@webiny/api-file-manager-ddb 5.34.8 → 5.35.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/definitions/settingsEntity.d.ts +0 -2
  2. package/definitions/settingsEntity.js +9 -23
  3. package/definitions/settingsEntity.js.map +1 -1
  4. package/definitions/systemEntity.d.ts +0 -2
  5. package/definitions/systemEntity.js +2 -13
  6. package/definitions/systemEntity.js.map +1 -1
  7. package/definitions/table.d.ts +5 -5
  8. package/definitions/table.js +14 -13
  9. package/definitions/table.js.map +1 -1
  10. package/index.d.ts +9 -5
  11. package/index.js +52 -11
  12. package/index.js.map +1 -1
  13. package/operations/files/FilesStorageOperations.d.ts +12 -8
  14. package/operations/files/FilesStorageOperations.js +165 -123
  15. package/operations/files/FilesStorageOperations.js.map +1 -1
  16. package/operations/files/fields.d.ts +1 -2
  17. package/operations/files/fields.js +3 -6
  18. package/operations/files/fields.js.map +1 -1
  19. package/operations/settings/SettingsStorageOperations.d.ts +7 -8
  20. package/operations/settings/SettingsStorageOperations.js +36 -61
  21. package/operations/settings/SettingsStorageOperations.js.map +1 -1
  22. package/operations/system/SystemStorageOperations.d.ts +5 -6
  23. package/operations/system/SystemStorageOperations.js +11 -42
  24. package/operations/system/SystemStorageOperations.js.map +1 -1
  25. package/operations/utils.js +0 -10
  26. package/operations/utils.js.map +1 -1
  27. package/package.json +10 -9
  28. package/plugins/FileAttributePlugin.js +1 -7
  29. package/plugins/FileAttributePlugin.js.map +1 -1
  30. package/plugins/FileDynamoDbFieldPlugin.js +0 -5
  31. package/plugins/FileDynamoDbFieldPlugin.js.map +1 -1
  32. package/plugins/SettingsAttributePlugin.js +1 -7
  33. package/plugins/SettingsAttributePlugin.js.map +1 -1
  34. package/plugins/SystemAttributePlugin.js +0 -6
  35. package/plugins/SystemAttributePlugin.js.map +1 -1
  36. package/plugins/index.d.ts +4 -0
  37. package/plugins/index.js +49 -0
  38. package/plugins/index.js.map +1 -0
@@ -1,15 +1,14 @@
1
- import { FileManagerContext, FileManagerSettings, FileManagerSettingsStorageOperations, FileManagerSettingsStorageOperationsCreateParams, FileManagerSettingsStorageOperationsUpdateParams } from "@webiny/api-file-manager/types";
2
- interface SettingsStorageOperationsConstructorParams {
3
- context: FileManagerContext;
1
+ import { FileManagerSettings, FileManagerSettingsStorageOperations, FileManagerSettingsStorageOperationsCreateParams, FileManagerSettingsStorageOperationsUpdateParams, FileManagerStorageOperationsDeleteSettings, FileManagerStorageOperationsGetSettingsParams } from "@webiny/api-file-manager/types";
2
+ import { DocumentClient } from "aws-sdk/clients/dynamodb";
3
+ interface SettingsStorageOperationsConfig {
4
+ documentClient: DocumentClient;
4
5
  }
5
6
  export declare class SettingsStorageOperations implements FileManagerSettingsStorageOperations {
6
- private readonly _context;
7
7
  private readonly _entity;
8
- private get partitionKey();
9
- constructor({ context }: SettingsStorageOperationsConstructorParams);
10
- get(): Promise<FileManagerSettings | null>;
8
+ constructor({ documentClient }: SettingsStorageOperationsConfig);
9
+ get({ tenant }: FileManagerStorageOperationsGetSettingsParams): Promise<FileManagerSettings | null>;
11
10
  create({ data }: FileManagerSettingsStorageOperationsCreateParams): Promise<FileManagerSettings>;
12
11
  update({ data }: FileManagerSettingsStorageOperationsUpdateParams): Promise<FileManagerSettings>;
13
- delete(): Promise<void>;
12
+ delete({ tenant }: FileManagerStorageOperationsDeleteSettings): Promise<void>;
14
13
  }
15
14
  export {};
@@ -1,87 +1,62 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.SettingsStorageOperations = void 0;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
-
14
9
  var _error = _interopRequireDefault(require("@webiny/error"));
15
-
16
- var _table = _interopRequireDefault(require("../../definitions/table"));
17
-
18
10
  var _settingsEntity = _interopRequireDefault(require("../../definitions/settingsEntity"));
19
-
20
- const SORT_KEY = "default";
21
-
11
+ var _get = require("@webiny/db-dynamodb/utils/get");
12
+ var _table = require("../../definitions/table");
13
+ const SORT_KEY = "A";
22
14
  class SettingsStorageOperations {
23
- get partitionKey() {
24
- const tenant = this._context.tenancy.getCurrentTenant();
25
-
26
- if (!tenant) {
27
- throw new _error.default("Tenant missing.", "TENANT_NOT_FOUND");
28
- }
29
-
30
- return `T#${tenant.id}#FM#SETTINGS`;
31
- }
32
-
33
15
  constructor({
34
- context
16
+ documentClient
35
17
  }) {
36
- (0, _defineProperty2.default)(this, "_context", void 0);
37
18
  (0, _defineProperty2.default)(this, "_entity", void 0);
38
- this._context = context;
39
- const table = (0, _table.default)({
40
- context
41
- });
42
19
  this._entity = (0, _settingsEntity.default)({
43
- context,
44
- table
20
+ table: (0, _table.createTable)({
21
+ documentClient
22
+ })
45
23
  });
46
24
  }
47
-
48
- async get() {
25
+ async get({
26
+ tenant
27
+ }) {
49
28
  try {
50
- const settings = await this._entity.get({
51
- PK: this.partitionKey,
52
- SK: SORT_KEY
29
+ const settings = await (0, _get.get)({
30
+ entity: this._entity,
31
+ keys: {
32
+ PK: `T#${tenant}#FM#SETTINGS`,
33
+ SK: "A"
34
+ }
53
35
  });
54
-
55
- if (!settings || !settings.Item) {
56
- return null;
57
- }
58
-
59
- return settings.Item;
36
+ return settings ? settings.data : null;
60
37
  } catch (ex) {
61
38
  throw new _error.default(ex.message || "Could not fetch the FileManager settings.", ex.code || "GET_SETTINGS_ERROR");
62
39
  }
63
40
  }
64
-
65
41
  async create({
66
42
  data
67
43
  }) {
68
- const original = await this.get();
69
- /**
70
- * TODO: check if need to throw an error on existing settings
71
- */
72
-
44
+ const original = await this.get({
45
+ tenant: data.tenant
46
+ });
73
47
  if (original) {
74
48
  return await this.update({
75
49
  original,
76
50
  data
77
51
  });
78
52
  }
79
-
80
53
  try {
81
- await this._entity.put((0, _objectSpread2.default)({
82
- PK: this.partitionKey,
83
- SK: SORT_KEY
84
- }, data));
54
+ await this._entity.put({
55
+ PK: `T#${data.tenant}#FM#SETTINGS`,
56
+ SK: SORT_KEY,
57
+ TYPE: "fm.settings",
58
+ data
59
+ });
85
60
  return data;
86
61
  } catch (ex) {
87
62
  throw new _error.default(ex.message || "Cannot create FileManager settings.", ex.code || "CREATE_FM_SETTINGS_ERROR", {
@@ -89,15 +64,16 @@ class SettingsStorageOperations {
89
64
  });
90
65
  }
91
66
  }
92
-
93
67
  async update({
94
68
  data
95
69
  }) {
96
70
  try {
97
- await this._entity.update((0, _objectSpread2.default)({
98
- PK: this.partitionKey,
99
- SK: SORT_KEY
100
- }, data));
71
+ await this._entity.update({
72
+ PK: `T#${data.tenant}#FM#SETTINGS`,
73
+ SK: SORT_KEY,
74
+ TYPE: "fm.settings",
75
+ data
76
+ });
101
77
  return data;
102
78
  } catch (ex) {
103
79
  throw new _error.default(ex.message || "Cannot update FileManager settings.", ex.code || "UPDATE_FM_SETTINGS_ERROR", {
@@ -105,14 +81,13 @@ class SettingsStorageOperations {
105
81
  });
106
82
  }
107
83
  }
108
-
109
- async delete() {
84
+ async delete({
85
+ tenant
86
+ }) {
110
87
  return this._entity.delete({
111
- PK: this.partitionKey,
88
+ PK: `T#${tenant}#FM#SETTINGS`,
112
89
  SK: SORT_KEY
113
90
  });
114
91
  }
115
-
116
92
  }
117
-
118
93
  exports.SettingsStorageOperations = SettingsStorageOperations;
@@ -1 +1 @@
1
- {"version":3,"names":["SORT_KEY","SettingsStorageOperations","partitionKey","tenant","_context","tenancy","getCurrentTenant","WebinyError","id","constructor","context","table","defineTable","_entity","defineSettingsEntity","get","settings","PK","SK","Item","ex","message","code","create","data","original","update","put","delete"],"sources":["SettingsStorageOperations.ts"],"sourcesContent":["import {\n FileManagerContext,\n FileManagerSettings,\n FileManagerSettingsStorageOperations,\n FileManagerSettingsStorageOperationsCreateParams,\n FileManagerSettingsStorageOperationsUpdateParams\n} from \"@webiny/api-file-manager/types\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport WebinyError from \"@webiny/error\";\nimport defineTable from \"~/definitions/table\";\nimport defineSettingsEntity from \"~/definitions/settingsEntity\";\n\ninterface SettingsStorageOperationsConstructorParams {\n context: FileManagerContext;\n}\n\nconst SORT_KEY = \"default\";\n\nexport class SettingsStorageOperations implements FileManagerSettingsStorageOperations {\n private readonly _context: FileManagerContext;\n private readonly _entity: Entity<any>;\n\n private get partitionKey(): string {\n const tenant = this._context.tenancy.getCurrentTenant();\n if (!tenant) {\n throw new WebinyError(\"Tenant missing.\", \"TENANT_NOT_FOUND\");\n }\n return `T#${tenant.id}#FM#SETTINGS`;\n }\n\n public constructor({ context }: SettingsStorageOperationsConstructorParams) {\n this._context = context;\n const table = defineTable({\n context\n });\n\n this._entity = defineSettingsEntity({\n context,\n table\n });\n }\n\n public async get(): Promise<FileManagerSettings | null> {\n try {\n const settings = await this._entity.get({\n PK: this.partitionKey,\n SK: SORT_KEY\n });\n if (!settings || !settings.Item) {\n return null;\n }\n return settings.Item;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not fetch the FileManager settings.\",\n ex.code || \"GET_SETTINGS_ERROR\"\n );\n }\n }\n\n public async create({\n data\n }: FileManagerSettingsStorageOperationsCreateParams): Promise<FileManagerSettings> {\n const original = await this.get();\n /**\n * TODO: check if need to throw an error on existing settings\n */\n if (original) {\n return await this.update({ original, data });\n }\n\n try {\n await this._entity.put({\n PK: this.partitionKey,\n SK: SORT_KEY,\n ...data\n });\n return data;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Cannot create FileManager settings.\",\n ex.code || \"CREATE_FM_SETTINGS_ERROR\",\n {\n data\n }\n );\n }\n }\n\n public async update({\n data\n }: FileManagerSettingsStorageOperationsUpdateParams): Promise<FileManagerSettings> {\n try {\n await this._entity.update({\n PK: this.partitionKey,\n SK: SORT_KEY,\n ...data\n });\n return data;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Cannot update FileManager settings.\",\n ex.code || \"UPDATE_FM_SETTINGS_ERROR\",\n {\n data\n }\n );\n }\n }\n\n public async delete(): Promise<void> {\n return this._entity.delete({\n PK: this.partitionKey,\n SK: SORT_KEY\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAQA;;AACA;;AACA;;AAMA,MAAMA,QAAQ,GAAG,SAAjB;;AAEO,MAAMC,yBAAN,CAAgF;EAI3D,IAAZC,YAAY,GAAW;IAC/B,MAAMC,MAAM,GAAG,KAAKC,QAAL,CAAcC,OAAd,CAAsBC,gBAAtB,EAAf;;IACA,IAAI,CAACH,MAAL,EAAa;MACT,MAAM,IAAII,cAAJ,CAAgB,iBAAhB,EAAmC,kBAAnC,CAAN;IACH;;IACD,OAAQ,KAAIJ,MAAM,CAACK,EAAG,cAAtB;EACH;;EAEMC,WAAW,CAAC;IAAEC;EAAF,CAAD,EAA0D;IAAA;IAAA;IACxE,KAAKN,QAAL,GAAgBM,OAAhB;IACA,MAAMC,KAAK,GAAG,IAAAC,cAAA,EAAY;MACtBF;IADsB,CAAZ,CAAd;IAIA,KAAKG,OAAL,GAAe,IAAAC,uBAAA,EAAqB;MAChCJ,OADgC;MAEhCC;IAFgC,CAArB,CAAf;EAIH;;EAEe,MAAHI,GAAG,GAAwC;IACpD,IAAI;MACA,MAAMC,QAAQ,GAAG,MAAM,KAAKH,OAAL,CAAaE,GAAb,CAAiB;QACpCE,EAAE,EAAE,KAAKf,YAD2B;QAEpCgB,EAAE,EAAElB;MAFgC,CAAjB,CAAvB;;MAIA,IAAI,CAACgB,QAAD,IAAa,CAACA,QAAQ,CAACG,IAA3B,EAAiC;QAC7B,OAAO,IAAP;MACH;;MACD,OAAOH,QAAQ,CAACG,IAAhB;IACH,CATD,CASE,OAAOC,EAAP,EAAW;MACT,MAAM,IAAIb,cAAJ,CACFa,EAAE,CAACC,OAAH,IAAc,2CADZ,EAEFD,EAAE,CAACE,IAAH,IAAW,oBAFT,CAAN;IAIH;EACJ;;EAEkB,MAANC,MAAM,CAAC;IAChBC;EADgB,CAAD,EAEgE;IAC/E,MAAMC,QAAQ,GAAG,MAAM,KAAKV,GAAL,EAAvB;IACA;AACR;AACA;;IACQ,IAAIU,QAAJ,EAAc;MACV,OAAO,MAAM,KAAKC,MAAL,CAAY;QAAED,QAAF;QAAYD;MAAZ,CAAZ,CAAb;IACH;;IAED,IAAI;MACA,MAAM,KAAKX,OAAL,CAAac,GAAb;QACFV,EAAE,EAAE,KAAKf,YADP;QAEFgB,EAAE,EAAElB;MAFF,GAGCwB,IAHD,EAAN;MAKA,OAAOA,IAAP;IACH,CAPD,CAOE,OAAOJ,EAAP,EAAW;MACT,MAAM,IAAIb,cAAJ,CACFa,EAAE,CAACC,OAAH,IAAc,qCADZ,EAEFD,EAAE,CAACE,IAAH,IAAW,0BAFT,EAGF;QACIE;MADJ,CAHE,CAAN;IAOH;EACJ;;EAEkB,MAANE,MAAM,CAAC;IAChBF;EADgB,CAAD,EAEgE;IAC/E,IAAI;MACA,MAAM,KAAKX,OAAL,CAAaa,MAAb;QACFT,EAAE,EAAE,KAAKf,YADP;QAEFgB,EAAE,EAAElB;MAFF,GAGCwB,IAHD,EAAN;MAKA,OAAOA,IAAP;IACH,CAPD,CAOE,OAAOJ,EAAP,EAAW;MACT,MAAM,IAAIb,cAAJ,CACFa,EAAE,CAACC,OAAH,IAAc,qCADZ,EAEFD,EAAE,CAACE,IAAH,IAAW,0BAFT,EAGF;QACIE;MADJ,CAHE,CAAN;IAOH;EACJ;;EAEkB,MAANI,MAAM,GAAkB;IACjC,OAAO,KAAKf,OAAL,CAAae,MAAb,CAAoB;MACvBX,EAAE,EAAE,KAAKf,YADc;MAEvBgB,EAAE,EAAElB;IAFmB,CAApB,CAAP;EAIH;;AAjGkF"}
1
+ {"version":3,"names":["SORT_KEY","SettingsStorageOperations","constructor","documentClient","_entity","defineSettingsEntity","table","createTable","get","tenant","settings","entity","keys","PK","SK","data","ex","WebinyError","message","code","create","original","update","put","TYPE","delete"],"sources":["SettingsStorageOperations.ts"],"sourcesContent":["import {\n FileManagerSettings,\n FileManagerSettingsStorageOperations,\n FileManagerSettingsStorageOperationsCreateParams,\n FileManagerSettingsStorageOperationsUpdateParams,\n FileManagerStorageOperationsDeleteSettings,\n FileManagerStorageOperationsGetSettingsParams\n} from \"@webiny/api-file-manager/types\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport WebinyError from \"@webiny/error\";\nimport defineSettingsEntity from \"~/definitions/settingsEntity\";\nimport { get } from \"@webiny/db-dynamodb/utils/get\";\nimport { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport { createTable } from \"~/definitions/table\";\n\ninterface SettingsStorageOperationsConfig {\n documentClient: DocumentClient;\n}\n\nconst SORT_KEY = \"A\";\n\nexport class SettingsStorageOperations implements FileManagerSettingsStorageOperations {\n private readonly _entity: Entity<any>;\n\n public constructor({ documentClient }: SettingsStorageOperationsConfig) {\n this._entity = defineSettingsEntity({ table: createTable({ documentClient }) });\n }\n\n public async get({\n tenant\n }: FileManagerStorageOperationsGetSettingsParams): Promise<FileManagerSettings | null> {\n try {\n const settings = await get<{ data: FileManagerSettings }>({\n entity: this._entity,\n keys: {\n PK: `T#${tenant}#FM#SETTINGS`,\n SK: \"A\"\n }\n });\n\n return settings ? settings.data : null;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not fetch the FileManager settings.\",\n ex.code || \"GET_SETTINGS_ERROR\"\n );\n }\n }\n\n public async create({\n data\n }: FileManagerSettingsStorageOperationsCreateParams): Promise<FileManagerSettings> {\n const original = await this.get({ tenant: data.tenant });\n\n if (original) {\n return await this.update({ original, data });\n }\n\n try {\n await this._entity.put({\n PK: `T#${data.tenant}#FM#SETTINGS`,\n SK: SORT_KEY,\n TYPE: \"fm.settings\",\n data\n });\n return data;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Cannot create FileManager settings.\",\n ex.code || \"CREATE_FM_SETTINGS_ERROR\",\n {\n data\n }\n );\n }\n }\n\n public async update({\n data\n }: FileManagerSettingsStorageOperationsUpdateParams): Promise<FileManagerSettings> {\n try {\n await this._entity.update({\n PK: `T#${data.tenant}#FM#SETTINGS`,\n SK: SORT_KEY,\n TYPE: \"fm.settings\",\n data\n });\n return data;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Cannot update FileManager settings.\",\n ex.code || \"UPDATE_FM_SETTINGS_ERROR\",\n {\n data\n }\n );\n }\n }\n\n public async delete({ tenant }: FileManagerStorageOperationsDeleteSettings): Promise<void> {\n return this._entity.delete({\n PK: `T#${tenant}#FM#SETTINGS`,\n SK: SORT_KEY\n });\n }\n}\n"],"mappings":";;;;;;;;AASA;AACA;AACA;AAEA;AAMA,MAAMA,QAAQ,GAAG,GAAG;AAEb,MAAMC,yBAAyB,CAAiD;EAG5EC,WAAW,CAAC;IAAEC;EAAgD,CAAC,EAAE;IAAA;IACpE,IAAI,CAACC,OAAO,GAAG,IAAAC,uBAAoB,EAAC;MAAEC,KAAK,EAAE,IAAAC,kBAAW,EAAC;QAAEJ;MAAe,CAAC;IAAE,CAAC,CAAC;EACnF;EAEA,MAAaK,GAAG,CAAC;IACbC;EAC2C,CAAC,EAAuC;IACnF,IAAI;MACA,MAAMC,QAAQ,GAAG,MAAM,IAAAF,QAAG,EAAgC;QACtDG,MAAM,EAAE,IAAI,CAACP,OAAO;QACpBQ,IAAI,EAAE;UACFC,EAAE,EAAG,KAAIJ,MAAO,cAAa;UAC7BK,EAAE,EAAE;QACR;MACJ,CAAC,CAAC;MAEF,OAAOJ,QAAQ,GAAGA,QAAQ,CAACK,IAAI,GAAG,IAAI;IAC1C,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,2CAA2C,EACzDF,EAAE,CAACG,IAAI,IAAI,oBAAoB,CAClC;IACL;EACJ;EAEA,MAAaC,MAAM,CAAC;IAChBL;EAC8C,CAAC,EAAgC;IAC/E,MAAMM,QAAQ,GAAG,MAAM,IAAI,CAACb,GAAG,CAAC;MAAEC,MAAM,EAAEM,IAAI,CAACN;IAAO,CAAC,CAAC;IAExD,IAAIY,QAAQ,EAAE;MACV,OAAO,MAAM,IAAI,CAACC,MAAM,CAAC;QAAED,QAAQ;QAAEN;MAAK,CAAC,CAAC;IAChD;IAEA,IAAI;MACA,MAAM,IAAI,CAACX,OAAO,CAACmB,GAAG,CAAC;QACnBV,EAAE,EAAG,KAAIE,IAAI,CAACN,MAAO,cAAa;QAClCK,EAAE,EAAEd,QAAQ;QACZwB,IAAI,EAAE,aAAa;QACnBT;MACJ,CAAC,CAAC;MACF,OAAOA,IAAI;IACf,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,qCAAqC,EACnDF,EAAE,CAACG,IAAI,IAAI,0BAA0B,EACrC;QACIJ;MACJ,CAAC,CACJ;IACL;EACJ;EAEA,MAAaO,MAAM,CAAC;IAChBP;EAC8C,CAAC,EAAgC;IAC/E,IAAI;MACA,MAAM,IAAI,CAACX,OAAO,CAACkB,MAAM,CAAC;QACtBT,EAAE,EAAG,KAAIE,IAAI,CAACN,MAAO,cAAa;QAClCK,EAAE,EAAEd,QAAQ;QACZwB,IAAI,EAAE,aAAa;QACnBT;MACJ,CAAC,CAAC;MACF,OAAOA,IAAI;IACf,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,qCAAqC,EACnDF,EAAE,CAACG,IAAI,IAAI,0BAA0B,EACrC;QACIJ;MACJ,CAAC,CACJ;IACL;EACJ;EAEA,MAAaU,MAAM,CAAC;IAAEhB;EAAmD,CAAC,EAAiB;IACvF,OAAO,IAAI,CAACL,OAAO,CAACqB,MAAM,CAAC;MACvBZ,EAAE,EAAG,KAAIJ,MAAO,cAAa;MAC7BK,EAAE,EAAEd;IACR,CAAC,CAAC;EACN;AACJ;AAAC"}
@@ -1,13 +1,12 @@
1
- import { FileManagerContext, FileManagerSystem, FileManagerSystemStorageOperations, FileManagerSystemStorageOperationsCreateParams, FileManagerSystemStorageOperationsUpdateParams } from "@webiny/api-file-manager/types";
1
+ import { DocumentClient } from "aws-sdk/clients/dynamodb";
2
+ import { FileManagerSystem, FileManagerSystemStorageOperations, FileManagerSystemStorageOperationsCreateParams, FileManagerSystemStorageOperationsGetParams, FileManagerSystemStorageOperationsUpdateParams } from "@webiny/api-file-manager/types";
2
3
  interface SystemStorageOperationsConstructorParams {
3
- context: FileManagerContext;
4
+ documentClient: DocumentClient;
4
5
  }
5
6
  export declare class SystemStorageOperations implements FileManagerSystemStorageOperations {
6
- private readonly _context;
7
7
  private readonly _entity;
8
- private get partitionKey();
9
- constructor({ context }: SystemStorageOperationsConstructorParams);
10
- get(): Promise<FileManagerSystem | null>;
8
+ constructor({ documentClient }: SystemStorageOperationsConstructorParams);
9
+ get({ tenant }: FileManagerSystemStorageOperationsGetParams): Promise<FileManagerSystem | null>;
11
10
  create(params: FileManagerSystemStorageOperationsCreateParams): Promise<FileManagerSystem>;
12
11
  update(params: FileManagerSystemStorageOperationsUpdateParams): Promise<FileManagerSystem>;
13
12
  }
@@ -1,75 +1,50 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.SystemStorageOperations = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
-
14
10
  var _error = _interopRequireDefault(require("@webiny/error"));
15
-
16
11
  var _systemEntity = _interopRequireDefault(require("../../definitions/systemEntity"));
17
-
18
- var _table = _interopRequireDefault(require("../../definitions/table"));
19
-
12
+ var _table = require("../../definitions/table");
20
13
  const SORT_KEY = "FM";
21
-
22
14
  class SystemStorageOperations {
23
- get partitionKey() {
24
- const tenant = this._context.tenancy.getCurrentTenant();
25
-
26
- if (!tenant) {
27
- throw new _error.default("Tenant missing.", "TENANT_NOT_FOUND");
28
- }
29
-
30
- return `T#${tenant.id}#SYSTEM`;
31
- }
32
-
33
15
  constructor({
34
- context
16
+ documentClient
35
17
  }) {
36
- (0, _defineProperty2.default)(this, "_context", void 0);
37
18
  (0, _defineProperty2.default)(this, "_entity", void 0);
38
- this._context = context;
39
- const table = (0, _table.default)({
40
- context
41
- });
42
19
  this._entity = (0, _systemEntity.default)({
43
- context,
44
- table
20
+ table: (0, _table.createTable)({
21
+ documentClient
22
+ })
45
23
  });
46
24
  }
47
-
48
- async get() {
25
+ async get({
26
+ tenant
27
+ }) {
49
28
  try {
50
29
  const system = await this._entity.get({
51
- PK: this.partitionKey,
30
+ PK: `T#${tenant}#SYSTEM`,
52
31
  SK: SORT_KEY
53
32
  });
54
-
55
33
  if (!system || !system.Item) {
56
34
  return null;
57
35
  }
58
-
59
36
  return system.Item;
60
37
  } catch (ex) {
61
38
  throw new _error.default(ex.message || "Could not fetch the FileManager system.", ex.code || "GET_SYSTEM_ERROR");
62
39
  }
63
40
  }
64
-
65
41
  async create(params) {
66
42
  const {
67
43
  data
68
44
  } = params;
69
-
70
45
  try {
71
46
  await this._entity.put((0, _objectSpread2.default)({
72
- PK: this.partitionKey,
47
+ PK: `T#${data.tenant}#SYSTEM`,
73
48
  SK: SORT_KEY
74
49
  }, data));
75
50
  } catch (ex) {
@@ -77,19 +52,16 @@ class SystemStorageOperations {
77
52
  data
78
53
  });
79
54
  }
80
-
81
55
  return data;
82
56
  }
83
-
84
57
  async update(params) {
85
58
  const {
86
59
  original,
87
60
  data
88
61
  } = params;
89
-
90
62
  try {
91
63
  await this._entity.update((0, _objectSpread2.default)({
92
- PK: this.partitionKey,
64
+ PK: `T#${data.tenant}#SYSTEM`,
93
65
  SK: SORT_KEY
94
66
  }, data));
95
67
  } catch (ex) {
@@ -97,10 +69,7 @@ class SystemStorageOperations {
97
69
  data
98
70
  });
99
71
  }
100
-
101
72
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, original), data);
102
73
  }
103
-
104
74
  }
105
-
106
75
  exports.SystemStorageOperations = SystemStorageOperations;
@@ -1 +1 @@
1
- {"version":3,"names":["SORT_KEY","SystemStorageOperations","partitionKey","tenant","_context","tenancy","getCurrentTenant","WebinyError","id","constructor","context","table","defineTable","_entity","defineSystemEntity","get","system","PK","SK","Item","ex","message","code","create","params","data","put","update","original"],"sources":["SystemStorageOperations.ts"],"sourcesContent":["import {\n FileManagerContext,\n FileManagerSystem,\n FileManagerSystemStorageOperations,\n FileManagerSystemStorageOperationsCreateParams,\n FileManagerSystemStorageOperationsUpdateParams\n} from \"@webiny/api-file-manager/types\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport WebinyError from \"@webiny/error\";\nimport defineSystemEntity from \"~/definitions/systemEntity\";\nimport defineTable from \"~/definitions/table\";\n\ninterface SystemStorageOperationsConstructorParams {\n context: FileManagerContext;\n}\n\nconst SORT_KEY = \"FM\";\n\nexport class SystemStorageOperations implements FileManagerSystemStorageOperations {\n private readonly _context: FileManagerContext;\n private readonly _entity: Entity<any>;\n\n private get partitionKey(): string {\n const tenant = this._context.tenancy.getCurrentTenant();\n if (!tenant) {\n throw new WebinyError(\"Tenant missing.\", \"TENANT_NOT_FOUND\");\n }\n return `T#${tenant.id}#SYSTEM`;\n }\n\n public constructor({ context }: SystemStorageOperationsConstructorParams) {\n this._context = context;\n const table = defineTable({\n context\n });\n\n this._entity = defineSystemEntity({\n context,\n table\n });\n }\n\n public async get(): Promise<FileManagerSystem | null> {\n try {\n const system = await this._entity.get({\n PK: this.partitionKey,\n SK: SORT_KEY\n });\n if (!system || !system.Item) {\n return null;\n }\n return system.Item;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not fetch the FileManager system.\",\n ex.code || \"GET_SYSTEM_ERROR\"\n );\n }\n }\n\n public async create(\n params: FileManagerSystemStorageOperationsCreateParams\n ): Promise<FileManagerSystem> {\n const { data } = params;\n try {\n await this._entity.put({\n PK: this.partitionKey,\n SK: SORT_KEY,\n ...data\n });\n } catch (ex) {\n throw new WebinyError(\n \"Could not insert new system data into DynamoDB\",\n \"CREATE_SYSTEM_ERROR\",\n {\n data\n }\n );\n }\n return data;\n }\n\n public async update(\n params: FileManagerSystemStorageOperationsUpdateParams\n ): Promise<FileManagerSystem> {\n const { original, data } = params;\n\n try {\n await this._entity.update({\n PK: this.partitionKey,\n SK: SORT_KEY,\n ...data\n });\n } catch (ex) {\n throw new WebinyError(\n \"Could not update system data in the DynamoDB.\",\n \"UPDATE_SYSTEM_ERROR\",\n {\n data\n }\n );\n }\n return {\n ...original,\n ...data\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAQA;;AACA;;AACA;;AAMA,MAAMA,QAAQ,GAAG,IAAjB;;AAEO,MAAMC,uBAAN,CAA4E;EAIvD,IAAZC,YAAY,GAAW;IAC/B,MAAMC,MAAM,GAAG,KAAKC,QAAL,CAAcC,OAAd,CAAsBC,gBAAtB,EAAf;;IACA,IAAI,CAACH,MAAL,EAAa;MACT,MAAM,IAAII,cAAJ,CAAgB,iBAAhB,EAAmC,kBAAnC,CAAN;IACH;;IACD,OAAQ,KAAIJ,MAAM,CAACK,EAAG,SAAtB;EACH;;EAEMC,WAAW,CAAC;IAAEC;EAAF,CAAD,EAAwD;IAAA;IAAA;IACtE,KAAKN,QAAL,GAAgBM,OAAhB;IACA,MAAMC,KAAK,GAAG,IAAAC,cAAA,EAAY;MACtBF;IADsB,CAAZ,CAAd;IAIA,KAAKG,OAAL,GAAe,IAAAC,qBAAA,EAAmB;MAC9BJ,OAD8B;MAE9BC;IAF8B,CAAnB,CAAf;EAIH;;EAEe,MAAHI,GAAG,GAAsC;IAClD,IAAI;MACA,MAAMC,MAAM,GAAG,MAAM,KAAKH,OAAL,CAAaE,GAAb,CAAiB;QAClCE,EAAE,EAAE,KAAKf,YADyB;QAElCgB,EAAE,EAAElB;MAF8B,CAAjB,CAArB;;MAIA,IAAI,CAACgB,MAAD,IAAW,CAACA,MAAM,CAACG,IAAvB,EAA6B;QACzB,OAAO,IAAP;MACH;;MACD,OAAOH,MAAM,CAACG,IAAd;IACH,CATD,CASE,OAAOC,EAAP,EAAW;MACT,MAAM,IAAIb,cAAJ,CACFa,EAAE,CAACC,OAAH,IAAc,yCADZ,EAEFD,EAAE,CAACE,IAAH,IAAW,kBAFT,CAAN;IAIH;EACJ;;EAEkB,MAANC,MAAM,CACfC,MADe,EAEW;IAC1B,MAAM;MAAEC;IAAF,IAAWD,MAAjB;;IACA,IAAI;MACA,MAAM,KAAKX,OAAL,CAAaa,GAAb;QACFT,EAAE,EAAE,KAAKf,YADP;QAEFgB,EAAE,EAAElB;MAFF,GAGCyB,IAHD,EAAN;IAKH,CAND,CAME,OAAOL,EAAP,EAAW;MACT,MAAM,IAAIb,cAAJ,CACF,gDADE,EAEF,qBAFE,EAGF;QACIkB;MADJ,CAHE,CAAN;IAOH;;IACD,OAAOA,IAAP;EACH;;EAEkB,MAANE,MAAM,CACfH,MADe,EAEW;IAC1B,MAAM;MAAEI,QAAF;MAAYH;IAAZ,IAAqBD,MAA3B;;IAEA,IAAI;MACA,MAAM,KAAKX,OAAL,CAAac,MAAb;QACFV,EAAE,EAAE,KAAKf,YADP;QAEFgB,EAAE,EAAElB;MAFF,GAGCyB,IAHD,EAAN;IAKH,CAND,CAME,OAAOL,EAAP,EAAW;MACT,MAAM,IAAIb,cAAJ,CACF,+CADE,EAEF,qBAFE,EAGF;QACIkB;MADJ,CAHE,CAAN;IAOH;;IACD,mEACOG,QADP,GAEOH,IAFP;EAIH;;AAxF8E"}
1
+ {"version":3,"names":["SORT_KEY","SystemStorageOperations","constructor","documentClient","_entity","defineSystemEntity","table","createTable","get","tenant","system","PK","SK","Item","ex","WebinyError","message","code","create","params","data","put","update","original"],"sources":["SystemStorageOperations.ts"],"sourcesContent":["import { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport {\n FileManagerSystem,\n FileManagerSystemStorageOperations,\n FileManagerSystemStorageOperationsCreateParams,\n FileManagerSystemStorageOperationsGetParams,\n FileManagerSystemStorageOperationsUpdateParams\n} from \"@webiny/api-file-manager/types\";\nimport WebinyError from \"@webiny/error\";\nimport defineSystemEntity from \"~/definitions/systemEntity\";\nimport { createTable } from \"~/definitions/table\";\n\ninterface SystemStorageOperationsConstructorParams {\n documentClient: DocumentClient;\n}\n\nconst SORT_KEY = \"FM\";\n\nexport class SystemStorageOperations implements FileManagerSystemStorageOperations {\n private readonly _entity: Entity<any>;\n\n public constructor({ documentClient }: SystemStorageOperationsConstructorParams) {\n this._entity = defineSystemEntity({ table: createTable({ documentClient }) });\n }\n\n public async get({\n tenant\n }: FileManagerSystemStorageOperationsGetParams): Promise<FileManagerSystem | null> {\n try {\n const system = await this._entity.get({\n PK: `T#${tenant}#SYSTEM`,\n SK: SORT_KEY\n });\n if (!system || !system.Item) {\n return null;\n }\n return system.Item;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not fetch the FileManager system.\",\n ex.code || \"GET_SYSTEM_ERROR\"\n );\n }\n }\n\n public async create(\n params: FileManagerSystemStorageOperationsCreateParams\n ): Promise<FileManagerSystem> {\n const { data } = params;\n try {\n await this._entity.put({\n PK: `T#${data.tenant}#SYSTEM`,\n SK: SORT_KEY,\n ...data\n });\n } catch (ex) {\n throw new WebinyError(\n \"Could not insert new system data into DynamoDB\",\n \"CREATE_SYSTEM_ERROR\",\n {\n data\n }\n );\n }\n return data;\n }\n\n public async update(\n params: FileManagerSystemStorageOperationsUpdateParams\n ): Promise<FileManagerSystem> {\n const { original, data } = params;\n\n try {\n await this._entity.update({\n PK: `T#${data.tenant}#SYSTEM`,\n SK: SORT_KEY,\n ...data\n });\n } catch (ex) {\n throw new WebinyError(\n \"Could not update system data in the DynamoDB.\",\n \"UPDATE_SYSTEM_ERROR\",\n {\n data\n }\n );\n }\n return {\n ...original,\n ...data\n };\n }\n}\n"],"mappings":";;;;;;;;;AASA;AACA;AACA;AAMA,MAAMA,QAAQ,GAAG,IAAI;AAEd,MAAMC,uBAAuB,CAA+C;EAGxEC,WAAW,CAAC;IAAEC;EAAyD,CAAC,EAAE;IAAA;IAC7E,IAAI,CAACC,OAAO,GAAG,IAAAC,qBAAkB,EAAC;MAAEC,KAAK,EAAE,IAAAC,kBAAW,EAAC;QAAEJ;MAAe,CAAC;IAAE,CAAC,CAAC;EACjF;EAEA,MAAaK,GAAG,CAAC;IACbC;EACyC,CAAC,EAAqC;IAC/E,IAAI;MACA,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACN,OAAO,CAACI,GAAG,CAAC;QAClCG,EAAE,EAAG,KAAIF,MAAO,SAAQ;QACxBG,EAAE,EAAEZ;MACR,CAAC,CAAC;MACF,IAAI,CAACU,MAAM,IAAI,CAACA,MAAM,CAACG,IAAI,EAAE;QACzB,OAAO,IAAI;MACf;MACA,OAAOH,MAAM,CAACG,IAAI;IACtB,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,yCAAyC,EACvDF,EAAE,CAACG,IAAI,IAAI,kBAAkB,CAChC;IACL;EACJ;EAEA,MAAaC,MAAM,CACfC,MAAsD,EAC5B;IAC1B,MAAM;MAAEC;IAAK,CAAC,GAAGD,MAAM;IACvB,IAAI;MACA,MAAM,IAAI,CAACf,OAAO,CAACiB,GAAG;QAClBV,EAAE,EAAG,KAAIS,IAAI,CAACX,MAAO,SAAQ;QAC7BG,EAAE,EAAEZ;MAAQ,GACToB,IAAI,EACT;IACN,CAAC,CAAC,OAAON,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjB,gDAAgD,EAChD,qBAAqB,EACrB;QACIK;MACJ,CAAC,CACJ;IACL;IACA,OAAOA,IAAI;EACf;EAEA,MAAaE,MAAM,CACfH,MAAsD,EAC5B;IAC1B,MAAM;MAAEI,QAAQ;MAAEH;IAAK,CAAC,GAAGD,MAAM;IAEjC,IAAI;MACA,MAAM,IAAI,CAACf,OAAO,CAACkB,MAAM;QACrBX,EAAE,EAAG,KAAIS,IAAI,CAACX,MAAO,SAAQ;QAC7BG,EAAE,EAAEZ;MAAQ,GACToB,IAAI,EACT;IACN,CAAC,CAAC,OAAON,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjB,+CAA+C,EAC/C,qBAAqB,EACrB;QACIK;MACJ,CAAC,CACJ;IACL;IACA,mEACOG,QAAQ,GACRH,IAAI;EAEf;AACJ;AAAC"}
@@ -1,36 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.getTable = exports.getDocumentClient = void 0;
9
-
10
8
  var _error = _interopRequireDefault(require("@webiny/error"));
11
-
12
9
  const getDocumentClient = context => {
13
10
  const driver = context.db.driver;
14
-
15
11
  if (!driver || !driver.documentClient) {
16
12
  throw new _error.default(`Missing documentDriver on the context db.driver property.`, "DOCUMENT_CLIENT_ERROR");
17
13
  }
18
-
19
14
  return driver.documentClient;
20
15
  };
21
-
22
16
  exports.getDocumentClient = getDocumentClient;
23
-
24
17
  const getTable = context => {
25
18
  const db = context.db;
26
-
27
19
  if (!db) {
28
20
  throw new _error.default("Missing db on context.", "DB_ERROR");
29
21
  } else if (!db.table) {
30
22
  throw new _error.default("Missing table on context.db.", "TABLE_ERROR");
31
23
  }
32
-
33
24
  return db.table;
34
25
  };
35
-
36
26
  exports.getTable = getTable;
@@ -1 +1 @@
1
- {"version":3,"names":["getDocumentClient","context","driver","db","documentClient","WebinyError","getTable","table"],"sources":["utils.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { FileManagerContext } from \"@webiny/api-file-manager/types\";\nimport { DocumentClient } from \"aws-sdk/clients/dynamodb\";\n\nexport const getDocumentClient = (context: FileManagerContext): DocumentClient => {\n const driver = context.db.driver as any;\n if (!driver || !driver.documentClient) {\n throw new WebinyError(\n `Missing documentDriver on the context db.driver property.`,\n \"DOCUMENT_CLIENT_ERROR\"\n );\n }\n return driver.documentClient;\n};\n\nexport const getTable = (context: FileManagerContext): string => {\n const db = context.db as any;\n if (!db) {\n throw new WebinyError(\"Missing db on context.\", \"DB_ERROR\");\n } else if (!db.table) {\n throw new WebinyError(\"Missing table on context.db.\", \"TABLE_ERROR\");\n }\n return db.table;\n};\n"],"mappings":";;;;;;;;;AAAA;;AAIO,MAAMA,iBAAiB,GAAIC,OAAD,IAAiD;EAC9E,MAAMC,MAAM,GAAGD,OAAO,CAACE,EAAR,CAAWD,MAA1B;;EACA,IAAI,CAACA,MAAD,IAAW,CAACA,MAAM,CAACE,cAAvB,EAAuC;IACnC,MAAM,IAAIC,cAAJ,CACD,2DADC,EAEF,uBAFE,CAAN;EAIH;;EACD,OAAOH,MAAM,CAACE,cAAd;AACH,CATM;;;;AAWA,MAAME,QAAQ,GAAIL,OAAD,IAAyC;EAC7D,MAAME,EAAE,GAAGF,OAAO,CAACE,EAAnB;;EACA,IAAI,CAACA,EAAL,EAAS;IACL,MAAM,IAAIE,cAAJ,CAAgB,wBAAhB,EAA0C,UAA1C,CAAN;EACH,CAFD,MAEO,IAAI,CAACF,EAAE,CAACI,KAAR,EAAe;IAClB,MAAM,IAAIF,cAAJ,CAAgB,8BAAhB,EAAgD,aAAhD,CAAN;EACH;;EACD,OAAOF,EAAE,CAACI,KAAV;AACH,CARM"}
1
+ {"version":3,"names":["getDocumentClient","context","driver","db","documentClient","WebinyError","getTable","table"],"sources":["utils.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { FileManagerContext } from \"@webiny/api-file-manager/types\";\nimport { DocumentClient } from \"aws-sdk/clients/dynamodb\";\n\nexport const getDocumentClient = (context: FileManagerContext): DocumentClient => {\n const driver = context.db.driver as any;\n if (!driver || !driver.documentClient) {\n throw new WebinyError(\n `Missing documentDriver on the context db.driver property.`,\n \"DOCUMENT_CLIENT_ERROR\"\n );\n }\n return driver.documentClient;\n};\n\nexport const getTable = (context: FileManagerContext): string => {\n const db = context.db as any;\n if (!db) {\n throw new WebinyError(\"Missing db on context.\", \"DB_ERROR\");\n } else if (!db.table) {\n throw new WebinyError(\"Missing table on context.db.\", \"TABLE_ERROR\");\n }\n return db.table;\n};\n"],"mappings":";;;;;;;AAAA;AAIO,MAAMA,iBAAiB,GAAIC,OAA2B,IAAqB;EAC9E,MAAMC,MAAM,GAAGD,OAAO,CAACE,EAAE,CAACD,MAAa;EACvC,IAAI,CAACA,MAAM,IAAI,CAACA,MAAM,CAACE,cAAc,EAAE;IACnC,MAAM,IAAIC,cAAW,CAChB,2DAA0D,EAC3D,uBAAuB,CAC1B;EACL;EACA,OAAOH,MAAM,CAACE,cAAc;AAChC,CAAC;AAAC;AAEK,MAAME,QAAQ,GAAIL,OAA2B,IAAa;EAC7D,MAAME,EAAE,GAAGF,OAAO,CAACE,EAAS;EAC5B,IAAI,CAACA,EAAE,EAAE;IACL,MAAM,IAAIE,cAAW,CAAC,wBAAwB,EAAE,UAAU,CAAC;EAC/D,CAAC,MAAM,IAAI,CAACF,EAAE,CAACI,KAAK,EAAE;IAClB,MAAM,IAAIF,cAAW,CAAC,8BAA8B,EAAE,aAAa,CAAC;EACxE;EACA,OAAOF,EAAE,CAACI,KAAK;AACnB,CAAC;AAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-file-manager-ddb",
3
- "version": "5.34.8",
3
+ "version": "5.35.0-beta.1",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "@webiny/api-file-manager",
@@ -21,12 +21,13 @@
21
21
  ],
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@babel/runtime": "7.19.0",
25
- "@webiny/api-file-manager": "5.34.8",
26
- "@webiny/db-dynamodb": "5.34.8",
27
- "@webiny/error": "5.34.8",
28
- "@webiny/project-utils": "5.34.8",
29
- "aws-sdk": "2.1230.0",
24
+ "@babel/runtime": "7.20.13",
25
+ "@webiny/api-file-manager": "5.35.0-beta.1",
26
+ "@webiny/db-dynamodb": "5.35.0-beta.1",
27
+ "@webiny/error": "5.35.0-beta.1",
28
+ "@webiny/plugins": "5.35.0-beta.1",
29
+ "@webiny/project-utils": "5.35.0-beta.1",
30
+ "aws-sdk": "2.1310.0",
30
31
  "dynamodb-toolbox": "0.3.5"
31
32
  },
32
33
  "devDependencies": {
@@ -36,7 +37,7 @@
36
37
  "@babel/plugin-transform-runtime": "^7.16.4",
37
38
  "@babel/preset-env": "^7.19.4",
38
39
  "@babel/preset-typescript": "^7.18.6",
39
- "@webiny/cli": "^5.34.8",
40
+ "@webiny/cli": "^5.35.0-beta.1",
40
41
  "jest": "^28.1.0",
41
42
  "jest-dynalite": "^3.2.0",
42
43
  "jsonpack": "^1.1.5",
@@ -63,5 +64,5 @@
63
64
  ]
64
65
  }
65
66
  },
66
- "gitHead": "6e77eebaac687279fe82ea04f667b7e84214b96a"
67
+ "gitHead": "6b376faedf02e056efbbf1e4d46d537850773ce0"
67
68
  }
@@ -1,23 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.FileAttributePlugin = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _AttributePlugin = require("@webiny/db-dynamodb/plugins/definitions/AttributePlugin");
13
-
14
10
  class FileAttributePlugin extends _AttributePlugin.AttributePlugin {
15
11
  constructor(params) {
16
12
  super((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
17
- entity: "Files"
13
+ entity: "FM.File"
18
14
  }));
19
15
  }
20
-
21
16
  }
22
-
23
17
  exports.FileAttributePlugin = FileAttributePlugin;
@@ -1 +1 @@
1
- {"version":3,"names":["FileAttributePlugin","AttributePlugin","constructor","params","entity"],"sources":["FileAttributePlugin.ts"],"sourcesContent":["import {\n AttributePlugin,\n AttributePluginParams\n} from \"@webiny/db-dynamodb/plugins/definitions/AttributePlugin\";\n\nexport class FileAttributePlugin extends AttributePlugin {\n public constructor(params: Omit<AttributePluginParams, \"entity\">) {\n super({\n ...params,\n entity: \"Files\"\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAKO,MAAMA,mBAAN,SAAkCC,gCAAlC,CAAkD;EAC9CC,WAAW,CAACC,MAAD,EAAgD;IAC9D,kEACOA,MADP;MAEIC,MAAM,EAAE;IAFZ;EAIH;;AANoD"}
1
+ {"version":3,"names":["FileAttributePlugin","AttributePlugin","constructor","params","entity"],"sources":["FileAttributePlugin.ts"],"sourcesContent":["import {\n AttributePlugin,\n AttributePluginParams\n} from \"@webiny/db-dynamodb/plugins/definitions/AttributePlugin\";\n\nexport class FileAttributePlugin extends AttributePlugin {\n public constructor(params: Omit<AttributePluginParams, \"entity\">) {\n super({\n ...params,\n entity: \"FM.File\"\n });\n }\n}\n"],"mappings":";;;;;;;;AAAA;AAKO,MAAMA,mBAAmB,SAASC,gCAAe,CAAC;EAC9CC,WAAW,CAACC,MAA6C,EAAE;IAC9D,KAAK,6DACEA,MAAM;MACTC,MAAM,EAAE;IAAS,GACnB;EACN;AACJ;AAAC"}
@@ -1,17 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.FileDynamoDbFieldPlugin = void 0;
9
-
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
9
  var _FieldPlugin = require("@webiny/db-dynamodb/plugins/definitions/FieldPlugin");
13
-
14
10
  class FileDynamoDbFieldPlugin extends _FieldPlugin.FieldPlugin {}
15
-
16
11
  exports.FileDynamoDbFieldPlugin = FileDynamoDbFieldPlugin;
17
12
  (0, _defineProperty2.default)(FileDynamoDbFieldPlugin, "type", "fileManager.dynamodb.field.file");
@@ -1 +1 @@
1
- {"version":3,"names":["FileDynamoDbFieldPlugin","FieldPlugin"],"sources":["FileDynamoDbFieldPlugin.ts"],"sourcesContent":["import { FieldPlugin } from \"@webiny/db-dynamodb/plugins/definitions/FieldPlugin\";\n\nexport class FileDynamoDbFieldPlugin extends FieldPlugin {\n public static override readonly type: string = \"fileManager.dynamodb.field.file\";\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAEO,MAAMA,uBAAN,SAAsCC,wBAAtC,CAAkD;;;8BAA5CD,uB,UACsC,iC"}
1
+ {"version":3,"names":["FileDynamoDbFieldPlugin","FieldPlugin"],"sources":["FileDynamoDbFieldPlugin.ts"],"sourcesContent":["import { FieldPlugin } from \"@webiny/db-dynamodb/plugins/definitions/FieldPlugin\";\n\nexport class FileDynamoDbFieldPlugin extends FieldPlugin {\n public static override readonly type: string = \"fileManager.dynamodb.field.file\";\n}\n"],"mappings":";;;;;;;;AAAA;AAEO,MAAMA,uBAAuB,SAASC,wBAAW,CAAC;AAExD;AAAA,8BAFYD,uBAAuB,UACe,iCAAiC"}
@@ -1,23 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.SettingsAttributePlugin = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _AttributePlugin = require("@webiny/db-dynamodb/plugins/definitions/AttributePlugin");
13
-
14
10
  class SettingsAttributePlugin extends _AttributePlugin.AttributePlugin {
15
11
  constructor(params) {
16
12
  super((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
17
- entity: "Settings"
13
+ entity: "FM.Settings"
18
14
  }));
19
15
  }
20
-
21
16
  }
22
-
23
17
  exports.SettingsAttributePlugin = SettingsAttributePlugin;
@@ -1 +1 @@
1
- {"version":3,"names":["SettingsAttributePlugin","AttributePlugin","constructor","params","entity"],"sources":["SettingsAttributePlugin.ts"],"sourcesContent":["import {\n AttributePlugin,\n AttributePluginParams\n} from \"@webiny/db-dynamodb/plugins/definitions/AttributePlugin\";\n\nexport class SettingsAttributePlugin extends AttributePlugin {\n public constructor(params: Omit<AttributePluginParams, \"entity\">) {\n super({\n ...params,\n entity: \"Settings\"\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAKO,MAAMA,uBAAN,SAAsCC,gCAAtC,CAAsD;EAClDC,WAAW,CAACC,MAAD,EAAgD;IAC9D,kEACOA,MADP;MAEIC,MAAM,EAAE;IAFZ;EAIH;;AANwD"}
1
+ {"version":3,"names":["SettingsAttributePlugin","AttributePlugin","constructor","params","entity"],"sources":["SettingsAttributePlugin.ts"],"sourcesContent":["import {\n AttributePlugin,\n AttributePluginParams\n} from \"@webiny/db-dynamodb/plugins/definitions/AttributePlugin\";\n\nexport class SettingsAttributePlugin extends AttributePlugin {\n public constructor(params: Omit<AttributePluginParams, \"entity\">) {\n super({\n ...params,\n entity: \"FM.Settings\"\n });\n }\n}\n"],"mappings":";;;;;;;;AAAA;AAKO,MAAMA,uBAAuB,SAASC,gCAAe,CAAC;EAClDC,WAAW,CAACC,MAA6C,EAAE;IAC9D,KAAK,6DACEA,MAAM;MACTC,MAAM,EAAE;IAAa,GACvB;EACN;AACJ;AAAC"}
@@ -1,23 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.SystemAttributePlugin = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _AttributePlugin = require("@webiny/db-dynamodb/plugins/definitions/AttributePlugin");
13
-
14
10
  class SystemAttributePlugin extends _AttributePlugin.AttributePlugin {
15
11
  constructor(params) {
16
12
  super((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
17
13
  entity: "System"
18
14
  }));
19
15
  }
20
-
21
16
  }
22
-
23
17
  exports.SystemAttributePlugin = SystemAttributePlugin;
@@ -1 +1 @@
1
- {"version":3,"names":["SystemAttributePlugin","AttributePlugin","constructor","params","entity"],"sources":["SystemAttributePlugin.ts"],"sourcesContent":["import {\n AttributePlugin,\n AttributePluginParams\n} from \"@webiny/db-dynamodb/plugins/definitions/AttributePlugin\";\n\nexport class SystemAttributePlugin extends AttributePlugin {\n public constructor(params: Omit<AttributePluginParams, \"entity\">) {\n super({\n ...params,\n entity: \"System\"\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAKO,MAAMA,qBAAN,SAAoCC,gCAApC,CAAoD;EAChDC,WAAW,CAACC,MAAD,EAAgD;IAC9D,kEACOA,MADP;MAEIC,MAAM,EAAE;IAFZ;EAIH;;AANsD"}
1
+ {"version":3,"names":["SystemAttributePlugin","AttributePlugin","constructor","params","entity"],"sources":["SystemAttributePlugin.ts"],"sourcesContent":["import {\n AttributePlugin,\n AttributePluginParams\n} from \"@webiny/db-dynamodb/plugins/definitions/AttributePlugin\";\n\nexport class SystemAttributePlugin extends AttributePlugin {\n public constructor(params: Omit<AttributePluginParams, \"entity\">) {\n super({\n ...params,\n entity: \"System\"\n });\n }\n}\n"],"mappings":";;;;;;;;AAAA;AAKO,MAAMA,qBAAqB,SAASC,gCAAe,CAAC;EAChDC,WAAW,CAACC,MAA6C,EAAE;IAC9D,KAAK,6DACEA,MAAM;MACTC,MAAM,EAAE;IAAQ,GAClB;EACN;AACJ;AAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./FileAttributePlugin";
2
+ export * from "./FileDynamoDbFieldPlugin";
3
+ export * from "./SettingsAttributePlugin";
4
+ export * from "./SystemAttributePlugin";