@webiny/api-headless-cms-ddb 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.e6f0dc8ca7

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 (157) hide show
  1. package/README.md +6 -20
  2. package/definitions/entry.d.ts +4 -6
  3. package/definitions/entry.js +5 -180
  4. package/definitions/entry.js.map +1 -1
  5. package/definitions/group.d.ts +4 -6
  6. package/definitions/group.js +5 -58
  7. package/definitions/group.js.map +1 -1
  8. package/definitions/model.d.ts +4 -6
  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 +61 -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 +4 -13
  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/transformValue/datetime.d.ts +1 -1
  27. package/dynamoDb/transformValue/datetime.js +5 -12
  28. package/dynamoDb/transformValue/datetime.js.map +1 -1
  29. package/index.d.ts +2 -3
  30. package/index.js +62 -92
  31. package/index.js.map +1 -1
  32. package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -2
  33. package/operations/entry/dataLoader/DataLoaderCache.js +3 -13
  34. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  35. package/operations/entry/dataLoader/constants.js +1 -7
  36. package/operations/entry/dataLoader/constants.js.map +1 -1
  37. package/operations/entry/dataLoader/createBatchScheduleFn.js +4 -10
  38. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  39. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
  40. package/operations/entry/dataLoader/getAllEntryRevisions.js +16 -26
  41. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  42. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
  43. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +27 -33
  44. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  45. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
  46. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +27 -33
  47. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  48. package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
  49. package/operations/entry/dataLoader/getRevisionById.js +29 -35
  50. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  51. package/operations/entry/dataLoader/index.d.ts +3 -3
  52. package/operations/entry/dataLoader/index.js +10 -31
  53. package/operations/entry/dataLoader/index.js.map +1 -1
  54. package/operations/entry/dataLoader/types.d.ts +4 -4
  55. package/operations/entry/dataLoader/types.js +1 -5
  56. package/operations/entry/dataLoader/types.js.map +1 -1
  57. package/operations/entry/dataLoaders.d.ts +11 -12
  58. package/operations/entry/dataLoaders.js +16 -24
  59. package/operations/entry/dataLoaders.js.map +1 -1
  60. package/operations/entry/filtering/createExpressions.d.ts +7 -6
  61. package/operations/entry/filtering/createExpressions.js +29 -35
  62. package/operations/entry/filtering/createExpressions.js.map +1 -1
  63. package/operations/entry/filtering/createFields.d.ts +2 -2
  64. package/operations/entry/filtering/createFields.js +20 -22
  65. package/operations/entry/filtering/createFields.js.map +1 -1
  66. package/operations/entry/filtering/extractSort.d.ts +5 -5
  67. package/operations/entry/filtering/extractSort.js +38 -23
  68. package/operations/entry/filtering/extractSort.js.map +1 -1
  69. package/operations/entry/filtering/filter.d.ts +7 -6
  70. package/operations/entry/filtering/filter.js +22 -27
  71. package/operations/entry/filtering/filter.js.map +1 -1
  72. package/operations/entry/filtering/fullTextSearch.d.ts +4 -4
  73. package/operations/entry/filtering/fullTextSearch.js +7 -15
  74. package/operations/entry/filtering/fullTextSearch.js.map +1 -1
  75. package/operations/entry/filtering/getValue.js +1 -8
  76. package/operations/entry/filtering/getValue.js.map +1 -1
  77. package/operations/entry/filtering/index.d.ts +2 -2
  78. package/operations/entry/filtering/index.js +2 -19
  79. package/operations/entry/filtering/index.js.map +1 -1
  80. package/operations/entry/filtering/mapPlugins.d.ts +1 -1
  81. package/operations/entry/filtering/mapPlugins.js +3 -11
  82. package/operations/entry/filtering/mapPlugins.js.map +1 -1
  83. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +1 -1
  84. package/operations/entry/filtering/plugins/defaultFilterCreate.js +10 -18
  85. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -1
  86. package/operations/entry/filtering/plugins/index.d.ts +1 -1
  87. package/operations/entry/filtering/plugins/index.js +6 -13
  88. package/operations/entry/filtering/plugins/index.js.map +1 -1
  89. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +1 -1
  90. package/operations/entry/filtering/plugins/objectFilterCreate.js +15 -21
  91. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
  92. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +2 -2
  93. package/operations/entry/filtering/plugins/refFilterCreate.js +16 -22
  94. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
  95. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +1 -1
  96. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +14 -17
  97. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -1
  98. package/operations/entry/filtering/sort.d.ts +5 -5
  99. package/operations/entry/filtering/sort.js +15 -19
  100. package/operations/entry/filtering/sort.js.map +1 -1
  101. package/operations/entry/filtering/systemFields.d.ts +2 -4
  102. package/operations/entry/filtering/systemFields.js +70 -29
  103. package/operations/entry/filtering/systemFields.js.map +1 -1
  104. package/operations/entry/filtering/transform.d.ts +1 -1
  105. package/operations/entry/filtering/transform.js +1 -8
  106. package/operations/entry/filtering/transform.js.map +1 -1
  107. package/operations/entry/filtering/types.d.ts +4 -4
  108. package/operations/entry/filtering/types.js +1 -5
  109. package/operations/entry/filtering/types.js.map +1 -1
  110. package/operations/entry/filtering/values.d.ts +1 -1
  111. package/operations/entry/filtering/values.js +4 -12
  112. package/operations/entry/filtering/values.js.map +1 -1
  113. package/operations/entry/filtering/where.js +1 -8
  114. package/operations/entry/filtering/where.js.map +1 -1
  115. package/operations/entry/index.d.ts +4 -3
  116. package/operations/entry/index.js +279 -388
  117. package/operations/entry/index.js.map +1 -1
  118. package/operations/entry/keys.d.ts +40 -2
  119. package/operations/entry/keys.js +53 -30
  120. package/operations/entry/keys.js.map +1 -1
  121. package/operations/group/index.d.ts +4 -5
  122. package/operations/group/index.js +37 -69
  123. package/operations/group/index.js.map +1 -1
  124. package/operations/model/index.d.ts +3 -3
  125. package/operations/model/index.js +36 -59
  126. package/operations/model/index.js.map +1 -1
  127. package/package.json +24 -20
  128. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +2 -2
  129. package/plugins/CmsEntryFieldFilterPathPlugin.js +4 -12
  130. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
  131. package/plugins/CmsEntryFieldFilterPlugin.d.ts +5 -5
  132. package/plugins/CmsEntryFieldFilterPlugin.js +2 -8
  133. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
  134. package/plugins/CmsEntryFieldSortingPlugin.d.ts +2 -2
  135. package/plugins/CmsEntryFieldSortingPlugin.js +3 -11
  136. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -1
  137. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +1 -1
  138. package/plugins/CmsFieldFilterValueTransformPlugin.js +2 -9
  139. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -1
  140. package/plugins/index.d.ts +4 -4
  141. package/plugins/index.js +4 -49
  142. package/plugins/index.js.map +1 -1
  143. package/types.d.ts +20 -20
  144. package/types.js +1 -8
  145. package/types.js.map +1 -1
  146. package/definitions/system.d.ts +0 -10
  147. package/definitions/system.js +0 -42
  148. package/definitions/system.js.map +0 -1
  149. package/dynamoDb/storage/longText.d.ts +0 -10
  150. package/dynamoDb/storage/longText.js +0 -94
  151. package/dynamoDb/storage/longText.js.map +0 -1
  152. package/dynamoDb/storage/richText.d.ts +0 -2
  153. package/dynamoDb/storage/richText.js +0 -61
  154. package/dynamoDb/storage/richText.js.map +0 -1
  155. package/operations/system/index.d.ts +0 -7
  156. package/operations/system/index.js +0 -94
  157. package/operations/system/index.js.map +0 -1
package/dynamoDb/index.js CHANGED
@@ -1,15 +1,6 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _richText = require("./storage/richText");
8
- var _longText = require("./storage/longText");
9
- var _plainObject = require("./path/plainObject");
10
- var _datetime = require("./transformValue/datetime");
11
- var _locationFolderId = require("./path/locationFolderId");
12
- var _default = () => [(0, _richText.createRichTextStorageTransformPlugin)(), (0, _longText.createLongTextStorageTransformPlugin)(), (0, _plainObject.createPlainObjectPathPlugin)(), (0, _locationFolderId.createLocationFolderIdPathPlugin)(), (0, _datetime.createDatetimeTransformValuePlugin)()];
13
- exports.default = _default;
1
+ import { createPlainObjectPathPlugin } from "./path/plainObject.js";
2
+ import { createDatetimeTransformValuePlugin } from "./transformValue/datetime.js";
3
+ import { createLocationFolderIdPathPlugin } from "./path/locationFolderId.js";
4
+ export default () => [createPlainObjectPathPlugin(), createLocationFolderIdPathPlugin(), createDatetimeTransformValuePlugin()];
14
5
 
15
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_richText","require","_longText","_plainObject","_datetime","_locationFolderId","_default","createRichTextStorageTransformPlugin","createLongTextStorageTransformPlugin","createPlainObjectPathPlugin","createLocationFolderIdPathPlugin","createDatetimeTransformValuePlugin","exports","default"],"sources":["index.ts"],"sourcesContent":["import { createRichTextStorageTransformPlugin } from \"./storage/richText\";\nimport { createLongTextStorageTransformPlugin } from \"./storage/longText\";\nimport { createPlainObjectPathPlugin } from \"./path/plainObject\";\nimport { createDatetimeTransformValuePlugin } from \"./transformValue/datetime\";\nimport { createLocationFolderIdPathPlugin } from \"~/dynamoDb/path/locationFolderId\";\n\nexport default () => [\n createRichTextStorageTransformPlugin(),\n createLongTextStorageTransformPlugin(),\n createPlainObjectPathPlugin(),\n createLocationFolderIdPathPlugin(),\n createDatetimeTransformValuePlugin()\n];\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AAAoF,IAAAK,QAAA,GAErEA,CAAA,KAAM,CACjB,IAAAC,8CAAoC,EAAC,CAAC,EACtC,IAAAC,8CAAoC,EAAC,CAAC,EACtC,IAAAC,wCAA2B,EAAC,CAAC,EAC7B,IAAAC,kDAAgC,EAAC,CAAC,EAClC,IAAAC,4CAAkC,EAAC,CAAC,CACvC;AAAAC,OAAA,CAAAC,OAAA,GAAAP,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["createPlainObjectPathPlugin","createDatetimeTransformValuePlugin","createLocationFolderIdPathPlugin"],"sources":["index.ts"],"sourcesContent":["import { createPlainObjectPathPlugin } from \"./path/plainObject.js\";\nimport { createDatetimeTransformValuePlugin } from \"./transformValue/datetime.js\";\nimport { createLocationFolderIdPathPlugin } from \"~/dynamoDb/path/locationFolderId.js\";\n\nexport default () => [\n createPlainObjectPathPlugin(),\n createLocationFolderIdPathPlugin(),\n createDatetimeTransformValuePlugin()\n];\n"],"mappings":"AAAA,SAASA,2BAA2B;AACpC,SAASC,kCAAkC;AAC3C,SAASC,gCAAgC;AAEzC,eAAe,MAAM,CACjBF,2BAA2B,CAAC,CAAC,EAC7BE,gCAAgC,CAAC,CAAC,EAClCD,kCAAkC,CAAC,CAAC,CACvC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin";
1
+ import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin.js";
2
2
  export declare const createLocationFolderIdPathPlugin: () => CmsEntryFieldFilterPathPlugin;
@@ -1,16 +1,8 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createLocationFolderIdPathPlugin = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _CmsEntryFieldFilterPathPlugin = require("../../plugins/CmsEntryFieldFilterPathPlugin");
10
1
  /**
11
2
  * File is @internal
12
3
  */
13
-
4
+ import WebinyError from "@webiny/error";
5
+ import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin.js";
14
6
  const createPath = ({
15
7
  field
16
8
  }) => {
@@ -18,14 +10,14 @@ const createPath = ({
18
10
  path
19
11
  } = field.settings || {};
20
12
  if (!path) {
21
- throw new _error.default("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
13
+ throw new WebinyError("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
22
14
  field
23
15
  });
24
16
  }
25
17
  return path;
26
18
  };
27
- const createLocationFolderIdPathPlugin = () => {
28
- return new _CmsEntryFieldFilterPathPlugin.CmsEntryFieldFilterPathPlugin({
19
+ export const createLocationFolderIdPathPlugin = () => {
20
+ return new CmsEntryFieldFilterPathPlugin({
29
21
  fieldType: "text",
30
22
  path: createPath,
31
23
  canUse: (field, parents) => {
@@ -38,6 +30,5 @@ const createLocationFolderIdPathPlugin = () => {
38
30
  }
39
31
  });
40
32
  };
41
- exports.createLocationFolderIdPathPlugin = createLocationFolderIdPathPlugin;
42
33
 
43
34
  //# sourceMappingURL=locationFolderId.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_CmsEntryFieldFilterPathPlugin","createPath","field","path","settings","WebinyError","createLocationFolderIdPathPlugin","CmsEntryFieldFilterPathPlugin","fieldType","canUse","parents","fieldId","length","exports"],"sources":["locationFolderId.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport type { CreatePathCallable } from \"~/plugins/CmsEntryFieldFilterPathPlugin\";\nimport { CmsEntryFieldFilterPathPlugin } from \"~/plugins/CmsEntryFieldFilterPathPlugin\";\n\nconst createPath: CreatePathCallable = ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n};\n\nexport const createLocationFolderIdPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"text\",\n path: createPath,\n canUse: (field, parents) => {\n if (field.fieldId !== \"folderId\") {\n return false;\n } else if (!parents?.length) {\n return false;\n }\n return parents[0] === \"wbyAco_location\";\n }\n });\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,8BAAA,GAAAD,OAAA;AALA;AACA;AACA;;AAKA,MAAME,UAA8B,GAAGA,CAAC;EAAEC;AAAM,CAAC,KAAK;EAClD,MAAM;IAAEC;EAAK,CAAC,GAAGD,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;EACrC,IAAI,CAACD,IAAI,EAAE;IACP,MAAM,IAAIE,cAAW,CAAC,8BAA8B,EAAE,sBAAsB,EAAE;MAC1EH;IACJ,CAAC,CAAC;EACN;EACA,OAAOC,IAAI;AACf,CAAC;AAEM,MAAMG,gCAAgC,GAAGA,CAAA,KAAqC;EACjF,OAAO,IAAIC,4DAA6B,CAAC;IACrCC,SAAS,EAAE,MAAM;IACjBL,IAAI,EAAEF,UAAU;IAChBQ,MAAM,EAAEA,CAACP,KAAK,EAAEQ,OAAO,KAAK;MACxB,IAAIR,KAAK,CAACS,OAAO,KAAK,UAAU,EAAE;QAC9B,OAAO,KAAK;MAChB,CAAC,MAAM,IAAI,CAACD,OAAO,EAAEE,MAAM,EAAE;QACzB,OAAO,KAAK;MAChB;MACA,OAAOF,OAAO,CAAC,CAAC,CAAC,KAAK,iBAAiB;IAC3C;EACJ,CAAC,CAAC;AACN,CAAC;AAACG,OAAA,CAAAP,gCAAA,GAAAA,gCAAA","ignoreList":[]}
1
+ {"version":3,"names":["WebinyError","CmsEntryFieldFilterPathPlugin","createPath","field","path","settings","createLocationFolderIdPathPlugin","fieldType","canUse","parents","fieldId","length"],"sources":["locationFolderId.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport type { CreatePathCallable } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\nimport { CmsEntryFieldFilterPathPlugin } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\n\nconst createPath: CreatePathCallable = ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n};\n\nexport const createLocationFolderIdPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"text\",\n path: createPath,\n canUse: (field, parents) => {\n if (field.fieldId !== \"folderId\") {\n return false;\n } else if (!parents?.length) {\n return false;\n }\n return parents[0] === \"wbyAco_location\";\n }\n });\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,WAAW,MAAM,eAAe;AAEvC,SAASC,6BAA6B;AAEtC,MAAMC,UAA8B,GAAGA,CAAC;EAAEC;AAAM,CAAC,KAAK;EAClD,MAAM;IAAEC;EAAK,CAAC,GAAGD,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;EACrC,IAAI,CAACD,IAAI,EAAE;IACP,MAAM,IAAIJ,WAAW,CAAC,8BAA8B,EAAE,sBAAsB,EAAE;MAC1EG;IACJ,CAAC,CAAC;EACN;EACA,OAAOC,IAAI;AACf,CAAC;AAED,OAAO,MAAME,gCAAgC,GAAGA,CAAA,KAAqC;EACjF,OAAO,IAAIL,6BAA6B,CAAC;IACrCM,SAAS,EAAE,MAAM;IACjBH,IAAI,EAAEF,UAAU;IAChBM,MAAM,EAAEA,CAACL,KAAK,EAAEM,OAAO,KAAK;MACxB,IAAIN,KAAK,CAACO,OAAO,KAAK,UAAU,EAAE;QAC9B,OAAO,KAAK;MAChB,CAAC,MAAM,IAAI,CAACD,OAAO,EAAEE,MAAM,EAAE;QACzB,OAAO,KAAK;MAChB;MACA,OAAOF,OAAO,CAAC,CAAC,CAAC,KAAK,iBAAiB;IAC3C;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin";
1
+ import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin.js";
2
2
  export declare const createPlainObjectPathPlugin: () => CmsEntryFieldFilterPathPlugin;
@@ -1,16 +1,8 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createPlainObjectPathPlugin = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _CmsEntryFieldFilterPathPlugin = require("../../plugins/CmsEntryFieldFilterPathPlugin");
10
1
  /**
11
2
  * File is @internal
12
3
  */
13
-
4
+ import WebinyError from "@webiny/error";
5
+ import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin.js";
14
6
  const createPath = ({
15
7
  field
16
8
  }) => {
@@ -18,18 +10,17 @@ const createPath = ({
18
10
  path
19
11
  } = field.settings || {};
20
12
  if (!path) {
21
- throw new _error.default("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
13
+ throw new WebinyError("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
22
14
  field
23
15
  });
24
16
  }
25
17
  return path;
26
18
  };
27
- const createPlainObjectPathPlugin = () => {
28
- return new _CmsEntryFieldFilterPathPlugin.CmsEntryFieldFilterPathPlugin({
19
+ export const createPlainObjectPathPlugin = () => {
20
+ return new CmsEntryFieldFilterPathPlugin({
29
21
  fieldType: "plainObject",
30
22
  path: createPath
31
23
  });
32
24
  };
33
- exports.createPlainObjectPathPlugin = createPlainObjectPathPlugin;
34
25
 
35
26
  //# sourceMappingURL=plainObject.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_CmsEntryFieldFilterPathPlugin","createPath","field","path","settings","WebinyError","createPlainObjectPathPlugin","CmsEntryFieldFilterPathPlugin","fieldType","exports"],"sources":["plainObject.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport type { CreatePathCallable } from \"~/plugins/CmsEntryFieldFilterPathPlugin\";\nimport { CmsEntryFieldFilterPathPlugin } from \"~/plugins/CmsEntryFieldFilterPathPlugin\";\n\nconst createPath: CreatePathCallable = ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n};\n\nexport const createPlainObjectPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"plainObject\",\n path: createPath\n });\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,8BAAA,GAAAD,OAAA;AALA;AACA;AACA;;AAKA,MAAME,UAA8B,GAAGA,CAAC;EAAEC;AAAM,CAAC,KAAK;EAClD,MAAM;IAAEC;EAAK,CAAC,GAAGD,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;EACrC,IAAI,CAACD,IAAI,EAAE;IACP,MAAM,IAAIE,cAAW,CAAC,8BAA8B,EAAE,sBAAsB,EAAE;MAC1EH;IACJ,CAAC,CAAC;EACN;EACA,OAAOC,IAAI;AACf,CAAC;AAEM,MAAMG,2BAA2B,GAAGA,CAAA,KAAqC;EAC5E,OAAO,IAAIC,4DAA6B,CAAC;IACrCC,SAAS,EAAE,aAAa;IACxBL,IAAI,EAAEF;EACV,CAAC,CAAC;AACN,CAAC;AAACQ,OAAA,CAAAH,2BAAA,GAAAA,2BAAA","ignoreList":[]}
1
+ {"version":3,"names":["WebinyError","CmsEntryFieldFilterPathPlugin","createPath","field","path","settings","createPlainObjectPathPlugin","fieldType"],"sources":["plainObject.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport type { CreatePathCallable } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\nimport { CmsEntryFieldFilterPathPlugin } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\n\nconst createPath: CreatePathCallable = ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n};\n\nexport const createPlainObjectPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"plainObject\",\n path: createPath\n });\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,WAAW,MAAM,eAAe;AAEvC,SAASC,6BAA6B;AAEtC,MAAMC,UAA8B,GAAGA,CAAC;EAAEC;AAAM,CAAC,KAAK;EAClD,MAAM;IAAEC;EAAK,CAAC,GAAGD,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;EACrC,IAAI,CAACD,IAAI,EAAE;IACP,MAAM,IAAIJ,WAAW,CAAC,8BAA8B,EAAE,sBAAsB,EAAE;MAC1EG;IACJ,CAAC,CAAC;EACN;EACA,OAAOC,IAAI;AACf,CAAC;AAED,OAAO,MAAME,2BAA2B,GAAGA,CAAA,KAAqC;EAC5E,OAAO,IAAIL,6BAA6B,CAAC;IACrCM,SAAS,EAAE,aAAa;IACxBH,IAAI,EAAEF;EACV,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * File is @internal
3
3
  */
4
- import type { CmsFieldFilterValueTransformPlugin } from "../../types";
4
+ import type { CmsFieldFilterValueTransformPlugin } from "../../types.js";
5
5
  export declare const createDatetimeTransformValuePlugin: () => CmsFieldFilterValueTransformPlugin;
@@ -1,22 +1,16 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createDatetimeTransformValuePlugin = void 0;
7
- var _TimeTransformPlugin = require("@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin");
8
- var _DateTimeTransformPlugin = require("@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin");
9
1
  /**
10
2
  * File is @internal
11
3
  */
12
4
 
13
- const timeTransformer = new _TimeTransformPlugin.TimeTransformPlugin({
5
+ import { TimeTransformPlugin } from "@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin.js";
6
+ import { DateTimeTransformPlugin } from "@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin.js";
7
+ const timeTransformer = new TimeTransformPlugin({
14
8
  fields: ["*"]
15
9
  });
16
- const dateTimeTransformer = new _DateTimeTransformPlugin.DateTimeTransformPlugin({
10
+ const dateTimeTransformer = new DateTimeTransformPlugin({
17
11
  fields: ["*"]
18
12
  });
19
- const createDatetimeTransformValuePlugin = () => {
13
+ export const createDatetimeTransformValuePlugin = () => {
20
14
  return {
21
15
  type: "cms-field-filter-value-transform",
22
16
  name: "cms-field-value-filter-transform-datetime",
@@ -42,6 +36,5 @@ const createDatetimeTransformValuePlugin = () => {
42
36
  }
43
37
  };
44
38
  };
45
- exports.createDatetimeTransformValuePlugin = createDatetimeTransformValuePlugin;
46
39
 
47
40
  //# sourceMappingURL=datetime.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_TimeTransformPlugin","require","_DateTimeTransformPlugin","timeTransformer","TimeTransformPlugin","fields","dateTimeTransformer","DateTimeTransformPlugin","createDatetimeTransformValuePlugin","type","name","fieldType","transform","field","value","settings","exports"],"sources":["datetime.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types\";\nimport { TimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin\";\nimport { DateTimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin\";\n\nconst timeTransformer = new TimeTransformPlugin({\n fields: [\"*\"]\n});\nconst dateTimeTransformer = new DateTimeTransformPlugin({\n fields: [\"*\"]\n});\n\nexport const createDatetimeTransformValuePlugin = (): CmsFieldFilterValueTransformPlugin => {\n return {\n type: \"cms-field-filter-value-transform\",\n name: \"cms-field-value-filter-transform-datetime\",\n fieldType: \"datetime\",\n /**\n * Always transform into the milliseconds.\n */\n transform: ({ field, value }) => {\n const { type } = field.settings || {};\n if (type === \"time\") {\n return timeTransformer.transform({\n value\n });\n }\n return dateTimeTransformer.transform({\n value\n });\n }\n };\n};\n"],"mappings":";;;;;;AAIA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA;AALA;AACA;AACA;;AAKA,MAAME,eAAe,GAAG,IAAIC,wCAAmB,CAAC;EAC5CC,MAAM,EAAE,CAAC,GAAG;AAChB,CAAC,CAAC;AACF,MAAMC,mBAAmB,GAAG,IAAIC,gDAAuB,CAAC;EACpDF,MAAM,EAAE,CAAC,GAAG;AAChB,CAAC,CAAC;AAEK,MAAMG,kCAAkC,GAAGA,CAAA,KAA0C;EACxF,OAAO;IACHC,IAAI,EAAE,kCAAkC;IACxCC,IAAI,EAAE,2CAA2C;IACjDC,SAAS,EAAE,UAAU;IACrB;AACR;AACA;IACQC,SAAS,EAAEA,CAAC;MAAEC,KAAK;MAAEC;IAAM,CAAC,KAAK;MAC7B,MAAM;QAAEL;MAAK,CAAC,GAAGI,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;MACrC,IAAIN,IAAI,KAAK,MAAM,EAAE;QACjB,OAAON,eAAe,CAACS,SAAS,CAAC;UAC7BE;QACJ,CAAC,CAAC;MACN;MACA,OAAOR,mBAAmB,CAACM,SAAS,CAAC;QACjCE;MACJ,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAAR,kCAAA,GAAAA,kCAAA","ignoreList":[]}
1
+ {"version":3,"names":["TimeTransformPlugin","DateTimeTransformPlugin","timeTransformer","fields","dateTimeTransformer","createDatetimeTransformValuePlugin","type","name","fieldType","transform","field","value","settings"],"sources":["datetime.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types.js\";\nimport { TimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin.js\";\nimport { DateTimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin.js\";\n\nconst timeTransformer = new TimeTransformPlugin({\n fields: [\"*\"]\n});\nconst dateTimeTransformer = new DateTimeTransformPlugin({\n fields: [\"*\"]\n});\n\nexport const createDatetimeTransformValuePlugin = (): CmsFieldFilterValueTransformPlugin => {\n return {\n type: \"cms-field-filter-value-transform\",\n name: \"cms-field-value-filter-transform-datetime\",\n fieldType: \"datetime\",\n /**\n * Always transform into the milliseconds.\n */\n transform: ({ field, value }) => {\n const { type } = field.settings || {};\n if (type === \"time\") {\n return timeTransformer.transform({\n value\n });\n }\n return dateTimeTransformer.transform({\n value\n });\n }\n };\n};\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,gEAAgE;AACpG,SAASC,uBAAuB,QAAQ,oEAAoE;AAE5G,MAAMC,eAAe,GAAG,IAAIF,mBAAmB,CAAC;EAC5CG,MAAM,EAAE,CAAC,GAAG;AAChB,CAAC,CAAC;AACF,MAAMC,mBAAmB,GAAG,IAAIH,uBAAuB,CAAC;EACpDE,MAAM,EAAE,CAAC,GAAG;AAChB,CAAC,CAAC;AAEF,OAAO,MAAME,kCAAkC,GAAGA,CAAA,KAA0C;EACxF,OAAO;IACHC,IAAI,EAAE,kCAAkC;IACxCC,IAAI,EAAE,2CAA2C;IACjDC,SAAS,EAAE,UAAU;IACrB;AACR;AACA;IACQC,SAAS,EAAEA,CAAC;MAAEC,KAAK;MAAEC;IAAM,CAAC,KAAK;MAC7B,MAAM;QAAEL;MAAK,CAAC,GAAGI,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;MACrC,IAAIN,IAAI,KAAK,MAAM,EAAE;QACjB,OAAOJ,eAAe,CAACO,SAAS,CAAC;UAC7BE;QACJ,CAAC,CAAC;MACN;MACA,OAAOP,mBAAmB,CAACK,SAAS,CAAC;QACjCE;MACJ,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
package/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- import type { StorageOperationsFactory } from "./types";
2
- export * from "./plugins";
3
- export declare const createStorageOperations: StorageOperationsFactory;
1
+ export * from "./plugins/index.js";
2
+ export declare const registerDynamoDbStorageOperations: () => import("@webiny/handler").RegisterExtensionPlugin<import("@webiny/handler/types.js").Context>[];
package/index.js CHANGED
@@ -1,127 +1,97 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- var _exportNames = {
8
- createStorageOperations: true
9
- };
10
- exports.createStorageOperations = void 0;
11
- var _filters = _interopRequireDefault(require("@webiny/db-dynamodb/plugins/filters"));
12
- var _dynamoDb = _interopRequireDefault(require("./dynamoDb"));
13
- var _types = require("./types");
14
- var _table = require("./definitions/table");
15
- var _system = require("./definitions/system");
16
- var _group = require("./definitions/group");
17
- var _model = require("./definitions/model");
18
- var _entry = require("./definitions/entry");
19
- var _plugins = require("@webiny/plugins");
20
- var _system2 = require("./operations/system");
21
- var _group2 = require("./operations/group");
22
- var _model2 = require("./operations/model");
23
- var _entry2 = require("./operations/entry");
24
- var _plugins2 = require("./operations/entry/filtering/plugins");
25
- var _plugins3 = require("./plugins");
26
- Object.keys(_plugins3).forEach(function (key) {
27
- if (key === "default" || key === "__esModule") return;
28
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
29
- if (key in exports && exports[key] === _plugins3[key]) return;
30
- Object.defineProperty(exports, key, {
31
- enumerable: true,
32
- get: function () {
33
- return _plugins3[key];
34
- }
35
- });
36
- });
37
- var _ValueFilterPlugin = require("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin");
38
- var _apiHeadlessCms = require("@webiny/api-headless-cms");
39
- var _api = require("@webiny/api");
40
- const createStorageOperations = params => {
1
+ import { registerExtension as registerDynamoDbExtension } from "@webiny/db-dynamodb";
2
+ import dynamoDbPlugins from "./dynamoDb/index.js";
3
+ import { ENTITIES } from "./types.js";
4
+ import { createGroupEntity } from "./definitions/group.js";
5
+ import { createModelEntity } from "./definitions/model.js";
6
+ import { createEntryEntity } from "./definitions/entry.js";
7
+ import { createGroupsStorageOperations } from "./operations/group/index.js";
8
+ import { createModelsStorageOperations } from "./operations/model/index.js";
9
+ import { createEntriesStorageOperations } from "./operations/entry/index.js";
10
+ import { createFilterCreatePlugins } from "./operations/entry/filtering/plugins/index.js";
11
+ import { createTable } from "./definitions/table.js";
12
+ import { createRegisterExtensionPlugin } from "@webiny/handler";
13
+ import { createFeature } from "@webiny/feature/api/index.js";
14
+ import { StorageOperationsFactory as StorageOperationsFactoryAbstraction } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
15
+ export * from "./plugins/index.js";
16
+ const createDynamoDbStorageOperations = params => {
41
17
  const {
42
- attributes,
43
18
  table,
44
19
  documentClient,
45
- plugins: userPlugins
20
+ plugins,
21
+ container
46
22
  } = params;
47
- const tableInstance = (0, _table.createTable)({
48
- table,
23
+ const tableInstance = createTable({
24
+ name: table,
49
25
  documentClient
50
26
  });
51
27
  const entities = {
52
- system: (0, _system.createSystemEntity)({
53
- entityName: _types.ENTITIES.SYSTEM,
54
- table: tableInstance,
55
- attributes: attributes ? attributes[_types.ENTITIES.SYSTEM] : {}
28
+ groups: createGroupEntity({
29
+ entityName: ENTITIES.GROUPS,
30
+ table: tableInstance
56
31
  }),
57
- groups: (0, _group.createGroupEntity)({
58
- entityName: _types.ENTITIES.GROUPS,
59
- table: tableInstance,
60
- attributes: attributes ? attributes[_types.ENTITIES.GROUPS] : {}
32
+ models: createModelEntity({
33
+ entityName: ENTITIES.MODELS,
34
+ table: tableInstance
61
35
  }),
62
- models: (0, _model.createModelEntity)({
63
- entityName: _types.ENTITIES.MODELS,
64
- table: tableInstance,
65
- attributes: attributes ? attributes[_types.ENTITIES.MODELS] : {}
66
- }),
67
- entries: (0, _entry.createEntryEntity)({
68
- entityName: _types.ENTITIES.ENTRIES,
69
- table: tableInstance,
70
- attributes: attributes ? attributes[_types.ENTITIES.ENTRIES] : {}
36
+ entries: createEntryEntity({
37
+ entityName: ENTITIES.ENTRIES,
38
+ table: tableInstance
71
39
  })
72
40
  };
73
- const plugins = new _plugins.PluginsContainer([
74
- /**
75
- * DynamoDB filter plugins for the where conditions.
76
- */
77
- (0, _filters.default)(),
41
+ plugins.register([
78
42
  /**
79
43
  * Field plugins for DynamoDB.
80
44
  */
81
- (0, _dynamoDb.default)(),
45
+ dynamoDbPlugins(),
82
46
  /**
83
47
  * Filter create plugins.
84
48
  */
85
- (0, _plugins2.createFilterCreatePlugins)(),
86
- /**
87
- * User defined custom plugins.
88
- */
89
- ...(userPlugins || [])]);
90
- const entries = (0, _entry2.createEntriesStorageOperations)({
49
+ createFilterCreatePlugins()]);
50
+ const entries = createEntriesStorageOperations({
91
51
  entity: entities.entries,
52
+ container,
92
53
  plugins
93
54
  });
94
55
  return {
95
56
  name: "dynamodb",
96
- beforeInit: async context => {
97
- const types = ["cms-model-field-to-graphql", _plugins3.CmsEntryFieldFilterPathPlugin.type, _plugins3.CmsFieldFilterValueTransformPlugin.type, _plugins3.CmsEntryFieldFilterPlugin.type, _plugins3.CmsEntryFieldSortingPlugin.type, _ValueFilterPlugin.ValueFilterPlugin.type, _apiHeadlessCms.StorageOperationsCmsModelPlugin.type, _apiHeadlessCms.StorageTransformPlugin.type, _api.CompressorPlugin.type];
98
- /**
99
- * Collect all required plugins from parent context.
100
- */
101
- for (const type of types) {
102
- plugins.mergeByType(context.plugins, type);
103
- }
104
- /**
105
- * Pass the plugins to the parent context.
106
- */
107
- context.plugins.register([(0, _dynamoDb.default)()]);
57
+ beforeInit: async () => {
108
58
  entries.dataLoaders.clearAll();
109
59
  },
110
60
  getEntities: () => entities,
111
61
  getTable: () => tableInstance,
112
- system: (0, _system2.createSystemStorageOperations)({
113
- entity: entities.system
114
- }),
115
- groups: (0, _group2.createGroupsStorageOperations)({
62
+ groups: createGroupsStorageOperations({
116
63
  entity: entities.groups,
117
- plugins
64
+ container
118
65
  }),
119
- models: (0, _model2.createModelsStorageOperations)({
66
+ models: createModelsStorageOperations({
120
67
  entity: entities.models
121
68
  }),
122
69
  entries
123
70
  };
124
71
  };
125
- exports.createStorageOperations = createStorageOperations;
72
+ class DynamoDbStorageOperationsFactoryImpl {
73
+ async create(context) {
74
+ return createDynamoDbStorageOperations({
75
+ documentClient: context.db.driver.getClient(),
76
+ plugins: context.plugins,
77
+ container: context.container
78
+ });
79
+ }
80
+ }
81
+ const DynamoDbStorageOperationsFactory = StorageOperationsFactoryAbstraction.createImplementation({
82
+ implementation: DynamoDbStorageOperationsFactoryImpl,
83
+ dependencies: []
84
+ });
85
+ const storageOperationsFeature = createFeature({
86
+ name: "cms.storageOperations.openSearch",
87
+ register: container => {
88
+ container.register(DynamoDbStorageOperationsFactory).inSingletonScope();
89
+ }
90
+ });
91
+ export const registerDynamoDbStorageOperations = () => {
92
+ return [registerDynamoDbExtension(), createRegisterExtensionPlugin(context => {
93
+ return storageOperationsFeature.register(context.container);
94
+ })];
95
+ };
126
96
 
127
97
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_filters","_interopRequireDefault","require","_dynamoDb","_types","_table","_system","_group","_model","_entry","_plugins","_system2","_group2","_model2","_entry2","_plugins2","_plugins3","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_ValueFilterPlugin","_apiHeadlessCms","_api","createStorageOperations","params","attributes","table","documentClient","plugins","userPlugins","tableInstance","createTable","entities","system","createSystemEntity","entityName","ENTITIES","SYSTEM","groups","createGroupEntity","GROUPS","models","createModelEntity","MODELS","entries","createEntryEntity","ENTRIES","PluginsContainer","dynamoDbValueFilters","dynamoDbPlugins","createFilterCreatePlugins","createEntriesStorageOperations","entity","name","beforeInit","context","types","CmsEntryFieldFilterPathPlugin","type","CmsFieldFilterValueTransformPlugin","CmsEntryFieldFilterPlugin","CmsEntryFieldSortingPlugin","ValueFilterPlugin","StorageOperationsCmsModelPlugin","StorageTransformPlugin","CompressorPlugin","mergeByType","register","dataLoaders","clearAll","getEntities","getTable","createSystemStorageOperations","createGroupsStorageOperations","createModelsStorageOperations"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport dynamoDbPlugins from \"./dynamoDb\";\nimport type { StorageOperationsFactory } from \"~/types\";\nimport { ENTITIES } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createSystemEntity } from \"~/definitions/system\";\nimport { createGroupEntity } from \"~/definitions/group\";\nimport { createModelEntity } from \"~/definitions/model\";\nimport { createEntryEntity } from \"~/definitions/entry\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createSystemStorageOperations } from \"~/operations/system\";\nimport { createGroupsStorageOperations } from \"~/operations/group\";\nimport { createModelsStorageOperations } from \"~/operations/model\";\nimport { createEntriesStorageOperations } from \"./operations/entry\";\n\nimport { createFilterCreatePlugins } from \"~/operations/entry/filtering/plugins\";\nimport {\n CmsEntryFieldFilterPathPlugin,\n CmsEntryFieldFilterPlugin,\n CmsEntryFieldSortingPlugin,\n CmsFieldFilterValueTransformPlugin\n} from \"~/plugins\";\nimport { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin\";\nimport { StorageOperationsCmsModelPlugin, StorageTransformPlugin } from \"@webiny/api-headless-cms\";\nimport { CompressorPlugin } from \"@webiny/api\";\n\nexport * from \"./plugins\";\n\nexport const createStorageOperations: StorageOperationsFactory = params => {\n const { attributes, table, documentClient, plugins: userPlugins } = params;\n\n const tableInstance = createTable({\n table,\n documentClient\n });\n\n const entities = {\n system: createSystemEntity({\n entityName: ENTITIES.SYSTEM,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SYSTEM] : {}\n }),\n groups: createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.GROUPS] : {}\n }),\n models: createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.MODELS] : {}\n }),\n entries: createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.ENTRIES] : {}\n })\n };\n\n const plugins = new PluginsContainer([\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Field plugins for DynamoDB.\n */\n dynamoDbPlugins(),\n /**\n * Filter create plugins.\n */\n createFilterCreatePlugins(),\n /**\n * User defined custom plugins.\n */\n ...(userPlugins || [])\n ]);\n\n const entries = createEntriesStorageOperations({\n entity: entities.entries,\n plugins\n });\n\n return {\n name: \"dynamodb\",\n beforeInit: async context => {\n const types: string[] = [\n \"cms-model-field-to-graphql\",\n CmsEntryFieldFilterPathPlugin.type,\n CmsFieldFilterValueTransformPlugin.type,\n CmsEntryFieldFilterPlugin.type,\n CmsEntryFieldSortingPlugin.type,\n ValueFilterPlugin.type,\n StorageOperationsCmsModelPlugin.type,\n StorageTransformPlugin.type,\n CompressorPlugin.type\n ];\n /**\n * Collect all required plugins from parent context.\n */\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n /**\n * Pass the plugins to the parent context.\n */\n context.plugins.register([dynamoDbPlugins()]);\n\n entries.dataLoaders.clearAll();\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n system: createSystemStorageOperations({\n entity: entities.system\n }),\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n plugins\n }),\n models: createModelsStorageOperations({\n entity: entities.models\n }),\n entries\n };\n};\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"names":["registerExtension","registerDynamoDbExtension","dynamoDbPlugins","ENTITIES","createGroupEntity","createModelEntity","createEntryEntity","createGroupsStorageOperations","createModelsStorageOperations","createEntriesStorageOperations","createFilterCreatePlugins","createTable","createRegisterExtensionPlugin","createFeature","StorageOperationsFactory","StorageOperationsFactoryAbstraction","createDynamoDbStorageOperations","params","table","documentClient","plugins","container","tableInstance","name","entities","groups","entityName","GROUPS","models","MODELS","entries","ENTRIES","register","entity","beforeInit","dataLoaders","clearAll","getEntities","getTable","DynamoDbStorageOperationsFactoryImpl","create","context","db","driver","getClient","DynamoDbStorageOperationsFactory","createImplementation","implementation","dependencies","storageOperationsFeature","inSingletonScope","registerDynamoDbStorageOperations"],"sources":["index.ts"],"sourcesContent":["import { registerExtension as registerDynamoDbExtension } from \"@webiny/db-dynamodb\";\nimport dynamoDbPlugins from \"./dynamoDb/index.js\";\nimport type { CmsContext, StorageOperationsFactory } from \"~/types.js\";\nimport { ENTITIES } from \"~/types.js\";\nimport { createGroupEntity } from \"~/definitions/group.js\";\nimport { createModelEntity } from \"~/definitions/model.js\";\nimport { createEntryEntity } from \"~/definitions/entry.js\";\nimport { createGroupsStorageOperations } from \"~/operations/group/index.js\";\nimport { createModelsStorageOperations } from \"~/operations/model/index.js\";\nimport { createEntriesStorageOperations } from \"./operations/entry/index.js\";\nimport { createFilterCreatePlugins } from \"~/operations/entry/filtering/plugins/index.js\";\nimport { createTable } from \"~/definitions/table.js\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\nimport { createFeature } from \"@webiny/feature/api/index.js\";\nimport { StorageOperationsFactory as StorageOperationsFactoryAbstraction } from \"@webiny/api-headless-cms/exports/api/cms/storage.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\n\nexport * from \"./plugins/index.js\";\n\nconst createDynamoDbStorageOperations: StorageOperationsFactory = params => {\n const { table, documentClient, plugins, container } = params;\n\n const tableInstance = createTable({\n name: table,\n documentClient\n });\n\n const entities = {\n groups: createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance\n }),\n models: createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance\n }),\n entries: createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance\n })\n };\n\n plugins.register([\n /**\n * Field plugins for DynamoDB.\n */\n dynamoDbPlugins(),\n /**\n * Filter create plugins.\n */\n createFilterCreatePlugins()\n ]);\n\n const entries = createEntriesStorageOperations({\n entity: entities.entries,\n container,\n plugins\n });\n\n return {\n name: \"dynamodb\",\n beforeInit: async () => {\n entries.dataLoaders.clearAll();\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n container\n }),\n models: createModelsStorageOperations({\n entity: entities.models\n }),\n entries\n };\n};\n\nclass DynamoDbStorageOperationsFactoryImpl\n implements StorageOperationsFactoryAbstraction.Interface\n{\n public async create(context: CmsContext) {\n return createDynamoDbStorageOperations({\n documentClient: context.db.driver.getClient() as DynamoDBDocument,\n plugins: context.plugins,\n container: context.container\n });\n }\n}\n\nconst DynamoDbStorageOperationsFactory = StorageOperationsFactoryAbstraction.createImplementation({\n implementation: DynamoDbStorageOperationsFactoryImpl,\n dependencies: []\n});\n\nconst storageOperationsFeature = createFeature({\n name: \"cms.storageOperations.openSearch\",\n register: container => {\n container.register(DynamoDbStorageOperationsFactory).inSingletonScope();\n }\n});\n\nexport const registerDynamoDbStorageOperations = () => {\n return [\n registerDynamoDbExtension(),\n createRegisterExtensionPlugin(context => {\n return storageOperationsFeature.register(context.container);\n })\n ];\n};\n"],"mappings":"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","ignoreList":[]}
@@ -2,11 +2,10 @@ import type DataLoader from "dataloader";
2
2
  export interface CacheKeyParams {
3
3
  name: string;
4
4
  tenant: string;
5
- locale: string;
5
+ modelId: string;
6
6
  }
7
7
  export interface ClearAllParams {
8
8
  tenant: string;
9
- locale: string;
10
9
  }
11
10
  export declare class DataLoaderCache {
12
11
  private readonly cache;
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.DataLoaderCache = void 0;
7
- class DataLoaderCache {
1
+ export class DataLoaderCache {
8
2
  cache = {};
9
3
  getDataLoader(params) {
10
4
  const key = this.createKey(params);
@@ -21,10 +15,7 @@ class DataLoaderCache {
21
15
  }
22
16
  return;
23
17
  }
24
- const key = this.createKey({
25
- ...params,
26
- name: ""
27
- });
18
+ const key = `${params.tenant}_`;
28
19
  for (const current in this.cache) {
29
20
  if (current.startsWith(key) === false) {
30
21
  continue;
@@ -33,9 +24,8 @@ class DataLoaderCache {
33
24
  }
34
25
  }
35
26
  createKey(params) {
36
- return `${params.tenant}_${params.locale}_${params.name}`;
27
+ return `${params.tenant}_${params.modelId}_${params.name}`;
37
28
  }
38
29
  }
39
- exports.DataLoaderCache = DataLoaderCache;
40
30
 
41
31
  //# sourceMappingURL=DataLoaderCache.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DataLoaderCache","cache","getDataLoader","params","key","createKey","setDataLoader","dataLoader","clearAll","current","name","startsWith","tenant","locale","exports"],"sources":["DataLoaderCache.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\n\nexport interface CacheKeyParams {\n name: string;\n tenant: string;\n locale: string;\n}\n\nexport interface ClearAllParams {\n tenant: string;\n locale: string;\n}\n\nexport class DataLoaderCache {\n private readonly cache: Record<string, DataLoader<any, any>> = {};\n\n public getDataLoader<I = any, R = any>(params: CacheKeyParams): DataLoader<I, R> | null {\n const key = this.createKey(params);\n\n return this.cache[key] || null;\n }\n\n public setDataLoader(params: CacheKeyParams, dataLoader: DataLoader<any, any>): void {\n const key = this.createKey(params);\n this.cache[key] = dataLoader;\n }\n\n public clearAll(params?: ClearAllParams): void {\n if (!params) {\n for (const current in this.cache) {\n this.cache[current].clearAll();\n }\n return;\n }\n const key = this.createKey({\n ...params,\n name: \"\"\n });\n for (const current in this.cache) {\n if (current.startsWith(key) === false) {\n continue;\n }\n this.cache[current].clearAll();\n }\n }\n\n private createKey(params: CacheKeyParams): string {\n return `${params.tenant}_${params.locale}_${params.name}`;\n }\n}\n"],"mappings":";;;;;;AAaO,MAAMA,eAAe,CAAC;EACRC,KAAK,GAAyC,CAAC,CAAC;EAE1DC,aAAaA,CAAmBC,MAAsB,EAA2B;IACpF,MAAMC,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAElC,OAAO,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC,IAAI,IAAI;EAClC;EAEOE,aAAaA,CAACH,MAAsB,EAAEI,UAAgC,EAAQ;IACjF,MAAMH,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAClC,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC,GAAGG,UAAU;EAChC;EAEOC,QAAQA,CAACL,MAAuB,EAAQ;IAC3C,IAAI,CAACA,MAAM,EAAE;MACT,KAAK,MAAMM,OAAO,IAAI,IAAI,CAACR,KAAK,EAAE;QAC9B,IAAI,CAACA,KAAK,CAACQ,OAAO,CAAC,CAACD,QAAQ,CAAC,CAAC;MAClC;MACA;IACJ;IACA,MAAMJ,GAAG,GAAG,IAAI,CAACC,SAAS,CAAC;MACvB,GAAGF,MAAM;MACTO,IAAI,EAAE;IACV,CAAC,CAAC;IACF,KAAK,MAAMD,OAAO,IAAI,IAAI,CAACR,KAAK,EAAE;MAC9B,IAAIQ,OAAO,CAACE,UAAU,CAACP,GAAG,CAAC,KAAK,KAAK,EAAE;QACnC;MACJ;MACA,IAAI,CAACH,KAAK,CAACQ,OAAO,CAAC,CAACD,QAAQ,CAAC,CAAC;IAClC;EACJ;EAEQH,SAASA,CAACF,MAAsB,EAAU;IAC9C,OAAO,GAAGA,MAAM,CAACS,MAAM,IAAIT,MAAM,CAACU,MAAM,IAAIV,MAAM,CAACO,IAAI,EAAE;EAC7D;AACJ;AAACI,OAAA,CAAAd,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["DataLoaderCache","cache","getDataLoader","params","key","createKey","setDataLoader","dataLoader","clearAll","current","tenant","startsWith","modelId","name"],"sources":["DataLoaderCache.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\n\nexport interface CacheKeyParams {\n name: string;\n tenant: string;\n modelId: string;\n}\n\nexport interface ClearAllParams {\n tenant: string;\n}\n\nexport class DataLoaderCache {\n private readonly cache: Record<string, DataLoader<any, any>> = {};\n\n public getDataLoader<I = any, R = any>(params: CacheKeyParams): DataLoader<I, R> | null {\n const key = this.createKey(params);\n\n return this.cache[key] || null;\n }\n\n public setDataLoader(params: CacheKeyParams, dataLoader: DataLoader<any, any>): void {\n const key = this.createKey(params);\n this.cache[key] = dataLoader;\n }\n\n public clearAll(params?: ClearAllParams): void {\n if (!params) {\n for (const current in this.cache) {\n this.cache[current].clearAll();\n }\n return;\n }\n const key = `${params.tenant}_`;\n for (const current in this.cache) {\n if (current.startsWith(key) === false) {\n continue;\n }\n this.cache[current].clearAll();\n }\n }\n\n private createKey(params: CacheKeyParams): string {\n return `${params.tenant}_${params.modelId}_${params.name}`;\n }\n}\n"],"mappings":"AAYA,OAAO,MAAMA,eAAe,CAAC;EACRC,KAAK,GAAyC,CAAC,CAAC;EAE1DC,aAAaA,CAAmBC,MAAsB,EAA2B;IACpF,MAAMC,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAElC,OAAO,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC,IAAI,IAAI;EAClC;EAEOE,aAAaA,CAACH,MAAsB,EAAEI,UAAgC,EAAQ;IACjF,MAAMH,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAClC,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC,GAAGG,UAAU;EAChC;EAEOC,QAAQA,CAACL,MAAuB,EAAQ;IAC3C,IAAI,CAACA,MAAM,EAAE;MACT,KAAK,MAAMM,OAAO,IAAI,IAAI,CAACR,KAAK,EAAE;QAC9B,IAAI,CAACA,KAAK,CAACQ,OAAO,CAAC,CAACD,QAAQ,CAAC,CAAC;MAClC;MACA;IACJ;IACA,MAAMJ,GAAG,GAAG,GAAGD,MAAM,CAACO,MAAM,GAAG;IAC/B,KAAK,MAAMD,OAAO,IAAI,IAAI,CAACR,KAAK,EAAE;MAC9B,IAAIQ,OAAO,CAACE,UAAU,CAACP,GAAG,CAAC,KAAK,KAAK,EAAE;QACnC;MACJ;MACA,IAAI,CAACH,KAAK,CAACQ,OAAO,CAAC,CAACD,QAAQ,CAAC,CAAC;IAClC;EACJ;EAEQH,SAASA,CAACF,MAAsB,EAAU;IAC9C,OAAO,GAAGA,MAAM,CAACO,MAAM,IAAIP,MAAM,CAACS,OAAO,IAAIT,MAAM,CAACU,IAAI,EAAE;EAC9D;AACJ","ignoreList":[]}
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CMS_ENTRY_BATCH_SCHEDULE_WAIT = void 0;
7
1
  const batchScheduleWaitEnv = Number(process.env.WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT || "0");
8
- const CMS_ENTRY_BATCH_SCHEDULE_WAIT = exports.CMS_ENTRY_BATCH_SCHEDULE_WAIT = isNaN(batchScheduleWaitEnv) ? 0 : batchScheduleWaitEnv;
2
+ export const CMS_ENTRY_BATCH_SCHEDULE_WAIT = isNaN(batchScheduleWaitEnv) ? 0 : batchScheduleWaitEnv;
9
3
 
10
4
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["batchScheduleWaitEnv","Number","process","env","WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT","CMS_ENTRY_BATCH_SCHEDULE_WAIT","exports","isNaN"],"sources":["constants.ts"],"sourcesContent":["const batchScheduleWaitEnv = Number(process.env.WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT || \"0\");\nexport const CMS_ENTRY_BATCH_SCHEDULE_WAIT = isNaN(batchScheduleWaitEnv) ? 0 : batchScheduleWaitEnv;\n"],"mappings":";;;;;;AAAA,MAAMA,oBAAoB,GAAGC,MAAM,CAACC,OAAO,CAACC,GAAG,CAACC,wCAAwC,IAAI,GAAG,CAAC;AACzF,MAAMC,6BAA6B,GAAAC,OAAA,CAAAD,6BAAA,GAAGE,KAAK,CAACP,oBAAoB,CAAC,GAAG,CAAC,GAAGA,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":["batchScheduleWaitEnv","Number","process","env","WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT","CMS_ENTRY_BATCH_SCHEDULE_WAIT","isNaN"],"sources":["constants.ts"],"sourcesContent":["const batchScheduleWaitEnv = Number(process.env.WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT || \"0\");\nexport const CMS_ENTRY_BATCH_SCHEDULE_WAIT = isNaN(batchScheduleWaitEnv) ? 0 : batchScheduleWaitEnv;\n"],"mappings":"AAAA,MAAMA,oBAAoB,GAAGC,MAAM,CAACC,OAAO,CAACC,GAAG,CAACC,wCAAwC,IAAI,GAAG,CAAC;AAChG,OAAO,MAAMC,6BAA6B,GAAGC,KAAK,CAACN,oBAAoB,CAAC,GAAG,CAAC,GAAGA,oBAAoB","ignoreList":[]}
@@ -1,10 +1,5 @@
1
- "use strict";
1
+ import { CMS_ENTRY_BATCH_SCHEDULE_WAIT } from "./constants.js";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createBatchScheduleFn = void 0;
7
- var _constants = require("./constants");
8
3
  /**
9
4
  * This is to be used when user wants to wait for a number of milliseconds before the batch is executed.
10
5
  * Intended to be used internally or for a specific user case.
@@ -12,14 +7,13 @@ var _constants = require("./constants");
12
7
  *
13
8
  * https://github.com/graphql/dataloader#batch-scheduling
14
9
  */
15
- const createBatchScheduleFn = () => {
16
- if (_constants.CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {
10
+ export const createBatchScheduleFn = () => {
11
+ if (CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {
17
12
  return undefined;
18
13
  }
19
14
  return callback => {
20
- setTimeout(callback, _constants.CMS_ENTRY_BATCH_SCHEDULE_WAIT);
15
+ setTimeout(callback, CMS_ENTRY_BATCH_SCHEDULE_WAIT);
21
16
  };
22
17
  };
23
- exports.createBatchScheduleFn = createBatchScheduleFn;
24
18
 
25
19
  //# sourceMappingURL=createBatchScheduleFn.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_constants","require","createBatchScheduleFn","CMS_ENTRY_BATCH_SCHEDULE_WAIT","undefined","callback","setTimeout","exports"],"sources":["createBatchScheduleFn.ts"],"sourcesContent":["import { CMS_ENTRY_BATCH_SCHEDULE_WAIT } from \"./constants\";\n\n/**\n * This is to be used when user wants to wait for a number of milliseconds before the batch is executed.\n * Intended to be used internally or for a specific user case.\n * Not to be documented and exposed to publish as it can slow the data loading a lot.\n *\n * https://github.com/graphql/dataloader#batch-scheduling\n */\nexport const createBatchScheduleFn = () => {\n if (CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {\n return undefined;\n }\n return (callback: () => void) => {\n setTimeout(callback, CMS_ENTRY_BATCH_SCHEDULE_WAIT);\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EACvC,IAAIC,wCAA6B,IAAI,CAAC,EAAE;IACpC,OAAOC,SAAS;EACpB;EACA,OAAQC,QAAoB,IAAK;IAC7BC,UAAU,CAACD,QAAQ,EAAEF,wCAA6B,CAAC;EACvD,CAAC;AACL,CAAC;AAACI,OAAA,CAAAL,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"names":["CMS_ENTRY_BATCH_SCHEDULE_WAIT","createBatchScheduleFn","undefined","callback","setTimeout"],"sources":["createBatchScheduleFn.ts"],"sourcesContent":["import { CMS_ENTRY_BATCH_SCHEDULE_WAIT } from \"./constants.js\";\n\n/**\n * This is to be used when user wants to wait for a number of milliseconds before the batch is executed.\n * Intended to be used internally or for a specific user case.\n * Not to be documented and exposed to publish as it can slow the data loading a lot.\n *\n * https://github.com/graphql/dataloader#batch-scheduling\n */\nexport const createBatchScheduleFn = () => {\n if (CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {\n return undefined;\n }\n return (callback: () => void) => {\n setTimeout(callback, CMS_ENTRY_BATCH_SCHEDULE_WAIT);\n };\n};\n"],"mappings":"AAAA,SAASA,6BAA6B;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EACvC,IAAID,6BAA6B,IAAI,CAAC,EAAE;IACpC,OAAOE,SAAS;EACpB;EACA,OAAQC,QAAoB,IAAK;IAC7BC,UAAU,CAACD,QAAQ,EAAEH,6BAA6B,CAAC;EACvD,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
1
  import DataLoader from "dataloader";
2
- import type { CmsStorageEntry } from "@webiny/api-headless-cms/types";
3
- import type { DataLoaderParams } from "./types";
4
- export declare const createGetAllEntryRevisions: (params: DataLoaderParams) => DataLoader<string, CmsStorageEntry[], string>;
2
+ import type { CmsStorageEntry } from "@webiny/api-headless-cms/types/index.js";
3
+ import type { IDataLoaderParams } from "./types.js";
4
+ export declare const createGetAllEntryRevisions: (params: IDataLoaderParams) => DataLoader<string, CmsStorageEntry<import("@webiny/api-headless-cms/types/types.js").CmsEntryValues>[], string>;