@webiny/api-file-manager-ddb 0.0.0-mt-3 → 0.0.0-unstable.13771d80a8

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 (56) hide show
  1. package/definitions/filesEntity.d.ts +3 -2
  2. package/definitions/filesEntity.js +3 -7
  3. package/definitions/filesEntity.js.map +1 -0
  4. package/definitions/settingsEntity.d.ts +3 -4
  5. package/definitions/settingsEntity.js +9 -27
  6. package/definitions/settingsEntity.js.map +1 -0
  7. package/definitions/systemEntity.d.ts +3 -4
  8. package/definitions/systemEntity.js +5 -17
  9. package/definitions/systemEntity.js.map +1 -0
  10. package/definitions/table.d.ts +6 -5
  11. package/definitions/table.js +14 -17
  12. package/definitions/table.js.map +1 -0
  13. package/index.d.ts +9 -5
  14. package/index.js +52 -11
  15. package/index.js.map +1 -0
  16. package/operations/files/FilesStorageOperations.d.ts +11 -7
  17. package/operations/files/FilesStorageOperations.js +175 -113
  18. package/operations/files/FilesStorageOperations.js.map +1 -0
  19. package/operations/files/fields.d.ts +1 -2
  20. package/operations/files/fields.js +3 -6
  21. package/operations/files/fields.js.map +1 -0
  22. package/operations/files/index.d.ts +2 -2
  23. package/operations/files/index.js +1 -1
  24. package/operations/files/index.js.map +1 -0
  25. package/operations/settings/SettingsStorageOperations.d.ts +7 -8
  26. package/operations/settings/SettingsStorageOperations.js +37 -64
  27. package/operations/settings/SettingsStorageOperations.js.map +1 -0
  28. package/operations/settings/index.d.ts +2 -4
  29. package/operations/settings/index.js +1 -1
  30. package/operations/settings/index.js.map +1 -0
  31. package/operations/system/SystemStorageOperations.d.ts +6 -7
  32. package/operations/system/SystemStorageOperations.js +16 -49
  33. package/operations/system/SystemStorageOperations.js.map +1 -0
  34. package/operations/system/index.d.ts +2 -4
  35. package/operations/system/index.js +1 -1
  36. package/operations/system/index.js.map +1 -0
  37. package/operations/utils.js +1 -11
  38. package/operations/utils.js.map +1 -0
  39. package/package.json +19 -18
  40. package/plugins/FileAttributePlugin.d.ts +2 -2
  41. package/plugins/FileAttributePlugin.js +4 -14
  42. package/plugins/FileAttributePlugin.js.map +1 -0
  43. package/plugins/FileDynamoDbFieldPlugin.js +1 -6
  44. package/plugins/FileDynamoDbFieldPlugin.js.map +1 -0
  45. package/plugins/SettingsAttributePlugin.d.ts +2 -2
  46. package/plugins/SettingsAttributePlugin.js +4 -14
  47. package/plugins/SettingsAttributePlugin.js.map +1 -0
  48. package/plugins/SystemAttributePlugin.d.ts +2 -2
  49. package/plugins/SystemAttributePlugin.js +3 -13
  50. package/plugins/SystemAttributePlugin.js.map +1 -0
  51. package/plugins/index.d.ts +4 -0
  52. package/plugins/index.js +49 -0
  53. package/plugins/index.js.map +1 -0
  54. package/types.js.map +1 -0
  55. package/operations/configurations.d.ts +0 -14
  56. package/operations/configurations.js +0 -22
@@ -1,89 +1,62 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.SettingsStorageOperations = void 0;
9
-
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
9
  var _error = _interopRequireDefault(require("@webiny/error"));
13
-
14
- var _table = _interopRequireDefault(require("../../definitions/table"));
15
-
16
10
  var _settingsEntity = _interopRequireDefault(require("../../definitions/settingsEntity"));
17
-
18
- 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; }
19
-
20
- 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; }
21
-
22
- const SORT_KEY = "default";
23
-
11
+ var _get = require("@webiny/db-dynamodb/utils/get");
12
+ var _table = require("../../definitions/table");
13
+ const SORT_KEY = "A";
24
14
  class SettingsStorageOperations {
25
- get partitionKey() {
26
- const tenant = this._context.tenancy.getCurrentTenant();
27
-
28
- if (!tenant) {
29
- throw new _error.default("Tenant missing.", "TENANT_NOT_FOUND");
30
- }
31
-
32
- return `T#${tenant.id}#FM#SETTINGS`;
33
- }
34
-
35
15
  constructor({
36
- context
16
+ documentClient
37
17
  }) {
38
- (0, _defineProperty2.default)(this, "_context", void 0);
39
18
  (0, _defineProperty2.default)(this, "_entity", void 0);
40
- this._context = context;
41
- const table = (0, _table.default)({
42
- context
43
- });
44
19
  this._entity = (0, _settingsEntity.default)({
45
- context,
46
- table
20
+ table: (0, _table.createTable)({
21
+ documentClient
22
+ })
47
23
  });
48
24
  }
49
-
50
- async get() {
25
+ async get({
26
+ tenant
27
+ }) {
51
28
  try {
52
- const settings = await this._entity.get({
53
- PK: this.partitionKey,
54
- 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
+ }
55
35
  });
56
-
57
- if (!settings || !settings.Item) {
58
- return null;
59
- }
60
-
61
- return settings.Item;
36
+ return settings ? settings.data : null;
62
37
  } catch (ex) {
63
38
  throw new _error.default(ex.message || "Could not fetch the FileManager settings.", ex.code || "GET_SETTINGS_ERROR");
64
39
  }
65
40
  }
66
-
67
41
  async create({
68
42
  data
69
43
  }) {
70
- const original = await this.get();
71
- /**
72
- * TODO: check if need to throw an error on existing settings
73
- */
74
-
44
+ const original = await this.get({
45
+ tenant: data.tenant
46
+ });
75
47
  if (original) {
76
48
  return await this.update({
77
49
  original,
78
50
  data
79
51
  });
80
52
  }
81
-
82
53
  try {
83
- await this._entity.put(_objectSpread({
84
- PK: this.partitionKey,
85
- SK: SORT_KEY
86
- }, data));
54
+ await this._entity.put({
55
+ PK: `T#${data.tenant}#FM#SETTINGS`,
56
+ SK: SORT_KEY,
57
+ TYPE: "fm.settings",
58
+ data
59
+ });
87
60
  return data;
88
61
  } catch (ex) {
89
62
  throw new _error.default(ex.message || "Cannot create FileManager settings.", ex.code || "CREATE_FM_SETTINGS_ERROR", {
@@ -91,15 +64,16 @@ class SettingsStorageOperations {
91
64
  });
92
65
  }
93
66
  }
94
-
95
67
  async update({
96
68
  data
97
69
  }) {
98
70
  try {
99
- await this._entity.update(_objectSpread({
100
- PK: this.partitionKey,
101
- SK: SORT_KEY
102
- }, data));
71
+ await this._entity.update({
72
+ PK: `T#${data.tenant}#FM#SETTINGS`,
73
+ SK: SORT_KEY,
74
+ TYPE: "fm.settings",
75
+ data
76
+ });
103
77
  return data;
104
78
  } catch (ex) {
105
79
  throw new _error.default(ex.message || "Cannot update FileManager settings.", ex.code || "UPDATE_FM_SETTINGS_ERROR", {
@@ -107,14 +81,13 @@ class SettingsStorageOperations {
107
81
  });
108
82
  }
109
83
  }
110
-
111
- async delete() {
84
+ async delete({
85
+ tenant
86
+ }) {
112
87
  return this._entity.delete({
113
- PK: this.partitionKey,
88
+ PK: `T#${tenant}#FM#SETTINGS`,
114
89
  SK: SORT_KEY
115
90
  });
116
91
  }
117
-
118
92
  }
119
-
120
93
  exports.SettingsStorageOperations = SettingsStorageOperations;
@@ -0,0 +1 @@
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,8 +1,6 @@
1
1
  import { SettingsStorageOperations } from "./SettingsStorageOperations";
2
- import { SettingsStorageOperationsProviderPlugin } from "@webiny/api-file-manager/plugins/definitions/SettingsStorageOperationsProviderPlugin";
2
+ import { SettingsStorageOperationsProviderPlugin, SettingsStorageOperationsProviderPluginParams } from "@webiny/api-file-manager/plugins/definitions/SettingsStorageOperationsProviderPlugin";
3
3
  export declare class SettingsStorageOperationsProviderDdbPlugin extends SettingsStorageOperationsProviderPlugin {
4
4
  name: string;
5
- provide({ context }: {
6
- context: any;
7
- }): Promise<SettingsStorageOperations>;
5
+ provide({ context }: SettingsStorageOperationsProviderPluginParams): Promise<SettingsStorageOperations>;
8
6
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SettingsStorageOperationsProviderDdbPlugin","SettingsStorageOperationsProviderPlugin","provide","context","SettingsStorageOperations"],"sources":["index.ts"],"sourcesContent":["import { SettingsStorageOperations } from \"./SettingsStorageOperations\";\nimport {\n SettingsStorageOperationsProviderPlugin,\n SettingsStorageOperationsProviderPluginParams\n} from \"@webiny/api-file-manager/plugins/definitions/SettingsStorageOperationsProviderPlugin\";\n\nexport class SettingsStorageOperationsProviderDdbPlugin extends SettingsStorageOperationsProviderPlugin {\n public override name = \"fm.storageOperationsProvider.settings.ddb\";\n\n public async provide({ context }: SettingsStorageOperationsProviderPluginParams) {\n return new SettingsStorageOperations({\n context\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAKO,MAAMA,0CAAN,SAAyDC,gFAAzD,CAAiG;EAAA;IAAA;IAAA,4CAC7E,2CAD6E;EAAA;;EAGhF,MAAPC,OAAO,CAAC;IAAEC;EAAF,CAAD,EAA6D;IAC7E,OAAO,IAAIC,oDAAJ,CAA8B;MACjCD;IADiC,CAA9B,CAAP;EAGH;;AAPmG"}
@@ -1,13 +1,12 @@
1
- import { FileManagerContext, FileManagerSystem, FileManagerSystemStorageOperations, FileManagerSystemStorageOperationsCreateParams, FileManagerSystemStorageOperationsUpdateParams } from "@webiny/api-file-manager/types";
2
- interface ConstructorParams {
3
- context: FileManagerContext;
1
+ import { DocumentClient } from "aws-sdk/clients/dynamodb";
2
+ import { FileManagerSystem, FileManagerSystemStorageOperations, FileManagerSystemStorageOperationsCreateParams, FileManagerSystemStorageOperationsGetParams, FileManagerSystemStorageOperationsUpdateParams } from "@webiny/api-file-manager/types";
3
+ interface SystemStorageOperationsConstructorParams {
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 }: ConstructorParams);
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,77 +1,50 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.SystemStorageOperations = void 0;
9
-
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
10
  var _error = _interopRequireDefault(require("@webiny/error"));
13
-
14
11
  var _systemEntity = _interopRequireDefault(require("../../definitions/systemEntity"));
15
-
16
- var _table = _interopRequireDefault(require("../../definitions/table"));
17
-
18
- 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; }
19
-
20
- 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; }
21
-
12
+ var _table = require("../../definitions/table");
22
13
  const SORT_KEY = "FM";
23
-
24
14
  class SystemStorageOperations {
25
- get partitionKey() {
26
- const tenant = this._context.tenancy.getCurrentTenant();
27
-
28
- if (!tenant) {
29
- throw new _error.default("Tenant missing.", "TENANT_NOT_FOUND");
30
- }
31
-
32
- return `T#${tenant.id}#SYSTEM`;
33
- }
34
-
35
15
  constructor({
36
- context
16
+ documentClient
37
17
  }) {
38
- (0, _defineProperty2.default)(this, "_context", void 0);
39
18
  (0, _defineProperty2.default)(this, "_entity", void 0);
40
- this._context = context;
41
- const table = (0, _table.default)({
42
- context
43
- });
44
19
  this._entity = (0, _systemEntity.default)({
45
- context,
46
- table
20
+ table: (0, _table.createTable)({
21
+ documentClient
22
+ })
47
23
  });
48
24
  }
49
-
50
- async get() {
25
+ async get({
26
+ tenant
27
+ }) {
51
28
  try {
52
29
  const system = await this._entity.get({
53
- PK: this.partitionKey,
30
+ PK: `T#${tenant}#SYSTEM`,
54
31
  SK: SORT_KEY
55
32
  });
56
-
57
33
  if (!system || !system.Item) {
58
34
  return null;
59
35
  }
60
-
61
36
  return system.Item;
62
37
  } catch (ex) {
63
38
  throw new _error.default(ex.message || "Could not fetch the FileManager system.", ex.code || "GET_SYSTEM_ERROR");
64
39
  }
65
40
  }
66
-
67
41
  async create(params) {
68
42
  const {
69
43
  data
70
44
  } = params;
71
-
72
45
  try {
73
- await this._entity.put(_objectSpread({
74
- PK: this.partitionKey,
46
+ await this._entity.put((0, _objectSpread2.default)({
47
+ PK: `T#${data.tenant}#SYSTEM`,
75
48
  SK: SORT_KEY
76
49
  }, data));
77
50
  } catch (ex) {
@@ -79,19 +52,16 @@ class SystemStorageOperations {
79
52
  data
80
53
  });
81
54
  }
82
-
83
55
  return data;
84
56
  }
85
-
86
57
  async update(params) {
87
58
  const {
88
59
  original,
89
60
  data
90
61
  } = params;
91
-
92
62
  try {
93
- await this._entity.update(_objectSpread({
94
- PK: this.partitionKey,
63
+ await this._entity.update((0, _objectSpread2.default)({
64
+ PK: `T#${data.tenant}#SYSTEM`,
95
65
  SK: SORT_KEY
96
66
  }, data));
97
67
  } catch (ex) {
@@ -99,10 +69,7 @@ class SystemStorageOperations {
99
69
  data
100
70
  });
101
71
  }
102
-
103
- return _objectSpread(_objectSpread({}, original), data);
72
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, original), data);
104
73
  }
105
-
106
74
  }
107
-
108
75
  exports.SystemStorageOperations = SystemStorageOperations;
@@ -0,0 +1 @@
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,8 +1,6 @@
1
1
  import { SystemStorageOperations } from "./SystemStorageOperations";
2
- import { SystemStorageOperationsProviderPlugin } from "@webiny/api-file-manager/plugins/definitions/SystemStorageOperationsProviderPlugin";
2
+ import { SystemStorageOperationsProviderPlugin, SystemStorageOperationsProviderPluginParams } from "@webiny/api-file-manager/plugins/definitions/SystemStorageOperationsProviderPlugin";
3
3
  export declare class SystemStorageOperationsProviderDdbPlugin extends SystemStorageOperationsProviderPlugin {
4
4
  name: string;
5
- provide({ context }: {
6
- context: any;
7
- }): Promise<SystemStorageOperations>;
5
+ provide({ context }: SystemStorageOperationsProviderPluginParams): Promise<SystemStorageOperations>;
8
6
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SystemStorageOperationsProviderDdbPlugin","SystemStorageOperationsProviderPlugin","provide","context","SystemStorageOperations"],"sources":["index.ts"],"sourcesContent":["import { SystemStorageOperations } from \"./SystemStorageOperations\";\nimport {\n SystemStorageOperationsProviderPlugin,\n SystemStorageOperationsProviderPluginParams\n} from \"@webiny/api-file-manager/plugins/definitions/SystemStorageOperationsProviderPlugin\";\n\nexport class SystemStorageOperationsProviderDdbPlugin extends SystemStorageOperationsProviderPlugin {\n public override name = \"fm.storageOperationsProvider.system.ddb\";\n public async provide({ context }: SystemStorageOperationsProviderPluginParams) {\n return new SystemStorageOperations({\n context\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAKO,MAAMA,wCAAN,SAAuDC,4EAAvD,CAA6F;EAAA;IAAA;IAAA,4CACzE,yCADyE;EAAA;;EAE5E,MAAPC,OAAO,CAAC;IAAEC;EAAF,CAAD,EAA2D;IAC3E,OAAO,IAAIC,gDAAJ,CAA4B;MAC/BD;IAD+B,CAA5B,CAAP;EAGH;;AAN+F"}
@@ -1,36 +1,26 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
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;
@@ -0,0 +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,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": "0.0.0-mt-3",
3
+ "version": "0.0.0-unstable.13771d80a8",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "@webiny/api-file-manager",
@@ -21,28 +21,29 @@
21
21
  ],
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@babel/runtime": "7.15.4",
25
- "@webiny/api-file-manager": "0.0.0-mt-3",
26
- "@webiny/db-dynamodb": "0.0.0-mt-3",
27
- "@webiny/error": "0.0.0-mt-3",
28
- "@webiny/project-utils": "0.0.0-mt-3",
29
- "aws-sdk": "2.1026.0",
30
- "dynamodb-toolbox": "0.3.4"
24
+ "@babel/runtime": "7.20.13",
25
+ "@webiny/api-file-manager": "0.0.0-unstable.13771d80a8",
26
+ "@webiny/db-dynamodb": "0.0.0-unstable.13771d80a8",
27
+ "@webiny/error": "0.0.0-unstable.13771d80a8",
28
+ "@webiny/plugins": "0.0.0-unstable.13771d80a8",
29
+ "@webiny/project-utils": "0.0.0-unstable.13771d80a8",
30
+ "aws-sdk": "2.1310.0",
31
+ "dynamodb-toolbox": "0.3.5"
31
32
  },
32
33
  "devDependencies": {
33
- "@babel/cli": "^7.5.5",
34
- "@babel/core": "^7.5.5",
35
- "@babel/plugin-proposal-object-rest-spread": "^7.5.5",
36
- "@babel/plugin-transform-runtime": "^7.5.5",
37
- "@babel/preset-env": "^7.5.5",
38
- "@babel/preset-typescript": "^7.0.0",
39
- "@webiny/cli": "^0.0.0-mt-3",
40
- "jest": "^26.6.3",
34
+ "@babel/cli": "^7.19.3",
35
+ "@babel/core": "^7.19.3",
36
+ "@babel/plugin-proposal-object-rest-spread": "^7.16.0",
37
+ "@babel/plugin-transform-runtime": "^7.16.4",
38
+ "@babel/preset-env": "^7.19.4",
39
+ "@babel/preset-typescript": "^7.18.6",
40
+ "@webiny/cli": "^0.0.0-unstable.13771d80a8",
41
+ "jest": "^28.1.0",
41
42
  "jest-dynalite": "^3.2.0",
42
43
  "jsonpack": "^1.1.5",
43
44
  "rimraf": "^3.0.2",
44
45
  "ttypescript": "^1.5.12",
45
- "typescript": "^4.1.3"
46
+ "typescript": "4.7.4"
46
47
  },
47
48
  "publishConfig": {
48
49
  "access": "public",
@@ -63,5 +64,5 @@
63
64
  ]
64
65
  }
65
66
  },
66
- "gitHead": "ebea815be2be99404591cba465cc1fe88355bd48"
67
+ "gitHead": "13771d80a8ae3195c9ea1485bf8c01f6667a129e"
67
68
  }
@@ -1,4 +1,4 @@
1
- import { AttributePlugin, Params } from "@webiny/db-dynamodb/plugins/definitions/AttributePlugin";
1
+ import { AttributePlugin, AttributePluginParams } from "@webiny/db-dynamodb/plugins/definitions/AttributePlugin";
2
2
  export declare class FileAttributePlugin extends AttributePlugin {
3
- constructor(params: Omit<Params, "entity">);
3
+ constructor(params: Omit<AttributePluginParams, "entity">);
4
4
  }
@@ -1,27 +1,17 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.FileAttributePlugin = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
9
  var _AttributePlugin = require("@webiny/db-dynamodb/plugins/definitions/AttributePlugin");
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
10
  class FileAttributePlugin extends _AttributePlugin.AttributePlugin {
19
11
  constructor(params) {
20
- super(_objectSpread(_objectSpread({}, params), {}, {
21
- entity: "Files"
12
+ super((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
13
+ entity: "FM.File"
22
14
  }));
23
15
  }
24
-
25
16
  }
26
-
27
17
  exports.FileAttributePlugin = FileAttributePlugin;
@@ -0,0 +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: \"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
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
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");
@@ -0,0 +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,uBAAuB,SAASC,wBAAW,CAAC;AAExD;AAAA,8BAFYD,uBAAuB,UACe,iCAAiC"}
@@ -1,4 +1,4 @@
1
- import { AttributePlugin, Params } from "@webiny/db-dynamodb/plugins/definitions/AttributePlugin";
1
+ import { AttributePlugin, AttributePluginParams } from "@webiny/db-dynamodb/plugins/definitions/AttributePlugin";
2
2
  export declare class SettingsAttributePlugin extends AttributePlugin {
3
- constructor(params: Omit<Params, "entity">);
3
+ constructor(params: Omit<AttributePluginParams, "entity">);
4
4
  }
@@ -1,27 +1,17 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.SettingsAttributePlugin = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
9
  var _AttributePlugin = require("@webiny/db-dynamodb/plugins/definitions/AttributePlugin");
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
10
  class SettingsAttributePlugin extends _AttributePlugin.AttributePlugin {
19
11
  constructor(params) {
20
- super(_objectSpread(_objectSpread({}, params), {}, {
21
- entity: "Settings"
12
+ super((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
13
+ entity: "FM.Settings"
22
14
  }));
23
15
  }
24
-
25
16
  }
26
-
27
17
  exports.SettingsAttributePlugin = SettingsAttributePlugin;
@@ -0,0 +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: \"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,4 +1,4 @@
1
- import { AttributePlugin, Params } from "@webiny/db-dynamodb/plugins/definitions/AttributePlugin";
1
+ import { AttributePlugin, AttributePluginParams } from "@webiny/db-dynamodb/plugins/definitions/AttributePlugin";
2
2
  export declare class SystemAttributePlugin extends AttributePlugin {
3
- constructor(params: Omit<Params, "entity">);
3
+ constructor(params: Omit<AttributePluginParams, "entity">);
4
4
  }