pg-mvc-service 2.1.0 → 2.1.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/PoolManager.d.ts +7 -0
- package/dist/PoolManager.d.ts.map +1 -0
- package/dist/Service.d.ts +82 -0
- package/dist/Service.d.ts.map +1 -0
- package/dist/Utils/DateTimeUtil.d.ts +58 -0
- package/dist/Utils/DateTimeUtil.d.ts.map +1 -0
- package/dist/Utils/NumberUtil.d.ts +10 -0
- package/dist/Utils/NumberUtil.d.ts.map +1 -0
- package/dist/Utils/StringUtil.d.ts +16 -0
- package/dist/Utils/StringUtil.d.ts.map +1 -0
- package/dist/clients/AwsS3Client.d.ts +35 -0
- package/dist/clients/AwsS3Client.d.ts.map +1 -0
- package/dist/clients/Base64Client.d.ts +31 -0
- package/dist/clients/Base64Client.d.ts.map +1 -0
- package/dist/clients/EncryptClient.d.ts +18 -0
- package/dist/clients/EncryptClient.d.ts.map +1 -0
- package/dist/clients/StringClient.d.ts +6 -0
- package/dist/clients/StringClient.d.ts.map +1 -0
- package/dist/cron/BaseCron.d.ts +35 -0
- package/dist/cron/BaseCron.d.ts.map +1 -0
- package/dist/cron/CronExecuter.d.ts +2 -0
- package/dist/cron/CronExecuter.d.ts.map +1 -0
- package/dist/cron/CronType.d.ts +6 -0
- package/dist/cron/CronType.d.ts.map +1 -0
- package/dist/documents/Swagger.d.ts +10 -0
- package/dist/documents/Swagger.d.ts.map +1 -0
- package/dist/exceptions/Exception.d.ts +31 -0
- package/dist/exceptions/Exception.d.ts.map +1 -0
- package/{src/index.ts → dist/index.d.ts} +2 -6
- package/dist/index.d.ts.map +1 -0
- package/dist/models/ExpressionClient.d.ts +12 -0
- package/dist/models/ExpressionClient.d.ts.map +1 -0
- package/dist/models/MigrateDatabase.d.ts +19 -0
- package/dist/models/MigrateDatabase.d.ts.map +1 -0
- package/dist/models/MigrateRollback.d.ts +18 -0
- package/dist/models/MigrateRollback.d.ts.map +1 -0
- package/dist/models/MigrateTable.d.ts +13 -0
- package/dist/models/MigrateTable.d.ts.map +1 -0
- package/dist/models/SqlUtils/SelectExpression.d.ts +31 -0
- package/dist/models/SqlUtils/SelectExpression.d.ts.map +1 -0
- package/dist/models/SqlUtils/UpdateExpression.d.ts +8 -0
- package/dist/models/SqlUtils/UpdateExpression.d.ts.map +1 -0
- package/dist/models/SqlUtils/ValidateValueUtil.d.ts +19 -0
- package/dist/models/SqlUtils/ValidateValueUtil.d.ts.map +1 -0
- package/dist/models/SqlUtils/WhereExpression.d.ts +30 -0
- package/dist/models/SqlUtils/WhereExpression.d.ts.map +1 -0
- package/dist/models/TableDoc.d.ts +3 -0
- package/dist/models/TableDoc.d.ts.map +1 -0
- package/dist/models/TableModel.d.ts +196 -0
- package/dist/models/TableModel.d.ts.map +1 -0
- package/dist/models/Type.d.ts +64 -0
- package/dist/models/Type.d.ts.map +1 -0
- package/dist/models/Utils/MessageUtil.d.ts +7 -0
- package/dist/models/Utils/MessageUtil.d.ts.map +1 -0
- package/dist/models/ValidateClient.d.ts +27 -0
- package/dist/models/ValidateClient.d.ts.map +1 -0
- package/dist/reqestResponse/ReqResType.d.ts +113 -0
- package/dist/reqestResponse/ReqResType.d.ts.map +1 -0
- package/dist/reqestResponse/RequestType.d.ts +247 -0
- package/dist/reqestResponse/RequestType.d.ts.map +1 -0
- package/dist/reqestResponse/ResponseType.d.ts +85 -0
- package/dist/reqestResponse/ResponseType.d.ts.map +1 -0
- package/package.json +7 -1
- package/index.d.ts +0 -192
- package/src/PoolManager.ts +0 -48
- package/src/Service.ts +0 -307
- package/src/Utils/DateTimeUtil.ts +0 -146
- package/src/Utils/NumberUtil.ts +0 -23
- package/src/Utils/StringUtil.ts +0 -33
- package/src/clients/AwsS3Client.ts +0 -310
- package/src/clients/Base64Client.ts +0 -305
- package/src/clients/EncryptClient.ts +0 -100
- package/src/clients/StringClient.ts +0 -19
- package/src/cron/BaseCron.ts +0 -122
- package/src/cron/CronExecuter.ts +0 -34
- package/src/cron/CronType.ts +0 -25
- package/src/documents/Swagger.ts +0 -106
- package/src/exceptions/Exception.ts +0 -72
- package/src/models/ExpressionClient.ts +0 -72
- package/src/models/MigrateDatabase.ts +0 -135
- package/src/models/MigrateRollback.ts +0 -151
- package/src/models/MigrateTable.ts +0 -56
- package/src/models/SqlUtils/SelectExpression.ts +0 -102
- package/src/models/SqlUtils/UpdateExpression.ts +0 -29
- package/src/models/SqlUtils/ValidateValueUtil.ts +0 -354
- package/src/models/SqlUtils/WhereExpression.ts +0 -455
- package/src/models/TableDoc.ts +0 -372
- package/src/models/TableModel.ts +0 -749
- package/src/models/Type.ts +0 -62
- package/src/models/Utils/MessageUtil.ts +0 -60
- package/src/models/ValidateClient.ts +0 -182
- package/src/reqestResponse/ReqResType.ts +0 -241
- package/src/reqestResponse/RequestType.ts +0 -1619
- package/src/reqestResponse/ResponseType.ts +0 -549
- package/tsconfig.json +0 -14
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { Request } from 'express';
|
|
2
|
+
import ReqResType, { EnumType, NumberType, PrimitiveType, StringType } from "./ReqResType";
|
|
3
|
+
import { IError } from '../Service';
|
|
4
|
+
import { Context } from 'hono';
|
|
5
|
+
export interface ErrorMessageType {
|
|
6
|
+
REQUIRED: string;
|
|
7
|
+
UNNECESSARY: string;
|
|
8
|
+
INVALID_OBJECT: string;
|
|
9
|
+
INVALID_ARRAY: string;
|
|
10
|
+
INVALID_NUMBER: string;
|
|
11
|
+
INVALID_NUMBER_MIN: string;
|
|
12
|
+
INVALID_NUMBER_MAX: string;
|
|
13
|
+
INVALID_BOOL: string;
|
|
14
|
+
INVALID_STRING: string;
|
|
15
|
+
INVALID_STRING_MAX_LENGTH: string;
|
|
16
|
+
INVALID_STRING_REG_EXP: string;
|
|
17
|
+
INVALID_UUID: string;
|
|
18
|
+
INVALID_MAIL: string;
|
|
19
|
+
INVALID_HTTPS: string;
|
|
20
|
+
INVALID_DATE: string;
|
|
21
|
+
INVALID_TIME: string;
|
|
22
|
+
INVALID_DATETIME: string;
|
|
23
|
+
INVALID_BASE64: string;
|
|
24
|
+
INVALID_ENUM: string;
|
|
25
|
+
INVALID_MAP_NUMBER: string;
|
|
26
|
+
INVALID_MAP_STRING: string;
|
|
27
|
+
INVALID_MAP_BOOL: string;
|
|
28
|
+
}
|
|
29
|
+
export declare class RequestType extends ReqResType {
|
|
30
|
+
private readonly ERROR_MESSAGE_ENGLISH;
|
|
31
|
+
private readonly ERROR_MESSAGE_JAPAN;
|
|
32
|
+
protected readonly ERROR_MESSAGE: ErrorMessageType;
|
|
33
|
+
protected paramProperties: Array<(PrimitiveType | StringType | NumberType | EnumType) & {
|
|
34
|
+
key: string;
|
|
35
|
+
}>;
|
|
36
|
+
get paramPath(): string;
|
|
37
|
+
private params?;
|
|
38
|
+
get Params(): {
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
};
|
|
41
|
+
private data?;
|
|
42
|
+
get Data(): {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
private headers?;
|
|
46
|
+
get Headers(): IncomingHttpHeaders;
|
|
47
|
+
get Authorization(): string | null;
|
|
48
|
+
setRequest(module: 'express' | 'hono', request: Request | Context): Promise<void>;
|
|
49
|
+
private createErrorMessage;
|
|
50
|
+
/**
|
|
51
|
+
* Generates an error message based on the provided code, keys, and value.
|
|
52
|
+
* 指定されたコード、キー、および値に基づいてエラーメッセージを生成します。
|
|
53
|
+
* @param {string} code - The error code. エラーコード
|
|
54
|
+
* @param {Array<string | number>} keys - The keys indicating the property path. プロパティパスを示すキー
|
|
55
|
+
* @param {any} value - The value that caused the error. エラーを引き起こした値
|
|
56
|
+
* @returns {string} The generated error message. 生成されたエラーメッセージ
|
|
57
|
+
*/
|
|
58
|
+
private throwInputError;
|
|
59
|
+
/**
|
|
60
|
+
* Sets the values of the request body to the class properties.
|
|
61
|
+
* リクエストボディの値をクラスのプロパティにセットします。
|
|
62
|
+
*
|
|
63
|
+
* Note: This method is implemented as a separate method rather than in the constructor.
|
|
64
|
+
* This is because if executed in the constructor, the properties of the inheriting class
|
|
65
|
+
* are not yet initialized, and the values cannot be set correctly.
|
|
66
|
+
* 注意: このメソッドはコンストラクタではなく別メソッドとして実装されています。
|
|
67
|
+
* これは、コンストラクタ内で実行すると継承先のクラスのプロパティが
|
|
68
|
+
* まだ初期化されていないため、正しく値をセットできないためです。
|
|
69
|
+
*
|
|
70
|
+
* @param {Object} body - Request body object, リクエストボディオブジェクト
|
|
71
|
+
* @throws {InputErrorException} Thrown when the input value is invalid, 入力値が不正な場合にスローされます
|
|
72
|
+
*/
|
|
73
|
+
private createBody;
|
|
74
|
+
/**
|
|
75
|
+
* Sets the value for an enum type based on the specified keys.
|
|
76
|
+
* 指定されたキーに基づいて列挙型の値を設定します。
|
|
77
|
+
* @param {Array<string | number>} keys - Path to the target (array of strings or index numbers)
|
|
78
|
+
* 処理対象のパス(文字列またはインデックス番号の配列)
|
|
79
|
+
* @param {any} value - Value to be set
|
|
80
|
+
* 設定する値
|
|
81
|
+
* @throws {InputErrorException} Thrown when the type does not match
|
|
82
|
+
* 型が一致しない場合にスローされます
|
|
83
|
+
*/
|
|
84
|
+
private setEnum;
|
|
85
|
+
/**
|
|
86
|
+
* Recursively processes array type values.
|
|
87
|
+
* Validates each element of the array and converts it to the appropriate type.
|
|
88
|
+
* 配列型の値を再帰的に処理します。
|
|
89
|
+
* 配列の各要素を検証し、適切な型に変換します。
|
|
90
|
+
*
|
|
91
|
+
* @param {Array<string | number>} keys - Current processing path (array of strings or index numbers)
|
|
92
|
+
* 現在の処理パス(文字列またはインデックス番号の配列)
|
|
93
|
+
* @param {any[]} values - Array to be processed
|
|
94
|
+
* 処理対象の配列
|
|
95
|
+
* @throws {InputErrorException} Thrown when the type of an array element is invalid
|
|
96
|
+
* 配列要素の型が不正な場合にスローされます
|
|
97
|
+
*/
|
|
98
|
+
private setArray;
|
|
99
|
+
/**
|
|
100
|
+
* Set the value of the request body to the specified path.
|
|
101
|
+
* Automatically create intermediate objects or arrays as needed.
|
|
102
|
+
* リクエストボディの値を指定されたパスに設定します。
|
|
103
|
+
* 必要に応じて中間のオブジェクトや配列を自動的に作成します。
|
|
104
|
+
* @param {Array<string | number>} keys - Path to the destination (array of strings or index numbers)
|
|
105
|
+
* 設定先へのパス(文字列またはインデックス番号の配列)
|
|
106
|
+
* @param {any} value - Value to be set
|
|
107
|
+
* 設定する値
|
|
108
|
+
*/
|
|
109
|
+
private changeBody;
|
|
110
|
+
/**
|
|
111
|
+
* Process object type values recursively.
|
|
112
|
+
* Validate object properties and convert them to appropriate types.
|
|
113
|
+
* オブジェクト型の値を再帰的に処理します。
|
|
114
|
+
* オブジェクトのプロパティを検証し、適切な型に変換します。
|
|
115
|
+
* @param {Array<string | number>} keys - Current processing path (array of strings or index numbers)
|
|
116
|
+
* 現在の処理パス(文字列またはインデックス番号の配列)
|
|
117
|
+
* @param {object} values - Object to be processed
|
|
118
|
+
* 処理対象のオブジェクト
|
|
119
|
+
* @throws {InputErrorException} Thrown when the property type is invalid
|
|
120
|
+
* プロパティの型が不正な場合にスローされます
|
|
121
|
+
*/
|
|
122
|
+
private setObject;
|
|
123
|
+
/**
|
|
124
|
+
* Convert the input value based on the specified type.
|
|
125
|
+
* Throws an exception if type conversion fails.
|
|
126
|
+
* 指定された型に基づいて入力値を変換します。
|
|
127
|
+
* 型変換に失敗した場合は例外をスローします。
|
|
128
|
+
*
|
|
129
|
+
* @param {string} property - The type to convert to (e.g., 'number', 'boolean', 'string', 'date', 'time', 'datetime')
|
|
130
|
+
* 変換する型(例: 'number', 'boolean', 'string', 'date', 'time', 'datetime')
|
|
131
|
+
* @param {any} value - The value to convert
|
|
132
|
+
* 変換する値
|
|
133
|
+
* @param {Array<string | number>} keys - The path to the target (array of strings or index numbers)
|
|
134
|
+
* 処理対象のパス(文字列またはインデックス番号の配列)
|
|
135
|
+
* @returns {any} The converted value, 変換された値
|
|
136
|
+
* @throws {InputErrorException} Thrown if type conversion fails, 型変換に失敗した場合にスローされます
|
|
137
|
+
*/
|
|
138
|
+
private convertValue;
|
|
139
|
+
/**
|
|
140
|
+
* Convert the input value to the specified type.
|
|
141
|
+
* Throws an exception if type conversion fails.
|
|
142
|
+
* 入力値を指定された型に変換します。
|
|
143
|
+
* 型変換に失敗した場合は例外をスローします。
|
|
144
|
+
* @param {Array<string | number>} keys - Path to the target (array of strings or index numbers)
|
|
145
|
+
* 処理対象のパス(文字列またはインデックス番号の配列)
|
|
146
|
+
* @param {any} value - Value to be converted
|
|
147
|
+
* 変換する値
|
|
148
|
+
* @throws {InputErrorException} Thrown when type conversion fails
|
|
149
|
+
* 型変換に失敗した場合にスローされます
|
|
150
|
+
*/
|
|
151
|
+
private convertInput;
|
|
152
|
+
/**
|
|
153
|
+
* Generates a Swagger YAML definition from the request body.
|
|
154
|
+
* リクエストボディからSwaggerのYAML定義を生成します。
|
|
155
|
+
* @returns {string} Swagger format YAML definition
|
|
156
|
+
* Swagger形式のYAML定義
|
|
157
|
+
*/
|
|
158
|
+
createSwagger(method: string): string;
|
|
159
|
+
/**
|
|
160
|
+
* Generates Swagger properties from object type properties
|
|
161
|
+
* オブジェクト型のプロパティからSwaggerのプロパティを生成
|
|
162
|
+
* @param {Array.<string|number>} keys - Path to the properties
|
|
163
|
+
* プロパティへのパス
|
|
164
|
+
* @returns {string} Swagger format property definition
|
|
165
|
+
* Swagger形式のプロパティ定義
|
|
166
|
+
*/
|
|
167
|
+
private makeSwaggerProperyFromObject;
|
|
168
|
+
/**
|
|
169
|
+
* Generates Swagger properties from array type properties
|
|
170
|
+
* 配列型のプロパティからSwaggerのプロパティを生成
|
|
171
|
+
* @param {Array.<string|number>} keys - Path to the properties
|
|
172
|
+
* プロパティへのパス
|
|
173
|
+
* @returns {string} Swagger format property definition
|
|
174
|
+
* Swagger形式のプロパティ定義
|
|
175
|
+
*/
|
|
176
|
+
private makeSwaggerPropertyFromArray;
|
|
177
|
+
getInputErrorList(method: string): Array<IError>;
|
|
178
|
+
private getErrorObject;
|
|
179
|
+
private getErrorArray;
|
|
180
|
+
private getError;
|
|
181
|
+
}
|
|
182
|
+
export interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
|
|
183
|
+
accept?: string | undefined;
|
|
184
|
+
"accept-language"?: string | undefined;
|
|
185
|
+
"accept-patch"?: string | undefined;
|
|
186
|
+
"accept-ranges"?: string | undefined;
|
|
187
|
+
"access-control-allow-credentials"?: string | undefined;
|
|
188
|
+
"access-control-allow-headers"?: string | undefined;
|
|
189
|
+
"access-control-allow-methods"?: string | undefined;
|
|
190
|
+
"access-control-allow-origin"?: string | undefined;
|
|
191
|
+
"access-control-expose-headers"?: string | undefined;
|
|
192
|
+
"access-control-max-age"?: string | undefined;
|
|
193
|
+
"access-control-request-headers"?: string | undefined;
|
|
194
|
+
"access-control-request-method"?: string | undefined;
|
|
195
|
+
age?: string | undefined;
|
|
196
|
+
allow?: string | undefined;
|
|
197
|
+
"alt-svc"?: string | undefined;
|
|
198
|
+
authorization?: string | undefined;
|
|
199
|
+
"cache-control"?: string | undefined;
|
|
200
|
+
connection?: string | undefined;
|
|
201
|
+
"content-disposition"?: string | undefined;
|
|
202
|
+
"content-encoding"?: string | undefined;
|
|
203
|
+
"content-language"?: string | undefined;
|
|
204
|
+
"content-length"?: string | undefined;
|
|
205
|
+
"content-location"?: string | undefined;
|
|
206
|
+
"content-range"?: string | undefined;
|
|
207
|
+
"content-type"?: string | undefined;
|
|
208
|
+
cookie?: string | undefined;
|
|
209
|
+
date?: string | undefined;
|
|
210
|
+
etag?: string | undefined;
|
|
211
|
+
expect?: string | undefined;
|
|
212
|
+
expires?: string | undefined;
|
|
213
|
+
forwarded?: string | undefined;
|
|
214
|
+
from?: string | undefined;
|
|
215
|
+
host?: string | undefined;
|
|
216
|
+
"if-match"?: string | undefined;
|
|
217
|
+
"if-modified-since"?: string | undefined;
|
|
218
|
+
"if-none-match"?: string | undefined;
|
|
219
|
+
"if-unmodified-since"?: string | undefined;
|
|
220
|
+
"last-modified"?: string | undefined;
|
|
221
|
+
location?: string | undefined;
|
|
222
|
+
origin?: string | undefined;
|
|
223
|
+
pragma?: string | undefined;
|
|
224
|
+
"proxy-authenticate"?: string | undefined;
|
|
225
|
+
"proxy-authorization"?: string | undefined;
|
|
226
|
+
"public-key-pins"?: string | undefined;
|
|
227
|
+
range?: string | undefined;
|
|
228
|
+
referer?: string | undefined;
|
|
229
|
+
"retry-after"?: string | undefined;
|
|
230
|
+
"sec-websocket-accept"?: string | undefined;
|
|
231
|
+
"sec-websocket-extensions"?: string | undefined;
|
|
232
|
+
"sec-websocket-key"?: string | undefined;
|
|
233
|
+
"sec-websocket-protocol"?: string | undefined;
|
|
234
|
+
"sec-websocket-version"?: string | undefined;
|
|
235
|
+
"set-cookie"?: string[] | undefined;
|
|
236
|
+
"strict-transport-security"?: string | undefined;
|
|
237
|
+
tk?: string | undefined;
|
|
238
|
+
trailer?: string | undefined;
|
|
239
|
+
"transfer-encoding"?: string | undefined;
|
|
240
|
+
upgrade?: string | undefined;
|
|
241
|
+
"user-agent"?: string | undefined;
|
|
242
|
+
vary?: string | undefined;
|
|
243
|
+
via?: string | undefined;
|
|
244
|
+
warning?: string | undefined;
|
|
245
|
+
"www-authenticate"?: string | undefined;
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=RequestType.d.ts.map
|
|
@@ -0,0 +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,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,MA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,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACpC,2BAA2B,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjD,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3C"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import ReqResType from "./ReqResType";
|
|
2
|
+
import { IError } from "../Service";
|
|
3
|
+
export declare class ResponseType extends ReqResType {
|
|
4
|
+
/**
|
|
5
|
+
* Property to store response data
|
|
6
|
+
* レスポンスデータを格納するためのプロパティ
|
|
7
|
+
*/
|
|
8
|
+
Data: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Convert and retrieve data according to the type definition
|
|
13
|
+
* 型定義に従ってデータを変換して取得
|
|
14
|
+
* @returns {Object.<string, any>} Converted data, 変換されたデータ
|
|
15
|
+
*/
|
|
16
|
+
get ResponseData(): {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Retrieve object type data
|
|
21
|
+
* オブジェクト型のデータを取得
|
|
22
|
+
* @param {Array.<string|number>} keys - Path to the property, プロパティへのパス
|
|
23
|
+
* @returns {Object.<string, any>} Retrieved object data, 取得されたオブジェクトデータ
|
|
24
|
+
*/
|
|
25
|
+
private getObject;
|
|
26
|
+
/**
|
|
27
|
+
* Retrieve array type data
|
|
28
|
+
* 配列型のデータを取得
|
|
29
|
+
* @param {Array.<string|number>} keys - Path to the property, プロパティへのパス
|
|
30
|
+
* @returns {Array<any> | undefined} Retrieved array data, 取得された配列データ
|
|
31
|
+
*/
|
|
32
|
+
private getArray;
|
|
33
|
+
/**
|
|
34
|
+
* Retrieve array type data
|
|
35
|
+
* 配列型のデータを取得
|
|
36
|
+
* @param {Array.<string|number>} keys - Path to the property, プロパティへのパス
|
|
37
|
+
* @returns {Array<any> | undefined} Retrieved array data, 取得された配列データ
|
|
38
|
+
*/
|
|
39
|
+
private getMap;
|
|
40
|
+
/**
|
|
41
|
+
* Retrieve data based on the provided keys
|
|
42
|
+
* 指定されたキーに基づいてデータを取得
|
|
43
|
+
* @param {Array.<string|number>} keys - Path to the data, データへのパス
|
|
44
|
+
* @returns {any} Retrieved data, 取得されたデータ
|
|
45
|
+
*/
|
|
46
|
+
private getData;
|
|
47
|
+
/**
|
|
48
|
+
* Retrieve value based on the provided keys
|
|
49
|
+
* 指定されたキーに基づいて値を取得
|
|
50
|
+
* @param {Array.<string|number>} keys - Path to the value, 値へのパス
|
|
51
|
+
* @returns {string | number | boolean | null | undefined} Retrieved value, 取得された値
|
|
52
|
+
*/
|
|
53
|
+
private getValue;
|
|
54
|
+
/**
|
|
55
|
+
* Generates Swagger response definition
|
|
56
|
+
* Swaggerのレスポンス定義を生成します
|
|
57
|
+
* @returns {string} Swagger format response definition
|
|
58
|
+
* Swagger形式のレスポンス定義
|
|
59
|
+
*/
|
|
60
|
+
createSwagger(errorList: Array<IError>, apiCode: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* Generates Swagger properties from object type properties
|
|
63
|
+
* オブジェクト型のプロパティからSwaggerのプロパティを生成
|
|
64
|
+
* @param {Array.<string|number>} keys - Path to the properties
|
|
65
|
+
* プロパティへのパス
|
|
66
|
+
* @returns {string} Swagger format property definition
|
|
67
|
+
* Swagger形式のプロパティ定義
|
|
68
|
+
*/
|
|
69
|
+
private makeSwaggerProperyFromObject;
|
|
70
|
+
/**
|
|
71
|
+
* Generates Swagger properties from array type properties
|
|
72
|
+
* 配列型のプロパティからSwaggerのプロパティを生成
|
|
73
|
+
* @param {Array.<string|number>} keys - Path to the properties, プロパティへのパス
|
|
74
|
+
* @returns {string} Swagger format property definition, Swagger形式のプロパティ定義
|
|
75
|
+
*/
|
|
76
|
+
private makeSwaggerPropertyFromArray;
|
|
77
|
+
/**
|
|
78
|
+
* Generates Swagger properties from array type properties
|
|
79
|
+
* 配列型のプロパティからSwaggerのプロパティを生成
|
|
80
|
+
* @param {Array.<string|number>} keys - Path to the properties, プロパティへのパス
|
|
81
|
+
* @returns {string} Swagger format property definition, Swagger形式のプロパティ定義
|
|
82
|
+
*/
|
|
83
|
+
private makeSwaggerPropertyFromDictionary;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=ResponseType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResponseType.d.ts","sourceRoot":"","sources":["../../src/reqestResponse/ResponseType.ts"],"names":[],"mappings":"AAEA,OAAO,UAA4B,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAIpC,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.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://github.com/n-daira/npm-pack_mvc-service#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
"author": "Sho Nakadaira",
|
|
15
15
|
"type": "commonjs",
|
|
16
16
|
"main": "dist/index.js",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/**/*",
|
|
20
|
+
"README.md",
|
|
21
|
+
"package.json"
|
|
22
|
+
],
|
|
17
23
|
"scripts": {
|
|
18
24
|
"build": "rm -rf dist/* && tsc",
|
|
19
25
|
"test": "echo \"Error: no test specified\" && exit 1"
|
package/index.d.ts
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { AxiosResponse } from "axios";
|
|
2
|
-
import { Request, Response } from 'express';
|
|
3
|
-
import { Pool, PoolClient } from 'pg';
|
|
4
|
-
import { ErrorMessageType, IncomingHttpHeaders } from './src/reqestResponse/RequestType';
|
|
5
|
-
import { ArrayType, EnumType, MapType, NumberType, ObjectType, PrimitiveType, StringType } from './src/reqestResponse/ReqResType';
|
|
6
|
-
|
|
7
|
-
import { MethodType } from './src/Service';
|
|
8
|
-
export { MethodType } from './src/Service';
|
|
9
|
-
|
|
10
|
-
import { Base64Client } from './src/clients/Base64Client';
|
|
11
|
-
import { StringClient } from './src/clients/StringClient';
|
|
12
|
-
import { EncryptClient } from './src/clients/EncryptClient';
|
|
13
|
-
|
|
14
|
-
import { AwsS3Client } from './src/clients/AwsS3Client';
|
|
15
|
-
export { AwsS3Client } from './src/clients/AwsS3Client';
|
|
16
|
-
|
|
17
|
-
// models class
|
|
18
|
-
import ValidateClient from './src/models/ValidateClient';
|
|
19
|
-
|
|
20
|
-
import { TableModel } from "./src/models/TableModel";
|
|
21
|
-
export { TableModel } from "./src/models/TableModel";
|
|
22
|
-
|
|
23
|
-
import { WhereExpression } from './src/models/SqlUtils/WhereExpression';
|
|
24
|
-
export { WhereExpression } from './src/models/SqlUtils/WhereExpression';
|
|
25
|
-
|
|
26
|
-
export { TColumnAttribute, TColumnType, TColumnArrayType, TColumn, TColumnDetail, TOperator, TColumnInfo, TQuery, TSelectExpression, TAggregateFuncType, TCondition, TNestedCondition, TSortKeyword, TKeyFormat } from './src/models/Type';
|
|
27
|
-
|
|
28
|
-
export { DayType, MonthType, DateType, HourType, MinuteSecondType } from './src/cron/CronType';
|
|
29
|
-
export { BaseCron } from "./src/cron/BaseCron";
|
|
30
|
-
export { runCron } from "./src/cron/CronExecuter";
|
|
31
|
-
|
|
32
|
-
declare module 'pg-mvc-service' {
|
|
33
|
-
export class Service {
|
|
34
|
-
protected readonly method: MethodType;
|
|
35
|
-
get Method(): MethodType;
|
|
36
|
-
protected readonly endpoint: string;
|
|
37
|
-
get Endpoint(): string;
|
|
38
|
-
protected readonly apiCode: string;
|
|
39
|
-
get ApiCode(): string;
|
|
40
|
-
protected readonly summary: string;
|
|
41
|
-
get Summary(): string;
|
|
42
|
-
protected readonly apiUserAvailable: string;
|
|
43
|
-
get ApiUserAvailable(): string;
|
|
44
|
-
protected readonly request: RequestType;
|
|
45
|
-
get AuthToken(): string;
|
|
46
|
-
protected readonly response: ResponseType;
|
|
47
|
-
protected readonly isTest: boolean;
|
|
48
|
-
protected readonly tags: Array<string>;
|
|
49
|
-
get Tags(): Array<string>;
|
|
50
|
-
|
|
51
|
-
protected readonly req: Request;
|
|
52
|
-
protected readonly res: Response;
|
|
53
|
-
constructor(request: Request, response: Response);
|
|
54
|
-
|
|
55
|
-
public inintialize(): void;
|
|
56
|
-
|
|
57
|
-
protected dbUser?: string;
|
|
58
|
-
protected dbHost?: string;
|
|
59
|
-
protected dbName?: string;
|
|
60
|
-
protected dbPassword?: string;
|
|
61
|
-
protected dbPort?: number;
|
|
62
|
-
protected dbIsSslConnect?: boolean;
|
|
63
|
-
protected checkMaintenance(): Promise<void>;
|
|
64
|
-
protected middleware(): Promise<void>;
|
|
65
|
-
|
|
66
|
-
public resSuccess(): void;
|
|
67
|
-
public handleException(ex: any): void;
|
|
68
|
-
protected outputErrorLog(ex: any): Promise<void>;
|
|
69
|
-
|
|
70
|
-
protected get Pool(): Pool;
|
|
71
|
-
protected get Client(): PoolClient;
|
|
72
|
-
|
|
73
|
-
public startConnect(): Promise<void>;
|
|
74
|
-
public commit(): Promise<void>;
|
|
75
|
-
public rollback(): Promise<void>;
|
|
76
|
-
public release(): Promise<void>;
|
|
77
|
-
|
|
78
|
-
get S3Client(): AwsS3Client;
|
|
79
|
-
get Base64Client(): Base64Client;
|
|
80
|
-
get StringClient(): StringClient;
|
|
81
|
-
get EncryptClient(): EncryptClient;
|
|
82
|
-
|
|
83
|
-
public requestApi<TRequest=Record<string, any>, TResponse={[key: string]: any}>(
|
|
84
|
-
method: MethodType, url: string, params: TRequest, header: {[key: string]: any}): Promise<AxiosResponse<TResponse>>;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export interface IParams {
|
|
88
|
-
in: 'header' | 'path',
|
|
89
|
-
name: string,
|
|
90
|
-
require?: boolean,
|
|
91
|
-
description?: string,
|
|
92
|
-
example?: string
|
|
93
|
-
}
|
|
94
|
-
export function createSwagger(services: Service[], name: string, url: string, params: Array<IParams>): string;
|
|
95
|
-
|
|
96
|
-
export type PropertyType = PrimitiveType | StringType | NumberType | ObjectType | ArrayType | EnumType | MapType;
|
|
97
|
-
|
|
98
|
-
export class RequestType {
|
|
99
|
-
constructor();
|
|
100
|
-
|
|
101
|
-
protected properties: { [key: string]: PropertyType; };
|
|
102
|
-
protected paramProperties: Array<(PrimitiveType | StringType | NumberType | EnumType) & { key: string }>;
|
|
103
|
-
protected readonly ERROR_MESSAGE: ErrorMessageType;
|
|
104
|
-
|
|
105
|
-
protected throwException(code: string, message: string): never;
|
|
106
|
-
|
|
107
|
-
public setRequest(request: Request): void;
|
|
108
|
-
get Data(): { [key: string]: any };
|
|
109
|
-
get Headers(): IncomingHttpHeaders;
|
|
110
|
-
get Params(): { [key: string]: any };
|
|
111
|
-
get RemoteAddress(): string | undefined;
|
|
112
|
-
get Authorization(): string | null;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export class ResponseType {
|
|
116
|
-
public Data: { [key: string]: any };
|
|
117
|
-
|
|
118
|
-
protected properties: { [key: string]: PropertyType; };
|
|
119
|
-
get ResponseData(): { [key: string]: any };
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export class AuthException extends Error {
|
|
123
|
-
private id: string;
|
|
124
|
-
get Id(): string;
|
|
125
|
-
constructor(id: string, message?: string);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export class ForbiddenException extends Error {
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export class InputErrorException extends Error {
|
|
132
|
-
private errorId: string;
|
|
133
|
-
get ErrorId(): string;
|
|
134
|
-
private errorLog: string;
|
|
135
|
-
get ErrorLog(): string;
|
|
136
|
-
constructor(errorId: string, message?: string, errorLog?: string);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export class MaintenanceException extends Error {
|
|
140
|
-
constructor(message?: string);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export class DbConflictException extends Error {
|
|
144
|
-
private errorId: string;
|
|
145
|
-
get ErrorId(): string;
|
|
146
|
-
constructor(errorId: string, message?: string);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export class NotFoundException extends Error {
|
|
150
|
-
private errorId: string;
|
|
151
|
-
get ErrorId(): string;
|
|
152
|
-
constructor(errorId: string, message?: string);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export class UnprocessableException extends Error {
|
|
156
|
-
private errorId: string;
|
|
157
|
-
get ErrorId(): string;
|
|
158
|
-
constructor(errorId: string, message?: string);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export function createTableDoc(models: Array<TableModel>, serviceName?: string): string;
|
|
162
|
-
export function migrate(migrates: Array<MigrateTable>, poolParam: {
|
|
163
|
-
host: string, user: string, dbName: string, password: string, port?: number, isSsl?: boolean
|
|
164
|
-
}): Promise<void>;
|
|
165
|
-
export function rollback(toNumber: number, poolParam: {
|
|
166
|
-
host: string, user: string, dbName: string, password: string, port?: number, isSsl?: boolean
|
|
167
|
-
}): Promise<void>;
|
|
168
|
-
export class MigrateTable {
|
|
169
|
-
protected readonly migrateSql: string;
|
|
170
|
-
protected readonly rollbackSql: string;
|
|
171
|
-
protected readonly addGrantTables: Array<string>;
|
|
172
|
-
protected readonly user: string;
|
|
173
|
-
|
|
174
|
-
constructor();
|
|
175
|
-
constructor(user: string);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export class MigrateDatabase {
|
|
179
|
-
constructor(dbName: string, userName: string, pool: Pool);
|
|
180
|
-
|
|
181
|
-
get DbName(): string;
|
|
182
|
-
get UserName(): string;
|
|
183
|
-
get Password(): string | null;
|
|
184
|
-
|
|
185
|
-
public IsExistUser(): Promise<boolean>;
|
|
186
|
-
public CreateUser(password?: string): Promise<void>;
|
|
187
|
-
public IsExistDb(): Promise<boolean>;
|
|
188
|
-
public CreateDb(collateType?: string): Promise<void>;
|
|
189
|
-
public RollbackDbSql(): string;
|
|
190
|
-
public RollbackUserSql(otherUserName: string): string;
|
|
191
|
-
}
|
|
192
|
-
}
|
package/src/PoolManager.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// PoolManager.ts
|
|
2
|
-
import { Pool } from 'pg';
|
|
3
|
-
|
|
4
|
-
export default class PoolManager {
|
|
5
|
-
private static poolMap: Record<string, Pool> = {};
|
|
6
|
-
|
|
7
|
-
static getPool(user: string, host: string, database: string, password: string, port: number | string, isSslConnect: boolean): Pool {
|
|
8
|
-
const key = `${user}@${host}/${database}`;
|
|
9
|
-
if (!this.poolMap[key]) {
|
|
10
|
-
this.poolMap[key] = new Pool({
|
|
11
|
-
user: user,
|
|
12
|
-
host: host,
|
|
13
|
-
database: database,
|
|
14
|
-
password: password,
|
|
15
|
-
port: Number(port),
|
|
16
|
-
ssl: isSslConnect ? {
|
|
17
|
-
rejectUnauthorized: false
|
|
18
|
-
} : false
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return this.poolMap[key];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
static async shutdownAll(): Promise<void> {
|
|
26
|
-
for (const [key, pool] of Object.entries(this.poolMap)) {
|
|
27
|
-
try {
|
|
28
|
-
await pool.end();
|
|
29
|
-
console.log(`Closed pool: ${key}`);
|
|
30
|
-
} catch (e) {
|
|
31
|
-
console.error(`Error closing pool ${key}`, e);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// ✅ 自動実行されるシャットダウン登録
|
|
38
|
-
process.on('SIGINT', async () => {
|
|
39
|
-
console.log('🔌 SIGINT received. Closing all pools...');
|
|
40
|
-
await PoolManager.shutdownAll();
|
|
41
|
-
process.exit(0);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
process.on('SIGTERM', async () => {
|
|
45
|
-
console.log('🔌 SIGTERM received. Closing all pools...');
|
|
46
|
-
await PoolManager.shutdownAll();
|
|
47
|
-
process.exit(0);
|
|
48
|
-
});
|