@adminforth/upload 1.0.31-next.0 → 1.0.31-next.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.
- package/dist/index.js +10 -14
- package/index.ts +5 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25,20 +25,13 @@ export default class UploadPlugin extends AdminForthPlugin {
|
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
26
|
// check that lifecyle rule "adminforth-unused-cleaner" exists
|
|
27
27
|
const CLEANUP_RULE_ID = 'adminforth-unused-cleaner';
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
region: this.options.s3Region,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
console.error('Unable to connect to S3. Upload will not work. Skipping setup of lifecycle rule', e);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
28
|
+
const s3 = new S3({
|
|
29
|
+
credentials: {
|
|
30
|
+
accessKeyId: this.options.s3AccessKeyId,
|
|
31
|
+
secretAccessKey: this.options.s3SecretAccessKey,
|
|
32
|
+
},
|
|
33
|
+
region: this.options.s3Region,
|
|
34
|
+
});
|
|
42
35
|
// check bucket exists
|
|
43
36
|
const bucketExists = s3.headBucket({ Bucket: this.options.s3Bucket });
|
|
44
37
|
if (!bucketExists) {
|
|
@@ -52,6 +45,9 @@ export default class UploadPlugin extends AdminForthPlugin {
|
|
|
52
45
|
}
|
|
53
46
|
catch (e) {
|
|
54
47
|
if (e.name !== 'NoSuchLifecycleConfiguration') {
|
|
48
|
+
console.error(`
|
|
49
|
+
⛔ Error getting lifecycle configuration, please check keys have permissions to
|
|
50
|
+
getBucketLifecycleConfiguration on bucket ${this.options.s3Bucket} in region ${this.options.s3Region}. Exception:`, e);
|
|
55
51
|
throw e;
|
|
56
52
|
}
|
|
57
53
|
else {
|
package/index.ts
CHANGED
|
@@ -26,19 +26,14 @@ export default class UploadPlugin extends AdminForthPlugin {
|
|
|
26
26
|
// check that lifecyle rule "adminforth-unused-cleaner" exists
|
|
27
27
|
const CLEANUP_RULE_ID = 'adminforth-unused-cleaner';
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
s3 = new S3({
|
|
29
|
+
const s3 = new S3({
|
|
32
30
|
credentials: {
|
|
33
31
|
accessKeyId: this.options.s3AccessKeyId,
|
|
34
32
|
secretAccessKey: this.options.s3SecretAccessKey,
|
|
35
33
|
},
|
|
36
34
|
region: this.options.s3Region,
|
|
37
35
|
});
|
|
38
|
-
|
|
39
|
-
console.error('Unable to connect to S3. Upload will not work. Skipping setup of lifecycle rule', e);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
36
|
+
|
|
42
37
|
// check bucket exists
|
|
43
38
|
const bucketExists = s3.headBucket({ Bucket: this.options.s3Bucket })
|
|
44
39
|
if (!bucketExists) {
|
|
@@ -53,6 +48,9 @@ export default class UploadPlugin extends AdminForthPlugin {
|
|
|
53
48
|
ruleExists = lifecycleConfig.Rules.some((rule: any) => rule.ID === CLEANUP_RULE_ID);
|
|
54
49
|
} catch (e: any) {
|
|
55
50
|
if (e.name !== 'NoSuchLifecycleConfiguration') {
|
|
51
|
+
console.error(`
|
|
52
|
+
⛔ Error getting lifecycle configuration, please check keys have permissions to
|
|
53
|
+
getBucketLifecycleConfiguration on bucket ${this.options.s3Bucket} in region ${this.options.s3Region}. Exception:`, e);
|
|
56
54
|
throw e;
|
|
57
55
|
} else {
|
|
58
56
|
ruleExists = false;
|