@webiny/api-headless-cms-ddb 0.0.0-unstable.bca7b3e350 → 0.0.0-unstable.c27f4d8a31

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 (169) hide show
  1. package/README.md +6 -20
  2. package/definitions/entry.d.ts +4 -5
  3. package/definitions/entry.js +6 -89
  4. package/definitions/entry.js.map +1 -1
  5. package/definitions/group.d.ts +4 -5
  6. package/definitions/group.js +6 -63
  7. package/definitions/group.js.map +1 -1
  8. package/definitions/model.d.ts +4 -5
  9. package/definitions/model.js +6 -90
  10. package/definitions/model.js.map +1 -1
  11. package/definitions/table.d.ts +4 -6
  12. package/definitions/table.js +7 -28
  13. package/definitions/table.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 +1 -1
  18. package/dynamoDb/index.js +8 -20
  19. package/dynamoDb/index.js.map +1 -1
  20. package/dynamoDb/path/locationFolderId.d.ts +2 -0
  21. package/dynamoDb/path/locationFolderId.js +34 -0
  22. package/dynamoDb/path/locationFolderId.js.map +1 -0
  23. package/dynamoDb/path/plainObject.d.ts +1 -1
  24. package/dynamoDb/path/plainObject.js +6 -20
  25. package/dynamoDb/path/plainObject.js.map +1 -1
  26. package/dynamoDb/storage/longText.js +13 -35
  27. package/dynamoDb/storage/longText.js.map +1 -1
  28. package/dynamoDb/storage/richText.js +27 -88
  29. package/dynamoDb/storage/richText.js.map +1 -1
  30. package/dynamoDb/transformValue/datetime.d.ts +1 -1
  31. package/dynamoDb/transformValue/datetime.js +7 -19
  32. package/dynamoDb/transformValue/datetime.js.map +1 -1
  33. package/index.d.ts +2 -2
  34. package/index.js +47 -111
  35. package/index.js.map +1 -1
  36. package/operations/entry/dataLoader/DataLoaderCache.d.ts +16 -0
  37. package/operations/entry/dataLoader/DataLoaderCache.js +31 -0
  38. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
  39. package/operations/entry/dataLoader/constants.d.ts +1 -0
  40. package/operations/entry/dataLoader/constants.js +4 -0
  41. package/operations/entry/dataLoader/constants.js.map +1 -0
  42. package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
  43. package/operations/entry/dataLoader/createBatchScheduleFn.js +19 -0
  44. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
  45. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
  46. package/operations/entry/dataLoader/getAllEntryRevisions.js +35 -0
  47. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
  48. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
  49. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +50 -0
  50. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
  51. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
  52. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +50 -0
  53. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
  54. package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
  55. package/operations/entry/dataLoader/getRevisionById.js +56 -0
  56. package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
  57. package/operations/entry/dataLoader/index.d.ts +8 -0
  58. package/operations/entry/dataLoader/index.js +19 -0
  59. package/operations/entry/dataLoader/index.js.map +1 -0
  60. package/operations/entry/dataLoader/types.d.ts +6 -0
  61. package/operations/entry/dataLoader/types.js +3 -0
  62. package/operations/entry/dataLoader/types.js.map +1 -0
  63. package/operations/entry/dataLoaders.d.ts +14 -30
  64. package/operations/entry/dataLoaders.js +58 -271
  65. package/operations/entry/dataLoaders.js.map +1 -1
  66. package/operations/entry/filtering/createExpressions.d.ts +5 -5
  67. package/operations/entry/filtering/createExpressions.js +30 -68
  68. package/operations/entry/filtering/createExpressions.js.map +1 -1
  69. package/operations/entry/filtering/createFields.d.ts +6 -4
  70. package/operations/entry/filtering/createFields.js +86 -103
  71. package/operations/entry/filtering/createFields.js.map +1 -1
  72. package/operations/entry/filtering/extractSort.d.ts +6 -6
  73. package/operations/entry/filtering/extractSort.js +39 -32
  74. package/operations/entry/filtering/extractSort.js.map +1 -1
  75. package/operations/entry/filtering/filter.d.ts +6 -6
  76. package/operations/entry/filtering/filter.js +36 -64
  77. package/operations/entry/filtering/filter.js.map +1 -1
  78. package/operations/entry/filtering/fullTextSearch.d.ts +3 -3
  79. package/operations/entry/filtering/fullTextSearch.js +6 -24
  80. package/operations/entry/filtering/fullTextSearch.js.map +1 -1
  81. package/operations/entry/filtering/getValue.js +5 -27
  82. package/operations/entry/filtering/getValue.js.map +1 -1
  83. package/operations/entry/filtering/index.d.ts +2 -2
  84. package/operations/entry/filtering/index.js +3 -20
  85. package/operations/entry/filtering/index.js.map +1 -1
  86. package/operations/entry/filtering/mapPlugins.d.ts +2 -2
  87. package/operations/entry/filtering/mapPlugins.js +4 -18
  88. package/operations/entry/filtering/mapPlugins.js.map +1 -1
  89. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +2 -2
  90. package/operations/entry/filtering/plugins/defaultFilterCreate.js +9 -20
  91. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -1
  92. package/operations/entry/filtering/plugins/index.d.ts +1 -1
  93. package/operations/entry/filtering/plugins/index.js +7 -16
  94. package/operations/entry/filtering/plugins/index.js.map +1 -1
  95. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +2 -2
  96. package/operations/entry/filtering/plugins/objectFilterCreate.js +16 -39
  97. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
  98. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +3 -2
  99. package/operations/entry/filtering/plugins/refFilterCreate.js +21 -36
  100. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
  101. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +2 -0
  102. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +57 -0
  103. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -0
  104. package/operations/entry/filtering/sort.d.ts +6 -6
  105. package/operations/entry/filtering/sort.js +17 -34
  106. package/operations/entry/filtering/sort.js.map +1 -1
  107. package/operations/entry/filtering/systemFields.d.ts +2 -4
  108. package/operations/entry/filtering/systemFields.js +102 -43
  109. package/operations/entry/filtering/systemFields.js.map +1 -1
  110. package/operations/entry/filtering/transform.d.ts +1 -1
  111. package/operations/entry/filtering/transform.js +2 -10
  112. package/operations/entry/filtering/transform.js.map +1 -1
  113. package/operations/entry/filtering/types.d.ts +3 -3
  114. package/operations/entry/filtering/types.js +2 -4
  115. package/operations/entry/filtering/types.js.map +1 -1
  116. package/operations/entry/filtering/values.d.ts +1 -1
  117. package/operations/entry/filtering/values.js +5 -17
  118. package/operations/entry/filtering/values.js.map +1 -1
  119. package/operations/entry/filtering/where.js +5 -15
  120. package/operations/entry/filtering/where.js.map +1 -1
  121. package/operations/entry/index.d.ts +3 -4
  122. package/operations/entry/index.js +732 -410
  123. package/operations/entry/index.js.map +1 -1
  124. package/operations/entry/keys.d.ts +40 -2
  125. package/operations/entry/keys.js +54 -47
  126. package/operations/entry/keys.js.map +1 -1
  127. package/operations/group/index.d.ts +4 -4
  128. package/operations/group/index.js +44 -91
  129. package/operations/group/index.js.map +1 -1
  130. package/operations/model/index.d.ts +3 -3
  131. package/operations/model/index.js +36 -70
  132. package/operations/model/index.js.map +1 -1
  133. package/package.json +22 -29
  134. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +4 -3
  135. package/plugins/CmsEntryFieldFilterPathPlugin.js +14 -29
  136. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
  137. package/plugins/CmsEntryFieldFilterPlugin.d.ts +10 -10
  138. package/plugins/CmsEntryFieldFilterPlugin.js +9 -19
  139. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
  140. package/plugins/CmsEntryFieldSortingPlugin.d.ts +2 -2
  141. package/plugins/CmsEntryFieldSortingPlugin.js +5 -24
  142. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -1
  143. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +11 -0
  144. package/plugins/CmsFieldFilterValueTransformPlugin.js +16 -0
  145. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -0
  146. package/plugins/index.d.ts +4 -3
  147. package/plugins/index.js +5 -43
  148. package/plugins/index.js.map +1 -1
  149. package/types.d.ts +24 -19
  150. package/types.js +5 -13
  151. package/types.js.map +1 -1
  152. package/definitions/settings.d.ts +0 -9
  153. package/definitions/settings.js +0 -58
  154. package/definitions/settings.js.map +0 -1
  155. package/definitions/system.d.ts +0 -9
  156. package/definitions/system.js +0 -46
  157. package/definitions/system.js.map +0 -1
  158. package/dynamoDb/storage/date.d.ts +0 -3
  159. package/dynamoDb/storage/date.js +0 -109
  160. package/dynamoDb/storage/date.js.map +0 -1
  161. package/operations/entry/systemFields.d.ts +0 -2
  162. package/operations/entry/systemFields.js +0 -74
  163. package/operations/entry/systemFields.js.map +0 -1
  164. package/operations/settings/index.d.ts +0 -7
  165. package/operations/settings/index.js +0 -135
  166. package/operations/settings/index.js.map +0 -1
  167. package/operations/system/index.d.ts +0 -7
  168. package/operations/system/index.js +0 -99
  169. package/operations/system/index.js.map +0 -1
@@ -1,12 +1,12 @@
1
- import { CmsEntry, CmsModel } from "@webiny/api-headless-cms/types";
2
- import { Field } from "./types";
3
- import { PluginsContainer } from "@webiny/plugins";
4
- interface Params {
1
+ import type { CmsEntry, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
2
+ import type { Field } from "./types.js";
3
+ import type { PluginsContainer } from "@webiny/plugins";
4
+ interface Params<T extends CmsEntryValues = CmsEntryValues> {
5
5
  model: CmsModel;
6
- items: CmsEntry[];
6
+ items: CmsEntry<T>[];
7
7
  sort?: string[];
8
8
  fields: Record<string, Field>;
9
9
  plugins: PluginsContainer;
10
10
  }
11
- export declare const sort: (params: Params) => CmsEntry[];
11
+ export declare const sort: <T extends CmsEntryValues = CmsEntryValues>(params: Params<T>) => CmsEntry<T>[];
12
12
  export {};
@@ -1,21 +1,8 @@
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.sort = void 0;
9
-
10
- var _error = _interopRequireDefault(require("@webiny/error"));
11
-
12
- var _dotProp = _interopRequireDefault(require("dot-prop"));
13
-
14
- var _sortBy = _interopRequireDefault(require("lodash/sortBy"));
15
-
16
- var _extractSort = require("./extractSort");
17
-
18
- const sort = params => {
1
+ import WebinyError from "@webiny/error";
2
+ import dotProp from "dot-prop";
3
+ import lodashSortBy from "lodash/sortBy.js";
4
+ import { extractSort } from "./extractSort.js";
5
+ export const sort = params => {
19
6
  const {
20
7
  model,
21
8
  items,
@@ -23,31 +10,27 @@ const sort = params => {
23
10
  fields,
24
11
  plugins
25
12
  } = params;
26
-
27
13
  if (items.length <= 1) {
28
14
  return items;
29
15
  } else if (sort.length === 0) {
30
16
  sort.push("savedOn_DESC");
31
17
  } else if (sort.length > 1) {
32
- throw new _error.default("Sorting is limited to a single field.", "SORT_MULTIPLE_FIELDS_ERROR", {
33
- sort: sort
18
+ throw new WebinyError("Sorting is limited to a single field on DynamoDB only system.", "SORT_MULTIPLE_FIELDS_ERROR", {
19
+ sort
34
20
  });
35
21
  }
36
-
37
22
  const [firstSort] = sort;
38
-
39
23
  if (!firstSort) {
40
- throw new _error.default("Empty sort array item.", "SORT_EMPTY_ERROR", {
24
+ throw new WebinyError("Empty sort array item.", "SORT_EMPTY_ERROR", {
41
25
  sort
42
26
  });
43
27
  }
44
-
45
28
  const {
46
29
  fieldId,
47
30
  field,
48
31
  valuePath,
49
32
  reverse
50
- } = (0, _extractSort.extractSort)({
33
+ } = extractSort({
51
34
  model,
52
35
  sortBy: firstSort,
53
36
  fields,
@@ -56,29 +39,29 @@ const sort = params => {
56
39
  const itemsToSort = items.map(item => {
57
40
  return {
58
41
  id: item.id,
59
- value: field.transform(_dotProp.default.get(item, valuePath))
42
+ value: field.transform(dotProp.get(item, valuePath))
60
43
  };
61
44
  });
62
- const sortedItems = (0, _sortBy.default)(itemsToSort, "value");
45
+ const sortedItems = lodashSortBy(itemsToSort, "value");
63
46
  const newItems = sortedItems.map(s => {
64
47
  const item = items.find(i => i.id === s.id);
65
-
66
48
  if (item) {
67
49
  return item;
68
50
  }
69
-
70
- throw new _error.default("Could not find item by given id after the sorting.", "SORTING_ITEMS_ERROR", {
51
+ /**
52
+ * This is impossible to happen because sorting items does not remove the items.
53
+ * BUT, we need to have this check just in case for development purposes.
54
+ */
55
+ throw new WebinyError("Could not find item by given id after the sorting.", "SORTING_ITEMS_ERROR", {
71
56
  id: s.id,
72
57
  sortingBy: fieldId,
73
58
  reverse
74
59
  });
75
60
  });
76
-
77
61
  if (!reverse) {
78
62
  return newItems;
79
63
  }
80
-
81
64
  return newItems.reverse();
82
65
  };
83
66
 
84
- exports.sort = sort;
67
+ //# sourceMappingURL=sort.js.map
@@ -1 +1 @@
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,MAAD,IAAgC;EAChD,MAAM;IAAEC,KAAF;IAASC,KAAT;IAAgBH,IAAI,GAAG,EAAvB;IAA2BI,MAA3B;IAAmCC;EAAnC,IAA+CJ,MAArD;;EACA,IAAIE,KAAK,CAACG,MAAN,IAAgB,CAApB,EAAuB;IACnB,OAAOH,KAAP;EACH,CAFD,MAEO,IAAIH,IAAI,CAACM,MAAL,KAAgB,CAApB,EAAuB;IAC1BN,IAAI,CAACO,IAAL,CAAU,cAAV;EACH,CAFM,MAEA,IAAIP,IAAI,CAACM,MAAL,GAAc,CAAlB,EAAqB;IACxB,MAAM,IAAIE,cAAJ,CACF,uCADE,EAEF,4BAFE,EAGF;MACIR,IAAI,EAAEA;IADV,CAHE,CAAN;EAOH;;EACD,MAAM,CAACS,SAAD,IAAcT,IAApB;;EACA,IAAI,CAACS,SAAL,EAAgB;IACZ,MAAM,IAAID,cAAJ,CAAgB,wBAAhB,EAA0C,kBAA1C,EAA8D;MAChER;IADgE,CAA9D,CAAN;EAGH;;EAED,MAAM;IAAEU,OAAF;IAAWC,KAAX;IAAkBC,SAAlB;IAA6BC;EAA7B,IAAyC,IAAAC,wBAAA,EAAY;IACvDZ,KADuD;IAEvDa,MAAM,EAAEN,SAF+C;IAGvDL,MAHuD;IAIvDC;EAJuD,CAAZ,CAA/C;EAOA,MAAMW,WAAW,GAAGb,KAAK,CAACc,GAAN,CAAUC,IAAI,IAAI;IAClC,OAAO;MACHC,EAAE,EAAED,IAAI,CAACC,EADN;MAEHC,KAAK,EAAET,KAAK,CAACU,SAAN,CAAgBC,gBAAA,CAAQC,GAAR,CAAYL,IAAZ,EAAkBN,SAAlB,CAAhB;IAFJ,CAAP;EAIH,CALmB,CAApB;EAMA,MAAMY,WAAyB,GAAG,IAAAC,eAAA,EAAaT,WAAb,EAA0B,OAA1B,CAAlC;EACA,MAAMU,QAAQ,GAAGF,WAAW,CAACP,GAAZ,CAAgBU,CAAC,IAAI;IAClC,MAAMT,IAAI,GAAGf,KAAK,CAACyB,IAAN,CAAWC,CAAC,IAAIA,CAAC,CAACV,EAAF,KAASQ,CAAC,CAACR,EAA3B,CAAb;;IACA,IAAID,IAAJ,EAAU;MACN,OAAOA,IAAP;IACH;;IACD,MAAM,IAAIV,cAAJ,CACF,oDADE,EAEF,qBAFE,EAGF;MACIW,EAAE,EAAEQ,CAAC,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,CAvDM"}
1
+ {"version":3,"names":["WebinyError","dotProp","lodashSortBy","extractSort","sort","params","model","items","fields","plugins","length","push","firstSort","fieldId","field","valuePath","reverse","sortBy","itemsToSort","map","item","id","value","transform","get","sortedItems","newItems","s","find","i","sortingBy"],"sources":["sort.ts"],"sourcesContent":["import type { CmsEntry, CmsEntryValues, CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport dotProp from \"dot-prop\";\nimport lodashSortBy from \"lodash/sortBy.js\";\nimport { extractSort } from \"./extractSort.js\";\nimport type { Field } from \"./types.js\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\n\ninterface Params<T extends CmsEntryValues = CmsEntryValues> {\n model: CmsModel;\n items: CmsEntry<T>[];\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 = <T extends CmsEntryValues = CmsEntryValues>(\n params: Params<T>\n): CmsEntry<T>[] => {\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 on DynamoDB only system.\",\n \"SORT_MULTIPLE_FIELDS_ERROR\",\n {\n 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 /**\n * This is impossible to happen because sorting items does not remove the items.\n * BUT, we need to have this check just in case for development purposes.\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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MAAMU,WAAyB,GAAGvB,YAAY,CAACgB,WAAW,EAAE,OAAO,CAAC;EACpE,MAAMQ,QAAQ,GAAGD,WAAW,CAACN,GAAG,CAACQ,CAAC,IAAI;IAClC,MAAMP,IAAI,GAAGb,KAAK,CAACqB,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACR,EAAE,KAAKM,CAAC,CAACN,EAAE,CAAC;IAC3C,IAAID,IAAI,EAAE;MACN,OAAOA,IAAI;IACf;IACA;AACR;AACA;AACA;IACQ,MAAM,IAAIpB,WAAW,CACjB,oDAAoD,EACpD,qBAAqB,EACrB;MACIqB,EAAE,EAAEM,CAAC,CAACN,EAAE;MACRS,SAAS,EAAEjB,OAAO;MAClBG;IACJ,CACJ,CAAC;EACL,CAAC,CAAC;EACF,IAAI,CAACA,OAAO,EAAE;IACV,OAAOU,QAAQ;EACnB;EACA,OAAOA,QAAQ,CAACV,OAAO,CAAC,CAAC;AAC7B,CAAC","ignoreList":[]}
@@ -1,4 +1,2 @@
1
- import { CmsModelField } from "@webiny/api-headless-cms/types";
2
- declare type Field = Pick<CmsModelField, "id" | "type" | "storageId" | "fieldId" | "settings" | "label">;
3
- export declare const createSystemFields: () => Field[];
4
- export {};
1
+ import type { CmsModelField } from "@webiny/api-headless-cms/types/index.js";
2
+ export declare const createSystemFields: () => CmsModelField[];
@@ -1,72 +1,131 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createSystemFields = void 0;
7
-
8
- const createSystemFields = () => {
9
- return [{
1
+ import { ENTRY_META_FIELDS, isDateTimeEntryMetaField, isIdentityEntryMetaField } from "@webiny/api-headless-cms/constants.js";
2
+ import lodashStartCase from "lodash/startCase.js";
3
+ import { createModelField } from "@webiny/api-headless-cms";
4
+ export const createSystemFields = () => {
5
+ const onMetaFields = ENTRY_META_FIELDS.filter(isDateTimeEntryMetaField).map(fieldName => {
6
+ return createModelField({
7
+ id: fieldName,
8
+ type: "datetime",
9
+ storageId: fieldName,
10
+ fieldId: fieldName,
11
+ label: lodashStartCase(fieldName)
12
+ });
13
+ });
14
+ const byMetaFields = ENTRY_META_FIELDS.filter(isIdentityEntryMetaField).map(fieldName => {
15
+ return createModelField({
16
+ id: fieldName,
17
+ type: "plainObject",
18
+ storageId: fieldName,
19
+ fieldId: fieldName,
20
+ label: lodashStartCase(fieldName),
21
+ settings: {
22
+ path: `${fieldName}.id`
23
+ }
24
+ });
25
+ });
26
+ return [createModelField({
10
27
  id: "id",
11
28
  type: "text",
12
29
  storageId: "id",
13
30
  fieldId: "id",
14
31
  label: "ID"
15
- }, {
32
+ }), createModelField({
16
33
  id: "entryId",
17
34
  type: "text",
18
35
  storageId: "entryId",
19
36
  fieldId: "entryId",
20
37
  label: "Entry ID"
21
- }, {
22
- id: "createdOn",
23
- type: "datetime",
24
- storageId: "createdOn",
25
- fieldId: "createdOn",
26
- label: "Created On"
27
- }, {
28
- id: "savedOn",
29
- type: "datetime",
30
- storageId: "savedOn",
31
- fieldId: "savedOn",
32
- label: "Saved On"
33
- }, {
34
- id: "createdBy",
35
- type: "plainObject",
36
- storageId: "createdBy",
37
- fieldId: "createdBy",
38
- label: "Created By",
39
- settings: {
40
- path: "createdBy.id"
41
- }
42
- }, {
38
+ }), ...onMetaFields, ...byMetaFields, createModelField({
43
39
  id: "meta",
44
40
  type: "plainObject",
45
41
  storageId: "meta",
46
42
  fieldId: "meta",
47
43
  label: "Meta"
48
- }, {
49
- id: "ownedBy",
50
- type: "plainObject",
51
- storageId: "ownedBy",
52
- fieldId: "ownedBy",
53
- label: "Owned By",
44
+ }), createModelField({
45
+ id: "wbyAco_location",
46
+ type: "object",
47
+ storageId: "location",
48
+ label: "Location",
49
+ fieldId: "wbyAco_location",
54
50
  settings: {
55
- path: "ownedBy.id"
51
+ fields: [createModelField({
52
+ id: "folderId",
53
+ type: "text",
54
+ fieldId: "folderId",
55
+ label: "Folder ID",
56
+ storageId: "folderId",
57
+ settings: {
58
+ path: "location.folderId"
59
+ }
60
+ })]
56
61
  }
57
- }, {
62
+ }), createModelField({
58
63
  id: "version",
59
64
  type: "number",
60
65
  storageId: "version",
61
66
  fieldId: "version",
62
67
  label: "Version"
63
- }, {
68
+ }), createModelField({
64
69
  id: "status",
65
70
  type: "text",
66
71
  storageId: "status",
67
72
  fieldId: "status",
68
73
  label: "Status"
69
- }];
74
+ }), createModelField({
75
+ id: "wbyDeleted",
76
+ type: "boolean",
77
+ storageId: "wbyDeleted",
78
+ fieldId: "wbyDeleted",
79
+ label: "Deleted"
80
+ }), createModelField({
81
+ id: "state",
82
+ type: "object",
83
+ storageId: "object@state",
84
+ fieldId: "state",
85
+ label: "State",
86
+ settings: {
87
+ fields: [createModelField({
88
+ id: "stepId",
89
+ type: "text",
90
+ fieldId: "stepId",
91
+ label: "Step ID",
92
+ storageId: "stepId"
93
+ }), createModelField({
94
+ id: "stepName",
95
+ type: "text",
96
+ fieldId: "stepName",
97
+ label: "Step Name",
98
+ storageId: "stepName"
99
+ }), createModelField({
100
+ id: "state",
101
+ type: "text",
102
+ fieldId: "state",
103
+ label: "State",
104
+ storageId: "state"
105
+ })]
106
+ }
107
+ }), createModelField({
108
+ id: "values",
109
+ type: "object",
110
+ storageId: "values",
111
+ fieldId: "values",
112
+ label: "Values"
113
+ }), createModelField({
114
+ id: "live",
115
+ type: "object",
116
+ storageId: "live",
117
+ fieldId: "live",
118
+ label: "Live",
119
+ settings: {
120
+ fields: [createModelField({
121
+ id: "version",
122
+ type: "number",
123
+ fieldId: "version",
124
+ label: "Version",
125
+ storageId: "version"
126
+ })]
127
+ }
128
+ })];
70
129
  };
71
130
 
72
- exports.createSystemFields = createSystemFields;
131
+ //# sourceMappingURL=systemFields.js.map
@@ -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":["ENTRY_META_FIELDS","isDateTimeEntryMetaField","isIdentityEntryMetaField","lodashStartCase","createModelField","createSystemFields","onMetaFields","filter","map","fieldName","id","type","storageId","fieldId","label","byMetaFields","settings","path","fields"],"sources":["systemFields.ts"],"sourcesContent":["import type { CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport {\n ENTRY_META_FIELDS,\n isDateTimeEntryMetaField,\n isIdentityEntryMetaField\n} from \"@webiny/api-headless-cms/constants.js\";\nimport lodashStartCase from \"lodash/startCase.js\";\nimport { createModelField } from \"@webiny/api-headless-cms\";\n\nexport const createSystemFields = (): CmsModelField[] => {\n const onMetaFields = ENTRY_META_FIELDS.filter(isDateTimeEntryMetaField).map<CmsModelField>(\n fieldName => {\n return createModelField({\n id: fieldName,\n type: \"datetime\",\n storageId: fieldName,\n fieldId: fieldName,\n label: lodashStartCase(fieldName)\n });\n }\n );\n\n const byMetaFields = ENTRY_META_FIELDS.filter(isIdentityEntryMetaField).map<CmsModelField>(\n fieldName => {\n return createModelField({\n id: fieldName,\n type: \"plainObject\",\n storageId: fieldName,\n fieldId: fieldName,\n label: lodashStartCase(fieldName),\n settings: {\n path: `${fieldName}.id`\n }\n });\n }\n );\n\n return [\n createModelField({\n id: \"id\",\n type: \"text\",\n storageId: \"id\",\n fieldId: \"id\",\n label: \"ID\"\n }),\n createModelField({\n id: \"entryId\",\n type: \"text\",\n storageId: \"entryId\",\n fieldId: \"entryId\",\n label: \"Entry ID\"\n }),\n\n ...onMetaFields,\n ...byMetaFields,\n\n createModelField({\n id: \"meta\",\n type: \"plainObject\",\n storageId: \"meta\",\n fieldId: \"meta\",\n label: \"Meta\"\n }),\n createModelField({\n id: \"wbyAco_location\",\n type: \"object\",\n storageId: \"location\",\n label: \"Location\",\n fieldId: \"wbyAco_location\",\n settings: {\n fields: [\n createModelField({\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 createModelField({\n id: \"version\",\n type: \"number\",\n storageId: \"version\",\n fieldId: \"version\",\n label: \"Version\"\n }),\n createModelField({\n id: \"status\",\n type: \"text\",\n storageId: \"status\",\n fieldId: \"status\",\n label: \"Status\"\n }),\n createModelField({\n id: \"wbyDeleted\",\n type: \"boolean\",\n storageId: \"wbyDeleted\",\n fieldId: \"wbyDeleted\",\n label: \"Deleted\"\n }),\n createModelField({\n id: \"state\",\n type: \"object\",\n storageId: \"object@state\",\n fieldId: \"state\",\n label: \"State\",\n settings: {\n fields: [\n createModelField({\n id: \"stepId\",\n type: \"text\",\n fieldId: \"stepId\",\n label: \"Step ID\",\n storageId: \"stepId\"\n }),\n createModelField({\n id: \"stepName\",\n type: \"text\",\n fieldId: \"stepName\",\n label: \"Step Name\",\n storageId: \"stepName\"\n }),\n createModelField({\n id: \"state\",\n type: \"text\",\n fieldId: \"state\",\n label: \"State\",\n storageId: \"state\"\n })\n ]\n }\n }),\n createModelField({\n id: \"values\",\n type: \"object\",\n storageId: \"values\",\n fieldId: \"values\",\n label: \"Values\"\n }),\n createModelField({\n id: \"live\",\n type: \"object\",\n storageId: \"live\",\n fieldId: \"live\",\n label: \"Live\",\n settings: {\n fields: [\n createModelField({\n id: \"version\",\n type: \"number\",\n fieldId: \"version\",\n label: \"Version\",\n storageId: \"version\"\n })\n ]\n }\n })\n ];\n};\n"],"mappings":"AACA,SACIA,iBAAiB,EACjBC,wBAAwB,EACxBC,wBAAwB,QACrB,uCAAuC;AAC9C,OAAOC,eAAe,MAAM,qBAAqB;AACjD,SAASC,gBAAgB,QAAQ,0BAA0B;AAE3D,OAAO,MAAMC,kBAAkB,GAAGA,CAAA,KAAuB;EACrD,MAAMC,YAAY,GAAGN,iBAAiB,CAACO,MAAM,CAACN,wBAAwB,CAAC,CAACO,GAAG,CACvEC,SAAS,IAAI;IACT,OAAOL,gBAAgB,CAAC;MACpBM,EAAE,EAAED,SAAS;MACbE,IAAI,EAAE,UAAU;MAChBC,SAAS,EAAEH,SAAS;MACpBI,OAAO,EAAEJ,SAAS;MAClBK,KAAK,EAAEX,eAAe,CAACM,SAAS;IACpC,CAAC,CAAC;EACN,CACJ,CAAC;EAED,MAAMM,YAAY,GAAGf,iBAAiB,CAACO,MAAM,CAACL,wBAAwB,CAAC,CAACM,GAAG,CACv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QAAQ;IACjBC,KAAK,EAAE;EACX,CAAC,CAAC,EACFV,gBAAgB,CAAC;IACbM,EAAE,EAAE,MAAM;IACVC,IAAI,EAAE,QAAQ;IACdC,SAAS,EAAE,MAAM;IACjBC,OAAO,EAAE,MAAM;IACfC,KAAK,EAAE,MAAM;IACbE,QAAQ,EAAE;MACNE,MAAM,EAAE,CACJd,gBAAgB,CAAC;QACbM,EAAE,EAAE,SAAS;QACbC,IAAI,EAAE,QAAQ;QACdE,OAAO,EAAE,SAAS;QAClBC,KAAK,EAAE,SAAS;QAChBF,SAAS,EAAE;MACf,CAAC,CAAC;IAEV;EACJ,CAAC,CAAC,CACL;AACL,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { Field } from "./types";
1
+ import type { Field } from "./types.js";
2
2
  interface Params extends Pick<Field, "transform"> {
3
3
  value: any;
4
4
  }
@@ -1,19 +1,11 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.transformValue = void 0;
7
-
8
- const transformValue = ({
1
+ export const transformValue = ({
9
2
  value,
10
3
  transform
11
4
  }) => {
12
5
  if (Array.isArray(value)) {
13
6
  return value.map(v => transform(v));
14
7
  }
15
-
16
8
  return transform(value);
17
9
  };
18
10
 
19
- exports.transformValue = transformValue;
11
+ //# sourceMappingURL=transform.js.map
@@ -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 type { Field } from \"./types.js\";\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":"AAKA,OAAO,MAAMA,cAAc,GAAGA,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","ignoreList":[]}
@@ -1,11 +1,11 @@
1
- import { CmsModelField } from "@webiny/api-headless-cms/types";
2
- import { CreatePathCallable } from "../../../plugins";
1
+ import type { CmsModelField } from "@webiny/api-headless-cms/types/index.js";
2
+ import type { CreatePathCallable } from "../../../plugins/index.js";
3
3
  interface FieldValueTransform {
4
4
  (value: any): any;
5
5
  }
6
6
  export interface FieldParent {
7
7
  fieldId: string;
8
- multipleValues?: boolean;
8
+ list?: boolean;
9
9
  }
10
10
  export interface Field extends Partial<Omit<CmsModelField, "id" | "type" | "storageId" | "fieldId">>, Pick<CmsModelField, "id" | "type" | "storageId" | "fieldId"> {
11
11
  /**
@@ -1,5 +1,3 @@
1
- "use strict";
1
+ export {};
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
3
+ //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { CreatePathCallable } from \"~/plugins\";\n\ninterface FieldValueTransform {\n (value: any): any;\n}\n\nexport interface FieldParent {\n fieldId: string;\n multipleValues?: boolean;\n}\n\nexport interface Field\n extends Partial<Omit<CmsModelField, \"id\" | \"type\" | \"storageId\" | \"fieldId\">>,\n Pick<CmsModelField, \"id\" | \"type\" | \"storageId\" | \"fieldId\"> {\n /**\n * A list od fieldId of all parents of the current field.\n *\n * This is used to check if we need to iterate through an array of parent values.\n */\n parents: FieldParent[];\n /**\n * The method which creates a path for the filtering.\n *\n * Always exists. In most cases it will return some fixed value.\n * When having a CmsEntryFieldFilterPathPlugin then it is executed to create a path.\n */\n createPath: CreatePathCallable;\n /**\n * In most cases, return value of this method is what ever is the input.\n *\n * In some cases there might be a CmsFieldFilterValueTransformPlugin, which transforms value to a comparable one.\n * For example, time in format 15:45:58 is not comparable, so we transform it into the seconds and then compare.\n */\n transform: FieldValueTransform;\n /**\n * Is the field a system field?\n * System fields are built into the code and cannot be changed.\n */\n system: boolean;\n}\n\nexport interface FilterItemFromStorage {\n <T = any>(\n field: Partial<CmsModelField> &\n Pick<CmsModelField, \"fieldId\" | \"storageId\" | \"id\" | \"settings\" | \"type\">,\n value: any\n ): Promise<T>;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { CreatePathCallable } from \"~/plugins/index.js\";\n\ninterface FieldValueTransform {\n (value: any): any;\n}\n\nexport interface FieldParent {\n fieldId: string;\n list?: boolean;\n}\n\nexport interface Field\n extends Partial<Omit<CmsModelField, \"id\" | \"type\" | \"storageId\" | \"fieldId\">>,\n Pick<CmsModelField, \"id\" | \"type\" | \"storageId\" | \"fieldId\"> {\n /**\n * A list od fieldId of all parents of the current field.\n *\n * This is used to check if we need to iterate through an array of parent values.\n */\n parents: FieldParent[];\n /**\n * The method which creates a path for the filtering.\n *\n * Always exists. In most cases it will return some fixed value.\n * When having a CmsEntryFieldFilterPathPlugin then it is executed to create a path.\n */\n createPath: CreatePathCallable;\n /**\n * In most cases, return value of this method is what ever is the input.\n *\n * In some cases there might be a CmsFieldFilterValueTransformPlugin, which transforms value to a comparable one.\n * For example, time in format 15:45:58 is not comparable, so we transform it into the seconds and then compare.\n */\n transform: FieldValueTransform;\n /**\n * Is the field a system field?\n * System fields are built into the code and cannot be changed.\n */\n system: boolean;\n}\n\nexport interface FilterItemFromStorage {\n <T = any>(\n field: Partial<CmsModelField> &\n Pick<CmsModelField, \"fieldId\" | \"storageId\" | \"id\" | \"settings\" | \"type\">,\n value: any\n ): Promise<T>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CmsEntryListWhere } from "@webiny/api-headless-cms/types";
1
+ import type { CmsEntryListWhere } from "@webiny/api-headless-cms/types/index.js";
2
2
  export declare const getWhereValues: (value: unknown, condition: "AND" | "OR") => CmsEntryListWhere[];
@@ -1,28 +1,16 @@
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.getWhereValues = void 0;
9
-
10
- var _error = _interopRequireDefault(require("@webiny/error"));
11
-
12
- const getWhereValues = (value, condition) => {
1
+ import WebinyError from "@webiny/error";
2
+ export const getWhereValues = (value, condition) => {
13
3
  const values = value;
14
-
15
4
  if (!Array.isArray(values)) {
16
- throw new _error.default(`Trying to run filtering with "${condition}", but the value sent is not an array.`, `MALFORMED_${condition}_CONDITION`, {
5
+ throw new WebinyError(`Trying to run filtering with "${condition}", but the value sent is not an array.`, `MALFORMED_${condition}_CONDITION`, {
17
6
  value
18
7
  });
19
8
  } else if (values.length === 0) {
20
- throw new _error.default(`Trying to run filtering with "${condition}", but the value sent is empty array.`, `MALFORMED_${condition}_CONDITION`, {
9
+ throw new WebinyError(`Trying to run filtering with "${condition}", but the value sent is empty array.`, `MALFORMED_${condition}_CONDITION`, {
21
10
  value
22
11
  });
23
12
  }
24
-
25
13
  return values;
26
14
  };
27
15
 
28
- exports.getWhereValues = getWhereValues;
16
+ //# sourceMappingURL=values.js.map
@@ -1 +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,KAAD,EAAiBC,SAAjB,KAA6C;EACvE,MAAMC,MAAM,GAAGF,KAAf;;EACA,IAAI,CAACG,KAAK,CAACC,OAAN,CAAcF,MAAd,CAAL,EAA4B;IACxB,MAAM,IAAIG,cAAJ,CACD,iCAAgCJ,SAAU,wCADzC,EAED,aAAYA,SAAU,YAFrB,EAGF;MACID;IADJ,CAHE,CAAN;EAOH,CARD,MAQO,IAAIE,MAAM,CAACI,MAAP,KAAkB,CAAtB,EAAyB;IAC5B,MAAM,IAAID,cAAJ,CACD,iCAAgCJ,SAAU,uCADzC,EAED,aAAYA,SAAU,YAFrB,EAGF;MACID;IADJ,CAHE,CAAN;EAOH;;EACD,OAAOE,MAAP;AACH,CApBM"}
1
+ {"version":3,"names":["WebinyError","getWhereValues","value","condition","values","Array","isArray","length"],"sources":["values.ts"],"sourcesContent":["import type { CmsEntryListWhere } from \"@webiny/api-headless-cms/types/index.js\";\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,OAAOA,WAAW,MAAM,eAAe;AAEvC,OAAO,MAAMC,cAAc,GAAGA,CAACC,KAAc,EAAEC,SAAuB,KAAK;EACvE,MAAMC,MAAM,GAAGF,KAAwC;EACvD,IAAI,CAACG,KAAK,CAACC,OAAO,CAACF,MAAM,CAAC,EAAE;IACxB,MAAM,IAAIJ,WAAW,CACjB,iCAAiCG,SAAS,wCAAwC,EAClF,aAAaA,SAAS,YAAY,EAClC;MACID;IACJ,CACJ,CAAC;EACL,CAAC,MAAM,IAAIE,MAAM,CAACG,MAAM,KAAK,CAAC,EAAE;IAC5B,MAAM,IAAIP,WAAW,CACjB,iCAAiCG,SAAS,uCAAuC,EACjF,aAAaA,SAAS,YAAY,EAClC;MACID;IACJ,CACJ,CAAC;EACL;EACA,OAAOE,MAAM;AACjB,CAAC","ignoreList":[]}
@@ -1,23 +1,14 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.extractWhereParams = void 0;
7
-
8
- const extractWhereParams = key => {
9
- const result = key.split("_");
1
+ export const extractWhereParams = key => {
2
+ const isWbyAco = key.match("wbyAco_") !== null;
3
+ const result = key.replace("wbyAco_", "").split("_");
10
4
  const fieldId = result.shift();
11
-
12
5
  if (!fieldId) {
13
6
  return null;
14
7
  }
15
-
16
8
  const rawOp = result.length === 0 ? "eq" : result.join("_");
17
9
  /**
18
10
  * When rawOp is not, it means it is equal negated so just return that.
19
11
  */
20
-
21
12
  if (rawOp === "not") {
22
13
  return {
23
14
  fieldId,
@@ -25,14 +16,13 @@ const extractWhereParams = key => {
25
16
  negate: true
26
17
  };
27
18
  }
28
-
29
19
  const negate = rawOp.match("not_") !== null;
30
20
  const operation = rawOp.replace("not_", "");
31
21
  return {
32
- fieldId,
22
+ fieldId: isWbyAco ? `wbyAco_${fieldId}` : fieldId,
33
23
  operation,
34
24
  negate
35
25
  };
36
26
  };
37
27
 
38
- exports.extractWhereParams = extractWhereParams;
28
+ //# sourceMappingURL=where.js.map
@@ -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":"AAAA,OAAO,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,CAAC,CAAC;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,GAAG,UAAUK,OAAO,EAAE,GAAGA,OAAO;IACjDK,SAAS;IACTC;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,8 +1,7 @@
1
- import { CmsEntryStorageOperations } from "@webiny/api-headless-cms/types";
2
- import { Entity } from "dynamodb-toolbox";
3
- import { PluginsContainer } from "@webiny/plugins";
1
+ import type { PluginsContainer } from "@webiny/plugins";
2
+ import type { CmsEntryStorageOperations, IEntryEntity } from "../../types.js";
4
3
  export interface CreateEntriesStorageOperationsParams {
5
- entity: Entity<any>;
4
+ entity: IEntryEntity;
6
5
  plugins: PluginsContainer;
7
6
  }
8
7
  export declare const createEntriesStorageOperations: (params: CreateEntriesStorageOperationsParams) => CmsEntryStorageOperations;