pg-mvc-service 2.0.129 → 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/Service.js +40 -23
- 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/RequestType.js +218 -173
- package/dist/reqestResponse/ResponseType.d.ts +85 -0
- package/dist/reqestResponse/ResponseType.d.ts.map +1 -0
- package/package.json +8 -1
- package/index.d.ts +0 -192
- package/src/PoolManager.ts +0 -48
- package/src/Service.ts +0 -284
- 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 -1588
- package/src/reqestResponse/ResponseType.ts +0 -549
- package/tsconfig.json +0 -14
|
@@ -1,4 +1,13 @@
|
|
|
1
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
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
@@ -91,7 +100,6 @@ class RequestType extends ReqResType_1.default {
|
|
|
91
100
|
}
|
|
92
101
|
return this.headers;
|
|
93
102
|
}
|
|
94
|
-
get RemoteAddress() { return this.remoteAddress; }
|
|
95
103
|
get Authorization() {
|
|
96
104
|
var _a;
|
|
97
105
|
const authorization = (_a = this.Headers['authorization']) !== null && _a !== void 0 ? _a : '';
|
|
@@ -100,23 +108,41 @@ class RequestType extends ReqResType_1.default {
|
|
|
100
108
|
}
|
|
101
109
|
return authorization.replace(/^Bearer\s/, '');
|
|
102
110
|
}
|
|
103
|
-
setRequest(request) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
if (
|
|
111
|
-
|
|
111
|
+
setRequest(module, request) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
var _a, _b, _c, _d;
|
|
114
|
+
yield this.createBody(module, request);
|
|
115
|
+
this.params = {};
|
|
116
|
+
if (module === 'express') {
|
|
117
|
+
const req = request;
|
|
118
|
+
if (req.params !== undefined) {
|
|
119
|
+
for (const [key, value] of Object.entries(req.params)) {
|
|
120
|
+
const index = this.paramProperties.findIndex((p) => p.key === key);
|
|
121
|
+
if (index === -1)
|
|
122
|
+
throw new Error(`${key} is not set in paramProperties.`);
|
|
123
|
+
const prop = this.paramProperties[index];
|
|
124
|
+
this.params[key] = this.convertValue(prop, value, [key, `(pathIndex: ${index})`], false);
|
|
125
|
+
}
|
|
112
126
|
}
|
|
113
|
-
|
|
114
|
-
this.
|
|
127
|
+
this.params = (_a = req.params) !== null && _a !== void 0 ? _a : {};
|
|
128
|
+
this.headers = (_b = req.headers) !== null && _b !== void 0 ? _b : {};
|
|
115
129
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
130
|
+
else {
|
|
131
|
+
const c = request;
|
|
132
|
+
for (let index = 0; index < this.paramProperties.length; index++) {
|
|
133
|
+
const prop = this.paramProperties[index];
|
|
134
|
+
const value = (_d = (_c = c.req).param) === null || _d === void 0 ? void 0 : _d.call(_c, prop.key); // hono の param()
|
|
135
|
+
if (value !== undefined) {
|
|
136
|
+
this.params[prop.key] = this.convertValue(prop, value, [prop.key, `(pathIndex: ${index})`], false);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const headersObj = {};
|
|
140
|
+
c.req.raw.headers.forEach((v, k) => {
|
|
141
|
+
headersObj[k.toLowerCase()] = v;
|
|
142
|
+
});
|
|
143
|
+
this.headers = headersObj;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
120
146
|
}
|
|
121
147
|
createErrorMessage(code, keys, value) {
|
|
122
148
|
var _a, _b, _c, _d, _e;
|
|
@@ -240,179 +266,198 @@ class RequestType extends ReqResType_1.default {
|
|
|
240
266
|
* @param {Object} body - Request body object, リクエストボディオブジェクト
|
|
241
267
|
* @throws {InputErrorException} Thrown when the input value is invalid, 入力値が不正な場合にスローされます
|
|
242
268
|
*/
|
|
243
|
-
createBody(request) {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
this.data = {};
|
|
252
|
-
}
|
|
253
|
-
for (const key of Object.keys(this.properties)) {
|
|
254
|
-
// NULLチェック
|
|
255
|
-
if (key in this.data === false || this.data[key] === null || this.data[key] === "") {
|
|
256
|
-
if (this.properties[key].type === 'array' && ['GET', 'DELETE'].includes(request.method)) {
|
|
257
|
-
// GET,DELETEメソッドの場合、?array=1&array=2で配列となるが、
|
|
258
|
-
// ?array=1のみで終わる場合は配列にならないため、直接配列にしている
|
|
259
|
-
// この処理で空文字やnullが入った場合の対処をここで行う
|
|
260
|
-
const itemProperty = this.properties[key].item;
|
|
261
|
-
if (itemProperty.type.endsWith('?')) {
|
|
262
|
-
const tempValue = this.data[key];
|
|
263
|
-
this.data[key] = [];
|
|
264
|
-
if (tempValue !== undefined) {
|
|
265
|
-
if (itemProperty.type === 'string?') {
|
|
266
|
-
this.data[key][0] = tempValue;
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
this.data[key][0] = null;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
continue;
|
|
273
|
-
}
|
|
274
|
-
else {
|
|
275
|
-
this.throwInputError("REQUIRE_00", [key, 0], "");
|
|
276
|
-
}
|
|
269
|
+
createBody(module, request) {
|
|
270
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
271
|
+
let method = '';
|
|
272
|
+
if (module === 'express') {
|
|
273
|
+
const req = request;
|
|
274
|
+
method = req.method;
|
|
275
|
+
if (method === 'GET' || method === 'DELETE') {
|
|
276
|
+
this.data = req.query;
|
|
277
277
|
}
|
|
278
278
|
else {
|
|
279
|
-
|
|
280
|
-
this.changeBody([key], null);
|
|
281
|
-
continue;
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
this.throwInputError("REQUIRE_01", [key], "");
|
|
285
|
-
}
|
|
279
|
+
this.data = req.body;
|
|
286
280
|
}
|
|
287
281
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
282
|
+
else {
|
|
283
|
+
const c = request;
|
|
284
|
+
method = c.req.method;
|
|
285
|
+
if (method === 'GET' || method === 'DELETE') {
|
|
286
|
+
const url = new URL(c.req.url);
|
|
287
|
+
this.data = Object.fromEntries(url.searchParams.entries());
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
// JSON を想定(form 等なら parseBody() を使う)
|
|
291
|
+
this.data = yield c.req.json();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (this.data === undefined) {
|
|
295
|
+
this.data = {};
|
|
296
|
+
}
|
|
297
|
+
for (const key of Object.keys(this.properties)) {
|
|
298
|
+
// NULLチェック
|
|
299
|
+
if (key in this.data === false || this.data[key] === null || this.data[key] === "") {
|
|
300
|
+
if (this.properties[key].type === 'array' && ['GET', 'DELETE'].includes(method)) {
|
|
301
|
+
// GET,DELETEメソッドの場合、?array=1&array=2で配列となるが、
|
|
302
|
+
// ?array=1のみで終わる場合は配列にならないため、直接配列にしている
|
|
303
|
+
// この処理で空文字やnullが入った場合の対処をここで行う
|
|
304
|
+
const itemProperty = this.properties[key].item;
|
|
305
|
+
if (itemProperty.type.endsWith('?')) {
|
|
306
|
+
const tempValue = this.data[key];
|
|
307
|
+
this.data[key] = [];
|
|
308
|
+
if (tempValue !== undefined) {
|
|
309
|
+
if (itemProperty.type === 'string?') {
|
|
310
|
+
this.data[key][0] = tempValue;
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
this.data[key][0] = null;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
this.throwInputError("REQUIRE_00", [key, 0], "");
|
|
320
|
+
}
|
|
303
321
|
}
|
|
304
322
|
else {
|
|
305
|
-
if (
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
const type = this.properties[key].item.type;
|
|
309
|
-
if (type === 'object' || type === 'object?' || type === 'array' || type === 'array?' || type === 'map' || type === 'map?') {
|
|
310
|
-
throw new Error("GETまたはDELETEメソッドでは配列型にobject, array, mapを使用することはできません。");
|
|
311
|
-
}
|
|
312
|
-
if (type === 'enum' || type === 'enum?') {
|
|
313
|
-
const tempProp = {
|
|
314
|
-
type: type,
|
|
315
|
-
description: this.properties[key].item.description,
|
|
316
|
-
enumType: this.properties[key].item.enumType,
|
|
317
|
-
enums: this.properties[key].item.enums,
|
|
318
|
-
};
|
|
319
|
-
this.data[key] = [this.convertValue(tempProp, value, [key, 0], true)];
|
|
320
|
-
}
|
|
321
|
-
else if (type === 'string' || type === 'string?') {
|
|
322
|
-
const tempProp = {
|
|
323
|
-
type: type,
|
|
324
|
-
description: this.properties[key].item.description,
|
|
325
|
-
maxLength: this.properties[key].item.maxLength,
|
|
326
|
-
regExp: this.properties[key].item.regExp
|
|
327
|
-
};
|
|
328
|
-
this.data[key] = [this.convertValue(tempProp, value, [key, 0], true)];
|
|
329
|
-
}
|
|
330
|
-
else if (type === 'number' || type === 'number?') {
|
|
331
|
-
const tempProp = {
|
|
332
|
-
type: type,
|
|
333
|
-
description: this.properties[key].item.description,
|
|
334
|
-
max: this.properties[key].item.max,
|
|
335
|
-
min: this.properties[key].item.min,
|
|
336
|
-
};
|
|
337
|
-
this.data[key] = [this.convertValue(tempProp, value, [key, 0], true)];
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
const tempProp = {
|
|
341
|
-
type: type,
|
|
342
|
-
description: this.properties[key].item.description
|
|
343
|
-
};
|
|
344
|
-
this.data[key] = [this.convertValue(tempProp, value, [key, 0], true)];
|
|
345
|
-
}
|
|
323
|
+
if (this.properties[key].type.endsWith('?')) {
|
|
324
|
+
this.changeBody([key], null);
|
|
325
|
+
continue;
|
|
346
326
|
}
|
|
347
327
|
else {
|
|
348
|
-
this.throwInputError("
|
|
328
|
+
this.throwInputError("REQUIRE_01", [key], "");
|
|
349
329
|
}
|
|
350
330
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
331
|
+
}
|
|
332
|
+
const value = this.data[key];
|
|
333
|
+
switch (this.properties[key].type) {
|
|
334
|
+
case 'object':
|
|
335
|
+
case 'object?':
|
|
336
|
+
if (typeof value === 'object') {
|
|
337
|
+
this.setObject([key], value);
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
this.throwInputError("OBJECT_01", [key], value);
|
|
341
|
+
}
|
|
342
|
+
break;
|
|
343
|
+
case 'array':
|
|
344
|
+
case 'array?':
|
|
345
|
+
if (Array.isArray(value)) {
|
|
346
|
+
this.setArray([key], value);
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
if (method === 'GET' || method === 'DELETE') {
|
|
350
|
+
// GET,DELETEメソッドの場合、?array=1&array=2で配列となるが、
|
|
351
|
+
// ?array=1のみで終わる場合は配列にならないため、直接配列にしている
|
|
352
|
+
const type = this.properties[key].item.type;
|
|
353
|
+
if (type === 'object' || type === 'object?' || type === 'array' || type === 'array?' || type === 'map' || type === 'map?') {
|
|
354
|
+
throw new Error("GETまたはDELETEメソッドでは配列型にobject, array, mapを使用することはできません。");
|
|
361
355
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
mapData[mapKey] = mapValue;
|
|
371
|
-
break;
|
|
372
|
-
default:
|
|
373
|
-
this.throwInputError("MAP_02", [key], value);
|
|
356
|
+
if (type === 'enum' || type === 'enum?') {
|
|
357
|
+
const tempProp = {
|
|
358
|
+
type: type,
|
|
359
|
+
description: this.properties[key].item.description,
|
|
360
|
+
enumType: this.properties[key].item.enumType,
|
|
361
|
+
enums: this.properties[key].item.enums,
|
|
362
|
+
};
|
|
363
|
+
this.data[key] = [this.convertValue(tempProp, value, [key, 0], true)];
|
|
374
364
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
this.throwInputError("MAP_03", [key], mapValue);
|
|
384
|
-
}
|
|
385
|
-
mapData[mapKey] = mapValue === 1;
|
|
386
|
-
break;
|
|
387
|
-
case 'string':
|
|
388
|
-
if (mapValue !== 'true' && mapValue !== 'false') {
|
|
389
|
-
this.throwInputError("MAP_04", [key], mapValue);
|
|
390
|
-
}
|
|
391
|
-
mapData[mapKey] = mapValue === 'true';
|
|
392
|
-
break;
|
|
393
|
-
default:
|
|
394
|
-
this.throwInputError("MAP_05", [key], mapValue);
|
|
365
|
+
else if (type === 'string' || type === 'string?') {
|
|
366
|
+
const tempProp = {
|
|
367
|
+
type: type,
|
|
368
|
+
description: this.properties[key].item.description,
|
|
369
|
+
maxLength: this.properties[key].item.maxLength,
|
|
370
|
+
regExp: this.properties[key].item.regExp
|
|
371
|
+
};
|
|
372
|
+
this.data[key] = [this.convertValue(tempProp, value, [key, 0], true)];
|
|
395
373
|
}
|
|
396
|
-
|
|
374
|
+
else if (type === 'number' || type === 'number?') {
|
|
375
|
+
const tempProp = {
|
|
376
|
+
type: type,
|
|
377
|
+
description: this.properties[key].item.description,
|
|
378
|
+
max: this.properties[key].item.max,
|
|
379
|
+
min: this.properties[key].item.min,
|
|
380
|
+
};
|
|
381
|
+
this.data[key] = [this.convertValue(tempProp, value, [key, 0], true)];
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
const tempProp = {
|
|
385
|
+
type: type,
|
|
386
|
+
description: this.properties[key].item.description
|
|
387
|
+
};
|
|
388
|
+
this.data[key] = [this.convertValue(tempProp, value, [key, 0], true)];
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
this.throwInputError("ARRAY_01", [key], value);
|
|
393
|
+
}
|
|
397
394
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
395
|
+
break;
|
|
396
|
+
case 'map':
|
|
397
|
+
case 'map?':
|
|
398
|
+
// tODO : ここは共通化したい
|
|
399
|
+
const mapData = {};
|
|
400
|
+
for (const [mapKey, mapValue] of Object.entries(value)) {
|
|
401
|
+
switch (this.properties[key].mapType) {
|
|
402
|
+
case 'number':
|
|
403
|
+
if (this.isNumber(mapValue) === false) {
|
|
404
|
+
this.throwInputError("MAP_01", [key], value);
|
|
405
|
+
}
|
|
406
|
+
mapData[mapKey] = Number(mapValue);
|
|
407
|
+
break;
|
|
408
|
+
case 'string':
|
|
409
|
+
switch (typeof mapValue) {
|
|
410
|
+
case 'number':
|
|
411
|
+
mapData[mapKey] = mapValue.toString();
|
|
412
|
+
break;
|
|
413
|
+
case 'string':
|
|
414
|
+
mapData[mapKey] = mapValue;
|
|
415
|
+
break;
|
|
416
|
+
default:
|
|
417
|
+
this.throwInputError("MAP_02", [key], value);
|
|
418
|
+
}
|
|
419
|
+
break;
|
|
420
|
+
case 'bool':
|
|
421
|
+
switch (typeof mapValue) {
|
|
422
|
+
case 'boolean':
|
|
423
|
+
mapData[mapKey] = mapValue;
|
|
424
|
+
break;
|
|
425
|
+
case 'number':
|
|
426
|
+
if (mapValue !== 0 && mapValue !== 1) {
|
|
427
|
+
this.throwInputError("MAP_03", [key], mapValue);
|
|
428
|
+
}
|
|
429
|
+
mapData[mapKey] = mapValue === 1;
|
|
430
|
+
break;
|
|
431
|
+
case 'string':
|
|
432
|
+
if (mapValue !== 'true' && mapValue !== 'false') {
|
|
433
|
+
this.throwInputError("MAP_04", [key], mapValue);
|
|
434
|
+
}
|
|
435
|
+
mapData[mapKey] = mapValue === 'true';
|
|
436
|
+
break;
|
|
437
|
+
default:
|
|
438
|
+
this.throwInputError("MAP_05", [key], mapValue);
|
|
439
|
+
}
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
this.changeBody([key], mapData);
|
|
444
|
+
break;
|
|
445
|
+
case 'enum':
|
|
446
|
+
case 'enum?':
|
|
447
|
+
this.setEnum([key], value);
|
|
448
|
+
break;
|
|
449
|
+
default:
|
|
450
|
+
this.convertInput([key], value);
|
|
451
|
+
break;
|
|
452
|
+
}
|
|
408
453
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
454
|
+
// 不要項目チェック
|
|
455
|
+
for (const [key, value] of Object.entries(this.data)) {
|
|
456
|
+
if (key in this.properties === false) {
|
|
457
|
+
this.throwInputError("UNNECESSARY_01", [key], value);
|
|
458
|
+
}
|
|
414
459
|
}
|
|
415
|
-
}
|
|
460
|
+
});
|
|
416
461
|
}
|
|
417
462
|
/**
|
|
418
463
|
* Sets the value for an enum type based on the specified keys.
|
|
@@ -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.
|
|
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"
|
|
@@ -31,6 +37,7 @@
|
|
|
31
37
|
"@types/express": "5.0.1",
|
|
32
38
|
"axios": "1.10.0",
|
|
33
39
|
"crypto": "1.0.1",
|
|
40
|
+
"hono": "4.11.2",
|
|
34
41
|
"node-cron": "4.2.1",
|
|
35
42
|
"pdf-lib": "1.17.1",
|
|
36
43
|
"sharp": "0.34.1",
|