@webiny/api-headless-cms-ddb 0.0.0-mt-2 → 0.0.0-unstable.06b2ede40f

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 +6 -4
  2. package/definitions/entry.js +111 -20
  3. package/definitions/entry.js.map +1 -0
  4. package/definitions/group.d.ts +6 -4
  5. package/definitions/group.js +8 -16
  6. package/definitions/group.js.map +1 -0
  7. package/definitions/model.d.ts +6 -4
  8. package/definitions/model.js +30 -16
  9. package/definitions/model.js.map +1 -0
  10. package/definitions/system.d.ts +6 -4
  11. package/definitions/system.js +8 -16
  12. package/definitions/system.js.map +1 -0
  13. package/definitions/table.d.ts +7 -6
  14. package/definitions/table.js +7 -6
  15. package/definitions/table.js.map +1 -0
  16. package/dynamoDb/index.d.ts +1 -1
  17. package/dynamoDb/index.js +9 -18
  18. package/dynamoDb/index.js.map +1 -0
  19. package/dynamoDb/path/locationFolderId.d.ts +2 -0
  20. package/dynamoDb/path/locationFolderId.js +43 -0
  21. package/dynamoDb/path/locationFolderId.js.map +1 -0
  22. package/dynamoDb/path/plainObject.d.ts +2 -3
  23. package/dynamoDb/path/plainObject.js +26 -24
  24. package/dynamoDb/path/plainObject.js.map +1 -0
  25. package/dynamoDb/storage/longText.d.ts +7 -4
  26. package/dynamoDb/storage/longText.js +74 -63
  27. package/dynamoDb/storage/longText.js.map +1 -0
  28. package/dynamoDb/storage/richText.d.ts +2 -8
  29. package/dynamoDb/storage/richText.js +49 -98
  30. package/dynamoDb/storage/richText.js.map +1 -0
  31. package/dynamoDb/transformValue/datetime.d.ts +5 -3
  32. package/dynamoDb/transformValue/datetime.js +29 -29
  33. package/dynamoDb/transformValue/datetime.js.map +1 -0
  34. package/index.d.ts +2 -1
  35. package/index.js +56 -54
  36. package/index.js.map +1 -0
  37. package/operations/entry/dataLoader/DataLoaderCache.d.ts +17 -0
  38. package/operations/entry/dataLoader/DataLoaderCache.js +41 -0
  39. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
  40. package/operations/entry/dataLoader/constants.d.ts +1 -0
  41. package/operations/entry/dataLoader/constants.js +10 -0
  42. package/operations/entry/dataLoader/constants.js.map +1 -0
  43. package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
  44. package/operations/entry/dataLoader/createBatchScheduleFn.js +25 -0
  45. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
  46. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
  47. package/operations/entry/dataLoader/getAllEntryRevisions.js +45 -0
  48. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
  49. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
  50. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +56 -0
  51. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
  52. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
  53. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +56 -0
  54. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
  55. package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
  56. package/operations/entry/dataLoader/getRevisionById.js +62 -0
  57. package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
  58. package/operations/entry/dataLoader/index.d.ts +8 -0
  59. package/operations/entry/dataLoader/index.js +40 -0
  60. package/operations/entry/dataLoader/index.js.map +1 -0
  61. package/operations/entry/dataLoader/types.d.ts +6 -0
  62. package/operations/entry/dataLoader/types.js +7 -0
  63. package/operations/entry/dataLoader/types.js.map +1 -0
  64. package/operations/entry/dataLoaders.d.ts +18 -29
  65. package/operations/entry/dataLoaders.js +59 -246
  66. package/operations/entry/dataLoaders.js.map +1 -0
  67. package/operations/entry/filtering/createExpressions.d.ts +26 -0
  68. package/operations/entry/filtering/createExpressions.js +178 -0
  69. package/operations/entry/filtering/createExpressions.js.map +1 -0
  70. package/operations/entry/filtering/createFields.d.ts +16 -0
  71. package/operations/entry/filtering/createFields.js +108 -0
  72. package/operations/entry/filtering/createFields.js.map +1 -0
  73. package/operations/entry/filtering/extractSort.d.ts +17 -0
  74. package/operations/entry/filtering/extractSort.js +69 -0
  75. package/operations/entry/filtering/extractSort.js.map +1 -0
  76. package/operations/entry/filtering/filter.d.ts +15 -0
  77. package/operations/entry/filtering/filter.js +158 -0
  78. package/operations/entry/filtering/filter.js.map +1 -0
  79. package/operations/entry/filtering/fullTextSearch.d.ts +14 -0
  80. package/operations/entry/filtering/fullTextSearch.js +50 -0
  81. package/operations/entry/filtering/fullTextSearch.js.map +1 -0
  82. package/operations/entry/filtering/getValue.d.ts +5 -0
  83. package/operations/entry/filtering/getValue.js +66 -0
  84. package/operations/entry/filtering/getValue.js.map +1 -0
  85. package/operations/entry/filtering/index.d.ts +2 -0
  86. package/operations/entry/filtering/index.js +21 -0
  87. package/operations/entry/filtering/index.js.map +1 -0
  88. package/operations/entry/filtering/mapPlugins.d.ts +8 -0
  89. package/operations/entry/filtering/mapPlugins.js +33 -0
  90. package/operations/entry/filtering/mapPlugins.js.map +1 -0
  91. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +2 -0
  92. package/operations/entry/filtering/plugins/defaultFilterCreate.js +45 -0
  93. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -0
  94. package/operations/entry/filtering/plugins/index.d.ts +1 -0
  95. package/operations/entry/filtering/plugins/index.js +16 -0
  96. package/operations/entry/filtering/plugins/index.js.map +1 -0
  97. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +2 -0
  98. package/operations/entry/filtering/plugins/objectFilterCreate.js +90 -0
  99. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -0
  100. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +3 -0
  101. package/operations/entry/filtering/plugins/refFilterCreate.js +80 -0
  102. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -0
  103. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +2 -0
  104. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +65 -0
  105. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -0
  106. package/operations/entry/filtering/sort.d.ts +12 -0
  107. package/operations/entry/filtering/sort.js +71 -0
  108. package/operations/entry/filtering/sort.js.map +1 -0
  109. package/operations/entry/filtering/systemFields.d.ts +4 -0
  110. package/operations/entry/filtering/systemFields.js +90 -0
  111. package/operations/entry/filtering/systemFields.js.map +1 -0
  112. package/operations/entry/filtering/transform.d.ts +6 -0
  113. package/operations/entry/filtering/transform.js +18 -0
  114. package/operations/entry/filtering/transform.js.map +1 -0
  115. package/operations/entry/filtering/types.d.ts +40 -0
  116. package/operations/entry/filtering/types.js +7 -0
  117. package/operations/entry/filtering/types.js.map +1 -0
  118. package/operations/entry/filtering/values.d.ts +2 -0
  119. package/operations/entry/filtering/values.js +24 -0
  120. package/operations/entry/filtering/values.js.map +1 -0
  121. package/operations/entry/filtering/where.d.ts +5 -0
  122. package/operations/entry/filtering/where.js +35 -0
  123. package/operations/entry/filtering/where.js.map +1 -0
  124. package/operations/entry/index.d.ts +5 -5
  125. package/operations/entry/index.js +920 -437
  126. package/operations/entry/index.js.map +1 -0
  127. package/operations/entry/keys.js +9 -14
  128. package/operations/entry/keys.js.map +1 -0
  129. package/operations/group/index.d.ts +6 -5
  130. package/operations/group/index.js +35 -59
  131. package/operations/group/index.js.map +1 -0
  132. package/operations/model/index.d.ts +5 -4
  133. package/operations/model/index.js +35 -46
  134. package/operations/model/index.js.map +1 -0
  135. package/operations/system/index.d.ts +5 -4
  136. package/operations/system/index.js +20 -31
  137. package/operations/system/index.js.map +1 -0
  138. package/package.json +23 -29
  139. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +23 -0
  140. package/plugins/CmsEntryFieldFilterPathPlugin.js +48 -0
  141. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -0
  142. package/plugins/CmsEntryFieldFilterPlugin.d.ts +43 -0
  143. package/plugins/CmsEntryFieldFilterPlugin.js +27 -0
  144. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -0
  145. package/plugins/CmsEntryFieldSortingPlugin.d.ts +42 -0
  146. package/plugins/CmsEntryFieldSortingPlugin.js +27 -0
  147. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -0
  148. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +11 -0
  149. package/plugins/CmsFieldFilterValueTransformPlugin.js +23 -0
  150. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -0
  151. package/plugins/index.d.ts +4 -0
  152. package/plugins/index.js +51 -0
  153. package/plugins/index.js.map +1 -0
  154. package/types.d.ts +21 -45
  155. package/types.js +5 -6
  156. package/types.js.map +1 -0
  157. package/definitions/settings.d.ts +0 -8
  158. package/definitions/settings.js +0 -62
  159. package/dynamoDb/path/ref.d.ts +0 -3
  160. package/dynamoDb/path/ref.js +0 -27
  161. package/dynamoDb/storage/date.d.ts +0 -3
  162. package/dynamoDb/storage/date.js +0 -65
  163. package/operations/entry/systemFields.d.ts +0 -2
  164. package/operations/entry/systemFields.js +0 -50
  165. package/operations/entry/utils.d.ts +0 -31
  166. package/operations/entry/utils.js +0 -406
  167. package/operations/settings/index.d.ts +0 -6
  168. package/operations/settings/index.js +0 -141
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createCmsEntryFieldSortingPlugin = exports.CmsEntryFieldSortingPlugin = void 0;
7
+ var _plugins = require("@webiny/plugins");
8
+ class CmsEntryFieldSortingPlugin extends _plugins.Plugin {
9
+ static type = "cms.entry.field.sorting";
10
+ constructor(config) {
11
+ super();
12
+ this.config = config;
13
+ }
14
+ canUse(params) {
15
+ return this.config.canUse(params);
16
+ }
17
+ createSort(params) {
18
+ return this.config.createSort(params);
19
+ }
20
+ }
21
+ exports.CmsEntryFieldSortingPlugin = CmsEntryFieldSortingPlugin;
22
+ const createCmsEntryFieldSortingPlugin = config => {
23
+ return new CmsEntryFieldSortingPlugin(config);
24
+ };
25
+ exports.createCmsEntryFieldSortingPlugin = createCmsEntryFieldSortingPlugin;
26
+
27
+ //# sourceMappingURL=CmsEntryFieldSortingPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_plugins","require","CmsEntryFieldSortingPlugin","Plugin","type","constructor","config","canUse","params","createSort","exports","createCmsEntryFieldSortingPlugin"],"sources":["CmsEntryFieldSortingPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { Field } from \"~/operations/entry/filtering/types\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types\";\n\ninterface CmsEntryFieldSortingPluginCanUseParams {\n model: CmsModel;\n field?: Field;\n fieldId: string;\n order: \"ASC\" | \"DESC\";\n /**\n * Combination of fieldId and sortBy\n *\n * example: id_ASC or createdBy_DESC\n */\n sortBy: string;\n}\n\ninterface CmsEntryFieldSortingPluginCreateSortParams {\n model: CmsModel;\n fieldId: string;\n order: \"ASC\" | \"DESC\";\n sortBy: string;\n fields: Record<string, Field>;\n field?: Field;\n}\n\ninterface CmsEntryFieldSortingPluginCreateSortResult {\n valuePath: string;\n reverse: boolean;\n fieldId: string;\n field: Field;\n}\n\ninterface CmsEntryFieldSortingPluginConfig {\n createSort: (\n params: CmsEntryFieldSortingPluginCreateSortParams\n ) => CmsEntryFieldSortingPluginCreateSortResult;\n canUse: (params: CmsEntryFieldSortingPluginCanUseParams) => boolean;\n}\n\nexport class CmsEntryFieldSortingPlugin extends Plugin {\n public static override readonly type: string = \"cms.entry.field.sorting\";\n private readonly config: CmsEntryFieldSortingPluginConfig;\n\n public constructor(config: CmsEntryFieldSortingPluginConfig) {\n super();\n this.config = config;\n }\n\n public canUse(params: CmsEntryFieldSortingPluginCanUseParams): boolean {\n return this.config.canUse(params);\n }\n\n public createSort(\n params: CmsEntryFieldSortingPluginCreateSortParams\n ): CmsEntryFieldSortingPluginCreateSortResult {\n return this.config.createSort(params);\n }\n}\n\nexport const createCmsEntryFieldSortingPlugin = (config: CmsEntryFieldSortingPluginConfig) => {\n return new CmsEntryFieldSortingPlugin(config);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAwCO,MAAMC,0BAA0B,SAASC,eAAM,CAAC;EACnD,OAAgCC,IAAI,GAAW,yBAAyB;EAGjEC,WAAWA,CAACC,MAAwC,EAAE;IACzD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEOC,MAAMA,CAACC,MAA8C,EAAW;IACnE,OAAO,IAAI,CAACF,MAAM,CAACC,MAAM,CAACC,MAAM,CAAC;EACrC;EAEOC,UAAUA,CACbD,MAAkD,EACR;IAC1C,OAAO,IAAI,CAACF,MAAM,CAACG,UAAU,CAACD,MAAM,CAAC;EACzC;AACJ;AAACE,OAAA,CAAAR,0BAAA,GAAAA,0BAAA;AAEM,MAAMS,gCAAgC,GAAIL,MAAwC,IAAK;EAC1F,OAAO,IAAIJ,0BAA0B,CAACI,MAAM,CAAC;AACjD,CAAC;AAACI,OAAA,CAAAC,gCAAA,GAAAA,gCAAA","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import type { CmsFieldFilterValueTransformPlugin as CmsFieldFilterValueTransformPluginInterface } from "../types";
3
+ type CmsFieldFilterValueTransformPluginParams = Omit<CmsFieldFilterValueTransformPluginInterface, "type">;
4
+ export declare class CmsFieldFilterValueTransformPlugin extends Plugin implements Omit<CmsFieldFilterValueTransformPluginInterface, "type"> {
5
+ static type: string;
6
+ private config;
7
+ get fieldType(): string;
8
+ get transform(): CmsFieldFilterValueTransformPluginParams["transform"];
9
+ constructor(config: CmsFieldFilterValueTransformPluginParams);
10
+ }
11
+ export {};
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CmsFieldFilterValueTransformPlugin = void 0;
7
+ var _plugins = require("@webiny/plugins");
8
+ class CmsFieldFilterValueTransformPlugin extends _plugins.Plugin {
9
+ static type = "cms-field-filter-value-transform";
10
+ get fieldType() {
11
+ return this.config.fieldType;
12
+ }
13
+ get transform() {
14
+ return this.config.transform;
15
+ }
16
+ constructor(config) {
17
+ super();
18
+ this.config = config;
19
+ }
20
+ }
21
+ exports.CmsFieldFilterValueTransformPlugin = CmsFieldFilterValueTransformPlugin;
22
+
23
+ //# sourceMappingURL=CmsFieldFilterValueTransformPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_plugins","require","CmsFieldFilterValueTransformPlugin","Plugin","type","fieldType","config","transform","constructor","exports"],"sources":["CmsFieldFilterValueTransformPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { CmsFieldFilterValueTransformPlugin as CmsFieldFilterValueTransformPluginInterface } from \"~/types\";\n\ntype CmsFieldFilterValueTransformPluginParams = Omit<\n CmsFieldFilterValueTransformPluginInterface,\n \"type\"\n>;\nexport class CmsFieldFilterValueTransformPlugin\n extends Plugin\n implements Omit<CmsFieldFilterValueTransformPluginInterface, \"type\">\n{\n public static override type = \"cms-field-filter-value-transform\";\n\n private config: CmsFieldFilterValueTransformPluginParams;\n\n public get fieldType(): string {\n return this.config.fieldType;\n }\n\n public get transform(): CmsFieldFilterValueTransformPluginParams[\"transform\"] {\n return this.config.transform;\n }\n\n public constructor(config: CmsFieldFilterValueTransformPluginParams) {\n super();\n this.config = config;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,kCAAkC,SACnCC,eAAM,CAElB;EACI,OAAuBC,IAAI,GAAG,kCAAkC;EAIhE,IAAWC,SAASA,CAAA,EAAW;IAC3B,OAAO,IAAI,CAACC,MAAM,CAACD,SAAS;EAChC;EAEA,IAAWE,SAASA,CAAA,EAA0D;IAC1E,OAAO,IAAI,CAACD,MAAM,CAACC,SAAS;EAChC;EAEOC,WAAWA,CAACF,MAAgD,EAAE;IACjE,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;AACJ;AAACG,OAAA,CAAAP,kCAAA,GAAAA,kCAAA","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ export * from "./CmsEntryFieldFilterPathPlugin";
2
+ export * from "./CmsEntryFieldSortingPlugin";
3
+ export * from "./CmsEntryFieldFilterPlugin";
4
+ export * from "./CmsFieldFilterValueTransformPlugin";
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _CmsEntryFieldFilterPathPlugin = require("./CmsEntryFieldFilterPathPlugin");
7
+ Object.keys(_CmsEntryFieldFilterPathPlugin).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _CmsEntryFieldFilterPathPlugin[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _CmsEntryFieldFilterPathPlugin[key];
14
+ }
15
+ });
16
+ });
17
+ var _CmsEntryFieldSortingPlugin = require("./CmsEntryFieldSortingPlugin");
18
+ Object.keys(_CmsEntryFieldSortingPlugin).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _CmsEntryFieldSortingPlugin[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _CmsEntryFieldSortingPlugin[key];
25
+ }
26
+ });
27
+ });
28
+ var _CmsEntryFieldFilterPlugin = require("./CmsEntryFieldFilterPlugin");
29
+ Object.keys(_CmsEntryFieldFilterPlugin).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _CmsEntryFieldFilterPlugin[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _CmsEntryFieldFilterPlugin[key];
36
+ }
37
+ });
38
+ });
39
+ var _CmsFieldFilterValueTransformPlugin = require("./CmsFieldFilterValueTransformPlugin");
40
+ Object.keys(_CmsFieldFilterValueTransformPlugin).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _CmsFieldFilterValueTransformPlugin[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _CmsFieldFilterValueTransformPlugin[key];
47
+ }
48
+ });
49
+ });
50
+
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_CmsEntryFieldFilterPathPlugin","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_CmsEntryFieldSortingPlugin","_CmsEntryFieldFilterPlugin","_CmsFieldFilterValueTransformPlugin"],"sources":["index.ts"],"sourcesContent":["export * from \"./CmsEntryFieldFilterPathPlugin\";\nexport * from \"./CmsEntryFieldSortingPlugin\";\nexport * from \"./CmsEntryFieldFilterPlugin\";\nexport * from \"./CmsFieldFilterValueTransformPlugin\";\n"],"mappings":";;;;;AAAA,IAAAA,8BAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,8BAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,8BAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,8BAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,2BAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,2BAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,2BAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,2BAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,0BAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,0BAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,0BAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,0BAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,mCAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,mCAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,mCAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,mCAAA,CAAAP,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
package/types.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { Plugin } from "@webiny/plugins/types";
2
- import { CmsModelField, CmsModelFieldToGraphQLPlugin, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
3
- import { DynamoDBTypes, TableConstructor } from "dynamodb-toolbox/dist/classes/Table";
4
- import { EntityAttributeConfig, EntityCompositeAttributes } from "dynamodb-toolbox/dist/classes/Entity";
5
- import { DocumentClient } from "aws-sdk/clients/dynamodb";
6
- import { Entity, Table } from "dynamodb-toolbox";
1
+ import type { Plugin } from "@webiny/plugins/types";
2
+ import type { CmsEntryStorageOperations as BaseCmsEntryStorageOperations, CmsModel, CmsModelField, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
3
+ import type { TableConstructor } from "@webiny/db-dynamodb/toolbox";
4
+ import type { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
5
+ import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
6
+ import type { Entity, Table } from "@webiny/db-dynamodb/toolbox";
7
7
  interface CmsFieldFilterValueTransformParams {
8
8
  /**
9
9
  * A field which value we are transforming.
10
10
  */
11
- field: CmsModelField;
11
+ field: Partial<CmsModelField> & Pick<CmsModelField, "id" | "storageId" | "fieldId" | "settings">;
12
12
  value: any;
13
13
  }
14
14
  export interface CmsFieldFilterValueTransformPlugin extends Plugin {
@@ -25,60 +25,36 @@ export interface CmsFieldFilterValueTransformPlugin extends Plugin {
25
25
  */
26
26
  transform: (params: CmsFieldFilterValueTransformParams) => any;
27
27
  }
28
- interface CmsFieldFilterPathParams {
29
- /**
30
- * A field for which we are creating the value path.
31
- */
32
- field: CmsModelField;
33
- /**
34
- * If value is an array we will need index position.
35
- * It is up to the developer to add.
36
- */
37
- index?: number | string;
38
- }
39
- export interface CmsFieldFilterPathPlugin extends Plugin {
40
- /**
41
- * A plugin type.
42
- */
43
- type: "cms-field-filter-path";
44
- /**
45
- * A field type this plugin is for.
46
- */
47
- fieldType: string;
48
- /**
49
- * A field id this plugin is for.
50
- * It is meant for targeting only specific fields in a certain type.
51
- */
52
- fieldId?: string[];
53
- /**
54
- * Get a path for given field.
55
- */
56
- createPath: (params: CmsFieldFilterPathParams) => string;
57
- }
58
- export declare type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;
59
- export declare type Attributes = Record<string, AttributeDefinition>;
28
+ export type Attributes = Record<string, AttributeDefinition>;
60
29
  export declare enum ENTITIES {
61
30
  SYSTEM = "CmsSystem",
62
- SETTINGS = "CmsSettings",
63
31
  GROUPS = "CmsGroups",
64
32
  MODELS = "CmsModels",
65
33
  ENTRIES = "CmsEntries"
66
34
  }
67
35
  export interface TableModifier {
68
- (table: TableConstructor): TableConstructor;
36
+ (table: TableConstructor<string, string, string>): TableConstructor<string, string, string>;
69
37
  }
70
38
  export interface StorageOperationsFactoryParams {
71
- documentClient: DocumentClient;
39
+ documentClient: DynamoDBDocument;
72
40
  table?: TableModifier;
73
- modelFieldToGraphQLPlugins: CmsModelFieldToGraphQLPlugin[];
74
41
  attributes?: Record<ENTITIES, Attributes>;
75
42
  plugins?: Plugin[] | Plugin[][];
76
43
  }
77
44
  export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {
78
- getTable: () => Table;
79
- getEntities: () => Record<"system" | "settings" | "groups" | "models" | "entries", Entity<any>>;
45
+ getTable: () => Table<string, string, string>;
46
+ getEntities: () => Record<"system" | "groups" | "models" | "entries", Entity<any>>;
80
47
  }
81
48
  export interface StorageOperationsFactory {
82
49
  (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;
83
50
  }
51
+ export interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {
52
+ dataLoaders: DataLoadersHandlerInterface;
53
+ }
54
+ export interface DataLoadersHandlerInterfaceClearAllParams {
55
+ model: Pick<CmsModel, "tenant" | "locale">;
56
+ }
57
+ export interface DataLoadersHandlerInterface {
58
+ clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;
59
+ }
84
60
  export {};
package/types.js CHANGED
@@ -4,13 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ENTITIES = void 0;
7
- let ENTITIES;
8
- exports.ENTITIES = ENTITIES;
9
-
10
- (function (ENTITIES) {
7
+ let ENTITIES = exports.ENTITIES = /*#__PURE__*/function (ENTITIES) {
11
8
  ENTITIES["SYSTEM"] = "CmsSystem";
12
- ENTITIES["SETTINGS"] = "CmsSettings";
13
9
  ENTITIES["GROUPS"] = "CmsGroups";
14
10
  ENTITIES["MODELS"] = "CmsModels";
15
11
  ENTITIES["ENTRIES"] = "CmsEntries";
16
- })(ENTITIES || (exports.ENTITIES = ENTITIES = {}));
12
+ return ENTITIES;
13
+ }({});
14
+
15
+ //# sourceMappingURL=types.js.map
package/types.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ENTITIES","exports"],"sources":["types.ts"],"sourcesContent":["import type { Plugin } from \"@webiny/plugins/types\";\nimport type {\n CmsEntryStorageOperations as BaseCmsEntryStorageOperations,\n CmsModel,\n CmsModelField,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types\";\nimport type { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\nimport type { AttributeDefinition } from \"@webiny/db-dynamodb/toolbox\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport type { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\n\ninterface CmsFieldFilterValueTransformParams {\n /**\n * A field which value we are transforming.\n */\n field: Partial<CmsModelField> &\n Pick<CmsModelField, \"id\" | \"storageId\" | \"fieldId\" | \"settings\">;\n value: any;\n}\n\nexport interface CmsFieldFilterValueTransformPlugin extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-field-filter-value-transform\";\n /**\n * A field type this plugin is for.\n */\n fieldType: string;\n /**\n * Transform method which expect field definition and value to transform.\n */\n transform: (params: CmsFieldFilterValueTransformParams) => any;\n}\n\nexport type Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n SYSTEM = \"CmsSystem\",\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\"\n}\n\nexport interface TableModifier {\n (table: TableConstructor<string, string, string>): TableConstructor<string, string, string>;\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DynamoDBDocument;\n table?: TableModifier;\n attributes?: Record<ENTITIES, Attributes>;\n plugins?: Plugin[] | Plugin[][];\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {\n getTable: () => Table<string, string, string>;\n getEntities: () => Record<\"system\" | \"groups\" | \"models\" | \"entries\", Entity<any>>;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n\nexport interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {\n dataLoaders: DataLoadersHandlerInterface;\n}\n\nexport interface DataLoadersHandlerInterfaceClearAllParams {\n model: Pick<CmsModel, \"tenant\" | \"locale\">;\n}\nexport interface DataLoadersHandlerInterface {\n clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;\n}\n"],"mappings":";;;;;;IAsCYA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import { Entity, Table } from "dynamodb-toolbox";
2
- import { Attributes } from "../types";
3
- export interface Params {
4
- table: Table;
5
- entityName: string;
6
- attributes: Attributes;
7
- }
8
- export declare const createSettingsEntity: (params: Params) => Entity<any>;
@@ -1,62 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.createSettingsEntity = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
15
-
16
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
17
-
18
- const createSettingsEntity = params => {
19
- const {
20
- entityName,
21
- table,
22
- attributes
23
- } = params;
24
- return new _dynamodbToolbox.Entity({
25
- name: entityName,
26
- table,
27
- attributes: _objectSpread({
28
- PK: {
29
- partitionKey: true
30
- },
31
- SK: {
32
- sortKey: true
33
- },
34
- TYPE: {
35
- type: "string"
36
- },
37
- key: {
38
- type: "string"
39
- },
40
- uploadMinFileSize: {
41
- type: "number"
42
- },
43
- uploadMaxFileSize: {
44
- type: "number"
45
- },
46
- srcPrefix: {
47
- type: "string"
48
- },
49
- contentModelLastChange: {
50
- type: "string"
51
- },
52
- tenant: {
53
- type: "string"
54
- },
55
- locale: {
56
- type: "string"
57
- }
58
- }, attributes || {})
59
- });
60
- };
61
-
62
- exports.createSettingsEntity = createSettingsEntity;
@@ -1,3 +0,0 @@
1
- import { CmsFieldFilterPathPlugin } from "../../types";
2
- declare const _default: () => CmsFieldFilterPathPlugin;
3
- export default _default;
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _default = () => ({
9
- type: "cms-field-filter-path",
10
- name: "cms-field-filter-path-ref",
11
- fieldType: "ref",
12
- createPath: ({
13
- field,
14
- index
15
- }) => {
16
- const paths = [field.fieldId];
17
-
18
- if (index !== undefined) {
19
- paths.push(String(index));
20
- }
21
-
22
- paths.push("entryId");
23
- return paths.join(".");
24
- }
25
- });
26
-
27
- exports.default = _default;
@@ -1,3 +0,0 @@
1
- import { StorageTransformPlugin } from "@webiny/api-headless-cms/content/plugins/storage/StorageTransformPlugin";
2
- declare const _default: () => StorageTransformPlugin<any, any>;
3
- export default _default;
@@ -1,65 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _error = _interopRequireDefault(require("@webiny/error"));
11
-
12
- var _StorageTransformPlugin = require("@webiny/api-headless-cms/content/plugins/storage/StorageTransformPlugin");
13
-
14
- const excludeTypes = ["time", "dateTimeWithTimezone"];
15
- const plugin = new _StorageTransformPlugin.StorageTransformPlugin({
16
- fieldType: "datetime",
17
- fromStorage: async ({
18
- value,
19
- field
20
- }) => {
21
- const {
22
- type
23
- } = field.settings || {};
24
-
25
- if (!value || !type || excludeTypes.includes(type)) {
26
- return value;
27
- }
28
-
29
- try {
30
- return new Date(value);
31
- } catch {
32
- console.log(`Could not transform from storage for field type`);
33
- return value;
34
- }
35
- },
36
- toStorage: async ({
37
- value,
38
- field
39
- }) => {
40
- const {
41
- type
42
- } = field.settings || {};
43
-
44
- if (!value || !type || excludeTypes.includes(type)) {
45
- return value;
46
- }
47
-
48
- if (value.toISOString) {
49
- return value.toISOString();
50
- } else if (typeof value === "string") {
51
- return value;
52
- }
53
-
54
- throw new _error.default("Error converting value to a storage type.", "TO_STORAGE_ERROR", {
55
- value,
56
- fieldId: field.fieldId
57
- });
58
- }
59
- });
60
-
61
- var _default = () => {
62
- return plugin;
63
- };
64
-
65
- exports.default = _default;
@@ -1,2 +0,0 @@
1
- import { CmsModelField } from "@webiny/api-headless-cms/types";
2
- export declare const systemFields: Record<string, CmsModelField>;
@@ -1,50 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.systemFields = void 0;
7
-
8
- const createSystemField = field => {
9
- return field;
10
- };
11
-
12
- const systemFields = {
13
- id: createSystemField({
14
- id: "id",
15
- type: "text",
16
- fieldId: "id"
17
- }),
18
- entryId: createSystemField({
19
- id: "entryId",
20
- type: "text",
21
- fieldId: "entryId"
22
- }),
23
- createdOn: createSystemField({
24
- id: "createdOn",
25
- type: "datetime",
26
- fieldId: "createdOn"
27
- }),
28
- savedOn: createSystemField({
29
- id: "savedOn",
30
- type: "datetime",
31
- fieldId: "savedOn"
32
- }),
33
- createdBy: createSystemField({
34
- id: "createdBy",
35
- type: "plainObject",
36
- fieldId: "createdBy",
37
- settings: {
38
- path: "createdBy.id"
39
- }
40
- }),
41
- ownedBy: createSystemField({
42
- id: "ownedBy",
43
- type: "plainObject",
44
- fieldId: "ownedBy",
45
- settings: {
46
- path: "ownedBy.id"
47
- }
48
- })
49
- };
50
- exports.systemFields = systemFields;
@@ -1,31 +0,0 @@
1
- import { CmsEntry, CmsEntryListWhere, CmsModel, CmsModelField } from "@webiny/api-headless-cms/types";
2
- import { PluginsContainer } from "@webiny/plugins";
3
- interface ModelField {
4
- def: CmsModelField;
5
- valueTransformer: (value: any) => any;
6
- valuePath: string;
7
- isSystemField?: boolean;
8
- }
9
- declare type ModelFieldRecords = Record<string, ModelField>;
10
- export interface FilterItemFromStorage {
11
- (field: CmsModelField, value: any): Promise<any>;
12
- }
13
- interface FilterItemsParams {
14
- items: CmsEntry[];
15
- where: CmsEntryListWhere;
16
- plugins: PluginsContainer;
17
- fields: ModelFieldRecords;
18
- fromStorage: FilterItemFromStorage;
19
- }
20
- export declare const filterItems: (params: FilterItemsParams) => Promise<CmsEntry[]>;
21
- interface SortEntryItemsArgs {
22
- items: CmsEntry[];
23
- sort: string[];
24
- fields: ModelFieldRecords;
25
- }
26
- export declare const sortEntryItems: (params: SortEntryItemsArgs) => CmsEntry[];
27
- export declare const buildModelFields: ({ plugins, model }: {
28
- plugins: PluginsContainer;
29
- model: CmsModel;
30
- }) => Record<string, ModelField>;
31
- export {};