@webiny/api-headless-cms-ddb-es 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.f6dc066313

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 (294) 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 +60 -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 +23 -30
  120. package/operations/entry/elasticsearch/body.js.map +1 -1
  121. package/operations/entry/elasticsearch/fields/createSystemField.d.ts +4 -0
  122. package/operations/entry/elasticsearch/fields/createSystemField.js +10 -0
  123. package/operations/entry/elasticsearch/fields/createSystemField.js.map +1 -0
  124. package/operations/entry/elasticsearch/fields/live.d.ts +2 -0
  125. package/operations/entry/elasticsearch/fields/live.js +45 -0
  126. package/operations/entry/elasticsearch/fields/live.js.map +1 -0
  127. package/operations/entry/elasticsearch/fields/location.d.ts +2 -0
  128. package/operations/entry/elasticsearch/fields/location.js +45 -0
  129. package/operations/entry/elasticsearch/fields/location.js.map +1 -0
  130. package/operations/entry/elasticsearch/fields/state.d.ts +2 -0
  131. package/operations/entry/elasticsearch/fields/state.js +93 -0
  132. package/operations/entry/elasticsearch/fields/state.js.map +1 -0
  133. package/operations/entry/elasticsearch/fields.d.ts +2 -2
  134. package/operations/entry/elasticsearch/fields.js +26 -67
  135. package/operations/entry/elasticsearch/fields.js.map +1 -1
  136. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +2 -2
  137. package/operations/entry/elasticsearch/filtering/applyFiltering.js +9 -17
  138. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -1
  139. package/operations/entry/elasticsearch/filtering/exec.d.ts +6 -5
  140. package/operations/entry/elasticsearch/filtering/exec.js +48 -45
  141. package/operations/entry/elasticsearch/filtering/exec.js.map +1 -1
  142. package/operations/entry/elasticsearch/filtering/index.d.ts +1 -1
  143. package/operations/entry/elasticsearch/filtering/index.js +1 -16
  144. package/operations/entry/elasticsearch/filtering/index.js.map +1 -1
  145. package/operations/entry/elasticsearch/filtering/path.d.ts +1 -1
  146. package/operations/entry/elasticsearch/filtering/path.js +5 -15
  147. package/operations/entry/elasticsearch/filtering/path.js.map +1 -1
  148. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +1 -1
  149. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +6 -14
  150. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -1
  151. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -1
  152. package/operations/entry/elasticsearch/filtering/plugins/index.js +5 -12
  153. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -1
  154. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +1 -1
  155. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +7 -15
  156. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -1
  157. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +1 -1
  158. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +7 -15
  159. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -1
  160. package/operations/entry/elasticsearch/filtering/populated.d.ts +1 -1
  161. package/operations/entry/elasticsearch/filtering/populated.js +1 -8
  162. package/operations/entry/elasticsearch/filtering/populated.js.map +1 -1
  163. package/operations/entry/elasticsearch/filtering/values.d.ts +1 -1
  164. package/operations/entry/elasticsearch/filtering/values.js +4 -12
  165. package/operations/entry/elasticsearch/filtering/values.js.map +1 -1
  166. package/operations/entry/elasticsearch/fullTextSearch.d.ts +4 -3
  167. package/operations/entry/elasticsearch/fullTextSearch.js +17 -16
  168. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -1
  169. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +4 -4
  170. package/operations/entry/elasticsearch/fullTextSearchFields.js +11 -18
  171. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -1
  172. package/operations/entry/elasticsearch/initialQuery.d.ts +2 -2
  173. package/operations/entry/elasticsearch/initialQuery.js +9 -27
  174. package/operations/entry/elasticsearch/initialQuery.js.map +1 -1
  175. package/operations/entry/elasticsearch/keyword.d.ts +1 -1
  176. package/operations/entry/elasticsearch/keyword.js +4 -9
  177. package/operations/entry/elasticsearch/keyword.js.map +1 -1
  178. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +2 -2
  179. package/operations/entry/elasticsearch/plugins/bodyModifier.js +3 -10
  180. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -1
  181. package/operations/entry/elasticsearch/plugins/operator.d.ts +1 -2
  182. package/operations/entry/elasticsearch/plugins/operator.js +4 -19
  183. package/operations/entry/elasticsearch/plugins/operator.js.map +1 -1
  184. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +2 -2
  185. package/operations/entry/elasticsearch/plugins/queryModifier.js +3 -10
  186. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -1
  187. package/operations/entry/elasticsearch/plugins/search.d.ts +1 -1
  188. package/operations/entry/elasticsearch/plugins/search.js +5 -13
  189. package/operations/entry/elasticsearch/plugins/search.js.map +1 -1
  190. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +2 -2
  191. package/operations/entry/elasticsearch/plugins/sortModifier.js +3 -10
  192. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -1
  193. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +1 -8
  194. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -1
  195. package/operations/entry/elasticsearch/sort.d.ts +3 -3
  196. package/operations/entry/elasticsearch/sort.js +51 -33
  197. package/operations/entry/elasticsearch/sort.js.map +1 -1
  198. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +2 -2
  199. package/operations/entry/elasticsearch/transformValueForSearch.js +4 -9
  200. package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -1
  201. package/operations/entry/elasticsearch/types.d.ts +2 -2
  202. package/operations/entry/elasticsearch/types.js +1 -5
  203. package/operations/entry/elasticsearch/types.js.map +1 -1
  204. package/operations/entry/index.d.ts +5 -4
  205. package/operations/entry/index.js +333 -515
  206. package/operations/entry/index.js.map +1 -1
  207. package/operations/entry/keys.d.ts +31 -1
  208. package/operations/entry/keys.js +56 -19
  209. package/operations/entry/keys.js.map +1 -1
  210. package/operations/entry/recordType.js +3 -12
  211. package/operations/entry/recordType.js.map +1 -1
  212. package/operations/entry/transformations/convertEntryKeys.d.ts +6 -6
  213. package/operations/entry/transformations/convertEntryKeys.js +2 -10
  214. package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
  215. package/operations/entry/transformations/index.d.ts +16 -16
  216. package/operations/entry/transformations/index.js +22 -30
  217. package/operations/entry/transformations/index.js.map +1 -1
  218. package/operations/entry/transformations/modifyEntryValues.d.ts +28 -34
  219. package/operations/entry/transformations/modifyEntryValues.js +1 -8
  220. package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
  221. package/operations/entry/transformations/transformEntryKeys.d.ts +8 -8
  222. package/operations/entry/transformations/transformEntryKeys.js +4 -11
  223. package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
  224. package/operations/entry/transformations/transformEntryToIndex.d.ts +6 -6
  225. package/operations/entry/transformations/transformEntryToIndex.js +3 -10
  226. package/operations/entry/transformations/transformEntryToIndex.js.map +1 -1
  227. package/operations/group/index.d.ts +5 -4
  228. package/operations/group/index.js +39 -73
  229. package/operations/group/index.js.map +1 -1
  230. package/operations/model/index.d.ts +3 -3
  231. package/operations/model/index.js +38 -57
  232. package/operations/model/index.js.map +1 -1
  233. package/package.json +27 -32
  234. package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +1 -1
  235. package/plugins/CmsElasticsearchModelFieldPlugin.js +2 -8
  236. package/plugins/CmsElasticsearchModelFieldPlugin.js.map +1 -1
  237. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +1 -1
  238. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +3 -11
  239. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -1
  240. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +5 -4
  241. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +3 -11
  242. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -1
  243. package/plugins/CmsEntryElasticsearchIndexPlugin.js +2 -9
  244. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -1
  245. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +2 -2
  246. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +3 -11
  247. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -1
  248. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +1 -1
  249. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +3 -11
  250. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -1
  251. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +1 -1
  252. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +3 -11
  253. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -1
  254. package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +12 -12
  255. package/plugins/CmsEntryElasticsearchValuesModifier.js +4 -12
  256. package/plugins/CmsEntryElasticsearchValuesModifier.js.map +1 -1
  257. package/plugins/CmsEntryFilterPlugin.d.ts +3 -3
  258. package/plugins/CmsEntryFilterPlugin.js +2 -9
  259. package/plugins/CmsEntryFilterPlugin.js.map +1 -1
  260. package/plugins/index.d.ts +8 -8
  261. package/plugins/index.js +8 -93
  262. package/plugins/index.js.map +1 -1
  263. package/tasks/createIndexTaskPlugin.d.ts +2 -2
  264. package/tasks/createIndexTaskPlugin.js +36 -62
  265. package/tasks/createIndexTaskPlugin.js.map +1 -1
  266. package/types.d.ts +23 -26
  267. package/types.js +5 -8
  268. package/types.js.map +1 -1
  269. package/values/NoValueContainer.js +1 -8
  270. package/values/NoValueContainer.js.map +1 -1
  271. package/definitions/entryElasticsearch.d.ts +0 -9
  272. package/definitions/entryElasticsearch.js +0 -41
  273. package/definitions/entryElasticsearch.js.map +0 -1
  274. package/definitions/system.d.ts +0 -9
  275. package/definitions/system.js +0 -42
  276. package/definitions/system.js.map +0 -1
  277. package/definitions/table.d.ts +0 -8
  278. package/definitions/table.js +0 -25
  279. package/definitions/table.js.map +0 -1
  280. package/definitions/tableElasticsearch.d.ts +0 -8
  281. package/definitions/tableElasticsearch.js +0 -25
  282. package/definitions/tableElasticsearch.js.map +0 -1
  283. package/elasticsearch/indices/japanese.d.ts +0 -2
  284. package/elasticsearch/indices/japanese.js +0 -14
  285. package/elasticsearch/indices/japanese.js.map +0 -1
  286. package/operations/entry/elasticsearch/logIgnoredEsResponseError.d.ts +0 -9
  287. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js +0 -26
  288. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js.map +0 -1
  289. package/operations/system/index.d.ts +0 -6
  290. package/operations/system/index.js +0 -94
  291. package/operations/system/index.js.map +0 -1
  292. package/operations/system/indexes.d.ts +0 -10
  293. package/operations/system/indexes.js +0 -41
  294. package/operations/system/indexes.js.map +0 -1
@@ -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
@@ -1 +1 @@
1
- {"version":3,"names":["_apiElasticsearch","require","_keyword","_search","_path","_NoValueContainer","createElasticsearchSort","params","sort","modelFields","plugins","length","order","searchPlugins","createSearchPluginList","createFieldPath","createFieldPathFactory","fieldIdToStorageIdIdMap","sortPlugins","Object","values","reduce","field","parents","fieldId","storageId","path","key","value","NoValueContainer","create","keyword","originalValue","ElasticsearchFieldPlugin","unmappedType","hasKeyword","sortable","searchable","ALL","transformedSort","map","matched","match","filter","Boolean","createSort","fieldPlugins","exports"],"sources":["sort.ts"],"sourcesContent":["import type { Sort as esSort } from \"@webiny/api-elasticsearch/types\";\nimport { createSort, ElasticsearchFieldPlugin } from \"@webiny/api-elasticsearch\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { CmsEntryListSort, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport type { ModelFields } from \"./types\";\nimport { hasKeyword } from \"~/operations/entry/elasticsearch/keyword\";\nimport { createSearchPluginList } from \"~/operations/entry/elasticsearch/plugins/search\";\nimport { createFieldPathFactory } from \"~/operations/entry/elasticsearch/filtering/path\";\nimport { NoValueContainer } from \"~/values/NoValueContainer.js\";\n\ninterface Params {\n plugins: PluginsContainer;\n sort?: CmsEntryListSort;\n modelFields: ModelFields;\n model: CmsModel;\n}\nexport const createElasticsearchSort = (params: Params): esSort => {\n const { sort, modelFields, plugins } = params;\n\n if (!sort || sort.length === 0) {\n return [\n {\n [\"id.keyword\"]: {\n order: \"asc\"\n }\n }\n ];\n }\n\n const searchPlugins = createSearchPluginList({\n plugins\n });\n\n const createFieldPath = createFieldPathFactory({\n plugins: searchPlugins\n });\n\n const fieldIdToStorageIdIdMap: Record<string, string> = {};\n\n const sortPlugins = Object.values(modelFields).reduce<Record<string, ElasticsearchFieldPlugin>>(\n (plugins, field) => {\n /**\n * We do not support sorting by nested fields.\n */\n if (field.parents.length > 0) {\n return plugins;\n }\n const { fieldId, storageId } = field.field;\n\n fieldIdToStorageIdIdMap[fieldId] = fieldId;\n\n const { path } = createFieldPath({\n key: storageId,\n field,\n value: NoValueContainer.create(),\n keyword: false,\n originalValue: NoValueContainer.create()\n });\n /**\n * Plugins must be stored with fieldId as key because it is later used to find the sorting plugin.\n */\n plugins[fieldId] = new ElasticsearchFieldPlugin({\n unmappedType: field.unmappedType,\n keyword: hasKeyword(field),\n sortable: field.sortable,\n searchable: field.searchable,\n field: fieldId,\n path\n });\n return plugins;\n },\n {\n [\"*\"]: new ElasticsearchFieldPlugin({\n field: ElasticsearchFieldPlugin.ALL,\n keyword: false\n })\n }\n );\n\n const transformedSort = sort\n .map(value => {\n const matched = value.match(/^([a-zA-Z-0-9_]+)_(ASC|DESC)$/);\n if (!matched) {\n return null;\n }\n const [, fieldId, order] = matched;\n if (fieldIdToStorageIdIdMap[fieldId]) {\n return `${fieldIdToStorageIdIdMap[fieldId]}_${order}`;\n }\n\n return value;\n })\n .filter(Boolean) as string[];\n return createSort({\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C;IAC3C,CAAC,CAAC;IACF;AACZ;AACA;IACYpB,OAAO,CAACc,OAAO,CAAC,GAAG,IAAIS,0CAAwB,CAAC;MAC5CC,YAAY,EAAEZ,KAAK,CAACY,YAAY;MAChCH,OAAO,EAAE,IAAAI,mBAAU,EAACb,KAAK,CAAC;MAC1Bc,QAAQ,EAAEd,KAAK,CAACc,QAAQ;MACxBC,UAAU,EAAEf,KAAK,CAACe,UAAU;MAC5Bf,KAAK,EAAEE,OAAO;MACdE;IACJ,CAAC,CAAC;IACF,OAAOhB,OAAO;EAClB,CAAC,EACD;IACI,CAAC,GAAG,GAAG,IAAIuB,0CAAwB,CAAC;MAChCX,KAAK,EAAEW,0CAAwB,CAACK,GAAG;MACnCP,OAAO,EAAE;IACb,CAAC;EACL,CACJ,CAAC;EAED,MAAMQ,eAAe,GAAG/B,IAAI,CACvBgC,GAAG,CAACZ,KAAK,IAAI;IACV,MAAMa,OAAO,GAAGb,KAAK,CAACc,KAAK,CAAC,+BAA+B,CAAC;IAC5D,IAAI,CAACD,OAAO,EAAE;MACV,OAAO,IAAI;IACf;IACA,MAAM,GAAGjB,OAAO,EAAEZ,KAAK,CAAC,GAAG6B,OAAO;IAClC,IAAIxB,uBAAuB,CAACO,OAAO,CAAC,EAAE;MAClC,OAAO,GAAGP,uBAAuB,CAACO,OAAO,CAAC,IAAIZ,KAAK,EAAE;IACzD;IAEA,OAAOgB,KAAK;EAChB,CAAC,CAAC,CACDe,MAAM,CAACC,OAAO,CAAa;EAChC,OAAO,IAAAC,4BAAU,EAAC;IACdC,YAAY,EAAE5B,WAAW;IACzBV,IAAI,EAAE+B;EACV,CAAC,CAAC;AACN,CAAC;AAACQ,OAAA,CAAAzC,uBAAA,GAAAA,uBAAA","ignoreList":[]}
1
+ {"version":3,"names":["createSort","ElasticsearchFieldPlugin","hasKeyword","createSearchPluginList","createFieldPathFactory","NoValueContainer","matchField","input","valuesMatch","match","fieldId","order","isValues","nonValues","createElasticsearchSort","params","sort","modelFields","plugins","length","searchPlugins","createFieldPath","fieldIdToStorageIdIdMap","sortPlugins","Object","values","reduce","field","parents","fieldIdPath","path","key","storageId","value","create","keyword","originalValue","unmappedType","sortable","searchable","ALL","transformedSort","map","matched","filter","Boolean","fieldPlugins"],"sources":["sort.ts"],"sourcesContent":["import type { Sort as esSort } from \"@webiny/api-elasticsearch/types.js\";\nimport { createSort, ElasticsearchFieldPlugin } from \"@webiny/api-elasticsearch\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { CmsEntryListSort, CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { ModelFields } from \"./types.js\";\nimport { hasKeyword } from \"~/operations/entry/elasticsearch/keyword.js\";\nimport { createSearchPluginList } from \"~/operations/entry/elasticsearch/plugins/search.js\";\nimport { createFieldPathFactory } from \"~/operations/entry/elasticsearch/filtering/path.js\";\nimport { NoValueContainer } from \"~/values/NoValueContainer.js\";\n\ninterface IMatchFieldResponse {\n fieldId: string;\n isValues: boolean;\n order: \"ASC\" | \"DESC\";\n}\n\nconst matchField = (input: string): IMatchFieldResponse | null => {\n const valuesMatch = input.match(/^values_([a-zA-Z-0-9_]+)_(ASC|DESC)$/);\n if (valuesMatch) {\n const [, fieldId, order] = valuesMatch;\n return {\n fieldId,\n isValues: true,\n order: order as \"ASC\" | \"DESC\"\n };\n }\n const nonValues = input.match(/^([a-zA-Z-0-9_]+)_(ASC|DESC)$/);\n if (!nonValues) {\n return null;\n }\n const [, fieldId, order] = nonValues;\n return {\n fieldId,\n isValues: false,\n order: order as \"ASC\" | \"DESC\"\n };\n};\n\ninterface Params {\n plugins: PluginsContainer;\n sort?: CmsEntryListSort;\n modelFields: ModelFields;\n model: CmsModel;\n}\n\nexport const createElasticsearchSort = (params: Params): esSort => {\n const { sort, modelFields, plugins } = params;\n\n if (!sort || sort.length === 0) {\n return [\n {\n [\"id.keyword\"]: {\n order: \"asc\"\n }\n }\n ];\n }\n\n const searchPlugins = createSearchPluginList({\n plugins\n });\n\n const createFieldPath = createFieldPathFactory({\n plugins: searchPlugins\n });\n\n const fieldIdToStorageIdIdMap: Record<string, string> = {};\n\n const sortPlugins = Object.values(modelFields).reduce<Record<string, ElasticsearchFieldPlugin>>(\n (plugins, field) => {\n /**\n * We do not support sorting by nested fields.\n */\n const isValues = field.parents.length === 1 && field.parents[0].fieldId === \"values\";\n if (field.parents.length > 0 && !isValues) {\n return plugins;\n }\n\n const fieldId = field.field.fieldId;\n const fieldIdPath = isValues ? `values.${fieldId}` : fieldId;\n\n fieldIdToStorageIdIdMap[fieldIdPath] = fieldIdPath;\n\n const { path } = createFieldPath({\n key: field.field.storageId,\n field,\n value: NoValueContainer.create(),\n keyword: false,\n originalValue: NoValueContainer.create()\n });\n /**\n * Plugins must be stored with fieldId as key because it is later used to find the sorting plugin.\n */\n plugins[fieldIdPath] = new ElasticsearchFieldPlugin({\n unmappedType: field.unmappedType,\n keyword: hasKeyword(field),\n sortable: field.sortable,\n searchable: field.searchable,\n field: fieldId,\n path\n });\n return plugins;\n },\n {\n [\"*\"]: new ElasticsearchFieldPlugin({\n field: ElasticsearchFieldPlugin.ALL,\n keyword: false\n })\n }\n );\n\n const transformedSort = sort\n .map(value => {\n const matched = matchField(value);\n if (!matched) {\n return null;\n }\n const { fieldId, order, isValues } = matched;\n const key = isValues ? `values.${fieldId}` : fieldId;\n if (fieldIdToStorageIdIdMap[key]) {\n return `${fieldIdToStorageIdIdMap[key]}_${order}`;\n }\n\n return value;\n })\n .filter(Boolean) as string[];\n return createSort({\n fieldPlugins: sortPlugins,\n sort: transformedSort\n });\n};\n"],"mappings":"AACA,SAASA,UAAU,EAAEC,wBAAwB,QAAQ,2BAA2B;AAIhF,SAASC,UAAU;AACnB,SAASC,sBAAsB;AAC/B,SAASC,sBAAsB;AAC/B,SAASC,gBAAgB;AAQzB,MAAMC,UAAU,GAAIC,KAAa,IAAiC;EAC9D,MAAMC,WAAW,GAAGD,KAAK,CAACE,KAAK,CAAC,sCAAsC,CAAC;EACvE,IAAID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AUF,OAAO,EAAE,GAAGA,OAAO;IACpD,IAAIY,uBAAuB,CAACS,GAAG,CAAC,EAAE;MAC9B,OAAO,GAAGT,uBAAuB,CAACS,GAAG,CAAC,IAAIpB,KAAK,EAAE;IACrD;IAEA,OAAOsB,KAAK;EAChB,CAAC,CAAC,CACDW,MAAM,CAACC,OAAO,CAAa;EAChC,OAAO7C,UAAU,CAAC;IACd8C,YAAY,EAAEvB,WAAW;IACzBP,IAAI,EAAEyB;EACV,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -2,8 +2,8 @@
2
2
  * We use any for input and output because they really can be anything.
3
3
  * Plugin, if exists, makes sure that response value is correct.
4
4
  */
5
- import type { CmsModelField } from "@webiny/api-headless-cms/types";
6
- import type { ElasticsearchQuerySearchValuePlugins } from "./types";
5
+ import type { CmsModelField } from "@webiny/api-headless-cms/types/index.js";
6
+ import type { ElasticsearchQuerySearchValuePlugins } from "./types.js";
7
7
  interface Params {
8
8
  plugins: ElasticsearchQuerySearchValuePlugins;
9
9
  field: CmsModelField;
@@ -1,24 +1,20 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.transformValueForSearch = void 0;
7
1
  /**
8
2
  * We use any for input and output because they really can be anything.
9
3
  * Plugin, if exists, makes sure that response value is correct.
10
4
  */
11
5
 
6
+ import { getBaseFieldType } from "@webiny/api-headless-cms/utils/getBaseFieldType.js";
12
7
  /**
13
8
  * Transformed value can be anything.
14
9
  */
15
- const transformValueForSearch = params => {
10
+ export const transformValueForSearch = params => {
16
11
  const {
17
12
  field,
18
13
  plugins,
19
14
  value
20
15
  } = params;
21
- const plugin = plugins[field.type];
16
+ const fieldType = getBaseFieldType(field);
17
+ const plugin = plugins[fieldType];
22
18
  if (!plugin) {
23
19
  return value;
24
20
  }
@@ -27,6 +23,5 @@ const transformValueForSearch = params => {
27
23
  value
28
24
  });
29
25
  };
30
- exports.transformValueForSearch = transformValueForSearch;
31
26
 
32
27
  //# sourceMappingURL=transformValueForSearch.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["transformValueForSearch","params","field","plugins","value","plugin","type","transform","exports"],"sources":["transformValueForSearch.ts"],"sourcesContent":["/**\n * We use any for input and output because they really can be anything.\n * Plugin, if exists, makes sure that response value is correct.\n */\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport type { ElasticsearchQuerySearchValuePlugins } from \"./types\";\n\ninterface Params {\n plugins: ElasticsearchQuerySearchValuePlugins;\n field: CmsModelField;\n value: any;\n}\n\n/**\n * Transformed value can be anything.\n */\nexport const transformValueForSearch = (params: Params): any => {\n const { field, plugins, value } = params;\n const plugin = plugins[field.type];\n if (!plugin) {\n return value;\n }\n return plugin.transform({ field, value });\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACO,MAAMA,uBAAuB,GAAIC,MAAc,IAAU;EAC5D,MAAM;IAAEC,KAAK;IAAEC,OAAO;IAAEC;EAAM,CAAC,GAAGH,MAAM;EACxC,MAAMI,MAAM,GAAGF,OAAO,CAACD,KAAK,CAACI,IAAI,CAAC;EAClC,IAAI,CAACD,MAAM,EAAE;IACT,OAAOD,KAAK;EAChB;EACA,OAAOC,MAAM,CAACE,SAAS,CAAC;IAAEL,KAAK;IAAEE;EAAM,CAAC,CAAC;AAC7C,CAAC;AAACI,OAAA,CAAAR,uBAAA,GAAAA,uBAAA","ignoreList":[]}
1
+ {"version":3,"names":["getBaseFieldType","transformValueForSearch","params","field","plugins","value","fieldType","plugin","transform"],"sources":["transformValueForSearch.ts"],"sourcesContent":["/**\n * We use any for input and output because they really can be anything.\n * Plugin, if exists, makes sure that response value is correct.\n */\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { ElasticsearchQuerySearchValuePlugins } from \"./types.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\n\ninterface Params {\n plugins: ElasticsearchQuerySearchValuePlugins;\n field: CmsModelField;\n value: any;\n}\n\n/**\n * Transformed value can be anything.\n */\nexport const transformValueForSearch = (params: Params): any => {\n const { field, plugins, value } = params;\n const fieldType = getBaseFieldType(field);\n const plugin = plugins[fieldType];\n if (!plugin) {\n return value;\n }\n return plugin.transform({ field, value });\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAGA,SAASA,gBAAgB,QAAQ,oDAAoD;AAQrF;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAIC,MAAc,IAAU;EAC5D,MAAM;IAAEC,KAAK;IAAEC,OAAO;IAAEC;EAAM,CAAC,GAAGH,MAAM;EACxC,MAAMI,SAAS,GAAGN,gBAAgB,CAACG,KAAK,CAAC;EACzC,MAAMI,MAAM,GAAGH,OAAO,CAACE,SAAS,CAAC;EACjC,IAAI,CAACC,MAAM,EAAE;IACT,OAAOF,KAAK;EAChB;EACA,OAAOE,MAAM,CAACC,SAAS,CAAC;IAAEL,KAAK;IAAEE;EAAM,CAAC,CAAC;AAC7C,CAAC","ignoreList":[]}
@@ -1,6 +1,6 @@
1
- import type { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from "../../../plugins";
1
+ import type { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from "../../../plugins/index.js";
2
2
  import type { ElasticsearchQueryBuilderOperatorPlugin } from "@webiny/api-elasticsearch";
3
- import type { CmsModelField } from "@webiny/api-headless-cms/types";
3
+ import type { CmsModelField } from "@webiny/api-headless-cms/types/index.js";
4
4
  /**
5
5
  * ./fields
6
6
  */
@@ -1,7 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ export {};
6
2
 
7
3
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from \"~/plugins\";\nimport type { ElasticsearchQueryBuilderOperatorPlugin } from \"@webiny/api-elasticsearch\";\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\n/**\n * ./fields\n */\ntype ModelFieldPath = string | ((value: string) => string);\n\nexport type FieldType = \"text\" | \"date\" | \"datetime\" | \"time\" | \"number\" | \"boolean\" | string;\n\nexport interface ModelFieldParent {\n fieldId: string;\n storageId: string;\n type: FieldType;\n}\nexport interface ModelField {\n unmappedType?: string;\n keyword?: boolean;\n searchable: boolean;\n sortable: boolean;\n type: FieldType;\n systemField?: boolean;\n field: CmsModelField;\n path?: ModelFieldPath;\n fullTextSearch?: boolean;\n parents: ModelFieldParent[];\n}\n\nexport interface ModelFields {\n [fieldId: string]: ModelField;\n}\n\n/**\n * ./plugins/operator\n */\nexport interface ElasticsearchQueryBuilderOperatorPlugins {\n [key: string]: ElasticsearchQueryBuilderOperatorPlugin;\n}\n/**\n * ./plugins/search\n */\nexport interface ElasticsearchQuerySearchValuePlugins {\n [fieldType: string]: CmsEntryElasticsearchQueryBuilderValueSearchPlugin;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from \"~/plugins/index.js\";\nimport type { ElasticsearchQueryBuilderOperatorPlugin } from \"@webiny/api-elasticsearch\";\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\n\n/**\n * ./fields\n */\ntype ModelFieldPath = string | ((value: string) => string);\n\nexport type FieldType = \"text\" | \"date\" | \"datetime\" | \"time\" | \"number\" | \"boolean\" | string;\n\nexport interface ModelFieldParent {\n fieldId: string;\n storageId: string;\n type: FieldType;\n}\nexport interface ModelField {\n unmappedType?: string;\n keyword?: boolean;\n searchable: boolean;\n sortable: boolean;\n type: FieldType;\n systemField?: boolean;\n field: CmsModelField;\n path?: ModelFieldPath;\n fullTextSearch?: boolean;\n parents: ModelFieldParent[];\n}\n\nexport interface ModelFields {\n [fieldId: string]: ModelField;\n}\n\n/**\n * ./plugins/operator\n */\nexport interface ElasticsearchQueryBuilderOperatorPlugins {\n [key: string]: ElasticsearchQueryBuilderOperatorPlugin;\n}\n/**\n * ./plugins/search\n */\nexport interface ElasticsearchQuerySearchValuePlugins {\n [fieldType: string]: CmsEntryElasticsearchQueryBuilderValueSearchPlugin;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,10 +1,11 @@
1
- import type { Entity } from "@webiny/db-dynamodb/toolbox";
2
1
  import type { Client } from "@elastic/elasticsearch";
3
2
  import type { PluginsContainer } from "@webiny/plugins";
4
- import type { CmsEntryStorageOperations } from "../../types";
3
+ import { type IElasticsearchEntity } from "@webiny/api-elasticsearch";
4
+ import type { CmsEntryStorageOperations } from "../../types.js";
5
+ import type { IEntryEntity } from "../../definitions/types.js";
5
6
  export interface CreateEntriesStorageOperationsParams {
6
- entity: Entity<any>;
7
- esEntity: Entity<any>;
7
+ entity: IEntryEntity;
8
+ esEntity: IElasticsearchEntity;
8
9
  elasticsearch: Client;
9
10
  plugins: PluginsContainer;
10
11
  }