@orion-js/file-manager 3.10.0 → 3.11.1
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.
|
@@ -12,41 +12,41 @@ const Files_1 = require("../Files");
|
|
|
12
12
|
exports.default = (0, resolvers_1.resolver)({
|
|
13
13
|
params: {
|
|
14
14
|
name: {
|
|
15
|
-
type: String
|
|
15
|
+
type: String,
|
|
16
16
|
},
|
|
17
17
|
size: {
|
|
18
|
-
type: Number
|
|
18
|
+
type: Number,
|
|
19
19
|
},
|
|
20
20
|
type: {
|
|
21
|
-
type: String
|
|
22
|
-
}
|
|
21
|
+
type: String,
|
|
22
|
+
},
|
|
23
23
|
},
|
|
24
24
|
returns: (0, models_1.createModel)({
|
|
25
25
|
name: 'UploadCredentials',
|
|
26
26
|
schema: {
|
|
27
27
|
fileId: {
|
|
28
|
-
type: 'ID'
|
|
28
|
+
type: 'ID',
|
|
29
29
|
},
|
|
30
30
|
url: {
|
|
31
|
-
type: String
|
|
31
|
+
type: String,
|
|
32
32
|
},
|
|
33
33
|
fields: {
|
|
34
|
-
type: 'blackbox'
|
|
34
|
+
type: 'blackbox',
|
|
35
35
|
},
|
|
36
36
|
key: {
|
|
37
|
-
type: String
|
|
38
|
-
}
|
|
39
|
-
}
|
|
37
|
+
type: String,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
40
|
}),
|
|
41
41
|
mutation: true,
|
|
42
42
|
async resolve(params, viewer) {
|
|
43
|
-
const { accessKeyId, secretAccessKey, region, bucket, endpoint, s3ForcePathStyle, canUpload, basePath } = (0, credentials_1.getAWSCredentials)();
|
|
43
|
+
const { accessKeyId, secretAccessKey, region, bucket, endpoint, s3ForcePathStyle, canUpload, basePath, } = (0, credentials_1.getAWSCredentials)();
|
|
44
44
|
const s3 = new aws_sdk_1.default.S3({
|
|
45
45
|
accessKeyId,
|
|
46
46
|
secretAccessKey,
|
|
47
47
|
region,
|
|
48
48
|
endpoint,
|
|
49
|
-
s3ForcePathStyle
|
|
49
|
+
s3ForcePathStyle,
|
|
50
50
|
});
|
|
51
51
|
if (canUpload) {
|
|
52
52
|
if (!(await canUpload(params, viewer)))
|
|
@@ -61,7 +61,7 @@ exports.default = (0, resolvers_1.resolver)({
|
|
|
61
61
|
size: params.size,
|
|
62
62
|
status: 'uploading',
|
|
63
63
|
createdBy: viewer.userId,
|
|
64
|
-
createdAt: new Date()
|
|
64
|
+
createdAt: new Date(),
|
|
65
65
|
});
|
|
66
66
|
const result = await new Promise((resolve, reject) => {
|
|
67
67
|
s3.createPresignedPost({
|
|
@@ -69,12 +69,14 @@ exports.default = (0, resolvers_1.resolver)({
|
|
|
69
69
|
Conditions: [
|
|
70
70
|
['content-length-range', params.size, params.size],
|
|
71
71
|
{ 'Content-Type': params.type },
|
|
72
|
-
{
|
|
72
|
+
{ 'Cache-Control': 'public, max-age=31536000, immutable' },
|
|
73
|
+
{ Key: key },
|
|
73
74
|
],
|
|
74
75
|
Fields: {
|
|
75
76
|
key: key,
|
|
76
|
-
'Content-Type': params.type
|
|
77
|
-
|
|
77
|
+
'Content-Type': params.type,
|
|
78
|
+
'Cache-Control': 'public, max-age=31536000, immutable',
|
|
79
|
+
},
|
|
78
80
|
}, function (error, data) {
|
|
79
81
|
if (error)
|
|
80
82
|
reject(error);
|
|
@@ -85,7 +87,7 @@ exports.default = (0, resolvers_1.resolver)({
|
|
|
85
87
|
return {
|
|
86
88
|
fileId,
|
|
87
89
|
...result,
|
|
88
|
-
key
|
|
90
|
+
key,
|
|
89
91
|
};
|
|
90
|
-
}
|
|
92
|
+
},
|
|
91
93
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/file-manager",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.1",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"author": "nicolaslopezj",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,27 +14,28 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@orion-js/helpers": "^3.10.0",
|
|
16
16
|
"@orion-js/models": "^3.10.0",
|
|
17
|
-
"@orion-js/mongodb": "^3.
|
|
18
|
-
"@orion-js/paginated-mongodb": "^3.
|
|
17
|
+
"@orion-js/mongodb": "^3.11.1",
|
|
18
|
+
"@orion-js/paginated-mongodb": "^3.11.1",
|
|
19
19
|
"@orion-js/resolvers": "^3.10.0",
|
|
20
20
|
"@orion-js/schema": "^3.10.0",
|
|
21
|
-
"@orion-js/typed-model": "^3.
|
|
21
|
+
"@orion-js/typed-model": "^3.11.1",
|
|
22
22
|
"aws-sdk": "^2.1367.0",
|
|
23
23
|
"escape-string-regexp": "^4.0.0",
|
|
24
24
|
"lodash": "^4.17.21",
|
|
25
25
|
"luxon": "^2.1.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@shelf/jest-mongodb": "^
|
|
28
|
+
"@shelf/jest-mongodb": "^4.3.2",
|
|
29
29
|
"@types/dot-object": "^2.1.2",
|
|
30
|
-
"@types/jest": "^
|
|
30
|
+
"@types/jest": "^29.5.12",
|
|
31
31
|
"@types/lodash": "4.14.181",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
32
|
+
"@types/node": "16.11.7",
|
|
33
|
+
"jest": "29.7.0",
|
|
34
|
+
"ts-jest": "29.1.2",
|
|
34
35
|
"typescript": "^4.6.3"
|
|
35
36
|
},
|
|
36
37
|
"publishConfig": {
|
|
37
38
|
"access": "public"
|
|
38
39
|
},
|
|
39
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "6d60b64d2b61ff2a74884cf4eb4eea806c2231c2"
|
|
40
41
|
}
|
package/globalConfig.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mongoUri":"mongodb://127.0.0.1:53531/"}
|