pg-mvc-service 2.0.89 → 2.0.91
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.
|
@@ -4,30 +4,6 @@ class ReqResType {
|
|
|
4
4
|
constructor() {
|
|
5
5
|
this.properties = {};
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* Retrieve the property definition corresponding to the specified key path.
|
|
9
|
-
* 指定されたキーパスに対応するプロパティ定義を取得します。
|
|
10
|
-
* @param {Array<string | number>} keys - Access path to the property (array of strings or index numbers)
|
|
11
|
-
* プロパティへのアクセスパス(文字列またはインデックス番号の配列)
|
|
12
|
-
* @returns {BaseType} Property definition object
|
|
13
|
-
* プロパティ定義オブジェクト
|
|
14
|
-
*/
|
|
15
|
-
// protected getProperty(keys: Array<string | number>) {
|
|
16
|
-
// let property: any = this.properties;
|
|
17
|
-
// for (let i = 0;i < keys.length;i++) {
|
|
18
|
-
// const key = keys[i];
|
|
19
|
-
// if (typeof key === 'number') {
|
|
20
|
-
// property = property.properties;
|
|
21
|
-
// continue;
|
|
22
|
-
// }
|
|
23
|
-
// if (i === 0) {
|
|
24
|
-
// property = property[key];
|
|
25
|
-
// } else {
|
|
26
|
-
// property = property.properties[key];
|
|
27
|
-
// }
|
|
28
|
-
// }
|
|
29
|
-
// return property;
|
|
30
|
-
// }
|
|
31
7
|
/**
|
|
32
8
|
* Retrieve property type data
|
|
33
9
|
* プロパティ型のデータを取得
|
|
@@ -222,12 +222,12 @@ class RequestType extends ReqResType_1.default {
|
|
|
222
222
|
break;
|
|
223
223
|
case 'string':
|
|
224
224
|
case 'string?':
|
|
225
|
-
errorMessage = errorMessage.replace('{maxLength}',
|
|
225
|
+
errorMessage = errorMessage.replace('{maxLength}', ((_b = property.maxLength) !== null && _b !== void 0 ? _b : '[未指定]').toString());
|
|
226
226
|
break;
|
|
227
227
|
case 'number':
|
|
228
228
|
case 'number?':
|
|
229
|
-
errorMessage = errorMessage.replace('{max}',
|
|
230
|
-
errorMessage = errorMessage.replace('{min}',
|
|
229
|
+
errorMessage = errorMessage.replace('{max}', ((_c = property.max) !== null && _c !== void 0 ? _c : '[未指定]').toString());
|
|
230
|
+
errorMessage = errorMessage.replace('{min}', ((_d = property.min) !== null && _d !== void 0 ? _d : '[未指定]').toString());
|
|
231
231
|
break;
|
|
232
232
|
}
|
|
233
233
|
errorMessage = errorMessage.replace("{property}", keys.join('.')).replace("{value}", value);
|
package/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { AxiosResponse } from "axios";
|
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
import { Pool, PoolClient } from 'pg';
|
|
4
4
|
import { ErrorMessageType, IncomingHttpHeaders } from './src/reqestResponse/RequestType';
|
|
5
|
-
import { ArrayType, EnumType, MapType, ObjectType, PrimitiveType } from './src/reqestResponse/ReqResType';
|
|
5
|
+
import { ArrayType, EnumType, MapType, NumberType, ObjectType, PrimitiveType, StringType } from './src/reqestResponse/ReqResType';
|
|
6
6
|
|
|
7
7
|
import { MethodType } from './src/Service';
|
|
8
8
|
export { MethodType } from './src/Service';
|
|
@@ -90,13 +90,13 @@ declare module 'pg-mvc-service' {
|
|
|
90
90
|
}
|
|
91
91
|
export function createSwagger(services: Service[], name: string, url: string, params: Array<IParams>): string;
|
|
92
92
|
|
|
93
|
-
export type PropertyType = PrimitiveType | ObjectType | ArrayType | EnumType | MapType;
|
|
93
|
+
export type PropertyType = PrimitiveType | StringType | NumberType | ObjectType | ArrayType | EnumType | MapType;
|
|
94
94
|
|
|
95
95
|
export class RequestType {
|
|
96
96
|
constructor();
|
|
97
97
|
|
|
98
98
|
protected properties: { [key: string]: PropertyType; };
|
|
99
|
-
protected paramProperties: Array<(PrimitiveType | EnumType) & { key: string }>;
|
|
99
|
+
protected paramProperties: Array<(PrimitiveType | StringType | NumberType | EnumType) & { key: string }>;
|
|
100
100
|
protected readonly ERROR_MESSAGE: ErrorMessageType;
|
|
101
101
|
|
|
102
102
|
protected throwException(code: string, message: string): never;
|
package/package.json
CHANGED
|
@@ -47,33 +47,6 @@ export default class ReqResType {
|
|
|
47
47
|
|
|
48
48
|
protected properties: { [key: string]: PropertyType; } = {};
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Retrieve the property definition corresponding to the specified key path.
|
|
53
|
-
* 指定されたキーパスに対応するプロパティ定義を取得します。
|
|
54
|
-
* @param {Array<string | number>} keys - Access path to the property (array of strings or index numbers)
|
|
55
|
-
* プロパティへのアクセスパス(文字列またはインデックス番号の配列)
|
|
56
|
-
* @returns {BaseType} Property definition object
|
|
57
|
-
* プロパティ定義オブジェクト
|
|
58
|
-
*/
|
|
59
|
-
// protected getProperty(keys: Array<string | number>) {
|
|
60
|
-
// let property: any = this.properties;
|
|
61
|
-
// for (let i = 0;i < keys.length;i++) {
|
|
62
|
-
// const key = keys[i];
|
|
63
|
-
// if (typeof key === 'number') {
|
|
64
|
-
// property = property.properties;
|
|
65
|
-
// continue;
|
|
66
|
-
// }
|
|
67
|
-
|
|
68
|
-
// if (i === 0) {
|
|
69
|
-
// property = property[key];
|
|
70
|
-
// } else {
|
|
71
|
-
// property = property.properties[key];
|
|
72
|
-
// }
|
|
73
|
-
// }
|
|
74
|
-
|
|
75
|
-
// return property;
|
|
76
|
-
// }
|
|
77
50
|
/**
|
|
78
51
|
* Retrieve property type data
|
|
79
52
|
* プロパティ型のデータを取得
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Request } from 'express';
|
|
2
|
-
import ReqResType, { EnumType, PrimitiveType, PropertyType, StringType } from "./ReqResType";
|
|
2
|
+
import ReqResType, { EnumType, NumberType, PrimitiveType, PropertyType, StringType } from "./ReqResType";
|
|
3
3
|
import { InputErrorException } from '../exceptions/Exception';
|
|
4
4
|
import StringUtil from '../Utils/StringUtil';
|
|
5
5
|
import { ValidateStringUtil } from 'type-utils-n-daira';
|
|
@@ -85,7 +85,7 @@ export class RequestType extends ReqResType {
|
|
|
85
85
|
}
|
|
86
86
|
protected readonly ERROR_MESSAGE: ErrorMessageType = process.env.TZ === 'Asia/Tokyo' ? this.ERROR_MESSAGE_JAPAN : this.ERROR_MESSAGE_ENGLISH;
|
|
87
87
|
|
|
88
|
-
protected paramProperties: Array<(PrimitiveType | EnumType) & { key: string }> = []
|
|
88
|
+
protected paramProperties: Array<(PrimitiveType | StringType | NumberType | EnumType) & { key: string }> = []
|
|
89
89
|
get paramPath(): string {
|
|
90
90
|
return this.paramProperties.map(property => `/{${property.key}}`).join("");
|
|
91
91
|
}
|
|
@@ -237,12 +237,12 @@ export class RequestType extends ReqResType {
|
|
|
237
237
|
break;
|
|
238
238
|
case 'string':
|
|
239
239
|
case 'string?':
|
|
240
|
-
errorMessage = errorMessage.replace('{maxLength}',
|
|
240
|
+
errorMessage = errorMessage.replace('{maxLength}', (property.maxLength ?? '[未指定]').toString());
|
|
241
241
|
break;
|
|
242
242
|
case 'number':
|
|
243
243
|
case 'number?':
|
|
244
|
-
errorMessage = errorMessage.replace('{max}',
|
|
245
|
-
errorMessage = errorMessage.replace('{min}',
|
|
244
|
+
errorMessage = errorMessage.replace('{max}', (property.max ?? '[未指定]').toString());
|
|
245
|
+
errorMessage = errorMessage.replace('{min}', (property.min ?? '[未指定]').toString());
|
|
246
246
|
break;
|
|
247
247
|
}
|
|
248
248
|
|