@webiny/api-headless-cms-ddb-es 6.0.0-alpha.5 → 6.0.0-rc.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 (282) hide show
  1. package/README.md +6 -30
  2. package/configurations.d.ts +4 -5
  3. package/configurations.js +12 -24
  4. package/configurations.js.map +1 -1
  5. package/definitions/entry.d.ts +4 -6
  6. package/definitions/entry.js +5 -174
  7. package/definitions/entry.js.map +1 -1
  8. package/definitions/group.d.ts +6 -7
  9. package/definitions/group.js +5 -58
  10. package/definitions/group.js.map +1 -1
  11. package/definitions/model.d.ts +6 -7
  12. package/definitions/model.js +5 -102
  13. package/definitions/model.js.map +1 -1
  14. package/definitions/types.d.ts +59 -0
  15. package/definitions/types.js +3 -0
  16. package/definitions/types.js.map +1 -0
  17. package/dynamoDb/index.d.ts +2 -2
  18. package/dynamoDb/index.js +5 -13
  19. package/dynamoDb/index.js.map +1 -1
  20. package/dynamoDb/storage/longText.js +10 -18
  21. package/dynamoDb/storage/longText.js.map +1 -1
  22. package/dynamoDb/storage/richText.js +10 -18
  23. package/dynamoDb/storage/richText.js.map +1 -1
  24. package/elasticsearch/createElasticsearchIndex.d.ts +1 -1
  25. package/elasticsearch/createElasticsearchIndex.js +7 -15
  26. package/elasticsearch/createElasticsearchIndex.js.map +1 -1
  27. package/elasticsearch/deleteElasticsearchIndex.d.ts +1 -1
  28. package/elasticsearch/deleteElasticsearchIndex.js +3 -10
  29. package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
  30. package/elasticsearch/index.d.ts +1 -1
  31. package/elasticsearch/index.js +3 -11
  32. package/elasticsearch/index.js.map +1 -1
  33. package/elasticsearch/indexing/dateTimeIndexing.d.ts +1 -1
  34. package/elasticsearch/indexing/dateTimeIndexing.js +1 -8
  35. package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -1
  36. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +1 -1
  37. package/elasticsearch/indexing/defaultFieldIndexing.js +1 -8
  38. package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -1
  39. package/elasticsearch/indexing/index.d.ts +1 -1
  40. package/elasticsearch/indexing/index.js +8 -16
  41. package/elasticsearch/indexing/index.js.map +1 -1
  42. package/elasticsearch/indexing/jsonIndexing.d.ts +1 -1
  43. package/elasticsearch/indexing/jsonIndexing.js +1 -8
  44. package/elasticsearch/indexing/jsonIndexing.js.map +1 -1
  45. package/elasticsearch/indexing/longTextIndexing.d.ts +1 -1
  46. package/elasticsearch/indexing/longTextIndexing.js +1 -8
  47. package/elasticsearch/indexing/longTextIndexing.js.map +1 -1
  48. package/elasticsearch/indexing/numberIndexing.d.ts +1 -1
  49. package/elasticsearch/indexing/numberIndexing.js +1 -8
  50. package/elasticsearch/indexing/numberIndexing.js.map +1 -1
  51. package/elasticsearch/indexing/objectIndexing.d.ts +1 -1
  52. package/elasticsearch/indexing/objectIndexing.js +6 -13
  53. package/elasticsearch/indexing/objectIndexing.js.map +1 -1
  54. package/elasticsearch/indexing/richTextIndexing.d.ts +1 -1
  55. package/elasticsearch/indexing/richTextIndexing.js +1 -8
  56. package/elasticsearch/indexing/richTextIndexing.js.map +1 -1
  57. package/elasticsearch/indices/base.d.ts +1 -1
  58. package/elasticsearch/indices/base.js +4 -10
  59. package/elasticsearch/indices/base.js.map +1 -1
  60. package/elasticsearch/indices/index.d.ts +1 -1
  61. package/elasticsearch/indices/index.js +3 -11
  62. package/elasticsearch/indices/index.js.map +1 -1
  63. package/elasticsearch/search/index.d.ts +1 -1
  64. package/elasticsearch/search/index.js +4 -11
  65. package/elasticsearch/search/index.js.map +1 -1
  66. package/elasticsearch/search/refSearch.d.ts +1 -1
  67. package/elasticsearch/search/refSearch.js +3 -10
  68. package/elasticsearch/search/refSearch.js.map +1 -1
  69. package/elasticsearch/search/searchableJson.d.ts +1 -1
  70. package/elasticsearch/search/searchableJson.js +9 -16
  71. package/elasticsearch/search/searchableJson.js.map +1 -1
  72. package/elasticsearch/search/timeSearch.d.ts +1 -1
  73. package/elasticsearch/search/timeSearch.js +3 -10
  74. package/elasticsearch/search/timeSearch.js.map +1 -1
  75. package/helpers/entryIndexHelpers.d.ts +9 -9
  76. package/helpers/entryIndexHelpers.js +32 -26
  77. package/helpers/entryIndexHelpers.js.map +1 -1
  78. package/helpers/fieldIdentifier.d.ts +1 -1
  79. package/helpers/fieldIdentifier.js +2 -10
  80. package/helpers/fieldIdentifier.js.map +1 -1
  81. package/helpers/index.d.ts +2 -2
  82. package/helpers/index.js +2 -27
  83. package/helpers/index.js.map +1 -1
  84. package/index.d.ts +2 -2
  85. package/index.js +98 -133
  86. package/index.js.map +1 -1
  87. package/operations/entry/dataLoader/DataLoaderCache.d.ts +0 -2
  88. package/operations/entry/dataLoader/DataLoaderCache.js +2 -9
  89. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  90. package/operations/entry/dataLoader/constants.js +1 -7
  91. package/operations/entry/dataLoader/constants.js.map +1 -1
  92. package/operations/entry/dataLoader/createBatchScheduleFn.js +4 -10
  93. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  94. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
  95. package/operations/entry/dataLoader/getAllEntryRevisions.js +11 -24
  96. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  97. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
  98. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +18 -30
  99. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  100. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
  101. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +18 -30
  102. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  103. package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
  104. package/operations/entry/dataLoader/getRevisionById.js +23 -35
  105. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  106. package/operations/entry/dataLoader/index.d.ts +3 -3
  107. package/operations/entry/dataLoader/index.js +10 -31
  108. package/operations/entry/dataLoader/index.js.map +1 -1
  109. package/operations/entry/dataLoader/types.d.ts +3 -4
  110. package/operations/entry/dataLoader/types.js +1 -5
  111. package/operations/entry/dataLoader/types.js.map +1 -1
  112. package/operations/entry/dataLoaders.d.ts +13 -13
  113. package/operations/entry/dataLoaders.js +15 -25
  114. package/operations/entry/dataLoaders.js.map +1 -1
  115. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +1 -1
  116. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +1 -8
  117. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -1
  118. package/operations/entry/elasticsearch/body.d.ts +2 -2
  119. package/operations/entry/elasticsearch/body.js +21 -28
  120. package/operations/entry/elasticsearch/body.js.map +1 -1
  121. package/operations/entry/elasticsearch/fields.d.ts +2 -2
  122. package/operations/entry/elasticsearch/fields.js +110 -24
  123. package/operations/entry/elasticsearch/fields.js.map +1 -1
  124. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +2 -2
  125. package/operations/entry/elasticsearch/filtering/applyFiltering.js +9 -17
  126. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -1
  127. package/operations/entry/elasticsearch/filtering/exec.d.ts +6 -5
  128. package/operations/entry/elasticsearch/filtering/exec.js +48 -45
  129. package/operations/entry/elasticsearch/filtering/exec.js.map +1 -1
  130. package/operations/entry/elasticsearch/filtering/index.d.ts +1 -1
  131. package/operations/entry/elasticsearch/filtering/index.js +1 -16
  132. package/operations/entry/elasticsearch/filtering/index.js.map +1 -1
  133. package/operations/entry/elasticsearch/filtering/path.d.ts +1 -1
  134. package/operations/entry/elasticsearch/filtering/path.js +5 -15
  135. package/operations/entry/elasticsearch/filtering/path.js.map +1 -1
  136. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +1 -1
  137. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +6 -14
  138. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -1
  139. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -1
  140. package/operations/entry/elasticsearch/filtering/plugins/index.js +5 -12
  141. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -1
  142. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +1 -1
  143. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +7 -15
  144. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -1
  145. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +1 -1
  146. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +7 -15
  147. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -1
  148. package/operations/entry/elasticsearch/filtering/populated.d.ts +1 -1
  149. package/operations/entry/elasticsearch/filtering/populated.js +1 -8
  150. package/operations/entry/elasticsearch/filtering/populated.js.map +1 -1
  151. package/operations/entry/elasticsearch/filtering/values.d.ts +1 -1
  152. package/operations/entry/elasticsearch/filtering/values.js +4 -12
  153. package/operations/entry/elasticsearch/filtering/values.js.map +1 -1
  154. package/operations/entry/elasticsearch/fullTextSearch.d.ts +2 -2
  155. package/operations/entry/elasticsearch/fullTextSearch.js +6 -12
  156. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -1
  157. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +1 -1
  158. package/operations/entry/elasticsearch/fullTextSearchFields.js +1 -8
  159. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -1
  160. package/operations/entry/elasticsearch/initialQuery.d.ts +2 -2
  161. package/operations/entry/elasticsearch/initialQuery.js +9 -27
  162. package/operations/entry/elasticsearch/initialQuery.js.map +1 -1
  163. package/operations/entry/elasticsearch/keyword.d.ts +1 -1
  164. package/operations/entry/elasticsearch/keyword.js +4 -9
  165. package/operations/entry/elasticsearch/keyword.js.map +1 -1
  166. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +2 -2
  167. package/operations/entry/elasticsearch/plugins/bodyModifier.js +3 -10
  168. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -1
  169. package/operations/entry/elasticsearch/plugins/operator.d.ts +1 -2
  170. package/operations/entry/elasticsearch/plugins/operator.js +4 -19
  171. package/operations/entry/elasticsearch/plugins/operator.js.map +1 -1
  172. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +2 -2
  173. package/operations/entry/elasticsearch/plugins/queryModifier.js +3 -10
  174. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -1
  175. package/operations/entry/elasticsearch/plugins/search.d.ts +1 -1
  176. package/operations/entry/elasticsearch/plugins/search.js +5 -13
  177. package/operations/entry/elasticsearch/plugins/search.js.map +1 -1
  178. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +2 -2
  179. package/operations/entry/elasticsearch/plugins/sortModifier.js +3 -10
  180. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -1
  181. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +1 -8
  182. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -1
  183. package/operations/entry/elasticsearch/sort.d.ts +3 -3
  184. package/operations/entry/elasticsearch/sort.js +51 -33
  185. package/operations/entry/elasticsearch/sort.js.map +1 -1
  186. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +2 -2
  187. package/operations/entry/elasticsearch/transformValueForSearch.js +4 -9
  188. package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -1
  189. package/operations/entry/elasticsearch/types.d.ts +2 -2
  190. package/operations/entry/elasticsearch/types.js +1 -5
  191. package/operations/entry/elasticsearch/types.js.map +1 -1
  192. package/operations/entry/index.d.ts +5 -4
  193. package/operations/entry/index.js +333 -515
  194. package/operations/entry/index.js.map +1 -1
  195. package/operations/entry/keys.d.ts +31 -1
  196. package/operations/entry/keys.js +56 -19
  197. package/operations/entry/keys.js.map +1 -1
  198. package/operations/entry/recordType.js +3 -12
  199. package/operations/entry/recordType.js.map +1 -1
  200. package/operations/entry/transformations/convertEntryKeys.d.ts +6 -6
  201. package/operations/entry/transformations/convertEntryKeys.js +2 -10
  202. package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
  203. package/operations/entry/transformations/index.d.ts +16 -16
  204. package/operations/entry/transformations/index.js +22 -30
  205. package/operations/entry/transformations/index.js.map +1 -1
  206. package/operations/entry/transformations/modifyEntryValues.d.ts +27 -34
  207. package/operations/entry/transformations/modifyEntryValues.js +1 -8
  208. package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
  209. package/operations/entry/transformations/transformEntryKeys.d.ts +8 -8
  210. package/operations/entry/transformations/transformEntryKeys.js +4 -11
  211. package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
  212. package/operations/entry/transformations/transformEntryToIndex.d.ts +6 -6
  213. package/operations/entry/transformations/transformEntryToIndex.js +3 -10
  214. package/operations/entry/transformations/transformEntryToIndex.js.map +1 -1
  215. package/operations/group/index.d.ts +5 -4
  216. package/operations/group/index.js +39 -73
  217. package/operations/group/index.js.map +1 -1
  218. package/operations/model/index.d.ts +3 -3
  219. package/operations/model/index.js +38 -57
  220. package/operations/model/index.js.map +1 -1
  221. package/package.json +27 -32
  222. package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +1 -1
  223. package/plugins/CmsElasticsearchModelFieldPlugin.js +2 -8
  224. package/plugins/CmsElasticsearchModelFieldPlugin.js.map +1 -1
  225. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +1 -1
  226. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +3 -11
  227. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -1
  228. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +2 -2
  229. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +3 -11
  230. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -1
  231. package/plugins/CmsEntryElasticsearchIndexPlugin.js +2 -9
  232. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -1
  233. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +2 -2
  234. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +3 -11
  235. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -1
  236. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +1 -1
  237. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +3 -11
  238. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -1
  239. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +1 -1
  240. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +3 -11
  241. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -1
  242. package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +12 -12
  243. package/plugins/CmsEntryElasticsearchValuesModifier.js +4 -12
  244. package/plugins/CmsEntryElasticsearchValuesModifier.js.map +1 -1
  245. package/plugins/CmsEntryFilterPlugin.d.ts +3 -3
  246. package/plugins/CmsEntryFilterPlugin.js +2 -9
  247. package/plugins/CmsEntryFilterPlugin.js.map +1 -1
  248. package/plugins/index.d.ts +8 -8
  249. package/plugins/index.js +8 -93
  250. package/plugins/index.js.map +1 -1
  251. package/tasks/createIndexTaskPlugin.d.ts +2 -2
  252. package/tasks/createIndexTaskPlugin.js +36 -62
  253. package/tasks/createIndexTaskPlugin.js.map +1 -1
  254. package/types.d.ts +23 -26
  255. package/types.js +5 -8
  256. package/types.js.map +1 -1
  257. package/values/NoValueContainer.js +1 -8
  258. package/values/NoValueContainer.js.map +1 -1
  259. package/definitions/entryElasticsearch.d.ts +0 -9
  260. package/definitions/entryElasticsearch.js +0 -41
  261. package/definitions/entryElasticsearch.js.map +0 -1
  262. package/definitions/system.d.ts +0 -9
  263. package/definitions/system.js +0 -42
  264. package/definitions/system.js.map +0 -1
  265. package/definitions/table.d.ts +0 -8
  266. package/definitions/table.js +0 -25
  267. package/definitions/table.js.map +0 -1
  268. package/definitions/tableElasticsearch.d.ts +0 -8
  269. package/definitions/tableElasticsearch.js +0 -25
  270. package/definitions/tableElasticsearch.js.map +0 -1
  271. package/elasticsearch/indices/japanese.d.ts +0 -2
  272. package/elasticsearch/indices/japanese.js +0 -14
  273. package/elasticsearch/indices/japanese.js.map +0 -1
  274. package/operations/entry/elasticsearch/logIgnoredEsResponseError.d.ts +0 -9
  275. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js +0 -26
  276. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js.map +0 -1
  277. package/operations/system/index.d.ts +0 -6
  278. package/operations/system/index.js +0 -94
  279. package/operations/system/index.js.map +0 -1
  280. package/operations/system/indexes.d.ts +0 -10
  281. package/operations/system/indexes.js +0 -41
  282. package/operations/system/indexes.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["createFullTextSearchFields","params","term","model","fields","length","trim","reduce","collection","fieldId","field","find","f","push","exports"],"sources":["fullTextSearchFields.ts"],"sourcesContent":["import type { CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types\";\n\ninterface Params {\n model: CmsModel;\n term?: string;\n fields?: string[];\n}\nexport const createFullTextSearchFields = (params: Params): CmsModelField[] => {\n const { term, model, fields } = params;\n if (!fields || fields.length === 0 || !term || term.trim().length === 0) {\n return [];\n }\n return fields.reduce<CmsModelField[]>((collection, fieldId) => {\n const field = model.fields.find(f => f.fieldId === fieldId);\n if (!field) {\n return collection;\n }\n collection.push(field);\n return collection;\n }, []);\n};\n"],"mappings":";;;;;;AAOO,MAAMA,0BAA0B,GAAIC,MAAc,IAAsB;EAC3E,MAAM;IAAEC,IAAI;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAAGH,MAAM;EACtC,IAAI,CAACG,MAAM,IAAIA,MAAM,CAACC,MAAM,KAAK,CAAC,IAAI,CAACH,IAAI,IAAIA,IAAI,CAACI,IAAI,CAAC,CAAC,CAACD,MAAM,KAAK,CAAC,EAAE;IACrE,OAAO,EAAE;EACb;EACA,OAAOD,MAAM,CAACG,MAAM,CAAkB,CAACC,UAAU,EAAEC,OAAO,KAAK;IAC3D,MAAMC,KAAK,GAAGP,KAAK,CAACC,MAAM,CAACO,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACH,OAAO,KAAKA,OAAO,CAAC;IAC3D,IAAI,CAACC,KAAK,EAAE;MACR,OAAOF,UAAU;IACrB;IACAA,UAAU,CAACK,IAAI,CAACH,KAAK,CAAC;IACtB,OAAOF,UAAU;EACrB,CAAC,EAAE,EAAE,CAAC;AACV,CAAC;AAACM,OAAA,CAAAd,0BAAA,GAAAA,0BAAA","ignoreList":[]}
1
+ {"version":3,"names":["createFullTextSearchFields","params","term","model","fields","length","trim","reduce","collection","fieldId","field","find","f","push"],"sources":["fullTextSearchFields.ts"],"sourcesContent":["import type { CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n model: CmsModel;\n term?: string;\n fields?: string[];\n}\nexport const createFullTextSearchFields = (params: Params): CmsModelField[] => {\n const { term, model, fields } = params;\n if (!fields || fields.length === 0 || !term || term.trim().length === 0) {\n return [];\n }\n return fields.reduce<CmsModelField[]>((collection, fieldId) => {\n const field = model.fields.find(f => f.fieldId === fieldId);\n if (!field) {\n return collection;\n }\n collection.push(field);\n return collection;\n }, []);\n};\n"],"mappings":"AAOA,OAAO,MAAMA,0BAA0B,GAAIC,MAAc,IAAsB;EAC3E,MAAM;IAAEC,IAAI;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAAGH,MAAM;EACtC,IAAI,CAACG,MAAM,IAAIA,MAAM,CAACC,MAAM,KAAK,CAAC,IAAI,CAACH,IAAI,IAAIA,IAAI,CAACI,IAAI,CAAC,CAAC,CAACD,MAAM,KAAK,CAAC,EAAE;IACrE,OAAO,EAAE;EACb;EACA,OAAOD,MAAM,CAACG,MAAM,CAAkB,CAACC,UAAU,EAAEC,OAAO,KAAK;IAC3D,MAAMC,KAAK,GAAGP,KAAK,CAACC,MAAM,CAACO,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACH,OAAO,KAAKA,OAAO,CAAC;IAC3D,IAAI,CAACC,KAAK,EAAE;MACR,OAAOF,UAAU;IACrB;IACAA,UAAU,CAACK,IAAI,CAACH,KAAK,CAAC;IACtB,OAAOF,UAAU;EACrB,CAAC,EAAE,EAAE,CAAC;AACV,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import type { ElasticsearchBoolQueryConfig } from "@webiny/api-elasticsearch/types";
2
- import type { CmsEntryListWhere, CmsModel } from "@webiny/api-headless-cms/types";
1
+ import type { ElasticsearchBoolQueryConfig } from "@webiny/api-elasticsearch/types.js";
2
+ import type { CmsEntryListWhere, CmsModel } from "@webiny/api-headless-cms/types/index.js";
3
3
  export declare const createBaseQuery: () => ElasticsearchBoolQueryConfig;
4
4
  interface Params {
5
5
  model: CmsModel;
@@ -1,14 +1,7 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createInitialQuery = exports.createBaseQuery = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _recordType = require("../recordType");
10
- var _apiElasticsearch = require("@webiny/api-elasticsearch");
11
- const createBaseQuery = () => {
1
+ import WebinyError from "@webiny/error";
2
+ import { createLatestRecordType, createPublishedRecordType } from "../recordType.js";
3
+ import { isSharedElasticsearchIndex } from "@webiny/api-elasticsearch";
4
+ export const createBaseQuery = () => {
12
5
  return {
13
6
  must: [],
14
7
  must_not: [],
@@ -16,7 +9,6 @@ const createBaseQuery = () => {
16
9
  filter: []
17
10
  };
18
11
  };
19
- exports.createBaseQuery = createBaseQuery;
20
12
  /**
21
13
  * Latest and published are specific in Elasticsearch to that extend that they are tagged in the __type property.
22
14
  * We allow either published or either latest.
@@ -25,7 +17,7 @@ exports.createBaseQuery = createBaseQuery;
25
17
  *
26
18
  * We add the query.filter terms because we do not need scored search here and it is a bit faster.
27
19
  */
28
- const createInitialQuery = params => {
20
+ export const createInitialQuery = params => {
29
21
  const {
30
22
  model,
31
23
  where
@@ -37,7 +29,7 @@ const createInitialQuery = params => {
37
29
  *
38
30
  * TODO determine if we want to search across tenants in shared index?
39
31
  */
40
- const sharedIndex = (0, _apiElasticsearch.isSharedElasticsearchIndex)();
32
+ const sharedIndex = isSharedElasticsearchIndex();
41
33
  if (sharedIndex) {
42
34
  /**
43
35
  * Tenant for the filtering is taken from the model.
@@ -57,15 +49,6 @@ const createInitialQuery = params => {
57
49
  "modelId.keyword": model.modelId
58
50
  }
59
51
  });
60
- /**
61
- * TODO determine if we want to search across locales?
62
- * This search would anyway work for a single model and when sharing index.
63
- */
64
- query.filter.push({
65
- term: {
66
- "locale.keyword": model.locale
67
- }
68
- });
69
52
  }
70
53
 
71
54
  /**
@@ -74,13 +57,13 @@ const createInitialQuery = params => {
74
57
  if (where.published === true) {
75
58
  query.filter.push({
76
59
  term: {
77
- "__type.keyword": (0, _recordType.createPublishedRecordType)()
60
+ "__type.keyword": createPublishedRecordType()
78
61
  }
79
62
  });
80
63
  } else if (where.latest === true) {
81
64
  query.filter.push({
82
65
  term: {
83
- "__type.keyword": (0, _recordType.createLatestRecordType)()
66
+ "__type.keyword": createLatestRecordType()
84
67
  }
85
68
  });
86
69
  }
@@ -89,7 +72,7 @@ const createInitialQuery = params => {
89
72
  * We do not allow filtering without the published or latest parameter.
90
73
  * Also, we do not want to set the default one, as there is a large possibility for user error when filtering.
91
74
  */else {
92
- throw new _error.default(`Cannot call Elasticsearch query when not setting "published" or "latest".`, "ELASTICSEARCH_UNSUPPORTED_QUERY", {
75
+ throw new WebinyError(`Cannot call Elasticsearch query when not setting "published" or "latest".`, "OPENSEARCH_UNSUPPORTED_QUERY", {
93
76
  where
94
77
  });
95
78
  }
@@ -101,6 +84,5 @@ const createInitialQuery = params => {
101
84
  delete where.latest;
102
85
  return query;
103
86
  };
104
- exports.createInitialQuery = createInitialQuery;
105
87
 
106
88
  //# sourceMappingURL=initialQuery.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_recordType","_apiElasticsearch","createBaseQuery","must","must_not","should","filter","exports","createInitialQuery","params","model","where","query","sharedIndex","isSharedElasticsearchIndex","push","term","tenant","modelId","locale","published","createPublishedRecordType","latest","createLatestRecordType","WebinyError"],"sources":["initialQuery.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { ElasticsearchBoolQueryConfig } from \"@webiny/api-elasticsearch/types\";\nimport type { CmsEntryListWhere, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { createLatestRecordType, createPublishedRecordType } from \"../recordType\";\nimport { isSharedElasticsearchIndex } from \"@webiny/api-elasticsearch\";\n\nexport const createBaseQuery = (): ElasticsearchBoolQueryConfig => {\n return {\n must: [],\n must_not: [],\n should: [],\n filter: []\n };\n};\n\ninterface Params {\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): ElasticsearchBoolQueryConfig => {\n const { model, where } = params;\n\n const query = createBaseQuery();\n\n /**\n * When ES index is shared between tenants, we need to filter records by tenant ID\n *\n * TODO determine if we want to search across tenants in shared index?\n */\n const sharedIndex = isSharedElasticsearchIndex();\n if (sharedIndex) {\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 * TODO determine if we want to search across locales?\n * This search would anyway work for a single model and when sharing index.\n */\n query.filter.push({\n term: {\n \"locale.keyword\": model.locale\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 \"ELASTICSEARCH_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"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEO,MAAMG,eAAe,GAAGA,CAAA,KAAoC;EAC/D,OAAO;IACHC,IAAI,EAAE,EAAE;IACRC,QAAQ,EAAE,EAAE;IACZC,MAAM,EAAE,EAAE;IACVC,MAAM,EAAE;EACZ,CAAC;AACL,CAAC;AAACC,OAAA,CAAAL,eAAA,GAAAA,eAAA;AAMF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMM,kBAAkB,GAAIC,MAAc,IAAmC;EAChF,MAAM;IAAEC,KAAK;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAE/B,MAAMG,KAAK,GAAGV,eAAe,CAAC,CAAC;;EAE/B;AACJ;AACA;AACA;AACA;EACI,MAAMW,WAAW,GAAG,IAAAC,4CAA0B,EAAC,CAAC;EAChD,IAAID,WAAW,EAAE;IACb;AACR;AACA;AACA;AACA;IACQD,KAAK,CAACN,MAAM,CAACS,IAAI,CAAC;MACdC,IAAI,EAAE;QACF,gBAAgB,EAAEN,KAAK,CAACO;MAC5B;IACJ,CAAC,CAAC;IACF;AACR;AACA;IACQL,KAAK,CAACN,MAAM,CAACS,IAAI,CAAC;MACdC,IAAI,EAAE;QACF,iBAAiB,EAAEN,KAAK,CAACQ;MAC7B;IACJ,CAAC,CAAC;IACF;AACR;AACA;AACA;IACQN,KAAK,CAACN,MAAM,CAACS,IAAI,CAAC;MACdC,IAAI,EAAE;QACF,gBAAgB,EAAEN,KAAK,CAACS;MAC5B;IACJ,CAAC,CAAC;EACN;;EAEA;AACJ;AACA;EACI,IAAIR,KAAK,CAACS,SAAS,KAAK,IAAI,EAAE;IAC1BR,KAAK,CAACN,MAAM,CAACS,IAAI,CAAC;MACdC,IAAI,EAAE;QACF,gBAAgB,EAAE,IAAAK,qCAAyB,EAAC;MAChD;IACJ,CAAC,CAAC;EACN,CAAC,MAAM,IAAIV,KAAK,CAACW,MAAM,KAAK,IAAI,EAAE;IAC9BV,KAAK,CAACN,MAAM,CAACS,IAAI,CAAC;MACdC,IAAI,EAAE;QACF,gBAAgB,EAAE,IAAAO,kCAAsB,EAAC;MAC7C;IACJ,CAAC,CAAC;EACN;EACA;EACA;AACJ;AACA;AACA,KAHI,KAIK;IACD,MAAM,IAAIC,cAAW,CACjB,2EAA2E,EAC3E,iCAAiC,EACjC;MACIb;IACJ,CACJ,CAAC;EACL;EACA;AACJ;AACA;AACA;EACI,OAAOA,KAAK,CAACS,SAAS;EACtB,OAAOT,KAAK,CAACW,MAAM;EAEnB,OAAOV,KAAK;AAChB,CAAC;AAACL,OAAA,CAAAC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
1
+ {"version":3,"names":["WebinyError","createLatestRecordType","createPublishedRecordType","isSharedElasticsearchIndex","createBaseQuery","must","must_not","should","filter","createInitialQuery","params","model","where","query","sharedIndex","push","term","tenant","modelId","published","latest"],"sources":["initialQuery.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { ElasticsearchBoolQueryConfig } from \"@webiny/api-elasticsearch/types.js\";\nimport type { CmsEntryListWhere, CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createLatestRecordType, createPublishedRecordType } from \"../recordType.js\";\nimport { isSharedElasticsearchIndex } from \"@webiny/api-elasticsearch\";\n\nexport const createBaseQuery = (): ElasticsearchBoolQueryConfig => {\n return {\n must: [],\n must_not: [],\n should: [],\n filter: []\n };\n};\n\ninterface Params {\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): ElasticsearchBoolQueryConfig => {\n const { model, where } = params;\n\n const query = createBaseQuery();\n\n /**\n * When ES index is shared between tenants, we need to filter records by tenant ID\n *\n * TODO determine if we want to search across tenants in shared index?\n */\n const sharedIndex = isSharedElasticsearchIndex();\n if (sharedIndex) {\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"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AAGvC,SAASC,sBAAsB,EAAEC,yBAAyB;AAC1D,SAASC,0BAA0B,QAAQ,2BAA2B;AAEtE,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAAoC;EAC/D,OAAO;IACHC,IAAI,EAAE,EAAE;IACRC,QAAQ,EAAE,EAAE;IACZC,MAAM,EAAE,EAAE;IACVC,MAAM,EAAE;EACZ,CAAC;AACL,CAAC;AAMD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAIC,MAAc,IAAmC;EAChF,MAAM;IAAEC,KAAK;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAE/B,MAAMG,KAAK,GAAGT,eAAe,CAAC,CAAC;;EAE/B;AACJ;AACA;AACA;AACA;EACI,MAAMU,WAAW,GAAGX,0BAA0B,CAAC,CAAC;EAChD,IAAIW,WAAW,EAAE;IACb;AACR;AACA;AACA;AACA;IACQD,KAAK,CAACL,MAAM,CAACO,IAAI,CAAC;MACdC,IAAI,EAAE;QACF,gBAAgB,EAAEL,KAAK,CAACM;MAC5B;IACJ,CAAC,CAAC;IACF;AACR;AACA;IACQJ,KAAK,CAACL,MAAM,CAACO,IAAI,CAAC;MACdC,IAAI,EAAE;QACF,iBAAiB,EAAEL,KAAK,CAACO;MAC7B;IACJ,CAAC,CAAC;EACN;;EAEA;AACJ;AACA;EACI,IAAIN,KAAK,CAACO,SAAS,KAAK,IAAI,EAAE;IAC1BN,KAAK,CAACL,MAAM,CAACO,IAAI,CAAC;MACdC,IAAI,EAAE;QACF,gBAAgB,EAAEd,yBAAyB,CAAC;MAChD;IACJ,CAAC,CAAC;EACN,CAAC,MAAM,IAAIU,KAAK,CAACQ,MAAM,KAAK,IAAI,EAAE;IAC9BP,KAAK,CAACL,MAAM,CAACO,IAAI,CAAC;MACdC,IAAI,EAAE;QACF,gBAAgB,EAAEf,sBAAsB,CAAC;MAC7C;IACJ,CAAC,CAAC;EACN;EACA;EACA;AACJ;AACA;AACA,KAHI,KAIK;IACD,MAAM,IAAID,WAAW,CACjB,2EAA2E,EAC3E,8BAA8B,EAC9B;MACIY;IACJ,CACJ,CAAC;EACL;EACA;AACJ;AACA;AACA;EACI,OAAOA,KAAK,CAACO,SAAS;EACtB,OAAOP,KAAK,CAACQ,MAAM;EAEnB,OAAOP,KAAK;AAChB,CAAC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import type { ModelField } from "./types";
1
+ import type { ModelField } from "./types.js";
2
2
  export declare const hasKeyword: (field: ModelField) => boolean;
@@ -1,15 +1,11 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.hasKeyword = void 0;
1
+ import { getBaseFieldType } from "@webiny/api-headless-cms/utils/getBaseFieldType.js";
7
2
  const noKeywordFields = ["date", "datetime", "number", "boolean"];
8
- const hasKeyword = field => {
3
+ export const hasKeyword = field => {
4
+ const fieldType = getBaseFieldType(field);
9
5
  /**
10
6
  * We defined some field types that MUST have no keyword added to the field path
11
7
  */
12
- if (noKeywordFields.includes(field.type)) {
8
+ if (noKeywordFields.includes(fieldType)) {
13
9
  return false;
14
10
  }
15
11
  /**
@@ -31,6 +27,5 @@ const hasKeyword = field => {
31
27
  */
32
28
  return true;
33
29
  };
34
- exports.hasKeyword = hasKeyword;
35
30
 
36
31
  //# sourceMappingURL=keyword.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["noKeywordFields","hasKeyword","field","includes","type","unmappedType","keyword","exports"],"sources":["keyword.ts"],"sourcesContent":["import type { ModelField } from \"./types\";\n\nconst noKeywordFields: string[] = [\"date\", \"datetime\", \"number\", \"boolean\"];\nexport const hasKeyword = (field: ModelField): boolean => {\n /**\n * We defined some field types that MUST have no keyword added to the field path\n */\n if (noKeywordFields.includes(field.type)) {\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"],"mappings":";;;;;;AAEA,MAAMA,eAAyB,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC;AACpE,MAAMC,UAAU,GAAIC,KAAiB,IAAc;EACtD;AACJ;AACA;EACI,IAAIF,eAAe,CAACG,QAAQ,CAACD,KAAK,CAACE,IAAI,CAAC,EAAE;IACtC,OAAO,KAAK;EAChB;EACA;AACJ;AACA;EACI;EAAA,KACK,IAAIF,KAAK,CAACG,YAAY,EAAE;IACzB,OAAO,KAAK;EAChB;EACA;AACJ;AACA;EACI;EAAA,KACK,IAAIH,KAAK,CAACI,OAAO,KAAK,KAAK,EAAE;IAC9B,OAAO,KAAK;EAChB;EACA;AACJ;AACA;EACI,OAAO,IAAI;AACf,CAAC;AAACC,OAAA,CAAAN,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["getBaseFieldType","noKeywordFields","hasKeyword","field","fieldType","includes","unmappedType","keyword"],"sources":["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"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,oDAAoD;AAErF,MAAMC,eAAyB,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC;AAC3E,OAAO,MAAMC,UAAU,GAAIC,KAAiB,IAAc;EACtD,MAAMC,SAAS,GAAGJ,gBAAgB,CAACG,KAAK,CAAC;EACzC;AACJ;AACA;EACI,IAAIF,eAAe,CAACI,QAAQ,CAACD,SAAS,CAAC,EAAE;IACrC,OAAO,KAAK;EAChB;EACA;AACJ;AACA;EACI;EAAA,KACK,IAAID,KAAK,CAACG,YAAY,EAAE;IACzB,OAAO,KAAK;EAChB;EACA;AACJ;AACA;EACI;EAAA,KACK,IAAIH,KAAK,CAACI,OAAO,KAAK,KAAK,EAAE;IAC9B,OAAO,KAAK;EAChB;EACA;AACJ;AACA;EACI,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
@@ -1,6 +1,6 @@
1
- import { CmsEntryElasticsearchBodyModifierPlugin } from "../../../../plugins";
1
+ import { CmsEntryElasticsearchBodyModifierPlugin } from "../../../../plugins/index.js";
2
2
  import type { PluginsContainer } from "@webiny/plugins";
3
- import type { CmsModel } from "@webiny/api-headless-cms/types";
3
+ import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
4
4
  interface Params {
5
5
  plugins: PluginsContainer;
6
6
  model: CmsModel;
@@ -1,18 +1,11 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createBodyModifierPluginList = void 0;
7
- var _plugins = require("../../../../plugins");
8
- const createBodyModifierPluginList = ({
1
+ import { CmsEntryElasticsearchBodyModifierPlugin } from "../../../../plugins/index.js";
2
+ export const createBodyModifierPluginList = ({
9
3
  plugins,
10
4
  model
11
5
  }) => {
12
- return plugins.byType(_plugins.CmsEntryElasticsearchBodyModifierPlugin.type).filter(pl => {
6
+ return plugins.byType(CmsEntryElasticsearchBodyModifierPlugin.type).filter(pl => {
13
7
  return !pl.modelId || pl.modelId === model.modelId;
14
8
  });
15
9
  };
16
- exports.createBodyModifierPluginList = createBodyModifierPluginList;
17
10
 
18
11
  //# sourceMappingURL=bodyModifier.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","createBodyModifierPluginList","plugins","model","byType","CmsEntryElasticsearchBodyModifierPlugin","type","filter","pl","modelId","exports"],"sources":["bodyModifier.ts"],"sourcesContent":["import { CmsEntryElasticsearchBodyModifierPlugin } from \"~/plugins\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types\";\n\ninterface Params {\n plugins: PluginsContainer;\n model: CmsModel;\n}\nexport const createBodyModifierPluginList = ({ plugins, model }: Params) => {\n return plugins\n .byType<CmsEntryElasticsearchBodyModifierPlugin>(\n CmsEntryElasticsearchBodyModifierPlugin.type\n )\n .filter(pl => {\n return !pl.modelId || pl.modelId === model.modelId;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAQO,MAAMC,4BAA4B,GAAGA,CAAC;EAAEC,OAAO;EAAEC;AAAc,CAAC,KAAK;EACxE,OAAOD,OAAO,CACTE,MAAM,CACHC,gDAAuC,CAACC,IAC5C,CAAC,CACAC,MAAM,CAACC,EAAE,IAAI;IACV,OAAO,CAACA,EAAE,CAACC,OAAO,IAAID,EAAE,CAACC,OAAO,KAAKN,KAAK,CAACM,OAAO;EACtD,CAAC,CAAC;AACV,CAAC;AAACC,OAAA,CAAAT,4BAAA,GAAAA,4BAAA","ignoreList":[]}
1
+ {"version":3,"names":["CmsEntryElasticsearchBodyModifierPlugin","createBodyModifierPluginList","plugins","model","byType","type","filter","pl","modelId"],"sources":["bodyModifier.ts"],"sourcesContent":["import { CmsEntryElasticsearchBodyModifierPlugin } from \"~/plugins/index.js\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n plugins: PluginsContainer;\n model: CmsModel;\n}\nexport const createBodyModifierPluginList = ({ plugins, model }: Params) => {\n return plugins\n .byType<CmsEntryElasticsearchBodyModifierPlugin>(\n CmsEntryElasticsearchBodyModifierPlugin.type\n )\n .filter(pl => {\n return !pl.modelId || pl.modelId === model.modelId;\n });\n};\n"],"mappings":"AAAA,SAASA,uCAAuC;AAQhD,OAAO,MAAMC,4BAA4B,GAAGA,CAAC;EAAEC,OAAO;EAAEC;AAAc,CAAC,KAAK;EACxE,OAAOD,OAAO,CACTE,MAAM,CACHJ,uCAAuC,CAACK,IAC5C,CAAC,CACAC,MAAM,CAACC,EAAE,IAAI;IACV,OAAO,CAACA,EAAE,CAACC,OAAO,IAAID,EAAE,CAACC,OAAO,KAAKL,KAAK,CAACK,OAAO;EACtD,CAAC,CAAC;AACV,CAAC","ignoreList":[]}
@@ -1,8 +1,7 @@
1
1
  import type { PluginsContainer } from "@webiny/plugins";
2
- import type { ElasticsearchQueryBuilderOperatorPlugins } from "../types";
2
+ import type { ElasticsearchQueryBuilderOperatorPlugins } from "../types.js";
3
3
  interface Params {
4
4
  plugins: PluginsContainer;
5
- locale: string;
6
5
  }
7
6
  export declare const createOperatorPluginList: (params: Params) => ElasticsearchQueryBuilderOperatorPlugins;
8
7
  export {};
@@ -1,28 +1,14 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createOperatorPluginList = void 0;
7
- var _apiElasticsearch = require("@webiny/api-elasticsearch");
8
- const createOperatorPluginList = params => {
1
+ import { ElasticsearchQueryBuilderOperatorPlugin } from "@webiny/api-elasticsearch";
2
+ export const createOperatorPluginList = params => {
9
3
  const {
10
- plugins,
11
- locale
4
+ plugins
12
5
  } = params;
13
6
  /**
14
7
  * We always set the last one operator plugin added.
15
8
  * This way user can override the plugins.
16
9
  */
17
- return plugins.byType(_apiElasticsearch.ElasticsearchQueryBuilderOperatorPlugin.type).reduce((acc, plugin) => {
10
+ return plugins.byType(ElasticsearchQueryBuilderOperatorPlugin.type).reduce((acc, plugin) => {
18
11
  const operator = plugin.getOperator();
19
- /**
20
- * We only allow the plugins which can pass the locale test.
21
- * The default plugins always return true.
22
- */
23
- if (plugin.isLocaleSupported(locale) === false) {
24
- return acc;
25
- }
26
12
  /**
27
13
  * We also only allow the override of the plugins if the new plugin is NOT a default one.
28
14
  * If a user sets the plugin name ending with .default, we cannot do anything about it.
@@ -34,6 +20,5 @@ const createOperatorPluginList = params => {
34
20
  return acc;
35
21
  }, {});
36
22
  };
37
- exports.createOperatorPluginList = createOperatorPluginList;
38
23
 
39
24
  //# sourceMappingURL=operator.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_apiElasticsearch","require","createOperatorPluginList","params","plugins","locale","byType","ElasticsearchQueryBuilderOperatorPlugin","type","reduce","acc","plugin","operator","getOperator","isLocaleSupported","name","match","exports"],"sources":["operator.ts"],"sourcesContent":["import type { PluginsContainer } from \"@webiny/plugins\";\nimport { ElasticsearchQueryBuilderOperatorPlugin } from \"@webiny/api-elasticsearch\";\nimport type { ElasticsearchQueryBuilderOperatorPlugins } from \"../types\";\n\ninterface Params {\n plugins: PluginsContainer;\n locale: string;\n}\nexport const createOperatorPluginList = (\n params: Params\n): ElasticsearchQueryBuilderOperatorPlugins => {\n const { plugins, locale } = params;\n /**\n * We always set the last one operator plugin added.\n * This way user can override the plugins.\n */\n return plugins\n .byType<ElasticsearchQueryBuilderOperatorPlugin>(\n ElasticsearchQueryBuilderOperatorPlugin.type\n )\n .reduce<ElasticsearchQueryBuilderOperatorPlugins>((acc, plugin) => {\n const operator = plugin.getOperator();\n /**\n * We only allow the plugins which can pass the locale test.\n * The default plugins always return true.\n */\n if (plugin.isLocaleSupported(locale) === false) {\n return acc;\n }\n /**\n * We also only allow the override of the plugins if the new plugin is NOT a default one.\n * If a user sets the plugin name ending with .default, we cannot do anything about it.\n */\n if (!!acc[operator] && (plugin.name || \"\").match(/\\.default$/)) {\n return acc;\n }\n acc[operator] = plugin;\n return acc;\n }, {});\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAOO,MAAMC,wBAAwB,GACjCC,MAAc,IAC6B;EAC3C,MAAM;IAAEC,OAAO;IAAEC;EAAO,CAAC,GAAGF,MAAM;EAClC;AACJ;AACA;AACA;EACI,OAAOC,OAAO,CACTE,MAAM,CACHC,yDAAuC,CAACC,IAC5C,CAAC,CACAC,MAAM,CAA2C,CAACC,GAAG,EAAEC,MAAM,KAAK;IAC/D,MAAMC,QAAQ,GAAGD,MAAM,CAACE,WAAW,CAAC,CAAC;IACrC;AACZ;AACA;AACA;IACY,IAAIF,MAAM,CAACG,iBAAiB,CAACT,MAAM,CAAC,KAAK,KAAK,EAAE;MAC5C,OAAOK,GAAG;IACd;IACA;AACZ;AACA;AACA;IACY,IAAI,CAAC,CAACA,GAAG,CAACE,QAAQ,CAAC,IAAI,CAACD,MAAM,CAACI,IAAI,IAAI,EAAE,EAAEC,KAAK,CAAC,YAAY,CAAC,EAAE;MAC5D,OAAON,GAAG;IACd;IACAA,GAAG,CAACE,QAAQ,CAAC,GAAGD,MAAM;IACtB,OAAOD,GAAG;EACd,CAAC,EAAE,CAAC,CAAC,CAAC;AACd,CAAC;AAACO,OAAA,CAAAf,wBAAA,GAAAA,wBAAA","ignoreList":[]}
1
+ {"version":3,"names":["ElasticsearchQueryBuilderOperatorPlugin","createOperatorPluginList","params","plugins","byType","type","reduce","acc","plugin","operator","getOperator","name","match"],"sources":["operator.ts"],"sourcesContent":["import type { PluginsContainer } from \"@webiny/plugins\";\nimport { ElasticsearchQueryBuilderOperatorPlugin } from \"@webiny/api-elasticsearch\";\nimport type { ElasticsearchQueryBuilderOperatorPlugins } from \"../types.js\";\n\ninterface Params {\n plugins: PluginsContainer;\n}\nexport const createOperatorPluginList = (\n params: Params\n): ElasticsearchQueryBuilderOperatorPlugins => {\n const { plugins } = params;\n /**\n * We always set the last one operator plugin added.\n * This way user can override the plugins.\n */\n return plugins\n .byType<ElasticsearchQueryBuilderOperatorPlugin>(\n ElasticsearchQueryBuilderOperatorPlugin.type\n )\n .reduce<ElasticsearchQueryBuilderOperatorPlugins>((acc, plugin) => {\n const operator = plugin.getOperator();\n /**\n * We also only allow the override of the plugins if the new plugin is NOT a default one.\n * If a user sets the plugin name ending with .default, we cannot do anything about it.\n */\n if (!!acc[operator] && (plugin.name || \"\").match(/\\.default$/)) {\n return acc;\n }\n acc[operator] = plugin;\n return acc;\n }, {});\n};\n"],"mappings":"AACA,SAASA,uCAAuC,QAAQ,2BAA2B;AAMnF,OAAO,MAAMC,wBAAwB,GACjCC,MAAc,IAC6B;EAC3C,MAAM;IAAEC;EAAQ,CAAC,GAAGD,MAAM;EAC1B;AACJ;AACA;AACA;EACI,OAAOC,OAAO,CACTC,MAAM,CACHJ,uCAAuC,CAACK,IAC5C,CAAC,CACAC,MAAM,CAA2C,CAACC,GAAG,EAAEC,MAAM,KAAK;IAC/D,MAAMC,QAAQ,GAAGD,MAAM,CAACE,WAAW,CAAC,CAAC;IACrC;AACZ;AACA;AACA;IACY,IAAI,CAAC,CAACH,GAAG,CAACE,QAAQ,CAAC,IAAI,CAACD,MAAM,CAACG,IAAI,IAAI,EAAE,EAAEC,KAAK,CAAC,YAAY,CAAC,EAAE;MAC5D,OAAOL,GAAG;IACd;IACAA,GAAG,CAACE,QAAQ,CAAC,GAAGD,MAAM;IACtB,OAAOD,GAAG;EACd,CAAC,EAAE,CAAC,CAAC,CAAC;AACd,CAAC","ignoreList":[]}
@@ -1,6 +1,6 @@
1
- import { CmsEntryElasticsearchQueryModifierPlugin } from "../../../../plugins";
1
+ import { CmsEntryElasticsearchQueryModifierPlugin } from "../../../../plugins/index.js";
2
2
  import type { PluginsContainer } from "@webiny/plugins";
3
- import type { CmsModel } from "@webiny/api-headless-cms/types";
3
+ import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
4
4
  interface Params {
5
5
  plugins: PluginsContainer;
6
6
  model: CmsModel;
@@ -1,18 +1,11 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createQueryModifierPluginList = void 0;
7
- var _plugins = require("../../../../plugins");
8
- const createQueryModifierPluginList = ({
1
+ import { CmsEntryElasticsearchQueryModifierPlugin } from "../../../../plugins/index.js";
2
+ export const createQueryModifierPluginList = ({
9
3
  plugins,
10
4
  model
11
5
  }) => {
12
- return plugins.byType(_plugins.CmsEntryElasticsearchQueryModifierPlugin.type).filter(pl => {
6
+ return plugins.byType(CmsEntryElasticsearchQueryModifierPlugin.type).filter(pl => {
13
7
  return !pl.modelId || pl.modelId === model.modelId;
14
8
  });
15
9
  };
16
- exports.createQueryModifierPluginList = createQueryModifierPluginList;
17
10
 
18
11
  //# sourceMappingURL=queryModifier.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","createQueryModifierPluginList","plugins","model","byType","CmsEntryElasticsearchQueryModifierPlugin","type","filter","pl","modelId","exports"],"sources":["queryModifier.ts"],"sourcesContent":["import { CmsEntryElasticsearchQueryModifierPlugin } from \"~/plugins\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types\";\n\ninterface Params {\n plugins: PluginsContainer;\n model: CmsModel;\n}\nexport const createQueryModifierPluginList = ({ plugins, model }: Params) => {\n return plugins\n .byType<CmsEntryElasticsearchQueryModifierPlugin>(\n CmsEntryElasticsearchQueryModifierPlugin.type\n )\n .filter(pl => {\n return !pl.modelId || pl.modelId === model.modelId;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAQO,MAAMC,6BAA6B,GAAGA,CAAC;EAAEC,OAAO;EAAEC;AAAc,CAAC,KAAK;EACzE,OAAOD,OAAO,CACTE,MAAM,CACHC,iDAAwC,CAACC,IAC7C,CAAC,CACAC,MAAM,CAACC,EAAE,IAAI;IACV,OAAO,CAACA,EAAE,CAACC,OAAO,IAAID,EAAE,CAACC,OAAO,KAAKN,KAAK,CAACM,OAAO;EACtD,CAAC,CAAC;AACV,CAAC;AAACC,OAAA,CAAAT,6BAAA,GAAAA,6BAAA","ignoreList":[]}
1
+ {"version":3,"names":["CmsEntryElasticsearchQueryModifierPlugin","createQueryModifierPluginList","plugins","model","byType","type","filter","pl","modelId"],"sources":["queryModifier.ts"],"sourcesContent":["import { CmsEntryElasticsearchQueryModifierPlugin } from \"~/plugins/index.js\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n plugins: PluginsContainer;\n model: CmsModel;\n}\nexport const createQueryModifierPluginList = ({ plugins, model }: Params) => {\n return plugins\n .byType<CmsEntryElasticsearchQueryModifierPlugin>(\n CmsEntryElasticsearchQueryModifierPlugin.type\n )\n .filter(pl => {\n return !pl.modelId || pl.modelId === model.modelId;\n });\n};\n"],"mappings":"AAAA,SAASA,wCAAwC;AAQjD,OAAO,MAAMC,6BAA6B,GAAGA,CAAC;EAAEC,OAAO;EAAEC;AAAc,CAAC,KAAK;EACzE,OAAOD,OAAO,CACTE,MAAM,CACHJ,wCAAwC,CAACK,IAC7C,CAAC,CACAC,MAAM,CAACC,EAAE,IAAI;IACV,OAAO,CAACA,EAAE,CAACC,OAAO,IAAID,EAAE,CAACC,OAAO,KAAKL,KAAK,CAACK,OAAO;EACtD,CAAC,CAAC;AACV,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { PluginsContainer } from "@webiny/plugins";
2
- import type { ElasticsearchQuerySearchValuePlugins } from "../types";
2
+ import type { ElasticsearchQuerySearchValuePlugins } from "../types.js";
3
3
  interface Params {
4
4
  plugins: PluginsContainer;
5
5
  }
@@ -1,18 +1,11 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createSearchPluginList = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _plugins = require("../../../../plugins");
10
- const createSearchPluginList = ({
1
+ import WebinyError from "@webiny/error";
2
+ import { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from "../../../../plugins/index.js";
3
+ export const createSearchPluginList = ({
11
4
  plugins
12
5
  }) => {
13
- return plugins.byType(_plugins.CmsEntryElasticsearchQueryBuilderValueSearchPlugin.type).reduce((plugins, plugin) => {
6
+ return plugins.byType(CmsEntryElasticsearchQueryBuilderValueSearchPlugin.type).reduce((plugins, plugin) => {
14
7
  if (plugins[plugin.fieldType]) {
15
- throw new _error.default("There is a ElasticsearchQueryBuilderValueSearchPlugin defined for the field type.", "PLUGIN_ALREADY_EXISTS", {
8
+ throw new WebinyError("There is a ElasticsearchQueryBuilderValueSearchPlugin defined for the field type.", "PLUGIN_ALREADY_EXISTS", {
16
9
  fieldType: plugin.fieldType,
17
10
  name: plugin.name || "unknown"
18
11
  });
@@ -21,6 +14,5 @@ const createSearchPluginList = ({
21
14
  return plugins;
22
15
  }, {});
23
16
  };
24
- exports.createSearchPluginList = createSearchPluginList;
25
17
 
26
18
  //# sourceMappingURL=search.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_plugins","createSearchPluginList","plugins","byType","CmsEntryElasticsearchQueryBuilderValueSearchPlugin","type","reduce","plugin","fieldType","WebinyError","name","exports"],"sources":["search.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from \"~/plugins\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { ElasticsearchQuerySearchValuePlugins } from \"../types\";\n\ninterface Params {\n plugins: PluginsContainer;\n}\nexport const createSearchPluginList = ({\n plugins\n}: Params): ElasticsearchQuerySearchValuePlugins => {\n return plugins\n .byType<CmsEntryElasticsearchQueryBuilderValueSearchPlugin>(\n CmsEntryElasticsearchQueryBuilderValueSearchPlugin.type\n )\n .reduce<ElasticsearchQuerySearchValuePlugins>((plugins, plugin) => {\n if (plugins[plugin.fieldType]) {\n throw new WebinyError(\n \"There is a ElasticsearchQueryBuilderValueSearchPlugin defined for the field type.\",\n \"PLUGIN_ALREADY_EXISTS\",\n {\n fieldType: plugin.fieldType,\n name: plugin.name || \"unknown\"\n }\n );\n }\n plugins[plugin.fieldType] = plugin;\n\n return plugins;\n }, {});\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAOO,MAAME,sBAAsB,GAAGA,CAAC;EACnCC;AACI,CAAC,KAA2C;EAChD,OAAOA,OAAO,CACTC,MAAM,CACHC,2DAAkD,CAACC,IACvD,CAAC,CACAC,MAAM,CAAuC,CAACJ,OAAO,EAAEK,MAAM,KAAK;IAC/D,IAAIL,OAAO,CAACK,MAAM,CAACC,SAAS,CAAC,EAAE;MAC3B,MAAM,IAAIC,cAAW,CACjB,mFAAmF,EACnF,uBAAuB,EACvB;QACID,SAAS,EAAED,MAAM,CAACC,SAAS;QAC3BE,IAAI,EAAEH,MAAM,CAACG,IAAI,IAAI;MACzB,CACJ,CAAC;IACL;IACAR,OAAO,CAACK,MAAM,CAACC,SAAS,CAAC,GAAGD,MAAM;IAElC,OAAOL,OAAO;EAClB,CAAC,EAAE,CAAC,CAAC,CAAC;AACd,CAAC;AAACS,OAAA,CAAAV,sBAAA,GAAAA,sBAAA","ignoreList":[]}
1
+ {"version":3,"names":["WebinyError","CmsEntryElasticsearchQueryBuilderValueSearchPlugin","createSearchPluginList","plugins","byType","type","reduce","plugin","fieldType","name"],"sources":["search.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from \"~/plugins/index.js\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { ElasticsearchQuerySearchValuePlugins } from \"../types.js\";\n\ninterface Params {\n plugins: PluginsContainer;\n}\nexport const createSearchPluginList = ({\n plugins\n}: Params): ElasticsearchQuerySearchValuePlugins => {\n return plugins\n .byType<CmsEntryElasticsearchQueryBuilderValueSearchPlugin>(\n CmsEntryElasticsearchQueryBuilderValueSearchPlugin.type\n )\n .reduce<ElasticsearchQuerySearchValuePlugins>((plugins, plugin) => {\n if (plugins[plugin.fieldType]) {\n throw new WebinyError(\n \"There is a ElasticsearchQueryBuilderValueSearchPlugin defined for the field type.\",\n \"PLUGIN_ALREADY_EXISTS\",\n {\n fieldType: plugin.fieldType,\n name: plugin.name || \"unknown\"\n }\n );\n }\n plugins[plugin.fieldType] = plugin;\n\n return plugins;\n }, {});\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,kDAAkD;AAO3D,OAAO,MAAMC,sBAAsB,GAAGA,CAAC;EACnCC;AACI,CAAC,KAA2C;EAChD,OAAOA,OAAO,CACTC,MAAM,CACHH,kDAAkD,CAACI,IACvD,CAAC,CACAC,MAAM,CAAuC,CAACH,OAAO,EAAEI,MAAM,KAAK;IAC/D,IAAIJ,OAAO,CAACI,MAAM,CAACC,SAAS,CAAC,EAAE;MAC3B,MAAM,IAAIR,WAAW,CACjB,mFAAmF,EACnF,uBAAuB,EACvB;QACIQ,SAAS,EAAED,MAAM,CAACC,SAAS;QAC3BC,IAAI,EAAEF,MAAM,CAACE,IAAI,IAAI;MACzB,CACJ,CAAC;IACL;IACAN,OAAO,CAACI,MAAM,CAACC,SAAS,CAAC,GAAGD,MAAM;IAElC,OAAOJ,OAAO;EAClB,CAAC,EAAE,CAAC,CAAC,CAAC;AACd,CAAC","ignoreList":[]}
@@ -1,6 +1,6 @@
1
- import { CmsEntryElasticsearchSortModifierPlugin } from "../../../../plugins";
1
+ import { CmsEntryElasticsearchSortModifierPlugin } from "../../../../plugins/index.js";
2
2
  import type { PluginsContainer } from "@webiny/plugins";
3
- import type { CmsModel } from "@webiny/api-headless-cms/types";
3
+ import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
4
4
  interface Params {
5
5
  plugins: PluginsContainer;
6
6
  model: CmsModel;
@@ -1,18 +1,11 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createSortModifierPluginList = void 0;
7
- var _plugins = require("../../../../plugins");
8
- const createSortModifierPluginList = ({
1
+ import { CmsEntryElasticsearchSortModifierPlugin } from "../../../../plugins/index.js";
2
+ export const createSortModifierPluginList = ({
9
3
  plugins,
10
4
  model
11
5
  }) => {
12
- return plugins.byType(_plugins.CmsEntryElasticsearchSortModifierPlugin.type).filter(pl => {
6
+ return plugins.byType(CmsEntryElasticsearchSortModifierPlugin.type).filter(pl => {
13
7
  return !pl.modelId || pl.modelId === model.modelId;
14
8
  });
15
9
  };
16
- exports.createSortModifierPluginList = createSortModifierPluginList;
17
10
 
18
11
  //# sourceMappingURL=sortModifier.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","createSortModifierPluginList","plugins","model","byType","CmsEntryElasticsearchSortModifierPlugin","type","filter","pl","modelId","exports"],"sources":["sortModifier.ts"],"sourcesContent":["import { CmsEntryElasticsearchSortModifierPlugin } from \"~/plugins\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types\";\n\ninterface Params {\n plugins: PluginsContainer;\n model: CmsModel;\n}\nexport const createSortModifierPluginList = ({ plugins, model }: Params) => {\n return plugins\n .byType<CmsEntryElasticsearchSortModifierPlugin>(\n CmsEntryElasticsearchSortModifierPlugin.type\n )\n .filter(pl => {\n return !pl.modelId || pl.modelId === model.modelId;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAQO,MAAMC,4BAA4B,GAAGA,CAAC;EAAEC,OAAO;EAAEC;AAAc,CAAC,KAAK;EACxE,OAAOD,OAAO,CACTE,MAAM,CACHC,gDAAuC,CAACC,IAC5C,CAAC,CACAC,MAAM,CAACC,EAAE,IAAI;IACV,OAAO,CAACA,EAAE,CAACC,OAAO,IAAID,EAAE,CAACC,OAAO,KAAKN,KAAK,CAACM,OAAO;EACtD,CAAC,CAAC;AACV,CAAC;AAACC,OAAA,CAAAT,4BAAA,GAAAA,4BAAA","ignoreList":[]}
1
+ {"version":3,"names":["CmsEntryElasticsearchSortModifierPlugin","createSortModifierPluginList","plugins","model","byType","type","filter","pl","modelId"],"sources":["sortModifier.ts"],"sourcesContent":["import { CmsEntryElasticsearchSortModifierPlugin } from \"~/plugins/index.js\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n plugins: PluginsContainer;\n model: CmsModel;\n}\nexport const createSortModifierPluginList = ({ plugins, model }: Params) => {\n return plugins\n .byType<CmsEntryElasticsearchSortModifierPlugin>(\n CmsEntryElasticsearchSortModifierPlugin.type\n )\n .filter(pl => {\n return !pl.modelId || pl.modelId === model.modelId;\n });\n};\n"],"mappings":"AAAA,SAASA,uCAAuC;AAQhD,OAAO,MAAMC,4BAA4B,GAAGA,CAAC;EAAEC,OAAO;EAAEC;AAAc,CAAC,KAAK;EACxE,OAAOD,OAAO,CACTE,MAAM,CACHJ,uCAAuC,CAACK,IAC5C,CAAC,CACAC,MAAM,CAACC,EAAE,IAAI;IACV,OAAO,CAACA,EAAE,CAACC,OAAO,IAAID,EAAE,CAACC,OAAO,KAAKL,KAAK,CAACK,OAAO;EACtD,CAAC,CAAC;AACV,CAAC","ignoreList":[]}
@@ -1,13 +1,6 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.shouldIgnoreEsResponseError = void 0;
7
1
  const IGNORED_ES_SEARCH_EXCEPTIONS = ["index_not_found_exception", "search_phase_execution_exception"];
8
- const shouldIgnoreEsResponseError = error => {
2
+ export const shouldIgnoreEsResponseError = error => {
9
3
  return IGNORED_ES_SEARCH_EXCEPTIONS.includes(error.message);
10
4
  };
11
- exports.shouldIgnoreEsResponseError = shouldIgnoreEsResponseError;
12
5
 
13
6
  //# sourceMappingURL=shouldIgnoreEsResponseError.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["IGNORED_ES_SEARCH_EXCEPTIONS","shouldIgnoreEsResponseError","error","includes","message","exports"],"sources":["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.includes(error.message);\n};\n"],"mappings":";;;;;;AAEA,MAAMA,4BAA4B,GAAG,CACjC,2BAA2B,EAC3B,kCAAkC,CACrC;AAEM,MAAMC,2BAA2B,GAAIC,KAAkB,IAAK;EAC/D,OAAOF,4BAA4B,CAACG,QAAQ,CAACD,KAAK,CAACE,OAAO,CAAC;AAC/D,CAAC;AAACC,OAAA,CAAAJ,2BAAA,GAAAA,2BAAA","ignoreList":[]}
1
+ {"version":3,"names":["IGNORED_ES_SEARCH_EXCEPTIONS","shouldIgnoreEsResponseError","error","includes","message"],"sources":["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.includes(error.message);\n};\n"],"mappings":"AAEA,MAAMA,4BAA4B,GAAG,CACjC,2BAA2B,EAC3B,kCAAkC,CACrC;AAED,OAAO,MAAMC,2BAA2B,GAAIC,KAAkB,IAAK;EAC/D,OAAOF,4BAA4B,CAACG,QAAQ,CAACD,KAAK,CAACE,OAAO,CAAC;AAC/D,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
- import type { Sort as esSort } from "@webiny/api-elasticsearch/types";
1
+ import type { Sort as esSort } from "@webiny/api-elasticsearch/types.js";
2
2
  import type { PluginsContainer } from "@webiny/plugins";
3
- import type { CmsEntryListSort, CmsModel } from "@webiny/api-headless-cms/types";
4
- import type { ModelFields } from "./types";
3
+ import type { CmsEntryListSort, CmsModel } from "@webiny/api-headless-cms/types/index.js";
4
+ import type { ModelFields } from "./types.js";
5
5
  interface Params {
6
6
  plugins: PluginsContainer;
7
7
  sort?: CmsEntryListSort;
@@ -1,15 +1,30 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createElasticsearchSort = void 0;
7
- var _apiElasticsearch = require("@webiny/api-elasticsearch");
8
- var _keyword = require("./keyword");
9
- var _search = require("./plugins/search");
10
- var _path = require("./filtering/path");
11
- var _NoValueContainer = require("../../../values/NoValueContainer.js");
12
- const createElasticsearchSort = params => {
1
+ import { createSort, ElasticsearchFieldPlugin } from "@webiny/api-elasticsearch";
2
+ import { hasKeyword } from "./keyword.js";
3
+ import { createSearchPluginList } from "./plugins/search.js";
4
+ import { createFieldPathFactory } from "./filtering/path.js";
5
+ import { NoValueContainer } from "../../../values/NoValueContainer.js";
6
+ const matchField = input => {
7
+ const valuesMatch = input.match(/^values_([a-zA-Z-0-9_]+)_(ASC|DESC)$/);
8
+ if (valuesMatch) {
9
+ const [, fieldId, order] = valuesMatch;
10
+ return {
11
+ fieldId,
12
+ isValues: true,
13
+ order: order
14
+ };
15
+ }
16
+ const nonValues = input.match(/^([a-zA-Z-0-9_]+)_(ASC|DESC)$/);
17
+ if (!nonValues) {
18
+ return null;
19
+ }
20
+ const [, fieldId, order] = nonValues;
21
+ return {
22
+ fieldId,
23
+ isValues: false,
24
+ order: order
25
+ };
26
+ };
27
+ export const createElasticsearchSort = params => {
13
28
  const {
14
29
  sort,
15
30
  modelFields,
@@ -22,10 +37,10 @@ const createElasticsearchSort = params => {
22
37
  }
23
38
  }];
24
39
  }
25
- const searchPlugins = (0, _search.createSearchPluginList)({
40
+ const searchPlugins = createSearchPluginList({
26
41
  plugins
27
42
  });
28
- const createFieldPath = (0, _path.createFieldPathFactory)({
43
+ const createFieldPath = createFieldPathFactory({
29
44
  plugins: searchPlugins
30
45
  });
31
46
  const fieldIdToStorageIdIdMap = {};
@@ -33,29 +48,28 @@ const createElasticsearchSort = params => {
33
48
  /**
34
49
  * We do not support sorting by nested fields.
35
50
  */
36
- if (field.parents.length > 0) {
51
+ const isValues = field.parents.length === 1 && field.parents[0].fieldId === "values";
52
+ if (field.parents.length > 0 && !isValues) {
37
53
  return plugins;
38
54
  }
39
- const {
40
- fieldId,
41
- storageId
42
- } = field.field;
43
- fieldIdToStorageIdIdMap[fieldId] = fieldId;
55
+ const fieldId = field.field.fieldId;
56
+ const fieldIdPath = isValues ? `values.${fieldId}` : fieldId;
57
+ fieldIdToStorageIdIdMap[fieldIdPath] = fieldIdPath;
44
58
  const {
45
59
  path
46
60
  } = createFieldPath({
47
- key: storageId,
61
+ key: field.field.storageId,
48
62
  field,
49
- value: _NoValueContainer.NoValueContainer.create(),
63
+ value: NoValueContainer.create(),
50
64
  keyword: false,
51
- originalValue: _NoValueContainer.NoValueContainer.create()
65
+ originalValue: NoValueContainer.create()
52
66
  });
53
67
  /**
54
68
  * Plugins must be stored with fieldId as key because it is later used to find the sorting plugin.
55
69
  */
56
- plugins[fieldId] = new _apiElasticsearch.ElasticsearchFieldPlugin({
70
+ plugins[fieldIdPath] = new ElasticsearchFieldPlugin({
57
71
  unmappedType: field.unmappedType,
58
- keyword: (0, _keyword.hasKeyword)(field),
72
+ keyword: hasKeyword(field),
59
73
  sortable: field.sortable,
60
74
  searchable: field.searchable,
61
75
  field: fieldId,
@@ -63,27 +77,31 @@ const createElasticsearchSort = params => {
63
77
  });
64
78
  return plugins;
65
79
  }, {
66
- ["*"]: new _apiElasticsearch.ElasticsearchFieldPlugin({
67
- field: _apiElasticsearch.ElasticsearchFieldPlugin.ALL,
80
+ ["*"]: new ElasticsearchFieldPlugin({
81
+ field: ElasticsearchFieldPlugin.ALL,
68
82
  keyword: false
69
83
  })
70
84
  });
71
85
  const transformedSort = sort.map(value => {
72
- const matched = value.match(/^([a-zA-Z-0-9_]+)_(ASC|DESC)$/);
86
+ const matched = matchField(value);
73
87
  if (!matched) {
74
88
  return null;
75
89
  }
76
- const [, fieldId, order] = matched;
77
- if (fieldIdToStorageIdIdMap[fieldId]) {
78
- return `${fieldIdToStorageIdIdMap[fieldId]}_${order}`;
90
+ const {
91
+ fieldId,
92
+ order,
93
+ isValues
94
+ } = matched;
95
+ const key = isValues ? `values.${fieldId}` : fieldId;
96
+ if (fieldIdToStorageIdIdMap[key]) {
97
+ return `${fieldIdToStorageIdIdMap[key]}_${order}`;
79
98
  }
80
99
  return value;
81
100
  }).filter(Boolean);
82
- return (0, _apiElasticsearch.createSort)({
101
+ return createSort({
83
102
  fieldPlugins: sortPlugins,
84
103
  sort: transformedSort
85
104
  });
86
105
  };
87
- exports.createElasticsearchSort = createElasticsearchSort;
88
106
 
89
107
  //# sourceMappingURL=sort.js.map