@webiny/api-headless-cms-ddb 0.0.0-unstable.97a151f74d → 0.0.0-unstable.99666aeb00

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 (140) hide show
  1. package/definitions/entry.js +6 -5
  2. package/definitions/entry.js.map +1 -1
  3. package/definitions/group.js +0 -5
  4. package/definitions/group.js.map +1 -1
  5. package/definitions/model.js +17 -5
  6. package/definitions/model.js.map +1 -1
  7. package/definitions/settings.js +0 -5
  8. package/definitions/settings.js.map +1 -1
  9. package/definitions/system.js +0 -5
  10. package/definitions/system.js.map +1 -1
  11. package/definitions/table.js +0 -3
  12. package/definitions/table.js.map +1 -1
  13. package/dynamoDb/index.js +2 -8
  14. package/dynamoDb/index.js.map +1 -1
  15. package/dynamoDb/path/locationFolderId.d.ts +2 -0
  16. package/dynamoDb/path/locationFolderId.js +41 -0
  17. package/dynamoDb/path/locationFolderId.js.map +1 -0
  18. package/dynamoDb/path/plainObject.js +1 -8
  19. package/dynamoDb/path/plainObject.js.map +1 -1
  20. package/dynamoDb/storage/date.js +3 -30
  21. package/dynamoDb/storage/date.js.map +1 -1
  22. package/dynamoDb/storage/longText.js +7 -17
  23. package/dynamoDb/storage/longText.js.map +1 -1
  24. package/dynamoDb/storage/richText.js +0 -18
  25. package/dynamoDb/storage/richText.js.map +1 -1
  26. package/dynamoDb/transformValue/datetime.js +1 -8
  27. package/dynamoDb/transformValue/datetime.js.map +1 -1
  28. package/index.js +12 -28
  29. package/index.js.map +1 -1
  30. package/operations/entry/dataLoader/DataLoaderCache.d.ts +17 -0
  31. package/operations/entry/dataLoader/DataLoaderCache.js +43 -0
  32. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
  33. package/operations/entry/dataLoader/constants.d.ts +1 -0
  34. package/operations/entry/dataLoader/constants.js +9 -0
  35. package/operations/entry/dataLoader/constants.js.map +1 -0
  36. package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
  37. package/operations/entry/dataLoader/createBatchScheduleFn.js +23 -0
  38. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
  39. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
  40. package/operations/entry/dataLoader/getAllEntryRevisions.js +43 -0
  41. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
  42. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
  43. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +57 -0
  44. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
  45. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
  46. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +57 -0
  47. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
  48. package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
  49. package/operations/entry/dataLoader/getRevisionById.js +63 -0
  50. package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
  51. package/operations/entry/dataLoader/index.d.ts +8 -0
  52. package/operations/entry/dataLoader/index.js +38 -0
  53. package/operations/entry/dataLoader/index.js.map +1 -0
  54. package/operations/entry/dataLoader/types.d.ts +6 -0
  55. package/operations/entry/dataLoader/types.js +5 -0
  56. package/operations/entry/dataLoader/types.js.map +1 -0
  57. package/operations/entry/dataLoaders.d.ts +11 -26
  58. package/operations/entry/dataLoaders.js +43 -249
  59. package/operations/entry/dataLoaders.js.map +1 -1
  60. package/operations/entry/filtering/{createFilters.d.ts → createExpressions.d.ts} +9 -3
  61. package/operations/entry/filtering/createExpressions.js +176 -0
  62. package/operations/entry/filtering/createExpressions.js.map +1 -0
  63. package/operations/entry/filtering/createFields.d.ts +5 -7
  64. package/operations/entry/filtering/createFields.js +73 -92
  65. package/operations/entry/filtering/createFields.js.map +1 -1
  66. package/operations/entry/filtering/extractSort.d.ts +4 -0
  67. package/operations/entry/filtering/extractSort.js +23 -11
  68. package/operations/entry/filtering/extractSort.js.map +1 -1
  69. package/operations/entry/filtering/filter.d.ts +2 -3
  70. package/operations/entry/filtering/filter.js +79 -73
  71. package/operations/entry/filtering/filter.js.map +1 -1
  72. package/operations/entry/filtering/fullTextSearch.d.ts +2 -6
  73. package/operations/entry/filtering/fullTextSearch.js +2 -18
  74. package/operations/entry/filtering/fullTextSearch.js.map +1 -1
  75. package/operations/entry/filtering/getValue.js +0 -18
  76. package/operations/entry/filtering/getValue.js.map +1 -1
  77. package/operations/entry/filtering/index.js +0 -2
  78. package/operations/entry/filtering/index.js.map +1 -1
  79. package/operations/entry/filtering/mapPlugins.js +0 -8
  80. package/operations/entry/filtering/mapPlugins.js.map +1 -1
  81. package/operations/entry/filtering/plugins/defaultFilterCreate.js +3 -8
  82. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -1
  83. package/operations/entry/filtering/plugins/index.d.ts +1 -1
  84. package/operations/entry/filtering/plugins/index.js +0 -5
  85. package/operations/entry/filtering/plugins/index.js.map +1 -1
  86. package/operations/entry/filtering/plugins/objectFilterCreate.js +3 -22
  87. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
  88. package/operations/entry/filtering/plugins/refFilterCreate.js +3 -19
  89. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
  90. package/operations/entry/filtering/sort.d.ts +4 -1
  91. package/operations/entry/filtering/sort.js +6 -17
  92. package/operations/entry/filtering/sort.js.map +1 -1
  93. package/operations/entry/filtering/systemFields.js +18 -2
  94. package/operations/entry/filtering/systemFields.js.map +1 -1
  95. package/operations/entry/filtering/transform.js +0 -3
  96. package/operations/entry/filtering/transform.js.map +1 -1
  97. package/operations/entry/filtering/values.d.ts +2 -0
  98. package/operations/entry/filtering/values.js +22 -0
  99. package/operations/entry/filtering/values.js.map +1 -0
  100. package/operations/entry/filtering/where.js +3 -8
  101. package/operations/entry/filtering/where.js.map +1 -1
  102. package/operations/entry/index.d.ts +1 -1
  103. package/operations/entry/index.js +189 -130
  104. package/operations/entry/index.js.map +1 -1
  105. package/operations/entry/keys.js +0 -18
  106. package/operations/entry/keys.js.map +1 -1
  107. package/operations/group/index.js +2 -32
  108. package/operations/group/index.js.map +1 -1
  109. package/operations/model/index.js +0 -25
  110. package/operations/model/index.js.map +1 -1
  111. package/operations/settings/index.js +0 -24
  112. package/operations/settings/index.js.map +1 -1
  113. package/operations/system/index.js +0 -17
  114. package/operations/system/index.js.map +1 -1
  115. package/package.json +21 -21
  116. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +2 -1
  117. package/plugins/CmsEntryFieldFilterPathPlugin.js +3 -15
  118. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
  119. package/plugins/CmsEntryFieldFilterPlugin.js +0 -7
  120. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
  121. package/plugins/CmsEntryFieldSortingPlugin.d.ts +42 -0
  122. package/plugins/CmsEntryFieldSortingPlugin.js +28 -0
  123. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -0
  124. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +11 -0
  125. package/plugins/CmsFieldFilterValueTransformPlugin.js +24 -0
  126. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -0
  127. package/plugins/index.d.ts +3 -0
  128. package/plugins/index.js +33 -2
  129. package/plugins/index.js.map +1 -1
  130. package/types.d.ts +10 -1
  131. package/types.js +0 -1
  132. package/types.js.map +1 -1
  133. package/operations/entry/filtering/createFilters.js +0 -155
  134. package/operations/entry/filtering/createFilters.js.map +0 -1
  135. package/operations/entry/systemFields.d.ts +0 -2
  136. package/operations/entry/systemFields.js +0 -74
  137. package/operations/entry/systemFields.js.map +0 -1
  138. package/operations/entry/utils.d.ts +0 -36
  139. package/operations/entry/utils.js +0 -684
  140. package/operations/entry/utils.js.map +0 -1
@@ -1,27 +1,22 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.sort = void 0;
9
-
10
8
  var _error = _interopRequireDefault(require("@webiny/error"));
11
-
12
9
  var _dotProp = _interopRequireDefault(require("dot-prop"));
13
-
14
10
  var _sortBy = _interopRequireDefault(require("lodash/sortBy"));
15
-
16
11
  var _extractSort = require("./extractSort");
17
-
18
12
  const sort = params => {
19
13
  const {
14
+ model,
20
15
  items,
21
16
  sort = [],
22
- fields
17
+ fields,
18
+ plugins
23
19
  } = params;
24
-
25
20
  if (items.length <= 1) {
26
21
  return items;
27
22
  } else if (sort.length === 0) {
@@ -31,23 +26,22 @@ const sort = params => {
31
26
  sort: sort
32
27
  });
33
28
  }
34
-
35
29
  const [firstSort] = sort;
36
-
37
30
  if (!firstSort) {
38
31
  throw new _error.default("Empty sort array item.", "SORT_EMPTY_ERROR", {
39
32
  sort
40
33
  });
41
34
  }
42
-
43
35
  const {
44
36
  fieldId,
45
37
  field,
46
38
  valuePath,
47
39
  reverse
48
40
  } = (0, _extractSort.extractSort)({
41
+ model,
49
42
  sortBy: firstSort,
50
- fields
43
+ fields,
44
+ plugins
51
45
  });
52
46
  const itemsToSort = items.map(item => {
53
47
  return {
@@ -58,23 +52,18 @@ const sort = params => {
58
52
  const sortedItems = (0, _sortBy.default)(itemsToSort, "value");
59
53
  const newItems = sortedItems.map(s => {
60
54
  const item = items.find(i => i.id === s.id);
61
-
62
55
  if (item) {
63
56
  return item;
64
57
  }
65
-
66
58
  throw new _error.default("Could not find item by given id after the sorting.", "SORTING_ITEMS_ERROR", {
67
59
  id: s.id,
68
60
  sortingBy: fieldId,
69
61
  reverse
70
62
  });
71
63
  });
72
-
73
64
  if (!reverse) {
74
65
  return newItems;
75
66
  }
76
-
77
67
  return newItems.reverse();
78
68
  };
79
-
80
69
  exports.sort = sort;
@@ -1 +1 @@
1
- {"version":3,"names":["sort","params","items","fields","length","push","WebinyError","firstSort","fieldId","field","valuePath","reverse","extractSort","sortBy","itemsToSort","map","item","id","value","transform","dotProp","get","sortedItems","lodashSortBy","newItems","s","find","i","sortingBy"],"sources":["sort.ts"],"sourcesContent":["import { CmsEntry } from \"@webiny/api-headless-cms/types\";\nimport WebinyError from \"@webiny/error\";\nimport dotProp from \"dot-prop\";\nimport lodashSortBy from \"lodash/sortBy\";\nimport { extractSort } from \"./extractSort\";\nimport { Field } from \"./types\";\n\ninterface Params {\n items: CmsEntry[];\n sort?: string[];\n fields: Record<string, Field>;\n}\n\ninterface SortedItem {\n id: string;\n value: any;\n}\n\nexport const sort = (params: Params): CmsEntry[] => {\n const { items, sort = [], fields } = params;\n if (items.length <= 1) {\n return items;\n } else if (sort.length === 0) {\n sort.push(\"savedOn_DESC\");\n } else if (sort.length > 1) {\n throw new WebinyError(\n \"Sorting is limited to a single field.\",\n \"SORT_MULTIPLE_FIELDS_ERROR\",\n {\n sort: sort\n }\n );\n }\n const [firstSort] = sort;\n if (!firstSort) {\n throw new WebinyError(\"Empty sort array item.\", \"SORT_EMPTY_ERROR\", {\n sort\n });\n }\n\n const { fieldId, field, valuePath, reverse } = extractSort({\n sortBy: firstSort,\n fields\n });\n\n const itemsToSort = items.map(item => {\n return {\n id: item.id,\n value: field.transform(dotProp.get(item, valuePath))\n };\n });\n const sortedItems: SortedItem[] = lodashSortBy(itemsToSort, \"value\");\n const newItems = sortedItems.map(s => {\n const item = items.find(i => i.id === s.id);\n if (item) {\n return item;\n }\n throw new WebinyError(\n \"Could not find item by given id after the sorting.\",\n \"SORTING_ITEMS_ERROR\",\n {\n id: s.id,\n sortingBy: fieldId,\n reverse\n }\n );\n });\n if (!reverse) {\n return newItems;\n }\n return newItems.reverse();\n};\n"],"mappings":";;;;;;;;;AACA;;AACA;;AACA;;AACA;;AAcO,MAAMA,IAAI,GAAIC,MAAD,IAAgC;EAChD,MAAM;IAAEC,KAAF;IAASF,IAAI,GAAG,EAAhB;IAAoBG;EAApB,IAA+BF,MAArC;;EACA,IAAIC,KAAK,CAACE,MAAN,IAAgB,CAApB,EAAuB;IACn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AAC,CAACR,EADV;MAEIW,SAAS,EAAEpB,OAFf;MAGIG;IAHJ,CAHE,CAAN;EASH,CAdgB,CAAjB;;EAeA,IAAI,CAACA,OAAL,EAAc;IACV,OAAOa,QAAP;EACH;;EACD,OAAOA,QAAQ,CAACb,OAAT,EAAP;AACH,CArDM"}
1
+ {"version":3,"names":["sort","params","model","items","fields","plugins","length","push","WebinyError","firstSort","fieldId","field","valuePath","reverse","extractSort","sortBy","itemsToSort","map","item","id","value","transform","dotProp","get","sortedItems","lodashSortBy","newItems","s","find","i","sortingBy"],"sources":["sort.ts"],"sourcesContent":["import { CmsEntry, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport WebinyError from \"@webiny/error\";\nimport dotProp from \"dot-prop\";\nimport lodashSortBy from \"lodash/sortBy\";\nimport { extractSort } from \"./extractSort\";\nimport { Field } from \"./types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\ninterface Params {\n model: CmsModel;\n items: CmsEntry[];\n sort?: string[];\n fields: Record<string, Field>;\n plugins: PluginsContainer;\n}\n\ninterface SortedItem {\n id: string;\n value: any;\n}\n\nexport const sort = (params: Params): CmsEntry[] => {\n const { model, items, sort = [], fields, plugins } = params;\n if (items.length <= 1) {\n return items;\n } else if (sort.length === 0) {\n sort.push(\"savedOn_DESC\");\n } else if (sort.length > 1) {\n throw new WebinyError(\n \"Sorting is limited to a single field.\",\n \"SORT_MULTIPLE_FIELDS_ERROR\",\n {\n sort: sort\n }\n );\n }\n const [firstSort] = sort;\n if (!firstSort) {\n throw new WebinyError(\"Empty sort array item.\", \"SORT_EMPTY_ERROR\", {\n sort\n });\n }\n\n const { fieldId, field, valuePath, reverse } = extractSort({\n model,\n sortBy: firstSort,\n fields,\n plugins\n });\n\n const itemsToSort = items.map(item => {\n return {\n id: item.id,\n value: field.transform(dotProp.get(item, valuePath))\n };\n });\n const sortedItems: SortedItem[] = lodashSortBy(itemsToSort, \"value\");\n const newItems = sortedItems.map(s => {\n const item = items.find(i => i.id === s.id);\n if (item) {\n return item;\n }\n throw new WebinyError(\n \"Could not find item by given id after the sorting.\",\n \"SORTING_ITEMS_ERROR\",\n {\n id: s.id,\n sortingBy: fieldId,\n reverse\n }\n );\n });\n if (!reverse) {\n return newItems;\n }\n return newItems.reverse();\n};\n"],"mappings":";;;;;;;AACA;AACA;AACA;AACA;AAiBO,MAAMA,IAAI,GAAIC,MAAc,IAAiB;EAChD,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEH,IAAI,GAAG,EAAE;IAAEI,MAAM;IAAEC;EAAQ,CAAC,GAAGJ,MAAM;EAC3D,IAAIE,KAAK,CAACG,MAAM,IAAI,CAAC,EAAE;IACnB,OAAOH,KAAK;EAChB,CAAC,MAAM,IAAIH,IAAI,CAACM,MAAM,KAAK,CAAC,EAAE;IAC1BN,IAAI,CAACO,IAAI,CAAC,cAAc,CAAC;EAC7B,CAAC,MAAM,IAAIP,IAAI,CAACM,MAAM,GAAG,CAAC,EAAE;IACxB,MAAM,IAAIE,cAAW,CACjB,uCAAuC,EACvC,4BAA4B,EAC5B;MACIR,IAAI,EAAEA;IACV,CAAC,CACJ;EACL;EACA,MAAM,CAACS,SAAS,CAAC,GAAGT,IAAI;EACxB,IAAI,CAACS,SAAS,EAAE;IACZ,MAAM,IAAID,cAAW,CAAC,wBAAwB,EAAE,kBAAkB,EAAE;MAChER;IACJ,CAAC,CAAC;EACN;EAEA,MAAM;IAAEU,OAAO;IAAEC,KAAK;IAAEC,SAAS;IAAEC;EAAQ,CAAC,GAAG,IAAAC,wBAAW,EAAC;IACvDZ,KAAK;IACLa,MAAM,EAAEN,SAAS;IACjBL,MAAM;IACNC;EACJ,CAAC,CAAC;EAEF,MAAMW,WAAW,GAAGb,KAAK,CAACc,GAAG,CAACC,IAAI,IAAI;IAClC,OAAO;MACHC,EAAE,EAAED,IAAI,CAACC,EAAE;MACXC,KAAK,EAAET,KAAK,CAACU,SAAS,CAACC,gBAAO,CAACC,GAAG,CAACL,IAAI,EAAEN,SAAS,CAAC;IACvD,CAAC;EACL,CAAC,CAAC;EACF,MAAMY,WAAyB,GAAG,IAAAC,eAAY,EAACT,WAAW,EAAE,OAAO,CAAC;EACpE,MAAMU,QAAQ,GAAGF,WAAW,CAACP,GAAG,CAACU,CAAC,IAAI;IAClC,MAAMT,IAAI,GAAGf,KAAK,CAACyB,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACV,EAAE,KAAKQ,CAAC,CAACR,EAAE,CAAC;IAC3C,IAAID,IAAI,EAAE;MACN,OAAOA,IAAI;IACf;IACA,MAAM,IAAIV,cAAW,CACjB,oDAAoD,EACpD,qBAAqB,EACrB;MACIW,EAAE,EAAEQ,CAAC,CAACR,EAAE;MACRW,SAAS,EAAEpB,OAAO;MAClBG;IACJ,CAAC,CACJ;EACL,CAAC,CAAC;EACF,IAAI,CAACA,OAAO,EAAE;IACV,OAAOa,QAAQ;EACnB;EACA,OAAOA,QAAQ,CAACb,OAAO,EAAE;AAC7B,CAAC;AAAC"}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createSystemFields = void 0;
7
-
8
7
  const createSystemFields = () => {
9
8
  return [{
10
9
  id: "id",
@@ -45,6 +44,24 @@ const createSystemFields = () => {
45
44
  storageId: "meta",
46
45
  fieldId: "meta",
47
46
  label: "Meta"
47
+ }, {
48
+ id: "wbyAco_location",
49
+ type: "object",
50
+ storageId: "location",
51
+ label: "Location",
52
+ fieldId: "wbyAco_location",
53
+ settings: {
54
+ fields: [{
55
+ id: "folderId",
56
+ type: "text",
57
+ fieldId: "folderId",
58
+ label: "Folder ID",
59
+ storageId: "folderId",
60
+ settings: {
61
+ path: "location.folderId"
62
+ }
63
+ }]
64
+ }
48
65
  }, {
49
66
  id: "ownedBy",
50
67
  type: "plainObject",
@@ -68,5 +85,4 @@ const createSystemFields = () => {
68
85
  label: "Status"
69
86
  }];
70
87
  };
71
-
72
88
  exports.createSystemFields = createSystemFields;
@@ -1 +1 @@
1
- {"version":3,"names":["createSystemFields","id","type","storageId","fieldId","label","settings","path"],"sources":["systemFields.ts"],"sourcesContent":["import { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\ntype Field = Pick<CmsModelField, \"id\" | \"type\" | \"storageId\" | \"fieldId\" | \"settings\" | \"label\">;\n\nexport const createSystemFields = (): Field[] => {\n return [\n {\n id: \"id\",\n type: \"text\",\n storageId: \"id\",\n fieldId: \"id\",\n label: \"ID\"\n },\n {\n id: \"entryId\",\n type: \"text\",\n storageId: \"entryId\",\n fieldId: \"entryId\",\n label: \"Entry ID\"\n },\n {\n id: \"createdOn\",\n type: \"datetime\",\n storageId: \"createdOn\",\n fieldId: \"createdOn\",\n label: \"Created On\"\n },\n {\n id: \"savedOn\",\n type: \"datetime\",\n storageId: \"savedOn\",\n fieldId: \"savedOn\",\n label: \"Saved On\"\n },\n {\n id: \"createdBy\",\n type: \"plainObject\",\n storageId: \"createdBy\",\n fieldId: \"createdBy\",\n label: \"Created By\",\n settings: {\n path: \"createdBy.id\"\n }\n },\n {\n id: \"meta\",\n type: \"plainObject\",\n storageId: \"meta\",\n fieldId: \"meta\",\n label: \"Meta\"\n },\n {\n id: \"ownedBy\",\n type: \"plainObject\",\n storageId: \"ownedBy\",\n fieldId: \"ownedBy\",\n label: \"Owned By\",\n settings: {\n path: \"ownedBy.id\"\n }\n },\n {\n id: \"version\",\n type: \"number\",\n storageId: \"version\",\n fieldId: \"version\",\n label: \"Version\"\n },\n {\n id: \"status\",\n type: \"text\",\n storageId: \"status\",\n fieldId: \"status\",\n label: \"Status\"\n }\n ];\n};\n"],"mappings":";;;;;;;AAIO,MAAMA,kBAAkB,GAAG,MAAe;EAC7C,OAAO,CACH;IACIC,EAAE,EAAE,IADR;IAEIC,IAAI,EAAE,MAFV;IAGIC,SAAS,EAAE,IAHf;IAIIC,OAAO,EAAE,IAJb;IAKIC,KAAK,EAAE;EALX,CADG,EAQH;IACIJ,EAAE,EAAE,SADR;IAEIC,IAAI,EAAE,MAFV;IAGIC,SAAS,EAAE,SAHf;IAIIC,OAAO,EAAE,SAJb;IAKIC,KAAK,EAAE;EALX,CARG,EAeH;IACIJ,EAAE,EAAE,WADR;IAEIC,IAAI,EAAE,UAFV;IAGIC,SAAS,EAAE,WAHf;IAIIC,OAAO,EAAE,WAJb;IAKIC,KAAK,EAAE;EALX,CAfG,EAsBH;IACIJ,EAAE,EAAE,SADR;IAEIC,IAAI,EAAE,UAFV;IAGIC,SAAS,EAAE,SAHf;IAIIC,OAAO,EAAE,SAJb;IAKIC,KAAK,EAAE;EALX,CAtBG,EA6BH;IACIJ,EAAE,EAAE,WADR;IAEIC,IAAI,EAAE,aAFV;IAGIC,SAAS,EAAE,WAHf;IAIIC,OAAO,EAAE,WAJb;IAKIC,KAAK,EAAE,YALX;IAMIC,QAAQ,EAAE;MACNC,IAAI,EAAE;IADA;EANd,CA7BG,EAuCH;IACIN,EAAE,EAAE,MADR;IAEIC,IAAI,EAAE,aAFV;IAGIC,SAAS,EAAE,MAHf;IAIIC,OAAO,EAAE,MAJb;IAKIC,KAAK,EAAE;EALX,CAvCG,EA8CH;IACIJ,EAAE,EAAE,SADR;IAEIC,IAAI,EAAE,aAFV;IAGIC,SAAS,EAAE,SAHf;IAIIC,OAAO,EAAE,SAJb;IAKIC,KAAK,EAAE,UALX;IAMIC,QAAQ,EAAE;MACNC,IAAI,EAAE;IADA;EANd,CA9CG,EAwDH;IACIN,EAAE,EAAE,SADR;IAEIC,IAAI,EAAE,QAFV;IAGIC,SAAS,EAAE,SAHf;IAIIC,OAAO,EAAE,SAJb;IAKIC,KAAK,EAAE;EALX,CAxDG,EA+DH;IACIJ,EAAE,EAAE,QADR;IAEIC,IAAI,EAAE,MAFV;IAGIC,SAAS,EAAE,QAHf;IAIIC,OAAO,EAAE,QAJb;IAKIC,KAAK,EAAE;EALX,CA/DG,CAAP;AAuEH,CAxEM"}
1
+ {"version":3,"names":["createSystemFields","id","type","storageId","fieldId","label","settings","path","fields"],"sources":["systemFields.ts"],"sourcesContent":["import { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\ntype Field = Pick<CmsModelField, \"id\" | \"type\" | \"storageId\" | \"fieldId\" | \"settings\" | \"label\">;\n\nexport const createSystemFields = (): Field[] => {\n return [\n {\n id: \"id\",\n type: \"text\",\n storageId: \"id\",\n fieldId: \"id\",\n label: \"ID\"\n },\n {\n id: \"entryId\",\n type: \"text\",\n storageId: \"entryId\",\n fieldId: \"entryId\",\n label: \"Entry ID\"\n },\n {\n id: \"createdOn\",\n type: \"datetime\",\n storageId: \"createdOn\",\n fieldId: \"createdOn\",\n label: \"Created On\"\n },\n {\n id: \"savedOn\",\n type: \"datetime\",\n storageId: \"savedOn\",\n fieldId: \"savedOn\",\n label: \"Saved On\"\n },\n {\n id: \"createdBy\",\n type: \"plainObject\",\n storageId: \"createdBy\",\n fieldId: \"createdBy\",\n label: \"Created By\",\n settings: {\n path: \"createdBy.id\"\n }\n },\n {\n id: \"meta\",\n type: \"plainObject\",\n storageId: \"meta\",\n fieldId: \"meta\",\n label: \"Meta\"\n },\n {\n id: \"wbyAco_location\",\n type: \"object\",\n storageId: \"location\",\n label: \"Location\",\n fieldId: \"wbyAco_location\",\n settings: {\n fields: [\n {\n id: \"folderId\",\n type: \"text\",\n fieldId: \"folderId\",\n label: \"Folder ID\",\n storageId: \"folderId\",\n settings: {\n path: \"location.folderId\"\n }\n }\n ]\n }\n },\n {\n id: \"ownedBy\",\n type: \"plainObject\",\n storageId: \"ownedBy\",\n fieldId: \"ownedBy\",\n label: \"Owned By\",\n settings: {\n path: \"ownedBy.id\"\n }\n },\n {\n id: \"version\",\n type: \"number\",\n storageId: \"version\",\n fieldId: \"version\",\n label: \"Version\"\n },\n {\n id: \"status\",\n type: \"text\",\n storageId: \"status\",\n fieldId: \"status\",\n label: \"Status\"\n }\n ];\n};\n"],"mappings":";;;;;;AAIO,MAAMA,kBAAkB,GAAG,MAAe;EAC7C,OAAO,CACH;IACIC,EAAE,EAAE,IAAI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C,IAAI,EAAE,aAAa;IACnBC,SAAS,EAAE,SAAS;IACpBC,OAAO,EAAE,SAAS;IAClBC,KAAK,EAAE,UAAU;IACjBC,QAAQ,EAAE;MACNC,IAAI,EAAE;IACV;EACJ,CAAC,EACD;IACIN,EAAE,EAAE,SAAS;IACbC,IAAI,EAAE,QAAQ;IACdC,SAAS,EAAE,SAAS;IACpBC,OAAO,EAAE,SAAS;IAClBC,KAAK,EAAE;EACX,CAAC,EACD;IACIJ,EAAE,EAAE,QAAQ;IACZC,IAAI,EAAE,MAAM;IACZC,SAAS,EAAE,QAAQ;IACnBC,OAAO,EAAE,QAAQ;IACjBC,KAAK,EAAE;EACX,CAAC,CACJ;AACL,CAAC;AAAC"}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.transformValue = void 0;
7
-
8
7
  const transformValue = ({
9
8
  value,
10
9
  transform
@@ -12,8 +11,6 @@ const transformValue = ({
12
11
  if (Array.isArray(value)) {
13
12
  return value.map(v => transform(v));
14
13
  }
15
-
16
14
  return transform(value);
17
15
  };
18
-
19
16
  exports.transformValue = transformValue;
@@ -1 +1 @@
1
- {"version":3,"names":["transformValue","value","transform","Array","isArray","map","v"],"sources":["transform.ts"],"sourcesContent":["import { Field } from \"./types\";\n\ninterface Params extends Pick<Field, \"transform\"> {\n value: any;\n}\nexport const transformValue = ({ value, transform }: Params): any => {\n if (Array.isArray(value)) {\n return value.map(v => transform(v));\n }\n return transform(value);\n};\n"],"mappings":";;;;;;;AAKO,MAAMA,cAAc,GAAG,CAAC;EAAEC,KAAF;EAASC;AAAT,CAAD,KAAuC;EACjE,IAAIC,KAAK,CAACC,OAAN,CAAcH,KAAd,CAAJ,EAA0B;IACtB,OAAOA,KAAK,CAACI,GAAN,CAAUC,CAAC,IAAIJ,SAAS,CAACI,CAAD,CAAxB,CAAP;EACH;;EACD,OAAOJ,SAAS,CAACD,KAAD,CAAhB;AACH,CALM"}
1
+ {"version":3,"names":["transformValue","value","transform","Array","isArray","map","v"],"sources":["transform.ts"],"sourcesContent":["import { Field } from \"./types\";\n\ninterface Params extends Pick<Field, \"transform\"> {\n value: any;\n}\nexport const transformValue = ({ value, transform }: Params): any => {\n if (Array.isArray(value)) {\n return value.map(v => transform(v));\n }\n return transform(value);\n};\n"],"mappings":";;;;;;AAKO,MAAMA,cAAc,GAAG,CAAC;EAAEC,KAAK;EAAEC;AAAkB,CAAC,KAAU;EACjE,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE;IACtB,OAAOA,KAAK,CAACI,GAAG,CAACC,CAAC,IAAIJ,SAAS,CAACI,CAAC,CAAC,CAAC;EACvC;EACA,OAAOJ,SAAS,CAACD,KAAK,CAAC;AAC3B,CAAC;AAAC"}
@@ -0,0 +1,2 @@
1
+ import { CmsEntryListWhere } from "@webiny/api-headless-cms/types";
2
+ export declare const getWhereValues: (value: unknown, condition: "AND" | "OR") => CmsEntryListWhere[];
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getWhereValues = void 0;
8
+ var _error = _interopRequireDefault(require("@webiny/error"));
9
+ const getWhereValues = (value, condition) => {
10
+ const values = value;
11
+ if (!Array.isArray(values)) {
12
+ throw new _error.default(`Trying to run filtering with "${condition}", but the value sent is not an array.`, `MALFORMED_${condition}_CONDITION`, {
13
+ value
14
+ });
15
+ } else if (values.length === 0) {
16
+ throw new _error.default(`Trying to run filtering with "${condition}", but the value sent is empty array.`, `MALFORMED_${condition}_CONDITION`, {
17
+ value
18
+ });
19
+ }
20
+ return values;
21
+ };
22
+ exports.getWhereValues = getWhereValues;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getWhereValues","value","condition","values","Array","isArray","WebinyError","length"],"sources":["values.ts"],"sourcesContent":["import { CmsEntryListWhere } from \"@webiny/api-headless-cms/types\";\nimport WebinyError from \"@webiny/error\";\n\nexport const getWhereValues = (value: unknown, condition: \"AND\" | \"OR\") => {\n const values = value as CmsEntryListWhere[] | undefined;\n if (!Array.isArray(values)) {\n throw new WebinyError(\n `Trying to run filtering with \"${condition}\", but the value sent is not an array.`,\n `MALFORMED_${condition}_CONDITION`,\n {\n value\n }\n );\n } else if (values.length === 0) {\n throw new WebinyError(\n `Trying to run filtering with \"${condition}\", but the value sent is empty array.`,\n `MALFORMED_${condition}_CONDITION`,\n {\n value\n }\n );\n }\n return values;\n};\n"],"mappings":";;;;;;;AACA;AAEO,MAAMA,cAAc,GAAG,CAACC,KAAc,EAAEC,SAAuB,KAAK;EACvE,MAAMC,MAAM,GAAGF,KAAwC;EACvD,IAAI,CAACG,KAAK,CAACC,OAAO,CAACF,MAAM,CAAC,EAAE;IACxB,MAAM,IAAIG,cAAW,CAChB,iCAAgCJ,SAAU,wCAAuC,EACjF,aAAYA,SAAU,YAAW,EAClC;MACID;IACJ,CAAC,CACJ;EACL,CAAC,MAAM,IAAIE,MAAM,CAACI,MAAM,KAAK,CAAC,EAAE;IAC5B,MAAM,IAAID,cAAW,CAChB,iCAAgCJ,SAAU,uCAAsC,EAChF,aAAYA,SAAU,YAAW,EAClC;MACID;IACJ,CAAC,CACJ;EACL;EACA,OAAOE,MAAM;AACjB,CAAC;AAAC"}
@@ -4,20 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.extractWhereParams = void 0;
7
-
8
7
  const extractWhereParams = key => {
9
- const result = key.split("_");
8
+ const isWbyAco = key.match("wbyAco_") !== null;
9
+ const result = key.replace("wbyAco_", "").split("_");
10
10
  const fieldId = result.shift();
11
-
12
11
  if (!fieldId) {
13
12
  return null;
14
13
  }
15
-
16
14
  const rawOp = result.length === 0 ? "eq" : result.join("_");
17
15
  /**
18
16
  * When rawOp is not, it means it is equal negated so just return that.
19
17
  */
20
-
21
18
  if (rawOp === "not") {
22
19
  return {
23
20
  fieldId,
@@ -25,14 +22,12 @@ const extractWhereParams = key => {
25
22
  negate: true
26
23
  };
27
24
  }
28
-
29
25
  const negate = rawOp.match("not_") !== null;
30
26
  const operation = rawOp.replace("not_", "");
31
27
  return {
32
- fieldId,
28
+ fieldId: isWbyAco ? `wbyAco_${fieldId}` : fieldId,
33
29
  operation,
34
30
  negate
35
31
  };
36
32
  };
37
-
38
33
  exports.extractWhereParams = extractWhereParams;
@@ -1 +1 @@
1
- {"version":3,"names":["extractWhereParams","key","result","split","fieldId","shift","rawOp","length","join","operation","negate","match","replace"],"sources":["where.ts"],"sourcesContent":["export const extractWhereParams = (key: string) => {\n const result = key.split(\"_\");\n const fieldId = result.shift();\n if (!fieldId) {\n return null;\n }\n const rawOp = result.length === 0 ? \"eq\" : result.join(\"_\");\n /**\n * When rawOp is not, it means it is equal negated so just return that.\n */\n if (rawOp === \"not\") {\n return {\n fieldId,\n operation: \"eq\",\n negate: true\n };\n }\n const negate = rawOp.match(\"not_\") !== null;\n const operation = rawOp.replace(\"not_\", \"\");\n return {\n fieldId,\n operation,\n negate\n };\n};\n"],"mappings":";;;;;;;AAAO,MAAMA,kBAAkB,GAAIC,GAAD,IAAiB;EAC/C,MAAMC,MAAM,GAAGD,GAAG,CAACE,KAAJ,CAAU,GAAV,CAAf;EACA,MAAMC,OAAO,GAAGF,MAAM,CAACG,KAAP,EAAhB;;EACA,IAAI,CAACD,OAAL,EAAc;IACV,OAAO,IAAP;EACH;;EACD,MAAME,KAAK,GAAGJ,MAAM,CAACK,MAAP,KAAkB,CAAlB,GAAsB,IAAtB,GAA6BL,MAAM,CAACM,IAAP,CAAY,GAAZ,CAA3C;EACA;AACJ;AACA;;EACI,IAAIF,KAAK,KAAK,KAAd,EAAqB;IACjB,OAAO;MACHF,OADG;MAEHK,SAAS,EAAE,IAFR;MAGHC,MAAM,EAAE;IAHL,CAAP;EAKH;;EACD,MAAMA,MAAM,GAAGJ,KAAK,CAACK,KAAN,CAAY,MAAZ,MAAwB,IAAvC;EACA,MAAMF,SAAS,GAAGH,KAAK,CAACM,OAAN,CAAc,MAAd,EAAsB,EAAtB,CAAlB;EACA,OAAO;IACHR,OADG;IAEHK,SAFG;IAGHC;EAHG,CAAP;AAKH,CAxBM"}
1
+ {"version":3,"names":["extractWhereParams","key","isWbyAco","match","result","replace","split","fieldId","shift","rawOp","length","join","operation","negate"],"sources":["where.ts"],"sourcesContent":["export const extractWhereParams = (key: string) => {\n const isWbyAco = key.match(\"wbyAco_\") !== null;\n const result = key.replace(\"wbyAco_\", \"\").split(\"_\");\n const fieldId = result.shift();\n if (!fieldId) {\n return null;\n }\n const rawOp = result.length === 0 ? \"eq\" : result.join(\"_\");\n /**\n * When rawOp is not, it means it is equal negated so just return that.\n */\n if (rawOp === \"not\") {\n return {\n fieldId,\n operation: \"eq\",\n negate: true\n };\n }\n const negate = rawOp.match(\"not_\") !== null;\n const operation = rawOp.replace(\"not_\", \"\");\n return {\n fieldId: isWbyAco ? `wbyAco_${fieldId}` : fieldId,\n operation,\n negate\n };\n};\n"],"mappings":";;;;;;AAAO,MAAMA,kBAAkB,GAAIC,GAAW,IAAK;EAC/C,MAAMC,QAAQ,GAAGD,GAAG,CAACE,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI;EAC9C,MAAMC,MAAM,GAAGH,GAAG,CAACI,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC;EACpD,MAAMC,OAAO,GAAGH,MAAM,CAACI,KAAK,EAAE;EAC9B,IAAI,CAACD,OAAO,EAAE;IACV,OAAO,IAAI;EACf;EACA,MAAME,KAAK,GAAGL,MAAM,CAACM,MAAM,KAAK,CAAC,GAAG,IAAI,GAAGN,MAAM,CAACO,IAAI,CAAC,GAAG,CAAC;EAC3D;AACJ;AACA;EACI,IAAIF,KAAK,KAAK,KAAK,EAAE;IACjB,OAAO;MACHF,OAAO;MACPK,SAAS,EAAE,IAAI;MACfC,MAAM,EAAE;IACZ,CAAC;EACL;EACA,MAAMA,MAAM,GAAGJ,KAAK,CAACN,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI;EAC3C,MAAMS,SAAS,GAAGH,KAAK,CAACJ,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;EAC3C,OAAO;IACHE,OAAO,EAAEL,QAAQ,GAAI,UAASK,OAAQ,EAAC,GAAGA,OAAO;IACjDK,SAAS;IACTC;EACJ,CAAC;AACL,CAAC;AAAC"}
@@ -1,6 +1,6 @@
1
- import { CmsEntryStorageOperations } from "@webiny/api-headless-cms/types";
2
1
  import { Entity } from "dynamodb-toolbox";
3
2
  import { PluginsContainer } from "@webiny/plugins";
3
+ import { CmsEntryStorageOperations } from "../../types";
4
4
  export interface CreateEntriesStorageOperationsParams {
5
5
  entity: Entity<any>;
6
6
  plugins: PluginsContainer;