@webiny/api-file-manager-ddb 0.0.0-mt-3 → 0.0.0-unstable.2af142b57e

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 (50) hide show
  1. package/definitions/filesEntity.d.ts +3 -2
  2. package/definitions/filesEntity.js +3 -13
  3. package/definitions/filesEntity.js.map +1 -0
  4. package/definitions/settingsEntity.d.ts +3 -2
  5. package/definitions/settingsEntity.js +3 -13
  6. package/definitions/settingsEntity.js.map +1 -0
  7. package/definitions/systemEntity.d.ts +3 -2
  8. package/definitions/systemEntity.js +6 -13
  9. package/definitions/systemEntity.js.map +1 -0
  10. package/definitions/table.d.ts +3 -2
  11. package/definitions/table.js +1 -9
  12. package/definitions/table.js.map +1 -0
  13. package/index.js +0 -5
  14. package/index.js.map +1 -0
  15. package/operations/files/FilesStorageOperations.js +28 -65
  16. package/operations/files/FilesStorageOperations.js.map +1 -0
  17. package/operations/files/fields.js +0 -3
  18. package/operations/files/fields.js.map +1 -0
  19. package/operations/files/index.d.ts +2 -2
  20. package/operations/files/index.js +1 -10
  21. package/operations/files/index.js.map +1 -0
  22. package/operations/settings/SettingsStorageOperations.d.ts +3 -3
  23. package/operations/settings/SettingsStorageOperations.js +4 -27
  24. package/operations/settings/SettingsStorageOperations.js.map +1 -0
  25. package/operations/settings/index.d.ts +2 -4
  26. package/operations/settings/index.js +1 -9
  27. package/operations/settings/index.js.map +1 -0
  28. package/operations/system/SystemStorageOperations.d.ts +2 -2
  29. package/operations/system/SystemStorageOperations.js +5 -29
  30. package/operations/system/SystemStorageOperations.js.map +1 -0
  31. package/operations/system/index.d.ts +2 -4
  32. package/operations/system/index.js +1 -9
  33. package/operations/system/index.js.map +1 -0
  34. package/operations/utils.js +1 -11
  35. package/operations/utils.js.map +1 -0
  36. package/package.json +18 -18
  37. package/plugins/FileAttributePlugin.d.ts +2 -2
  38. package/plugins/FileAttributePlugin.js +3 -13
  39. package/plugins/FileAttributePlugin.js.map +1 -0
  40. package/plugins/FileDynamoDbFieldPlugin.js +1 -6
  41. package/plugins/FileDynamoDbFieldPlugin.js.map +1 -0
  42. package/plugins/SettingsAttributePlugin.d.ts +2 -2
  43. package/plugins/SettingsAttributePlugin.js +3 -13
  44. package/plugins/SettingsAttributePlugin.js.map +1 -0
  45. package/plugins/SystemAttributePlugin.d.ts +2 -2
  46. package/plugins/SystemAttributePlugin.js +3 -13
  47. package/plugins/SystemAttributePlugin.js.map +1 -0
  48. package/types.js.map +1 -0
  49. package/operations/configurations.d.ts +0 -14
  50. package/operations/configurations.js +0 -22
@@ -1,26 +1,19 @@
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.FilesStorageOperationsProviderDdb = void 0;
9
-
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
9
  var _FilesStorageOperationsProviderPlugin = require("@webiny/api-file-manager/plugins/definitions/FilesStorageOperationsProviderPlugin");
13
-
14
10
  var _FilesStorageOperations = require("./FilesStorageOperations");
15
-
16
11
  var _fields = _interopRequireDefault(require("./fields"));
17
-
18
12
  class FilesStorageOperationsProviderDdb extends _FilesStorageOperationsProviderPlugin.FilesStorageOperationsProviderPlugin {
19
13
  constructor(...args) {
20
14
  super(...args);
21
15
  (0, _defineProperty2.default)(this, "name", "fm.storageOperationsProvider.files.ddb");
22
16
  }
23
-
24
17
  async provide({
25
18
  context
26
19
  }) {
@@ -29,7 +22,5 @@ class FilesStorageOperationsProviderDdb extends _FilesStorageOperationsProviderP
29
22
  context
30
23
  });
31
24
  }
32
-
33
25
  }
34
-
35
26
  exports.FilesStorageOperationsProviderDdb = FilesStorageOperationsProviderDdb;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FilesStorageOperationsProviderDdb","FilesStorageOperationsProviderPlugin","provide","context","plugins","register","fields","FilesStorageOperations"],"sources":["index.ts"],"sourcesContent":["import {\n FilesStorageOperationsProviderPlugin,\n FilesStorageOperationsProviderPluginParams\n} from \"@webiny/api-file-manager/plugins/definitions/FilesStorageOperationsProviderPlugin\";\nimport { FilesStorageOperations } from \"./FilesStorageOperations\";\nimport fields from \"./fields\";\n\nexport class FilesStorageOperationsProviderDdb extends FilesStorageOperationsProviderPlugin {\n public override name = \"fm.storageOperationsProvider.files.ddb\";\n async provide({ context }: FilesStorageOperationsProviderPluginParams) {\n context.plugins.register(fields());\n return new FilesStorageOperations({\n context\n });\n }\n}\n"],"mappings":";;;;;;;;AAAA;AAIA;AACA;AAEO,MAAMA,iCAAiC,SAASC,0EAAoC,CAAC;EAAA;IAAA;IAAA,4CACjE,wCAAwC;EAAA;EAC/D,MAAMC,OAAO,CAAC;IAAEC;EAAoD,CAAC,EAAE;IACnEA,OAAO,CAACC,OAAO,CAACC,QAAQ,CAAC,IAAAC,eAAM,GAAE,CAAC;IAClC,OAAO,IAAIC,8CAAsB,CAAC;MAC9BJ;IACJ,CAAC,CAAC;EACN;AACJ;AAAC"}
@@ -1,13 +1,13 @@
1
1
  import { FileManagerContext, FileManagerSettings, FileManagerSettingsStorageOperations, FileManagerSettingsStorageOperationsCreateParams, FileManagerSettingsStorageOperationsUpdateParams } from "@webiny/api-file-manager/types";
2
- interface ConstructorParams {
2
+ interface SettingsStorageOperationsConstructorParams {
3
3
  context: FileManagerContext;
4
4
  }
5
5
  export declare class SettingsStorageOperations implements FileManagerSettingsStorageOperations {
6
6
  private readonly _context;
7
7
  private readonly _entity;
8
8
  private get partitionKey();
9
- constructor({ context }: ConstructorParams);
10
- get(): Promise<FileManagerSettings>;
9
+ constructor({ context }: SettingsStorageOperationsConstructorParams);
10
+ get(): Promise<FileManagerSettings | null>;
11
11
  create({ data }: FileManagerSettingsStorageOperationsCreateParams): Promise<FileManagerSettings>;
12
12
  update({ data }: FileManagerSettingsStorageOperationsUpdateParams): Promise<FileManagerSettings>;
13
13
  delete(): Promise<void>;
@@ -1,37 +1,24 @@
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
-
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 _table = _interopRequireDefault(require("../../definitions/table"));
15
-
16
12
  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
13
  const SORT_KEY = "default";
23
-
24
14
  class SettingsStorageOperations {
25
15
  get partitionKey() {
26
16
  const tenant = this._context.tenancy.getCurrentTenant();
27
-
28
17
  if (!tenant) {
29
18
  throw new _error.default("Tenant missing.", "TENANT_NOT_FOUND");
30
19
  }
31
-
32
20
  return `T#${tenant.id}#FM#SETTINGS`;
33
21
  }
34
-
35
22
  constructor({
36
23
  context
37
24
  }) {
@@ -46,24 +33,20 @@ class SettingsStorageOperations {
46
33
  table
47
34
  });
48
35
  }
49
-
50
36
  async get() {
51
37
  try {
52
38
  const settings = await this._entity.get({
53
39
  PK: this.partitionKey,
54
40
  SK: SORT_KEY
55
41
  });
56
-
57
42
  if (!settings || !settings.Item) {
58
43
  return null;
59
44
  }
60
-
61
45
  return settings.Item;
62
46
  } catch (ex) {
63
47
  throw new _error.default(ex.message || "Could not fetch the FileManager settings.", ex.code || "GET_SETTINGS_ERROR");
64
48
  }
65
49
  }
66
-
67
50
  async create({
68
51
  data
69
52
  }) {
@@ -71,16 +54,14 @@ class SettingsStorageOperations {
71
54
  /**
72
55
  * TODO: check if need to throw an error on existing settings
73
56
  */
74
-
75
57
  if (original) {
76
58
  return await this.update({
77
59
  original,
78
60
  data
79
61
  });
80
62
  }
81
-
82
63
  try {
83
- await this._entity.put(_objectSpread({
64
+ await this._entity.put((0, _objectSpread2.default)({
84
65
  PK: this.partitionKey,
85
66
  SK: SORT_KEY
86
67
  }, data));
@@ -91,12 +72,11 @@ class SettingsStorageOperations {
91
72
  });
92
73
  }
93
74
  }
94
-
95
75
  async update({
96
76
  data
97
77
  }) {
98
78
  try {
99
- await this._entity.update(_objectSpread({
79
+ await this._entity.update((0, _objectSpread2.default)({
100
80
  PK: this.partitionKey,
101
81
  SK: SORT_KEY
102
82
  }, data));
@@ -107,14 +87,11 @@ class SettingsStorageOperations {
107
87
  });
108
88
  }
109
89
  }
110
-
111
90
  async delete() {
112
91
  return this._entity.delete({
113
92
  PK: this.partitionKey,
114
93
  SK: SORT_KEY
115
94
  });
116
95
  }
117
-
118
96
  }
119
-
120
97
  exports.SettingsStorageOperations = SettingsStorageOperations;
@@ -0,0 +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,SAAS;AAEnB,MAAMC,yBAAyB,CAAiD;EAInF,IAAYC,YAAY,GAAW;IAC/B,MAAMC,MAAM,GAAG,IAAI,CAACC,QAAQ,CAACC,OAAO,CAACC,gBAAgB,EAAE;IACvD,IAAI,CAACH,MAAM,EAAE;MACT,MAAM,IAAII,cAAW,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;IAChE;IACA,OAAQ,KAAIJ,MAAM,CAACK,EAAG,cAAa;EACvC;EAEOC,WAAW,CAAC;IAAEC;EAAoD,CAAC,EAAE;IAAA;IAAA;IACxE,IAAI,CAACN,QAAQ,GAAGM,OAAO;IACvB,MAAMC,KAAK,GAAG,IAAAC,cAAW,EAAC;MACtBF;IACJ,CAAC,CAAC;IAEF,IAAI,CAACG,OAAO,GAAG,IAAAC,uBAAoB,EAAC;MAChCJ,OAAO;MACPC;IACJ,CAAC,CAAC;EACN;EAEA,MAAaI,GAAG,GAAwC;IACpD,IAAI;MACA,MAAMC,QAAQ,GAAG,MAAM,IAAI,CAACH,OAAO,CAACE,GAAG,CAAC;QACpCE,EAAE,EAAE,IAAI,CAACf,YAAY;QACrBgB,EAAE,EAAElB;MACR,CAAC,CAAC;MACF,IAAI,CAACgB,QAAQ,IAAI,CAACA,QAAQ,CAACG,IAAI,EAAE;QAC7B,OAAO,IAAI;MACf;MACA,OAAOH,QAAQ,CAACG,IAAI;IACxB,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,MAAM,IAAIb,cAAW,CACjBa,EAAE,CAACC,OAAO,IAAI,2CAA2C,EACzDD,EAAE,CAACE,IAAI,IAAI,oBAAoB,CAClC;IACL;EACJ;EAEA,MAAaC,MAAM,CAAC;IAChBC;EAC8C,CAAC,EAAgC;IAC/E,MAAMC,QAAQ,GAAG,MAAM,IAAI,CAACV,GAAG,EAAE;IACjC;AACR;AACA;IACQ,IAAIU,QAAQ,EAAE;MACV,OAAO,MAAM,IAAI,CAACC,MAAM,CAAC;QAAED,QAAQ;QAAED;MAAK,CAAC,CAAC;IAChD;IAEA,IAAI;MACA,MAAM,IAAI,CAACX,OAAO,CAACc,GAAG;QAClBV,EAAE,EAAE,IAAI,CAACf,YAAY;QACrBgB,EAAE,EAAElB;MAAQ,GACTwB,IAAI,EACT;MACF,OAAOA,IAAI;IACf,CAAC,CAAC,OAAOJ,EAAE,EAAE;MACT,MAAM,IAAIb,cAAW,CACjBa,EAAE,CAACC,OAAO,IAAI,qCAAqC,EACnDD,EAAE,CAACE,IAAI,IAAI,0BAA0B,EACrC;QACIE;MACJ,CAAC,CACJ;IACL;EACJ;EAEA,MAAaE,MAAM,CAAC;IAChBF;EAC8C,CAAC,EAAgC;IAC/E,IAAI;MACA,MAAM,IAAI,CAACX,OAAO,CAACa,MAAM;QACrBT,EAAE,EAAE,IAAI,CAACf,YAAY;QACrBgB,EAAE,EAAElB;MAAQ,GACTwB,IAAI,EACT;MACF,OAAOA,IAAI;IACf,CAAC,CAAC,OAAOJ,EAAE,EAAE;MACT,MAAM,IAAIb,cAAW,CACjBa,EAAE,CAACC,OAAO,IAAI,qCAAqC,EACnDD,EAAE,CAACE,IAAI,IAAI,0BAA0B,EACrC;QACIE;MACJ,CAAC,CACJ;IACL;EACJ;EAEA,MAAaI,MAAM,GAAkB;IACjC,OAAO,IAAI,CAACf,OAAO,CAACe,MAAM,CAAC;MACvBX,EAAE,EAAE,IAAI,CAACf,YAAY;MACrBgB,EAAE,EAAElB;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,24 +1,18 @@
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.SettingsStorageOperationsProviderDdbPlugin = void 0;
9
-
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
9
  var _SettingsStorageOperations = require("./SettingsStorageOperations");
13
-
14
10
  var _SettingsStorageOperationsProviderPlugin = require("@webiny/api-file-manager/plugins/definitions/SettingsStorageOperationsProviderPlugin");
15
-
16
11
  class SettingsStorageOperationsProviderDdbPlugin extends _SettingsStorageOperationsProviderPlugin.SettingsStorageOperationsProviderPlugin {
17
12
  constructor(...args) {
18
13
  super(...args);
19
14
  (0, _defineProperty2.default)(this, "name", "fm.storageOperationsProvider.settings.ddb");
20
15
  }
21
-
22
16
  async provide({
23
17
  context
24
18
  }) {
@@ -26,7 +20,5 @@ class SettingsStorageOperationsProviderDdbPlugin extends _SettingsStorageOperati
26
20
  context
27
21
  });
28
22
  }
29
-
30
23
  }
31
-
32
24
  exports.SettingsStorageOperationsProviderDdbPlugin = SettingsStorageOperationsProviderDdbPlugin;
@@ -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,0CAA0C,SAASC,gFAAuC,CAAC;EAAA;IAAA;IAAA,4CAC7E,2CAA2C;EAAA;EAElE,MAAaC,OAAO,CAAC;IAAEC;EAAuD,CAAC,EAAE;IAC7E,OAAO,IAAIC,oDAAyB,CAAC;MACjCD;IACJ,CAAC,CAAC;EACN;AACJ;AAAC"}
@@ -1,12 +1,12 @@
1
1
  import { FileManagerContext, FileManagerSystem, FileManagerSystemStorageOperations, FileManagerSystemStorageOperationsCreateParams, FileManagerSystemStorageOperationsUpdateParams } from "@webiny/api-file-manager/types";
2
- interface ConstructorParams {
2
+ interface SystemStorageOperationsConstructorParams {
3
3
  context: FileManagerContext;
4
4
  }
5
5
  export declare class SystemStorageOperations implements FileManagerSystemStorageOperations {
6
6
  private readonly _context;
7
7
  private readonly _entity;
8
8
  private get partitionKey();
9
- constructor({ context }: ConstructorParams);
9
+ constructor({ context }: SystemStorageOperationsConstructorParams);
10
10
  get(): Promise<FileManagerSystem | null>;
11
11
  create(params: FileManagerSystemStorageOperationsCreateParams): Promise<FileManagerSystem>;
12
12
  update(params: FileManagerSystemStorageOperationsUpdateParams): Promise<FileManagerSystem>;
@@ -1,37 +1,24 @@
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
12
  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
-
22
13
  const SORT_KEY = "FM";
23
-
24
14
  class SystemStorageOperations {
25
15
  get partitionKey() {
26
16
  const tenant = this._context.tenancy.getCurrentTenant();
27
-
28
17
  if (!tenant) {
29
18
  throw new _error.default("Tenant missing.", "TENANT_NOT_FOUND");
30
19
  }
31
-
32
20
  return `T#${tenant.id}#SYSTEM`;
33
21
  }
34
-
35
22
  constructor({
36
23
  context
37
24
  }) {
@@ -46,31 +33,26 @@ class SystemStorageOperations {
46
33
  table
47
34
  });
48
35
  }
49
-
50
36
  async get() {
51
37
  try {
52
38
  const system = await this._entity.get({
53
39
  PK: this.partitionKey,
54
40
  SK: SORT_KEY
55
41
  });
56
-
57
42
  if (!system || !system.Item) {
58
43
  return null;
59
44
  }
60
-
61
45
  return system.Item;
62
46
  } catch (ex) {
63
47
  throw new _error.default(ex.message || "Could not fetch the FileManager system.", ex.code || "GET_SYSTEM_ERROR");
64
48
  }
65
49
  }
66
-
67
50
  async create(params) {
68
51
  const {
69
52
  data
70
53
  } = params;
71
-
72
54
  try {
73
- await this._entity.put(_objectSpread({
55
+ await this._entity.put((0, _objectSpread2.default)({
74
56
  PK: this.partitionKey,
75
57
  SK: SORT_KEY
76
58
  }, data));
@@ -79,18 +61,15 @@ class SystemStorageOperations {
79
61
  data
80
62
  });
81
63
  }
82
-
83
64
  return data;
84
65
  }
85
-
86
66
  async update(params) {
87
67
  const {
88
68
  original,
89
69
  data
90
70
  } = params;
91
-
92
71
  try {
93
- await this._entity.update(_objectSpread({
72
+ await this._entity.update((0, _objectSpread2.default)({
94
73
  PK: this.partitionKey,
95
74
  SK: SORT_KEY
96
75
  }, data));
@@ -99,10 +78,7 @@ class SystemStorageOperations {
99
78
  data
100
79
  });
101
80
  }
102
-
103
- return _objectSpread(_objectSpread({}, original), data);
81
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, original), data);
104
82
  }
105
-
106
83
  }
107
-
108
84
  exports.SystemStorageOperations = SystemStorageOperations;
@@ -0,0 +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,IAAI;AAEd,MAAMC,uBAAuB,CAA+C;EAI/E,IAAYC,YAAY,GAAW;IAC/B,MAAMC,MAAM,GAAG,IAAI,CAACC,QAAQ,CAACC,OAAO,CAACC,gBAAgB,EAAE;IACvD,IAAI,CAACH,MAAM,EAAE;MACT,MAAM,IAAII,cAAW,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;IAChE;IACA,OAAQ,KAAIJ,MAAM,CAACK,EAAG,SAAQ;EAClC;EAEOC,WAAW,CAAC;IAAEC;EAAkD,CAAC,EAAE;IAAA;IAAA;IACtE,IAAI,CAACN,QAAQ,GAAGM,OAAO;IACvB,MAAMC,KAAK,GAAG,IAAAC,cAAW,EAAC;MACtBF;IACJ,CAAC,CAAC;IAEF,IAAI,CAACG,OAAO,GAAG,IAAAC,qBAAkB,EAAC;MAC9BJ,OAAO;MACPC;IACJ,CAAC,CAAC;EACN;EAEA,MAAaI,GAAG,GAAsC;IAClD,IAAI;MACA,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACH,OAAO,CAACE,GAAG,CAAC;QAClCE,EAAE,EAAE,IAAI,CAACf,YAAY;QACrBgB,EAAE,EAAElB;MACR,CAAC,CAAC;MACF,IAAI,CAACgB,MAAM,IAAI,CAACA,MAAM,CAACG,IAAI,EAAE;QACzB,OAAO,IAAI;MACf;MACA,OAAOH,MAAM,CAACG,IAAI;IACtB,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,MAAM,IAAIb,cAAW,CACjBa,EAAE,CAACC,OAAO,IAAI,yCAAyC,EACvDD,EAAE,CAACE,IAAI,IAAI,kBAAkB,CAChC;IACL;EACJ;EAEA,MAAaC,MAAM,CACfC,MAAsD,EAC5B;IAC1B,MAAM;MAAEC;IAAK,CAAC,GAAGD,MAAM;IACvB,IAAI;MACA,MAAM,IAAI,CAACX,OAAO,CAACa,GAAG;QAClBT,EAAE,EAAE,IAAI,CAACf,YAAY;QACrBgB,EAAE,EAAElB;MAAQ,GACTyB,IAAI,EACT;IACN,CAAC,CAAC,OAAOL,EAAE,EAAE;MACT,MAAM,IAAIb,cAAW,CACjB,gDAAgD,EAChD,qBAAqB,EACrB;QACIkB;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,CAACX,OAAO,CAACc,MAAM;QACrBV,EAAE,EAAE,IAAI,CAACf,YAAY;QACrBgB,EAAE,EAAElB;MAAQ,GACTyB,IAAI,EACT;IACN,CAAC,CAAC,OAAOL,EAAE,EAAE;MACT,MAAM,IAAIb,cAAW,CACjB,+CAA+C,EAC/C,qBAAqB,EACrB;QACIkB;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,24 +1,18 @@
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.SystemStorageOperationsProviderDdbPlugin = void 0;
9
-
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
9
  var _SystemStorageOperations = require("./SystemStorageOperations");
13
-
14
10
  var _SystemStorageOperationsProviderPlugin = require("@webiny/api-file-manager/plugins/definitions/SystemStorageOperationsProviderPlugin");
15
-
16
11
  class SystemStorageOperationsProviderDdbPlugin extends _SystemStorageOperationsProviderPlugin.SystemStorageOperationsProviderPlugin {
17
12
  constructor(...args) {
18
13
  super(...args);
19
14
  (0, _defineProperty2.default)(this, "name", "fm.storageOperationsProvider.system.ddb");
20
15
  }
21
-
22
16
  async provide({
23
17
  context
24
18
  }) {
@@ -26,7 +20,5 @@ class SystemStorageOperationsProviderDdbPlugin extends _SystemStorageOperationsP
26
20
  context
27
21
  });
28
22
  }
29
-
30
23
  }
31
-
32
24
  exports.SystemStorageOperationsProviderDdbPlugin = SystemStorageOperationsProviderDdbPlugin;
@@ -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,wCAAwC,SAASC,4EAAqC,CAAC;EAAA;IAAA;IAAA,4CACzE,yCAAyC;EAAA;EAChE,MAAaC,OAAO,CAAC;IAAEC;EAAqD,CAAC,EAAE;IAC3E,OAAO,IAAIC,gDAAuB,CAAC;MAC/BD;IACJ,CAAC,CAAC;EACN;AACJ;AAAC"}
@@ -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.2af142b57e",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "@webiny/api-file-manager",
@@ -21,28 +21,28 @@
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.2af142b57e",
26
+ "@webiny/db-dynamodb": "0.0.0-unstable.2af142b57e",
27
+ "@webiny/error": "0.0.0-unstable.2af142b57e",
28
+ "@webiny/project-utils": "0.0.0-unstable.2af142b57e",
29
+ "aws-sdk": "2.1310.0",
30
+ "dynamodb-toolbox": "0.3.5"
31
31
  },
32
32
  "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",
33
+ "@babel/cli": "^7.19.3",
34
+ "@babel/core": "^7.19.3",
35
+ "@babel/plugin-proposal-object-rest-spread": "^7.16.0",
36
+ "@babel/plugin-transform-runtime": "^7.16.4",
37
+ "@babel/preset-env": "^7.19.4",
38
+ "@babel/preset-typescript": "^7.18.6",
39
+ "@webiny/cli": "^0.0.0-unstable.2af142b57e",
40
+ "jest": "^28.1.0",
41
41
  "jest-dynalite": "^3.2.0",
42
42
  "jsonpack": "^1.1.5",
43
43
  "rimraf": "^3.0.2",
44
44
  "ttypescript": "^1.5.12",
45
- "typescript": "^4.1.3"
45
+ "typescript": "4.7.4"
46
46
  },
47
47
  "publishConfig": {
48
48
  "access": "public",
@@ -63,5 +63,5 @@
63
63
  ]
64
64
  }
65
65
  },
66
- "gitHead": "ebea815be2be99404591cba465cc1fe88355bd48"
66
+ "gitHead": "2af142b57e7cdc433f5098b3b6d43ae6caa5d54e"
67
67
  }
@@ -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), {}, {
12
+ super((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
21
13
  entity: "Files"
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: \"Files\"\n });\n }\n}\n"],"mappings":";;;;;;;;AAAA;AAKO,MAAMA,mBAAmB,SAASC,gCAAe,CAAC;EAC9CC,WAAW,CAACC,MAA6C,EAAE;IAC9D,KAAK,6DACEA,MAAM;MACTC,MAAM,EAAE;IAAO,GACjB;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), {}, {
12
+ super((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
21
13
  entity: "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: \"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;IAAU,GACpB;EACN;AACJ;AAAC"}