@webiny/api-headless-cms-ddb 6.0.0-beta.0 → 6.0.0-rc.1

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 (158) hide show
  1. package/README.md +6 -20
  2. package/definitions/entry.d.ts +4 -5
  3. package/definitions/entry.js +5 -180
  4. package/definitions/entry.js.map +1 -1
  5. package/definitions/group.d.ts +4 -5
  6. package/definitions/group.js +5 -58
  7. package/definitions/group.js.map +1 -1
  8. package/definitions/model.d.ts +4 -5
  9. package/definitions/model.js +5 -102
  10. package/definitions/model.js.map +1 -1
  11. package/definitions/table.d.ts +3 -5
  12. package/definitions/table.js +6 -28
  13. package/definitions/table.js.map +1 -1
  14. package/definitions/types.d.ts +59 -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 +6 -14
  19. package/dynamoDb/index.js.map +1 -1
  20. package/dynamoDb/path/locationFolderId.d.ts +1 -1
  21. package/dynamoDb/path/locationFolderId.js +5 -14
  22. package/dynamoDb/path/locationFolderId.js.map +1 -1
  23. package/dynamoDb/path/plainObject.d.ts +1 -1
  24. package/dynamoDb/path/plainObject.js +5 -14
  25. package/dynamoDb/path/plainObject.js.map +1 -1
  26. package/dynamoDb/storage/longText.js +11 -18
  27. package/dynamoDb/storage/longText.js.map +1 -1
  28. package/dynamoDb/storage/richText.js +26 -71
  29. package/dynamoDb/storage/richText.js.map +1 -1
  30. package/dynamoDb/transformValue/datetime.d.ts +1 -1
  31. package/dynamoDb/transformValue/datetime.js +5 -12
  32. package/dynamoDb/transformValue/datetime.js.map +1 -1
  33. package/index.d.ts +2 -2
  34. package/index.js +38 -72
  35. package/index.js.map +1 -1
  36. package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -3
  37. package/operations/entry/dataLoader/DataLoaderCache.js +2 -9
  38. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  39. package/operations/entry/dataLoader/constants.js +1 -7
  40. package/operations/entry/dataLoader/constants.js.map +1 -1
  41. package/operations/entry/dataLoader/createBatchScheduleFn.js +4 -10
  42. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  43. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
  44. package/operations/entry/dataLoader/getAllEntryRevisions.js +11 -24
  45. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  46. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
  47. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +22 -32
  48. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  49. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
  50. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +22 -32
  51. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  52. package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
  53. package/operations/entry/dataLoader/getRevisionById.js +24 -34
  54. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  55. package/operations/entry/dataLoader/index.d.ts +5 -5
  56. package/operations/entry/dataLoader/index.js +10 -31
  57. package/operations/entry/dataLoader/index.js.map +1 -1
  58. package/operations/entry/dataLoader/types.d.ts +3 -4
  59. package/operations/entry/dataLoader/types.js +1 -5
  60. package/operations/entry/dataLoader/types.js.map +1 -1
  61. package/operations/entry/dataLoaders.d.ts +11 -12
  62. package/operations/entry/dataLoaders.js +15 -25
  63. package/operations/entry/dataLoaders.js.map +1 -1
  64. package/operations/entry/filtering/createExpressions.d.ts +5 -5
  65. package/operations/entry/filtering/createExpressions.js +27 -30
  66. package/operations/entry/filtering/createExpressions.js.map +1 -1
  67. package/operations/entry/filtering/createFields.d.ts +3 -3
  68. package/operations/entry/filtering/createFields.js +20 -22
  69. package/operations/entry/filtering/createFields.js.map +1 -1
  70. package/operations/entry/filtering/extractSort.d.ts +6 -6
  71. package/operations/entry/filtering/extractSort.js +38 -23
  72. package/operations/entry/filtering/extractSort.js.map +1 -1
  73. package/operations/entry/filtering/filter.d.ts +6 -6
  74. package/operations/entry/filtering/filter.js +13 -21
  75. package/operations/entry/filtering/filter.js.map +1 -1
  76. package/operations/entry/filtering/fullTextSearch.d.ts +3 -3
  77. package/operations/entry/filtering/fullTextSearch.js +6 -14
  78. package/operations/entry/filtering/fullTextSearch.js.map +1 -1
  79. package/operations/entry/filtering/getValue.js +1 -8
  80. package/operations/entry/filtering/getValue.js.map +1 -1
  81. package/operations/entry/filtering/index.d.ts +2 -2
  82. package/operations/entry/filtering/index.js +2 -19
  83. package/operations/entry/filtering/index.js.map +1 -1
  84. package/operations/entry/filtering/mapPlugins.d.ts +2 -2
  85. package/operations/entry/filtering/mapPlugins.js +3 -11
  86. package/operations/entry/filtering/mapPlugins.js.map +1 -1
  87. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +2 -2
  88. package/operations/entry/filtering/plugins/defaultFilterCreate.js +6 -14
  89. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -1
  90. package/operations/entry/filtering/plugins/index.d.ts +1 -1
  91. package/operations/entry/filtering/plugins/index.js +6 -12
  92. package/operations/entry/filtering/plugins/index.js.map +1 -1
  93. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +2 -2
  94. package/operations/entry/filtering/plugins/objectFilterCreate.js +13 -19
  95. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
  96. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +3 -2
  97. package/operations/entry/filtering/plugins/refFilterCreate.js +18 -19
  98. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
  99. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +2 -0
  100. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +57 -0
  101. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -0
  102. package/operations/entry/filtering/sort.d.ts +6 -6
  103. package/operations/entry/filtering/sort.js +16 -20
  104. package/operations/entry/filtering/sort.js.map +1 -1
  105. package/operations/entry/filtering/systemFields.d.ts +2 -4
  106. package/operations/entry/filtering/systemFields.js +55 -29
  107. package/operations/entry/filtering/systemFields.js.map +1 -1
  108. package/operations/entry/filtering/transform.d.ts +1 -1
  109. package/operations/entry/filtering/transform.js +1 -8
  110. package/operations/entry/filtering/transform.js.map +1 -1
  111. package/operations/entry/filtering/types.d.ts +3 -3
  112. package/operations/entry/filtering/types.js +1 -5
  113. package/operations/entry/filtering/types.js.map +1 -1
  114. package/operations/entry/filtering/values.d.ts +1 -1
  115. package/operations/entry/filtering/values.js +4 -12
  116. package/operations/entry/filtering/values.js.map +1 -1
  117. package/operations/entry/filtering/where.js +1 -8
  118. package/operations/entry/filtering/where.js.map +1 -1
  119. package/operations/entry/index.d.ts +3 -4
  120. package/operations/entry/index.js +447 -495
  121. package/operations/entry/index.js.map +1 -1
  122. package/operations/entry/keys.d.ts +40 -2
  123. package/operations/entry/keys.js +53 -30
  124. package/operations/entry/keys.js.map +1 -1
  125. package/operations/group/index.d.ts +4 -4
  126. package/operations/group/index.js +35 -64
  127. package/operations/group/index.js.map +1 -1
  128. package/operations/model/index.d.ts +3 -3
  129. package/operations/model/index.js +36 -58
  130. package/operations/model/index.js.map +1 -1
  131. package/package.json +20 -26
  132. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +2 -2
  133. package/plugins/CmsEntryFieldFilterPathPlugin.js +4 -12
  134. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
  135. package/plugins/CmsEntryFieldFilterPlugin.d.ts +10 -10
  136. package/plugins/CmsEntryFieldFilterPlugin.js +2 -8
  137. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
  138. package/plugins/CmsEntryFieldSortingPlugin.d.ts +2 -2
  139. package/plugins/CmsEntryFieldSortingPlugin.js +3 -11
  140. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -1
  141. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +2 -2
  142. package/plugins/CmsFieldFilterValueTransformPlugin.js +2 -9
  143. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -1
  144. package/plugins/index.d.ts +4 -4
  145. package/plugins/index.js +4 -49
  146. package/plugins/index.js.map +1 -1
  147. package/types.d.ts +17 -19
  148. package/types.js +1 -8
  149. package/types.js.map +1 -1
  150. package/definitions/system.d.ts +0 -9
  151. package/definitions/system.js +0 -42
  152. package/definitions/system.js.map +0 -1
  153. package/dynamoDb/storage/date.d.ts +0 -3
  154. package/dynamoDb/storage/date.js +0 -84
  155. package/dynamoDb/storage/date.js.map +0 -1
  156. package/operations/system/index.d.ts +0 -7
  157. package/operations/system/index.js +0 -94
  158. package/operations/system/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_dotProp","_sortBy","_extractSort","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","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAiBO,MAAMI,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,CACJ,CAAC;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,CACJ,CAAC;EACL,CAAC,CAAC;EACF,IAAI,CAACA,OAAO,EAAE;IACV,OAAOa,QAAQ;EACnB;EACA,OAAOA,QAAQ,CAACb,OAAO,CAAC,CAAC;AAC7B,CAAC;AAACkB,OAAA,CAAA/B,IAAA,GAAAA,IAAA","ignoreList":[]}
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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AAC;EACF,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,60 +1,54 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createSystemFields = void 0;
8
- var _constants = require("@webiny/api-headless-cms/constants");
9
- var _startCase = _interopRequireDefault(require("lodash/startCase"));
10
- const createSystemFields = () => {
11
- const onMetaFields = _constants.ENTRY_META_FIELDS.filter(_constants.isDateTimeEntryMetaField).map(fieldName => {
12
- 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({
13
7
  id: fieldName,
14
8
  type: "datetime",
15
9
  storageId: fieldName,
16
10
  fieldId: fieldName,
17
- label: (0, _startCase.default)(fieldName)
18
- };
11
+ label: lodashStartCase(fieldName)
12
+ });
19
13
  });
20
- const byMetaFields = _constants.ENTRY_META_FIELDS.filter(_constants.isIdentityEntryMetaField).map(fieldName => {
21
- return {
14
+ const byMetaFields = ENTRY_META_FIELDS.filter(isIdentityEntryMetaField).map(fieldName => {
15
+ return createModelField({
22
16
  id: fieldName,
23
17
  type: "plainObject",
24
18
  storageId: fieldName,
25
19
  fieldId: fieldName,
26
- label: (0, _startCase.default)(fieldName),
20
+ label: lodashStartCase(fieldName),
27
21
  settings: {
28
22
  path: `${fieldName}.id`
29
23
  }
30
- };
24
+ });
31
25
  });
32
- return [{
26
+ return [createModelField({
33
27
  id: "id",
34
28
  type: "text",
35
29
  storageId: "id",
36
30
  fieldId: "id",
37
31
  label: "ID"
38
- }, {
32
+ }), createModelField({
39
33
  id: "entryId",
40
34
  type: "text",
41
35
  storageId: "entryId",
42
36
  fieldId: "entryId",
43
37
  label: "Entry ID"
44
- }, ...onMetaFields, ...byMetaFields, {
38
+ }), ...onMetaFields, ...byMetaFields, createModelField({
45
39
  id: "meta",
46
40
  type: "plainObject",
47
41
  storageId: "meta",
48
42
  fieldId: "meta",
49
43
  label: "Meta"
50
- }, {
44
+ }), createModelField({
51
45
  id: "wbyAco_location",
52
46
  type: "object",
53
47
  storageId: "location",
54
48
  label: "Location",
55
49
  fieldId: "wbyAco_location",
56
50
  settings: {
57
- fields: [{
51
+ fields: [createModelField({
58
52
  id: "folderId",
59
53
  type: "text",
60
54
  fieldId: "folderId",
@@ -63,28 +57,60 @@ const createSystemFields = () => {
63
57
  settings: {
64
58
  path: "location.folderId"
65
59
  }
66
- }]
60
+ })]
67
61
  }
68
- }, {
62
+ }), createModelField({
69
63
  id: "version",
70
64
  type: "number",
71
65
  storageId: "version",
72
66
  fieldId: "version",
73
67
  label: "Version"
74
- }, {
68
+ }), createModelField({
75
69
  id: "status",
76
70
  type: "text",
77
71
  storageId: "status",
78
72
  fieldId: "status",
79
73
  label: "Status"
80
- }, {
74
+ }), createModelField({
81
75
  id: "wbyDeleted",
82
76
  type: "boolean",
83
77
  storageId: "wbyDeleted",
84
78
  fieldId: "wbyDeleted",
85
79
  label: "Deleted"
86
- }];
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
+ })];
87
114
  };
88
- exports.createSystemFields = createSystemFields;
89
115
 
90
116
  //# sourceMappingURL=systemFields.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_constants","require","_startCase","_interopRequireDefault","createSystemFields","onMetaFields","ENTRY_META_FIELDS","filter","isDateTimeEntryMetaField","map","fieldName","id","type","storageId","fieldId","label","lodashStartCase","byMetaFields","isIdentityEntryMetaField","settings","path","fields","exports"],"sources":["systemFields.ts"],"sourcesContent":["import { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport {\n ENTRY_META_FIELDS,\n isDateTimeEntryMetaField,\n isIdentityEntryMetaField\n} from \"@webiny/api-headless-cms/constants\";\nimport lodashStartCase from \"lodash/startCase\";\n\ntype Field = Pick<CmsModelField, \"id\" | \"type\" | \"storageId\" | \"fieldId\" | \"settings\" | \"label\">;\n\nexport const createSystemFields = (): Field[] => {\n const onMetaFields = ENTRY_META_FIELDS.filter(isDateTimeEntryMetaField).map(fieldName => {\n return {\n id: fieldName,\n type: \"datetime\",\n storageId: fieldName,\n fieldId: fieldName,\n label: lodashStartCase(fieldName)\n };\n });\n\n const byMetaFields = ENTRY_META_FIELDS.filter(isIdentityEntryMetaField).map(fieldName => {\n return {\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 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 ...onMetaFields,\n ...byMetaFields,\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 {\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 id: \"wbyDeleted\",\n type: \"boolean\",\n storageId: \"wbyDeleted\",\n fieldId: \"wbyDeleted\",\n label: \"Deleted\"\n }\n ];\n};\n"],"mappings":";;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAKA,IAAA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AAE,UAAU;IACrBE,KAAK,EAAE,UAAU;IACjBD,OAAO,EAAE,iBAAiB;IAC1BK,QAAQ,EAAE;MACNE,MAAM,EAAE,CACJ;QACIV,EAAE,EAAE,UAAU;QACdC,IAAI,EAAE,MAAM;QACZE,OAAO,EAAE,UAAU;QACnBC,KAAK,EAAE,WAAW;QAClBF,SAAS,EAAE,UAAU;QACrBM,QAAQ,EAAE;UACNC,IAAI,EAAE;QACV;MACJ,CAAC;IAET;EACJ,CAAC,EAED;IACIT,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,EACD;IACIJ,EAAE,EAAE,YAAY;IAChBC,IAAI,EAAE,SAAS;IACfC,SAAS,EAAE,YAAY;IACvBC,OAAO,EAAE,YAAY;IACrBC,KAAK,EAAE;EACX,CAAC,CACJ;AACL,CAAC;AAACO,OAAA,CAAAlB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
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 ];\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,CACvEC,SAAS,IAAI;IACT,OAAOL,gBAAgB,CAAC;MACpBM,EAAE,EAAED,SAAS;MACbE,IAAI,EAAE,aAAa;MACnBC,SAAS,EAAEH,SAAS;MACpBI,OAAO,EAAEJ,SAAS;MAClBK,KAAK,EAAEX,eAAe,CAACM,SAAS,CAAC;MACjCO,QAAQ,EAAE;QACNC,IAAI,EAAE,GAAGR,SAAS;MACtB;IACJ,CAAC,CAAC;EACN,CACJ,CAAC;EAED,OAAO,CACHL,gBAAgB,CAAC;IACbM,EAAE,EAAE,IAAI;IACRC,IAAI,EAAE,MAAM;IACZC,SAAS,EAAE,IAAI;IACfC,OAAO,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,EAAE,YAAY;IACrBC,KAAK,EAAE;EACX,CAAC,CAAC,EACFV,gBAAgB,CAAC;IACbM,EAAE,EAAE,OAAO;IACXC,IAAI,EAAE,QAAQ;IACdC,SAAS,EAAE,cAAc;IACzBC,OAAO,EAAE,OAAO;IAChBC,KAAK,EAAE,OAAO;IACdE,QAAQ,EAAE;MACNE,MAAM,EAAE,CACJd,gBAAgB,CAAC;QACbM,EAAE,EAAE,QAAQ;QACZC,IAAI,EAAE,MAAM;QACZE,OAAO,EAAE,QAAQ;QACjBC,KAAK,EAAE,SAAS;QAChBF,SAAS,EAAE;MACf,CAAC,CAAC,EACFR,gBAAgB,CAAC;QACbM,EAAE,EAAE,UAAU;QACdC,IAAI,EAAE,MAAM;QACZE,OAAO,EAAE,UAAU;QACnBC,KAAK,EAAE,WAAW;QAClBF,SAAS,EAAE;MACf,CAAC,CAAC,EACFR,gBAAgB,CAAC;QACbM,EAAE,EAAE,OAAO;QACXC,IAAI,EAAE,MAAM;QACZE,OAAO,EAAE,OAAO;QAChBC,KAAK,EAAE,OAAO;QACdF,SAAS,EAAE;MACf,CAAC,CAAC;IAEV;EACJ,CAAC,CAAC,EACFR,gBAAgB,CAAC;IACbM,EAAE,EAAE,QAAQ;IACZC,IAAI,EAAE,QAAQ;IACdC,SAAS,EAAE,QAAQ;IACnBC,OAAO,EAAE,QAAQ;IACjBC,KAAK,EAAE;EACX,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,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.transformValue = void 0;
7
- const transformValue = ({
1
+ export const transformValue = ({
8
2
  value,
9
3
  transform
10
4
  }) => {
@@ -13,6 +7,5 @@ const transformValue = ({
13
7
  }
14
8
  return transform(value);
15
9
  };
16
- exports.transformValue = transformValue;
17
10
 
18
11
  //# sourceMappingURL=transform.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["transformValue","value","transform","Array","isArray","map","v","exports"],"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,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;AAACM,OAAA,CAAAP,cAAA,GAAAA,cAAA","ignoreList":[]}
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,7 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ export {};
6
2
 
7
3
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { 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":"","ignoreList":[]}
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,24 +1,16 @@
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) => {
1
+ import WebinyError from "@webiny/error";
2
+ export const getWhereValues = (value, condition) => {
10
3
  const values = value;
11
4
  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`, {
5
+ throw new WebinyError(`Trying to run filtering with "${condition}", but the value sent is not an array.`, `MALFORMED_${condition}_CONDITION`, {
13
6
  value
14
7
  });
15
8
  } 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`, {
9
+ throw new WebinyError(`Trying to run filtering with "${condition}", but the value sent is empty array.`, `MALFORMED_${condition}_CONDITION`, {
17
10
  value
18
11
  });
19
12
  }
20
13
  return values;
21
14
  };
22
- exports.getWhereValues = getWhereValues;
23
15
 
24
16
  //# sourceMappingURL=values.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","getWhereValues","value","condition","values","Array","isArray","WebinyError","length","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEO,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,IAAIG,cAAW,CAChB,iCAAgCJ,SAAU,wCAAuC,EACjF,aAAYA,SAAU,YAAW,EAClC;MACID;IACJ,CACJ,CAAC;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,CACJ,CAAC;EACL;EACA,OAAOE,MAAM;AACjB,CAAC;AAACK,OAAA,CAAAR,cAAA,GAAAA,cAAA","ignoreList":[]}
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,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.extractWhereParams = void 0;
7
- const extractWhereParams = key => {
1
+ export const extractWhereParams = key => {
8
2
  const isWbyAco = key.match("wbyAco_") !== null;
9
3
  const result = key.replace("wbyAco_", "").split("_");
10
4
  const fieldId = result.shift();
@@ -30,6 +24,5 @@ const extractWhereParams = key => {
30
24
  negate
31
25
  };
32
26
  };
33
- exports.extractWhereParams = extractWhereParams;
34
27
 
35
28
  //# sourceMappingURL=where.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["extractWhereParams","key","isWbyAco","match","result","replace","split","fieldId","shift","rawOp","length","join","operation","negate","exports"],"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,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,GAAI,UAASK,OAAQ,EAAC,GAAGA,OAAO;IACjDK,SAAS;IACTC;EACJ,CAAC;AACL,CAAC;AAACC,OAAA,CAAAd,kBAAA,GAAAA,kBAAA","ignoreList":[]}
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 { Entity } from "@webiny/db-dynamodb/toolbox";
2
- import { PluginsContainer } from "@webiny/plugins";
3
- import { CmsEntryStorageOperations } from "../../types";
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;