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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,7 +1,5 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
- import { FileManagerContext } from "@webiny/api-file-manager/types";
3
2
  export interface SettingsEntityParams {
4
- context: FileManagerContext;
5
3
  table: Table;
6
4
  }
7
5
  declare const _default: (params: SettingsEntityParams) => Entity<any>;
@@ -1,52 +1,38 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
7
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
- var _attributes = require("@webiny/db-dynamodb/utils/attributes");
15
-
16
8
  var _default = params => {
17
9
  const {
18
- context,
19
10
  table
20
11
  } = params;
21
- const entityName = "Settings";
22
- const attributes = (0, _attributes.getExtraAttributes)(context, entityName);
12
+ const entityName = "FM.Settings";
23
13
  return new _dynamodbToolbox.Entity({
24
14
  name: entityName,
25
15
  table,
26
- attributes: (0, _objectSpread2.default)({
16
+ attributes: {
27
17
  PK: {
28
18
  partitionKey: true
29
19
  },
30
20
  SK: {
31
21
  sortKey: true
32
22
  },
33
- TYPE: {
23
+ GSI1_PK: {
34
24
  type: "string"
35
25
  },
36
- key: {
26
+ GSI1_SK: {
37
27
  type: "string"
38
28
  },
39
- uploadMinFileSize: {
40
- type: "number"
41
- },
42
- uploadMaxFileSize: {
43
- type: "number"
44
- },
45
- srcPrefix: {
29
+ TYPE: {
46
30
  type: "string"
31
+ },
32
+ data: {
33
+ type: "map"
47
34
  }
48
- }, attributes)
35
+ }
49
36
  });
50
37
  };
51
-
52
38
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["params","context","table","entityName","attributes","getExtraAttributes","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","key","uploadMinFileSize","uploadMaxFileSize","srcPrefix"],"sources":["settingsEntity.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { FileManagerContext } from \"@webiny/api-file-manager/types\";\nimport { getExtraAttributes } from \"@webiny/db-dynamodb/utils/attributes\";\n\nexport interface SettingsEntityParams {\n context: FileManagerContext;\n table: Table;\n}\nexport default (params: SettingsEntityParams): Entity<any> => {\n const { context, table } = params;\n const entityName = \"Settings\";\n const attributes = getExtraAttributes(context, entityName);\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n key: {\n type: \"string\"\n },\n uploadMinFileSize: {\n type: \"number\"\n },\n uploadMaxFileSize: {\n type: \"number\"\n },\n srcPrefix: {\n type: \"string\"\n },\n ...attributes\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;eAMgBA,MAAD,IAA+C;EAC1D,MAAM;IAAEC,OAAF;IAAWC;EAAX,IAAqBF,MAA3B;EACA,MAAMG,UAAU,GAAG,UAAnB;EACA,MAAMC,UAAU,GAAG,IAAAC,8BAAA,EAAmBJ,OAAnB,EAA4BE,UAA5B,CAAnB;EACA,OAAO,IAAIG,uBAAJ,CAAW;IACdC,IAAI,EAAEJ,UADQ;IAEdD,KAFc;IAGdE,UAAU;MACNI,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,IAAI,EAAE;QACFC,IAAI,EAAE;MADJ,CAPA;MAUNC,GAAG,EAAE;QACDD,IAAI,EAAE;MADL,CAVC;MAaNE,iBAAiB,EAAE;QACfF,IAAI,EAAE;MADS,CAbb;MAgBNG,iBAAiB,EAAE;QACfH,IAAI,EAAE;MADS,CAhBb;MAmBNI,SAAS,EAAE;QACPJ,IAAI,EAAE;MADC;IAnBL,GAsBHT,UAtBG;EAHI,CAAX,CAAP;AA4BH,C"}
1
+ {"version":3,"names":["params","table","entityName","Entity","name","attributes","PK","partitionKey","SK","sortKey","GSI1_PK","type","GSI1_SK","TYPE","data"],"sources":["settingsEntity.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\n\nexport interface SettingsEntityParams {\n table: Table;\n}\nexport default (params: SettingsEntityParams): Entity<any> => {\n const { table } = params;\n const entityName = \"FM.Settings\";\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n }\n }\n });\n};\n"],"mappings":";;;;;;AAAA;AAAiD,eAKjCA,MAA4B,IAAkB;EAC1D,MAAM;IAAEC;EAAM,CAAC,GAAGD,MAAM;EACxB,MAAME,UAAU,GAAG,aAAa;EAChC,OAAO,IAAIC,uBAAM,CAAC;IACdC,IAAI,EAAEF,UAAU;IAChBD,KAAK;IACLI,UAAU,EAAE;MACRC,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,OAAO,EAAE;QACLD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAAA"}
@@ -1,7 +1,5 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
- import { FileManagerContext } from "@webiny/api-file-manager/types";
3
2
  export interface SystemEntityParams {
4
- context: FileManagerContext;
5
3
  table: Table;
6
4
  }
7
5
  declare const _default: (params: SystemEntityParams) => Entity<any>;
@@ -1,29 +1,19 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
7
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
- var _attributes = require("@webiny/db-dynamodb/utils/attributes");
15
-
16
8
  var _default = params => {
17
9
  const {
18
- context,
19
10
  table
20
11
  } = params;
21
12
  const entityName = "System";
22
- const attributes = (0, _attributes.getExtraAttributes)(context, entityName);
23
13
  return new _dynamodbToolbox.Entity({
24
14
  name: entityName,
25
15
  table,
26
- attributes: (0, _objectSpread2.default)({
16
+ attributes: {
27
17
  PK: {
28
18
  partitionKey: true
29
19
  },
@@ -36,8 +26,7 @@ var _default = params => {
36
26
  tenant: {
37
27
  type: "string"
38
28
  }
39
- }, attributes)
29
+ }
40
30
  });
41
31
  };
42
-
43
32
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["params","context","table","entityName","attributes","getExtraAttributes","Entity","name","PK","partitionKey","SK","sortKey","version","type","tenant"],"sources":["systemEntity.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { FileManagerContext } from \"@webiny/api-file-manager/types\";\nimport { getExtraAttributes } from \"@webiny/db-dynamodb/utils/attributes\";\n\nexport interface SystemEntityParams {\n context: FileManagerContext;\n table: Table;\n}\nexport default (params: SystemEntityParams): Entity<any> => {\n const { context, table } = params;\n const entityName = \"System\";\n const attributes = getExtraAttributes(context, entityName);\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n version: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n ...attributes\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;eAMgBA,MAAD,IAA6C;EACxD,MAAM;IAAEC,OAAF;IAAWC;EAAX,IAAqBF,MAA3B;EACA,MAAMG,UAAU,GAAG,QAAnB;EACA,MAAMC,UAAU,GAAG,IAAAC,8BAAA,EAAmBJ,OAAnB,EAA4BE,UAA5B,CAAnB;EACA,OAAO,IAAIG,uBAAJ,CAAW;IACdC,IAAI,EAAEJ,UADQ;IAEdD,KAFc;IAGdE,UAAU;MACNI,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,OAAO,EAAE;QACLC,IAAI,EAAE;MADD,CAPH;MAUNC,MAAM,EAAE;QACJD,IAAI,EAAE;MADF;IAVF,GAaHT,UAbG;EAHI,CAAX,CAAP;AAmBH,C"}
1
+ {"version":3,"names":["params","table","entityName","Entity","name","attributes","PK","partitionKey","SK","sortKey","version","type","tenant"],"sources":["systemEntity.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\n\nexport interface SystemEntityParams {\n table: Table;\n}\nexport default (params: SystemEntityParams): Entity<any> => {\n const { table } = params;\n const entityName = \"System\";\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n version: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n }\n }\n });\n};\n"],"mappings":";;;;;;AAAA;AAAiD,eAKjCA,MAA0B,IAAkB;EACxD,MAAM;IAAEC;EAAM,CAAC,GAAGD,MAAM;EACxB,MAAME,UAAU,GAAG,QAAQ;EAC3B,OAAO,IAAIC,uBAAM,CAAC;IACdC,IAAI,EAAEF,UAAU;IAChBD,KAAK;IACLI,UAAU,EAAE;MACRC,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,MAAM,EAAE;QACJD,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAAA"}
@@ -1,7 +1,7 @@
1
+ import { DocumentClient } from "aws-sdk/clients/dynamodb";
1
2
  import { Table } from "dynamodb-toolbox";
2
- import { FileManagerContext } from "@webiny/api-file-manager/types";
3
- export interface TableParams {
4
- context: FileManagerContext;
3
+ export interface CreateTableParams {
4
+ table?: string;
5
+ documentClient: DocumentClient;
5
6
  }
6
- declare const _default: (params: TableParams) => Table;
7
- export default _default;
7
+ export declare const createTable: ({ table, documentClient }: CreateTableParams) => Table;
@@ -3,22 +3,23 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
7
-
6
+ exports.createTable = void 0;
8
7
  var _dynamodbToolbox = require("dynamodb-toolbox");
9
-
10
- var _utils = require("../operations/utils");
11
-
12
- var _default = params => {
13
- const {
14
- context
15
- } = params;
8
+ const createTable = ({
9
+ table,
10
+ documentClient
11
+ }) => {
16
12
  return new _dynamodbToolbox.Table({
17
- name: process.env.DB_TABLE_FILE_MANGER || process.env.DB_TABLE || (0, _utils.getTable)(context),
13
+ name: table || String(process.env.DB_TABLE),
18
14
  partitionKey: "PK",
19
15
  sortKey: "SK",
20
- DocumentClient: (0, _utils.getDocumentClient)(context)
16
+ DocumentClient: documentClient,
17
+ indexes: {
18
+ GSI1: {
19
+ partitionKey: "GSI1_PK",
20
+ sortKey: "GSI1_SK"
21
+ }
22
+ }
21
23
  });
22
24
  };
23
-
24
- exports.default = _default;
25
+ exports.createTable = createTable;
@@ -1 +1 @@
1
- {"version":3,"names":["params","context","Table","name","process","env","DB_TABLE_FILE_MANGER","DB_TABLE","getTable","partitionKey","sortKey","DocumentClient","getDocumentClient"],"sources":["table.ts"],"sourcesContent":["import { Table } from \"dynamodb-toolbox\";\nimport { getDocumentClient, getTable } from \"~/operations/utils\";\nimport { FileManagerContext } from \"@webiny/api-file-manager/types\";\n\nexport interface TableParams {\n context: FileManagerContext;\n}\nexport default (params: TableParams): Table => {\n const { context } = params;\n return new Table({\n name: process.env.DB_TABLE_FILE_MANGER || process.env.DB_TABLE || getTable(context),\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: getDocumentClient(context)\n });\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;eAMgBA,MAAD,IAAgC;EAC3C,MAAM;IAAEC;EAAF,IAAcD,MAApB;EACA,OAAO,IAAIE,sBAAJ,CAAU;IACbC,IAAI,EAAEC,OAAO,CAACC,GAAR,CAAYC,oBAAZ,IAAoCF,OAAO,CAACC,GAAR,CAAYE,QAAhD,IAA4D,IAAAC,eAAA,EAASP,OAAT,CADrD;IAEbQ,YAAY,EAAE,IAFD;IAGbC,OAAO,EAAE,IAHI;IAIbC,cAAc,EAAE,IAAAC,wBAAA,EAAkBX,OAAlB;EAJH,CAAV,CAAP;AAMH,C"}
1
+ {"version":3,"names":["createTable","table","documentClient","Table","name","String","process","env","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1"],"sources":["table.ts"],"sourcesContent":["import { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport { Table } from \"dynamodb-toolbox\";\n\nexport interface CreateTableParams {\n table?: string;\n documentClient: DocumentClient;\n}\n\nexport const createTable = ({ table, documentClient }: CreateTableParams) => {\n return new Table({\n name: table || String(process.env.DB_TABLE),\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n indexes: {\n GSI1: {\n partitionKey: \"GSI1_PK\",\n sortKey: \"GSI1_SK\"\n }\n }\n });\n};\n"],"mappings":";;;;;;AACA;AAOO,MAAMA,WAAW,GAAG,CAAC;EAAEC,KAAK;EAAEC;AAAkC,CAAC,KAAK;EACzE,OAAO,IAAIC,sBAAK,CAAC;IACbC,IAAI,EAAEH,KAAK,IAAII,MAAM,CAACC,OAAO,CAACC,GAAG,CAACC,QAAQ,CAAC;IAC3CC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAET,cAAc;IAC9BU,OAAO,EAAE;MACLC,IAAI,EAAE;QACFJ,YAAY,EAAE,SAAS;QACvBC,OAAO,EAAE;MACb;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
package/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
- import { FilesStorageOperationsProviderDdb } from "./operations/files";
2
- import { SettingsStorageOperationsProviderDdbPlugin } from "./operations/settings";
3
- import { SystemStorageOperationsProviderDdbPlugin } from "./operations/system";
4
- declare const _default: () => (FilesStorageOperationsProviderDdb | SettingsStorageOperationsProviderDdbPlugin | SystemStorageOperationsProviderDdbPlugin)[];
5
- export default _default;
1
+ import { DocumentClient } from "aws-sdk/clients/dynamodb";
2
+ import { PluginCollection } from "@webiny/plugins/types";
3
+ import { FileManagerStorageOperations } from "@webiny/api-file-manager/types";
4
+ export interface StorageOperationsConfig {
5
+ documentClient: DocumentClient;
6
+ plugins?: PluginCollection;
7
+ }
8
+ export * from "./plugins";
9
+ export declare const createFileManagerStorageOperations: ({ documentClient, plugins: userPlugins }: StorageOperationsConfig) => FileManagerStorageOperations;
package/index.js CHANGED
@@ -1,16 +1,57 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.default = void 0;
7
-
8
- var _files = require("./operations/files");
9
-
10
- var _settings = require("./operations/settings");
11
-
12
- var _system = require("./operations/system");
13
-
14
- var _default = () => [new _files.FilesStorageOperationsProviderDdb(), new _settings.SettingsStorageOperationsProviderDdbPlugin(), new _system.SystemStorageOperationsProviderDdbPlugin()];
15
-
16
- exports.default = _default;
7
+ var _exportNames = {
8
+ createFileManagerStorageOperations: true
9
+ };
10
+ exports.createFileManagerStorageOperations = void 0;
11
+ var _plugins = _interopRequireDefault(require("@webiny/db-dynamodb/plugins"));
12
+ var _plugins2 = require("@webiny/plugins");
13
+ var _FilesStorageOperations = require("./operations/files/FilesStorageOperations");
14
+ var _SettingsStorageOperations = require("./operations/settings/SettingsStorageOperations");
15
+ var _SystemStorageOperations = require("./operations/system/SystemStorageOperations");
16
+ var _fields = require("./operations/files/fields");
17
+ var _plugins3 = require("./plugins");
18
+ Object.keys(_plugins3).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
21
+ if (key in exports && exports[key] === _plugins3[key]) return;
22
+ Object.defineProperty(exports, key, {
23
+ enumerable: true,
24
+ get: function () {
25
+ return _plugins3[key];
26
+ }
27
+ });
28
+ });
29
+ const createFileManagerStorageOperations = ({
30
+ documentClient,
31
+ plugins: userPlugins
32
+ }) => {
33
+ const plugins = new _plugins2.PluginsContainer([(0, _plugins.default)(),
34
+ // Built-in plugins
35
+ ...(0, _fields.createFileFieldsPlugins)(),
36
+ // User plugins
37
+ ...(userPlugins || [])]);
38
+ return {
39
+ beforeInit: async context => {
40
+ const types = [_plugins3.FileAttributePlugin.type, _plugins3.FileDynamoDbFieldPlugin.type, _plugins3.SettingsAttributePlugin.type, _plugins3.SystemAttributePlugin.type];
41
+ for (const type of types) {
42
+ plugins.mergeByType(context.plugins, type);
43
+ }
44
+ },
45
+ files: new _FilesStorageOperations.FilesStorageOperations({
46
+ plugins,
47
+ documentClient
48
+ }),
49
+ settings: new _SettingsStorageOperations.SettingsStorageOperations({
50
+ documentClient
51
+ }),
52
+ system: new _SystemStorageOperations.SystemStorageOperations({
53
+ documentClient
54
+ })
55
+ };
56
+ };
57
+ exports.createFileManagerStorageOperations = createFileManagerStorageOperations;
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["FilesStorageOperationsProviderDdb","SettingsStorageOperationsProviderDdbPlugin","SystemStorageOperationsProviderDdbPlugin"],"sources":["index.ts"],"sourcesContent":["import { FilesStorageOperationsProviderDdb } from \"./operations/files\";\nimport { SettingsStorageOperationsProviderDdbPlugin } from \"./operations/settings\";\nimport { SystemStorageOperationsProviderDdbPlugin } from \"./operations/system\";\n\nexport default () => [\n new FilesStorageOperationsProviderDdb(),\n new SettingsStorageOperationsProviderDdbPlugin(),\n new SystemStorageOperationsProviderDdbPlugin()\n];\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;eAEe,MAAM,CACjB,IAAIA,wCAAJ,EADiB,EAEjB,IAAIC,oDAAJ,EAFiB,EAGjB,IAAIC,gDAAJ,EAHiB,C"}
1
+ {"version":3,"names":["createFileManagerStorageOperations","documentClient","plugins","userPlugins","PluginsContainer","ddbPlugins","createFileFieldsPlugins","beforeInit","context","types","FileAttributePlugin","type","FileDynamoDbFieldPlugin","SettingsAttributePlugin","SystemAttributePlugin","mergeByType","files","FilesStorageOperations","settings","SettingsStorageOperations","system","SystemStorageOperations"],"sources":["index.ts"],"sourcesContent":["import { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport ddbPlugins from \"@webiny/db-dynamodb/plugins\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { PluginCollection } from \"@webiny/plugins/types\";\nimport { FileManagerStorageOperations } from \"@webiny/api-file-manager/types\";\nimport { FilesStorageOperations } from \"~/operations/files/FilesStorageOperations\";\nimport { SettingsStorageOperations } from \"~/operations/settings/SettingsStorageOperations\";\nimport { SystemStorageOperations } from \"~/operations/system/SystemStorageOperations\";\nimport { createFileFieldsPlugins } from \"~/operations/files/fields\";\nimport {\n FileAttributePlugin,\n FileDynamoDbFieldPlugin,\n SettingsAttributePlugin,\n SystemAttributePlugin\n} from \"./plugins\";\n\nexport interface StorageOperationsConfig {\n documentClient: DocumentClient;\n plugins?: PluginCollection;\n}\n\nexport * from \"./plugins\";\n\nexport const createFileManagerStorageOperations = ({\n documentClient,\n plugins: userPlugins\n}: StorageOperationsConfig): FileManagerStorageOperations => {\n const plugins = new PluginsContainer([\n ddbPlugins(),\n // Built-in plugins\n ...createFileFieldsPlugins(),\n // User plugins\n ...(userPlugins || [])\n ]);\n\n return {\n beforeInit: async context => {\n const types: string[] = [\n FileAttributePlugin.type,\n FileDynamoDbFieldPlugin.type,\n SettingsAttributePlugin.type,\n SystemAttributePlugin.type\n ];\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n },\n files: new FilesStorageOperations({ plugins, documentClient }),\n settings: new SettingsStorageOperations({ documentClient }),\n system: new SystemStorageOperations({ documentClient })\n };\n};\n"],"mappings":";;;;;;;;;;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAYA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAEO,MAAMA,kCAAkC,GAAG,CAAC;EAC/CC,cAAc;EACdC,OAAO,EAAEC;AACY,CAAC,KAAmC;EACzD,MAAMD,OAAO,GAAG,IAAIE,0BAAgB,CAAC,CACjC,IAAAC,gBAAU,GAAE;EACZ;EACA,GAAG,IAAAC,+BAAuB,GAAE;EAC5B;EACA,IAAIH,WAAW,IAAI,EAAE,CAAC,CACzB,CAAC;EAEF,OAAO;IACHI,UAAU,EAAE,MAAMC,OAAO,IAAI;MACzB,MAAMC,KAAe,GAAG,CACpBC,6BAAmB,CAACC,IAAI,EACxBC,iCAAuB,CAACD,IAAI,EAC5BE,iCAAuB,CAACF,IAAI,EAC5BG,+BAAqB,CAACH,IAAI,CAC7B;MACD,KAAK,MAAMA,IAAI,IAAIF,KAAK,EAAE;QACtBP,OAAO,CAACa,WAAW,CAACP,OAAO,CAACN,OAAO,EAAES,IAAI,CAAC;MAC9C;IACJ,CAAC;IACDK,KAAK,EAAE,IAAIC,8CAAsB,CAAC;MAAEf,OAAO;MAAED;IAAe,CAAC,CAAC;IAC9DiB,QAAQ,EAAE,IAAIC,oDAAyB,CAAC;MAAElB;IAAe,CAAC,CAAC;IAC3DmB,MAAM,EAAE,IAAIC,gDAAuB,CAAC;MAAEpB;IAAe,CAAC;EAC1D,CAAC;AACL,CAAC;AAAC"}
@@ -1,22 +1,26 @@
1
- import { File, FileManagerContext, FileManagerFilesStorageOperations, FileManagerFilesStorageOperationsCreateBatchParams, FileManagerFilesStorageOperationsCreateParams, FileManagerFilesStorageOperationsDeleteParams, FileManagerFilesStorageOperationsGetParams, FileManagerFilesStorageOperationsListParams, FileManagerFilesStorageOperationsListResponse, FileManagerFilesStorageOperationsTagsParams, FileManagerFilesStorageOperationsTagsResponse, FileManagerFilesStorageOperationsUpdateParams } from "@webiny/api-file-manager/types";
1
+ import { File, FileManagerFilesStorageOperations, FileManagerFilesStorageOperationsCreateBatchParams, FileManagerFilesStorageOperationsCreateParams, FileManagerFilesStorageOperationsDeleteParams, FileManagerFilesStorageOperationsGetParams, FileManagerFilesStorageOperationsListParams, FileManagerFilesStorageOperationsListResponse, FileManagerFilesStorageOperationsTagsParams, FileManagerFilesStorageOperationsTagsResponse, FileManagerFilesStorageOperationsUpdateParams } from "@webiny/api-file-manager/types";
2
+ import { DocumentClient } from "aws-sdk/clients/dynamodb";
3
+ import { PluginsContainer } from "@webiny/plugins";
2
4
  interface ConstructorParams {
3
- context: FileManagerContext;
5
+ documentClient: DocumentClient;
6
+ plugins: PluginsContainer;
4
7
  }
5
8
  export declare class FilesStorageOperations implements FileManagerFilesStorageOperations {
6
- private readonly _context;
9
+ private readonly plugins;
7
10
  private readonly table;
8
- private readonly entity;
9
- private get context();
10
- constructor({ context }: ConstructorParams);
11
+ private readonly fileEntity;
12
+ private readonly aliasEntity;
13
+ constructor({ documentClient, plugins }: ConstructorParams);
11
14
  get(params: FileManagerFilesStorageOperationsGetParams): Promise<File | null>;
12
15
  create(params: FileManagerFilesStorageOperationsCreateParams): Promise<File>;
13
16
  update(params: FileManagerFilesStorageOperationsUpdateParams): Promise<File>;
14
17
  delete(params: FileManagerFilesStorageOperationsDeleteParams): Promise<void>;
15
18
  createBatch(params: FileManagerFilesStorageOperationsCreateBatchParams): Promise<File[]>;
16
19
  list(params: FileManagerFilesStorageOperationsListParams): Promise<FileManagerFilesStorageOperationsListResponse>;
17
- tags(params: FileManagerFilesStorageOperationsTagsParams): Promise<FileManagerFilesStorageOperationsTagsResponse>;
20
+ tags(params: FileManagerFilesStorageOperationsTagsParams): Promise<FileManagerFilesStorageOperationsTagsResponse[]>;
18
21
  private createQueryAllOptions;
19
22
  private createPartitionKey;
20
- private createSortKey;
23
+ private createGSI1PartitionKey;
24
+ private createNewAliasesRecords;
21
25
  }
22
26
  export {};