@webiny/api-headless-cms-ddb 0.0.0-mt-2 → 0.0.0-unstable.085ff6572f

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 (168) hide show
  1. package/definitions/entry.d.ts +2 -1
  2. package/definitions/entry.js +12 -12
  3. package/definitions/entry.js.map +1 -0
  4. package/definitions/group.d.ts +2 -1
  5. package/definitions/group.js +3 -12
  6. package/definitions/group.js.map +1 -0
  7. package/definitions/model.d.ts +2 -1
  8. package/definitions/model.js +25 -12
  9. package/definitions/model.js.map +1 -0
  10. package/definitions/settings.d.ts +2 -1
  11. package/definitions/settings.js +3 -12
  12. package/definitions/settings.js.map +1 -0
  13. package/definitions/system.d.ts +2 -1
  14. package/definitions/system.js +3 -12
  15. package/definitions/system.js.map +1 -0
  16. package/definitions/table.d.ts +2 -1
  17. package/definitions/table.js +0 -3
  18. package/definitions/table.js.map +1 -0
  19. package/dynamoDb/index.d.ts +1 -1
  20. package/dynamoDb/index.js +7 -17
  21. package/dynamoDb/index.js.map +1 -0
  22. package/dynamoDb/path/locationFolderId.d.ts +2 -0
  23. package/dynamoDb/path/locationFolderId.js +41 -0
  24. package/dynamoDb/path/locationFolderId.js.map +1 -0
  25. package/dynamoDb/path/plainObject.d.ts +2 -3
  26. package/dynamoDb/path/plainObject.js +25 -25
  27. package/dynamoDb/path/plainObject.js.map +1 -0
  28. package/dynamoDb/storage/date.d.ts +3 -3
  29. package/dynamoDb/storage/date.js +71 -54
  30. package/dynamoDb/storage/date.js.map +1 -0
  31. package/dynamoDb/storage/longText.d.ts +7 -4
  32. package/dynamoDb/storage/longText.js +72 -64
  33. package/dynamoDb/storage/longText.js.map +1 -0
  34. package/dynamoDb/storage/richText.d.ts +2 -8
  35. package/dynamoDb/storage/richText.js +62 -77
  36. package/dynamoDb/storage/richText.js.map +1 -0
  37. package/dynamoDb/transformValue/datetime.d.ts +4 -2
  38. package/dynamoDb/transformValue/datetime.js +28 -30
  39. package/dynamoDb/transformValue/datetime.js.map +1 -0
  40. package/index.d.ts +1 -0
  41. package/index.js +54 -45
  42. package/index.js.map +1 -0
  43. package/operations/entry/dataLoader/DataLoaderCache.d.ts +17 -0
  44. package/operations/entry/dataLoader/DataLoaderCache.js +43 -0
  45. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
  46. package/operations/entry/dataLoader/constants.d.ts +1 -0
  47. package/operations/entry/dataLoader/constants.js +9 -0
  48. package/operations/entry/dataLoader/constants.js.map +1 -0
  49. package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
  50. package/operations/entry/dataLoader/createBatchScheduleFn.js +23 -0
  51. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
  52. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
  53. package/operations/entry/dataLoader/getAllEntryRevisions.js +43 -0
  54. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
  55. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
  56. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +57 -0
  57. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
  58. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
  59. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +57 -0
  60. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
  61. package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
  62. package/operations/entry/dataLoader/getRevisionById.js +63 -0
  63. package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
  64. package/operations/entry/dataLoader/index.d.ts +8 -0
  65. package/operations/entry/dataLoader/index.js +38 -0
  66. package/operations/entry/dataLoader/index.js.map +1 -0
  67. package/operations/entry/dataLoader/types.d.ts +6 -0
  68. package/operations/entry/dataLoader/types.js +5 -0
  69. package/operations/entry/dataLoader/types.js.map +1 -0
  70. package/operations/entry/dataLoaders.d.ts +17 -28
  71. package/operations/entry/dataLoaders.js +51 -239
  72. package/operations/entry/dataLoaders.js.map +1 -0
  73. package/operations/entry/filtering/createExpressions.d.ts +26 -0
  74. package/operations/entry/filtering/createExpressions.js +176 -0
  75. package/operations/entry/filtering/createExpressions.js.map +1 -0
  76. package/operations/entry/filtering/createFields.d.ts +16 -0
  77. package/operations/entry/filtering/createFields.js +105 -0
  78. package/operations/entry/filtering/createFields.js.map +1 -0
  79. package/operations/entry/filtering/extractSort.d.ts +17 -0
  80. package/operations/entry/filtering/extractSort.js +67 -0
  81. package/operations/entry/filtering/extractSort.js.map +1 -0
  82. package/operations/entry/filtering/filter.d.ts +15 -0
  83. package/operations/entry/filtering/filter.js +143 -0
  84. package/operations/entry/filtering/filter.js.map +1 -0
  85. package/operations/entry/filtering/fullTextSearch.d.ts +14 -0
  86. package/operations/entry/filtering/fullTextSearch.js +48 -0
  87. package/operations/entry/filtering/fullTextSearch.js.map +1 -0
  88. package/operations/entry/filtering/getValue.d.ts +5 -0
  89. package/operations/entry/filtering/getValue.js +63 -0
  90. package/operations/entry/filtering/getValue.js.map +1 -0
  91. package/operations/entry/filtering/index.d.ts +2 -0
  92. package/operations/entry/filtering/index.js +19 -0
  93. package/operations/entry/filtering/index.js.map +1 -0
  94. package/operations/entry/filtering/mapPlugins.d.ts +8 -0
  95. package/operations/entry/filtering/mapPlugins.js +31 -0
  96. package/operations/entry/filtering/mapPlugins.js.map +1 -0
  97. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +2 -0
  98. package/operations/entry/filtering/plugins/defaultFilterCreate.js +43 -0
  99. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -0
  100. package/operations/entry/filtering/plugins/index.d.ts +1 -0
  101. package/operations/entry/filtering/plugins/index.js +13 -0
  102. package/operations/entry/filtering/plugins/index.js.map +1 -0
  103. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +2 -0
  104. package/operations/entry/filtering/plugins/objectFilterCreate.js +88 -0
  105. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -0
  106. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +2 -0
  107. package/operations/entry/filtering/plugins/refFilterCreate.js +73 -0
  108. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -0
  109. package/operations/entry/filtering/sort.d.ts +12 -0
  110. package/operations/entry/filtering/sort.js +69 -0
  111. package/operations/entry/filtering/sort.js.map +1 -0
  112. package/operations/entry/filtering/systemFields.d.ts +4 -0
  113. package/operations/entry/filtering/systemFields.js +88 -0
  114. package/operations/entry/filtering/systemFields.js.map +1 -0
  115. package/operations/entry/filtering/transform.d.ts +6 -0
  116. package/operations/entry/filtering/transform.js +16 -0
  117. package/operations/entry/filtering/transform.js.map +1 -0
  118. package/operations/entry/filtering/types.d.ts +40 -0
  119. package/operations/entry/filtering/types.js +5 -0
  120. package/operations/entry/filtering/types.js.map +1 -0
  121. package/operations/entry/filtering/values.d.ts +2 -0
  122. package/operations/entry/filtering/values.js +22 -0
  123. package/operations/entry/filtering/values.js.map +1 -0
  124. package/operations/entry/filtering/where.d.ts +5 -0
  125. package/operations/entry/filtering/where.js +33 -0
  126. package/operations/entry/filtering/where.js.map +1 -0
  127. package/operations/entry/index.d.ts +3 -3
  128. package/operations/entry/index.js +425 -330
  129. package/operations/entry/index.js.map +1 -0
  130. package/operations/entry/keys.js +7 -14
  131. package/operations/entry/keys.js.map +1 -0
  132. package/operations/group/index.d.ts +3 -2
  133. package/operations/group/index.js +9 -45
  134. package/operations/group/index.js.map +1 -0
  135. package/operations/model/index.d.ts +3 -2
  136. package/operations/model/index.js +13 -37
  137. package/operations/model/index.js.map +1 -0
  138. package/operations/settings/index.d.ts +3 -2
  139. package/operations/settings/index.js +7 -37
  140. package/operations/settings/index.js.map +1 -0
  141. package/operations/system/index.d.ts +3 -2
  142. package/operations/system/index.js +5 -28
  143. package/operations/system/index.js.map +1 -0
  144. package/package.json +25 -26
  145. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +23 -0
  146. package/plugins/CmsEntryFieldFilterPathPlugin.js +43 -0
  147. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -0
  148. package/plugins/CmsEntryFieldFilterPlugin.d.ts +43 -0
  149. package/plugins/CmsEntryFieldFilterPlugin.js +24 -0
  150. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -0
  151. package/plugins/CmsEntryFieldSortingPlugin.d.ts +42 -0
  152. package/plugins/CmsEntryFieldSortingPlugin.js +28 -0
  153. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -0
  154. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +11 -0
  155. package/plugins/CmsFieldFilterValueTransformPlugin.js +24 -0
  156. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -0
  157. package/plugins/index.d.ts +4 -0
  158. package/plugins/index.js +49 -0
  159. package/plugins/index.js.map +1 -0
  160. package/types.d.ts +11 -33
  161. package/types.js +0 -1
  162. package/types.js.map +1 -0
  163. package/dynamoDb/path/ref.d.ts +0 -3
  164. package/dynamoDb/path/ref.js +0 -27
  165. package/operations/entry/systemFields.d.ts +0 -2
  166. package/operations/entry/systemFields.js +0 -50
  167. package/operations/entry/utils.d.ts +0 -31
  168. package/operations/entry/utils.js +0 -406
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createSystemFields = void 0;
7
+ const createSystemFields = () => {
8
+ return [{
9
+ id: "id",
10
+ type: "text",
11
+ storageId: "id",
12
+ fieldId: "id",
13
+ label: "ID"
14
+ }, {
15
+ id: "entryId",
16
+ type: "text",
17
+ storageId: "entryId",
18
+ fieldId: "entryId",
19
+ label: "Entry ID"
20
+ }, {
21
+ id: "createdOn",
22
+ type: "datetime",
23
+ storageId: "createdOn",
24
+ fieldId: "createdOn",
25
+ label: "Created On"
26
+ }, {
27
+ id: "savedOn",
28
+ type: "datetime",
29
+ storageId: "savedOn",
30
+ fieldId: "savedOn",
31
+ label: "Saved On"
32
+ }, {
33
+ id: "createdBy",
34
+ type: "plainObject",
35
+ storageId: "createdBy",
36
+ fieldId: "createdBy",
37
+ label: "Created By",
38
+ settings: {
39
+ path: "createdBy.id"
40
+ }
41
+ }, {
42
+ id: "meta",
43
+ type: "plainObject",
44
+ storageId: "meta",
45
+ fieldId: "meta",
46
+ label: "Meta"
47
+ }, {
48
+ id: "wbyAco_location",
49
+ type: "object",
50
+ storageId: "location",
51
+ label: "Location",
52
+ fieldId: "wbyAco_location",
53
+ settings: {
54
+ fields: [{
55
+ id: "folderId",
56
+ type: "text",
57
+ fieldId: "folderId",
58
+ label: "Folder ID",
59
+ storageId: "folderId",
60
+ settings: {
61
+ path: "location.folderId"
62
+ }
63
+ }]
64
+ }
65
+ }, {
66
+ id: "ownedBy",
67
+ type: "plainObject",
68
+ storageId: "ownedBy",
69
+ fieldId: "ownedBy",
70
+ label: "Owned By",
71
+ settings: {
72
+ path: "ownedBy.id"
73
+ }
74
+ }, {
75
+ id: "version",
76
+ type: "number",
77
+ storageId: "version",
78
+ fieldId: "version",
79
+ label: "Version"
80
+ }, {
81
+ id: "status",
82
+ type: "text",
83
+ storageId: "status",
84
+ fieldId: "status",
85
+ label: "Status"
86
+ }];
87
+ };
88
+ exports.createSystemFields = createSystemFields;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createSystemFields","id","type","storageId","fieldId","label","settings","path","fields"],"sources":["systemFields.ts"],"sourcesContent":["import { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\ntype Field = Pick<CmsModelField, \"id\" | \"type\" | \"storageId\" | \"fieldId\" | \"settings\" | \"label\">;\n\nexport const createSystemFields = (): Field[] => {\n return [\n {\n id: \"id\",\n type: \"text\",\n storageId: \"id\",\n fieldId: \"id\",\n label: \"ID\"\n },\n {\n id: \"entryId\",\n type: \"text\",\n storageId: \"entryId\",\n fieldId: \"entryId\",\n label: \"Entry ID\"\n },\n {\n id: \"createdOn\",\n type: \"datetime\",\n storageId: \"createdOn\",\n fieldId: \"createdOn\",\n label: \"Created On\"\n },\n {\n id: \"savedOn\",\n type: \"datetime\",\n storageId: \"savedOn\",\n fieldId: \"savedOn\",\n label: \"Saved On\"\n },\n {\n id: \"createdBy\",\n type: \"plainObject\",\n storageId: \"createdBy\",\n fieldId: \"createdBy\",\n label: \"Created By\",\n settings: {\n path: \"createdBy.id\"\n }\n },\n {\n id: \"meta\",\n type: \"plainObject\",\n storageId: \"meta\",\n fieldId: \"meta\",\n label: \"Meta\"\n },\n {\n id: \"wbyAco_location\",\n type: \"object\",\n storageId: \"location\",\n label: \"Location\",\n fieldId: \"wbyAco_location\",\n settings: {\n fields: [\n {\n id: \"folderId\",\n type: \"text\",\n fieldId: \"folderId\",\n label: \"Folder ID\",\n storageId: \"folderId\",\n settings: {\n path: \"location.folderId\"\n }\n }\n ]\n }\n },\n {\n id: \"ownedBy\",\n type: \"plainObject\",\n storageId: \"ownedBy\",\n fieldId: \"ownedBy\",\n label: \"Owned By\",\n settings: {\n path: \"ownedBy.id\"\n }\n },\n {\n id: \"version\",\n type: \"number\",\n storageId: \"version\",\n fieldId: \"version\",\n label: \"Version\"\n },\n {\n id: \"status\",\n type: \"text\",\n storageId: \"status\",\n fieldId: \"status\",\n label: \"Status\"\n }\n ];\n};\n"],"mappings":";;;;;;AAIO,MAAMA,kBAAkB,GAAG,MAAe;EAC7C,OAAO,CACH;IACIC,EAAE,EAAE,IAAI;IACRC,IAAI,EAAE,MAAM;IACZC,SAAS,EAAE,IAAI;IACfC,OAAO,EAAE,IAAI;IACbC,KAAK,EAAE;EACX,CAAC,EACD;IACIJ,EAAE,EAAE,SAAS;IACbC,IAAI,EAAE,MAAM;IACZC,SAAS,EAAE,SAAS;IACpBC,OAAO,EAAE,SAAS;IAClBC,KAAK,EAAE;EACX,CAAC,EACD;IACIJ,EAAE,EAAE,WAAW;IACfC,IAAI,EAAE,UAAU;IAChBC,SAAS,EAAE,WAAW;IACtBC,OAAO,EAAE,WAAW;IACpBC,KAAK,EAAE;EACX,CAAC,EACD;IACIJ,EAAE,EAAE,SAAS;IACbC,IAAI,EAAE,UAAU;IAChBC,SAAS,EAAE,SAAS;IACpBC,OAAO,EAAE,SAAS;IAClBC,KAAK,EAAE;EACX,CAAC,EACD;IACIJ,EAAE,EAAE,WAAW;IACfC,IAAI,EAAE,aAAa;IACnBC,SAAS,EAAE,WAAW;IACtBC,OAAO,EAAE,WAAW;IACpBC,KAAK,EAAE,YAAY;IACnBC,QAAQ,EAAE;MACNC,IAAI,EAAE;IACV;EACJ,CAAC,EACD;IACIN,EAAE,EAAE,MAAM;IACVC,IAAI,EAAE,aAAa;IACnBC,SAAS,EAAE,MAAM;IACjBC,OAAO,EAAE,MAAM;IACfC,KAAK,EAAE;EACX,CAAC,EACD;IACIJ,EAAE,EAAE,iBAAiB;IACrBC,IAAI,EAAE,QAAQ;IACdC,SAAS,EAAE,UAAU;IACrBE,KAAK,EAAE,UAAU;IACjBD,OAAO,EAAE,iBAAiB;IAC1BE,QAAQ,EAAE;MACNE,MAAM,EAAE,CACJ;QACIP,EAAE,EAAE,UAAU;QACdC,IAAI,EAAE,MAAM;QACZE,OAAO,EAAE,UAAU;QACnBC,KAAK,EAAE,WAAW;QAClBF,SAAS,EAAE,UAAU;QACrBG,QAAQ,EAAE;UACNC,IAAI,EAAE;QACV;MACJ,CAAC;IAET;EACJ,CAAC,EACD;IACIN,EAAE,EAAE,SAAS;IACbC,IAAI,EAAE,aAAa;IACnBC,SAAS,EAAE,SAAS;IACpBC,OAAO,EAAE,SAAS;IAClBC,KAAK,EAAE,UAAU;IACjBC,QAAQ,EAAE;MACNC,IAAI,EAAE;IACV;EACJ,CAAC,EACD;IACIN,EAAE,EAAE,SAAS;IACbC,IAAI,EAAE,QAAQ;IACdC,SAAS,EAAE,SAAS;IACpBC,OAAO,EAAE,SAAS;IAClBC,KAAK,EAAE;EACX,CAAC,EACD;IACIJ,EAAE,EAAE,QAAQ;IACZC,IAAI,EAAE,MAAM;IACZC,SAAS,EAAE,QAAQ;IACnBC,OAAO,EAAE,QAAQ;IACjBC,KAAK,EAAE;EACX,CAAC,CACJ;AACL,CAAC;AAAC"}
@@ -0,0 +1,6 @@
1
+ import { Field } from "./types";
2
+ interface Params extends Pick<Field, "transform"> {
3
+ value: any;
4
+ }
5
+ export declare const transformValue: ({ value, transform }: Params) => any;
6
+ export {};
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.transformValue = void 0;
7
+ const transformValue = ({
8
+ value,
9
+ transform
10
+ }) => {
11
+ if (Array.isArray(value)) {
12
+ return value.map(v => transform(v));
13
+ }
14
+ return transform(value);
15
+ };
16
+ exports.transformValue = transformValue;
@@ -0,0 +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,KAAK;EAAEC;AAAkB,CAAC,KAAU;EACjE,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE;IACtB,OAAOA,KAAK,CAACI,GAAG,CAACC,CAAC,IAAIJ,SAAS,CAACI,CAAC,CAAC,CAAC;EACvC;EACA,OAAOJ,SAAS,CAACD,KAAK,CAAC;AAC3B,CAAC;AAAC"}
@@ -0,0 +1,40 @@
1
+ import { CmsModelField } from "@webiny/api-headless-cms/types";
2
+ import { CreatePathCallable } from "../../../plugins";
3
+ interface FieldValueTransform {
4
+ (value: any): any;
5
+ }
6
+ export interface FieldParent {
7
+ fieldId: string;
8
+ multipleValues?: boolean;
9
+ }
10
+ export interface Field extends Partial<Omit<CmsModelField, "id" | "type" | "storageId" | "fieldId">>, Pick<CmsModelField, "id" | "type" | "storageId" | "fieldId"> {
11
+ /**
12
+ * A list od fieldId of all parents of the current field.
13
+ *
14
+ * This is used to check if we need to iterate through an array of parent values.
15
+ */
16
+ parents: FieldParent[];
17
+ /**
18
+ * The method which creates a path for the filtering.
19
+ *
20
+ * Always exists. In most cases it will return some fixed value.
21
+ * When having a CmsEntryFieldFilterPathPlugin then it is executed to create a path.
22
+ */
23
+ createPath: CreatePathCallable;
24
+ /**
25
+ * In most cases, return value of this method is what ever is the input.
26
+ *
27
+ * In some cases there might be a CmsFieldFilterValueTransformPlugin, which transforms value to a comparable one.
28
+ * For example, time in format 15:45:58 is not comparable, so we transform it into the seconds and then compare.
29
+ */
30
+ transform: FieldValueTransform;
31
+ /**
32
+ * Is the field a system field?
33
+ * System fields are built into the code and cannot be changed.
34
+ */
35
+ system: boolean;
36
+ }
37
+ export interface FilterItemFromStorage {
38
+ <T = any>(field: Partial<CmsModelField> & Pick<CmsModelField, "fieldId" | "storageId" | "id" | "settings" | "type">, value: any): Promise<T>;
39
+ }
40
+ export {};
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +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":""}
@@ -0,0 +1,2 @@
1
+ import { CmsEntryListWhere } from "@webiny/api-headless-cms/types";
2
+ export declare const getWhereValues: (value: unknown, condition: "AND" | "OR") => CmsEntryListWhere[];
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getWhereValues = void 0;
8
+ var _error = _interopRequireDefault(require("@webiny/error"));
9
+ const getWhereValues = (value, condition) => {
10
+ const values = value;
11
+ if (!Array.isArray(values)) {
12
+ throw new _error.default(`Trying to run filtering with "${condition}", but the value sent is not an array.`, `MALFORMED_${condition}_CONDITION`, {
13
+ value
14
+ });
15
+ } else if (values.length === 0) {
16
+ throw new _error.default(`Trying to run filtering with "${condition}", but the value sent is empty array.`, `MALFORMED_${condition}_CONDITION`, {
17
+ value
18
+ });
19
+ }
20
+ return values;
21
+ };
22
+ exports.getWhereValues = getWhereValues;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getWhereValues","value","condition","values","Array","isArray","WebinyError","length"],"sources":["values.ts"],"sourcesContent":["import { CmsEntryListWhere } from \"@webiny/api-headless-cms/types\";\nimport WebinyError from \"@webiny/error\";\n\nexport const getWhereValues = (value: unknown, condition: \"AND\" | \"OR\") => {\n const values = value as CmsEntryListWhere[] | undefined;\n if (!Array.isArray(values)) {\n throw new WebinyError(\n `Trying to run filtering with \"${condition}\", but the value sent is not an array.`,\n `MALFORMED_${condition}_CONDITION`,\n {\n value\n }\n );\n } else if (values.length === 0) {\n throw new WebinyError(\n `Trying to run filtering with \"${condition}\", but the value sent is empty array.`,\n `MALFORMED_${condition}_CONDITION`,\n {\n value\n }\n );\n }\n return values;\n};\n"],"mappings":";;;;;;;AACA;AAEO,MAAMA,cAAc,GAAG,CAACC,KAAc,EAAEC,SAAuB,KAAK;EACvE,MAAMC,MAAM,GAAGF,KAAwC;EACvD,IAAI,CAACG,KAAK,CAACC,OAAO,CAACF,MAAM,CAAC,EAAE;IACxB,MAAM,IAAIG,cAAW,CAChB,iCAAgCJ,SAAU,wCAAuC,EACjF,aAAYA,SAAU,YAAW,EAClC;MACID;IACJ,CAAC,CACJ;EACL,CAAC,MAAM,IAAIE,MAAM,CAACI,MAAM,KAAK,CAAC,EAAE;IAC5B,MAAM,IAAID,cAAW,CAChB,iCAAgCJ,SAAU,uCAAsC,EAChF,aAAYA,SAAU,YAAW,EAClC;MACID;IACJ,CAAC,CACJ;EACL;EACA,OAAOE,MAAM;AACjB,CAAC;AAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const extractWhereParams: (key: string) => {
2
+ fieldId: string;
3
+ operation: string;
4
+ negate: boolean;
5
+ } | null;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.extractWhereParams = void 0;
7
+ const extractWhereParams = key => {
8
+ const isWbyAco = key.match("wbyAco_") !== null;
9
+ const result = key.replace("wbyAco_", "").split("_");
10
+ const fieldId = result.shift();
11
+ if (!fieldId) {
12
+ return null;
13
+ }
14
+ const rawOp = result.length === 0 ? "eq" : result.join("_");
15
+ /**
16
+ * When rawOp is not, it means it is equal negated so just return that.
17
+ */
18
+ if (rawOp === "not") {
19
+ return {
20
+ fieldId,
21
+ operation: "eq",
22
+ negate: true
23
+ };
24
+ }
25
+ const negate = rawOp.match("not_") !== null;
26
+ const operation = rawOp.replace("not_", "");
27
+ return {
28
+ fieldId: isWbyAco ? `wbyAco_${fieldId}` : fieldId,
29
+ operation,
30
+ negate
31
+ };
32
+ };
33
+ exports.extractWhereParams = extractWhereParams;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["extractWhereParams","key","isWbyAco","match","result","replace","split","fieldId","shift","rawOp","length","join","operation","negate"],"sources":["where.ts"],"sourcesContent":["export const extractWhereParams = (key: string) => {\n const isWbyAco = key.match(\"wbyAco_\") !== null;\n const result = key.replace(\"wbyAco_\", \"\").split(\"_\");\n const fieldId = result.shift();\n if (!fieldId) {\n return null;\n }\n const rawOp = result.length === 0 ? \"eq\" : result.join(\"_\");\n /**\n * When rawOp is not, it means it is equal negated so just return that.\n */\n if (rawOp === \"not\") {\n return {\n fieldId,\n operation: \"eq\",\n negate: true\n };\n }\n const negate = rawOp.match(\"not_\") !== null;\n const operation = rawOp.replace(\"not_\", \"\");\n return {\n fieldId: isWbyAco ? `wbyAco_${fieldId}` : fieldId,\n operation,\n negate\n };\n};\n"],"mappings":";;;;;;AAAO,MAAMA,kBAAkB,GAAIC,GAAW,IAAK;EAC/C,MAAMC,QAAQ,GAAGD,GAAG,CAACE,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI;EAC9C,MAAMC,MAAM,GAAGH,GAAG,CAACI,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC;EACpD,MAAMC,OAAO,GAAGH,MAAM,CAACI,KAAK,EAAE;EAC9B,IAAI,CAACD,OAAO,EAAE;IACV,OAAO,IAAI;EACf;EACA,MAAME,KAAK,GAAGL,MAAM,CAACM,MAAM,KAAK,CAAC,GAAG,IAAI,GAAGN,MAAM,CAACO,IAAI,CAAC,GAAG,CAAC;EAC3D;AACJ;AACA;EACI,IAAIF,KAAK,KAAK,KAAK,EAAE;IACjB,OAAO;MACHF,OAAO;MACPK,SAAS,EAAE,IAAI;MACfC,MAAM,EAAE;IACZ,CAAC;EACL;EACA,MAAMA,MAAM,GAAGJ,KAAK,CAACN,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI;EAC3C,MAAMS,SAAS,GAAGH,KAAK,CAACJ,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;EAC3C,OAAO;IACHE,OAAO,EAAEL,QAAQ,GAAI,UAASK,OAAQ,EAAC,GAAGA,OAAO;IACjDK,SAAS;IACTC;EACJ,CAAC;AACL,CAAC;AAAC"}
@@ -1,8 +1,8 @@
1
- import { CmsEntryStorageOperations } from "@webiny/api-headless-cms/types";
2
1
  import { Entity } from "dynamodb-toolbox";
3
2
  import { PluginsContainer } from "@webiny/plugins";
4
- export interface Params {
3
+ import { CmsEntryStorageOperations } from "../../types";
4
+ export interface CreateEntriesStorageOperationsParams {
5
5
  entity: Entity<any>;
6
6
  plugins: PluginsContainer;
7
7
  }
8
- export declare const createEntriesStorageOperations: (params: Params) => CmsEntryStorageOperations;
8
+ export declare const createEntriesStorageOperations: (params: CreateEntriesStorageOperationsParams) => CmsEntryStorageOperations;