@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
|
@@ -9431,6 +9431,7 @@ var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
|
|
|
9431
9431
|
// src/codes/HttpStatus.ts
|
|
9432
9432
|
var HttpStatus = /* @__PURE__ */ ((HttpStatus2) => {
|
|
9433
9433
|
HttpStatus2[HttpStatus2["Ok"] = 200] = "Ok";
|
|
9434
|
+
HttpStatus2[HttpStatus2["MultipleChoices"] = 300] = "MultipleChoices";
|
|
9434
9435
|
HttpStatus2[HttpStatus2["MovedPermanently"] = 301] = "MovedPermanently";
|
|
9435
9436
|
HttpStatus2[HttpStatus2["Found"] = 302] = "Found";
|
|
9436
9437
|
HttpStatus2[HttpStatus2["SeeOther"] = 303] = "SeeOther";
|
|
@@ -9535,6 +9536,7 @@ var ReflectUtils;
|
|
|
9535
9536
|
// src/decorators/MethodMapping.ts
|
|
9536
9537
|
var UrlMappingSituationType = /* @__PURE__ */ ((UrlMappingSituationType2) => {
|
|
9537
9538
|
UrlMappingSituationType2["REQ_JSON_BODY"] = "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_JSON_BODY";
|
|
9539
|
+
UrlMappingSituationType2["REQ_URL_SEARCH_PARAMS_OBJ"] = "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_URL_SEARCH_PARAMS_OBJ";
|
|
9538
9540
|
UrlMappingSituationType2["REQ_FORM_URL_BODY"] = "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_FORM_URL_BODY";
|
|
9539
9541
|
return UrlMappingSituationType2;
|
|
9540
9542
|
})(UrlMappingSituationType || {});
|
|
@@ -9814,6 +9816,14 @@ var ValidUtils;
|
|
|
9814
9816
|
const isConstructorLike = (fn) => {
|
|
9815
9817
|
return typeof fn === "function" && typeof fn.prototype !== "undefined";
|
|
9816
9818
|
};
|
|
9819
|
+
ValidUtils2.isUrl = (str) => {
|
|
9820
|
+
try {
|
|
9821
|
+
new URL(str);
|
|
9822
|
+
return true;
|
|
9823
|
+
} catch (_) {
|
|
9824
|
+
return false;
|
|
9825
|
+
}
|
|
9826
|
+
};
|
|
9817
9827
|
ValidUtils2.isFrozen = (obj) => {
|
|
9818
9828
|
return Object.isFrozen(obj);
|
|
9819
9829
|
};
|
|
@@ -10087,6 +10097,7 @@ var FileUtils;
|
|
|
10087
10097
|
constructor(_data) {
|
|
10088
10098
|
this._data = _data;
|
|
10089
10099
|
this.updateStats();
|
|
10100
|
+
this.etcData = _data.etcData;
|
|
10090
10101
|
}
|
|
10091
10102
|
get originalName() {
|
|
10092
10103
|
return this._data.originalName;
|
|
@@ -10136,10 +10147,11 @@ var FileUtils;
|
|
|
10136
10147
|
}
|
|
10137
10148
|
FileUtils2.File = File;
|
|
10138
10149
|
FileUtils2.writeFile = async (buffer, config) => {
|
|
10150
|
+
config ?? (config = {});
|
|
10139
10151
|
config.path ?? (config.path = `${node_os.tmpdir()}/${RandomUtils.uuid4()}_${Date.now()}`);
|
|
10140
10152
|
await node_fs.promises.mkdir(config.path.substring(0, config.path.lastIndexOf("/")), { recursive: true });
|
|
10141
10153
|
await node_fs.promises.writeFile(config.path, buffer);
|
|
10142
|
-
return new File({ path: config.path, originalName: config.originalName });
|
|
10154
|
+
return new File({ path: config.path, originalName: config.originalName, etcData: config.etcData });
|
|
10143
10155
|
};
|
|
10144
10156
|
FileUtils2.path = (path22) => {
|
|
10145
10157
|
return Array.isArray(path22) ? node_path.join(...path22) : path22;
|
|
@@ -10189,6 +10201,14 @@ var FileUtils;
|
|
|
10189
10201
|
const p = FileUtils2.path(path22);
|
|
10190
10202
|
return node_fs.promises.readFile(p, config?.option);
|
|
10191
10203
|
};
|
|
10204
|
+
FileUtils2.readJsonSync = (path22) => {
|
|
10205
|
+
const json = FileUtils2.readStringSync(path22);
|
|
10206
|
+
return JSON.parse(json);
|
|
10207
|
+
};
|
|
10208
|
+
FileUtils2.readJsonAsync = async (path22) => {
|
|
10209
|
+
const json = await FileUtils2.readStringAsync(path22);
|
|
10210
|
+
return JSON.parse(json);
|
|
10211
|
+
};
|
|
10192
10212
|
FileUtils2.readStringSync = (path22) => {
|
|
10193
10213
|
const p = FileUtils2.path(path22);
|
|
10194
10214
|
return node_fs.readFileSync(p, "utf-8");
|
|
@@ -10658,19 +10678,64 @@ var Intent = class {
|
|
|
10658
10678
|
const paths = this.fullPath.split("?");
|
|
10659
10679
|
return paths[1] ?? "";
|
|
10660
10680
|
}
|
|
10681
|
+
getQueryParamDecodeURI(key) {
|
|
10682
|
+
const p = this.queryParamsDecodeURI;
|
|
10683
|
+
if (key) {
|
|
10684
|
+
return p[key];
|
|
10685
|
+
} else {
|
|
10686
|
+
return p;
|
|
10687
|
+
}
|
|
10688
|
+
}
|
|
10689
|
+
getQueryParamDecodeURIFirst(key) {
|
|
10690
|
+
const param = this.getQueryParamDecodeURI(key);
|
|
10691
|
+
if (Array.isArray(param)) {
|
|
10692
|
+
return param[0];
|
|
10693
|
+
} else {
|
|
10694
|
+
return param;
|
|
10695
|
+
}
|
|
10696
|
+
}
|
|
10697
|
+
getQueryParam(key) {
|
|
10698
|
+
const p = this.queryParams;
|
|
10699
|
+
if (key) {
|
|
10700
|
+
return p[key];
|
|
10701
|
+
} else {
|
|
10702
|
+
return p;
|
|
10703
|
+
}
|
|
10704
|
+
}
|
|
10705
|
+
getQueryParamFirst(key) {
|
|
10706
|
+
const param = this.getQueryParam(key);
|
|
10707
|
+
if (Array.isArray(param)) {
|
|
10708
|
+
return param[0];
|
|
10709
|
+
} else {
|
|
10710
|
+
return param;
|
|
10711
|
+
}
|
|
10712
|
+
}
|
|
10661
10713
|
get queryParams() {
|
|
10662
10714
|
const param = {};
|
|
10663
10715
|
this.query.split("&")?.forEach((it) => {
|
|
10664
10716
|
const a = it.split("=");
|
|
10665
|
-
param[a[0]]
|
|
10717
|
+
if (param[a[0]]) {
|
|
10718
|
+
if (Array.isArray(param[a[0]])) {
|
|
10719
|
+
param[a[0]].push(a[1]);
|
|
10720
|
+
} else {
|
|
10721
|
+
param[a[0]] = [param[a[0]], a[1]];
|
|
10722
|
+
}
|
|
10723
|
+
} else {
|
|
10724
|
+
param[a[0]] = a[1];
|
|
10725
|
+
}
|
|
10666
10726
|
});
|
|
10667
10727
|
return param;
|
|
10668
10728
|
}
|
|
10669
|
-
get
|
|
10729
|
+
get queryParamsDecodeURI() {
|
|
10670
10730
|
const params = this.queryParams;
|
|
10671
10731
|
for (const key in params) {
|
|
10672
10732
|
if (params.hasOwnProperty(key)) {
|
|
10673
|
-
|
|
10733
|
+
const param = params[key];
|
|
10734
|
+
if (Array.isArray(param)) {
|
|
10735
|
+
params[key] = param.map((p) => decodeURIComponent(p));
|
|
10736
|
+
} else {
|
|
10737
|
+
params[key] = decodeURIComponent(param);
|
|
10738
|
+
}
|
|
10674
10739
|
}
|
|
10675
10740
|
}
|
|
10676
10741
|
return params;
|
|
@@ -11966,57 +12031,70 @@ var ObjectUtils;
|
|
|
11966
12031
|
if (Path2.isFunctionScript(path3) || Path2.isArrowFunctionScript(path3)) {
|
|
11967
12032
|
return path3;
|
|
11968
12033
|
}
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
|
|
11972
|
-
|
|
11973
|
-
|
|
11974
|
-
|
|
11975
|
-
|
|
11976
|
-
|
|
12034
|
+
const nullishCoalescingPlaceholder = "__NULLISH_COALESCING__";
|
|
12035
|
+
const hasNullishCoalescing = path3.includes("??");
|
|
12036
|
+
let tempPath = path3;
|
|
12037
|
+
if (hasNullishCoalescing) {
|
|
12038
|
+
tempPath = tempPath.replace(/\?\?/g, nullishCoalescingPlaceholder);
|
|
12039
|
+
}
|
|
12040
|
+
const ternaryMatch = tempPath.match(/\?\s+[^:]*:/);
|
|
12041
|
+
if (ternaryMatch) {
|
|
12042
|
+
const questionMarkIndex = tempPath.indexOf("?");
|
|
12043
|
+
const colonIndex = tempPath.indexOf(":", questionMarkIndex);
|
|
12044
|
+
if (questionMarkIndex !== -1 && colonIndex !== -1) {
|
|
12045
|
+
const charAfterQuestion = tempPath.charAt(questionMarkIndex + 1);
|
|
12046
|
+
if (charAfterQuestion === " " || charAfterQuestion === " " || charAfterQuestion === "\n") {
|
|
12047
|
+
const condition = tempPath.substring(0, questionMarkIndex).trim();
|
|
12048
|
+
const trueBranch = tempPath.substring(questionMarkIndex + 1, colonIndex).trim();
|
|
12049
|
+
const falseBranch = tempPath.substring(colonIndex + 1).trim();
|
|
12050
|
+
const processedCondition = Path2.toOptionalChainPath(condition);
|
|
12051
|
+
const processedTrueBranch = Path2.toOptionalChainPath(trueBranch);
|
|
12052
|
+
const processedFalseBranch = Path2.toOptionalChainPath(falseBranch);
|
|
12053
|
+
const finalResult = `${processedCondition} ? ${processedTrueBranch} : ${processedFalseBranch}`;
|
|
12054
|
+
return hasNullishCoalescing ? finalResult.replace(new RegExp(nullishCoalescingPlaceholder, "g"), "??") : finalResult;
|
|
11977
12055
|
}
|
|
11978
|
-
|
|
11979
|
-
});
|
|
11980
|
-
return result.join("");
|
|
12056
|
+
}
|
|
11981
12057
|
}
|
|
11982
|
-
if (
|
|
12058
|
+
if (tempPath.includes("(")) {
|
|
11983
12059
|
const functionCallMatches = [];
|
|
11984
|
-
let
|
|
12060
|
+
let workingPath = tempPath;
|
|
11985
12061
|
let counter = 0;
|
|
11986
12062
|
const functionCallRegex = /(\w+)\(([^()]*(?:\([^()]*\)[^()]*)*)\)/g;
|
|
11987
12063
|
let match;
|
|
11988
|
-
while ((match = functionCallRegex.exec(
|
|
12064
|
+
while ((match = functionCallRegex.exec(tempPath)) !== null) {
|
|
11989
12065
|
const fullMatch = match[0];
|
|
11990
12066
|
const funcName = match[1];
|
|
11991
12067
|
const funcArgs = match[2];
|
|
11992
12068
|
const placeholder = `__FUNC_CALL_${counter}__`;
|
|
11993
|
-
|
|
12069
|
+
let processedArgs = funcArgs ? Path2.toOptionalChainPath(funcArgs) : "";
|
|
12070
|
+
processedArgs = processedArgs.replace(/\?\.\s*$/, "");
|
|
11994
12071
|
const processedFuncCall = `${funcName}?.(${processedArgs})`;
|
|
11995
12072
|
functionCallMatches.push({
|
|
11996
12073
|
original: fullMatch,
|
|
11997
12074
|
processed: processedFuncCall,
|
|
11998
12075
|
placeholder
|
|
11999
12076
|
});
|
|
12000
|
-
|
|
12077
|
+
workingPath = workingPath.replace(fullMatch, placeholder);
|
|
12001
12078
|
counter++;
|
|
12002
12079
|
}
|
|
12003
|
-
const tokens2 =
|
|
12080
|
+
const tokens2 = workingPath.match(/[^?.[\]]+|\[[^\]]*\]/g);
|
|
12004
12081
|
let processedPath = "";
|
|
12005
12082
|
if (tokens2 && tokens2.length > 1) {
|
|
12006
12083
|
processedPath = tokens2.join("?.");
|
|
12007
12084
|
} else {
|
|
12008
|
-
processedPath =
|
|
12085
|
+
processedPath = workingPath;
|
|
12009
12086
|
}
|
|
12010
12087
|
for (const funcMatch of functionCallMatches) {
|
|
12011
12088
|
processedPath = processedPath.replace(funcMatch.placeholder, funcMatch.processed);
|
|
12012
12089
|
}
|
|
12013
|
-
return processedPath;
|
|
12090
|
+
return hasNullishCoalescing ? processedPath.replace(new RegExp(nullishCoalescingPlaceholder, "g"), "??") : processedPath;
|
|
12014
12091
|
}
|
|
12015
|
-
const tokens =
|
|
12092
|
+
const tokens = tempPath.match(/[^?.[\]]+|\[[^\]]*\]/g);
|
|
12016
12093
|
if (!tokens) {
|
|
12017
|
-
return path3;
|
|
12094
|
+
return hasNullishCoalescing ? path3 : path3;
|
|
12018
12095
|
}
|
|
12019
|
-
|
|
12096
|
+
const result = tokens.join("?.");
|
|
12097
|
+
return hasNullishCoalescing ? result.replace(new RegExp(nullishCoalescingPlaceholder, "g"), "??") : result;
|
|
12020
12098
|
};
|
|
12021
12099
|
Path2.removeOptionalChainOperator = (path3) => {
|
|
12022
12100
|
if (!path3) {
|
|
@@ -12329,9 +12407,19 @@ var ConvertUtils2;
|
|
|
12329
12407
|
ConvertUtils22.jsonToMap = (jsonStr) => {
|
|
12330
12408
|
return new Map(JSON.parse(jsonStr));
|
|
12331
12409
|
};
|
|
12410
|
+
ConvertUtils22.toUrl = (data) => {
|
|
12411
|
+
try {
|
|
12412
|
+
return new URL(data);
|
|
12413
|
+
} catch (e) {
|
|
12414
|
+
throw new Error(`Invalid URL string: ${data}`);
|
|
12415
|
+
}
|
|
12416
|
+
};
|
|
12332
12417
|
ConvertUtils22.decodeURIString = (data) => {
|
|
12333
12418
|
return decodeURIComponent(data);
|
|
12334
12419
|
};
|
|
12420
|
+
ConvertUtils22.encodeURIString = (data) => {
|
|
12421
|
+
return encodeURIComponent(data);
|
|
12422
|
+
};
|
|
12335
12423
|
ConvertUtils22.objToStrMap = (obj) => {
|
|
12336
12424
|
const strMap = /* @__PURE__ */ new Map();
|
|
12337
12425
|
for (const k of Object.keys(obj)) {
|
|
@@ -12699,6 +12787,29 @@ var ConvertUtils2;
|
|
|
12699
12787
|
ConvertUtils22.stringJsonToKeyPairs = (stringJson) => {
|
|
12700
12788
|
return Array.from(stringJson.matchAll(/(\w+):\s*([^,}]+)/g)).map((match) => ({ key: match[1], value: match[2] }));
|
|
12701
12789
|
};
|
|
12790
|
+
ConvertUtils22.stringToBase64 = (str) => {
|
|
12791
|
+
return btoa(str);
|
|
12792
|
+
};
|
|
12793
|
+
ConvertUtils22.uint8ArrayToBase64 = (bytes) => {
|
|
12794
|
+
let binary = "";
|
|
12795
|
+
const len = bytes.byteLength;
|
|
12796
|
+
for (let i = 0; i < len; i++) {
|
|
12797
|
+
binary += String.fromCharCode(bytes[i]);
|
|
12798
|
+
}
|
|
12799
|
+
return btoa(binary);
|
|
12800
|
+
};
|
|
12801
|
+
ConvertUtils22.base64ToString = (base64) => {
|
|
12802
|
+
return atob(base64);
|
|
12803
|
+
};
|
|
12804
|
+
ConvertUtils22.base64ToUint8Array = (base64) => {
|
|
12805
|
+
const binaryString = atob(base64);
|
|
12806
|
+
const len = binaryString.length;
|
|
12807
|
+
const bytes = new Uint8Array(len);
|
|
12808
|
+
for (let i = 0; i < len; i++) {
|
|
12809
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
12810
|
+
}
|
|
12811
|
+
return bytes;
|
|
12812
|
+
};
|
|
12702
12813
|
})(ConvertUtils2 || (ConvertUtils2 = {}));
|
|
12703
12814
|
|
|
12704
12815
|
// src/models/RequestResponse.ts
|
|
@@ -12819,7 +12930,7 @@ var RequestResponse = class _RequestResponse {
|
|
|
12819
12930
|
const formData = {};
|
|
12820
12931
|
for (const it of m) {
|
|
12821
12932
|
if (it.isFile) {
|
|
12822
|
-
formData[it.name] = await FileUtils.writeFile(it.value, { originalName: it.filename });
|
|
12933
|
+
formData[it.name] = await FileUtils.writeFile(it.value, { originalName: it.filename, etcData: it });
|
|
12823
12934
|
} else {
|
|
12824
12935
|
const target = formData[it.name];
|
|
12825
12936
|
if (Array.isArray(target)) {
|
|
@@ -13135,6 +13246,11 @@ var RequestResponse = class _RequestResponse {
|
|
|
13135
13246
|
// // this.res.write(chunk);
|
|
13136
13247
|
// return this.createRequestResponseChain();
|
|
13137
13248
|
// }
|
|
13249
|
+
resRedirect(statusCode, location) {
|
|
13250
|
+
this.res.statusCode = statusCode;
|
|
13251
|
+
this.res.setHeader(HttpHeaders.Location, location);
|
|
13252
|
+
this.res.end();
|
|
13253
|
+
}
|
|
13138
13254
|
resWriteHead(statusCode, headers) {
|
|
13139
13255
|
return this.createRequestResponseChain(this.res.writeHead(statusCode, headers));
|
|
13140
13256
|
}
|
|
@@ -14141,7 +14257,7 @@ var SimstanceManager = class _SimstanceManager {
|
|
|
14141
14257
|
}
|
|
14142
14258
|
};
|
|
14143
14259
|
|
|
14144
|
-
// ../core/dist/esm/message/Subscriber
|
|
14260
|
+
// ../core/dist/esm/message/Subscriber.js
|
|
14145
14261
|
var Subscriber = class {
|
|
14146
14262
|
constructor(destination) {
|
|
14147
14263
|
this.destination = destination;
|
|
@@ -14426,17 +14542,37 @@ var RouterModule = class {
|
|
|
14426
14542
|
return this.routerChains[0];
|
|
14427
14543
|
}
|
|
14428
14544
|
get firstRouteChainValue() {
|
|
14429
|
-
return this.firstRouteChain
|
|
14545
|
+
return this.firstRouteChain?.getValue();
|
|
14430
14546
|
}
|
|
14431
14547
|
get lastRouteChain() {
|
|
14432
14548
|
return this.routerChains[this.routerChains.length - 1];
|
|
14433
14549
|
}
|
|
14434
14550
|
get lastRouteChainValue() {
|
|
14435
|
-
return this.lastRouteChain
|
|
14551
|
+
return this.lastRouteChain?.getValue();
|
|
14436
14552
|
}
|
|
14437
14553
|
hasActivateInLastRoute(obj) {
|
|
14438
14554
|
return this.lastRouteChainValue?.hasActivate(obj) === true;
|
|
14439
14555
|
}
|
|
14556
|
+
getQueryParamDecodeURI(key) {
|
|
14557
|
+
if (this.intent) {
|
|
14558
|
+
return this.intent.getQueryParamDecodeURI(key);
|
|
14559
|
+
}
|
|
14560
|
+
}
|
|
14561
|
+
getQueryParamDecodeURIFirst(key) {
|
|
14562
|
+
if (this.intent) {
|
|
14563
|
+
return this.intent.getQueryParamDecodeURIFirst(key);
|
|
14564
|
+
}
|
|
14565
|
+
}
|
|
14566
|
+
getQueryParam(key) {
|
|
14567
|
+
if (this.intent) {
|
|
14568
|
+
return this.intent.getQueryParam(key);
|
|
14569
|
+
}
|
|
14570
|
+
}
|
|
14571
|
+
getQueryParamFirst(key) {
|
|
14572
|
+
if (this.intent) {
|
|
14573
|
+
return this.intent.getQueryParamFirst(key);
|
|
14574
|
+
}
|
|
14575
|
+
}
|
|
14440
14576
|
get queryParams() {
|
|
14441
14577
|
if (this.intent) {
|
|
14442
14578
|
return this.intent.queryParams;
|
|
@@ -14444,7 +14580,7 @@ var RouterModule = class {
|
|
|
14444
14580
|
}
|
|
14445
14581
|
get queryParamsAfterDecodeURI() {
|
|
14446
14582
|
if (this.intent) {
|
|
14447
|
-
return this.intent.
|
|
14583
|
+
return this.intent.queryParamsDecodeURI;
|
|
14448
14584
|
}
|
|
14449
14585
|
}
|
|
14450
14586
|
};
|
|
@@ -14809,6 +14945,53 @@ RouterManager = __decorate2([
|
|
|
14809
14945
|
__metadata("design:paramtypes", [typeof (_a = typeof SimstanceManager !== "undefined" && SimstanceManager) === "function" ? _a : Object, typeof (_b = typeof SimOption !== "undefined" && SimOption) === "function" ? _b : Object])
|
|
14810
14946
|
], RouterManager);
|
|
14811
14947
|
|
|
14948
|
+
// ../simple-boot/dist/esm/intent/IntentSubscribe.js
|
|
14949
|
+
var isIntentSubscribe = (obj) => {
|
|
14950
|
+
return !!obj && typeof obj.intentSubscribe === "function";
|
|
14951
|
+
};
|
|
14952
|
+
|
|
14953
|
+
// ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
|
|
14954
|
+
var CacheMetadataKey = Symbol("Cache");
|
|
14955
|
+
|
|
14956
|
+
// ../simple-boot/dist/esm/decorators/event/EventListener.js
|
|
14957
|
+
var EventListenerMetadataKey = Symbol("EventListener");
|
|
14958
|
+
|
|
14959
|
+
// ../simple-boot/dist/esm/decorators/validate/Validation.js
|
|
14960
|
+
var ValidMetadataKey = Symbol("ValidMetadataKey");
|
|
14961
|
+
var getValidIndex = (target, propertyKey) => {
|
|
14962
|
+
if (target !== null && void 0 !== target && typeof target === "object") {
|
|
14963
|
+
target = target.constructor;
|
|
14964
|
+
}
|
|
14965
|
+
if (propertyKey) {
|
|
14966
|
+
const parameters = Reflect.getOwnMetadata(ValidMetadataKey, target, propertyKey);
|
|
14967
|
+
return parameters ?? [];
|
|
14968
|
+
} else {
|
|
14969
|
+
return ReflectUtils.getMetadata(ValidMetadataKey, target) ?? [];
|
|
14970
|
+
}
|
|
14971
|
+
};
|
|
14972
|
+
var ValidationMetadataKey = Symbol("ValidationMetadataKey");
|
|
14973
|
+
var getValidators = (target) => {
|
|
14974
|
+
if (target !== null && void 0 !== target && typeof target === "object") {
|
|
14975
|
+
target = target.constructor;
|
|
14976
|
+
}
|
|
14977
|
+
return ReflectUtils.getMetadata(ValidationMetadataKey, target) ?? [];
|
|
14978
|
+
};
|
|
14979
|
+
var execValidationInValid = (obj) => {
|
|
14980
|
+
return execValidation(obj).filter((it) => !it.valid);
|
|
14981
|
+
};
|
|
14982
|
+
var execValidation = (obj) => {
|
|
14983
|
+
const validators = getValidators(obj);
|
|
14984
|
+
const reesults = [];
|
|
14985
|
+
validators.forEach((it) => {
|
|
14986
|
+
reesults.push({
|
|
14987
|
+
name: it.propertyKey,
|
|
14988
|
+
valid: it.validator(it.propertyKey, it),
|
|
14989
|
+
message: ""
|
|
14990
|
+
});
|
|
14991
|
+
});
|
|
14992
|
+
return reesults;
|
|
14993
|
+
};
|
|
14994
|
+
|
|
14812
14995
|
// ../simple-boot/dist/esm/intent/IntentManager.js
|
|
14813
14996
|
var __decorate3 = function(decorators, target, key, desc) {
|
|
14814
14997
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -14850,7 +15033,7 @@ var IntentManager = class IntentManager2 {
|
|
|
14850
15033
|
} else if (typeof it === "string") {
|
|
14851
15034
|
it = new Intent(it, data);
|
|
14852
15035
|
}
|
|
14853
|
-
|
|
15036
|
+
const intent = it;
|
|
14854
15037
|
const r = [];
|
|
14855
15038
|
if (!routerMatch) {
|
|
14856
15039
|
if (intent.symbols) {
|
|
@@ -14869,7 +15052,7 @@ var IntentManager = class IntentManager2 {
|
|
|
14869
15052
|
}
|
|
14870
15053
|
});
|
|
14871
15054
|
this.subject.next(it);
|
|
14872
|
-
|
|
15055
|
+
for (let data2 of targetInstances) {
|
|
14873
15056
|
let orNewSim = data2;
|
|
14874
15057
|
if (orNewSim) {
|
|
14875
15058
|
if (intent.paths.length > 0) {
|
|
@@ -14881,6 +15064,18 @@ var IntentManager = class IntentManager2 {
|
|
|
14881
15064
|
lastProp = i;
|
|
14882
15065
|
});
|
|
14883
15066
|
if (orNewSim && typeof orNewSim === "function") {
|
|
15067
|
+
const injects = getInject(callthis, orNewSim.name);
|
|
15068
|
+
if (injects) {
|
|
15069
|
+
for (const inject of injects) {
|
|
15070
|
+
let v = this.simstanceManager.findLastSim(inject.config).getValue();
|
|
15071
|
+
if (typeof inject.config.returnFactory === "function") {
|
|
15072
|
+
v = await inject.config.returnFactory({ instance: callthis, methodName: orNewSim.name, parameter: intent.data }, v);
|
|
15073
|
+
} else if (typeof inject.config.returnFactory === "string") {
|
|
15074
|
+
v = await v[inject.config.returnFactory]({ instance: callthis, methodName: orNewSim.name, parameter: intent.data }, v);
|
|
15075
|
+
}
|
|
15076
|
+
intent.data[inject.index] = v;
|
|
15077
|
+
}
|
|
15078
|
+
}
|
|
14884
15079
|
if (PublishType.DATA_PARAMETERS === intent.publishType) {
|
|
14885
15080
|
r.push(orNewSim.call(callthis, intent.data));
|
|
14886
15081
|
} else if (PublishType.INLINE_DATA_PARAMETERS === intent.publishType) {
|
|
@@ -14894,15 +15089,22 @@ var IntentManager = class IntentManager2 {
|
|
|
14894
15089
|
}
|
|
14895
15090
|
} else {
|
|
14896
15091
|
if (PublishType.DATA_PARAMETERS === intent.publishType) {
|
|
14897
|
-
|
|
15092
|
+
if (isIntentSubscribe(orNewSim)) {
|
|
15093
|
+
r.push(orNewSim.intentSubscribe(intent.data));
|
|
15094
|
+
}
|
|
14898
15095
|
} else if (PublishType.INLINE_DATA_PARAMETERS === intent.publishType) {
|
|
14899
|
-
|
|
15096
|
+
if (isIntentSubscribe(orNewSim)) {
|
|
15097
|
+
r.push(orNewSim.intentSubscribe(...intent.data));
|
|
15098
|
+
}
|
|
14900
15099
|
} else {
|
|
14901
|
-
|
|
15100
|
+
if (isIntentSubscribe(orNewSim)) {
|
|
15101
|
+
r.push(orNewSim?.intentSubscribe?.(intent));
|
|
15102
|
+
}
|
|
14902
15103
|
}
|
|
14903
15104
|
}
|
|
14904
15105
|
}
|
|
14905
|
-
}
|
|
15106
|
+
}
|
|
15107
|
+
;
|
|
14906
15108
|
return r;
|
|
14907
15109
|
}
|
|
14908
15110
|
};
|
|
@@ -15004,42 +15206,6 @@ var SimpleApplication = class {
|
|
|
15004
15206
|
import { IncomingMessage, Server as HttpServer, ServerResponse } from "http";
|
|
15005
15207
|
import { Server as HttpsServer } from "https";
|
|
15006
15208
|
|
|
15007
|
-
// ../simple-boot/dist/esm/decorators/validate/Validation.js
|
|
15008
|
-
var ValidMetadataKey = Symbol("ValidMetadataKey");
|
|
15009
|
-
var getValidIndex = (target, propertyKey) => {
|
|
15010
|
-
if (target !== null && void 0 !== target && typeof target === "object") {
|
|
15011
|
-
target = target.constructor;
|
|
15012
|
-
}
|
|
15013
|
-
if (propertyKey) {
|
|
15014
|
-
const parameters = Reflect.getOwnMetadata(ValidMetadataKey, target, propertyKey);
|
|
15015
|
-
return parameters ?? [];
|
|
15016
|
-
} else {
|
|
15017
|
-
return ReflectUtils.getMetadata(ValidMetadataKey, target) ?? [];
|
|
15018
|
-
}
|
|
15019
|
-
};
|
|
15020
|
-
var ValidationMetadataKey = Symbol("ValidationMetadataKey");
|
|
15021
|
-
var getValidators = (target) => {
|
|
15022
|
-
if (target !== null && void 0 !== target && typeof target === "object") {
|
|
15023
|
-
target = target.constructor;
|
|
15024
|
-
}
|
|
15025
|
-
return ReflectUtils.getMetadata(ValidationMetadataKey, target) ?? [];
|
|
15026
|
-
};
|
|
15027
|
-
var execValidationInValid = (obj) => {
|
|
15028
|
-
return execValidation(obj).filter((it) => !it.valid);
|
|
15029
|
-
};
|
|
15030
|
-
var execValidation = (obj) => {
|
|
15031
|
-
const validators = getValidators(obj);
|
|
15032
|
-
const reesults = [];
|
|
15033
|
-
validators.forEach((it) => {
|
|
15034
|
-
reesults.push({
|
|
15035
|
-
name: it.propertyKey,
|
|
15036
|
-
valid: it.validator(it.propertyKey, it),
|
|
15037
|
-
message: ""
|
|
15038
|
-
});
|
|
15039
|
-
});
|
|
15040
|
-
return reesults;
|
|
15041
|
-
};
|
|
15042
|
-
|
|
15043
15209
|
// ../simple-boot/dist/esm/errors/ValidException.js
|
|
15044
15210
|
var ValidException = class {
|
|
15045
15211
|
constructor(result) {
|
|
@@ -15055,6 +15221,12 @@ var ValidException = class {
|
|
|
15055
15221
|
|
|
15056
15222
|
// src/SimpleBootHttpServer.ts
|
|
15057
15223
|
import { URLSearchParams as URLSearchParams3 } from "url";
|
|
15224
|
+
|
|
15225
|
+
// src/models/datas/search/ReqSearchParamsObj.ts
|
|
15226
|
+
var ReqSearchParamsObj = class {
|
|
15227
|
+
};
|
|
15228
|
+
|
|
15229
|
+
// src/SimpleBootHttpServer.ts
|
|
15058
15230
|
var SimpleBootHttpServer = class extends SimpleApplication {
|
|
15059
15231
|
constructor(option = new HttpServerOption()) {
|
|
15060
15232
|
super(option);
|
|
@@ -15189,6 +15361,7 @@ var SimpleBootHttpServer = class extends SimpleApplication {
|
|
|
15189
15361
|
const validIndexs = getValidIndex(moduleInstance, it.propertyKey);
|
|
15190
15362
|
if (injects) {
|
|
15191
15363
|
const isJson = injects.find((it2) => it2.config?.situationType === "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_JSON_BODY" /* REQ_JSON_BODY */);
|
|
15364
|
+
const isSearchParamsObj = injects.find((it2) => it2.config?.situationType === "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_URL_SEARCH_PARAMS_OBJ" /* REQ_URL_SEARCH_PARAMS_OBJ */);
|
|
15192
15365
|
const isFormUrl = injects.find((it2) => it2.config?.situationType === "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_FORM_URL_BODY" /* REQ_FORM_URL_BODY */);
|
|
15193
15366
|
const isTransactionManager = injects.find((it2) => it2.config?.situationType === InjectSituationType.TransactionManager);
|
|
15194
15367
|
const siturationContainers = new SituationTypeContainers();
|
|
@@ -15208,6 +15381,19 @@ var SimpleBootHttpServer = class extends SimpleApplication {
|
|
|
15208
15381
|
data: data2
|
|
15209
15382
|
}));
|
|
15210
15383
|
}
|
|
15384
|
+
if (isSearchParamsObj) {
|
|
15385
|
+
let data2 = rr.reqUrlSearchParamsObj;
|
|
15386
|
+
if (validIndexs.includes(isSearchParamsObj.index)) {
|
|
15387
|
+
const inValid = execValidationInValid(data2);
|
|
15388
|
+
if ((inValid?.length ?? 0) > 0) {
|
|
15389
|
+
throw new ValidException(inValid);
|
|
15390
|
+
}
|
|
15391
|
+
}
|
|
15392
|
+
siturationContainers.push(new SituationTypeContainer({
|
|
15393
|
+
situationType: "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_URL_SEARCH_PARAMS_OBJ" /* REQ_URL_SEARCH_PARAMS_OBJ */,
|
|
15394
|
+
data: data2
|
|
15395
|
+
}));
|
|
15396
|
+
}
|
|
15211
15397
|
if (isFormUrl) {
|
|
15212
15398
|
let data2 = await rr.reqBodyFormUrlData();
|
|
15213
15399
|
if (isFormUrl.type) {
|
|
@@ -15237,6 +15423,8 @@ var SimpleBootHttpServer = class extends SimpleApplication {
|
|
|
15237
15423
|
otherStorage.set(ReqFormUrlBody, await rr.reqBodyReqFormUrlBody());
|
|
15238
15424
|
} else if (paramType === ReqJsonBody) {
|
|
15239
15425
|
otherStorage.set(ReqJsonBody, await rr.reqBodyReqJsonBody());
|
|
15426
|
+
} else if (paramType === ReqSearchParamsObj) {
|
|
15427
|
+
otherStorage.set(ReqSearchParamsObj, rr.reqUrlSearchParamsObj);
|
|
15240
15428
|
} else if (paramType === URLSearchParams3) {
|
|
15241
15429
|
otherStorage.set(URLSearchParams3, rr.reqUrlSearchParams);
|
|
15242
15430
|
} else if (paramType === ReqMultipartFormBody) {
|