@orion-js/file-manager 3.10.0 → 3.10.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
- { Key: key }
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.10.0",
3
+ "version": "3.10.1",
4
4
  "main": "lib/index.js",
5
5
  "author": "nicolaslopezj",
6
6
  "license": "MIT",
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "68036a0293066cc23feb3000ab44e58600540615"
39
+ "gitHead": "22755e5c49b74a061a83af98a38264856ef6d8be"
40
40
  }