@dooboostore/simple-boot-http-server 1.0.21 → 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 +59 -19
- package/dist/cjs/filters/ResourceFilter.js.map +2 -2
- package/dist/cjs/models/RequestResponse.js +29 -2
- 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 +56 -18
- package/dist/esm/filters/ResourceFilter.js.map +2 -2
- package/dist/esm/models/RequestResponse.js +29 -2
- 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 +437 -231
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js.map +4 -4
- 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 +16 -6
- package/dist/types/filters/ResourceFilter.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -38
- package/dist/types/models/RequestResponse.d.ts +3 -1
- 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 +444 -238
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js.map +4 -4
- package/package.json +14 -14
- 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 +68 -20
- package/src/models/RequestResponse.ts +32 -3
- package/src/models/datas/search/ReqSearchParamsObj.ts +3 -0
|
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
mod
|
|
31
31
|
));
|
|
32
32
|
|
|
33
|
-
//
|
|
33
|
+
// ../../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/db.json
|
|
34
34
|
var require_db = __commonJS({
|
|
35
|
-
"
|
|
35
|
+
"../../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/db.json"(exports, module) {
|
|
36
36
|
module.exports = {
|
|
37
37
|
"application/1d-interleaved-parityfec": {
|
|
38
38
|
source: "iana"
|
|
@@ -8555,16 +8555,16 @@ var require_db = __commonJS({
|
|
|
8555
8555
|
}
|
|
8556
8556
|
});
|
|
8557
8557
|
|
|
8558
|
-
//
|
|
8558
|
+
// ../../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/index.js
|
|
8559
8559
|
var require_mime_db = __commonJS({
|
|
8560
|
-
"
|
|
8560
|
+
"../../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/index.js"(exports, module) {
|
|
8561
8561
|
module.exports = require_db();
|
|
8562
8562
|
}
|
|
8563
8563
|
});
|
|
8564
8564
|
|
|
8565
|
-
//
|
|
8565
|
+
// ../../../node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.js
|
|
8566
8566
|
var require_mime_types = __commonJS({
|
|
8567
|
-
"
|
|
8567
|
+
"../../../node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.js"(exports) {
|
|
8568
8568
|
"use strict";
|
|
8569
8569
|
var db = require_mime_db();
|
|
8570
8570
|
var extname = __require("path").extname;
|
|
@@ -8652,9 +8652,9 @@ var require_mime_types = __commonJS({
|
|
|
8652
8652
|
}
|
|
8653
8653
|
});
|
|
8654
8654
|
|
|
8655
|
-
//
|
|
8655
|
+
// ../../../node_modules/.pnpm/node-gzip@1.1.2/node_modules/node-gzip/dist/index.js
|
|
8656
8656
|
var require_dist = __commonJS({
|
|
8657
|
-
"
|
|
8657
|
+
"../../../node_modules/.pnpm/node-gzip@1.1.2/node_modules/node-gzip/dist/index.js"(exports, module) {
|
|
8658
8658
|
"use strict";
|
|
8659
8659
|
var zlib = __require("zlib");
|
|
8660
8660
|
module.exports = {
|
|
@@ -8680,9 +8680,9 @@ var require_dist = __commonJS({
|
|
|
8680
8680
|
}
|
|
8681
8681
|
});
|
|
8682
8682
|
|
|
8683
|
-
//
|
|
8683
|
+
// ../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/helpers.js
|
|
8684
8684
|
var require_helpers = __commonJS({
|
|
8685
|
-
"
|
|
8685
|
+
"../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/helpers.js"(exports) {
|
|
8686
8686
|
var __extends = exports && exports.__extends || /* @__PURE__ */ function() {
|
|
8687
8687
|
var extendStatics = function(d, b) {
|
|
8688
8688
|
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
@@ -8848,9 +8848,9 @@ var require_helpers = __commonJS({
|
|
|
8848
8848
|
}
|
|
8849
8849
|
});
|
|
8850
8850
|
|
|
8851
|
-
//
|
|
8851
|
+
// ../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/core.js
|
|
8852
8852
|
var require_core = __commonJS({
|
|
8853
|
-
"
|
|
8853
|
+
"../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/core.js"(exports) {
|
|
8854
8854
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8855
8855
|
var helpers_js_1 = require_helpers();
|
|
8856
8856
|
exports.JsonPatchError = helpers_js_1.PatchError;
|
|
@@ -9181,9 +9181,9 @@ var require_core = __commonJS({
|
|
|
9181
9181
|
}
|
|
9182
9182
|
});
|
|
9183
9183
|
|
|
9184
|
-
//
|
|
9184
|
+
// ../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/duplex.js
|
|
9185
9185
|
var require_duplex = __commonJS({
|
|
9186
|
-
"
|
|
9186
|
+
"../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/duplex.js"(exports) {
|
|
9187
9187
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9188
9188
|
var helpers_js_1 = require_helpers();
|
|
9189
9189
|
var core_js_1 = require_core();
|
|
@@ -9355,9 +9355,9 @@ var require_duplex = __commonJS({
|
|
|
9355
9355
|
}
|
|
9356
9356
|
});
|
|
9357
9357
|
|
|
9358
|
-
//
|
|
9358
|
+
// ../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/index.js
|
|
9359
9359
|
var require_fast_json_patch = __commonJS({
|
|
9360
|
-
"
|
|
9360
|
+
"../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/index.js"(exports) {
|
|
9361
9361
|
var core = require_core();
|
|
9362
9362
|
Object.assign(exports, core);
|
|
9363
9363
|
var duplex = require_duplex();
|
|
@@ -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;
|
|
@@ -10185,6 +10197,26 @@ var FileUtils;
|
|
|
10185
10197
|
const buffer = config?.option ? node_fs.readFileSync(p, config.option) : node_fs.readFileSync(p);
|
|
10186
10198
|
return buffer;
|
|
10187
10199
|
};
|
|
10200
|
+
FileUtils2.readAsync = async (path22, config) => {
|
|
10201
|
+
const p = FileUtils2.path(path22);
|
|
10202
|
+
return node_fs.promises.readFile(p, config?.option);
|
|
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
|
+
};
|
|
10212
|
+
FileUtils2.readStringSync = (path22) => {
|
|
10213
|
+
const p = FileUtils2.path(path22);
|
|
10214
|
+
return node_fs.readFileSync(p, "utf-8");
|
|
10215
|
+
};
|
|
10216
|
+
FileUtils2.readStringAsync = async (path22) => {
|
|
10217
|
+
const p = FileUtils2.path(path22);
|
|
10218
|
+
return node_fs.promises.readFile(p, "utf-8");
|
|
10219
|
+
};
|
|
10188
10220
|
FileUtils2.read = async (path22, config) => {
|
|
10189
10221
|
const p = FileUtils2.path(path22);
|
|
10190
10222
|
return node_fs.readFile(p, config.option);
|
|
@@ -10432,20 +10464,33 @@ var OpenApi3Filter = class {
|
|
|
10432
10464
|
|
|
10433
10465
|
// src/filters/ResourceFilter.ts
|
|
10434
10466
|
var import_mime_types = __toESM(require_mime_types(), 1);
|
|
10435
|
-
import fs from "fs";
|
|
10436
|
-
import path from "path";
|
|
10467
|
+
import fs from "node:fs";
|
|
10468
|
+
import path from "node:path";
|
|
10469
|
+
import { Blob } from "node:buffer";
|
|
10470
|
+
var isPathDist = (item) => {
|
|
10471
|
+
return typeof item === "object" && "request" in item && "dist" in item;
|
|
10472
|
+
};
|
|
10473
|
+
var isDataDist = (item) => {
|
|
10474
|
+
return typeof item === "object" && "request" in item && "response" in item;
|
|
10475
|
+
};
|
|
10437
10476
|
var ResourceFilter = class {
|
|
10438
|
-
constructor(
|
|
10439
|
-
|
|
10440
|
-
|
|
10477
|
+
constructor(resourceDistPathOrResourceRegex, resourceRegex) {
|
|
10478
|
+
if (typeof resourceDistPathOrResourceRegex === "string") {
|
|
10479
|
+
this.resourceDistPath = resourceDistPathOrResourceRegex;
|
|
10480
|
+
this.resources = resourceRegex;
|
|
10481
|
+
} else {
|
|
10482
|
+
this.resources = resourceDistPathOrResourceRegex;
|
|
10483
|
+
}
|
|
10441
10484
|
}
|
|
10485
|
+
// constructor(private resourceDistPath: string, private resourceRegex: (RequestFilterType | { request: RequestFilterType, dist: string | ((rr: RequestResponse, app: SimpleBootHttpServer) => (string|Promise<Blob |ArrayBuffer| Response>)) })[] = []) {
|
|
10486
|
+
// }
|
|
10442
10487
|
async onInit(app) {
|
|
10443
10488
|
}
|
|
10444
10489
|
async proceedBefore({ rr, app }) {
|
|
10445
10490
|
const url = (rr.reqUrlPathName ?? "").replace(/\.\./g, "");
|
|
10446
10491
|
const urlObj = rr.reqUrlObject;
|
|
10447
10492
|
let sw = true;
|
|
10448
|
-
const regExps = this.
|
|
10493
|
+
const regExps = this.resources?.filter((it) => {
|
|
10449
10494
|
if (it instanceof RegExp) {
|
|
10450
10495
|
return it.test(url);
|
|
10451
10496
|
}
|
|
@@ -10461,21 +10506,44 @@ var ResourceFilter = class {
|
|
|
10461
10506
|
}
|
|
10462
10507
|
return RegExp(it.request).test(url);
|
|
10463
10508
|
}
|
|
10464
|
-
});
|
|
10509
|
+
}) ?? [];
|
|
10465
10510
|
for (const it of regExps) {
|
|
10466
|
-
const resourcePath = path.join(this.resourceDistPath, typeof it === "object" && "dist" in it ? it.dist : urlObj.pathname);
|
|
10467
10511
|
sw = false;
|
|
10468
|
-
if (
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10512
|
+
if (isDataDist(it)) {
|
|
10513
|
+
let distValue = typeof it.response === "function" ? it.response(rr, app) : it.response;
|
|
10514
|
+
if (distValue instanceof Promise) {
|
|
10515
|
+
const result = await distValue;
|
|
10516
|
+
if (result instanceof Response) {
|
|
10517
|
+
await rr.resEnd(result);
|
|
10518
|
+
break;
|
|
10519
|
+
} else if (result instanceof Blob) {
|
|
10520
|
+
rr.resStatusCode(200 /* Ok */);
|
|
10521
|
+
await rr.resEnd(result);
|
|
10522
|
+
break;
|
|
10523
|
+
}
|
|
10524
|
+
}
|
|
10473
10525
|
} else {
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10526
|
+
const dist = typeof it === "object" && "dist" in it ? it.dist : urlObj.pathname;
|
|
10527
|
+
let distValue = typeof dist === "function" ? dist(rr, app) : dist;
|
|
10528
|
+
if (this.resourceDistPath) {
|
|
10529
|
+
const resourcePath = path.join(this.resourceDistPath, distValue);
|
|
10530
|
+
if (fs.existsSync(resourcePath)) {
|
|
10531
|
+
rr.resStatusCode(200 /* Ok */);
|
|
10532
|
+
rr.resSetHeader(HttpHeaders.ContentType, import_mime_types.default.lookup(resourcePath).toString());
|
|
10533
|
+
await rr.resEnd(fs.readFileSync(resourcePath));
|
|
10534
|
+
break;
|
|
10535
|
+
} else {
|
|
10536
|
+
rr.resStatusCode(404 /* NotFound */);
|
|
10537
|
+
await rr.resEnd();
|
|
10538
|
+
break;
|
|
10539
|
+
}
|
|
10540
|
+
} else {
|
|
10541
|
+
rr.resStatusCode(500 /* InternalServerError */);
|
|
10542
|
+
await rr.resEnd();
|
|
10543
|
+
break;
|
|
10544
|
+
}
|
|
10477
10545
|
}
|
|
10478
|
-
sw =
|
|
10546
|
+
sw = true;
|
|
10479
10547
|
}
|
|
10480
10548
|
return sw;
|
|
10481
10549
|
}
|
|
@@ -10510,117 +10578,6 @@ var InjectSituationType;
|
|
|
10510
10578
|
InjectSituationType2.TransactionManager = Symbol("TransactionManager");
|
|
10511
10579
|
})(InjectSituationType || (InjectSituationType = {}));
|
|
10512
10580
|
|
|
10513
|
-
// ../core/dist/esm/string/StringUtils.js
|
|
10514
|
-
var StringUtils;
|
|
10515
|
-
((StringUtils2) => {
|
|
10516
|
-
StringUtils2.deleteEnter = (data) => {
|
|
10517
|
-
return data.replace(/\r?\n/g, "");
|
|
10518
|
-
};
|
|
10519
|
-
StringUtils2.pickEmoji = (data) => {
|
|
10520
|
-
return data.match(/[\p{Emoji}]/gu) ?? [];
|
|
10521
|
-
};
|
|
10522
|
-
StringUtils2.regexExec = (regex, text) => {
|
|
10523
|
-
let varExec = regex.exec(text);
|
|
10524
|
-
const usingVars = [];
|
|
10525
|
-
while (varExec) {
|
|
10526
|
-
usingVars.push(varExec);
|
|
10527
|
-
varExec = regex.exec(varExec.input);
|
|
10528
|
-
}
|
|
10529
|
-
return usingVars;
|
|
10530
|
-
};
|
|
10531
|
-
StringUtils2.regexExecArrayReplace = (origin, regexpExecArrayOrRegex, replace) => {
|
|
10532
|
-
const regexpExecArrays = Array.isArray(regexpExecArrayOrRegex) ? regexpExecArrayOrRegex : StringUtils2.regexExec(regexpExecArrayOrRegex, origin);
|
|
10533
|
-
regexpExecArrays.reverse().forEach((it) => {
|
|
10534
|
-
const r = typeof replace === "string" ? replace : replace(it);
|
|
10535
|
-
origin = origin.substr(0, it.index) + origin.substr(it.index).replace(it[0], r);
|
|
10536
|
-
});
|
|
10537
|
-
return origin;
|
|
10538
|
-
};
|
|
10539
|
-
StringUtils2.escapeSpecialCharacterRegExp = (data) => {
|
|
10540
|
-
return data.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
10541
|
-
};
|
|
10542
|
-
StringUtils2.trim = (data) => data.trim();
|
|
10543
|
-
StringUtils2.rsubString = (data_s, blen_n) => data_s.substring(data_s.length - blen_n, data_s.length);
|
|
10544
|
-
StringUtils2.lsubString = (data_s, alen_n) => data_s.substring(0, alen_n);
|
|
10545
|
-
StringUtils2.lpad = (fill_s, len_n, full_s) => {
|
|
10546
|
-
while (len_n > full_s.length) {
|
|
10547
|
-
full_s = fill_s + full_s;
|
|
10548
|
-
}
|
|
10549
|
-
return StringUtils2.rsubString(full_s, len_n);
|
|
10550
|
-
};
|
|
10551
|
-
StringUtils2.rpad = (fill_s, len_n, full_s) => {
|
|
10552
|
-
while (len_n > full_s.length) {
|
|
10553
|
-
full_s += fill_s;
|
|
10554
|
-
}
|
|
10555
|
-
return StringUtils2.lsubString(full_s, len_n);
|
|
10556
|
-
};
|
|
10557
|
-
StringUtils2.lappend = (count_n, input_s) => {
|
|
10558
|
-
let s = "";
|
|
10559
|
-
let i = 0;
|
|
10560
|
-
while (i++ < count_n) {
|
|
10561
|
-
s += input_s;
|
|
10562
|
-
}
|
|
10563
|
-
return s;
|
|
10564
|
-
};
|
|
10565
|
-
StringUtils2.unescape = (html) => {
|
|
10566
|
-
if (!html) return "";
|
|
10567
|
-
const htmlEntity = {
|
|
10568
|
-
quot: '"',
|
|
10569
|
-
amp: "&",
|
|
10570
|
-
apos: "'",
|
|
10571
|
-
lt: "<",
|
|
10572
|
-
gt: ">",
|
|
10573
|
-
nbsp: "\xA0",
|
|
10574
|
-
iexcl: "\xA1",
|
|
10575
|
-
cent: "\xA2",
|
|
10576
|
-
pound: "\xA3",
|
|
10577
|
-
curren: "\xA4",
|
|
10578
|
-
yen: "\xA5",
|
|
10579
|
-
brvbar: "\xA6",
|
|
10580
|
-
sect: "\xA7",
|
|
10581
|
-
uml: "\xA8",
|
|
10582
|
-
copy: "\xA9",
|
|
10583
|
-
ordf: "\xAA",
|
|
10584
|
-
laquo: "\xAB",
|
|
10585
|
-
not: "\xAC",
|
|
10586
|
-
shy: "\xAD",
|
|
10587
|
-
reg: "\xAE",
|
|
10588
|
-
macr: "\xAF",
|
|
10589
|
-
deg: "\xB0",
|
|
10590
|
-
plusmn: "\xB1",
|
|
10591
|
-
sup2: "\xB2",
|
|
10592
|
-
sup3: "\xB3",
|
|
10593
|
-
acute: "\xB4",
|
|
10594
|
-
micro: "\xB5",
|
|
10595
|
-
para: "\xB6",
|
|
10596
|
-
middot: "\xB7",
|
|
10597
|
-
cedil: "\xB8",
|
|
10598
|
-
sup1: "\xB9",
|
|
10599
|
-
ordm: "\xBA",
|
|
10600
|
-
raquo: "\xBB",
|
|
10601
|
-
frac14: "\xBC",
|
|
10602
|
-
frac12: "\xBD",
|
|
10603
|
-
frac34: "\xBE",
|
|
10604
|
-
iquest: "\xBF",
|
|
10605
|
-
"#x27": "'"
|
|
10606
|
-
};
|
|
10607
|
-
return html.replace(/&((?:(?:[a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});?)+);/gi, (match, entity) => {
|
|
10608
|
-
const entities = entity.toLowerCase().split(";");
|
|
10609
|
-
return entities.map((it) => it in htmlEntity ? htmlEntity[it] : match).join("");
|
|
10610
|
-
});
|
|
10611
|
-
};
|
|
10612
|
-
StringUtils2.executeExpression = (formatString, object) => {
|
|
10613
|
-
return formatString.replace(/\${([^{}]*)}/g, (matched, piece) => String(object[piece] ?? matched));
|
|
10614
|
-
};
|
|
10615
|
-
StringUtils2.ellipsis = (text, length) => {
|
|
10616
|
-
if (text.length > length) return `${text.slice(0, length)}...`;
|
|
10617
|
-
return text;
|
|
10618
|
-
};
|
|
10619
|
-
StringUtils2.appendPostposition = (text, { vowel, consonant }) => {
|
|
10620
|
-
return `${text}${ValidUtils.lastConsonantLetter(text) ? consonant : vowel}`;
|
|
10621
|
-
};
|
|
10622
|
-
})(StringUtils || (StringUtils = {}));
|
|
10623
|
-
|
|
10624
10581
|
// ../core/dist/esm/expression/Expression.js
|
|
10625
10582
|
var Expression;
|
|
10626
10583
|
((Expression2) => {
|
|
@@ -10635,17 +10592,6 @@ var Expression;
|
|
|
10635
10592
|
return binder;
|
|
10636
10593
|
});
|
|
10637
10594
|
};
|
|
10638
|
-
let Group;
|
|
10639
|
-
((Group2) => {
|
|
10640
|
-
Group2.isExpression = (data) => {
|
|
10641
|
-
const reg = /[$#]\{([\s\S.]*?)\}[$#]/g;
|
|
10642
|
-
return reg.test(data ?? "");
|
|
10643
|
-
};
|
|
10644
|
-
Group2.expressionGroups = (data) => {
|
|
10645
|
-
const reg = /[$#]\{([\s\S.]*?)\}[$#]/g;
|
|
10646
|
-
return StringUtils.regexExec(reg, data ?? "");
|
|
10647
|
-
};
|
|
10648
|
-
})(Group = Expression2.Group || (Expression2.Group = {}));
|
|
10649
10595
|
let Path;
|
|
10650
10596
|
((Path2) => {
|
|
10651
10597
|
Path2.pathNameData = (pathName, urlExpression) => {
|
|
@@ -10732,19 +10678,64 @@ var Intent = class {
|
|
|
10732
10678
|
const paths = this.fullPath.split("?");
|
|
10733
10679
|
return paths[1] ?? "";
|
|
10734
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
|
+
}
|
|
10735
10713
|
get queryParams() {
|
|
10736
10714
|
const param = {};
|
|
10737
10715
|
this.query.split("&")?.forEach((it) => {
|
|
10738
10716
|
const a = it.split("=");
|
|
10739
|
-
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
|
+
}
|
|
10740
10726
|
});
|
|
10741
10727
|
return param;
|
|
10742
10728
|
}
|
|
10743
|
-
get
|
|
10729
|
+
get queryParamsDecodeURI() {
|
|
10744
10730
|
const params = this.queryParams;
|
|
10745
10731
|
for (const key in params) {
|
|
10746
10732
|
if (params.hasOwnProperty(key)) {
|
|
10747
|
-
|
|
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
|
+
}
|
|
10748
10739
|
}
|
|
10749
10740
|
}
|
|
10750
10741
|
return params;
|
|
@@ -10775,6 +10766,7 @@ var ReqHeader = class {
|
|
|
10775
10766
|
|
|
10776
10767
|
// src/models/RequestResponse.ts
|
|
10777
10768
|
var import_node_gzip = __toESM(require_dist(), 1);
|
|
10769
|
+
import { Blob as Blob2 } from "node:buffer";
|
|
10778
10770
|
|
|
10779
10771
|
// ../core/dist/esm/entity/Point2D.js
|
|
10780
10772
|
var Point2D = class _Point2D {
|
|
@@ -12039,57 +12031,70 @@ var ObjectUtils;
|
|
|
12039
12031
|
if (Path2.isFunctionScript(path3) || Path2.isArrowFunctionScript(path3)) {
|
|
12040
12032
|
return path3;
|
|
12041
12033
|
}
|
|
12042
|
-
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
|
|
12046
|
-
|
|
12047
|
-
|
|
12048
|
-
|
|
12049
|
-
|
|
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;
|
|
12050
12055
|
}
|
|
12051
|
-
|
|
12052
|
-
});
|
|
12053
|
-
return result.join("");
|
|
12056
|
+
}
|
|
12054
12057
|
}
|
|
12055
|
-
if (
|
|
12058
|
+
if (tempPath.includes("(")) {
|
|
12056
12059
|
const functionCallMatches = [];
|
|
12057
|
-
let
|
|
12060
|
+
let workingPath = tempPath;
|
|
12058
12061
|
let counter = 0;
|
|
12059
12062
|
const functionCallRegex = /(\w+)\(([^()]*(?:\([^()]*\)[^()]*)*)\)/g;
|
|
12060
12063
|
let match;
|
|
12061
|
-
while ((match = functionCallRegex.exec(
|
|
12064
|
+
while ((match = functionCallRegex.exec(tempPath)) !== null) {
|
|
12062
12065
|
const fullMatch = match[0];
|
|
12063
12066
|
const funcName = match[1];
|
|
12064
12067
|
const funcArgs = match[2];
|
|
12065
12068
|
const placeholder = `__FUNC_CALL_${counter}__`;
|
|
12066
|
-
|
|
12069
|
+
let processedArgs = funcArgs ? Path2.toOptionalChainPath(funcArgs) : "";
|
|
12070
|
+
processedArgs = processedArgs.replace(/\?\.\s*$/, "");
|
|
12067
12071
|
const processedFuncCall = `${funcName}?.(${processedArgs})`;
|
|
12068
12072
|
functionCallMatches.push({
|
|
12069
12073
|
original: fullMatch,
|
|
12070
12074
|
processed: processedFuncCall,
|
|
12071
12075
|
placeholder
|
|
12072
12076
|
});
|
|
12073
|
-
|
|
12077
|
+
workingPath = workingPath.replace(fullMatch, placeholder);
|
|
12074
12078
|
counter++;
|
|
12075
12079
|
}
|
|
12076
|
-
const tokens2 =
|
|
12080
|
+
const tokens2 = workingPath.match(/[^?.[\]]+|\[[^\]]*\]/g);
|
|
12077
12081
|
let processedPath = "";
|
|
12078
12082
|
if (tokens2 && tokens2.length > 1) {
|
|
12079
12083
|
processedPath = tokens2.join("?.");
|
|
12080
12084
|
} else {
|
|
12081
|
-
processedPath =
|
|
12085
|
+
processedPath = workingPath;
|
|
12082
12086
|
}
|
|
12083
12087
|
for (const funcMatch of functionCallMatches) {
|
|
12084
12088
|
processedPath = processedPath.replace(funcMatch.placeholder, funcMatch.processed);
|
|
12085
12089
|
}
|
|
12086
|
-
return processedPath;
|
|
12090
|
+
return hasNullishCoalescing ? processedPath.replace(new RegExp(nullishCoalescingPlaceholder, "g"), "??") : processedPath;
|
|
12087
12091
|
}
|
|
12088
|
-
const tokens =
|
|
12092
|
+
const tokens = tempPath.match(/[^?.[\]]+|\[[^\]]*\]/g);
|
|
12089
12093
|
if (!tokens) {
|
|
12090
|
-
return path3;
|
|
12094
|
+
return hasNullishCoalescing ? path3 : path3;
|
|
12091
12095
|
}
|
|
12092
|
-
|
|
12096
|
+
const result = tokens.join("?.");
|
|
12097
|
+
return hasNullishCoalescing ? result.replace(new RegExp(nullishCoalescingPlaceholder, "g"), "??") : result;
|
|
12093
12098
|
};
|
|
12094
12099
|
Path2.removeOptionalChainOperator = (path3) => {
|
|
12095
12100
|
if (!path3) {
|
|
@@ -12330,7 +12335,7 @@ var ObjectUtils;
|
|
|
12330
12335
|
const func = new Function("window", "document", "console", `"use strict"; ${script}; `);
|
|
12331
12336
|
func.call(destUser, globalContext.window, globalContext.document, globalContext.console);
|
|
12332
12337
|
} catch (e) {
|
|
12333
|
-
console.error("detectPathFromScript error:", e);
|
|
12338
|
+
console.error("detectPathFromScript error:", script, e);
|
|
12334
12339
|
}
|
|
12335
12340
|
if (options?.excludeThis) {
|
|
12336
12341
|
const filteredVars = /* @__PURE__ */ new Set();
|
|
@@ -12402,9 +12407,19 @@ var ConvertUtils2;
|
|
|
12402
12407
|
ConvertUtils22.jsonToMap = (jsonStr) => {
|
|
12403
12408
|
return new Map(JSON.parse(jsonStr));
|
|
12404
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
|
+
};
|
|
12405
12417
|
ConvertUtils22.decodeURIString = (data) => {
|
|
12406
12418
|
return decodeURIComponent(data);
|
|
12407
12419
|
};
|
|
12420
|
+
ConvertUtils22.encodeURIString = (data) => {
|
|
12421
|
+
return encodeURIComponent(data);
|
|
12422
|
+
};
|
|
12408
12423
|
ConvertUtils22.objToStrMap = (obj) => {
|
|
12409
12424
|
const strMap = /* @__PURE__ */ new Map();
|
|
12410
12425
|
for (const k of Object.keys(obj)) {
|
|
@@ -12542,6 +12557,74 @@ var ConvertUtils2;
|
|
|
12542
12557
|
ConvertUtils22.decodeHTMLEscape = (data) => {
|
|
12543
12558
|
return data.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(///g, "/");
|
|
12544
12559
|
};
|
|
12560
|
+
function escapeHTML(htmlString, option) {
|
|
12561
|
+
if (!htmlString) return "";
|
|
12562
|
+
const escapeMap = {
|
|
12563
|
+
"&": "&",
|
|
12564
|
+
// 반드시 먼저 처리
|
|
12565
|
+
"<": "<",
|
|
12566
|
+
">": ">",
|
|
12567
|
+
'"': """,
|
|
12568
|
+
"'": "'",
|
|
12569
|
+
// or ' (하지만 HTML4에서는 ' 권장)
|
|
12570
|
+
"/": "/",
|
|
12571
|
+
"`": "`",
|
|
12572
|
+
"=": "=",
|
|
12573
|
+
"{": "{",
|
|
12574
|
+
"}": "}",
|
|
12575
|
+
"#": "#",
|
|
12576
|
+
"$": "$",
|
|
12577
|
+
"\n": " ",
|
|
12578
|
+
// newline
|
|
12579
|
+
"\r": " ",
|
|
12580
|
+
// carriage return
|
|
12581
|
+
" ": "	",
|
|
12582
|
+
// tab
|
|
12583
|
+
"\xA0": " ",
|
|
12584
|
+
// non-breaking space
|
|
12585
|
+
"\xA2": "¢",
|
|
12586
|
+
"\xA3": "£",
|
|
12587
|
+
"\xA5": "¥",
|
|
12588
|
+
"\u20AC": "€",
|
|
12589
|
+
"\xA9": "©",
|
|
12590
|
+
"\xAE": "®",
|
|
12591
|
+
"\u2122": "™",
|
|
12592
|
+
"\xB0": "°",
|
|
12593
|
+
"\xB1": "±",
|
|
12594
|
+
"\xD7": "×",
|
|
12595
|
+
"\xF7": "÷",
|
|
12596
|
+
"\u2212": "−",
|
|
12597
|
+
"\u2022": "•",
|
|
12598
|
+
"\u2026": "…",
|
|
12599
|
+
"\u2190": "←",
|
|
12600
|
+
"\u2192": "→",
|
|
12601
|
+
"\u2191": "↑",
|
|
12602
|
+
"\u2193": "↓",
|
|
12603
|
+
"\u2194": "↔"
|
|
12604
|
+
};
|
|
12605
|
+
const targetsSet = option?.targets ? new Set(option.targets) : null;
|
|
12606
|
+
const filteredEscapeMap = targetsSet ? Object.fromEntries(Object.entries(escapeMap).filter(([key]) => targetsSet.has(key))) : escapeMap;
|
|
12607
|
+
const shouldEscapeAmpersand = !targetsSet || targetsSet.has("&");
|
|
12608
|
+
const charsToEscape = Object.keys(filteredEscapeMap).filter((char) => char !== "&");
|
|
12609
|
+
if (charsToEscape.length === 0 && !shouldEscapeAmpersand) {
|
|
12610
|
+
return htmlString;
|
|
12611
|
+
}
|
|
12612
|
+
const escapedChars = charsToEscape.map((char) => {
|
|
12613
|
+
return char.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
12614
|
+
}).join("");
|
|
12615
|
+
let result = htmlString;
|
|
12616
|
+
if (shouldEscapeAmpersand) {
|
|
12617
|
+
result = result.replace(/&/g, "&");
|
|
12618
|
+
}
|
|
12619
|
+
if (escapedChars.length > 0) {
|
|
12620
|
+
const regex = new RegExp(`[${escapedChars}]`, "g");
|
|
12621
|
+
result = result.replace(regex, (match) => {
|
|
12622
|
+
return filteredEscapeMap[match] || match;
|
|
12623
|
+
});
|
|
12624
|
+
}
|
|
12625
|
+
return result;
|
|
12626
|
+
}
|
|
12627
|
+
ConvertUtils22.escapeHTML = escapeHTML;
|
|
12545
12628
|
ConvertUtils22.copyObject = (obj, update = {}) => {
|
|
12546
12629
|
return { ...obj, ...update };
|
|
12547
12630
|
};
|
|
@@ -12704,6 +12787,29 @@ var ConvertUtils2;
|
|
|
12704
12787
|
ConvertUtils22.stringJsonToKeyPairs = (stringJson) => {
|
|
12705
12788
|
return Array.from(stringJson.matchAll(/(\w+):\s*([^,}]+)/g)).map((match) => ({ key: match[1], value: match[2] }));
|
|
12706
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
|
+
};
|
|
12707
12813
|
})(ConvertUtils2 || (ConvertUtils2 = {}));
|
|
12708
12814
|
|
|
12709
12815
|
// src/models/RequestResponse.ts
|
|
@@ -12824,7 +12930,7 @@ var RequestResponse = class _RequestResponse {
|
|
|
12824
12930
|
const formData = {};
|
|
12825
12931
|
for (const it of m) {
|
|
12826
12932
|
if (it.isFile) {
|
|
12827
|
-
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 });
|
|
12828
12934
|
} else {
|
|
12829
12935
|
const target = formData[it.name];
|
|
12830
12936
|
if (Array.isArray(target)) {
|
|
@@ -13102,7 +13208,28 @@ var RequestResponse = class _RequestResponse {
|
|
|
13102
13208
|
this.res.end(data);
|
|
13103
13209
|
}
|
|
13104
13210
|
async resEnd(chunk) {
|
|
13105
|
-
|
|
13211
|
+
if (chunk instanceof Response) {
|
|
13212
|
+
chunk.headers.forEach((value, key) => {
|
|
13213
|
+
this.res.setHeader(`ORIGIN-${key}`, value);
|
|
13214
|
+
});
|
|
13215
|
+
if (!this.resHeader(HttpHeaders.ContentType)) {
|
|
13216
|
+
const contentType = chunk.headers.get(HttpHeaders.ContentType);
|
|
13217
|
+
if (contentType) {
|
|
13218
|
+
this.res.setHeader(HttpHeaders.ContentType, contentType);
|
|
13219
|
+
}
|
|
13220
|
+
}
|
|
13221
|
+
this.res.statusCode = chunk.status;
|
|
13222
|
+
this.resWriteChunk = Buffer2.from(await chunk.arrayBuffer());
|
|
13223
|
+
} else if (chunk instanceof Blob2) {
|
|
13224
|
+
this.resWriteChunk = Buffer2.from(await chunk.arrayBuffer());
|
|
13225
|
+
if (!this.resHeader(HttpHeaders.ContentType)) {
|
|
13226
|
+
this.res.setHeader(HttpHeaders.ContentType, chunk.type);
|
|
13227
|
+
}
|
|
13228
|
+
} else if (chunk instanceof ArrayBuffer) {
|
|
13229
|
+
this.resWriteChunk = Buffer2.from(chunk);
|
|
13230
|
+
} else {
|
|
13231
|
+
this.resWriteChunk = chunk ?? this.resWriteChunk;
|
|
13232
|
+
}
|
|
13106
13233
|
if (this.req.readable) {
|
|
13107
13234
|
await this.reqBodyData();
|
|
13108
13235
|
await this.resEndChunk();
|
|
@@ -13119,6 +13246,11 @@ var RequestResponse = class _RequestResponse {
|
|
|
13119
13246
|
// // this.res.write(chunk);
|
|
13120
13247
|
// return this.createRequestResponseChain();
|
|
13121
13248
|
// }
|
|
13249
|
+
resRedirect(statusCode, location) {
|
|
13250
|
+
this.res.statusCode = statusCode;
|
|
13251
|
+
this.res.setHeader(HttpHeaders.Location, location);
|
|
13252
|
+
this.res.end();
|
|
13253
|
+
}
|
|
13122
13254
|
resWriteHead(statusCode, headers) {
|
|
13123
13255
|
return this.createRequestResponseChain(this.res.writeHead(statusCode, headers));
|
|
13124
13256
|
}
|
|
@@ -14125,7 +14257,7 @@ var SimstanceManager = class _SimstanceManager {
|
|
|
14125
14257
|
}
|
|
14126
14258
|
};
|
|
14127
14259
|
|
|
14128
|
-
// ../core/dist/esm/message/Subscriber
|
|
14260
|
+
// ../core/dist/esm/message/Subscriber.js
|
|
14129
14261
|
var Subscriber = class {
|
|
14130
14262
|
constructor(destination) {
|
|
14131
14263
|
this.destination = destination;
|
|
@@ -14410,17 +14542,37 @@ var RouterModule = class {
|
|
|
14410
14542
|
return this.routerChains[0];
|
|
14411
14543
|
}
|
|
14412
14544
|
get firstRouteChainValue() {
|
|
14413
|
-
return this.firstRouteChain
|
|
14545
|
+
return this.firstRouteChain?.getValue();
|
|
14414
14546
|
}
|
|
14415
14547
|
get lastRouteChain() {
|
|
14416
14548
|
return this.routerChains[this.routerChains.length - 1];
|
|
14417
14549
|
}
|
|
14418
14550
|
get lastRouteChainValue() {
|
|
14419
|
-
return this.lastRouteChain
|
|
14551
|
+
return this.lastRouteChain?.getValue();
|
|
14420
14552
|
}
|
|
14421
14553
|
hasActivateInLastRoute(obj) {
|
|
14422
14554
|
return this.lastRouteChainValue?.hasActivate(obj) === true;
|
|
14423
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
|
+
}
|
|
14424
14576
|
get queryParams() {
|
|
14425
14577
|
if (this.intent) {
|
|
14426
14578
|
return this.intent.queryParams;
|
|
@@ -14428,7 +14580,7 @@ var RouterModule = class {
|
|
|
14428
14580
|
}
|
|
14429
14581
|
get queryParamsAfterDecodeURI() {
|
|
14430
14582
|
if (this.intent) {
|
|
14431
|
-
return this.intent.
|
|
14583
|
+
return this.intent.queryParamsDecodeURI;
|
|
14432
14584
|
}
|
|
14433
14585
|
}
|
|
14434
14586
|
};
|
|
@@ -14793,6 +14945,53 @@ RouterManager = __decorate2([
|
|
|
14793
14945
|
__metadata("design:paramtypes", [typeof (_a = typeof SimstanceManager !== "undefined" && SimstanceManager) === "function" ? _a : Object, typeof (_b = typeof SimOption !== "undefined" && SimOption) === "function" ? _b : Object])
|
|
14794
14946
|
], RouterManager);
|
|
14795
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
|
+
|
|
14796
14995
|
// ../simple-boot/dist/esm/intent/IntentManager.js
|
|
14797
14996
|
var __decorate3 = function(decorators, target, key, desc) {
|
|
14798
14997
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -14834,7 +15033,7 @@ var IntentManager = class IntentManager2 {
|
|
|
14834
15033
|
} else if (typeof it === "string") {
|
|
14835
15034
|
it = new Intent(it, data);
|
|
14836
15035
|
}
|
|
14837
|
-
|
|
15036
|
+
const intent = it;
|
|
14838
15037
|
const r = [];
|
|
14839
15038
|
if (!routerMatch) {
|
|
14840
15039
|
if (intent.symbols) {
|
|
@@ -14853,7 +15052,7 @@ var IntentManager = class IntentManager2 {
|
|
|
14853
15052
|
}
|
|
14854
15053
|
});
|
|
14855
15054
|
this.subject.next(it);
|
|
14856
|
-
|
|
15055
|
+
for (let data2 of targetInstances) {
|
|
14857
15056
|
let orNewSim = data2;
|
|
14858
15057
|
if (orNewSim) {
|
|
14859
15058
|
if (intent.paths.length > 0) {
|
|
@@ -14865,6 +15064,18 @@ var IntentManager = class IntentManager2 {
|
|
|
14865
15064
|
lastProp = i;
|
|
14866
15065
|
});
|
|
14867
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
|
+
}
|
|
14868
15079
|
if (PublishType.DATA_PARAMETERS === intent.publishType) {
|
|
14869
15080
|
r.push(orNewSim.call(callthis, intent.data));
|
|
14870
15081
|
} else if (PublishType.INLINE_DATA_PARAMETERS === intent.publishType) {
|
|
@@ -14878,15 +15089,22 @@ var IntentManager = class IntentManager2 {
|
|
|
14878
15089
|
}
|
|
14879
15090
|
} else {
|
|
14880
15091
|
if (PublishType.DATA_PARAMETERS === intent.publishType) {
|
|
14881
|
-
|
|
15092
|
+
if (isIntentSubscribe(orNewSim)) {
|
|
15093
|
+
r.push(orNewSim.intentSubscribe(intent.data));
|
|
15094
|
+
}
|
|
14882
15095
|
} else if (PublishType.INLINE_DATA_PARAMETERS === intent.publishType) {
|
|
14883
|
-
|
|
15096
|
+
if (isIntentSubscribe(orNewSim)) {
|
|
15097
|
+
r.push(orNewSim.intentSubscribe(...intent.data));
|
|
15098
|
+
}
|
|
14884
15099
|
} else {
|
|
14885
|
-
|
|
15100
|
+
if (isIntentSubscribe(orNewSim)) {
|
|
15101
|
+
r.push(orNewSim?.intentSubscribe?.(intent));
|
|
15102
|
+
}
|
|
14886
15103
|
}
|
|
14887
15104
|
}
|
|
14888
15105
|
}
|
|
14889
|
-
}
|
|
15106
|
+
}
|
|
15107
|
+
;
|
|
14890
15108
|
return r;
|
|
14891
15109
|
}
|
|
14892
15110
|
};
|
|
@@ -14988,42 +15206,6 @@ var SimpleApplication = class {
|
|
|
14988
15206
|
import { IncomingMessage, Server as HttpServer, ServerResponse } from "http";
|
|
14989
15207
|
import { Server as HttpsServer } from "https";
|
|
14990
15208
|
|
|
14991
|
-
// ../simple-boot/dist/esm/decorators/validate/Validation.js
|
|
14992
|
-
var ValidMetadataKey = Symbol("ValidMetadataKey");
|
|
14993
|
-
var getValidIndex = (target, propertyKey) => {
|
|
14994
|
-
if (target !== null && void 0 !== target && typeof target === "object") {
|
|
14995
|
-
target = target.constructor;
|
|
14996
|
-
}
|
|
14997
|
-
if (propertyKey) {
|
|
14998
|
-
const parameters = Reflect.getOwnMetadata(ValidMetadataKey, target, propertyKey);
|
|
14999
|
-
return parameters ?? [];
|
|
15000
|
-
} else {
|
|
15001
|
-
return ReflectUtils.getMetadata(ValidMetadataKey, target) ?? [];
|
|
15002
|
-
}
|
|
15003
|
-
};
|
|
15004
|
-
var ValidationMetadataKey = Symbol("ValidationMetadataKey");
|
|
15005
|
-
var getValidators = (target) => {
|
|
15006
|
-
if (target !== null && void 0 !== target && typeof target === "object") {
|
|
15007
|
-
target = target.constructor;
|
|
15008
|
-
}
|
|
15009
|
-
return ReflectUtils.getMetadata(ValidationMetadataKey, target) ?? [];
|
|
15010
|
-
};
|
|
15011
|
-
var execValidationInValid = (obj) => {
|
|
15012
|
-
return execValidation(obj).filter((it) => !it.valid);
|
|
15013
|
-
};
|
|
15014
|
-
var execValidation = (obj) => {
|
|
15015
|
-
const validators = getValidators(obj);
|
|
15016
|
-
const reesults = [];
|
|
15017
|
-
validators.forEach((it) => {
|
|
15018
|
-
reesults.push({
|
|
15019
|
-
name: it.propertyKey,
|
|
15020
|
-
valid: it.validator(it.propertyKey, it),
|
|
15021
|
-
message: ""
|
|
15022
|
-
});
|
|
15023
|
-
});
|
|
15024
|
-
return reesults;
|
|
15025
|
-
};
|
|
15026
|
-
|
|
15027
15209
|
// ../simple-boot/dist/esm/errors/ValidException.js
|
|
15028
15210
|
var ValidException = class {
|
|
15029
15211
|
constructor(result) {
|
|
@@ -15039,6 +15221,12 @@ var ValidException = class {
|
|
|
15039
15221
|
|
|
15040
15222
|
// src/SimpleBootHttpServer.ts
|
|
15041
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
|
|
15042
15230
|
var SimpleBootHttpServer = class extends SimpleApplication {
|
|
15043
15231
|
constructor(option = new HttpServerOption()) {
|
|
15044
15232
|
super(option);
|
|
@@ -15173,6 +15361,7 @@ var SimpleBootHttpServer = class extends SimpleApplication {
|
|
|
15173
15361
|
const validIndexs = getValidIndex(moduleInstance, it.propertyKey);
|
|
15174
15362
|
if (injects) {
|
|
15175
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 */);
|
|
15176
15365
|
const isFormUrl = injects.find((it2) => it2.config?.situationType === "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_FORM_URL_BODY" /* REQ_FORM_URL_BODY */);
|
|
15177
15366
|
const isTransactionManager = injects.find((it2) => it2.config?.situationType === InjectSituationType.TransactionManager);
|
|
15178
15367
|
const siturationContainers = new SituationTypeContainers();
|
|
@@ -15192,6 +15381,19 @@ var SimpleBootHttpServer = class extends SimpleApplication {
|
|
|
15192
15381
|
data: data2
|
|
15193
15382
|
}));
|
|
15194
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
|
+
}
|
|
15195
15397
|
if (isFormUrl) {
|
|
15196
15398
|
let data2 = await rr.reqBodyFormUrlData();
|
|
15197
15399
|
if (isFormUrl.type) {
|
|
@@ -15221,6 +15423,8 @@ var SimpleBootHttpServer = class extends SimpleApplication {
|
|
|
15221
15423
|
otherStorage.set(ReqFormUrlBody, await rr.reqBodyReqFormUrlBody());
|
|
15222
15424
|
} else if (paramType === ReqJsonBody) {
|
|
15223
15425
|
otherStorage.set(ReqJsonBody, await rr.reqBodyReqJsonBody());
|
|
15426
|
+
} else if (paramType === ReqSearchParamsObj) {
|
|
15427
|
+
otherStorage.set(ReqSearchParamsObj, rr.reqUrlSearchParamsObj);
|
|
15224
15428
|
} else if (paramType === URLSearchParams3) {
|
|
15225
15429
|
otherStorage.set(URLSearchParams3, rr.reqUrlSearchParams);
|
|
15226
15430
|
} else if (paramType === ReqMultipartFormBody) {
|
|
@@ -15357,7 +15561,9 @@ export {
|
|
|
15357
15561
|
getTRACE,
|
|
15358
15562
|
getTRACES,
|
|
15359
15563
|
getUrlMapping,
|
|
15360
|
-
getUrlMappings
|
|
15564
|
+
getUrlMappings,
|
|
15565
|
+
isDataDist,
|
|
15566
|
+
isPathDist
|
|
15361
15567
|
};
|
|
15362
15568
|
/*! Bundled license information:
|
|
15363
15569
|
|