@orion-js/file-manager 2.6.15 → 2.7.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.
@@ -48,6 +48,10 @@ var _default = {
48
48
  createdAt: {
49
49
  type: Date,
50
50
  optional: true
51
+ },
52
+ metadata: {
53
+ type: 'blackbox',
54
+ optional: true
51
55
  }
52
56
  };
53
57
  exports.default = _default;
@@ -9,7 +9,9 @@ exports.default = void 0;
9
9
 
10
10
  var _app = require("@orion-js/app");
11
11
 
12
- var _awsSdk = _interopRequireDefault(require("aws-sdk"));
12
+ var _clientS = require("@aws-sdk/client-s3");
13
+
14
+ var _s3PresignedPost = require("@aws-sdk/s3-presigned-post");
13
15
 
14
16
  var _credentials = require("../credentials");
15
17
 
@@ -55,10 +57,12 @@ var _default = (0, _app.resolver)({
55
57
  canUpload,
56
58
  basePath
57
59
  } = (0, _credentials.getAWSCredentials)();
58
- const s3 = new _awsSdk.default.S3({
59
- accessKeyId,
60
- secretAccessKey,
61
- region
60
+ const s3 = new _clientS.S3Client({
61
+ region,
62
+ credentials: {
63
+ accessKeyId,
64
+ secretAccessKey
65
+ }
62
66
  });
63
67
 
64
68
  if (canUpload) {
@@ -76,21 +80,17 @@ var _default = (0, _app.resolver)({
76
80
  createdBy: viewer.userId,
77
81
  createdAt: new Date()
78
82
  });
79
- const result = await new Promise((resolve, reject) => {
80
- s3.createPresignedPost({
81
- Bucket: bucket,
82
- Conditions: [['content-length-range', params.size, params.size], {
83
- 'Content-Type': params.type
84
- }, {
85
- Key: key
86
- }],
87
- Fields: {
88
- key: key,
89
- 'Content-Type': params.type
90
- }
91
- }, function (error, data) {
92
- if (error) reject(error);else resolve(data);
93
- });
83
+ const result = await (0, _s3PresignedPost.createPresignedPost)(s3, {
84
+ Bucket: bucket,
85
+ Conditions: [['content-length-range', params.size, params.size], {
86
+ 'Content-Type': params.type
87
+ }, {
88
+ Key: key
89
+ }],
90
+ Fields: {
91
+ key: key,
92
+ 'Content-Type': params.type
93
+ }
94
94
  });
95
95
  return {
96
96
  fileId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-js/file-manager",
3
- "version": "2.6.15",
3
+ "version": "2.7.0",
4
4
  "main": "lib/index.js",
5
5
  "author": "nicolaslopezj",
6
6
  "license": "MIT",
@@ -11,7 +11,8 @@
11
11
  "test": "exit 0"
12
12
  },
13
13
  "dependencies": {
14
- "aws-sdk": "^2.258.1",
14
+ "@aws-sdk/client-s3": "^3.682.0",
15
+ "@aws-sdk/s3-presigned-post": "^3.682.0",
15
16
  "lodash": "^4.17.10",
16
17
  "luxon": "^1.2.0"
17
18
  },
@@ -21,7 +22,7 @@
21
22
  "@babel/plugin-transform-runtime": "^7.5.5",
22
23
  "@babel/preset-env": "^7.5.5",
23
24
  "@babel/runtime": "^7.5.5",
24
- "@orion-js/app": "^2.6.15",
25
+ "@orion-js/app": "^2.7.0",
25
26
  "babel-jest": "^22.4.3",
26
27
  "jest": "^22.4.3"
27
28
  },
@@ -31,5 +32,5 @@
31
32
  "publishConfig": {
32
33
  "access": "public"
33
34
  },
34
- "gitHead": "4ba5e70419afb0996917c26a0e4ba5d4a5d71f8c"
35
+ "gitHead": "b6a9c4ad6b924ab3bf71b8dcd8bd7d7b9f274e4a"
35
36
  }