@webiny/api-headless-cms-ddb-es 5.37.8 → 5.38.0-beta.0

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 (123) hide show
  1. package/configurations.js +3 -1
  2. package/definitions/entry.js +3 -1
  3. package/definitions/entryElasticsearch.js +3 -1
  4. package/definitions/group.js +3 -1
  5. package/definitions/model.js +3 -1
  6. package/definitions/system.js +3 -1
  7. package/definitions/table.js +3 -1
  8. package/definitions/tableElasticsearch.js +3 -1
  9. package/dynamoDb/index.js +3 -1
  10. package/dynamoDb/storage/date.js +3 -1
  11. package/dynamoDb/storage/longText.js +3 -1
  12. package/dynamoDb/storage/richText.js +3 -1
  13. package/elasticsearch/createElasticsearchIndex.d.ts +1 -1
  14. package/elasticsearch/createElasticsearchIndex.js +19 -29
  15. package/elasticsearch/createElasticsearchIndex.js.map +1 -1
  16. package/elasticsearch/deleteElasticsearchIndex.d.ts +1 -1
  17. package/elasticsearch/deleteElasticsearchIndex.js +6 -4
  18. package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
  19. package/elasticsearch/index.js +3 -1
  20. package/elasticsearch/indexing/dateTimeIndexing.js +3 -1
  21. package/elasticsearch/indexing/defaultFieldIndexing.js +3 -1
  22. package/elasticsearch/indexing/index.js +3 -1
  23. package/elasticsearch/indexing/longTextIndexing.js +3 -1
  24. package/elasticsearch/indexing/numberIndexing.js +3 -1
  25. package/elasticsearch/indexing/objectIndexing.js +3 -1
  26. package/elasticsearch/indexing/richTextIndexing.js +3 -1
  27. package/elasticsearch/indices/base.js +3 -1
  28. package/elasticsearch/indices/index.js +3 -1
  29. package/elasticsearch/indices/japanese.js +3 -1
  30. package/elasticsearch/search/index.js +3 -1
  31. package/elasticsearch/search/refSearch.js +3 -1
  32. package/elasticsearch/search/timeSearch.js +3 -1
  33. package/helpers/entryIndexHelpers.js +3 -1
  34. package/helpers/fieldIdentifier.js +3 -1
  35. package/helpers/index.js +3 -1
  36. package/index.js +14 -16
  37. package/index.js.map +1 -1
  38. package/operations/entry/dataLoader/DataLoaderCache.js +3 -1
  39. package/operations/entry/dataLoader/constants.js +3 -1
  40. package/operations/entry/dataLoader/createBatchScheduleFn.js +3 -1
  41. package/operations/entry/dataLoader/getAllEntryRevisions.js +3 -1
  42. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +3 -1
  43. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +3 -1
  44. package/operations/entry/dataLoader/getRevisionById.js +3 -1
  45. package/operations/entry/dataLoader/index.js +3 -1
  46. package/operations/entry/dataLoader/types.js +3 -1
  47. package/operations/entry/dataLoaders.js +3 -1
  48. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +3 -1
  49. package/operations/entry/elasticsearch/body.js +3 -1
  50. package/operations/entry/elasticsearch/fields.js +3 -1
  51. package/operations/entry/elasticsearch/filtering/applyFiltering.js +3 -1
  52. package/operations/entry/elasticsearch/filtering/exec.js +3 -1
  53. package/operations/entry/elasticsearch/filtering/index.js +3 -1
  54. package/operations/entry/elasticsearch/filtering/path.js +3 -1
  55. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +3 -1
  56. package/operations/entry/elasticsearch/filtering/plugins/index.js +3 -1
  57. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +3 -1
  58. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +3 -1
  59. package/operations/entry/elasticsearch/filtering/populated.js +3 -1
  60. package/operations/entry/elasticsearch/filtering/values.js +3 -1
  61. package/operations/entry/elasticsearch/fullTextSearch.js +3 -1
  62. package/operations/entry/elasticsearch/fullTextSearchFields.js +3 -1
  63. package/operations/entry/elasticsearch/initialQuery.js +3 -1
  64. package/operations/entry/elasticsearch/keyword.js +3 -1
  65. package/operations/entry/elasticsearch/plugins/bodyModifier.js +3 -1
  66. package/operations/entry/elasticsearch/plugins/operator.js +3 -1
  67. package/operations/entry/elasticsearch/plugins/queryModifier.js +3 -1
  68. package/operations/entry/elasticsearch/plugins/search.js +3 -1
  69. package/operations/entry/elasticsearch/plugins/sortModifier.js +3 -1
  70. package/operations/entry/elasticsearch/sort.js +3 -1
  71. package/operations/entry/elasticsearch/transformValueForSearch.js +3 -1
  72. package/operations/entry/elasticsearch/types.js +3 -1
  73. package/operations/entry/index.d.ts +0 -3
  74. package/operations/entry/index.js +80 -176
  75. package/operations/entry/index.js.map +1 -1
  76. package/operations/entry/keys.js +3 -1
  77. package/operations/entry/recordType.js +3 -1
  78. package/operations/entry/transformations/convertEntryKeys.d.ts +8 -0
  79. package/operations/entry/transformations/convertEntryKeys.js +38 -0
  80. package/operations/entry/transformations/convertEntryKeys.js.map +1 -0
  81. package/operations/entry/transformations/index.d.ts +29 -0
  82. package/operations/entry/transformations/index.js +126 -0
  83. package/operations/entry/transformations/index.js.map +1 -0
  84. package/operations/entry/transformations/modifyEntryValues.d.ts +32 -0
  85. package/operations/entry/transformations/modifyEntryValues.js +29 -0
  86. package/operations/entry/transformations/modifyEntryValues.js.map +1 -0
  87. package/operations/entry/transformations/transformEntryKeys.d.ts +11 -0
  88. package/operations/entry/transformations/transformEntryKeys.js +27 -0
  89. package/operations/entry/transformations/transformEntryKeys.js.map +1 -0
  90. package/operations/entry/transformations/transformEntryToIndex.d.ts +10 -0
  91. package/operations/entry/transformations/transformEntryToIndex.js +33 -0
  92. package/operations/entry/transformations/transformEntryToIndex.js.map +1 -0
  93. package/operations/group/index.js +5 -3
  94. package/operations/group/index.js.map +1 -1
  95. package/operations/model/index.js +3 -1
  96. package/operations/system/index.js +3 -1
  97. package/operations/system/indexes.d.ts +10 -0
  98. package/operations/system/indexes.js +42 -0
  99. package/operations/system/indexes.js.map +1 -0
  100. package/package.json +19 -18
  101. package/plugins/CmsElasticsearchModelFieldPlugin.js +3 -1
  102. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +3 -1
  103. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +3 -1
  104. package/plugins/CmsEntryElasticsearchIndexPlugin.js +3 -1
  105. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +3 -1
  106. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +3 -1
  107. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +3 -1
  108. package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +33 -0
  109. package/plugins/CmsEntryElasticsearchValuesModifier.js +54 -0
  110. package/plugins/CmsEntryElasticsearchValuesModifier.js.map +1 -0
  111. package/plugins/CmsEntryFilterPlugin.js +3 -1
  112. package/plugins/index.d.ts +1 -0
  113. package/plugins/index.js +14 -1
  114. package/plugins/index.js.map +1 -1
  115. package/types.d.ts +1 -2
  116. package/types.js +3 -2
  117. package/types.js.map +1 -1
  118. package/definitions/settings.d.ts +0 -8
  119. package/definitions/settings.js +0 -53
  120. package/definitions/settings.js.map +0 -1
  121. package/operations/settings/index.d.ts +0 -6
  122. package/operations/settings/index.js +0 -111
  123. package/operations/settings/index.js.map +0 -1
@@ -0,0 +1,33 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import { CmsEntry, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types";
3
+ interface CmsEntryElasticsearchValuesModifierCbParamsSetValuesCb<T = CmsEntryValues> {
4
+ (prev: Partial<T>): Partial<T>;
5
+ }
6
+ interface CmsEntryElasticsearchValuesModifierCbParams<T = CmsEntryValues> {
7
+ model: CmsModel;
8
+ entry: CmsEntry<T>;
9
+ values: T;
10
+ setValues: (cb: CmsEntryElasticsearchValuesModifierCbParamsSetValuesCb<T>) => void;
11
+ }
12
+ export interface CmsEntryElasticsearchValuesModifierCb<T = CmsEntryValues> {
13
+ (params: CmsEntryElasticsearchValuesModifierCbParams<T>): void;
14
+ }
15
+ export interface CmsEntryElasticsearchValuesModifierExecParams<T = CmsEntryValues> {
16
+ model: CmsModel;
17
+ entry: CmsEntry<T>;
18
+ values: Partial<T>;
19
+ }
20
+ export declare type CmsEntryElasticsearchValuesModifierParams<T> = CmsEntryElasticsearchValuesModifierCb<T> | {
21
+ models: string[];
22
+ modifier: CmsEntryElasticsearchValuesModifierCb<T>;
23
+ };
24
+ export declare class CmsEntryElasticsearchValuesModifier<T = CmsEntryValues> extends Plugin {
25
+ static readonly type: string;
26
+ private readonly models?;
27
+ private readonly cb;
28
+ constructor(params: CmsEntryElasticsearchValuesModifierParams<T>);
29
+ canModify(modelId: string): boolean;
30
+ modify(params: CmsEntryElasticsearchValuesModifierExecParams<T>): Partial<T>;
31
+ }
32
+ export declare const createCmsEntryElasticsearchValuesModifier: <T = CmsEntryValues>(params: CmsEntryElasticsearchValuesModifierParams<T>) => CmsEntryElasticsearchValuesModifier<T>;
33
+ export {};
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.createCmsEntryElasticsearchValuesModifier = exports.CmsEntryElasticsearchValuesModifier = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _plugins = require("@webiny/plugins");
10
+ class CmsEntryElasticsearchValuesModifier extends _plugins.Plugin {
11
+ constructor(params) {
12
+ super();
13
+ (0, _defineProperty2.default)(this, "models", undefined);
14
+ (0, _defineProperty2.default)(this, "cb", void 0);
15
+ if (typeof params === "function") {
16
+ this.cb = params;
17
+ } else {
18
+ this.cb = params.modifier;
19
+ this.models = params.models.length > 0 ? params.models : undefined;
20
+ }
21
+ }
22
+ canModify(modelId) {
23
+ var _this$models;
24
+ if (!((_this$models = this.models) !== null && _this$models !== void 0 && _this$models.length)) {
25
+ return true;
26
+ }
27
+ return this.models.includes(modelId);
28
+ }
29
+ modify(params) {
30
+ const {
31
+ model,
32
+ entry,
33
+ values: initialValues
34
+ } = params;
35
+ let values = initialValues;
36
+ this.cb({
37
+ model,
38
+ entry,
39
+ values,
40
+ setValues: cb => {
41
+ values = cb(values);
42
+ }
43
+ });
44
+ return values;
45
+ }
46
+ }
47
+ exports.CmsEntryElasticsearchValuesModifier = CmsEntryElasticsearchValuesModifier;
48
+ (0, _defineProperty2.default)(CmsEntryElasticsearchValuesModifier, "type", "cms.entry.elasticsearch.values.modifier");
49
+ const createCmsEntryElasticsearchValuesModifier = params => {
50
+ return new CmsEntryElasticsearchValuesModifier(params);
51
+ };
52
+ exports.createCmsEntryElasticsearchValuesModifier = createCmsEntryElasticsearchValuesModifier;
53
+
54
+ //# sourceMappingURL=CmsEntryElasticsearchValuesModifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_plugins","require","CmsEntryElasticsearchValuesModifier","Plugin","constructor","params","_defineProperty2","default","undefined","cb","modifier","models","length","canModify","modelId","_this$models","includes","modify","model","entry","values","initialValues","setValues","exports","createCmsEntryElasticsearchValuesModifier"],"sources":["CmsEntryElasticsearchValuesModifier.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { CmsEntry, CmsEntryValues, CmsModel } from \"@webiny/api-headless-cms/types\";\n\ninterface CmsEntryElasticsearchValuesModifierCbParamsSetValuesCb<T = CmsEntryValues> {\n (prev: Partial<T>): Partial<T>;\n}\n\ninterface CmsEntryElasticsearchValuesModifierCbParams<T = CmsEntryValues> {\n model: CmsModel;\n entry: CmsEntry<T>;\n values: T;\n setValues: (cb: CmsEntryElasticsearchValuesModifierCbParamsSetValuesCb<T>) => void;\n}\n\nexport interface CmsEntryElasticsearchValuesModifierCb<T = CmsEntryValues> {\n (params: CmsEntryElasticsearchValuesModifierCbParams<T>): void;\n}\n\nexport interface CmsEntryElasticsearchValuesModifierExecParams<T = CmsEntryValues> {\n model: CmsModel;\n entry: CmsEntry<T>;\n values: Partial<T>;\n}\n\nexport type CmsEntryElasticsearchValuesModifierParams<T> =\n | CmsEntryElasticsearchValuesModifierCb<T>\n | {\n models: string[];\n modifier: CmsEntryElasticsearchValuesModifierCb<T>;\n };\n\nexport class CmsEntryElasticsearchValuesModifier<T = CmsEntryValues> extends Plugin {\n public static override readonly type: string = \"cms.entry.elasticsearch.values.modifier\";\n\n private readonly models?: string[] = undefined;\n private readonly cb: CmsEntryElasticsearchValuesModifierCb<T>;\n\n public constructor(params: CmsEntryElasticsearchValuesModifierParams<T>) {\n super();\n if (typeof params === \"function\") {\n this.cb = params;\n } else {\n this.cb = params.modifier;\n this.models = params.models.length > 0 ? params.models : undefined;\n }\n }\n\n public canModify(modelId: string): boolean {\n if (!this.models?.length) {\n return true;\n }\n return this.models.includes(modelId);\n }\n\n public modify(params: CmsEntryElasticsearchValuesModifierExecParams<T>): Partial<T> {\n const { model, entry, values: initialValues } = params;\n let values: any = initialValues;\n this.cb({\n model,\n entry,\n values,\n setValues: (cb: CmsEntryElasticsearchValuesModifierCbParamsSetValuesCb<T>) => {\n values = cb(values);\n }\n });\n return values;\n }\n}\n\nexport const createCmsEntryElasticsearchValuesModifier = <T = CmsEntryValues>(\n params: CmsEntryElasticsearchValuesModifierParams<T>\n) => {\n return new CmsEntryElasticsearchValuesModifier<T>(params);\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AA+BO,MAAMC,mCAAmC,SAA6BC,eAAM,CAAC;EAMzEC,WAAWA,CAACC,MAAoD,EAAE;IACrE,KAAK,CAAC,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA,kBAJyBC,SAAS;IAAA,IAAAF,gBAAA,CAAAC,OAAA;IAK1C,IAAI,OAAOF,MAAM,KAAK,UAAU,EAAE;MAC9B,IAAI,CAACI,EAAE,GAAGJ,MAAM;IACpB,CAAC,MAAM;MACH,IAAI,CAACI,EAAE,GAAGJ,MAAM,CAACK,QAAQ;MACzB,IAAI,CAACC,MAAM,GAAGN,MAAM,CAACM,MAAM,CAACC,MAAM,GAAG,CAAC,GAAGP,MAAM,CAACM,MAAM,GAAGH,SAAS;IACtE;EACJ;EAEOK,SAASA,CAACC,OAAe,EAAW;IAAA,IAAAC,YAAA;IACvC,IAAI,GAAAA,YAAA,GAAC,IAAI,CAACJ,MAAM,cAAAI,YAAA,eAAXA,YAAA,CAAaH,MAAM,GAAE;MACtB,OAAO,IAAI;IACf;IACA,OAAO,IAAI,CAACD,MAAM,CAACK,QAAQ,CAACF,OAAO,CAAC;EACxC;EAEOG,MAAMA,CAACZ,MAAwD,EAAc;IAChF,MAAM;MAAEa,KAAK;MAAEC,KAAK;MAAEC,MAAM,EAAEC;IAAc,CAAC,GAAGhB,MAAM;IACtD,IAAIe,MAAW,GAAGC,aAAa;IAC/B,IAAI,CAACZ,EAAE,CAAC;MACJS,KAAK;MACLC,KAAK;MACLC,MAAM;MACNE,SAAS,EAAGb,EAA6D,IAAK;QAC1EW,MAAM,GAAGX,EAAE,CAACW,MAAM,CAAC;MACvB;IACJ,CAAC,CAAC;IACF,OAAOA,MAAM;EACjB;AACJ;AAACG,OAAA,CAAArB,mCAAA,GAAAA,mCAAA;AAAA,IAAAI,gBAAA,CAAAC,OAAA,EApCYL,mCAAmC,UACG,yCAAyC;AAqCrF,MAAMsB,yCAAyC,GAClDnB,MAAoD,IACnD;EACD,OAAO,IAAIH,mCAAmC,CAAIG,MAAM,CAAC;AAC7D,CAAC;AAACkB,OAAA,CAAAC,yCAAA,GAAAA,yCAAA"}
@@ -21,4 +21,6 @@ class CmsEntryFilterPlugin extends _plugins.Plugin {
21
21
  }
22
22
  exports.CmsEntryFilterPlugin = CmsEntryFilterPlugin;
23
23
  (0, _defineProperty2.default)(CmsEntryFilterPlugin, "type", "cms.elasticsearch.entry.filter");
24
- (0, _defineProperty2.default)(CmsEntryFilterPlugin, "ALL", "*");
24
+ (0, _defineProperty2.default)(CmsEntryFilterPlugin, "ALL", "*");
25
+
26
+ //# sourceMappingURL=CmsEntryFilterPlugin.js.map
@@ -5,3 +5,4 @@ export * from "./CmsEntryElasticsearchQueryModifierPlugin";
5
5
  export * from "./CmsEntryElasticsearchSortModifierPlugin";
6
6
  export * from "./CmsEntryElasticsearchFullTextSearchPlugin";
7
7
  export * from "./CmsElasticsearchModelFieldPlugin";
8
+ export * from "./CmsEntryElasticsearchValuesModifier";
package/plugins/index.js CHANGED
@@ -79,4 +79,17 @@ Object.keys(_CmsElasticsearchModelFieldPlugin).forEach(function (key) {
79
79
  return _CmsElasticsearchModelFieldPlugin[key];
80
80
  }
81
81
  });
82
- });
82
+ });
83
+ var _CmsEntryElasticsearchValuesModifier = require("./CmsEntryElasticsearchValuesModifier");
84
+ Object.keys(_CmsEntryElasticsearchValuesModifier).forEach(function (key) {
85
+ if (key === "default" || key === "__esModule") return;
86
+ if (key in exports && exports[key] === _CmsEntryElasticsearchValuesModifier[key]) return;
87
+ Object.defineProperty(exports, key, {
88
+ enumerable: true,
89
+ get: function () {
90
+ return _CmsEntryElasticsearchValuesModifier[key];
91
+ }
92
+ });
93
+ });
94
+
95
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_CmsEntryElasticsearchBodyModifierPlugin","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_CmsEntryElasticsearchIndexPlugin","_CmsEntryElasticsearchQueryBuilderValueSearchPlugin","_CmsEntryElasticsearchQueryModifierPlugin","_CmsEntryElasticsearchSortModifierPlugin","_CmsEntryElasticsearchFullTextSearchPlugin","_CmsElasticsearchModelFieldPlugin"],"sources":["index.ts"],"sourcesContent":["export * from \"./CmsEntryElasticsearchBodyModifierPlugin\";\nexport * from \"./CmsEntryElasticsearchIndexPlugin\";\nexport * from \"./CmsEntryElasticsearchQueryBuilderValueSearchPlugin\";\nexport * from \"./CmsEntryElasticsearchQueryModifierPlugin\";\nexport * from \"./CmsEntryElasticsearchSortModifierPlugin\";\nexport * from \"./CmsEntryElasticsearchFullTextSearchPlugin\";\nexport * from \"./CmsElasticsearchModelFieldPlugin\";\n"],"mappings":";;;;;AAAA,IAAAA,wCAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,wCAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAA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":["_CmsEntryElasticsearchBodyModifierPlugin","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_CmsEntryElasticsearchIndexPlugin","_CmsEntryElasticsearchQueryBuilderValueSearchPlugin","_CmsEntryElasticsearchQueryModifierPlugin","_CmsEntryElasticsearchSortModifierPlugin","_CmsEntryElasticsearchFullTextSearchPlugin","_CmsElasticsearchModelFieldPlugin","_CmsEntryElasticsearchValuesModifier"],"sources":["index.ts"],"sourcesContent":["export * from \"./CmsEntryElasticsearchBodyModifierPlugin\";\nexport * from \"./CmsEntryElasticsearchIndexPlugin\";\nexport * from \"./CmsEntryElasticsearchQueryBuilderValueSearchPlugin\";\nexport * from \"./CmsEntryElasticsearchQueryModifierPlugin\";\nexport * from \"./CmsEntryElasticsearchSortModifierPlugin\";\nexport * from \"./CmsEntryElasticsearchFullTextSearchPlugin\";\nexport * from \"./CmsElasticsearchModelFieldPlugin\";\nexport * from \"./CmsEntryElasticsearchValuesModifier\";\n"],"mappings":";;;;;AAAA,IAAAA,wCAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,wCAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,wCAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,wCAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,iCAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,iCAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,iCAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD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AAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,0CAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAS,0CAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAK,0CAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,iCAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,iCAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAU,iCAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAM,iCAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AACA,IAAAW,oCAAA,GAAAf,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAa,oCAAA,EAAAZ,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAW,oCAAA,CAAAX,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAO,oCAAA,CAAAX,GAAA;IAAA;EAAA;AAAA"}
package/types.d.ts CHANGED
@@ -133,7 +133,6 @@ export declare type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig
133
133
  export declare type Attributes = Record<string, AttributeDefinition>;
134
134
  export declare enum ENTITIES {
135
135
  SYSTEM = "CmsSystem",
136
- SETTINGS = "CmsSettings",
137
136
  GROUPS = "CmsGroups",
138
137
  MODELS = "CmsModels",
139
138
  ENTRIES = "CmsEntries",
@@ -153,7 +152,7 @@ export interface StorageOperationsFactoryParams {
153
152
  export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations<CmsContext> {
154
153
  getTable: () => Table;
155
154
  getEsTable: () => Table;
156
- getEntities: () => Record<"system" | "settings" | "groups" | "models" | "entries" | "entriesEs", Entity<any>>;
155
+ getEntities: () => Record<"system" | "groups" | "models" | "entries" | "entriesEs", Entity<any>>;
157
156
  }
158
157
  export interface StorageOperationsFactory {
159
158
  (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;
package/types.js CHANGED
@@ -32,11 +32,12 @@ exports.ENTITIES = void 0;
32
32
  */
33
33
  let ENTITIES = /*#__PURE__*/function (ENTITIES) {
34
34
  ENTITIES["SYSTEM"] = "CmsSystem";
35
- ENTITIES["SETTINGS"] = "CmsSettings";
36
35
  ENTITIES["GROUPS"] = "CmsGroups";
37
36
  ENTITIES["MODELS"] = "CmsModels";
38
37
  ENTITIES["ENTRIES"] = "CmsEntries";
39
38
  ENTITIES["ENTRIES_ES"] = "CmsEntriesElasticsearch";
40
39
  return ENTITIES;
41
40
  }({});
42
- exports.ENTITIES = ENTITIES;
41
+ exports.ENTITIES = ENTITIES;
42
+
43
+ //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ENTITIES","exports"],"sources":["types.ts"],"sourcesContent":["import { Plugin, PluginCollection } from \"@webiny/plugins/types\";\nimport {\n CmsContext as BaseCmsContext,\n CmsEntry,\n CmsEntryStorageOperations as BaseCmsEntryStorageOperations,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types\";\nimport { DynamoDBTypes, TableConstructor } from \"dynamodb-toolbox/dist/classes/Table\";\nimport { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport {\n EntityAttributeConfig,\n EntityCompositeAttributes\n} from \"dynamodb-toolbox/dist/classes/Entity\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport { Entity, Table } from \"dynamodb-toolbox\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\n/**\n * A definition of the entry that is being prepared for the Elasticsearch.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\nexport interface CmsIndexEntry extends CmsEntry {\n /**\n * Values that are not going to be indexed.\n */\n rawValues: Record<string, any>;\n /**\n * A first part of the ID, without the revision.\n * For example, we can search for all the revisions of the given entry.\n */\n primaryId: string;\n /**\n * Dev can add what ever keys they want and need. Just need to be careful not to break the entry.\n */\n [key: string]: any;\n}\n\n/**\n * Arguments for the method that is transforming content entry in its original form to the one we are storing to the Elasticsearch.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\ninterface CmsModelFieldToElasticsearchToParams {\n plugins: PluginsContainer;\n model: CmsModel;\n field: CmsModelField;\n /**\n * Raw value on the entry - before prepare for storage.\n */\n rawValue: any;\n /**\n * Value prepared for storage received from base api-headless-cms package.\n */\n value: any;\n getFieldIndexPlugin(fieldType: string): CmsModelFieldToElasticsearchPlugin;\n getFieldTypePlugin(fieldType: string): CmsModelFieldToGraphQLPlugin;\n}\n\n/**\n * Arguments for the method that is transforming content entry from Elasticsearch into the original one.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\ninterface CmsModelFieldToElasticsearchFromParams {\n plugins: PluginsContainer;\n model: CmsModel;\n field: CmsModelField;\n value: any;\n rawValue: any;\n getFieldIndexPlugin(fieldType: string): CmsModelFieldToElasticsearchPlugin;\n getFieldTypePlugin(fieldType: string): CmsModelFieldToGraphQLPlugin;\n}\n\ninterface ToIndexValue {\n /**\n * Use this key to store value for indexing.\n */\n value?: any;\n /**\n * Use this key to tell ES that this value should not be indexed.\n */\n rawValue?: any;\n}\n\n/**\n * A plugin defining transformation of entry for Elasticsearch.\n *\n * @category Plugin\n * @category ContentModelField\n * @category CmsEntry\n * @category Elasticsearch\n */\nexport interface CmsModelFieldToElasticsearchPlugin extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-field-to-elastic-search\";\n /**\n * A unique identifier of the field type (text, number, json, myField, ...).\n *\n * ```ts\n * fieldType: \"myField\"\n * ```\n */\n fieldType: string;\n /**\n * If you need to define a type when building an Elasticsearch query.\n * Check [dateTimeIndexing](https://github.com/webiny/webiny-js/blob/3074165701b8b45e5fc6ac2444caace7d04ada66/packages/api-headless-cms/src/content/plugins/es/indexing/dateTimeIndexing.ts) plugin for usage example.\n *\n * ```ts\n * unmappedType: \"date\"\n * ```\n */\n unmappedType?: (field: Pick<CmsModelField, \"fieldId\" | \"type\">) => string;\n /**\n * This is meant to do some transformation of the entry, preferably only to fieldType it was defined for. Nothing is stopping you to do anything you want to other fields, but try to separate field transformations.\n * It returns `Partial<CmsContentIndexEntryType>`. Always return a top-level property of the entry since it is merged via spread operator.\n *\n * ```ts\n * toIndex({ value }) {\n * return {\n * value: value, // This will be stored and indexed\n * rawValue: JSON.stringify(value) // This will be stored but excluded from indexing\n * };\n * }\n * ```\n */\n toIndex?: (params: CmsModelFieldToElasticsearchToParams) => ToIndexValue;\n /**\n * This is meant to revert a transformation done in the `toIndex` method.\n * You have access to \"value\" or a \"rawValue\", depending on what you returned from `toIndex`.\n *\n * ```ts\n * fromIndex({ value, rawValue }) {\n * return JSON.parse(rawValue);\n * }\n * ```\n */\n fromIndex?: (params: CmsModelFieldToElasticsearchFromParams) => any;\n}\n\nexport type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;\n\nexport type Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n SYSTEM = \"CmsSystem\",\n SETTINGS = \"CmsSettings\",\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\",\n ENTRIES_ES = \"CmsEntriesElasticsearch\"\n}\n\nexport interface TableModifier {\n (table: TableConstructor): TableConstructor;\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DocumentClient;\n elasticsearch: Client;\n table?: TableModifier;\n esTable?: TableModifier;\n attributes?: Record<ENTITIES, Attributes>;\n plugins?: PluginCollection;\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations<CmsContext> {\n getTable: () => Table;\n getEsTable: () => Table;\n getEntities: () => Record<\n \"system\" | \"settings\" | \"groups\" | \"models\" | \"entries\" | \"entriesEs\",\n Entity<any>\n >;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n\nexport interface CmsContext extends BaseCmsContext {\n [key: string]: any;\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":";;;;;;AAoBA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACA;AACA;AACA;AACA;AACA;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IA6DYA,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAAAC,OAAA,CAAAD,QAAA,GAAAA,QAAA"}
1
+ {"version":3,"names":["ENTITIES","exports"],"sources":["types.ts"],"sourcesContent":["import { Plugin, PluginCollection } from \"@webiny/plugins/types\";\nimport {\n CmsContext as BaseCmsContext,\n CmsEntry,\n CmsEntryStorageOperations as BaseCmsEntryStorageOperations,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types\";\nimport { DynamoDBTypes, TableConstructor } from \"dynamodb-toolbox/dist/classes/Table\";\nimport { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport {\n EntityAttributeConfig,\n EntityCompositeAttributes\n} from \"dynamodb-toolbox/dist/classes/Entity\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport { Entity, Table } from \"dynamodb-toolbox\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\n/**\n * A definition of the entry that is being prepared for the Elasticsearch.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\nexport interface CmsIndexEntry extends CmsEntry {\n /**\n * Values that are not going to be indexed.\n */\n rawValues: Record<string, any>;\n /**\n * A first part of the ID, without the revision.\n * For example, we can search for all the revisions of the given entry.\n */\n primaryId: string;\n /**\n * Dev can add what ever keys they want and need. Just need to be careful not to break the entry.\n */\n [key: string]: any;\n}\n\n/**\n * Arguments for the method that is transforming content entry in its original form to the one we are storing to the Elasticsearch.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\ninterface CmsModelFieldToElasticsearchToParams {\n plugins: PluginsContainer;\n model: CmsModel;\n field: CmsModelField;\n /**\n * Raw value on the entry - before prepare for storage.\n */\n rawValue: any;\n /**\n * Value prepared for storage received from base api-headless-cms package.\n */\n value: any;\n getFieldIndexPlugin(fieldType: string): CmsModelFieldToElasticsearchPlugin;\n getFieldTypePlugin(fieldType: string): CmsModelFieldToGraphQLPlugin;\n}\n\n/**\n * Arguments for the method that is transforming content entry from Elasticsearch into the original one.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\ninterface CmsModelFieldToElasticsearchFromParams {\n plugins: PluginsContainer;\n model: CmsModel;\n field: CmsModelField;\n value: any;\n rawValue: any;\n getFieldIndexPlugin(fieldType: string): CmsModelFieldToElasticsearchPlugin;\n getFieldTypePlugin(fieldType: string): CmsModelFieldToGraphQLPlugin;\n}\n\ninterface ToIndexValue {\n /**\n * Use this key to store value for indexing.\n */\n value?: any;\n /**\n * Use this key to tell ES that this value should not be indexed.\n */\n rawValue?: any;\n}\n\n/**\n * A plugin defining transformation of entry for Elasticsearch.\n *\n * @category Plugin\n * @category ContentModelField\n * @category CmsEntry\n * @category Elasticsearch\n */\nexport interface CmsModelFieldToElasticsearchPlugin extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-field-to-elastic-search\";\n /**\n * A unique identifier of the field type (text, number, json, myField, ...).\n *\n * ```ts\n * fieldType: \"myField\"\n * ```\n */\n fieldType: string;\n /**\n * If you need to define a type when building an Elasticsearch query.\n * Check [dateTimeIndexing](https://github.com/webiny/webiny-js/blob/3074165701b8b45e5fc6ac2444caace7d04ada66/packages/api-headless-cms/src/content/plugins/es/indexing/dateTimeIndexing.ts) plugin for usage example.\n *\n * ```ts\n * unmappedType: \"date\"\n * ```\n */\n unmappedType?: (field: Pick<CmsModelField, \"fieldId\" | \"type\">) => string;\n /**\n * This is meant to do some transformation of the entry, preferably only to fieldType it was defined for. Nothing is stopping you to do anything you want to other fields, but try to separate field transformations.\n * It returns `Partial<CmsContentIndexEntryType>`. Always return a top-level property of the entry since it is merged via spread operator.\n *\n * ```ts\n * toIndex({ value }) {\n * return {\n * value: value, // This will be stored and indexed\n * rawValue: JSON.stringify(value) // This will be stored but excluded from indexing\n * };\n * }\n * ```\n */\n toIndex?: (params: CmsModelFieldToElasticsearchToParams) => ToIndexValue;\n /**\n * This is meant to revert a transformation done in the `toIndex` method.\n * You have access to \"value\" or a \"rawValue\", depending on what you returned from `toIndex`.\n *\n * ```ts\n * fromIndex({ value, rawValue }) {\n * return JSON.parse(rawValue);\n * }\n * ```\n */\n fromIndex?: (params: CmsModelFieldToElasticsearchFromParams) => any;\n}\n\nexport type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;\n\nexport type Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n SYSTEM = \"CmsSystem\",\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\",\n ENTRIES_ES = \"CmsEntriesElasticsearch\"\n}\n\nexport interface TableModifier {\n (table: TableConstructor): TableConstructor;\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DocumentClient;\n elasticsearch: Client;\n table?: TableModifier;\n esTable?: TableModifier;\n attributes?: Record<ENTITIES, Attributes>;\n plugins?: PluginCollection;\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations<CmsContext> {\n getTable: () => Table;\n getEsTable: () => Table;\n getEntities: () => Record<\n \"system\" | \"groups\" | \"models\" | \"entries\" | \"entriesEs\",\n Entity<any>\n >;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n\nexport interface CmsContext extends BaseCmsContext {\n [key: string]: any;\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":";;;;;;AAoBA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACA;AACA;AACA;AACA;AACA;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IA6DYA,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAAAC,OAAA,CAAAD,QAAA,GAAAA,QAAA"}
@@ -1,8 +0,0 @@
1
- import { Entity, Table } from "dynamodb-toolbox";
2
- import { Attributes } from "../types";
3
- export interface CreateSettingsEntityParams {
4
- table: Table;
5
- entityName: string;
6
- attributes: Attributes;
7
- }
8
- export declare const createSettingsEntity: (params: CreateSettingsEntityParams) => Entity<any>;
@@ -1,53 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createSettingsEntity = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _dynamodbToolbox = require("dynamodb-toolbox");
10
- const createSettingsEntity = params => {
11
- const {
12
- entityName,
13
- table,
14
- attributes
15
- } = params;
16
- return new _dynamodbToolbox.Entity({
17
- name: entityName,
18
- table,
19
- attributes: (0, _objectSpread2.default)({
20
- PK: {
21
- partitionKey: true
22
- },
23
- SK: {
24
- sortKey: true
25
- },
26
- TYPE: {
27
- type: "string"
28
- },
29
- key: {
30
- type: "string"
31
- },
32
- uploadMinFileSize: {
33
- type: "number"
34
- },
35
- uploadMaxFileSize: {
36
- type: "number"
37
- },
38
- srcPrefix: {
39
- type: "string"
40
- },
41
- contentModelLastChange: {
42
- type: "string"
43
- },
44
- tenant: {
45
- type: "string"
46
- },
47
- locale: {
48
- type: "string"
49
- }
50
- }, attributes || {})
51
- });
52
- };
53
- exports.createSettingsEntity = createSettingsEntity;
@@ -1 +0,0 @@
1
- {"version":3,"names":["_dynamodbToolbox","require","createSettingsEntity","params","entityName","table","attributes","Entity","name","_objectSpread2","default","PK","partitionKey","SK","sortKey","TYPE","type","key","uploadMinFileSize","uploadMaxFileSize","srcPrefix","contentModelLastChange","tenant","locale","exports"],"sources":["settings.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\nexport interface CreateSettingsEntityParams {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSettingsEntity = (params: CreateSettingsEntityParams): Entity<any> => {\n const { entityName, table, attributes } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n key: {\n type: \"string\"\n },\n uploadMinFileSize: {\n type: \"number\"\n },\n uploadMaxFileSize: {\n type: \"number\"\n },\n srcPrefix: {\n type: \"string\"\n },\n contentModelLastChange: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AASO,MAAMC,oBAAoB,GAAIC,MAAkC,IAAkB;EACrF,MAAM;IAAEC,UAAU;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,uBAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBC,KAAK;IACLC,UAAU,MAAAG,cAAA,CAAAC,OAAA;MACNC,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,GAAG,EAAE;QACDD,IAAI,EAAE;MACV,CAAC;MACDE,iBAAiB,EAAE;QACfF,IAAI,EAAE;MACV,CAAC;MACDG,iBAAiB,EAAE;QACfH,IAAI,EAAE;MACV,CAAC;MACDI,SAAS,EAAE;QACPJ,IAAI,EAAE;MACV,CAAC;MACDK,sBAAsB,EAAE;QACpBL,IAAI,EAAE;MACV,CAAC;MACDM,MAAM,EAAE;QACJN,IAAI,EAAE;MACV,CAAC;MACDO,MAAM,EAAE;QACJP,IAAI,EAAE;MACV;IAAC,GACGV,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAACkB,OAAA,CAAAtB,oBAAA,GAAAA,oBAAA"}
@@ -1,6 +0,0 @@
1
- import { CmsSettingsStorageOperations } from "@webiny/api-headless-cms/types";
2
- import { Entity } from "dynamodb-toolbox";
3
- export interface CreateSettingsStorageOperationsParams {
4
- entity: Entity<any>;
5
- }
6
- export declare const createSettingsStorageOperations: (params: CreateSettingsStorageOperationsParams) => CmsSettingsStorageOperations;
@@ -1,111 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createSettingsStorageOperations = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _get = require("@webiny/db-dynamodb/utils/get");
10
- var _error = _interopRequireDefault(require("@webiny/error"));
11
- var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
12
- const convertToDbData = settings => {
13
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, settings), {}, {
14
- contentModelLastChange: settings.contentModelLastChange.toISOString()
15
- });
16
- };
17
- const convertFromDbData = settings => {
18
- if (!settings) {
19
- return null;
20
- }
21
- let contentModelLastChange;
22
- try {
23
- contentModelLastChange = new Date(settings.contentModelLastChange);
24
- } catch {
25
- contentModelLastChange = new Date();
26
- }
27
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, settings), {}, {
28
- contentModelLastChange
29
- });
30
- };
31
- const createPartitionKey = ({
32
- tenant,
33
- locale
34
- }) => {
35
- return `T#${tenant}#L#${locale}#CMS#SETTINGS`;
36
- };
37
- const createSortKey = () => {
38
- return "settings";
39
- };
40
- const createKeys = params => {
41
- return {
42
- PK: createPartitionKey(params),
43
- SK: createSortKey()
44
- };
45
- };
46
- const createSettingsStorageOperations = params => {
47
- const {
48
- entity
49
- } = params;
50
- const create = async params => {
51
- const {
52
- settings
53
- } = params;
54
- const keys = createKeys(settings);
55
- const dbSettings = convertToDbData(settings);
56
- try {
57
- await entity.put((0, _objectSpread2.default)((0, _objectSpread2.default)({}, dbSettings), keys));
58
- return settings;
59
- } catch (ex) {
60
- throw new _error.default(ex.message || "Could not create settings.", ex.code || "CREATE_SETTINGS_ERROR", {
61
- error: ex,
62
- settings,
63
- dbSettings,
64
- keys
65
- });
66
- }
67
- };
68
- const update = async params => {
69
- const {
70
- settings
71
- } = params;
72
- const keys = createKeys(settings);
73
- const dbSettings = convertToDbData(settings);
74
- try {
75
- await entity.put((0, _objectSpread2.default)((0, _objectSpread2.default)({}, dbSettings), keys));
76
- return settings;
77
- } catch (ex) {
78
- throw new _error.default(ex.message || "Could not update settings.", ex.code || "UPDATE_SETTINGS_ERROR", {
79
- error: ex,
80
- settings,
81
- dbSettings,
82
- keys
83
- });
84
- }
85
- };
86
- const get = async params => {
87
- const keys = createKeys(params);
88
- try {
89
- const record = await (0, _get.get)({
90
- entity,
91
- keys
92
- });
93
- if (!record) {
94
- return null;
95
- }
96
- const settings = (0, _cleanup.cleanupItem)(entity, record);
97
- return convertFromDbData(settings);
98
- } catch (ex) {
99
- throw new _error.default(ex.message || "Could not get settings.", ex.code || "GET_SETTINGS_ERROR", {
100
- error: ex,
101
- keys
102
- });
103
- }
104
- };
105
- return {
106
- create,
107
- get,
108
- update
109
- };
110
- };
111
- exports.createSettingsStorageOperations = createSettingsStorageOperations;
@@ -1 +0,0 @@
1
- {"version":3,"names":["_get","require","_error","_interopRequireDefault","_cleanup","convertToDbData","settings","_objectSpread2","default","contentModelLastChange","toISOString","convertFromDbData","Date","createPartitionKey","tenant","locale","createSortKey","createKeys","params","PK","SK","createSettingsStorageOperations","entity","create","keys","dbSettings","put","ex","WebinyError","message","code","error","update","get","record","getRecord","cleanupItem","exports"],"sources":["index.ts"],"sourcesContent":["import {\n CmsSettings,\n CmsSettingsStorageOperations,\n CmsSettingsStorageOperationsCreateParams,\n CmsSettingsStorageOperationsGetParams,\n CmsSettingsStorageOperationsUpdateParams\n} from \"@webiny/api-headless-cms/types\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport { get as getRecord } from \"@webiny/db-dynamodb/utils/get\";\nimport WebinyError from \"@webiny/error\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\n\ninterface CmsSettingsDb extends Omit<CmsSettings, \"contentModelLastChange\"> {\n contentModelLastChange: string;\n}\n\nconst convertToDbData = (settings: CmsSettings): CmsSettingsDb => {\n return {\n ...settings,\n contentModelLastChange: settings.contentModelLastChange.toISOString()\n };\n};\n\nconst convertFromDbData = (settings?: CmsSettingsDb): CmsSettings | null => {\n if (!settings) {\n return null;\n }\n let contentModelLastChange;\n try {\n contentModelLastChange = new Date(settings.contentModelLastChange);\n } catch {\n contentModelLastChange = new Date();\n }\n return {\n ...settings,\n contentModelLastChange\n };\n};\n\ninterface PartitionKeyParams {\n tenant: string;\n locale: string;\n}\n\nconst createPartitionKey = ({ tenant, locale }: PartitionKeyParams): string => {\n return `T#${tenant}#L#${locale}#CMS#SETTINGS`;\n};\n\nconst createSortKey = (): string => {\n return \"settings\";\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n}\nconst createKeys = (params: PartitionKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKey()\n };\n};\n\nexport interface CreateSettingsStorageOperationsParams {\n entity: Entity<any>;\n}\n\nexport const createSettingsStorageOperations = (\n params: CreateSettingsStorageOperationsParams\n): CmsSettingsStorageOperations => {\n const { entity } = params;\n\n const create = async (params: CmsSettingsStorageOperationsCreateParams) => {\n const { settings } = params;\n const keys = createKeys(settings);\n\n const dbSettings: CmsSettingsDb = convertToDbData(settings);\n\n try {\n await entity.put({\n ...dbSettings,\n ...keys\n });\n return settings;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create settings.\",\n ex.code || \"CREATE_SETTINGS_ERROR\",\n {\n error: ex,\n settings,\n dbSettings,\n keys\n }\n );\n }\n };\n\n const update = async (params: CmsSettingsStorageOperationsUpdateParams) => {\n const { settings } = params;\n\n const keys = createKeys(settings);\n\n const dbSettings: CmsSettingsDb = convertToDbData(settings);\n\n try {\n await entity.put({\n ...dbSettings,\n ...keys\n });\n return settings;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update settings.\",\n ex.code || \"UPDATE_SETTINGS_ERROR\",\n {\n error: ex,\n settings,\n dbSettings,\n keys\n }\n );\n }\n };\n\n const get = async (params: CmsSettingsStorageOperationsGetParams) => {\n const keys = createKeys(params);\n try {\n const record = await getRecord<CmsSettingsDb>({\n entity,\n keys\n });\n if (!record) {\n return null;\n }\n const settings = cleanupItem(entity, record) as CmsSettingsDb;\n return convertFromDbData(settings);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get settings.\",\n ex.code || \"GET_SETTINGS_ERROR\",\n {\n error: ex,\n keys\n }\n );\n }\n };\n\n return {\n create,\n get,\n update\n };\n};\n"],"mappings":";;;;;;;;AAQA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAMA,MAAMI,eAAe,GAAIC,QAAqB,IAAoB;EAC9D,WAAAC,cAAA,CAAAC,OAAA,MAAAD,cAAA,CAAAC,OAAA,MACOF,QAAQ;IACXG,sBAAsB,EAAEH,QAAQ,CAACG,sBAAsB,CAACC,WAAW,CAAC;EAAC;AAE7E,CAAC;AAED,MAAMC,iBAAiB,GAAIL,QAAwB,IAAyB;EACxE,IAAI,CAACA,QAAQ,EAAE;IACX,OAAO,IAAI;EACf;EACA,IAAIG,sBAAsB;EAC1B,IAAI;IACAA,sBAAsB,GAAG,IAAIG,IAAI,CAACN,QAAQ,CAACG,sBAAsB,CAAC;EACtE,CAAC,CAAC,MAAM;IACJA,sBAAsB,GAAG,IAAIG,IAAI,CAAC,CAAC;EACvC;EACA,WAAAL,cAAA,CAAAC,OAAA,MAAAD,cAAA,CAAAC,OAAA,MACOF,QAAQ;IACXG;EAAsB;AAE9B,CAAC;AAOD,MAAMI,kBAAkB,GAAGA,CAAC;EAAEC,MAAM;EAAEC;AAA2B,CAAC,KAAa;EAC3E,OAAQ,KAAID,MAAO,MAAKC,MAAO,eAAc;AACjD,CAAC;AAED,MAAMC,aAAa,GAAGA,CAAA,KAAc;EAChC,OAAO,UAAU;AACrB,CAAC;A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