@dooboostore/simple-boot-http-server 1.0.22 → 1.0.23
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/README.MD +1 -3
- package/dist/cjs/SimpleBootHttpServer.js +17 -0
- package/dist/cjs/SimpleBootHttpServer.js.map +2 -2
- package/dist/cjs/codes/HttpStatus.js +1 -0
- package/dist/cjs/codes/HttpStatus.js.map +2 -2
- package/dist/cjs/decorators/MethodMapping.js +1 -0
- package/dist/cjs/decorators/MethodMapping.js.map +2 -2
- package/dist/cjs/filters/ResourceFilter.js.map +2 -2
- package/dist/cjs/models/RequestResponse.js +6 -1
- package/dist/cjs/models/RequestResponse.js.map +2 -2
- package/dist/cjs/models/datas/search/ReqSearchParamsObj.js +29 -0
- package/dist/cjs/models/datas/search/ReqSearchParamsObj.js.map +7 -0
- package/dist/esm/SimpleBootHttpServer.js +17 -0
- package/dist/esm/SimpleBootHttpServer.js.map +2 -2
- package/dist/esm/codes/HttpStatus.js +1 -0
- package/dist/esm/codes/HttpStatus.js.map +2 -2
- package/dist/esm/decorators/MethodMapping.js +1 -0
- package/dist/esm/decorators/MethodMapping.js.map +2 -2
- package/dist/esm/filters/ResourceFilter.js.map +2 -2
- package/dist/esm/models/RequestResponse.js +6 -1
- package/dist/esm/models/RequestResponse.js.map +2 -2
- package/dist/esm/models/datas/search/ReqSearchParamsObj.js +6 -0
- package/dist/esm/models/datas/search/ReqSearchParamsObj.js.map +7 -0
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js +261 -73
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js.map +3 -3
- package/dist/types/SimpleBootHttpServer.d.ts.map +1 -1
- package/dist/types/codes/HttpStatus.d.ts +13 -1
- package/dist/types/codes/HttpStatus.d.ts.map +1 -1
- package/dist/types/decorators/MethodMapping.d.ts +1 -0
- package/dist/types/decorators/MethodMapping.d.ts.map +1 -1
- package/dist/types/filters/ResourceFilter.d.ts.map +1 -1
- package/dist/types/models/RequestResponse.d.ts +1 -0
- package/dist/types/models/RequestResponse.d.ts.map +1 -1
- package/dist/types/models/datas/search/ReqSearchParamsObj.d.ts +4 -0
- package/dist/types/models/datas/search/ReqSearchParamsObj.d.ts.map +1 -0
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js +261 -73
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js.map +3 -3
- package/package.json +6 -6
- package/src/SimpleBootHttpServer.ts +18 -1
- package/src/codes/HttpStatus.ts +19 -1
- package/src/decorators/MethodMapping.ts +2 -0
- package/src/filters/ResourceFilter.ts +1 -0
- package/src/models/RequestResponse.ts +6 -1
- package/src/models/datas/search/ReqSearchParamsObj.ts +3 -0
|
@@ -9506,6 +9506,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
9506
9506
|
// src/codes/HttpStatus.ts
|
|
9507
9507
|
var HttpStatus = /* @__PURE__ */ ((HttpStatus2) => {
|
|
9508
9508
|
HttpStatus2[HttpStatus2["Ok"] = 200] = "Ok";
|
|
9509
|
+
HttpStatus2[HttpStatus2["MultipleChoices"] = 300] = "MultipleChoices";
|
|
9509
9510
|
HttpStatus2[HttpStatus2["MovedPermanently"] = 301] = "MovedPermanently";
|
|
9510
9511
|
HttpStatus2[HttpStatus2["Found"] = 302] = "Found";
|
|
9511
9512
|
HttpStatus2[HttpStatus2["SeeOther"] = 303] = "SeeOther";
|
|
@@ -9610,6 +9611,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
9610
9611
|
// src/decorators/MethodMapping.ts
|
|
9611
9612
|
var UrlMappingSituationType = /* @__PURE__ */ ((UrlMappingSituationType2) => {
|
|
9612
9613
|
UrlMappingSituationType2["REQ_JSON_BODY"] = "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_JSON_BODY";
|
|
9614
|
+
UrlMappingSituationType2["REQ_URL_SEARCH_PARAMS_OBJ"] = "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_URL_SEARCH_PARAMS_OBJ";
|
|
9613
9615
|
UrlMappingSituationType2["REQ_FORM_URL_BODY"] = "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_FORM_URL_BODY";
|
|
9614
9616
|
return UrlMappingSituationType2;
|
|
9615
9617
|
})(UrlMappingSituationType || {});
|
|
@@ -9889,6 +9891,14 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
9889
9891
|
const isConstructorLike = (fn) => {
|
|
9890
9892
|
return typeof fn === "function" && typeof fn.prototype !== "undefined";
|
|
9891
9893
|
};
|
|
9894
|
+
ValidUtils2.isUrl = (str) => {
|
|
9895
|
+
try {
|
|
9896
|
+
new URL(str);
|
|
9897
|
+
return true;
|
|
9898
|
+
} catch (_) {
|
|
9899
|
+
return false;
|
|
9900
|
+
}
|
|
9901
|
+
};
|
|
9892
9902
|
ValidUtils2.isFrozen = (obj) => {
|
|
9893
9903
|
return Object.isFrozen(obj);
|
|
9894
9904
|
};
|
|
@@ -10162,6 +10172,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10162
10172
|
constructor(_data) {
|
|
10163
10173
|
this._data = _data;
|
|
10164
10174
|
this.updateStats();
|
|
10175
|
+
this.etcData = _data.etcData;
|
|
10165
10176
|
}
|
|
10166
10177
|
get originalName() {
|
|
10167
10178
|
return this._data.originalName;
|
|
@@ -10211,10 +10222,11 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10211
10222
|
}
|
|
10212
10223
|
FileUtils2.File = File;
|
|
10213
10224
|
FileUtils2.writeFile = async (buffer, config) => {
|
|
10225
|
+
config ?? (config = {});
|
|
10214
10226
|
config.path ?? (config.path = `${node_os.tmpdir()}/${RandomUtils.uuid4()}_${Date.now()}`);
|
|
10215
10227
|
await node_fs.promises.mkdir(config.path.substring(0, config.path.lastIndexOf("/")), { recursive: true });
|
|
10216
10228
|
await node_fs.promises.writeFile(config.path, buffer);
|
|
10217
|
-
return new File({ path: config.path, originalName: config.originalName });
|
|
10229
|
+
return new File({ path: config.path, originalName: config.originalName, etcData: config.etcData });
|
|
10218
10230
|
};
|
|
10219
10231
|
FileUtils2.path = (path22) => {
|
|
10220
10232
|
return Array.isArray(path22) ? node_path.join(...path22) : path22;
|
|
@@ -10264,6 +10276,14 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10264
10276
|
const p = FileUtils2.path(path22);
|
|
10265
10277
|
return node_fs.promises.readFile(p, config?.option);
|
|
10266
10278
|
};
|
|
10279
|
+
FileUtils2.readJsonSync = (path22) => {
|
|
10280
|
+
const json = FileUtils2.readStringSync(path22);
|
|
10281
|
+
return JSON.parse(json);
|
|
10282
|
+
};
|
|
10283
|
+
FileUtils2.readJsonAsync = async (path22) => {
|
|
10284
|
+
const json = await FileUtils2.readStringAsync(path22);
|
|
10285
|
+
return JSON.parse(json);
|
|
10286
|
+
};
|
|
10267
10287
|
FileUtils2.readStringSync = (path22) => {
|
|
10268
10288
|
const p = FileUtils2.path(path22);
|
|
10269
10289
|
return node_fs.readFileSync(p, "utf-8");
|
|
@@ -10733,19 +10753,64 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10733
10753
|
const paths = this.fullPath.split("?");
|
|
10734
10754
|
return paths[1] ?? "";
|
|
10735
10755
|
}
|
|
10756
|
+
getQueryParamDecodeURI(key) {
|
|
10757
|
+
const p = this.queryParamsDecodeURI;
|
|
10758
|
+
if (key) {
|
|
10759
|
+
return p[key];
|
|
10760
|
+
} else {
|
|
10761
|
+
return p;
|
|
10762
|
+
}
|
|
10763
|
+
}
|
|
10764
|
+
getQueryParamDecodeURIFirst(key) {
|
|
10765
|
+
const param = this.getQueryParamDecodeURI(key);
|
|
10766
|
+
if (Array.isArray(param)) {
|
|
10767
|
+
return param[0];
|
|
10768
|
+
} else {
|
|
10769
|
+
return param;
|
|
10770
|
+
}
|
|
10771
|
+
}
|
|
10772
|
+
getQueryParam(key) {
|
|
10773
|
+
const p = this.queryParams;
|
|
10774
|
+
if (key) {
|
|
10775
|
+
return p[key];
|
|
10776
|
+
} else {
|
|
10777
|
+
return p;
|
|
10778
|
+
}
|
|
10779
|
+
}
|
|
10780
|
+
getQueryParamFirst(key) {
|
|
10781
|
+
const param = this.getQueryParam(key);
|
|
10782
|
+
if (Array.isArray(param)) {
|
|
10783
|
+
return param[0];
|
|
10784
|
+
} else {
|
|
10785
|
+
return param;
|
|
10786
|
+
}
|
|
10787
|
+
}
|
|
10736
10788
|
get queryParams() {
|
|
10737
10789
|
const param = {};
|
|
10738
10790
|
this.query.split("&")?.forEach((it) => {
|
|
10739
10791
|
const a = it.split("=");
|
|
10740
|
-
param[a[0]]
|
|
10792
|
+
if (param[a[0]]) {
|
|
10793
|
+
if (Array.isArray(param[a[0]])) {
|
|
10794
|
+
param[a[0]].push(a[1]);
|
|
10795
|
+
} else {
|
|
10796
|
+
param[a[0]] = [param[a[0]], a[1]];
|
|
10797
|
+
}
|
|
10798
|
+
} else {
|
|
10799
|
+
param[a[0]] = a[1];
|
|
10800
|
+
}
|
|
10741
10801
|
});
|
|
10742
10802
|
return param;
|
|
10743
10803
|
}
|
|
10744
|
-
get
|
|
10804
|
+
get queryParamsDecodeURI() {
|
|
10745
10805
|
const params = this.queryParams;
|
|
10746
10806
|
for (const key in params) {
|
|
10747
10807
|
if (params.hasOwnProperty(key)) {
|
|
10748
|
-
|
|
10808
|
+
const param = params[key];
|
|
10809
|
+
if (Array.isArray(param)) {
|
|
10810
|
+
params[key] = param.map((p) => decodeURIComponent(p));
|
|
10811
|
+
} else {
|
|
10812
|
+
params[key] = decodeURIComponent(param);
|
|
10813
|
+
}
|
|
10749
10814
|
}
|
|
10750
10815
|
}
|
|
10751
10816
|
return params;
|
|
@@ -12041,57 +12106,70 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
12041
12106
|
if (Path2.isFunctionScript(path3) || Path2.isArrowFunctionScript(path3)) {
|
|
12042
12107
|
return path3;
|
|
12043
12108
|
}
|
|
12044
|
-
|
|
12045
|
-
|
|
12046
|
-
|
|
12047
|
-
|
|
12048
|
-
|
|
12049
|
-
|
|
12050
|
-
|
|
12051
|
-
|
|
12109
|
+
const nullishCoalescingPlaceholder = "__NULLISH_COALESCING__";
|
|
12110
|
+
const hasNullishCoalescing = path3.includes("??");
|
|
12111
|
+
let tempPath = path3;
|
|
12112
|
+
if (hasNullishCoalescing) {
|
|
12113
|
+
tempPath = tempPath.replace(/\?\?/g, nullishCoalescingPlaceholder);
|
|
12114
|
+
}
|
|
12115
|
+
const ternaryMatch = tempPath.match(/\?\s+[^:]*:/);
|
|
12116
|
+
if (ternaryMatch) {
|
|
12117
|
+
const questionMarkIndex = tempPath.indexOf("?");
|
|
12118
|
+
const colonIndex = tempPath.indexOf(":", questionMarkIndex);
|
|
12119
|
+
if (questionMarkIndex !== -1 && colonIndex !== -1) {
|
|
12120
|
+
const charAfterQuestion = tempPath.charAt(questionMarkIndex + 1);
|
|
12121
|
+
if (charAfterQuestion === " " || charAfterQuestion === " " || charAfterQuestion === "\n") {
|
|
12122
|
+
const condition = tempPath.substring(0, questionMarkIndex).trim();
|
|
12123
|
+
const trueBranch = tempPath.substring(questionMarkIndex + 1, colonIndex).trim();
|
|
12124
|
+
const falseBranch = tempPath.substring(colonIndex + 1).trim();
|
|
12125
|
+
const processedCondition = Path2.toOptionalChainPath(condition);
|
|
12126
|
+
const processedTrueBranch = Path2.toOptionalChainPath(trueBranch);
|
|
12127
|
+
const processedFalseBranch = Path2.toOptionalChainPath(falseBranch);
|
|
12128
|
+
const finalResult = `${processedCondition} ? ${processedTrueBranch} : ${processedFalseBranch}`;
|
|
12129
|
+
return hasNullishCoalescing ? finalResult.replace(new RegExp(nullishCoalescingPlaceholder, "g"), "??") : finalResult;
|
|
12052
12130
|
}
|
|
12053
|
-
|
|
12054
|
-
});
|
|
12055
|
-
return result.join("");
|
|
12131
|
+
}
|
|
12056
12132
|
}
|
|
12057
|
-
if (
|
|
12133
|
+
if (tempPath.includes("(")) {
|
|
12058
12134
|
const functionCallMatches = [];
|
|
12059
|
-
let
|
|
12135
|
+
let workingPath = tempPath;
|
|
12060
12136
|
let counter = 0;
|
|
12061
12137
|
const functionCallRegex = /(\w+)\(([^()]*(?:\([^()]*\)[^()]*)*)\)/g;
|
|
12062
12138
|
let match;
|
|
12063
|
-
while ((match = functionCallRegex.exec(
|
|
12139
|
+
while ((match = functionCallRegex.exec(tempPath)) !== null) {
|
|
12064
12140
|
const fullMatch = match[0];
|
|
12065
12141
|
const funcName = match[1];
|
|
12066
12142
|
const funcArgs = match[2];
|
|
12067
12143
|
const placeholder = `__FUNC_CALL_${counter}__`;
|
|
12068
|
-
|
|
12144
|
+
let processedArgs = funcArgs ? Path2.toOptionalChainPath(funcArgs) : "";
|
|
12145
|
+
processedArgs = processedArgs.replace(/\?\.\s*$/, "");
|
|
12069
12146
|
const processedFuncCall = `${funcName}?.(${processedArgs})`;
|
|
12070
12147
|
functionCallMatches.push({
|
|
12071
12148
|
original: fullMatch,
|
|
12072
12149
|
processed: processedFuncCall,
|
|
12073
12150
|
placeholder
|
|
12074
12151
|
});
|
|
12075
|
-
|
|
12152
|
+
workingPath = workingPath.replace(fullMatch, placeholder);
|
|
12076
12153
|
counter++;
|
|
12077
12154
|
}
|
|
12078
|
-
const tokens2 =
|
|
12155
|
+
const tokens2 = workingPath.match(/[^?.[\]]+|\[[^\]]*\]/g);
|
|
12079
12156
|
let processedPath = "";
|
|
12080
12157
|
if (tokens2 && tokens2.length > 1) {
|
|
12081
12158
|
processedPath = tokens2.join("?.");
|
|
12082
12159
|
} else {
|
|
12083
|
-
processedPath =
|
|
12160
|
+
processedPath = workingPath;
|
|
12084
12161
|
}
|
|
12085
12162
|
for (const funcMatch of functionCallMatches) {
|
|
12086
12163
|
processedPath = processedPath.replace(funcMatch.placeholder, funcMatch.processed);
|
|
12087
12164
|
}
|
|
12088
|
-
return processedPath;
|
|
12165
|
+
return hasNullishCoalescing ? processedPath.replace(new RegExp(nullishCoalescingPlaceholder, "g"), "??") : processedPath;
|
|
12089
12166
|
}
|
|
12090
|
-
const tokens =
|
|
12167
|
+
const tokens = tempPath.match(/[^?.[\]]+|\[[^\]]*\]/g);
|
|
12091
12168
|
if (!tokens) {
|
|
12092
|
-
return path3;
|
|
12169
|
+
return hasNullishCoalescing ? path3 : path3;
|
|
12093
12170
|
}
|
|
12094
|
-
|
|
12171
|
+
const result = tokens.join("?.");
|
|
12172
|
+
return hasNullishCoalescing ? result.replace(new RegExp(nullishCoalescingPlaceholder, "g"), "??") : result;
|
|
12095
12173
|
};
|
|
12096
12174
|
Path2.removeOptionalChainOperator = (path3) => {
|
|
12097
12175
|
if (!path3) {
|
|
@@ -12404,9 +12482,19 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
12404
12482
|
ConvertUtils22.jsonToMap = (jsonStr) => {
|
|
12405
12483
|
return new Map(JSON.parse(jsonStr));
|
|
12406
12484
|
};
|
|
12485
|
+
ConvertUtils22.toUrl = (data) => {
|
|
12486
|
+
try {
|
|
12487
|
+
return new URL(data);
|
|
12488
|
+
} catch (e) {
|
|
12489
|
+
throw new Error(`Invalid URL string: ${data}`);
|
|
12490
|
+
}
|
|
12491
|
+
};
|
|
12407
12492
|
ConvertUtils22.decodeURIString = (data) => {
|
|
12408
12493
|
return decodeURIComponent(data);
|
|
12409
12494
|
};
|
|
12495
|
+
ConvertUtils22.encodeURIString = (data) => {
|
|
12496
|
+
return encodeURIComponent(data);
|
|
12497
|
+
};
|
|
12410
12498
|
ConvertUtils22.objToStrMap = (obj) => {
|
|
12411
12499
|
const strMap = /* @__PURE__ */ new Map();
|
|
12412
12500
|
for (const k of Object.keys(obj)) {
|
|
@@ -12774,6 +12862,29 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
12774
12862
|
ConvertUtils22.stringJsonToKeyPairs = (stringJson) => {
|
|
12775
12863
|
return Array.from(stringJson.matchAll(/(\w+):\s*([^,}]+)/g)).map((match) => ({ key: match[1], value: match[2] }));
|
|
12776
12864
|
};
|
|
12865
|
+
ConvertUtils22.stringToBase64 = (str) => {
|
|
12866
|
+
return btoa(str);
|
|
12867
|
+
};
|
|
12868
|
+
ConvertUtils22.uint8ArrayToBase64 = (bytes) => {
|
|
12869
|
+
let binary = "";
|
|
12870
|
+
const len = bytes.byteLength;
|
|
12871
|
+
for (let i = 0; i < len; i++) {
|
|
12872
|
+
binary += String.fromCharCode(bytes[i]);
|
|
12873
|
+
}
|
|
12874
|
+
return btoa(binary);
|
|
12875
|
+
};
|
|
12876
|
+
ConvertUtils22.base64ToString = (base64) => {
|
|
12877
|
+
return atob(base64);
|
|
12878
|
+
};
|
|
12879
|
+
ConvertUtils22.base64ToUint8Array = (base64) => {
|
|
12880
|
+
const binaryString = atob(base64);
|
|
12881
|
+
const len = binaryString.length;
|
|
12882
|
+
const bytes = new Uint8Array(len);
|
|
12883
|
+
for (let i = 0; i < len; i++) {
|
|
12884
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
12885
|
+
}
|
|
12886
|
+
return bytes;
|
|
12887
|
+
};
|
|
12777
12888
|
})(ConvertUtils2 || (ConvertUtils2 = {}));
|
|
12778
12889
|
|
|
12779
12890
|
// src/models/RequestResponse.ts
|
|
@@ -12894,7 +13005,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
12894
13005
|
const formData = {};
|
|
12895
13006
|
for (const it of m) {
|
|
12896
13007
|
if (it.isFile) {
|
|
12897
|
-
formData[it.name] = await FileUtils.writeFile(it.value, { originalName: it.filename });
|
|
13008
|
+
formData[it.name] = await FileUtils.writeFile(it.value, { originalName: it.filename, etcData: it });
|
|
12898
13009
|
} else {
|
|
12899
13010
|
const target = formData[it.name];
|
|
12900
13011
|
if (Array.isArray(target)) {
|
|
@@ -13210,6 +13321,11 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
13210
13321
|
// // this.res.write(chunk);
|
|
13211
13322
|
// return this.createRequestResponseChain();
|
|
13212
13323
|
// }
|
|
13324
|
+
resRedirect(statusCode, location) {
|
|
13325
|
+
this.res.statusCode = statusCode;
|
|
13326
|
+
this.res.setHeader(HttpHeaders.Location, location);
|
|
13327
|
+
this.res.end();
|
|
13328
|
+
}
|
|
13213
13329
|
resWriteHead(statusCode, headers) {
|
|
13214
13330
|
return this.createRequestResponseChain(this.res.writeHead(statusCode, headers));
|
|
13215
13331
|
}
|
|
@@ -14216,7 +14332,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
14216
14332
|
}
|
|
14217
14333
|
};
|
|
14218
14334
|
|
|
14219
|
-
// ../core/dist/esm/message/Subscriber
|
|
14335
|
+
// ../core/dist/esm/message/Subscriber.js
|
|
14220
14336
|
var Subscriber = class {
|
|
14221
14337
|
constructor(destination) {
|
|
14222
14338
|
this.destination = destination;
|
|
@@ -14501,17 +14617,37 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
14501
14617
|
return this.routerChains[0];
|
|
14502
14618
|
}
|
|
14503
14619
|
get firstRouteChainValue() {
|
|
14504
|
-
return this.firstRouteChain
|
|
14620
|
+
return this.firstRouteChain?.getValue();
|
|
14505
14621
|
}
|
|
14506
14622
|
get lastRouteChain() {
|
|
14507
14623
|
return this.routerChains[this.routerChains.length - 1];
|
|
14508
14624
|
}
|
|
14509
14625
|
get lastRouteChainValue() {
|
|
14510
|
-
return this.lastRouteChain
|
|
14626
|
+
return this.lastRouteChain?.getValue();
|
|
14511
14627
|
}
|
|
14512
14628
|
hasActivateInLastRoute(obj) {
|
|
14513
14629
|
return this.lastRouteChainValue?.hasActivate(obj) === true;
|
|
14514
14630
|
}
|
|
14631
|
+
getQueryParamDecodeURI(key) {
|
|
14632
|
+
if (this.intent) {
|
|
14633
|
+
return this.intent.getQueryParamDecodeURI(key);
|
|
14634
|
+
}
|
|
14635
|
+
}
|
|
14636
|
+
getQueryParamDecodeURIFirst(key) {
|
|
14637
|
+
if (this.intent) {
|
|
14638
|
+
return this.intent.getQueryParamDecodeURIFirst(key);
|
|
14639
|
+
}
|
|
14640
|
+
}
|
|
14641
|
+
getQueryParam(key) {
|
|
14642
|
+
if (this.intent) {
|
|
14643
|
+
return this.intent.getQueryParam(key);
|
|
14644
|
+
}
|
|
14645
|
+
}
|
|
14646
|
+
getQueryParamFirst(key) {
|
|
14647
|
+
if (this.intent) {
|
|
14648
|
+
return this.intent.getQueryParamFirst(key);
|
|
14649
|
+
}
|
|
14650
|
+
}
|
|
14515
14651
|
get queryParams() {
|
|
14516
14652
|
if (this.intent) {
|
|
14517
14653
|
return this.intent.queryParams;
|
|
@@ -14519,7 +14655,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
14519
14655
|
}
|
|
14520
14656
|
get queryParamsAfterDecodeURI() {
|
|
14521
14657
|
if (this.intent) {
|
|
14522
|
-
return this.intent.
|
|
14658
|
+
return this.intent.queryParamsDecodeURI;
|
|
14523
14659
|
}
|
|
14524
14660
|
}
|
|
14525
14661
|
};
|
|
@@ -14884,6 +15020,53 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
14884
15020
|
__metadata("design:paramtypes", [typeof (_a = typeof SimstanceManager !== "undefined" && SimstanceManager) === "function" ? _a : Object, typeof (_b = typeof SimOption !== "undefined" && SimOption) === "function" ? _b : Object])
|
|
14885
15021
|
], RouterManager);
|
|
14886
15022
|
|
|
15023
|
+
// ../simple-boot/dist/esm/intent/IntentSubscribe.js
|
|
15024
|
+
var isIntentSubscribe = (obj) => {
|
|
15025
|
+
return !!obj && typeof obj.intentSubscribe === "function";
|
|
15026
|
+
};
|
|
15027
|
+
|
|
15028
|
+
// ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
|
|
15029
|
+
var CacheMetadataKey = Symbol("Cache");
|
|
15030
|
+
|
|
15031
|
+
// ../simple-boot/dist/esm/decorators/event/EventListener.js
|
|
15032
|
+
var EventListenerMetadataKey = Symbol("EventListener");
|
|
15033
|
+
|
|
15034
|
+
// ../simple-boot/dist/esm/decorators/validate/Validation.js
|
|
15035
|
+
var ValidMetadataKey = Symbol("ValidMetadataKey");
|
|
15036
|
+
var getValidIndex = (target, propertyKey) => {
|
|
15037
|
+
if (target !== null && void 0 !== target && typeof target === "object") {
|
|
15038
|
+
target = target.constructor;
|
|
15039
|
+
}
|
|
15040
|
+
if (propertyKey) {
|
|
15041
|
+
const parameters = Reflect.getOwnMetadata(ValidMetadataKey, target, propertyKey);
|
|
15042
|
+
return parameters ?? [];
|
|
15043
|
+
} else {
|
|
15044
|
+
return ReflectUtils.getMetadata(ValidMetadataKey, target) ?? [];
|
|
15045
|
+
}
|
|
15046
|
+
};
|
|
15047
|
+
var ValidationMetadataKey = Symbol("ValidationMetadataKey");
|
|
15048
|
+
var getValidators = (target) => {
|
|
15049
|
+
if (target !== null && void 0 !== target && typeof target === "object") {
|
|
15050
|
+
target = target.constructor;
|
|
15051
|
+
}
|
|
15052
|
+
return ReflectUtils.getMetadata(ValidationMetadataKey, target) ?? [];
|
|
15053
|
+
};
|
|
15054
|
+
var execValidationInValid = (obj) => {
|
|
15055
|
+
return execValidation(obj).filter((it) => !it.valid);
|
|
15056
|
+
};
|
|
15057
|
+
var execValidation = (obj) => {
|
|
15058
|
+
const validators = getValidators(obj);
|
|
15059
|
+
const reesults = [];
|
|
15060
|
+
validators.forEach((it) => {
|
|
15061
|
+
reesults.push({
|
|
15062
|
+
name: it.propertyKey,
|
|
15063
|
+
valid: it.validator(it.propertyKey, it),
|
|
15064
|
+
message: ""
|
|
15065
|
+
});
|
|
15066
|
+
});
|
|
15067
|
+
return reesults;
|
|
15068
|
+
};
|
|
15069
|
+
|
|
14887
15070
|
// ../simple-boot/dist/esm/intent/IntentManager.js
|
|
14888
15071
|
var __decorate3 = function(decorators, target, key, desc) {
|
|
14889
15072
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -14925,7 +15108,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
14925
15108
|
} else if (typeof it === "string") {
|
|
14926
15109
|
it = new Intent(it, data);
|
|
14927
15110
|
}
|
|
14928
|
-
|
|
15111
|
+
const intent = it;
|
|
14929
15112
|
const r = [];
|
|
14930
15113
|
if (!routerMatch) {
|
|
14931
15114
|
if (intent.symbols) {
|
|
@@ -14944,7 +15127,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
14944
15127
|
}
|
|
14945
15128
|
});
|
|
14946
15129
|
this.subject.next(it);
|
|
14947
|
-
|
|
15130
|
+
for (let data2 of targetInstances) {
|
|
14948
15131
|
let orNewSim = data2;
|
|
14949
15132
|
if (orNewSim) {
|
|
14950
15133
|
if (intent.paths.length > 0) {
|
|
@@ -14956,6 +15139,18 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
14956
15139
|
lastProp = i;
|
|
14957
15140
|
});
|
|
14958
15141
|
if (orNewSim && typeof orNewSim === "function") {
|
|
15142
|
+
const injects = getInject(callthis, orNewSim.name);
|
|
15143
|
+
if (injects) {
|
|
15144
|
+
for (const inject of injects) {
|
|
15145
|
+
let v = this.simstanceManager.findLastSim(inject.config).getValue();
|
|
15146
|
+
if (typeof inject.config.returnFactory === "function") {
|
|
15147
|
+
v = await inject.config.returnFactory({ instance: callthis, methodName: orNewSim.name, parameter: intent.data }, v);
|
|
15148
|
+
} else if (typeof inject.config.returnFactory === "string") {
|
|
15149
|
+
v = await v[inject.config.returnFactory]({ instance: callthis, methodName: orNewSim.name, parameter: intent.data }, v);
|
|
15150
|
+
}
|
|
15151
|
+
intent.data[inject.index] = v;
|
|
15152
|
+
}
|
|
15153
|
+
}
|
|
14959
15154
|
if (PublishType.DATA_PARAMETERS === intent.publishType) {
|
|
14960
15155
|
r.push(orNewSim.call(callthis, intent.data));
|
|
14961
15156
|
} else if (PublishType.INLINE_DATA_PARAMETERS === intent.publishType) {
|
|
@@ -14969,15 +15164,22 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
14969
15164
|
}
|
|
14970
15165
|
} else {
|
|
14971
15166
|
if (PublishType.DATA_PARAMETERS === intent.publishType) {
|
|
14972
|
-
|
|
15167
|
+
if (isIntentSubscribe(orNewSim)) {
|
|
15168
|
+
r.push(orNewSim.intentSubscribe(intent.data));
|
|
15169
|
+
}
|
|
14973
15170
|
} else if (PublishType.INLINE_DATA_PARAMETERS === intent.publishType) {
|
|
14974
|
-
|
|
15171
|
+
if (isIntentSubscribe(orNewSim)) {
|
|
15172
|
+
r.push(orNewSim.intentSubscribe(...intent.data));
|
|
15173
|
+
}
|
|
14975
15174
|
} else {
|
|
14976
|
-
|
|
15175
|
+
if (isIntentSubscribe(orNewSim)) {
|
|
15176
|
+
r.push(orNewSim?.intentSubscribe?.(intent));
|
|
15177
|
+
}
|
|
14977
15178
|
}
|
|
14978
15179
|
}
|
|
14979
15180
|
}
|
|
14980
|
-
}
|
|
15181
|
+
}
|
|
15182
|
+
;
|
|
14981
15183
|
return r;
|
|
14982
15184
|
}
|
|
14983
15185
|
};
|
|
@@ -15079,42 +15281,6 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
15079
15281
|
var import_http = __require("http");
|
|
15080
15282
|
var import_https = __require("https");
|
|
15081
15283
|
|
|
15082
|
-
// ../simple-boot/dist/esm/decorators/validate/Validation.js
|
|
15083
|
-
var ValidMetadataKey = Symbol("ValidMetadataKey");
|
|
15084
|
-
var getValidIndex = (target, propertyKey) => {
|
|
15085
|
-
if (target !== null && void 0 !== target && typeof target === "object") {
|
|
15086
|
-
target = target.constructor;
|
|
15087
|
-
}
|
|
15088
|
-
if (propertyKey) {
|
|
15089
|
-
const parameters = Reflect.getOwnMetadata(ValidMetadataKey, target, propertyKey);
|
|
15090
|
-
return parameters ?? [];
|
|
15091
|
-
} else {
|
|
15092
|
-
return ReflectUtils.getMetadata(ValidMetadataKey, target) ?? [];
|
|
15093
|
-
}
|
|
15094
|
-
};
|
|
15095
|
-
var ValidationMetadataKey = Symbol("ValidationMetadataKey");
|
|
15096
|
-
var getValidators = (target) => {
|
|
15097
|
-
if (target !== null && void 0 !== target && typeof target === "object") {
|
|
15098
|
-
target = target.constructor;
|
|
15099
|
-
}
|
|
15100
|
-
return ReflectUtils.getMetadata(ValidationMetadataKey, target) ?? [];
|
|
15101
|
-
};
|
|
15102
|
-
var execValidationInValid = (obj) => {
|
|
15103
|
-
return execValidation(obj).filter((it) => !it.valid);
|
|
15104
|
-
};
|
|
15105
|
-
var execValidation = (obj) => {
|
|
15106
|
-
const validators = getValidators(obj);
|
|
15107
|
-
const reesults = [];
|
|
15108
|
-
validators.forEach((it) => {
|
|
15109
|
-
reesults.push({
|
|
15110
|
-
name: it.propertyKey,
|
|
15111
|
-
valid: it.validator(it.propertyKey, it),
|
|
15112
|
-
message: ""
|
|
15113
|
-
});
|
|
15114
|
-
});
|
|
15115
|
-
return reesults;
|
|
15116
|
-
};
|
|
15117
|
-
|
|
15118
15284
|
// ../simple-boot/dist/esm/errors/ValidException.js
|
|
15119
15285
|
var ValidException = class {
|
|
15120
15286
|
constructor(result) {
|
|
@@ -15130,6 +15296,12 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
15130
15296
|
|
|
15131
15297
|
// src/SimpleBootHttpServer.ts
|
|
15132
15298
|
var import_url2 = __require("url");
|
|
15299
|
+
|
|
15300
|
+
// src/models/datas/search/ReqSearchParamsObj.ts
|
|
15301
|
+
var ReqSearchParamsObj = class {
|
|
15302
|
+
};
|
|
15303
|
+
|
|
15304
|
+
// src/SimpleBootHttpServer.ts
|
|
15133
15305
|
var SimpleBootHttpServer = class extends SimpleApplication {
|
|
15134
15306
|
constructor(option = new HttpServerOption()) {
|
|
15135
15307
|
super(option);
|
|
@@ -15264,6 +15436,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
15264
15436
|
const validIndexs = getValidIndex(moduleInstance, it.propertyKey);
|
|
15265
15437
|
if (injects) {
|
|
15266
15438
|
const isJson = injects.find((it2) => it2.config?.situationType === "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_JSON_BODY" /* REQ_JSON_BODY */);
|
|
15439
|
+
const isSearchParamsObj = injects.find((it2) => it2.config?.situationType === "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_URL_SEARCH_PARAMS_OBJ" /* REQ_URL_SEARCH_PARAMS_OBJ */);
|
|
15267
15440
|
const isFormUrl = injects.find((it2) => it2.config?.situationType === "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_FORM_URL_BODY" /* REQ_FORM_URL_BODY */);
|
|
15268
15441
|
const isTransactionManager = injects.find((it2) => it2.config?.situationType === InjectSituationType.TransactionManager);
|
|
15269
15442
|
const siturationContainers = new SituationTypeContainers();
|
|
@@ -15283,6 +15456,19 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
15283
15456
|
data: data2
|
|
15284
15457
|
}));
|
|
15285
15458
|
}
|
|
15459
|
+
if (isSearchParamsObj) {
|
|
15460
|
+
let data2 = rr.reqUrlSearchParamsObj;
|
|
15461
|
+
if (validIndexs.includes(isSearchParamsObj.index)) {
|
|
15462
|
+
const inValid = execValidationInValid(data2);
|
|
15463
|
+
if ((inValid?.length ?? 0) > 0) {
|
|
15464
|
+
throw new ValidException(inValid);
|
|
15465
|
+
}
|
|
15466
|
+
}
|
|
15467
|
+
siturationContainers.push(new SituationTypeContainer({
|
|
15468
|
+
situationType: "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_URL_SEARCH_PARAMS_OBJ" /* REQ_URL_SEARCH_PARAMS_OBJ */,
|
|
15469
|
+
data: data2
|
|
15470
|
+
}));
|
|
15471
|
+
}
|
|
15286
15472
|
if (isFormUrl) {
|
|
15287
15473
|
let data2 = await rr.reqBodyFormUrlData();
|
|
15288
15474
|
if (isFormUrl.type) {
|
|
@@ -15312,6 +15498,8 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
15312
15498
|
otherStorage.set(ReqFormUrlBody, await rr.reqBodyReqFormUrlBody());
|
|
15313
15499
|
} else if (paramType === ReqJsonBody) {
|
|
15314
15500
|
otherStorage.set(ReqJsonBody, await rr.reqBodyReqJsonBody());
|
|
15501
|
+
} else if (paramType === ReqSearchParamsObj) {
|
|
15502
|
+
otherStorage.set(ReqSearchParamsObj, rr.reqUrlSearchParamsObj);
|
|
15315
15503
|
} else if (paramType === import_url2.URLSearchParams) {
|
|
15316
15504
|
otherStorage.set(import_url2.URLSearchParams, rr.reqUrlSearchParams);
|
|
15317
15505
|
} else if (paramType === ReqMultipartFormBody) {
|