pg-mvc-service 2.1.4 → 2.1.6
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 +29 -9
- package/dist/Service.d.ts.map +1 -1
- package/dist/Service.js +112 -42
- package/package.json +1 -1
package/dist/Service.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosResponse } from "axios";
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
|
-
import { Context } from 'hono';
|
|
3
|
+
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';
|
|
@@ -14,8 +14,22 @@ export interface IError {
|
|
|
14
14
|
code: string;
|
|
15
15
|
description: string;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
interface IServiceEnv {
|
|
18
|
+
DB_USER?: string;
|
|
19
|
+
DB_HOST?: string;
|
|
20
|
+
DB_DATABASE?: string;
|
|
21
|
+
DB_PASSWORD?: string;
|
|
22
|
+
DB_PORT?: string | number;
|
|
23
|
+
DB_IS_SSL?: string;
|
|
24
|
+
TZ?: string;
|
|
25
|
+
S3_BUCKET_NAME?: string;
|
|
26
|
+
S3_REGION?: string;
|
|
27
|
+
S3_ACCESS_KEY_ID?: string;
|
|
28
|
+
S3_SECRET_ACCESS_KEY?: string;
|
|
29
|
+
SECRET_KEY_HEX?: string;
|
|
30
|
+
HMAC_KEY_BASE64?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare class Service<IEnv extends IServiceEnv = IServiceEnv> {
|
|
19
33
|
protected readonly method: MethodType;
|
|
20
34
|
get Method(): MethodType;
|
|
21
35
|
protected readonly endpoint: string;
|
|
@@ -35,10 +49,14 @@ export declare class Service {
|
|
|
35
49
|
get Tags(): Array<string>;
|
|
36
50
|
protected readonly errorList: Array<IError>;
|
|
37
51
|
get ErrorList(): Array<IError>;
|
|
38
|
-
|
|
39
|
-
protected
|
|
40
|
-
|
|
41
|
-
protected
|
|
52
|
+
private readonly req?;
|
|
53
|
+
protected get Req(): Request;
|
|
54
|
+
private readonly res?;
|
|
55
|
+
protected get Res(): Response;
|
|
56
|
+
private readonly c?;
|
|
57
|
+
protected get C(): Context;
|
|
58
|
+
get Module(): 'express' | 'hono';
|
|
59
|
+
get Env(): IEnv;
|
|
42
60
|
constructor(request: Request, response: Response);
|
|
43
61
|
constructor(c: Context);
|
|
44
62
|
inintialize(): Promise<void>;
|
|
@@ -51,9 +69,11 @@ export declare class Service {
|
|
|
51
69
|
private setPool;
|
|
52
70
|
protected checkMaintenance(): Promise<void>;
|
|
53
71
|
protected middleware(): Promise<void>;
|
|
54
|
-
|
|
72
|
+
resSuccessExpress(): void;
|
|
73
|
+
resSuccessHono(): TypedResponse<any>;
|
|
55
74
|
protected outputErrorLog(ex: any): Promise<void>;
|
|
56
|
-
|
|
75
|
+
handleExceptionExpress(ex: any): void;
|
|
76
|
+
handleExceptionHono(ex: any): TypedResponse<any>;
|
|
57
77
|
private pool?;
|
|
58
78
|
protected get Pool(): Pool;
|
|
59
79
|
private client?;
|
package/dist/Service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,EAAQ,OAAO,EAAE,MAAM,MAAM,CAAA;
|
|
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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IAAI,CAAC;IAKvB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAOzB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAOrC,OAAO,CAAC,QAAQ,CAAC,CAAc;IAC/B,IAAI,QAAQ,IAAI,WAAW,CAU1B;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"}
|
package/dist/Service.js
CHANGED
|
@@ -40,17 +40,43 @@ class Service {
|
|
|
40
40
|
description: 'サーバー内部エラー(予期せぬエラー)'
|
|
41
41
|
}];
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
get Req() {
|
|
44
|
+
if (this.req === undefined) {
|
|
45
|
+
throw new Error('This method can only be used when module is "express".');
|
|
46
|
+
}
|
|
47
|
+
return this.req;
|
|
48
|
+
}
|
|
49
|
+
get Res() {
|
|
50
|
+
if (this.res === undefined) {
|
|
51
|
+
throw new Error('This method can only be used when module is "express".');
|
|
52
|
+
}
|
|
53
|
+
return this.res;
|
|
54
|
+
}
|
|
55
|
+
get C() {
|
|
56
|
+
if (this.c === undefined) {
|
|
57
|
+
throw new Error('This method can only be used when module is "hono".');
|
|
58
|
+
}
|
|
59
|
+
return this.c;
|
|
60
|
+
}
|
|
61
|
+
get Module() {
|
|
62
|
+
if (this.c !== undefined) {
|
|
63
|
+
return 'hono';
|
|
64
|
+
}
|
|
65
|
+
else if (this.req !== undefined && this.res !== undefined) {
|
|
66
|
+
return 'express';
|
|
67
|
+
}
|
|
68
|
+
throw new Error('Failed to determine whether the module is "express" or "hono".');
|
|
69
|
+
}
|
|
70
|
+
;
|
|
71
|
+
get Env() {
|
|
72
|
+
if (this.Module === 'express') {
|
|
73
|
+
return process.env;
|
|
47
74
|
}
|
|
48
75
|
else {
|
|
49
|
-
|
|
76
|
+
return this.C.env;
|
|
50
77
|
}
|
|
51
78
|
}
|
|
52
79
|
constructor(param1, param2) {
|
|
53
|
-
this.module = 'express';
|
|
54
80
|
this.method = 'GET';
|
|
55
81
|
this.endpoint = '';
|
|
56
82
|
this.apiCode = '';
|
|
@@ -60,32 +86,30 @@ class Service {
|
|
|
60
86
|
this.response = new ResponseType_1.ResponseType();
|
|
61
87
|
this.tags = [];
|
|
62
88
|
this.errorList = [];
|
|
63
|
-
this.dbUser =
|
|
64
|
-
this.dbHost =
|
|
65
|
-
this.dbName =
|
|
66
|
-
this.dbPassword =
|
|
67
|
-
this.dbPort =
|
|
68
|
-
this.dbIsSslConnect =
|
|
89
|
+
this.dbUser = this.Env.DB_USER;
|
|
90
|
+
this.dbHost = this.Env.DB_HOST;
|
|
91
|
+
this.dbName = this.Env.DB_DATABASE;
|
|
92
|
+
this.dbPassword = this.Env.DB_PASSWORD;
|
|
93
|
+
this.dbPort = this.Env.DB_PORT;
|
|
94
|
+
this.dbIsSslConnect = this.Env.DB_IS_SSL === 'true';
|
|
69
95
|
this.isExecuteRollback = false;
|
|
70
96
|
if (param2 !== undefined) {
|
|
71
97
|
// Express の場合: (request, response)
|
|
72
|
-
this.module = 'express';
|
|
73
98
|
this.req = param1;
|
|
74
99
|
this.res = param2;
|
|
75
100
|
}
|
|
76
101
|
else {
|
|
77
102
|
// Hono の場合: (c)
|
|
78
|
-
this.module = 'hono';
|
|
79
103
|
this.c = param1;
|
|
80
104
|
}
|
|
81
105
|
}
|
|
82
106
|
inintialize() {
|
|
83
107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
if (this.
|
|
85
|
-
yield this.request.setRequest(this.
|
|
108
|
+
if (this.Module === "express") {
|
|
109
|
+
yield this.request.setRequest(this.Module, this.Req);
|
|
86
110
|
}
|
|
87
111
|
else {
|
|
88
|
-
yield this.request.setRequest(this.
|
|
112
|
+
yield this.request.setRequest(this.Module, this.C);
|
|
89
113
|
}
|
|
90
114
|
yield this.checkMaintenance();
|
|
91
115
|
yield this.middleware();
|
|
@@ -120,75 +144,121 @@ class Service {
|
|
|
120
144
|
middleware() {
|
|
121
145
|
return __awaiter(this, void 0, void 0, function* () { });
|
|
122
146
|
}
|
|
123
|
-
|
|
124
|
-
this.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return;
|
|
147
|
+
resSuccessExpress() {
|
|
148
|
+
this.Res.status(200).json(this.response.ResponseData);
|
|
149
|
+
}
|
|
150
|
+
resSuccessHono() {
|
|
151
|
+
return this.C.json(this.response.ResponseData, 200);
|
|
129
152
|
}
|
|
130
153
|
outputErrorLog(ex) {
|
|
131
154
|
return __awaiter(this, void 0, void 0, function* () { });
|
|
132
155
|
}
|
|
133
|
-
|
|
156
|
+
handleExceptionExpress(ex) {
|
|
134
157
|
// To avoid slowing down the response, make this asynchronous
|
|
135
158
|
this.outputErrorLog(ex).catch((ex) => {
|
|
136
159
|
console.error(ex);
|
|
137
160
|
});
|
|
138
161
|
if (ex instanceof Exception_1.AuthException) {
|
|
139
|
-
this.
|
|
162
|
+
this.Res.status(401).json({
|
|
140
163
|
message: "Authentication expired. Please login again."
|
|
141
164
|
});
|
|
142
165
|
}
|
|
143
166
|
else if (ex instanceof Exception_1.ForbiddenException) {
|
|
144
|
-
this.
|
|
167
|
+
this.Res.status(403).json({
|
|
145
168
|
message: 'Forbidden error'
|
|
146
169
|
});
|
|
147
170
|
}
|
|
148
171
|
else if (ex instanceof Exception_1.InputErrorException) {
|
|
149
|
-
this.
|
|
172
|
+
this.Res.status(400).json({
|
|
150
173
|
errorCode: `${this.apiCode}-${ex.ErrorId}`,
|
|
151
174
|
errorMessage: ex.message
|
|
152
175
|
});
|
|
176
|
+
return;
|
|
153
177
|
}
|
|
154
178
|
else if (ex instanceof Exception_1.DbConflictException) {
|
|
155
|
-
this.
|
|
179
|
+
this.Res.status(409).json({
|
|
156
180
|
errorCode: `${this.apiCode}-${ex.ErrorId}`,
|
|
157
181
|
errorMessage: ex.message
|
|
158
182
|
});
|
|
159
183
|
}
|
|
160
184
|
else if (ex instanceof Exception_1.UnprocessableException) {
|
|
161
|
-
this.
|
|
185
|
+
this.Res.status(422).json({
|
|
162
186
|
errorCode: `${this.apiCode}-${ex.ErrorId}`,
|
|
163
187
|
errorMessage: ex.message
|
|
164
188
|
});
|
|
165
189
|
}
|
|
166
190
|
else if (ex instanceof Exception_1.MaintenanceException) {
|
|
167
|
-
this.
|
|
191
|
+
this.Res.status(503).json({
|
|
168
192
|
errorMessage: ex.message
|
|
169
193
|
});
|
|
170
194
|
}
|
|
171
195
|
else if (ex instanceof Exception_1.NotFoundException) {
|
|
172
|
-
this.
|
|
196
|
+
this.Res.status(404).json({
|
|
173
197
|
errorCode: `${this.apiCode}-${ex.ErrorId}`,
|
|
174
198
|
errorMessage: ex.message
|
|
175
199
|
});
|
|
176
200
|
}
|
|
177
201
|
else {
|
|
178
|
-
this.
|
|
202
|
+
this.Res.status(500).json({
|
|
179
203
|
message: 'Internal server error'
|
|
180
204
|
});
|
|
181
205
|
}
|
|
182
|
-
|
|
183
|
-
|
|
206
|
+
}
|
|
207
|
+
handleExceptionHono(ex) {
|
|
208
|
+
// To avoid slowing down the response, make this asynchronous
|
|
209
|
+
this.outputErrorLog(ex).catch((ex) => {
|
|
210
|
+
console.error(ex);
|
|
211
|
+
});
|
|
212
|
+
if (ex instanceof Exception_1.AuthException) {
|
|
213
|
+
return this.C.json({
|
|
214
|
+
message: "Authentication expired. Please login again."
|
|
215
|
+
}, 401);
|
|
216
|
+
}
|
|
217
|
+
else if (ex instanceof Exception_1.ForbiddenException) {
|
|
218
|
+
return this.C.json({
|
|
219
|
+
message: 'Forbidden error'
|
|
220
|
+
}, 403);
|
|
221
|
+
}
|
|
222
|
+
else if (ex instanceof Exception_1.InputErrorException) {
|
|
223
|
+
return this.C.json({
|
|
224
|
+
errorCode: `${this.apiCode}-${ex.ErrorId}`,
|
|
225
|
+
errorMessage: ex.message
|
|
226
|
+
}, 400);
|
|
227
|
+
}
|
|
228
|
+
else if (ex instanceof Exception_1.DbConflictException) {
|
|
229
|
+
return this.C.json({
|
|
230
|
+
errorCode: `${this.apiCode}-${ex.ErrorId}`,
|
|
231
|
+
errorMessage: ex.message
|
|
232
|
+
}, 409);
|
|
233
|
+
}
|
|
234
|
+
else if (ex instanceof Exception_1.UnprocessableException) {
|
|
235
|
+
return this.C.json({
|
|
236
|
+
errorCode: `${this.apiCode}-${ex.ErrorId}`,
|
|
237
|
+
errorMessage: ex.message
|
|
238
|
+
}, 422);
|
|
239
|
+
}
|
|
240
|
+
else if (ex instanceof Exception_1.MaintenanceException) {
|
|
241
|
+
return this.C.json({
|
|
242
|
+
errorMessage: ex.message
|
|
243
|
+
}, 503);
|
|
244
|
+
}
|
|
245
|
+
else if (ex instanceof Exception_1.NotFoundException) {
|
|
246
|
+
return this.C.json({
|
|
247
|
+
errorCode: `${this.apiCode}-${ex.ErrorId}`,
|
|
248
|
+
errorMessage: ex.message
|
|
249
|
+
}, 404);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
return this.C.json({
|
|
253
|
+
message: 'Internal server error'
|
|
254
|
+
}, 500);
|
|
184
255
|
}
|
|
185
|
-
return;
|
|
186
256
|
}
|
|
187
257
|
get Pool() {
|
|
188
258
|
var _a;
|
|
189
259
|
if (this.pool === undefined) {
|
|
190
260
|
this.pool = this.setPool();
|
|
191
|
-
this.pool.query(`SET TIME ZONE '${(_a =
|
|
261
|
+
this.pool.query(`SET TIME ZONE '${(_a = this.Env.TZ) !== null && _a !== void 0 ? _a : 'Asia/Tokyo'}';`);
|
|
192
262
|
}
|
|
193
263
|
return this.pool;
|
|
194
264
|
}
|
|
@@ -230,10 +300,10 @@ class Service {
|
|
|
230
300
|
get S3Client() {
|
|
231
301
|
if (this.s3Client === undefined) {
|
|
232
302
|
this.s3Client = new AwsS3Client_1.AwsS3Client({
|
|
233
|
-
bucketName:
|
|
234
|
-
region:
|
|
235
|
-
accessKeyId:
|
|
236
|
-
secretAccessKey:
|
|
303
|
+
bucketName: this.Env.S3_BUCKET_NAME,
|
|
304
|
+
region: this.Env.S3_REGION,
|
|
305
|
+
accessKeyId: this.Env.S3_ACCESS_KEY_ID,
|
|
306
|
+
secretAccessKey: this.Env.S3_SECRET_ACCESS_KEY
|
|
237
307
|
});
|
|
238
308
|
}
|
|
239
309
|
return this.s3Client;
|
|
@@ -247,8 +317,8 @@ class Service {
|
|
|
247
317
|
get EncryptClient() {
|
|
248
318
|
if (this.encryptClient === undefined) {
|
|
249
319
|
this.encryptClient = new EncryptClient_1.EncryptClient({
|
|
250
|
-
secretKeyHex:
|
|
251
|
-
hmacKeyBase64:
|
|
320
|
+
secretKeyHex: this.Env.SECRET_KEY_HEX,
|
|
321
|
+
hmacKeyBase64: this.Env.HMAC_KEY_BASE64
|
|
252
322
|
});
|
|
253
323
|
}
|
|
254
324
|
return this.encryptClient;
|