@webiny/api-headless-cms-ddb 0.0.0-unstable.d4f203fa97 → 0.0.0-unstable.d65ec29d44

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 (86) hide show
  1. package/definitions/model.js +5 -0
  2. package/definitions/model.js.map +1 -1
  3. package/dynamoDb/index.d.ts +1 -1
  4. package/dynamoDb/storage/date.d.ts +2 -1
  5. package/dynamoDb/storage/date.js +13 -3
  6. package/dynamoDb/storage/date.js.map +1 -1
  7. package/dynamoDb/storage/longText.d.ts +1 -1
  8. package/dynamoDb/storage/longText.js +7 -0
  9. package/dynamoDb/storage/longText.js.map +1 -1
  10. package/dynamoDb/storage/richText.d.ts +1 -1
  11. package/dynamoDb/storage/richText.js.map +1 -1
  12. package/index.js +16 -4
  13. package/index.js.map +1 -1
  14. package/operations/entry/filtering/createExpressions.d.ts +26 -0
  15. package/operations/entry/filtering/createExpressions.js +213 -0
  16. package/operations/entry/filtering/createExpressions.js.map +1 -0
  17. package/operations/entry/filtering/createFields.d.ts +14 -0
  18. package/operations/entry/filtering/createFields.js +123 -0
  19. package/operations/entry/filtering/createFields.js.map +1 -0
  20. package/operations/entry/filtering/extractSort.d.ts +17 -0
  21. package/operations/entry/filtering/extractSort.js +77 -0
  22. package/operations/entry/filtering/extractSort.js.map +1 -0
  23. package/operations/entry/filtering/filter.d.ts +15 -0
  24. package/operations/entry/filtering/filter.js +178 -0
  25. package/operations/entry/filtering/filter.js.map +1 -0
  26. package/operations/entry/filtering/fullTextSearch.d.ts +14 -0
  27. package/operations/entry/filtering/fullTextSearch.js +60 -0
  28. package/operations/entry/filtering/fullTextSearch.js.map +1 -0
  29. package/operations/entry/filtering/getValue.d.ts +5 -0
  30. package/operations/entry/filtering/getValue.js +81 -0
  31. package/operations/entry/filtering/getValue.js.map +1 -0
  32. package/operations/entry/filtering/index.d.ts +2 -0
  33. package/operations/entry/filtering/index.js +21 -0
  34. package/operations/entry/filtering/index.js.map +1 -0
  35. package/operations/entry/filtering/mapPlugins.d.ts +8 -0
  36. package/operations/entry/filtering/mapPlugins.js +39 -0
  37. package/operations/entry/filtering/mapPlugins.js.map +1 -0
  38. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +2 -0
  39. package/operations/entry/filtering/plugins/defaultFilterCreate.js +48 -0
  40. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -0
  41. package/operations/entry/filtering/plugins/index.d.ts +1 -0
  42. package/operations/entry/filtering/plugins/index.js +18 -0
  43. package/operations/entry/filtering/plugins/index.js.map +1 -0
  44. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +2 -0
  45. package/operations/entry/filtering/plugins/objectFilterCreate.js +107 -0
  46. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -0
  47. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +2 -0
  48. package/operations/entry/filtering/plugins/refFilterCreate.js +89 -0
  49. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -0
  50. package/operations/entry/filtering/sort.d.ts +12 -0
  51. package/operations/entry/filtering/sort.js +84 -0
  52. package/operations/entry/filtering/sort.js.map +1 -0
  53. package/operations/entry/filtering/systemFields.d.ts +4 -0
  54. package/operations/entry/filtering/systemFields.js +72 -0
  55. package/operations/entry/filtering/systemFields.js.map +1 -0
  56. package/operations/entry/filtering/transform.d.ts +6 -0
  57. package/operations/entry/filtering/transform.js +19 -0
  58. package/operations/entry/filtering/transform.js.map +1 -0
  59. package/operations/entry/filtering/types.d.ts +40 -0
  60. package/operations/entry/filtering/types.js +5 -0
  61. package/operations/entry/filtering/types.js.map +1 -0
  62. package/operations/entry/filtering/values.d.ts +2 -0
  63. package/operations/entry/filtering/values.js +28 -0
  64. package/operations/entry/filtering/values.js.map +1 -0
  65. package/operations/entry/filtering/where.d.ts +5 -0
  66. package/operations/entry/filtering/where.js +38 -0
  67. package/operations/entry/filtering/where.js.map +1 -0
  68. package/operations/entry/index.js +36 -19
  69. package/operations/entry/index.js.map +1 -1
  70. package/package.json +13 -13
  71. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +2 -2
  72. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
  73. package/plugins/CmsEntryFieldFilterPlugin.d.ts +43 -0
  74. package/plugins/CmsEntryFieldFilterPlugin.js +31 -0
  75. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -0
  76. package/plugins/CmsEntryFieldSortingPlugin.d.ts +42 -0
  77. package/plugins/CmsEntryFieldSortingPlugin.js +38 -0
  78. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -0
  79. package/plugins/index.d.ts +2 -0
  80. package/plugins/index.js +26 -0
  81. package/plugins/index.js.map +1 -1
  82. package/types.d.ts +1 -1
  83. package/types.js.map +1 -1
  84. package/operations/entry/utils.d.ts +0 -36
  85. package/operations/entry/utils.js +0 -690
  86. package/operations/entry/utils.js.map +0 -1
@@ -1,690 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.sortEntryItems = exports.filterItems = exports.buildModelFields = void 0;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
- var _error = _interopRequireDefault(require("@webiny/error"));
13
-
14
- var _sortBy = _interopRequireDefault(require("lodash/sortBy"));
15
-
16
- var _dotProp = _interopRequireDefault(require("dot-prop"));
17
-
18
- var _systemFields = require("./systemFields");
19
-
20
- var _ValueFilterPlugin = require("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin");
21
-
22
- var _CmsEntryFieldFilterPathPlugin = require("../../plugins/CmsEntryFieldFilterPathPlugin");
23
-
24
- const VALUES_ATTRIBUTE = "values";
25
-
26
- const extractWhereParams = key => {
27
- const result = key.split("_");
28
- const fieldId = result.shift();
29
-
30
- if (!fieldId) {
31
- return null;
32
- }
33
-
34
- const rawOp = result.length === 0 ? "eq" : result.join("_");
35
- /**
36
- * When rawOp is not, it means it is equal negated so just return that.
37
- */
38
-
39
- if (rawOp === "not") {
40
- return {
41
- fieldId,
42
- operation: "eq",
43
- negate: true
44
- };
45
- }
46
-
47
- const negate = rawOp.match("not_") !== null;
48
- const operation = rawOp.replace("not_", "");
49
- return {
50
- fieldId,
51
- operation,
52
- negate
53
- };
54
- };
55
-
56
- const transformValue = (value, transform) => {
57
- if (Array.isArray(value)) {
58
- return value.map(v => transform(v));
59
- }
60
-
61
- return transform(value);
62
- };
63
-
64
- const getFilterPlugin = params => {
65
- const {
66
- plugins,
67
- operation
68
- } = params;
69
- const plugin = plugins[operation];
70
-
71
- if (plugin) {
72
- return plugin;
73
- }
74
-
75
- throw new _error.default(`There is no filter plugin for operation "${operation}".`, "FILTER_PLUGIN_ERROR", {
76
- operation
77
- });
78
- };
79
-
80
- const createValuePath = params => {
81
- const {
82
- field,
83
- plugins,
84
- index
85
- } = params;
86
- const {
87
- fieldId
88
- } = field;
89
- const valuePathPlugin = plugins[field.type];
90
- const basePath = _systemFields.systemFields[fieldId] ? "" : `${VALUES_ATTRIBUTE}.`;
91
-
92
- if (!valuePathPlugin || valuePathPlugin.canUse(field) === false) {
93
- return `${basePath}${fieldId}`;
94
- }
95
-
96
- const path = valuePathPlugin.createPath({
97
- field,
98
- index
99
- });
100
- return `${basePath}${path}`;
101
- };
102
-
103
- const isObjectFiltering = params => {
104
- const {
105
- value
106
- } = params;
107
-
108
- if (!value) {
109
- return false;
110
- } else if (Array.isArray(value) === true) {
111
- return false;
112
- } else if (value instanceof Date || !!value.toISOString) {
113
- return false;
114
- } else if (typeof value !== "object") {
115
- return false;
116
- }
117
-
118
- return true;
119
- };
120
-
121
- const createFilters = params => {
122
- const {
123
- where,
124
- plugins,
125
- fields
126
- } = params;
127
- const filterPlugins = getMappedPlugins({
128
- plugins,
129
- type: _ValueFilterPlugin.ValueFilterPlugin.type,
130
- property: "operation"
131
- });
132
- const transformValuePlugins = getMappedPlugins({
133
- plugins,
134
- type: "cms-field-filter-value-transform",
135
- property: "fieldType"
136
- });
137
- const valuePathPlugins = getMappedPlugins({
138
- plugins,
139
- type: _CmsEntryFieldFilterPathPlugin.CmsEntryFieldFilterPathPlugin.type,
140
- property: "fieldType"
141
- });
142
- const filters = [];
143
-
144
- for (const key in where) {
145
- if (where.hasOwnProperty(key) === false) {
146
- continue;
147
- }
148
- /**
149
- * At the moment we do not allow OR and AND conditional filtering, so throw an error on it.
150
- */
151
-
152
-
153
- if (key === "AND") {
154
- throw new _error.default(`Conditional "AND" is currently disabled in the DynamoDB only deployment.`, "DISABLED_AND_CONDITIONAL");
155
- } else if (key === "OR") {
156
- throw new _error.default(`Conditional "OR" is currently disabled in the DynamoDB only deployment.`, "DISABLED_OR_CONDITIONAL");
157
- }
158
-
159
- const value = where[key];
160
-
161
- if (value === undefined) {
162
- continue;
163
- }
164
-
165
- const whereParams = extractWhereParams(key);
166
-
167
- if (!whereParams) {
168
- continue;
169
- }
170
-
171
- const {
172
- fieldId,
173
- operation,
174
- negate
175
- } = whereParams;
176
- const field = fields[fieldId];
177
-
178
- if (!field) {
179
- throw new _error.default(`There is no field with the fieldId "${fieldId}".`, "FIELD_ERROR", {
180
- fieldId
181
- });
182
- }
183
-
184
- const transformValuePlugin = transformValuePlugins[field.def.type];
185
-
186
- const transformValueCallable = value => {
187
- if (!transformValuePlugin) {
188
- return value;
189
- }
190
-
191
- return transformValuePlugin.transform({
192
- field: field.def,
193
- value
194
- });
195
- };
196
-
197
- const objectFilteringParams = {
198
- key,
199
- value,
200
- field: field.def
201
- };
202
-
203
- if (isObjectFiltering(objectFilteringParams)) {
204
- const propertyFilters = Object.keys(value);
205
-
206
- if (propertyFilters.length === 0) {
207
- continue;
208
- }
209
-
210
- for (const propertyFilter of propertyFilters) {
211
- const whereParams = extractWhereParams(propertyFilter);
212
-
213
- if (!whereParams) {
214
- continue;
215
- }
216
-
217
- const {
218
- fieldId: propertyId,
219
- operation: propertyOperation,
220
- negate: propertyNegate
221
- } = whereParams;
222
- const filterPlugin = getFilterPlugin({
223
- plugins: filterPlugins,
224
- operation: propertyOperation
225
- });
226
- const basePath = createValuePath({
227
- field: field.def,
228
- plugins: valuePathPlugins
229
- });
230
- const multiValuesPath = field.def.multipleValues ? "%s." : "";
231
- filters.push({
232
- fieldId,
233
- path: `${basePath}.${multiValuesPath}${propertyId}`,
234
- filterPlugin,
235
- negate: propertyNegate,
236
- compareValue: transformValue(value[propertyFilter], transformValueCallable),
237
- transformValue: transformValueCallable
238
- });
239
- }
240
-
241
- continue;
242
- }
243
-
244
- const filterPlugin = getFilterPlugin({
245
- plugins: filterPlugins,
246
- operation
247
- });
248
- filters.push({
249
- fieldId,
250
- path: createValuePath({
251
- field: field.def,
252
- plugins: valuePathPlugins
253
- }),
254
- filterPlugin,
255
- negate,
256
- compareValue: transformValue(value, transformValueCallable),
257
- transformValue: transformValueCallable
258
- });
259
- }
260
-
261
- return filters;
262
- };
263
- /**
264
- * In case filter field is not multiple values one, return exact path.
265
- * If is multiple values field, use path without the last part
266
- */
267
-
268
-
269
- const getFilterValuePath = filter => {
270
- if (filter.path.includes(".%s.") === false) {
271
- return filter.path;
272
- }
273
-
274
- const paths = filter.path.split(".%s.");
275
- return paths.shift();
276
- };
277
-
278
- const getFilterValuePropertyPath = filter => {
279
- if (filter.path.includes(".%s.") === false) {
280
- return null;
281
- }
282
-
283
- const paths = filter.path.split(".%s.");
284
- return paths.pop() || null;
285
- };
286
-
287
- const execFilter = params => {
288
- const {
289
- value: plainValue,
290
- filter
291
- } = params;
292
- const value = transformValue(plainValue, filter.transformValue);
293
- const matched = filter.filterPlugin.matches({
294
- value,
295
- compareValue: filter.compareValue
296
- });
297
-
298
- if (filter.negate) {
299
- return matched === false;
300
- }
301
-
302
- return matched;
303
- };
304
-
305
- /**
306
- * Unfortunately we must use the contains plugin directly as plugins do not support multi field searching.
307
- */
308
- const createFullTextSearch = ({
309
- term,
310
- fields: targetFields,
311
- plugin
312
- }) => {
313
- if (!term || term.trim().length === 0 || !targetFields || targetFields.length === 0) {
314
- return null;
315
- }
316
-
317
- return async ({
318
- item,
319
- fromStorage,
320
- fields
321
- }) => {
322
- for (const targetField of targetFields) {
323
- const field = Object.values(fields).find(field => {
324
- return field.def.fieldId === targetField;
325
- });
326
-
327
- if (!field) {
328
- throw new _error.default(`Unknown field "${targetField}" in the model.`, "UNKNOWN_FIELD", {
329
- target: targetField
330
- });
331
- }
332
-
333
- const value = await fromStorage(field.def, item.values[targetField]);
334
-
335
- if (!value) {
336
- continue;
337
- }
338
-
339
- if (plugin.matches({
340
- value,
341
- compareValue: term
342
- }) === true) {
343
- return true;
344
- }
345
- }
346
-
347
- return false;
348
- };
349
- };
350
-
351
- const filterItems = async params => {
352
- const {
353
- items: records,
354
- where,
355
- plugins,
356
- fields,
357
- fromStorage,
358
- fullTextSearch
359
- } = params;
360
- const filters = createFilters({
361
- plugins,
362
- where,
363
- fields
364
- });
365
- const fullTextSearchPlugin = plugins.byType(_ValueFilterPlugin.ValueFilterPlugin.type).find(plugin => plugin.getOperation() === "contains");
366
-
367
- if (!fullTextSearchPlugin) {
368
- throw new _error.default(`Missing "contains" plugin to run the full-text search.`, "MISSING_PLUGIN");
369
- }
370
-
371
- const search = createFullTextSearch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, fullTextSearch), {}, {
372
- plugin: fullTextSearchPlugin
373
- }));
374
- const promises = records.map(async record => {
375
- /**
376
- * We need to go through all the filters and apply them to the given record.
377
- */
378
- for (const filter of filters) {
379
- /**
380
- * In case is multiple values field, last part is removed from path.
381
- * -> values.categories.id -> values.categories
382
- */
383
- const valuePath = getFilterValuePath(filter);
384
-
385
- const rawValue = _dotProp.default.get(record, valuePath);
386
-
387
- if (valuePath !== filter.path) {
388
- /**
389
- * Calculated is different than original because we need to search in the array of objects.
390
- */
391
- const propertyPath = getFilterValuePropertyPath(filter);
392
-
393
- if (!propertyPath) {
394
- console.log(`Cannot determine the property path of "${filter.path}".`);
395
- continue;
396
- }
397
-
398
- const plainValue = await fromStorage(fields[filter.fieldId].def, rawValue);
399
- /**
400
- * We cannot go through the value because it is not array. Log the error and continue.
401
- */
402
-
403
- if (Array.isArray(plainValue) === false) {
404
- console.log(`Cannot go through the value on ${valuePath} because it is not an array, and we expect it to be.`);
405
- continue;
406
- }
407
-
408
- record = _dotProp.default.set(record, valuePath, plainValue);
409
- const values = plainValue.map(value => {
410
- return value[propertyPath];
411
- });
412
- const result = execFilter({
413
- value: values,
414
- filter
415
- });
416
-
417
- if (!result) {
418
- return null;
419
- }
420
-
421
- continue;
422
- }
423
-
424
- const plainValue = await fromStorage(fields[filter.fieldId].def, rawValue);
425
- /**
426
- * If raw value is not same as the value after the storage transform, set the value to the items being filtered.
427
- */
428
-
429
- if (plainValue !== rawValue) {
430
- record = _dotProp.default.set(record, filter.path, plainValue);
431
- }
432
-
433
- const result = execFilter({
434
- value: plainValue,
435
- filter
436
- });
437
-
438
- if (result === false) {
439
- return null;
440
- }
441
- }
442
- /**
443
- * If we have full text search defined, run it. Otherwise just return the given record.
444
- */
445
-
446
-
447
- if (!search) {
448
- return record;
449
- }
450
-
451
- const result = await search({
452
- item: record,
453
- fromStorage,
454
- fields
455
- });
456
-
457
- if (!result) {
458
- return null;
459
- }
460
-
461
- return record;
462
- });
463
- /**
464
- * We run filtering as promises so it is a bit faster than in for ... of loop.
465
- */
466
-
467
- const results = await Promise.all(promises);
468
- /**
469
- * And filter out the null values which are returned when filter is not satisfied.
470
- */
471
-
472
- return results.filter(Boolean);
473
- };
474
-
475
- exports.filterItems = filterItems;
476
-
477
- const extractSort = (sortBy, fields) => {
478
- const result = sortBy.split("_");
479
-
480
- if (result.length !== 2) {
481
- throw new _error.default("Problem in determining the sorting for the entry items.", "SORT_EXTRACT_ERROR", {
482
- sortBy
483
- });
484
- }
485
-
486
- const [fieldId, order] = result;
487
- const modelField = Object.values(fields).find(field => {
488
- return field.def.fieldId === fieldId;
489
- });
490
-
491
- if (!modelField) {
492
- throw new _error.default("Sorting field does not exist in the content model.", "SORTING_FIELD_ERROR", {
493
- fieldId,
494
- fields
495
- });
496
- }
497
-
498
- const valuePath = modelField.createPath({
499
- field: modelField.def
500
- });
501
- return {
502
- field: modelField,
503
- fieldId,
504
- valuePath,
505
- reverse: order === "DESC"
506
- };
507
- };
508
-
509
- const sortEntryItems = params => {
510
- const {
511
- items,
512
- sort = [],
513
- fields
514
- } = params;
515
-
516
- if (items.length <= 1) {
517
- return items;
518
- } else if (sort.length === 0) {
519
- sort.push("savedOn_DESC");
520
- } else if (sort.length > 1) {
521
- throw new _error.default("Sorting is limited to a single field.", "SORT_MULTIPLE_FIELDS_ERROR", {
522
- sort: sort
523
- });
524
- }
525
-
526
- const [firstSort] = sort;
527
-
528
- if (!firstSort) {
529
- throw new _error.default("Empty sort array item.", "SORT_EMPTY_ERROR", {
530
- sort
531
- });
532
- }
533
-
534
- const {
535
- fieldId,
536
- field,
537
- valuePath,
538
- reverse
539
- } = extractSort(firstSort, fields);
540
- const itemsToSort = items.map(item => {
541
- return {
542
- id: item.id,
543
- value: field.valueTransformer(_dotProp.default.get(item, valuePath))
544
- };
545
- });
546
- const sortedItems = (0, _sortBy.default)(itemsToSort, "value");
547
- const newItems = sortedItems.map(s => {
548
- const item = items.find(i => i.id === s.id);
549
-
550
- if (item) {
551
- return item;
552
- }
553
-
554
- throw new _error.default("Could not find item by given id after the sorting.", "SORTING_ITEMS_ERROR", {
555
- id: s.id,
556
- sortingBy: fieldId,
557
- reverse
558
- });
559
- });
560
-
561
- if (!reverse) {
562
- return newItems;
563
- }
564
-
565
- return newItems.reverse();
566
- };
567
-
568
- exports.sortEntryItems = sortEntryItems;
569
-
570
- const getMappedPlugins = params => {
571
- const {
572
- plugins: pluginsContainer,
573
- type,
574
- property
575
- } = params;
576
- const plugins = pluginsContainer.byType(type);
577
-
578
- if (plugins.length === 0) {
579
- throw new _error.default(`There are no plugins of type "${type}".`, "PLUGINS_ERROR", {
580
- type
581
- });
582
- }
583
-
584
- return plugins.reduce((collection, plugin) => {
585
- const key = plugin[property];
586
-
587
- if (typeof key !== "string") {
588
- throw new _error.default("Property to map the plugins on must be a string.", "PLUGIN_PROPERTY_ERROR", {
589
- type,
590
- property
591
- });
592
- }
593
-
594
- collection[key] = plugin;
595
- return collection;
596
- }, {});
597
- };
598
-
599
- const buildModelFields = ({
600
- plugins,
601
- model
602
- }) => {
603
- const transformValuePlugins = getMappedPlugins({
604
- plugins,
605
- type: "cms-field-filter-value-transform",
606
- property: "fieldType"
607
- });
608
- const valuePathPlugins = getMappedPlugins({
609
- plugins,
610
- type: _CmsEntryFieldFilterPathPlugin.CmsEntryFieldFilterPathPlugin.type,
611
- property: "fieldType"
612
- });
613
- const fields = Object.values(_systemFields.systemFields).reduce((collection, field) => {
614
- /**
615
- * This should be caught on the tests runs and never actually happen on live system.
616
- */
617
- if (!field.fieldId) {
618
- throw new _error.default("Missing system field `fieldId`.", "FIELD_ID_ERROR", {
619
- field
620
- });
621
- }
622
-
623
- const transformValuePlugin = transformValuePlugins[field.type];
624
- const valuePathPlugin = valuePathPlugins[field.type];
625
-
626
- let createPath = params => {
627
- return params.field.fieldId;
628
- };
629
-
630
- if (valuePathPlugin) {
631
- createPath = params => {
632
- return valuePathPlugin.createPath(params);
633
- };
634
- }
635
-
636
- collection[field.fieldId] = {
637
- def: field,
638
- valueTransformer: value => {
639
- if (!transformValuePlugin) {
640
- return value;
641
- }
642
-
643
- return transformValuePlugin.transform({
644
- field,
645
- value
646
- });
647
- },
648
- createPath,
649
- isSystemField: true
650
- };
651
- return collection;
652
- }, {});
653
- return model.fields.reduce((collection, field) => {
654
- if (!field.fieldId) {
655
- console.log(`Field "${field.storageId}" in model "${model.modelId}" is missing fieldId.`);
656
- return collection;
657
- }
658
-
659
- const transformValuePlugin = transformValuePlugins[field.type];
660
- const valuePathPlugin = valuePathPlugins[field.type];
661
-
662
- let createPath = params => {
663
- return `${VALUES_ATTRIBUTE}.${params.field.fieldId}`;
664
- };
665
-
666
- if (valuePathPlugin) {
667
- createPath = params => {
668
- return valuePathPlugin.createPath(params);
669
- };
670
- }
671
-
672
- collection[field.fieldId] = {
673
- def: field,
674
- valueTransformer: value => {
675
- if (!transformValuePlugin) {
676
- return value;
677
- }
678
-
679
- return transformValuePlugin.transform({
680
- field,
681
- value
682
- });
683
- },
684
- createPath
685
- };
686
- return collection;
687
- }, fields);
688
- };
689
-
690
- exports.buildModelFields = buildModelFields;