pg-mvc-service 2.0.27 → 2.0.29
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/cron/BaseCron.js +30 -2
- package/package.json +1 -1
- package/src/cron/BaseCron.ts +33 -2
package/dist/cron/BaseCron.js
CHANGED
|
@@ -14,6 +14,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.BaseCron = void 0;
|
|
16
16
|
const PoolManager_1 = __importDefault(require("../PoolManager"));
|
|
17
|
+
const AwsS3Client_1 = require("../clients/AwsS3Client");
|
|
18
|
+
const Base64Client_1 = require("../clients/Base64Client");
|
|
17
19
|
class BaseCron {
|
|
18
20
|
constructor() {
|
|
19
21
|
this.isTest = process.env.NODE_ENV === 'test';
|
|
@@ -97,10 +99,36 @@ class BaseCron {
|
|
|
97
99
|
}
|
|
98
100
|
tearDown() {
|
|
99
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
-
|
|
101
|
-
this.
|
|
102
|
+
try {
|
|
103
|
+
if (this.isExecuteRollback === false) {
|
|
104
|
+
yield this.rollback();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
finally {
|
|
108
|
+
// クライアント接続をリリース
|
|
109
|
+
if (this.client) {
|
|
110
|
+
this.client.release();
|
|
111
|
+
this.client = undefined;
|
|
112
|
+
}
|
|
102
113
|
}
|
|
103
114
|
});
|
|
104
115
|
}
|
|
116
|
+
get S3Client() {
|
|
117
|
+
if (this.s3Client === undefined) {
|
|
118
|
+
this.s3Client = new AwsS3Client_1.AwsS3Client({
|
|
119
|
+
bucketName: process.env.S3_BUCKET_NAME,
|
|
120
|
+
region: process.env.S3_REGION,
|
|
121
|
+
accessKeyId: process.env.S3_ACCESS_KEY_ID,
|
|
122
|
+
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return this.s3Client;
|
|
126
|
+
}
|
|
127
|
+
get Base64Client() {
|
|
128
|
+
if (this.base64Client === undefined) {
|
|
129
|
+
this.base64Client = new Base64Client_1.Base64Client();
|
|
130
|
+
}
|
|
131
|
+
return this.base64Client;
|
|
132
|
+
}
|
|
105
133
|
}
|
|
106
134
|
exports.BaseCron = BaseCron;
|
package/package.json
CHANGED
package/src/cron/BaseCron.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Pool, PoolClient } from "pg";
|
|
2
2
|
import { DateType, DayType, HourType, MinuteSecondType, MonthType } from "./CronType";
|
|
3
3
|
import PoolManager from "../PoolManager";
|
|
4
|
+
import { AwsS3Client } from "../clients/AwsS3Client";
|
|
5
|
+
import { Base64Client } from "../clients/Base64Client";
|
|
4
6
|
|
|
5
7
|
export class BaseCron {
|
|
6
8
|
|
|
@@ -84,8 +86,37 @@ export class BaseCron {
|
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
public async tearDown() {
|
|
87
|
-
|
|
88
|
-
this.
|
|
89
|
+
try {
|
|
90
|
+
if (this.isExecuteRollback === false) {
|
|
91
|
+
await this.rollback();
|
|
92
|
+
}
|
|
93
|
+
} finally {
|
|
94
|
+
// クライアント接続をリリース
|
|
95
|
+
if (this.client) {
|
|
96
|
+
this.client.release();
|
|
97
|
+
this.client = undefined;
|
|
98
|
+
}
|
|
89
99
|
}
|
|
90
100
|
}
|
|
101
|
+
|
|
102
|
+
private s3Client?: AwsS3Client;
|
|
103
|
+
get S3Client(): AwsS3Client {
|
|
104
|
+
if (this.s3Client === undefined) {
|
|
105
|
+
this.s3Client = new AwsS3Client({
|
|
106
|
+
bucketName: process.env.S3_BUCKET_NAME,
|
|
107
|
+
region: process.env.S3_REGION,
|
|
108
|
+
accessKeyId: process.env.S3_ACCESS_KEY_ID,
|
|
109
|
+
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
return this.s3Client;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private base64Client? : Base64Client;
|
|
116
|
+
get Base64Client(): Base64Client {
|
|
117
|
+
if (this.base64Client === undefined) {
|
|
118
|
+
this.base64Client = new Base64Client();
|
|
119
|
+
}
|
|
120
|
+
return this.base64Client;
|
|
121
|
+
}
|
|
91
122
|
}
|