@webiny/api-file-manager-ddb 0.0.0-mt-2 → 0.0.0-unstable.1145e7667f
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.
- package/definitions/filesEntity.d.ts +3 -2
- package/definitions/filesEntity.js +3 -7
- package/definitions/filesEntity.js.map +1 -0
- package/definitions/settingsEntity.d.ts +3 -4
- package/definitions/settingsEntity.js +9 -27
- package/definitions/settingsEntity.js.map +1 -0
- package/definitions/systemEntity.d.ts +3 -4
- package/definitions/systemEntity.js +5 -17
- package/definitions/systemEntity.js.map +1 -0
- package/definitions/table.d.ts +6 -5
- package/definitions/table.js +14 -17
- package/definitions/table.js.map +1 -0
- package/index.d.ts +9 -5
- package/index.js +52 -11
- package/index.js.map +1 -0
- package/operations/files/FilesStorageOperations.d.ts +12 -8
- package/operations/files/FilesStorageOperations.js +182 -127
- package/operations/files/FilesStorageOperations.js.map +1 -0
- package/operations/files/fields.d.ts +1 -2
- package/operations/files/fields.js +3 -6
- package/operations/files/fields.js.map +1 -0
- package/operations/files/index.d.ts +2 -2
- package/operations/files/index.js +1 -1
- package/operations/files/index.js.map +1 -0
- package/operations/settings/SettingsStorageOperations.d.ts +7 -8
- package/operations/settings/SettingsStorageOperations.js +37 -64
- package/operations/settings/SettingsStorageOperations.js.map +1 -0
- package/operations/settings/index.d.ts +2 -4
- package/operations/settings/index.js +1 -1
- package/operations/settings/index.js.map +1 -0
- package/operations/system/SystemStorageOperations.d.ts +6 -7
- package/operations/system/SystemStorageOperations.js +16 -49
- package/operations/system/SystemStorageOperations.js.map +1 -0
- package/operations/system/index.d.ts +2 -4
- package/operations/system/index.js +1 -1
- package/operations/system/index.js.map +1 -0
- package/operations/utils.js +1 -11
- package/operations/utils.js.map +1 -0
- package/package.json +19 -18
- package/plugins/FileAttributePlugin.d.ts +2 -2
- package/plugins/FileAttributePlugin.js +4 -14
- package/plugins/FileAttributePlugin.js.map +1 -0
- package/plugins/FileDynamoDbFieldPlugin.js +1 -6
- package/plugins/FileDynamoDbFieldPlugin.js.map +1 -0
- package/plugins/SettingsAttributePlugin.d.ts +2 -2
- package/plugins/SettingsAttributePlugin.js +4 -14
- package/plugins/SettingsAttributePlugin.js.map +1 -0
- package/plugins/SystemAttributePlugin.d.ts +2 -2
- package/plugins/SystemAttributePlugin.js +3 -13
- package/plugins/SystemAttributePlugin.js.map +1 -0
- package/plugins/index.d.ts +4 -0
- package/plugins/index.js +49 -0
- package/plugins/index.js.map +1 -0
- package/types.js.map +1 -0
- package/operations/configurations.d.ts +0 -14
- package/operations/configurations.js +0 -22
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
2
|
import { FileManagerContext } from "@webiny/api-file-manager/types";
|
|
3
|
-
|
|
3
|
+
export interface FilesEntityParams {
|
|
4
4
|
context: FileManagerContext;
|
|
5
5
|
table: Table;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
|
+
declare const _default: (params: FilesEntityParams) => Entity<any>;
|
|
7
8
|
export default _default;
|
|
@@ -1,22 +1,18 @@
|
|
|
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
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
11
|
|
|
12
12
|
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
13
|
|
|
14
14
|
var _attributes = require("@webiny/db-dynamodb/utils/attributes");
|
|
15
15
|
|
|
16
|
-
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; }
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
16
|
var _default = params => {
|
|
21
17
|
const {
|
|
22
18
|
context,
|
|
@@ -27,7 +23,7 @@ var _default = params => {
|
|
|
27
23
|
return new _dynamodbToolbox.Entity({
|
|
28
24
|
name: entityName,
|
|
29
25
|
table,
|
|
30
|
-
attributes:
|
|
26
|
+
attributes: (0, _objectSpread2.default)({
|
|
31
27
|
PK: {
|
|
32
28
|
partitionKey: true
|
|
33
29
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["params","context","table","entityName","attributes","getExtraAttributes","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","id","key","size","meta","tags","createdOn","createdBy","tenant","locale","webinyVersion"],"sources":["filesEntity.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 FilesEntityParams {\n context: FileManagerContext;\n table: Table;\n}\nexport default (params: FilesEntityParams): Entity<any> => {\n const { context, table } = params;\n const entityName = \"Files\";\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 id: {\n type: \"string\"\n },\n key: {\n type: \"string\"\n },\n size: {\n type: \"number\"\n },\n type: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n meta: {\n type: \"map\"\n },\n tags: {\n type: \"list\"\n },\n createdOn: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n webinyVersion: {\n type: \"string\"\n },\n ...attributes\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;eAMgBA,MAAD,IAA4C;EACvD,MAAM;IAAEC,OAAF;IAAWC;EAAX,IAAqBF,MAA3B;EACA,MAAMG,UAAU,GAAG,OAAnB;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,EAAE,EAAE;QACAD,IAAI,EAAE;MADN,CAVE;MAaNE,GAAG,EAAE;QACDF,IAAI,EAAE;MADL,CAbC;MAgBNG,IAAI,EAAE;QACFH,IAAI,EAAE;MADJ,CAhBA;MAmBNA,IAAI,EAAE;QACFA,IAAI,EAAE;MADJ,CAnBA;MAsBNN,IAAI,EAAE;QACFM,IAAI,EAAE;MADJ,CAtBA;MAyBNI,IAAI,EAAE;QACFJ,IAAI,EAAE;MADJ,CAzBA;MA4BNK,IAAI,EAAE;QACFL,IAAI,EAAE;MADJ,CA5BA;MA+BNM,SAAS,EAAE;QACPN,IAAI,EAAE;MADC,CA/BL;MAkCNO,SAAS,EAAE;QACPP,IAAI,EAAE;MADC,CAlCL;MAqCNQ,MAAM,EAAE;QACJR,IAAI,EAAE;MADF,CArCF;MAwCNS,MAAM,EAAE;QACJT,IAAI,EAAE;MADF,CAxCF;MA2CNU,aAAa,EAAE;QACXV,IAAI,EAAE;MADK;IA3CT,GA8CHT,UA9CG;EAHI,CAAX,CAAP;AAoDH,C"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
|
-
|
|
3
|
-
declare const _default: (params: {
|
|
4
|
-
context: FileManagerContext;
|
|
2
|
+
export interface SettingsEntityParams {
|
|
5
3
|
table: Table;
|
|
6
|
-
}
|
|
4
|
+
}
|
|
5
|
+
declare const _default: (params: SettingsEntityParams) => Entity<any>;
|
|
7
6
|
export default _default;
|
|
@@ -1,56 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
7
|
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
|
-
|
|
14
|
-
var _attributes = require("@webiny/db-dynamodb/utils/attributes");
|
|
15
|
-
|
|
16
|
-
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; }
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
8
|
var _default = params => {
|
|
21
9
|
const {
|
|
22
|
-
context,
|
|
23
10
|
table
|
|
24
11
|
} = params;
|
|
25
|
-
const entityName = "Settings";
|
|
26
|
-
const attributes = (0, _attributes.getExtraAttributes)(context, entityName);
|
|
12
|
+
const entityName = "FM.Settings";
|
|
27
13
|
return new _dynamodbToolbox.Entity({
|
|
28
14
|
name: entityName,
|
|
29
15
|
table,
|
|
30
|
-
attributes:
|
|
16
|
+
attributes: {
|
|
31
17
|
PK: {
|
|
32
18
|
partitionKey: true
|
|
33
19
|
},
|
|
34
20
|
SK: {
|
|
35
21
|
sortKey: true
|
|
36
22
|
},
|
|
37
|
-
|
|
23
|
+
GSI1_PK: {
|
|
38
24
|
type: "string"
|
|
39
25
|
},
|
|
40
|
-
|
|
26
|
+
GSI1_SK: {
|
|
41
27
|
type: "string"
|
|
42
28
|
},
|
|
43
|
-
|
|
44
|
-
type: "number"
|
|
45
|
-
},
|
|
46
|
-
uploadMaxFileSize: {
|
|
47
|
-
type: "number"
|
|
48
|
-
},
|
|
49
|
-
srcPrefix: {
|
|
29
|
+
TYPE: {
|
|
50
30
|
type: "string"
|
|
31
|
+
},
|
|
32
|
+
data: {
|
|
33
|
+
type: "map"
|
|
51
34
|
}
|
|
52
|
-
}
|
|
35
|
+
}
|
|
53
36
|
});
|
|
54
37
|
};
|
|
55
|
-
|
|
56
38
|
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
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,6 @@
|
|
|
1
1
|
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
|
-
|
|
3
|
-
declare const _default: (params: {
|
|
4
|
-
context: FileManagerContext;
|
|
2
|
+
export interface SystemEntityParams {
|
|
5
3
|
table: Table;
|
|
6
|
-
}
|
|
4
|
+
}
|
|
5
|
+
declare const _default: (params: SystemEntityParams) => Entity<any>;
|
|
7
6
|
export default _default;
|
|
@@ -1,33 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
7
|
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
|
-
|
|
14
|
-
var _attributes = require("@webiny/db-dynamodb/utils/attributes");
|
|
15
|
-
|
|
16
|
-
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; }
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
8
|
var _default = params => {
|
|
21
9
|
const {
|
|
22
|
-
context,
|
|
23
10
|
table
|
|
24
11
|
} = params;
|
|
25
12
|
const entityName = "System";
|
|
26
|
-
const attributes = (0, _attributes.getExtraAttributes)(context, entityName);
|
|
27
13
|
return new _dynamodbToolbox.Entity({
|
|
28
14
|
name: entityName,
|
|
29
15
|
table,
|
|
30
|
-
attributes:
|
|
16
|
+
attributes: {
|
|
31
17
|
PK: {
|
|
32
18
|
partitionKey: true
|
|
33
19
|
},
|
|
@@ -36,9 +22,11 @@ var _default = params => {
|
|
|
36
22
|
},
|
|
37
23
|
version: {
|
|
38
24
|
type: "string"
|
|
25
|
+
},
|
|
26
|
+
tenant: {
|
|
27
|
+
type: "string"
|
|
39
28
|
}
|
|
40
|
-
}
|
|
29
|
+
}
|
|
41
30
|
});
|
|
42
31
|
};
|
|
43
|
-
|
|
44
32
|
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/definitions/table.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { DocumentClient } from "aws-sdk/clients/dynamodb";
|
|
1
2
|
import { Table } from "dynamodb-toolbox";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export
|
|
3
|
+
export interface CreateTableParams {
|
|
4
|
+
table?: string;
|
|
5
|
+
documentClient: DocumentClient;
|
|
6
|
+
}
|
|
7
|
+
export declare const createTable: ({ table, documentClient }: CreateTableParams) => Table;
|
package/definitions/table.js
CHANGED
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
exports.
|
|
9
|
-
|
|
6
|
+
exports.createTable = void 0;
|
|
10
7
|
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _default = params => {
|
|
17
|
-
const {
|
|
18
|
-
context
|
|
19
|
-
} = params;
|
|
8
|
+
const createTable = ({
|
|
9
|
+
table,
|
|
10
|
+
documentClient
|
|
11
|
+
}) => {
|
|
20
12
|
return new _dynamodbToolbox.Table({
|
|
21
|
-
name:
|
|
13
|
+
name: table || String(process.env.DB_TABLE),
|
|
22
14
|
partitionKey: "PK",
|
|
23
15
|
sortKey: "SK",
|
|
24
|
-
DocumentClient:
|
|
16
|
+
DocumentClient: documentClient,
|
|
17
|
+
indexes: {
|
|
18
|
+
GSI1: {
|
|
19
|
+
partitionKey: "GSI1_PK",
|
|
20
|
+
sortKey: "GSI1_SK"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
25
23
|
});
|
|
26
24
|
};
|
|
27
|
-
|
|
28
|
-
exports.default = _default;
|
|
25
|
+
exports.createTable = createTable;
|
|
@@ -0,0 +1 @@
|
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
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
ADDED
|
@@ -0,0 +1 @@
|
|
|
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,
|
|
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
|
-
|
|
5
|
+
documentClient: DocumentClient;
|
|
6
|
+
plugins: PluginsContainer;
|
|
4
7
|
}
|
|
5
8
|
export declare class FilesStorageOperations implements FileManagerFilesStorageOperations {
|
|
6
|
-
private readonly
|
|
9
|
+
private readonly plugins;
|
|
7
10
|
private readonly table;
|
|
8
|
-
private readonly
|
|
9
|
-
private
|
|
10
|
-
constructor({
|
|
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
|
|
23
|
+
private createGSI1PartitionKey;
|
|
24
|
+
private createNewAliasesRecords;
|
|
21
25
|
}
|
|
22
26
|
export {};
|