pg-mvc-service 2.1.38 → 2.1.40
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/{Service.d.ts → Controller.d.ts} +13 -25
- package/dist/Controller.d.ts.map +1 -0
- package/dist/{Service.js → Controller.js} +76 -99
- package/dist/cron/BaseCron.d.ts +0 -3
- package/dist/cron/BaseCron.d.ts.map +1 -1
- package/dist/cron/BaseCron.js +0 -12
- package/dist/documents/Swagger.d.ts +2 -2
- package/dist/documents/Swagger.d.ts.map +1 -1
- package/dist/documents/Swagger.js +11 -11
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -5
- package/dist/reqestResponse/RequestType.d.ts +1 -1
- package/dist/reqestResponse/RequestType.d.ts.map +1 -1
- package/dist/reqestResponse/ResponseType.d.ts +1 -1
- package/dist/reqestResponse/ResponseType.d.ts.map +1 -1
- package/package.json +1 -8
- package/dist/Service.d.ts.map +0 -1
- package/dist/clients/AwsS3Client.d.ts +0 -34
- package/dist/clients/AwsS3Client.d.ts.map +0 -1
- package/dist/clients/AwsS3Client.js +0 -325
|
@@ -4,7 +4,6 @@ import { Context, TypedResponse } from 'hono';
|
|
|
4
4
|
import { Pool, type PoolClient } from 'pg';
|
|
5
5
|
import { RequestType } from './reqestResponse/RequestType';
|
|
6
6
|
import { ResponseType } from './reqestResponse/ResponseType';
|
|
7
|
-
import { AwsS3Client } from './clients/AwsS3Client';
|
|
8
7
|
import { StringClient } from './clients/StringClient';
|
|
9
8
|
import { EncryptClient } from './clients/EncryptClient';
|
|
10
9
|
type TStatusCode = 200 | 201 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 503;
|
|
@@ -14,7 +13,7 @@ export interface IError {
|
|
|
14
13
|
code: string;
|
|
15
14
|
description: string;
|
|
16
15
|
}
|
|
17
|
-
interface
|
|
16
|
+
interface IBaseEnv {
|
|
18
17
|
DB_USER?: string;
|
|
19
18
|
DB_HOST?: string;
|
|
20
19
|
DB_DATABASE?: string;
|
|
@@ -22,14 +21,10 @@ interface IServiceEnv {
|
|
|
22
21
|
DB_PORT?: string | number;
|
|
23
22
|
DB_IS_SSL?: string;
|
|
24
23
|
TZ?: string;
|
|
25
|
-
S3_BUCKET_NAME?: string;
|
|
26
|
-
S3_REGION?: string;
|
|
27
|
-
S3_ACCESS_KEY_ID?: string;
|
|
28
|
-
S3_SECRET_ACCESS_KEY?: string;
|
|
29
24
|
SECRET_KEY_HEX?: string;
|
|
30
25
|
HMAC_KEY_BASE64?: string;
|
|
31
26
|
}
|
|
32
|
-
export declare class
|
|
27
|
+
export declare class Controller<IEnv extends IBaseEnv = IBaseEnv> {
|
|
33
28
|
protected readonly method: MethodType;
|
|
34
29
|
get Method(): MethodType;
|
|
35
30
|
protected readonly endpoint: string;
|
|
@@ -48,6 +43,12 @@ export declare class Service<IEnv extends IServiceEnv = IServiceEnv> {
|
|
|
48
43
|
get Tags(): Array<string>;
|
|
49
44
|
protected readonly errorList: Array<IError>;
|
|
50
45
|
get ErrorList(): Array<IError>;
|
|
46
|
+
protected readonly isSetDbConnection: boolean;
|
|
47
|
+
protected main(): Promise<void>;
|
|
48
|
+
protected middleware(): Promise<void>;
|
|
49
|
+
protected outputSuccessLog(): Promise<void>;
|
|
50
|
+
protected outputErrorLog(ex: any): Promise<void>;
|
|
51
|
+
run(): Promise<void | Response<any, Record<string, any>> | TypedResponse<any>>;
|
|
51
52
|
private readonly req?;
|
|
52
53
|
protected get Req(): Request;
|
|
53
54
|
private readonly res?;
|
|
@@ -75,7 +76,6 @@ export declare class Service<IEnv extends IServiceEnv = IServiceEnv> {
|
|
|
75
76
|
get Env(): IEnv;
|
|
76
77
|
constructor(request: Request, response: Response);
|
|
77
78
|
constructor(c: Context);
|
|
78
|
-
inintialize(): Promise<void>;
|
|
79
79
|
protected get DbUser(): string | undefined;
|
|
80
80
|
protected get DbHost(): string | undefined;
|
|
81
81
|
protected get DbName(): string | undefined;
|
|
@@ -83,25 +83,13 @@ export declare class Service<IEnv extends IServiceEnv = IServiceEnv> {
|
|
|
83
83
|
protected get DbPort(): string | number | undefined;
|
|
84
84
|
protected get DbIsSslConnect(): boolean;
|
|
85
85
|
private setPool;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
protected outputSuccessLog(): Promise<void>;
|
|
89
|
-
resSuccessExpress(): void;
|
|
90
|
-
resSuccessHono(): TypedResponse<any>;
|
|
91
|
-
protected outputErrorLog(ex: any): Promise<void>;
|
|
92
|
-
handleExceptionExpress(ex: any): void;
|
|
93
|
-
handleExceptionHono(ex: any): TypedResponse<any>;
|
|
86
|
+
private handleExceptionExpress;
|
|
87
|
+
private handleExceptionHono;
|
|
94
88
|
private pool?;
|
|
95
|
-
|
|
89
|
+
private get Pool();
|
|
96
90
|
private client?;
|
|
97
91
|
private isExecuteRollback;
|
|
98
|
-
protected get Client(): PoolClient;
|
|
99
|
-
startConnect(): Promise<void>;
|
|
100
|
-
commit(): Promise<void>;
|
|
101
|
-
rollback(): Promise<void>;
|
|
102
|
-
release(): Promise<void>;
|
|
103
|
-
private s3Client?;
|
|
104
|
-
get S3Client(): AwsS3Client;
|
|
92
|
+
protected get Client(): Pool | PoolClient;
|
|
105
93
|
private stringClient?;
|
|
106
94
|
get StringClient(): StringClient;
|
|
107
95
|
private encryptClient?;
|
|
@@ -113,4 +101,4 @@ export declare class Service<IEnv extends IServiceEnv = IServiceEnv> {
|
|
|
113
101
|
}): Promise<AxiosResponse<TResponse>>;
|
|
114
102
|
}
|
|
115
103
|
export {};
|
|
116
|
-
//# sourceMappingURL=
|
|
104
|
+
//# sourceMappingURL=Controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Controller.d.ts","sourceRoot":"","sources":["../src/Controller.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,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MAAM,GAAG,SAAS,CAA6B;IACvE,SAAS,KAAK,MAAM,IAAI,MAAM,GAAG,SAAS,CAA6B;IACvE,SAAS,KAAK,MAAM,IAAI,MAAM,GAAG,SAAS,CAAiC;IAC3E,SAAS,KAAK,UAAU,IAAI,MAAM,GAAG,SAAS,CAAiC;IAC/E,SAAS,KAAK,MAAM,IAAI,MAAM,GAAG,MAAM,GAAG,SAAS,CAA6B;IAChF,SAAS,KAAK,cAAc,IAAI,OAAO,CAA0C;IAEjF,OAAO,CAAC,OAAO;IAsCf,OAAO,CAAC,sBAAsB;IAyC9B,OAAO,CAAC,mBAAmB;IAwC3B,OAAO,CAAC,IAAI,CAAC,CAAO;IACpB,OAAO,KAAK,IAAI,GAMf;IACD,OAAO,CAAC,MAAM,CAAC,CAAa;IAC5B,OAAO,CAAC,iBAAiB,CAAkB;IAC3C,SAAS,KAAK,MAAM,IAAI,IAAI,GAAG,UAAU,CAQxC;IAED,OAAO,CAAC,YAAY,CAAC,CAAgB;IACrC,IAAI,YAAY,IAAI,YAAY,CAK/B;IAED,OAAO,CAAC,aAAa,CAAC,CAAgB;IACtC,IAAI,aAAa,IAAI,aAAa,CASjC;IAEY,UAAU,CAAC,QAAQ,GAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,GAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,EAChF,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;CA0C1H"}
|
|
@@ -12,18 +12,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.Controller = void 0;
|
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
|
17
17
|
const cookie_1 = require("hono/cookie");
|
|
18
18
|
const pg_1 = require("pg");
|
|
19
19
|
const Exception_1 = require("./exceptions/Exception");
|
|
20
20
|
const RequestType_1 = require("./reqestResponse/RequestType");
|
|
21
21
|
const ResponseType_1 = require("./reqestResponse/ResponseType");
|
|
22
|
-
const AwsS3Client_1 = require("./clients/AwsS3Client");
|
|
23
22
|
const StringClient_1 = require("./clients/StringClient");
|
|
24
23
|
const EncryptClient_1 = require("./clients/EncryptClient");
|
|
25
24
|
const PoolManager_1 = __importDefault(require("./PoolManager"));
|
|
26
|
-
class
|
|
25
|
+
class Controller {
|
|
27
26
|
get Method() { return this.method; }
|
|
28
27
|
get Endpoint() { return this.endpoint + this.request.paramPath; }
|
|
29
28
|
get ApiCode() { return this.apiCode; }
|
|
@@ -41,6 +40,73 @@ class Service {
|
|
|
41
40
|
description: 'サーバー内部エラー(予期せぬエラー)'
|
|
42
41
|
}];
|
|
43
42
|
}
|
|
43
|
+
main() {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
45
|
+
}
|
|
46
|
+
middleware() {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
48
|
+
}
|
|
49
|
+
outputSuccessLog() {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
51
|
+
}
|
|
52
|
+
outputErrorLog(ex) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
54
|
+
}
|
|
55
|
+
run() {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
try {
|
|
58
|
+
if (this.Module === "express") {
|
|
59
|
+
yield this.request.setRequest(this.Module, this.Req);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
yield this.request.setRequest(this.Module, this.C);
|
|
63
|
+
}
|
|
64
|
+
if (this.isSetDbConnection) {
|
|
65
|
+
this.client = yield this.Pool.connect();
|
|
66
|
+
yield this.Client.query('BEGIN');
|
|
67
|
+
this.isExecuteRollback = true;
|
|
68
|
+
}
|
|
69
|
+
yield this.middleware();
|
|
70
|
+
yield this.main();
|
|
71
|
+
if (this.isSetDbConnection) {
|
|
72
|
+
yield this.Client.query('COMMIT');
|
|
73
|
+
this.isExecuteRollback = false;
|
|
74
|
+
}
|
|
75
|
+
this.outputSuccessLog().catch((ex) => {
|
|
76
|
+
console.error(ex);
|
|
77
|
+
});
|
|
78
|
+
if (this.Module === 'express') {
|
|
79
|
+
return this.Res.status(200).json(this.response.ResponseData);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return this.C.json(this.response.ResponseData, 200);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (ex) {
|
|
86
|
+
this.outputErrorLog(ex).catch((ex) => {
|
|
87
|
+
console.error(ex);
|
|
88
|
+
});
|
|
89
|
+
if (this.Module === 'express') {
|
|
90
|
+
return this.handleExceptionExpress(ex);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
return this.handleExceptionHono(ex);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
finally {
|
|
97
|
+
if (this.isExecuteRollback) {
|
|
98
|
+
yield this.Client.query('ROLLBACK');
|
|
99
|
+
}
|
|
100
|
+
this.isExecuteRollback = false;
|
|
101
|
+
if (this.client !== undefined) {
|
|
102
|
+
yield this.client.release();
|
|
103
|
+
}
|
|
104
|
+
if (this.Module === 'hono' && this.pool !== undefined) {
|
|
105
|
+
yield this.pool.end();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
44
110
|
get Req() {
|
|
45
111
|
if (this.req === undefined) {
|
|
46
112
|
throw new Error('This method can only be used when module is "express".');
|
|
@@ -79,12 +145,10 @@ class Service {
|
|
|
79
145
|
}
|
|
80
146
|
getHeader(key) {
|
|
81
147
|
if (this.Module === 'express') {
|
|
82
|
-
// Expressの場合
|
|
83
148
|
const value = this.Req.header(key);
|
|
84
149
|
return Array.isArray(value) ? value[0] : value;
|
|
85
150
|
}
|
|
86
151
|
else {
|
|
87
|
-
// Honoの場合
|
|
88
152
|
return this.C.req.header(key);
|
|
89
153
|
}
|
|
90
154
|
}
|
|
@@ -101,11 +165,9 @@ class Service {
|
|
|
101
165
|
formattedValue = JSON.stringify(value);
|
|
102
166
|
}
|
|
103
167
|
if (this.Module === 'express') {
|
|
104
|
-
// Expressの場合
|
|
105
168
|
this.Res.setHeader(key, formattedValue);
|
|
106
169
|
}
|
|
107
170
|
else {
|
|
108
|
-
// Honoの場合
|
|
109
171
|
this.C.header(key, formattedValue);
|
|
110
172
|
}
|
|
111
173
|
}
|
|
@@ -139,11 +201,9 @@ class Service {
|
|
|
139
201
|
}
|
|
140
202
|
removeCookie(key, options) {
|
|
141
203
|
if (this.Module === 'express') {
|
|
142
|
-
// Expressの場合
|
|
143
204
|
this.Res.clearCookie(key, options);
|
|
144
205
|
}
|
|
145
206
|
else if (this.Module === 'hono') {
|
|
146
|
-
// Honoの場合
|
|
147
207
|
(0, cookie_1.deleteCookie)(this.C, key, options);
|
|
148
208
|
}
|
|
149
209
|
}
|
|
@@ -165,6 +225,7 @@ class Service {
|
|
|
165
225
|
this.response = new ResponseType_1.ResponseType();
|
|
166
226
|
this.tags = [];
|
|
167
227
|
this.errorList = [];
|
|
228
|
+
this.isSetDbConnection = true;
|
|
168
229
|
this.isExecuteRollback = false;
|
|
169
230
|
if (param2 !== undefined) {
|
|
170
231
|
// Express の場合: (request, response)
|
|
@@ -176,18 +237,6 @@ class Service {
|
|
|
176
237
|
this.c = param1;
|
|
177
238
|
}
|
|
178
239
|
}
|
|
179
|
-
inintialize() {
|
|
180
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
-
if (this.Module === "express") {
|
|
182
|
-
yield this.request.setRequest(this.Module, this.Req);
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
yield this.request.setRequest(this.Module, this.C);
|
|
186
|
-
}
|
|
187
|
-
yield this.checkMaintenance();
|
|
188
|
-
yield this.middleware();
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
240
|
get DbUser() { return this.Env.DB_USER; }
|
|
192
241
|
get DbHost() { return this.Env.DB_HOST; }
|
|
193
242
|
get DbName() { return this.Env.DB_DATABASE; }
|
|
@@ -230,35 +279,7 @@ class Service {
|
|
|
230
279
|
throw new Error("Failed to connect to the database. Please check the connection settings.");
|
|
231
280
|
}
|
|
232
281
|
}
|
|
233
|
-
checkMaintenance() {
|
|
234
|
-
return __awaiter(this, void 0, void 0, function* () { });
|
|
235
|
-
}
|
|
236
|
-
middleware() {
|
|
237
|
-
return __awaiter(this, void 0, void 0, function* () { });
|
|
238
|
-
}
|
|
239
|
-
outputSuccessLog() {
|
|
240
|
-
return __awaiter(this, void 0, void 0, function* () { });
|
|
241
|
-
}
|
|
242
|
-
resSuccessExpress() {
|
|
243
|
-
this.outputSuccessLog().catch((ex) => {
|
|
244
|
-
console.error(ex);
|
|
245
|
-
});
|
|
246
|
-
this.Res.status(200).json(this.response.ResponseData);
|
|
247
|
-
}
|
|
248
|
-
resSuccessHono() {
|
|
249
|
-
this.outputSuccessLog().catch((ex) => {
|
|
250
|
-
console.error(ex);
|
|
251
|
-
});
|
|
252
|
-
return this.C.json(this.response.ResponseData, 200);
|
|
253
|
-
}
|
|
254
|
-
outputErrorLog(ex) {
|
|
255
|
-
return __awaiter(this, void 0, void 0, function* () { });
|
|
256
|
-
}
|
|
257
282
|
handleExceptionExpress(ex) {
|
|
258
|
-
// To avoid slowing down the response, make this asynchronous
|
|
259
|
-
this.outputErrorLog(ex).catch((ex) => {
|
|
260
|
-
console.error(ex);
|
|
261
|
-
});
|
|
262
283
|
if (ex instanceof Exception_1.AuthException) {
|
|
263
284
|
this.Res.status(401).json({
|
|
264
285
|
message: "Authentication expired. Please login again."
|
|
@@ -306,10 +327,6 @@ class Service {
|
|
|
306
327
|
}
|
|
307
328
|
}
|
|
308
329
|
handleExceptionHono(ex) {
|
|
309
|
-
// To avoid slowing down the response, make this asynchronous
|
|
310
|
-
this.outputErrorLog(ex).catch((ex) => {
|
|
311
|
-
console.error(ex);
|
|
312
|
-
});
|
|
313
330
|
if (ex instanceof Exception_1.AuthException) {
|
|
314
331
|
return this.C.json({
|
|
315
332
|
message: "Authentication expired. Please login again."
|
|
@@ -364,53 +381,13 @@ class Service {
|
|
|
364
381
|
return this.pool;
|
|
365
382
|
}
|
|
366
383
|
get Client() {
|
|
367
|
-
if (this.
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
return this.client;
|
|
371
|
-
}
|
|
372
|
-
startConnect() {
|
|
373
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
374
|
-
this.client = yield this.Pool.connect();
|
|
375
|
-
yield this.Client.query('BEGIN');
|
|
376
|
-
this.isExecuteRollback = true;
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
commit() {
|
|
380
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
381
|
-
yield this.Client.query('COMMIT');
|
|
382
|
-
this.isExecuteRollback = false;
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
rollback() {
|
|
386
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
387
|
-
if (this.isExecuteRollback) {
|
|
388
|
-
yield this.Client.query('ROLLBACK');
|
|
384
|
+
if (this.isSetDbConnection) {
|
|
385
|
+
if (this.client === undefined) {
|
|
386
|
+
throw new Error("Please call this.PoolClient after using the startConnect method.");
|
|
389
387
|
}
|
|
390
|
-
this.
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
release() {
|
|
394
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
395
|
-
yield this.rollback();
|
|
396
|
-
if (this.client !== undefined) {
|
|
397
|
-
yield this.client.release();
|
|
398
|
-
}
|
|
399
|
-
if (this.Module === 'hono' && this.pool !== undefined) {
|
|
400
|
-
yield this.pool.end();
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
get S3Client() {
|
|
405
|
-
if (this.s3Client === undefined) {
|
|
406
|
-
this.s3Client = new AwsS3Client_1.AwsS3Client({
|
|
407
|
-
bucketName: this.Env.S3_BUCKET_NAME,
|
|
408
|
-
region: this.Env.S3_REGION,
|
|
409
|
-
accessKeyId: this.Env.S3_ACCESS_KEY_ID,
|
|
410
|
-
secretAccessKey: this.Env.S3_SECRET_ACCESS_KEY
|
|
411
|
-
});
|
|
388
|
+
return this.client;
|
|
412
389
|
}
|
|
413
|
-
return this.
|
|
390
|
+
return this.Pool;
|
|
414
391
|
}
|
|
415
392
|
get StringClient() {
|
|
416
393
|
if (this.stringClient === undefined) {
|
|
@@ -471,4 +448,4 @@ class Service {
|
|
|
471
448
|
});
|
|
472
449
|
}
|
|
473
450
|
}
|
|
474
|
-
exports.
|
|
451
|
+
exports.Controller = Controller;
|
package/dist/cron/BaseCron.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PoolClient } from "pg";
|
|
2
2
|
import { DateType, DayType, HourType, MinuteSecondType, MonthType } from "./CronType";
|
|
3
|
-
import { AwsS3Client } from "../clients/AwsS3Client";
|
|
4
3
|
export declare class BaseCron {
|
|
5
4
|
protected readonly isTest: boolean;
|
|
6
5
|
protected dbUser?: string;
|
|
@@ -26,7 +25,5 @@ export declare class BaseCron {
|
|
|
26
25
|
get CronCode(): string;
|
|
27
26
|
setUp(): Promise<void>;
|
|
28
27
|
tearDown(): Promise<void>;
|
|
29
|
-
private s3Client?;
|
|
30
|
-
get S3Client(): AwsS3Client;
|
|
31
28
|
}
|
|
32
29
|
//# sourceMappingURL=BaseCron.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseCron.d.ts","sourceRoot":"","sources":["../../src/cron/BaseCron.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,MAAM,IAAI,CAAC;AACtC,OAAO,EAAE,QA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AE,OAAO,GAAG,GAAG,CAAO;IACtB,GAAG;IAKhB,IAAI,YAAY,IAAI,MAAM,CAQzB;IACD,IAAI,QAAQ,IAAI,MAAM,CAA0B;IAEnC,KAAK;IAwBL,QAAQ;CAaxB"}
|
package/dist/cron/BaseCron.js
CHANGED
|
@@ -14,7 +14,6 @@ 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
17
|
class BaseCron {
|
|
19
18
|
constructor() {
|
|
20
19
|
this.isTest = process.env.NODE_ENV === 'test';
|
|
@@ -112,16 +111,5 @@ class BaseCron {
|
|
|
112
111
|
}
|
|
113
112
|
});
|
|
114
113
|
}
|
|
115
|
-
get S3Client() {
|
|
116
|
-
if (this.s3Client === undefined) {
|
|
117
|
-
this.s3Client = new AwsS3Client_1.AwsS3Client({
|
|
118
|
-
bucketName: process.env.S3_BUCKET_NAME,
|
|
119
|
-
region: process.env.S3_REGION,
|
|
120
|
-
accessKeyId: process.env.S3_ACCESS_KEY_ID,
|
|
121
|
-
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
return this.s3Client;
|
|
125
|
-
}
|
|
126
114
|
}
|
|
127
115
|
exports.BaseCron = BaseCron;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Controller } from '../Controller';
|
|
2
2
|
export interface IParams {
|
|
3
3
|
in: 'header' | 'path';
|
|
4
4
|
name: string;
|
|
@@ -6,5 +6,5 @@ export interface IParams {
|
|
|
6
6
|
description?: string;
|
|
7
7
|
example?: string;
|
|
8
8
|
}
|
|
9
|
-
export declare const createSwagger: (
|
|
9
|
+
export declare const createSwagger: (controllers: Controller[], name: string, pathOrUrl: string, params?: Array<IParams>) => string;
|
|
10
10
|
//# sourceMappingURL=Swagger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Swagger.d.ts","sourceRoot":"","sources":["../../src/documents/Swagger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Swagger.d.ts","sourceRoot":"","sources":["../../src/documents/Swagger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,WAAW,OAAO;IACpB,EAAE,EAAE,QAAQ,GAAG,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,aAAa,GAAI,aAAa,UAAU,EAAE,EAAE,MAAM,MAAM,EAAE,WAAW,MAAM,EAAE,SAAQ,KAAK,CAAC,OAAO,CAAM,KAAG,MA8FvH,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createSwagger = void 0;
|
|
4
|
-
const createSwagger = (
|
|
4
|
+
const createSwagger = (controllers, name, pathOrUrl, params = []) => {
|
|
5
5
|
// *****************************************
|
|
6
6
|
// Internal method definitions
|
|
7
7
|
// *****************************************
|
|
@@ -16,12 +16,12 @@ const createSwagger = (services, name, pathOrUrl, params = []) => {
|
|
|
16
16
|
// *****************************************
|
|
17
17
|
const endpontSwaggerYml = {};
|
|
18
18
|
let tags = [];
|
|
19
|
-
for (const
|
|
20
|
-
if (
|
|
21
|
-
endpontSwaggerYml[
|
|
19
|
+
for (const controller of controllers) {
|
|
20
|
+
if (controller.Endpoint in endpontSwaggerYml === false) {
|
|
21
|
+
endpontSwaggerYml[controller.Endpoint] = {};
|
|
22
22
|
}
|
|
23
23
|
let yml = "";
|
|
24
|
-
const apiTags =
|
|
24
|
+
const apiTags = controller.Tags;
|
|
25
25
|
if (apiTags.length > 0) {
|
|
26
26
|
tags = [...tags, ...apiTags];
|
|
27
27
|
yml += ` tags:\n`;
|
|
@@ -29,9 +29,9 @@ const createSwagger = (services, name, pathOrUrl, params = []) => {
|
|
|
29
29
|
yml += ` - ${tag}\n`;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
yml += ` summary: "${
|
|
32
|
+
yml += ` summary: "${controller.Summary}"\n`;
|
|
33
33
|
const croneParams = [...params];
|
|
34
|
-
for (const path of
|
|
34
|
+
for (const path of controller.Endpoint.split('/')) {
|
|
35
35
|
if (path.startsWith('{') && path.endsWith('}')) {
|
|
36
36
|
const key = path.replace('{', '').replace('}', '');
|
|
37
37
|
croneParams.push({
|
|
@@ -58,10 +58,10 @@ const createSwagger = (services, name, pathOrUrl, params = []) => {
|
|
|
58
58
|
yml += ` type: string\n`;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
yml +=
|
|
62
|
-
const errorList = [...
|
|
63
|
-
yml +=
|
|
64
|
-
endpontSwaggerYml[
|
|
61
|
+
yml += controller.Request.createSwagger(controller.Method);
|
|
62
|
+
const errorList = [...controller.ErrorList, ...controller.Request.getInputErrorList(controller.Method)];
|
|
63
|
+
yml += controller.Response.createSwagger(errorList, controller.ApiCode);
|
|
64
|
+
endpontSwaggerYml[controller.Endpoint][controller.Method] = yml;
|
|
65
65
|
}
|
|
66
66
|
let swaggerInfo = `openapi: 3.0.0
|
|
67
67
|
info:
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type { MethodType } from './
|
|
1
|
+
export { Controller } from './Controller';
|
|
2
|
+
export type { MethodType } from './Controller';
|
|
3
3
|
export { MaintenanceException, AuthException, InputErrorException, ForbiddenException, DbConflictException, UnprocessableException, NotFoundException } from './exceptions/Exception';
|
|
4
4
|
export { createSwagger } from './documents/Swagger';
|
|
5
5
|
export type { IParams } from './documents/Swagger';
|
|
6
|
-
export { AwsS3Client } from './clients/AwsS3Client';
|
|
7
6
|
export { StringClient } from './clients/StringClient';
|
|
8
7
|
export { EncryptClient } from './clients/EncryptClient';
|
|
9
8
|
export { RequestType } from './reqestResponse/RequestType';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACtL,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,YAAY,EACR,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,OAAO,EACP,aAAa,EACb,SAAS,EACT,WAAW,EACX,MAAM,EACN,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runCron = exports.BaseCron = exports.rollback = exports.migrate = exports.MigrateDatabase = exports.MigrateTable = exports.createTableDoc = exports.SelectExpression = exports.WhereExpression = exports.TableModel = exports.ResponseType = exports.RequestType = exports.EncryptClient = exports.StringClient = exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.runCron = exports.BaseCron = exports.rollback = exports.migrate = exports.MigrateDatabase = exports.MigrateTable = exports.createTableDoc = exports.SelectExpression = exports.WhereExpression = exports.TableModel = exports.ResponseType = exports.RequestType = exports.EncryptClient = exports.StringClient = exports.createSwagger = exports.NotFoundException = exports.UnprocessableException = exports.DbConflictException = exports.ForbiddenException = exports.InputErrorException = exports.AuthException = exports.MaintenanceException = exports.Controller = void 0;
|
|
4
|
+
var Controller_1 = require("./Controller");
|
|
5
|
+
Object.defineProperty(exports, "Controller", { enumerable: true, get: function () { return Controller_1.Controller; } });
|
|
6
6
|
var Exception_1 = require("./exceptions/Exception");
|
|
7
7
|
Object.defineProperty(exports, "MaintenanceException", { enumerable: true, get: function () { return Exception_1.MaintenanceException; } });
|
|
8
8
|
Object.defineProperty(exports, "AuthException", { enumerable: true, get: function () { return Exception_1.AuthException; } });
|
|
@@ -13,8 +13,6 @@ Object.defineProperty(exports, "UnprocessableException", { enumerable: true, get
|
|
|
13
13
|
Object.defineProperty(exports, "NotFoundException", { enumerable: true, get: function () { return Exception_1.NotFoundException; } });
|
|
14
14
|
var Swagger_1 = require("./documents/Swagger");
|
|
15
15
|
Object.defineProperty(exports, "createSwagger", { enumerable: true, get: function () { return Swagger_1.createSwagger; } });
|
|
16
|
-
var AwsS3Client_1 = require("./clients/AwsS3Client");
|
|
17
|
-
Object.defineProperty(exports, "AwsS3Client", { enumerable: true, get: function () { return AwsS3Client_1.AwsS3Client; } });
|
|
18
16
|
var StringClient_1 = require("./clients/StringClient");
|
|
19
17
|
Object.defineProperty(exports, "StringClient", { enumerable: true, get: function () { return StringClient_1.StringClient; } });
|
|
20
18
|
var EncryptClient_1 = require("./clients/EncryptClient");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Request } from 'express';
|
|
2
2
|
import ReqResType, { EnumType, NumberType, PrimitiveType, StringType } from "./ReqResType";
|
|
3
|
-
import { IError } from '../
|
|
3
|
+
import { IError } from '../Controller';
|
|
4
4
|
import { Context } from 'hono';
|
|
5
5
|
export interface ErrorMessageType {
|
|
6
6
|
REQUIRED: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestType.d.ts","sourceRoot":"","sources":["../../src/reqestResponse/RequestType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,UAAU,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAgB,UAAU,EAAE,MAAM,cAAc,CAAC;AAIzG,OAAO,EAAE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ts","sourceRoot":"","sources":["../../src/reqestResponse/ResponseType.ts"],"names":[],"mappings":"AAEA,OAAO,UAA4B,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAIvC,qBAAa,YAAa,SAAQ,UAAU;IAExC;;;OAGG;IACI,IAAI,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAM;IAEvC;;;;OAIG;IACH,IAAI,YAAY,IAAI;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAoCvC;IAED;;;;;OAKG;IACH,OAAO,CAAC,SAAS;IA2CjB;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;IAoCZ;;;;;GAKD;IACH,OAAO,CAAC,MAAM;IAqDd;;;;;OAKG;IACH,OAAO,CAAC,OAAO;IAef;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;IAmIhB;;;;;OAKG;IACI,aAAa,CAAC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IA6EvE;;;;;;;OAOG;IACH,OAAO,CAAC,4BAA4B;IAqCpC;;;;;OAKG;IACH,OAAO,CAAC,4BAA4B;IAgChC;;;;;GAKD;IACH,OAAO,CAAC,iCAAiC;CAU5C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg-mvc-service",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.40",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://github.com/n-daira/npm-pack_mvc-service#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -25,21 +25,14 @@
|
|
|
25
25
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/jest": "29.5.14",
|
|
29
28
|
"@types/pg": "8.11.11",
|
|
30
|
-
"copyfiles": "2.4.1",
|
|
31
|
-
"jest": "29.7.0",
|
|
32
|
-
"ts-jest": "29.3.1",
|
|
33
29
|
"typescript": "5.8.2"
|
|
34
30
|
},
|
|
35
31
|
"dependencies": {
|
|
36
|
-
"@aws-sdk/client-s3": "3.817.0",
|
|
37
32
|
"@types/express": "5.0.1",
|
|
38
33
|
"axios": "1.10.0",
|
|
39
34
|
"crypto": "1.0.1",
|
|
40
35
|
"hono": "4.11.2",
|
|
41
|
-
"node-cron": "4.2.1",
|
|
42
|
-
"pdf-lib": "1.17.1",
|
|
43
36
|
"type-utils-n-daira": "1.0.11"
|
|
44
37
|
}
|
|
45
38
|
}
|
package/dist/Service.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Service.d.ts","sourceRoot":"","sources":["../src/Service.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AAE7C,OAAO,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,IAAI,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,KAAK,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAE7E,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,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
-
private readonly bucketName;
|
|
9
|
-
private readonly region;
|
|
10
|
-
get UrlPrefix(): string;
|
|
11
|
-
constructor(params: {
|
|
12
|
-
bucketName?: string;
|
|
13
|
-
region?: string;
|
|
14
|
-
accessKeyId?: string;
|
|
15
|
-
secretAccessKey?: string;
|
|
16
|
-
});
|
|
17
|
-
private makeKey;
|
|
18
|
-
url(path: string, fileName?: string): string;
|
|
19
|
-
uploadJson(path: string, fileName: string, data: {
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
}): Promise<void>;
|
|
22
|
-
uploadText(path: string, fileName: string, text: string): Promise<void>;
|
|
23
|
-
uploadBase64Data(path: string, fileName: string, base64Data: string): Promise<IUploadResponse>;
|
|
24
|
-
uploadFromUrl(path: string, fileName: string, url: string): Promise<IUploadResponse>;
|
|
25
|
-
uploadStackText(path: string, fileName: string, text: string): Promise<void>;
|
|
26
|
-
getText(path: string, fileName: string): Promise<string | null>;
|
|
27
|
-
getFilesInDir(path: string): Promise<Array<_Object>>;
|
|
28
|
-
getDataFronJson<T = any>(path: string, fileName: string): Promise<T>;
|
|
29
|
-
deleteFile(path: string, fileName: string): Promise<void>;
|
|
30
|
-
deleteDir(path: string): Promise<void>;
|
|
31
|
-
deleteFromUrl(url: string, isFileUrl?: boolean): Promise<void>;
|
|
32
|
-
}
|
|
33
|
-
export {};
|
|
34
|
-
//# sourceMappingURL=AwsS3Client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AwsS3Client.d.ts","sourceRoot":"","sources":["../../src/clients/AwsS3Client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAuG,MAAM,oBAAoB,CAAC;AAIlJ,KAAK,eAAe,GAAG;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAA;AAED,qBAAa,WAAW;IACpB,OAAO,CAAC,MAAM,CAAW;IAEzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;IA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AE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWzD,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAatC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,GAAE,OAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAqBpF"}
|
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
12
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
13
|
-
var m = o[Symbol.asyncIterator], i;
|
|
14
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
15
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
16
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
17
|
-
};
|
|
18
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.AwsS3Client = void 0;
|
|
23
|
-
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
24
|
-
const Exception_1 = require("../exceptions/Exception");
|
|
25
|
-
const axios_1 = __importDefault(require("axios"));
|
|
26
|
-
class AwsS3Client {
|
|
27
|
-
get UrlPrefix() {
|
|
28
|
-
return `https://${this.bucketName}.s3.${this.region}.amazonaws.com`;
|
|
29
|
-
}
|
|
30
|
-
constructor(params) {
|
|
31
|
-
if (params.bucketName === undefined) {
|
|
32
|
-
throw new Error("Please specify the bucketName.");
|
|
33
|
-
}
|
|
34
|
-
if (params.region === undefined) {
|
|
35
|
-
throw new Error("Please specify the region.");
|
|
36
|
-
}
|
|
37
|
-
if (params.accessKeyId === undefined) {
|
|
38
|
-
throw new Error("Please specify the accessKeyId.");
|
|
39
|
-
}
|
|
40
|
-
if (params.secretAccessKey === undefined) {
|
|
41
|
-
throw new Error("Please specify the secretAccessKey.");
|
|
42
|
-
}
|
|
43
|
-
this.client = new client_s3_1.S3Client({
|
|
44
|
-
region: params.region,
|
|
45
|
-
credentials: {
|
|
46
|
-
accessKeyId: params.accessKeyId,
|
|
47
|
-
secretAccessKey: params.secretAccessKey
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
this.region = params.region;
|
|
51
|
-
this.bucketName = params.bucketName;
|
|
52
|
-
}
|
|
53
|
-
makeKey(path, fileName) {
|
|
54
|
-
path = path.replace(/^\/|\/$/g, '');
|
|
55
|
-
if ((fileName !== null && fileName !== void 0 ? fileName : '').trim().length > 0) {
|
|
56
|
-
path += '/' + fileName;
|
|
57
|
-
}
|
|
58
|
-
return path;
|
|
59
|
-
}
|
|
60
|
-
url(path, fileName = '') {
|
|
61
|
-
path = path.replace(/^\/|\/$/g, '');
|
|
62
|
-
let url = `${this.UrlPrefix}`;
|
|
63
|
-
if (path !== '') {
|
|
64
|
-
url += '/' + path;
|
|
65
|
-
}
|
|
66
|
-
if (fileName.trim().length > 0) {
|
|
67
|
-
url += '/' + fileName;
|
|
68
|
-
}
|
|
69
|
-
return url;
|
|
70
|
-
}
|
|
71
|
-
uploadJson(path, fileName, data) {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
const command = new client_s3_1.PutObjectCommand({
|
|
74
|
-
Bucket: this.bucketName,
|
|
75
|
-
Key: this.makeKey(path, fileName),
|
|
76
|
-
Body: JSON.stringify(data),
|
|
77
|
-
ContentType: 'text/plain; charset=utf-8'
|
|
78
|
-
});
|
|
79
|
-
yield this.client.send(command);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
// public async uploadToPdf(path: string, fileName: string, base64Datas: Array<string>) {
|
|
83
|
-
// const base64Client = new Base64Client();
|
|
84
|
-
// const mergedPdfBase64 = await base64Client.mergeToPdfBase64(base64Datas);
|
|
85
|
-
// const command = new PutObjectCommand({
|
|
86
|
-
// Bucket: this.bucketName,
|
|
87
|
-
// Key: this.makeKey(path, fileName),
|
|
88
|
-
// Body: Buffer.from(mergedPdfBase64, 'base64'),
|
|
89
|
-
// ContentEncoding: 'base64',
|
|
90
|
-
// ContentType: 'application/pdf'
|
|
91
|
-
// });
|
|
92
|
-
// await this.client.send(command);
|
|
93
|
-
// }
|
|
94
|
-
uploadText(path, fileName, text) {
|
|
95
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
-
const command = new client_s3_1.PutObjectCommand({
|
|
97
|
-
Bucket: this.bucketName,
|
|
98
|
-
Key: this.makeKey(path, fileName),
|
|
99
|
-
Body: text,
|
|
100
|
-
ContentType: 'text/plain; charset=utf-8'
|
|
101
|
-
});
|
|
102
|
-
yield this.client.send(command);
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
uploadBase64Data(path, fileName, base64Data) {
|
|
106
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
const key = this.makeKey(path, fileName);
|
|
108
|
-
const command = new client_s3_1.PutObjectCommand({
|
|
109
|
-
Bucket: this.bucketName,
|
|
110
|
-
Key: key,
|
|
111
|
-
Body: Buffer.from(base64Data, 'base64'),
|
|
112
|
-
ContentEncoding: 'base64'
|
|
113
|
-
});
|
|
114
|
-
yield this.client.send(command);
|
|
115
|
-
return {
|
|
116
|
-
url: `${this.UrlPrefix}/${key}`,
|
|
117
|
-
fileName: fileName
|
|
118
|
-
};
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
uploadFromUrl(path, fileName, url) {
|
|
122
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
-
try {
|
|
124
|
-
// URLからデータを取得
|
|
125
|
-
const response = yield axios_1.default.get(url, {
|
|
126
|
-
responseType: 'arraybuffer',
|
|
127
|
-
timeout: 30000,
|
|
128
|
-
});
|
|
129
|
-
// Content-Typeを取得
|
|
130
|
-
const contentType = response.headers['content-type'] || 'application/octet-stream';
|
|
131
|
-
const key = this.makeKey(path, fileName);
|
|
132
|
-
const command = new client_s3_1.PutObjectCommand({
|
|
133
|
-
Bucket: this.bucketName,
|
|
134
|
-
Key: key,
|
|
135
|
-
Body: Buffer.from(response.data),
|
|
136
|
-
ContentType: contentType,
|
|
137
|
-
ContentLength: response.data.length
|
|
138
|
-
});
|
|
139
|
-
yield this.client.send(command);
|
|
140
|
-
// アップロードされたファイルのURLを返す
|
|
141
|
-
return {
|
|
142
|
-
url: this.url(path, fileName),
|
|
143
|
-
fileName: fileName
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
catch (error) {
|
|
147
|
-
if (axios_1.default.isAxiosError(error)) {
|
|
148
|
-
if (error.response) {
|
|
149
|
-
throw new Exception_1.UnprocessableException(`Failed to download from URL. HTTP ${error.response.status}: ${error.response.statusText}`);
|
|
150
|
-
}
|
|
151
|
-
else if (error.request) {
|
|
152
|
-
throw new Exception_1.UnprocessableException('Failed to connect to the URL. Please check if the URL is accessible.');
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
throw new Exception_1.UnprocessableException('Invalid URL format.');
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
throw new Exception_1.UnprocessableException('Failed to upload from URL.');
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
uploadStackText(path, fileName, text) {
|
|
163
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
-
let preText = yield this.getText(path, fileName);
|
|
165
|
-
if (typeof preText === 'string') {
|
|
166
|
-
text = preText + '\n' + text;
|
|
167
|
-
}
|
|
168
|
-
yield this.uploadText(path, fileName, text);
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
getText(path, fileName) {
|
|
172
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
-
var _a, e_1, _b, _c;
|
|
174
|
-
var _d;
|
|
175
|
-
try {
|
|
176
|
-
const command = new client_s3_1.GetObjectCommand({
|
|
177
|
-
Bucket: this.bucketName,
|
|
178
|
-
Key: this.makeKey(path, fileName),
|
|
179
|
-
});
|
|
180
|
-
const res = yield this.client.send(command);
|
|
181
|
-
if (res.Body === undefined) {
|
|
182
|
-
throw new Error(`Failed to get text data. Response body is undefined.`);
|
|
183
|
-
}
|
|
184
|
-
if (((_d = res.ContentType) === null || _d === void 0 ? void 0 : _d.startsWith('text/')) === false) {
|
|
185
|
-
throw new Error(`Cannot get text data from non-text file. ContentType: ${res.ContentType}`);
|
|
186
|
-
}
|
|
187
|
-
// v3ではBodyがReadableStreamなので、変換が必要
|
|
188
|
-
const chunks = [];
|
|
189
|
-
if (res.Body && typeof res.Body === 'object' && 'getReader' in res.Body) {
|
|
190
|
-
// ReadableStreamの場合
|
|
191
|
-
const stream = res.Body;
|
|
192
|
-
const reader = stream.getReader();
|
|
193
|
-
while (true) {
|
|
194
|
-
const { done, value } = yield reader.read();
|
|
195
|
-
if (done)
|
|
196
|
-
break;
|
|
197
|
-
chunks.push(value);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
try {
|
|
202
|
-
// Node.js Readableの場合
|
|
203
|
-
for (var _e = true, _f = __asyncValues(res.Body), _g; _g = yield _f.next(), _a = _g.done, !_a; _e = true) {
|
|
204
|
-
_c = _g.value;
|
|
205
|
-
_e = false;
|
|
206
|
-
const chunk = _c;
|
|
207
|
-
chunks.push(chunk);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
211
|
-
finally {
|
|
212
|
-
try {
|
|
213
|
-
if (!_e && !_a && (_b = _f.return)) yield _b.call(_f);
|
|
214
|
-
}
|
|
215
|
-
finally { if (e_1) throw e_1.error; }
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
const buffer = Buffer.concat(chunks);
|
|
219
|
-
return buffer.toString('utf-8');
|
|
220
|
-
}
|
|
221
|
-
catch (ex) {
|
|
222
|
-
if (ex instanceof Error && ex.name === 'NoSuchKey') {
|
|
223
|
-
return null;
|
|
224
|
-
}
|
|
225
|
-
throw ex;
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
getFilesInDir(path) {
|
|
230
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
231
|
-
var _a;
|
|
232
|
-
const listCommand = new client_s3_1.ListObjectsV2Command({
|
|
233
|
-
Bucket: this.bucketName,
|
|
234
|
-
Prefix: this.makeKey(path),
|
|
235
|
-
});
|
|
236
|
-
const data = yield this.client.send(listCommand);
|
|
237
|
-
return (_a = data.Contents) !== null && _a !== void 0 ? _a : [];
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
getDataFronJson(path, fileName) {
|
|
241
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
242
|
-
var _a, e_2, _b, _c;
|
|
243
|
-
const command = new client_s3_1.GetObjectCommand({
|
|
244
|
-
Bucket: this.bucketName,
|
|
245
|
-
Key: this.makeKey(path, fileName),
|
|
246
|
-
});
|
|
247
|
-
const res = yield this.client.send(command);
|
|
248
|
-
if (res.Body === undefined) {
|
|
249
|
-
throw new Error(`Failed to get JSON data. Response body is undefined.`);
|
|
250
|
-
}
|
|
251
|
-
if (res.ContentType !== 'application/json') {
|
|
252
|
-
throw new Error(`Cannot get JSON data from non-JSON file. ContentType: ${res.ContentType}`);
|
|
253
|
-
}
|
|
254
|
-
// v3ではBodyがReadableなので、変換が必要
|
|
255
|
-
const chunks = [];
|
|
256
|
-
try {
|
|
257
|
-
for (var _d = true, _e = __asyncValues(res.Body), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
|
|
258
|
-
_c = _f.value;
|
|
259
|
-
_d = false;
|
|
260
|
-
const chunk = _c;
|
|
261
|
-
chunks.push(chunk);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
265
|
-
finally {
|
|
266
|
-
try {
|
|
267
|
-
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
|
|
268
|
-
}
|
|
269
|
-
finally { if (e_2) throw e_2.error; }
|
|
270
|
-
}
|
|
271
|
-
const buffer = Buffer.concat(chunks);
|
|
272
|
-
const jsonString = buffer.toString('utf-8');
|
|
273
|
-
return JSON.parse(jsonString);
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
deleteFile(path, fileName) {
|
|
277
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
278
|
-
const key = this.makeKey(path, fileName);
|
|
279
|
-
const command = new client_s3_1.DeleteObjectsCommand({
|
|
280
|
-
Bucket: this.bucketName,
|
|
281
|
-
Delete: {
|
|
282
|
-
Objects: [{ Key: key }]
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
yield this.client.send(command);
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
deleteDir(path) {
|
|
289
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
290
|
-
const files = yield this.getFilesInDir(path);
|
|
291
|
-
if (files.length > 0) {
|
|
292
|
-
const deleteCommand = new client_s3_1.DeleteObjectsCommand({
|
|
293
|
-
Bucket: this.bucketName,
|
|
294
|
-
Delete: {
|
|
295
|
-
Objects: files.map((file) => ({ Key: file.Key })),
|
|
296
|
-
},
|
|
297
|
-
});
|
|
298
|
-
yield this.client.send(deleteCommand);
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
deleteFromUrl(url_1) {
|
|
303
|
-
return __awaiter(this, arguments, void 0, function* (url, isFileUrl = true) {
|
|
304
|
-
const path = url.replace(this.UrlPrefix + '/', '');
|
|
305
|
-
if (url === path) {
|
|
306
|
-
throw new Exception_1.UnprocessableException('The specified URL cannot be deleted because the bucket and region do not match.');
|
|
307
|
-
}
|
|
308
|
-
if (path.trim() === "") {
|
|
309
|
-
throw new Exception_1.UnprocessableException('This URL is invalid.');
|
|
310
|
-
}
|
|
311
|
-
if (isFileUrl) {
|
|
312
|
-
const pathSplits = path.split('/');
|
|
313
|
-
const file = pathSplits.pop();
|
|
314
|
-
if (file === undefined) {
|
|
315
|
-
throw new Exception_1.UnprocessableException('This URL is invalid.');
|
|
316
|
-
}
|
|
317
|
-
yield this.deleteFile(pathSplits.join('/'), file);
|
|
318
|
-
}
|
|
319
|
-
else {
|
|
320
|
-
yield this.deleteDir(path);
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
exports.AwsS3Client = AwsS3Client;
|