@webiny/api-headless-cms-ddb-es 5.19.1 → 5.20.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,10 +7,15 @@ exports.createRefSearchPlugin = void 0;
7
7
 
8
8
  var _CmsEntryElasticsearchQueryBuilderValueSearchPlugin = require("../../plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin");
9
9
 
10
- const createPath = params => {
11
- const value = `${params.value || ""}`;
12
- const target = value && value.includes("#") ? "id" : "entryId";
13
- return `${params.field.fieldId}.${target}`;
10
+ const createPath = ({
11
+ field,
12
+ key
13
+ }) => {
14
+ if (key && key.match("entryId") === null) {
15
+ return `${field.fieldId}.id`;
16
+ }
17
+
18
+ return `${field.fieldId}.entryId`;
14
19
  };
15
20
 
16
21
  const transform = params => {
@@ -63,6 +63,7 @@ const createElasticsearchSortParams = args => {
63
63
  searchable: modelField.isSearchable,
64
64
  field: modelField.field.fieldId,
65
65
  path: createFieldPath({
66
+ key: modelField.field.fieldId,
66
67
  parentPath,
67
68
  modelField,
68
69
  searchPlugin
@@ -144,14 +145,16 @@ const createInitialQueryValue = args => {
144
145
  const createFieldPath = ({
145
146
  modelField,
146
147
  searchPlugin,
147
- parentPath
148
+ parentPath,
149
+ key
148
150
  }) => {
149
151
  let path;
150
152
 
151
153
  if (searchPlugin && typeof searchPlugin.createPath === "function") {
152
154
  path = searchPlugin.createPath({
153
155
  field: modelField.field,
154
- value: null
156
+ value: null,
157
+ key
155
158
  });
156
159
  } else if (typeof modelField.path === "function") {
157
160
  path = modelField.path(modelField.field.fieldId);
@@ -222,7 +225,8 @@ const fieldPathFactory = params => {
222
225
  modelField,
223
226
  value,
224
227
  parentPath,
225
- keyword
228
+ keyword,
229
+ key
226
230
  } = params;
227
231
  const field = modelField.field;
228
232
  let fieldPath;
@@ -230,7 +234,8 @@ const fieldPathFactory = params => {
230
234
  if (plugin) {
231
235
  fieldPath = plugin.createPath({
232
236
  field,
233
- value
237
+ value,
238
+ key
234
239
  });
235
240
  }
236
241
 
@@ -256,6 +261,7 @@ const applyFiltering = params => {
256
261
  query,
257
262
  modelField,
258
263
  operator,
264
+ key,
259
265
  value: initialValue,
260
266
  operatorPlugins,
261
267
  searchPlugins,
@@ -281,14 +287,16 @@ const applyFiltering = params => {
281
287
  plugin: fieldSearchPlugin,
282
288
  modelField,
283
289
  parentPath: modelField.isSystemField ? null : parentPath,
284
- value
290
+ value,
291
+ key
285
292
  }),
286
293
  path: fieldPathFactory({
287
294
  plugin: fieldSearchPlugin,
288
295
  modelField,
289
296
  value,
290
297
  parentPath: modelField.isSystemField ? null : parentPath,
291
- keyword
298
+ keyword,
299
+ key
292
300
  }),
293
301
  value,
294
302
  keyword
@@ -381,6 +389,7 @@ const execElasticsearchBuildQueryPlugins = params => {
381
389
  query,
382
390
  modelField,
383
391
  operator,
392
+ key: whereKey,
384
393
  value: where[key][whereKey],
385
394
  searchPlugins,
386
395
  operatorPlugins,
@@ -395,6 +404,7 @@ const execElasticsearchBuildQueryPlugins = params => {
395
404
  query,
396
405
  modelField,
397
406
  operator,
407
+ key,
398
408
  value: where[key],
399
409
  searchPlugins,
400
410
  operatorPlugins,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-ddb-es",
3
- "version": "5.19.1",
3
+ "version": "5.20.0-beta.0",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "@webiny/api-headless-cms",
@@ -23,15 +23,15 @@
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
25
  "@babel/runtime": "7.16.3",
26
- "@webiny/api-headless-cms": "5.19.1",
27
- "@webiny/api-upgrade": "5.19.1",
28
- "@webiny/db-dynamodb": "5.19.1",
29
- "@webiny/error": "5.19.1",
30
- "@webiny/handler": "5.19.1",
31
- "@webiny/handler-aws": "5.19.1",
32
- "@webiny/handler-db": "5.19.1",
33
- "@webiny/plugins": "5.19.1",
34
- "@webiny/utils": "5.19.1",
26
+ "@webiny/api-headless-cms": "5.20.0-beta.0",
27
+ "@webiny/api-upgrade": "5.20.0-beta.0",
28
+ "@webiny/db-dynamodb": "5.20.0-beta.0",
29
+ "@webiny/error": "5.20.0-beta.0",
30
+ "@webiny/handler": "5.20.0-beta.0",
31
+ "@webiny/handler-aws": "5.20.0-beta.0",
32
+ "@webiny/handler-db": "5.20.0-beta.0",
33
+ "@webiny/plugins": "5.20.0-beta.0",
34
+ "@webiny/utils": "5.20.0-beta.0",
35
35
  "dataloader": "2.0.0",
36
36
  "dynamodb-toolbox": "0.3.5",
37
37
  "jsonpack": "1.1.5",
@@ -47,10 +47,10 @@
47
47
  "@elastic/elasticsearch": "7.12.0",
48
48
  "@shelf/jest-elasticsearch": "^1.0.0",
49
49
  "@types/jsonpack": "^1.1.0",
50
- "@webiny/api-dynamodb-to-elasticsearch": "^5.19.1",
51
- "@webiny/api-elasticsearch": "^5.19.1",
52
- "@webiny/cli": "^5.19.1",
53
- "@webiny/project-utils": "^5.19.1",
50
+ "@webiny/api-dynamodb-to-elasticsearch": "^5.20.0-beta.0",
51
+ "@webiny/api-elasticsearch": "^5.20.0-beta.0",
52
+ "@webiny/cli": "^5.20.0-beta.0",
53
+ "@webiny/project-utils": "^5.20.0-beta.0",
54
54
  "jest": "^26.6.3",
55
55
  "jest-dynalite": "^3.2.0",
56
56
  "jest-environment-node": "^26.6.2",
@@ -69,5 +69,5 @@
69
69
  "build": "yarn webiny run build",
70
70
  "watch": "yarn webiny run watch"
71
71
  },
72
- "gitHead": "1424145d10add470e70fba9c44225656894e0028"
72
+ "gitHead": "2de02bc113e15e3ffa8e1d82deb9d27417787188"
73
73
  }
@@ -2,6 +2,7 @@ import { Plugin } from "@webiny/plugins/Plugin";
2
2
  import { CmsModelField } from "@webiny/api-headless-cms/types";
3
3
  export interface CreatePathCallableParams<T = any> {
4
4
  field: CmsModelField;
5
+ key: string;
5
6
  value: T;
6
7
  }
7
8
  export interface CreatePathCallable<T = any> {