pg-mvc-service 2.0.52 → 2.0.53
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/reqestResponse/ReqResType.js +68 -0
- package/dist/reqestResponse/RequestType.js +0 -25
- package/dist/reqestResponse/ResponseType.js +0 -23
- package/package.json +1 -1
- package/src/reqestResponse/ReqResType.ts +75 -0
- package/src/reqestResponse/RequestType.ts +1 -28
- package/src/reqestResponse/ResponseType.ts +1 -26
|
@@ -4,6 +4,74 @@ 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
|
+
getProperty(keys) {
|
|
16
|
+
let property = 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
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
property = property.properties[key];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return property;
|
|
31
|
+
}
|
|
32
|
+
// /**
|
|
33
|
+
// * Retrieve property type data
|
|
34
|
+
// * プロパティ型のデータを取得
|
|
35
|
+
// * @param {Array.<string|number>} keys - Path to the property, プロパティへのパス
|
|
36
|
+
// * @returns {any} Retrieved property data, 取得されたプロパティデータ
|
|
37
|
+
// */
|
|
38
|
+
// private getProperty(keys: Array<string | number>) {
|
|
39
|
+
// if (keys.length === 0) {
|
|
40
|
+
// throw new Error(`getPropertyメソッドでは1以上のkeysからしか入力を受け付けない。`);
|
|
41
|
+
// }
|
|
42
|
+
// const firstKey = keys[0];
|
|
43
|
+
// let property = this.properties[firstKey];
|
|
44
|
+
// for (let i = 1;i < keys.length;i++) {
|
|
45
|
+
// const key = keys[i];
|
|
46
|
+
// if (typeof key === 'number') {
|
|
47
|
+
// if (property.type === 'array' || property.type === 'array?') {
|
|
48
|
+
// property = property.properties;
|
|
49
|
+
// continue;
|
|
50
|
+
// } else {
|
|
51
|
+
// throw new Error(`getPropertyでnumber型のINPUTにも関わらず、array以外のtypeの場合のエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
52
|
+
// }
|
|
53
|
+
// }
|
|
54
|
+
// switch (property.type) {
|
|
55
|
+
// case 'array':
|
|
56
|
+
// case 'array?':
|
|
57
|
+
// if (typeof key !== 'number') {
|
|
58
|
+
// throw new Error(`getPropertyでnumber型のINPUTで、array以外の場合はエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
59
|
+
// }
|
|
60
|
+
// property = property.properties;
|
|
61
|
+
// continue;
|
|
62
|
+
// case 'object':
|
|
63
|
+
// case 'object':
|
|
64
|
+
// if (typeof key !== 'string') {
|
|
65
|
+
// throw new Error(`getPropertyでnumber型のINPUTで、arrayの場合はエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
66
|
+
// }
|
|
67
|
+
// property = property.properties[key];
|
|
68
|
+
// continue;
|
|
69
|
+
// default:
|
|
70
|
+
// throw new Error(`getPropertyでarray,object以外のtypeを読み込もうとしている。\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
71
|
+
// }
|
|
72
|
+
// }
|
|
73
|
+
// return property;
|
|
74
|
+
// }
|
|
7
75
|
/**
|
|
8
76
|
* Checks if the value is a valid date-time format
|
|
9
77
|
* 値が有効な日付時間形式かどうかを確認します
|
|
@@ -423,31 +423,6 @@ class RequestType extends ReqResType_1.default {
|
|
|
423
423
|
// }
|
|
424
424
|
// }
|
|
425
425
|
}
|
|
426
|
-
/**
|
|
427
|
-
* Retrieve the property definition corresponding to the specified key path.
|
|
428
|
-
* 指定されたキーパスに対応するプロパティ定義を取得します。
|
|
429
|
-
* @param {Array<string | number>} keys - Access path to the property (array of strings or index numbers)
|
|
430
|
-
* プロパティへのアクセスパス(文字列またはインデックス番号の配列)
|
|
431
|
-
* @returns {BaseType} Property definition object
|
|
432
|
-
* プロパティ定義オブジェクト
|
|
433
|
-
*/
|
|
434
|
-
getProperty(keys) {
|
|
435
|
-
let property = this.properties;
|
|
436
|
-
for (let i = 0; i < keys.length; i++) {
|
|
437
|
-
const key = keys[i];
|
|
438
|
-
if (typeof key === 'number') {
|
|
439
|
-
property = property.properties;
|
|
440
|
-
continue;
|
|
441
|
-
}
|
|
442
|
-
if (i === 0) {
|
|
443
|
-
property = property[key];
|
|
444
|
-
}
|
|
445
|
-
else {
|
|
446
|
-
property = property.properties[key];
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
return property;
|
|
450
|
-
}
|
|
451
426
|
/**
|
|
452
427
|
* Set the value of the request body to the specified path.
|
|
453
428
|
* Automatically create intermediate objects or arrays as needed.
|
|
@@ -115,29 +115,6 @@ class ResponseType extends ReqResType_1.default {
|
|
|
115
115
|
}
|
|
116
116
|
return resData;
|
|
117
117
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Retrieve property type data
|
|
120
|
-
* プロパティ型のデータを取得
|
|
121
|
-
* @param {Array.<string|number>} keys - Path to the property, プロパティへのパス
|
|
122
|
-
* @returns {any} Retrieved property data, 取得されたプロパティデータ
|
|
123
|
-
*/
|
|
124
|
-
getProperty(keys) {
|
|
125
|
-
let property = this.properties;
|
|
126
|
-
for (let i = 0; i < keys.length; i++) {
|
|
127
|
-
const key = keys[i];
|
|
128
|
-
if (typeof key === 'number') {
|
|
129
|
-
property = property.properties;
|
|
130
|
-
continue;
|
|
131
|
-
}
|
|
132
|
-
if (i === 0) {
|
|
133
|
-
property = property[key];
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
property = property.properties[key];
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return property;
|
|
140
|
-
}
|
|
141
118
|
/**
|
|
142
119
|
* Retrieve data based on the provided keys
|
|
143
120
|
* 指定されたキーに基づいてデータを取得
|
package/package.json
CHANGED
|
@@ -36,6 +36,81 @@ export default class ReqResType {
|
|
|
36
36
|
|
|
37
37
|
protected properties: { [key: string]: PropertyType; } = {};
|
|
38
38
|
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Retrieve the property definition corresponding to the specified key path.
|
|
42
|
+
* 指定されたキーパスに対応するプロパティ定義を取得します。
|
|
43
|
+
* @param {Array<string | number>} keys - Access path to the property (array of strings or index numbers)
|
|
44
|
+
* プロパティへのアクセスパス(文字列またはインデックス番号の配列)
|
|
45
|
+
* @returns {BaseType} Property definition object
|
|
46
|
+
* プロパティ定義オブジェクト
|
|
47
|
+
*/
|
|
48
|
+
protected getProperty(keys: Array<string | number>) {
|
|
49
|
+
let property: any = this.properties;
|
|
50
|
+
for (let i = 0;i < keys.length;i++) {
|
|
51
|
+
const key = keys[i];
|
|
52
|
+
if (typeof key === 'number') {
|
|
53
|
+
property = property.properties;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (i === 0) {
|
|
58
|
+
property = property[key];
|
|
59
|
+
} else {
|
|
60
|
+
property = property.properties[key];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return property;
|
|
65
|
+
}
|
|
66
|
+
// /**
|
|
67
|
+
// * Retrieve property type data
|
|
68
|
+
// * プロパティ型のデータを取得
|
|
69
|
+
// * @param {Array.<string|number>} keys - Path to the property, プロパティへのパス
|
|
70
|
+
// * @returns {any} Retrieved property data, 取得されたプロパティデータ
|
|
71
|
+
// */
|
|
72
|
+
// private getProperty(keys: Array<string | number>) {
|
|
73
|
+
// if (keys.length === 0) {
|
|
74
|
+
// throw new Error(`getPropertyメソッドでは1以上のkeysからしか入力を受け付けない。`);
|
|
75
|
+
// }
|
|
76
|
+
|
|
77
|
+
// const firstKey = keys[0];
|
|
78
|
+
// let property = this.properties[firstKey];
|
|
79
|
+
|
|
80
|
+
// for (let i = 1;i < keys.length;i++) {
|
|
81
|
+
// const key = keys[i];
|
|
82
|
+
// if (typeof key === 'number') {
|
|
83
|
+
// if (property.type === 'array' || property.type === 'array?') {
|
|
84
|
+
// property = property.properties;
|
|
85
|
+
// continue;
|
|
86
|
+
// } else {
|
|
87
|
+
// throw new Error(`getPropertyでnumber型のINPUTにも関わらず、array以外のtypeの場合のエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
88
|
+
// }
|
|
89
|
+
// }
|
|
90
|
+
|
|
91
|
+
// switch (property.type) {
|
|
92
|
+
// case 'array':
|
|
93
|
+
// case 'array?':
|
|
94
|
+
// if (typeof key !== 'number') {
|
|
95
|
+
// throw new Error(`getPropertyでnumber型のINPUTで、array以外の場合はエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
96
|
+
// }
|
|
97
|
+
// property = property.properties;
|
|
98
|
+
// continue;
|
|
99
|
+
// case 'object':
|
|
100
|
+
// case 'object':
|
|
101
|
+
// if (typeof key !== 'string') {
|
|
102
|
+
// throw new Error(`getPropertyでnumber型のINPUTで、arrayの場合はエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
103
|
+
// }
|
|
104
|
+
// property = property.properties[key];
|
|
105
|
+
// continue;
|
|
106
|
+
// default:
|
|
107
|
+
// throw new Error(`getPropertyでarray,object以外のtypeを読み込もうとしている。\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
108
|
+
// }
|
|
109
|
+
// }
|
|
110
|
+
|
|
111
|
+
// return property;
|
|
112
|
+
// }
|
|
113
|
+
|
|
39
114
|
/**
|
|
40
115
|
* Checks if the value is a valid date-time format
|
|
41
116
|
* 値が有効な日付時間形式かどうかを確認します
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Request } from 'express';
|
|
2
|
-
import ReqResType, {
|
|
2
|
+
import ReqResType, { EnumType, PrimitiveType } 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';
|
|
@@ -443,33 +443,6 @@ export class RequestType extends ReqResType {
|
|
|
443
443
|
// }
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
-
/**
|
|
447
|
-
* Retrieve the property definition corresponding to the specified key path.
|
|
448
|
-
* 指定されたキーパスに対応するプロパティ定義を取得します。
|
|
449
|
-
* @param {Array<string | number>} keys - Access path to the property (array of strings or index numbers)
|
|
450
|
-
* プロパティへのアクセスパス(文字列またはインデックス番号の配列)
|
|
451
|
-
* @returns {BaseType} Property definition object
|
|
452
|
-
* プロパティ定義オブジェクト
|
|
453
|
-
*/
|
|
454
|
-
private getProperty(keys: Array<string | number>) {
|
|
455
|
-
let property: any = this.properties;
|
|
456
|
-
for (let i = 0;i < keys.length;i++) {
|
|
457
|
-
const key = keys[i];
|
|
458
|
-
if (typeof key === 'number') {
|
|
459
|
-
property = property.properties;
|
|
460
|
-
continue;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
if (i === 0) {
|
|
464
|
-
property = property[key];
|
|
465
|
-
} else {
|
|
466
|
-
property = property.properties[key];
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
return property;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
446
|
/**
|
|
474
447
|
* Set the value of the request body to the specified path.
|
|
475
448
|
* Automatically create intermediate objects or arrays as needed.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ValidateStringUtil } from "type-utils-n-daira";
|
|
2
2
|
import StringUtil from "../Utils/StringUtil";
|
|
3
|
-
import ReqResType, {
|
|
3
|
+
import ReqResType, { PropertyType } from "./ReqResType";
|
|
4
4
|
|
|
5
5
|
export class ResponseType extends ReqResType {
|
|
6
6
|
|
|
@@ -124,31 +124,6 @@ export class ResponseType extends ReqResType {
|
|
|
124
124
|
return resData;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
/**
|
|
128
|
-
* Retrieve property type data
|
|
129
|
-
* プロパティ型のデータを取得
|
|
130
|
-
* @param {Array.<string|number>} keys - Path to the property, プロパティへのパス
|
|
131
|
-
* @returns {any} Retrieved property data, 取得されたプロパティデータ
|
|
132
|
-
*/
|
|
133
|
-
private getProperty(keys: Array<string | number>) {
|
|
134
|
-
let property: any = this.properties;
|
|
135
|
-
for (let i = 0;i < keys.length;i++) {
|
|
136
|
-
const key = keys[i];
|
|
137
|
-
if (typeof key === 'number') {
|
|
138
|
-
property = property.properties;
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (i === 0) {
|
|
143
|
-
property = property[key];
|
|
144
|
-
} else {
|
|
145
|
-
property = property.properties[key];
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return property;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
127
|
/**
|
|
153
128
|
* Retrieve data based on the provided keys
|
|
154
129
|
* 指定されたキーに基づいてデータを取得
|