@adminforth/upload 1.0.30 → 1.0.31-next.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.
Files changed (3) hide show
  1. package/dist/index.js +14 -7
  2. package/index.ts +13 -7
  3. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -25,13 +25,20 @@ 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
- const s3 = new S3({
29
- credentials: {
30
- accessKeyId: this.options.s3AccessKeyId,
31
- secretAccessKey: this.options.s3SecretAccessKey,
32
- },
33
- region: this.options.s3Region,
34
- });
28
+ let s3;
29
+ try {
30
+ s3 = new S3({
31
+ credentials: {
32
+ accessKeyId: this.options.s3AccessKeyId,
33
+ secretAccessKey: this.options.s3SecretAccessKey,
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
+ }
35
42
  // check bucket exists
36
43
  const bucketExists = s3.headBucket({ Bucket: this.options.s3Bucket });
37
44
  if (!bucketExists) {
package/index.ts CHANGED
@@ -25,14 +25,20 @@ export default class UploadPlugin extends AdminForthPlugin {
25
25
  async setupLifecycleRule() {
26
26
  // check that lifecyle rule "adminforth-unused-cleaner" exists
27
27
  const CLEANUP_RULE_ID = 'adminforth-unused-cleaner';
28
- const s3 = new S3({
29
- credentials: {
30
- accessKeyId: this.options.s3AccessKeyId,
31
- secretAccessKey: this.options.s3SecretAccessKey,
32
- },
33
28
 
34
- region: this.options.s3Region,
35
- });
29
+ let s3;
30
+ try {
31
+ s3 = new S3({
32
+ credentials: {
33
+ accessKeyId: this.options.s3AccessKeyId,
34
+ secretAccessKey: this.options.s3SecretAccessKey,
35
+ },
36
+ region: this.options.s3Region,
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
+ }
36
42
  // check bucket exists
37
43
  const bucketExists = s3.headBucket({ Bucket: this.options.s3Bucket })
38
44
  if (!bucketExists) {
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@adminforth/upload",
3
- "version": "1.0.30",
3
+ "version": "1.0.31-next.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "rollout": "tsc && rsync -av --exclude 'node_modules' custom dist/ && npm version patch && npm publish --access public",
9
9
  "prepare": "npm link adminforth",
10
+ "rollout-next": "npm run build && npm version prerelease --preid=next && npm publish --tag next",
10
11
  "build": "tsc"
11
12
  },
12
13
  "type": "module",