@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
|
@@ -36,9 +36,9 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
36
36
|
));
|
|
37
37
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
38
|
|
|
39
|
-
//
|
|
39
|
+
// ../../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/db.json
|
|
40
40
|
var require_db = __commonJS({
|
|
41
|
-
"
|
|
41
|
+
"../../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/db.json"(exports, module) {
|
|
42
42
|
module.exports = {
|
|
43
43
|
"application/1d-interleaved-parityfec": {
|
|
44
44
|
source: "iana"
|
|
@@ -8561,16 +8561,16 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
8561
8561
|
}
|
|
8562
8562
|
});
|
|
8563
8563
|
|
|
8564
|
-
//
|
|
8564
|
+
// ../../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/index.js
|
|
8565
8565
|
var require_mime_db = __commonJS({
|
|
8566
|
-
"
|
|
8566
|
+
"../../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/index.js"(exports, module) {
|
|
8567
8567
|
module.exports = require_db();
|
|
8568
8568
|
}
|
|
8569
8569
|
});
|
|
8570
8570
|
|
|
8571
|
-
//
|
|
8571
|
+
// ../../../node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.js
|
|
8572
8572
|
var require_mime_types = __commonJS({
|
|
8573
|
-
"
|
|
8573
|
+
"../../../node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.js"(exports) {
|
|
8574
8574
|
"use strict";
|
|
8575
8575
|
var db = require_mime_db();
|
|
8576
8576
|
var extname = __require("path").extname;
|
|
@@ -8658,9 +8658,9 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
8658
8658
|
}
|
|
8659
8659
|
});
|
|
8660
8660
|
|
|
8661
|
-
//
|
|
8661
|
+
// ../../../node_modules/.pnpm/node-gzip@1.1.2/node_modules/node-gzip/dist/index.js
|
|
8662
8662
|
var require_dist = __commonJS({
|
|
8663
|
-
"
|
|
8663
|
+
"../../../node_modules/.pnpm/node-gzip@1.1.2/node_modules/node-gzip/dist/index.js"(exports, module) {
|
|
8664
8664
|
"use strict";
|
|
8665
8665
|
var zlib = __require("zlib");
|
|
8666
8666
|
module.exports = {
|
|
@@ -8686,9 +8686,9 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
8686
8686
|
}
|
|
8687
8687
|
});
|
|
8688
8688
|
|
|
8689
|
-
//
|
|
8689
|
+
// ../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/helpers.js
|
|
8690
8690
|
var require_helpers = __commonJS({
|
|
8691
|
-
"
|
|
8691
|
+
"../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/helpers.js"(exports) {
|
|
8692
8692
|
var __extends = exports && exports.__extends || /* @__PURE__ */ function() {
|
|
8693
8693
|
var extendStatics = function(d, b) {
|
|
8694
8694
|
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
@@ -8854,9 +8854,9 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
8854
8854
|
}
|
|
8855
8855
|
});
|
|
8856
8856
|
|
|
8857
|
-
//
|
|
8857
|
+
// ../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/core.js
|
|
8858
8858
|
var require_core = __commonJS({
|
|
8859
|
-
"
|
|
8859
|
+
"../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/core.js"(exports) {
|
|
8860
8860
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8861
8861
|
var helpers_js_1 = require_helpers();
|
|
8862
8862
|
exports.JsonPatchError = helpers_js_1.PatchError;
|
|
@@ -9187,9 +9187,9 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
9187
9187
|
}
|
|
9188
9188
|
});
|
|
9189
9189
|
|
|
9190
|
-
//
|
|
9190
|
+
// ../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/duplex.js
|
|
9191
9191
|
var require_duplex = __commonJS({
|
|
9192
|
-
"
|
|
9192
|
+
"../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/duplex.js"(exports) {
|
|
9193
9193
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9194
9194
|
var helpers_js_1 = require_helpers();
|
|
9195
9195
|
var core_js_1 = require_core();
|
|
@@ -9361,9 +9361,9 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
9361
9361
|
}
|
|
9362
9362
|
});
|
|
9363
9363
|
|
|
9364
|
-
//
|
|
9364
|
+
// ../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/index.js
|
|
9365
9365
|
var require_fast_json_patch = __commonJS({
|
|
9366
|
-
"
|
|
9366
|
+
"../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/index.js"(exports) {
|
|
9367
9367
|
var core = require_core();
|
|
9368
9368
|
Object.assign(exports, core);
|
|
9369
9369
|
var duplex = require_duplex();
|
|
@@ -9440,7 +9440,9 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
9440
9440
|
getTRACE: () => getTRACE,
|
|
9441
9441
|
getTRACES: () => getTRACES,
|
|
9442
9442
|
getUrlMapping: () => getUrlMapping,
|
|
9443
|
-
getUrlMappings: () => getUrlMappings
|
|
9443
|
+
getUrlMappings: () => getUrlMappings,
|
|
9444
|
+
isDataDist: () => isDataDist,
|
|
9445
|
+
isPathDist: () => isPathDist
|
|
9444
9446
|
});
|
|
9445
9447
|
|
|
9446
9448
|
// src/codes/HttpHeaders.ts
|
|
@@ -9504,6 +9506,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
9504
9506
|
// src/codes/HttpStatus.ts
|
|
9505
9507
|
var HttpStatus = /* @__PURE__ */ ((HttpStatus2) => {
|
|
9506
9508
|
HttpStatus2[HttpStatus2["Ok"] = 200] = "Ok";
|
|
9509
|
+
HttpStatus2[HttpStatus2["MultipleChoices"] = 300] = "MultipleChoices";
|
|
9507
9510
|
HttpStatus2[HttpStatus2["MovedPermanently"] = 301] = "MovedPermanently";
|
|
9508
9511
|
HttpStatus2[HttpStatus2["Found"] = 302] = "Found";
|
|
9509
9512
|
HttpStatus2[HttpStatus2["SeeOther"] = 303] = "SeeOther";
|
|
@@ -9608,6 +9611,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
9608
9611
|
// src/decorators/MethodMapping.ts
|
|
9609
9612
|
var UrlMappingSituationType = /* @__PURE__ */ ((UrlMappingSituationType2) => {
|
|
9610
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";
|
|
9611
9615
|
UrlMappingSituationType2["REQ_FORM_URL_BODY"] = "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_FORM_URL_BODY";
|
|
9612
9616
|
return UrlMappingSituationType2;
|
|
9613
9617
|
})(UrlMappingSituationType || {});
|
|
@@ -9887,6 +9891,14 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
9887
9891
|
const isConstructorLike = (fn) => {
|
|
9888
9892
|
return typeof fn === "function" && typeof fn.prototype !== "undefined";
|
|
9889
9893
|
};
|
|
9894
|
+
ValidUtils2.isUrl = (str) => {
|
|
9895
|
+
try {
|
|
9896
|
+
new URL(str);
|
|
9897
|
+
return true;
|
|
9898
|
+
} catch (_) {
|
|
9899
|
+
return false;
|
|
9900
|
+
}
|
|
9901
|
+
};
|
|
9890
9902
|
ValidUtils2.isFrozen = (obj) => {
|
|
9891
9903
|
return Object.isFrozen(obj);
|
|
9892
9904
|
};
|
|
@@ -10160,6 +10172,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10160
10172
|
constructor(_data) {
|
|
10161
10173
|
this._data = _data;
|
|
10162
10174
|
this.updateStats();
|
|
10175
|
+
this.etcData = _data.etcData;
|
|
10163
10176
|
}
|
|
10164
10177
|
get originalName() {
|
|
10165
10178
|
return this._data.originalName;
|
|
@@ -10209,10 +10222,11 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10209
10222
|
}
|
|
10210
10223
|
FileUtils2.File = File;
|
|
10211
10224
|
FileUtils2.writeFile = async (buffer, config) => {
|
|
10225
|
+
config ?? (config = {});
|
|
10212
10226
|
config.path ?? (config.path = `${node_os.tmpdir()}/${RandomUtils.uuid4()}_${Date.now()}`);
|
|
10213
10227
|
await node_fs.promises.mkdir(config.path.substring(0, config.path.lastIndexOf("/")), { recursive: true });
|
|
10214
10228
|
await node_fs.promises.writeFile(config.path, buffer);
|
|
10215
|
-
return new File({ path: config.path, originalName: config.originalName });
|
|
10229
|
+
return new File({ path: config.path, originalName: config.originalName, etcData: config.etcData });
|
|
10216
10230
|
};
|
|
10217
10231
|
FileUtils2.path = (path22) => {
|
|
10218
10232
|
return Array.isArray(path22) ? node_path.join(...path22) : path22;
|
|
@@ -10258,6 +10272,26 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10258
10272
|
const buffer = config?.option ? node_fs.readFileSync(p, config.option) : node_fs.readFileSync(p);
|
|
10259
10273
|
return buffer;
|
|
10260
10274
|
};
|
|
10275
|
+
FileUtils2.readAsync = async (path22, config) => {
|
|
10276
|
+
const p = FileUtils2.path(path22);
|
|
10277
|
+
return node_fs.promises.readFile(p, config?.option);
|
|
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
|
+
};
|
|
10287
|
+
FileUtils2.readStringSync = (path22) => {
|
|
10288
|
+
const p = FileUtils2.path(path22);
|
|
10289
|
+
return node_fs.readFileSync(p, "utf-8");
|
|
10290
|
+
};
|
|
10291
|
+
FileUtils2.readStringAsync = async (path22) => {
|
|
10292
|
+
const p = FileUtils2.path(path22);
|
|
10293
|
+
return node_fs.promises.readFile(p, "utf-8");
|
|
10294
|
+
};
|
|
10261
10295
|
FileUtils2.read = async (path22, config) => {
|
|
10262
10296
|
const p = FileUtils2.path(path22);
|
|
10263
10297
|
return node_fs.readFile(p, config.option);
|
|
@@ -10504,21 +10538,34 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10504
10538
|
};
|
|
10505
10539
|
|
|
10506
10540
|
// src/filters/ResourceFilter.ts
|
|
10507
|
-
var
|
|
10508
|
-
var
|
|
10541
|
+
var import_node_fs = __toESM(__require("node:fs"), 1);
|
|
10542
|
+
var import_node_path = __toESM(__require("node:path"), 1);
|
|
10509
10543
|
var import_mime_types = __toESM(require_mime_types(), 1);
|
|
10544
|
+
var import_node_buffer = __require("node:buffer");
|
|
10545
|
+
var isPathDist = (item) => {
|
|
10546
|
+
return typeof item === "object" && "request" in item && "dist" in item;
|
|
10547
|
+
};
|
|
10548
|
+
var isDataDist = (item) => {
|
|
10549
|
+
return typeof item === "object" && "request" in item && "response" in item;
|
|
10550
|
+
};
|
|
10510
10551
|
var ResourceFilter = class {
|
|
10511
|
-
constructor(
|
|
10512
|
-
|
|
10513
|
-
|
|
10552
|
+
constructor(resourceDistPathOrResourceRegex, resourceRegex) {
|
|
10553
|
+
if (typeof resourceDistPathOrResourceRegex === "string") {
|
|
10554
|
+
this.resourceDistPath = resourceDistPathOrResourceRegex;
|
|
10555
|
+
this.resources = resourceRegex;
|
|
10556
|
+
} else {
|
|
10557
|
+
this.resources = resourceDistPathOrResourceRegex;
|
|
10558
|
+
}
|
|
10514
10559
|
}
|
|
10560
|
+
// constructor(private resourceDistPath: string, private resourceRegex: (RequestFilterType | { request: RequestFilterType, dist: string | ((rr: RequestResponse, app: SimpleBootHttpServer) => (string|Promise<Blob |ArrayBuffer| Response>)) })[] = []) {
|
|
10561
|
+
// }
|
|
10515
10562
|
async onInit(app) {
|
|
10516
10563
|
}
|
|
10517
10564
|
async proceedBefore({ rr, app }) {
|
|
10518
10565
|
const url = (rr.reqUrlPathName ?? "").replace(/\.\./g, "");
|
|
10519
10566
|
const urlObj = rr.reqUrlObject;
|
|
10520
10567
|
let sw = true;
|
|
10521
|
-
const regExps = this.
|
|
10568
|
+
const regExps = this.resources?.filter((it) => {
|
|
10522
10569
|
if (it instanceof RegExp) {
|
|
10523
10570
|
return it.test(url);
|
|
10524
10571
|
}
|
|
@@ -10534,21 +10581,44 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10534
10581
|
}
|
|
10535
10582
|
return RegExp(it.request).test(url);
|
|
10536
10583
|
}
|
|
10537
|
-
});
|
|
10584
|
+
}) ?? [];
|
|
10538
10585
|
for (const it of regExps) {
|
|
10539
|
-
const resourcePath = import_path.default.join(this.resourceDistPath, typeof it === "object" && "dist" in it ? it.dist : urlObj.pathname);
|
|
10540
10586
|
sw = false;
|
|
10541
|
-
if (
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10587
|
+
if (isDataDist(it)) {
|
|
10588
|
+
let distValue = typeof it.response === "function" ? it.response(rr, app) : it.response;
|
|
10589
|
+
if (distValue instanceof Promise) {
|
|
10590
|
+
const result = await distValue;
|
|
10591
|
+
if (result instanceof Response) {
|
|
10592
|
+
await rr.resEnd(result);
|
|
10593
|
+
break;
|
|
10594
|
+
} else if (result instanceof import_node_buffer.Blob) {
|
|
10595
|
+
rr.resStatusCode(200 /* Ok */);
|
|
10596
|
+
await rr.resEnd(result);
|
|
10597
|
+
break;
|
|
10598
|
+
}
|
|
10599
|
+
}
|
|
10546
10600
|
} else {
|
|
10547
|
-
|
|
10548
|
-
|
|
10549
|
-
|
|
10601
|
+
const dist = typeof it === "object" && "dist" in it ? it.dist : urlObj.pathname;
|
|
10602
|
+
let distValue = typeof dist === "function" ? dist(rr, app) : dist;
|
|
10603
|
+
if (this.resourceDistPath) {
|
|
10604
|
+
const resourcePath = import_node_path.default.join(this.resourceDistPath, distValue);
|
|
10605
|
+
if (import_node_fs.default.existsSync(resourcePath)) {
|
|
10606
|
+
rr.resStatusCode(200 /* Ok */);
|
|
10607
|
+
rr.resSetHeader(HttpHeaders.ContentType, import_mime_types.default.lookup(resourcePath).toString());
|
|
10608
|
+
await rr.resEnd(import_node_fs.default.readFileSync(resourcePath));
|
|
10609
|
+
break;
|
|
10610
|
+
} else {
|
|
10611
|
+
rr.resStatusCode(404 /* NotFound */);
|
|
10612
|
+
await rr.resEnd();
|
|
10613
|
+
break;
|
|
10614
|
+
}
|
|
10615
|
+
} else {
|
|
10616
|
+
rr.resStatusCode(500 /* InternalServerError */);
|
|
10617
|
+
await rr.resEnd();
|
|
10618
|
+
break;
|
|
10619
|
+
}
|
|
10550
10620
|
}
|
|
10551
|
-
sw =
|
|
10621
|
+
sw = true;
|
|
10552
10622
|
}
|
|
10553
10623
|
return sw;
|
|
10554
10624
|
}
|
|
@@ -10583,117 +10653,6 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10583
10653
|
InjectSituationType2.TransactionManager = Symbol("TransactionManager");
|
|
10584
10654
|
})(InjectSituationType || (InjectSituationType = {}));
|
|
10585
10655
|
|
|
10586
|
-
// ../core/dist/esm/string/StringUtils.js
|
|
10587
|
-
var StringUtils;
|
|
10588
|
-
((StringUtils2) => {
|
|
10589
|
-
StringUtils2.deleteEnter = (data) => {
|
|
10590
|
-
return data.replace(/\r?\n/g, "");
|
|
10591
|
-
};
|
|
10592
|
-
StringUtils2.pickEmoji = (data) => {
|
|
10593
|
-
return data.match(/[\p{Emoji}]/gu) ?? [];
|
|
10594
|
-
};
|
|
10595
|
-
StringUtils2.regexExec = (regex, text) => {
|
|
10596
|
-
let varExec = regex.exec(text);
|
|
10597
|
-
const usingVars = [];
|
|
10598
|
-
while (varExec) {
|
|
10599
|
-
usingVars.push(varExec);
|
|
10600
|
-
varExec = regex.exec(varExec.input);
|
|
10601
|
-
}
|
|
10602
|
-
return usingVars;
|
|
10603
|
-
};
|
|
10604
|
-
StringUtils2.regexExecArrayReplace = (origin, regexpExecArrayOrRegex, replace) => {
|
|
10605
|
-
const regexpExecArrays = Array.isArray(regexpExecArrayOrRegex) ? regexpExecArrayOrRegex : StringUtils2.regexExec(regexpExecArrayOrRegex, origin);
|
|
10606
|
-
regexpExecArrays.reverse().forEach((it) => {
|
|
10607
|
-
const r = typeof replace === "string" ? replace : replace(it);
|
|
10608
|
-
origin = origin.substr(0, it.index) + origin.substr(it.index).replace(it[0], r);
|
|
10609
|
-
});
|
|
10610
|
-
return origin;
|
|
10611
|
-
};
|
|
10612
|
-
StringUtils2.escapeSpecialCharacterRegExp = (data) => {
|
|
10613
|
-
return data.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
10614
|
-
};
|
|
10615
|
-
StringUtils2.trim = (data) => data.trim();
|
|
10616
|
-
StringUtils2.rsubString = (data_s, blen_n) => data_s.substring(data_s.length - blen_n, data_s.length);
|
|
10617
|
-
StringUtils2.lsubString = (data_s, alen_n) => data_s.substring(0, alen_n);
|
|
10618
|
-
StringUtils2.lpad = (fill_s, len_n, full_s) => {
|
|
10619
|
-
while (len_n > full_s.length) {
|
|
10620
|
-
full_s = fill_s + full_s;
|
|
10621
|
-
}
|
|
10622
|
-
return StringUtils2.rsubString(full_s, len_n);
|
|
10623
|
-
};
|
|
10624
|
-
StringUtils2.rpad = (fill_s, len_n, full_s) => {
|
|
10625
|
-
while (len_n > full_s.length) {
|
|
10626
|
-
full_s += fill_s;
|
|
10627
|
-
}
|
|
10628
|
-
return StringUtils2.lsubString(full_s, len_n);
|
|
10629
|
-
};
|
|
10630
|
-
StringUtils2.lappend = (count_n, input_s) => {
|
|
10631
|
-
let s = "";
|
|
10632
|
-
let i = 0;
|
|
10633
|
-
while (i++ < count_n) {
|
|
10634
|
-
s += input_s;
|
|
10635
|
-
}
|
|
10636
|
-
return s;
|
|
10637
|
-
};
|
|
10638
|
-
StringUtils2.unescape = (html) => {
|
|
10639
|
-
if (!html) return "";
|
|
10640
|
-
const htmlEntity = {
|
|
10641
|
-
quot: '"',
|
|
10642
|
-
amp: "&",
|
|
10643
|
-
apos: "'",
|
|
10644
|
-
lt: "<",
|
|
10645
|
-
gt: ">",
|
|
10646
|
-
nbsp: "\xA0",
|
|
10647
|
-
iexcl: "\xA1",
|
|
10648
|
-
cent: "\xA2",
|
|
10649
|
-
pound: "\xA3",
|
|
10650
|
-
curren: "\xA4",
|
|
10651
|
-
yen: "\xA5",
|
|
10652
|
-
brvbar: "\xA6",
|
|
10653
|
-
sect: "\xA7",
|
|
10654
|
-
uml: "\xA8",
|
|
10655
|
-
copy: "\xA9",
|
|
10656
|
-
ordf: "\xAA",
|
|
10657
|
-
laquo: "\xAB",
|
|
10658
|
-
not: "\xAC",
|
|
10659
|
-
shy: "\xAD",
|
|
10660
|
-
reg: "\xAE",
|
|
10661
|
-
macr: "\xAF",
|
|
10662
|
-
deg: "\xB0",
|
|
10663
|
-
plusmn: "\xB1",
|
|
10664
|
-
sup2: "\xB2",
|
|
10665
|
-
sup3: "\xB3",
|
|
10666
|
-
acute: "\xB4",
|
|
10667
|
-
micro: "\xB5",
|
|
10668
|
-
para: "\xB6",
|
|
10669
|
-
middot: "\xB7",
|
|
10670
|
-
cedil: "\xB8",
|
|
10671
|
-
sup1: "\xB9",
|
|
10672
|
-
ordm: "\xBA",
|
|
10673
|
-
raquo: "\xBB",
|
|
10674
|
-
frac14: "\xBC",
|
|
10675
|
-
frac12: "\xBD",
|
|
10676
|
-
frac34: "\xBE",
|
|
10677
|
-
iquest: "\xBF",
|
|
10678
|
-
"#x27": "'"
|
|
10679
|
-
};
|
|
10680
|
-
return html.replace(/&((?:(?:[a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});?)+);/gi, (match, entity) => {
|
|
10681
|
-
const entities = entity.toLowerCase().split(";");
|
|
10682
|
-
return entities.map((it) => it in htmlEntity ? htmlEntity[it] : match).join("");
|
|
10683
|
-
});
|
|
10684
|
-
};
|
|
10685
|
-
StringUtils2.executeExpression = (formatString, object) => {
|
|
10686
|
-
return formatString.replace(/\${([^{}]*)}/g, (matched, piece) => String(object[piece] ?? matched));
|
|
10687
|
-
};
|
|
10688
|
-
StringUtils2.ellipsis = (text, length) => {
|
|
10689
|
-
if (text.length > length) return `${text.slice(0, length)}...`;
|
|
10690
|
-
return text;
|
|
10691
|
-
};
|
|
10692
|
-
StringUtils2.appendPostposition = (text, { vowel, consonant }) => {
|
|
10693
|
-
return `${text}${ValidUtils.lastConsonantLetter(text) ? consonant : vowel}`;
|
|
10694
|
-
};
|
|
10695
|
-
})(StringUtils || (StringUtils = {}));
|
|
10696
|
-
|
|
10697
10656
|
// ../core/dist/esm/expression/Expression.js
|
|
10698
10657
|
var Expression;
|
|
10699
10658
|
((Expression2) => {
|
|
@@ -10708,17 +10667,6 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10708
10667
|
return binder;
|
|
10709
10668
|
});
|
|
10710
10669
|
};
|
|
10711
|
-
let Group;
|
|
10712
|
-
((Group2) => {
|
|
10713
|
-
Group2.isExpression = (data) => {
|
|
10714
|
-
const reg = /[$#]\{([\s\S.]*?)\}[$#]/g;
|
|
10715
|
-
return reg.test(data ?? "");
|
|
10716
|
-
};
|
|
10717
|
-
Group2.expressionGroups = (data) => {
|
|
10718
|
-
const reg = /[$#]\{([\s\S.]*?)\}[$#]/g;
|
|
10719
|
-
return StringUtils.regexExec(reg, data ?? "");
|
|
10720
|
-
};
|
|
10721
|
-
})(Group = Expression2.Group || (Expression2.Group = {}));
|
|
10722
10670
|
let Path;
|
|
10723
10671
|
((Path2) => {
|
|
10724
10672
|
Path2.pathNameData = (pathName, urlExpression) => {
|
|
@@ -10805,19 +10753,64 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10805
10753
|
const paths = this.fullPath.split("?");
|
|
10806
10754
|
return paths[1] ?? "";
|
|
10807
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
|
+
}
|
|
10808
10788
|
get queryParams() {
|
|
10809
10789
|
const param = {};
|
|
10810
10790
|
this.query.split("&")?.forEach((it) => {
|
|
10811
10791
|
const a = it.split("=");
|
|
10812
|
-
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
|
+
}
|
|
10813
10801
|
});
|
|
10814
10802
|
return param;
|
|
10815
10803
|
}
|
|
10816
|
-
get
|
|
10804
|
+
get queryParamsDecodeURI() {
|
|
10817
10805
|
const params = this.queryParams;
|
|
10818
10806
|
for (const key in params) {
|
|
10819
10807
|
if (params.hasOwnProperty(key)) {
|
|
10820
|
-
|
|
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
|
+
}
|
|
10821
10814
|
}
|
|
10822
10815
|
}
|
|
10823
10816
|
return params;
|
|
@@ -10848,6 +10841,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10848
10841
|
|
|
10849
10842
|
// src/models/RequestResponse.ts
|
|
10850
10843
|
var import_node_gzip = __toESM(require_dist(), 1);
|
|
10844
|
+
var import_node_buffer2 = __require("node:buffer");
|
|
10851
10845
|
|
|
10852
10846
|
// ../core/dist/esm/entity/Point2D.js
|
|
10853
10847
|
var Point2D = class _Point2D {
|
|
@@ -12112,57 +12106,70 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
12112
12106
|
if (Path2.isFunctionScript(path3) || Path2.isArrowFunctionScript(path3)) {
|
|
12113
12107
|
return path3;
|
|
12114
12108
|
}
|
|
12115
|
-
|
|
12116
|
-
|
|
12117
|
-
|
|
12118
|
-
|
|
12119
|
-
|
|
12120
|
-
|
|
12121
|
-
|
|
12122
|
-
|
|
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;
|
|
12123
12130
|
}
|
|
12124
|
-
|
|
12125
|
-
});
|
|
12126
|
-
return result.join("");
|
|
12131
|
+
}
|
|
12127
12132
|
}
|
|
12128
|
-
if (
|
|
12133
|
+
if (tempPath.includes("(")) {
|
|
12129
12134
|
const functionCallMatches = [];
|
|
12130
|
-
let
|
|
12135
|
+
let workingPath = tempPath;
|
|
12131
12136
|
let counter = 0;
|
|
12132
12137
|
const functionCallRegex = /(\w+)\(([^()]*(?:\([^()]*\)[^()]*)*)\)/g;
|
|
12133
12138
|
let match;
|
|
12134
|
-
while ((match = functionCallRegex.exec(
|
|
12139
|
+
while ((match = functionCallRegex.exec(tempPath)) !== null) {
|
|
12135
12140
|
const fullMatch = match[0];
|
|
12136
12141
|
const funcName = match[1];
|
|
12137
12142
|
const funcArgs = match[2];
|
|
12138
12143
|
const placeholder = `__FUNC_CALL_${counter}__`;
|
|
12139
|
-
|
|
12144
|
+
let processedArgs = funcArgs ? Path2.toOptionalChainPath(funcArgs) : "";
|
|
12145
|
+
processedArgs = processedArgs.replace(/\?\.\s*$/, "");
|
|
12140
12146
|
const processedFuncCall = `${funcName}?.(${processedArgs})`;
|
|
12141
12147
|
functionCallMatches.push({
|
|
12142
12148
|
original: fullMatch,
|
|
12143
12149
|
processed: processedFuncCall,
|
|
12144
12150
|
placeholder
|
|
12145
12151
|
});
|
|
12146
|
-
|
|
12152
|
+
workingPath = workingPath.replace(fullMatch, placeholder);
|
|
12147
12153
|
counter++;
|
|
12148
12154
|
}
|
|
12149
|
-
const tokens2 =
|
|
12155
|
+
const tokens2 = workingPath.match(/[^?.[\]]+|\[[^\]]*\]/g);
|
|
12150
12156
|
let processedPath = "";
|
|
12151
12157
|
if (tokens2 && tokens2.length > 1) {
|
|
12152
12158
|
processedPath = tokens2.join("?.");
|
|
12153
12159
|
} else {
|
|
12154
|
-
processedPath =
|
|
12160
|
+
processedPath = workingPath;
|
|
12155
12161
|
}
|
|
12156
12162
|
for (const funcMatch of functionCallMatches) {
|
|
12157
12163
|
processedPath = processedPath.replace(funcMatch.placeholder, funcMatch.processed);
|
|
12158
12164
|
}
|
|
12159
|
-
return processedPath;
|
|
12165
|
+
return hasNullishCoalescing ? processedPath.replace(new RegExp(nullishCoalescingPlaceholder, "g"), "??") : processedPath;
|
|
12160
12166
|
}
|
|
12161
|
-
const tokens =
|
|
12167
|
+
const tokens = tempPath.match(/[^?.[\]]+|\[[^\]]*\]/g);
|
|
12162
12168
|
if (!tokens) {
|
|
12163
|
-
return path3;
|
|
12169
|
+
return hasNullishCoalescing ? path3 : path3;
|
|
12164
12170
|
}
|
|
12165
|
-
|
|
12171
|
+
const result = tokens.join("?.");
|
|
12172
|
+
return hasNullishCoalescing ? result.replace(new RegExp(nullishCoalescingPlaceholder, "g"), "??") : result;
|
|
12166
12173
|
};
|
|
12167
12174
|
Path2.removeOptionalChainOperator = (path3) => {
|
|
12168
12175
|
if (!path3) {
|
|
@@ -12403,7 +12410,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
12403
12410
|
const func = new Function("window", "document", "console", `"use strict"; ${script}; `);
|
|
12404
12411
|
func.call(destUser, globalContext.window, globalContext.document, globalContext.console);
|
|
12405
12412
|
} catch (e) {
|
|
12406
|
-
console.error("detectPathFromScript error:", e);
|
|
12413
|
+
console.error("detectPathFromScript error:", script, e);
|
|
12407
12414
|
}
|
|
12408
12415
|
if (options?.excludeThis) {
|
|
12409
12416
|
const filteredVars = /* @__PURE__ */ new Set();
|
|
@@ -12475,9 +12482,19 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
12475
12482
|
ConvertUtils22.jsonToMap = (jsonStr) => {
|
|
12476
12483
|
return new Map(JSON.parse(jsonStr));
|
|
12477
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
|
+
};
|
|
12478
12492
|
ConvertUtils22.decodeURIString = (data) => {
|
|
12479
12493
|
return decodeURIComponent(data);
|
|
12480
12494
|
};
|
|
12495
|
+
ConvertUtils22.encodeURIString = (data) => {
|
|
12496
|
+
return encodeURIComponent(data);
|
|
12497
|
+
};
|
|
12481
12498
|
ConvertUtils22.objToStrMap = (obj) => {
|
|
12482
12499
|
const strMap = /* @__PURE__ */ new Map();
|
|
12483
12500
|
for (const k of Object.keys(obj)) {
|
|
@@ -12615,6 +12632,74 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
12615
12632
|
ConvertUtils22.decodeHTMLEscape = (data) => {
|
|
12616
12633
|
return data.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(///g, "/");
|
|
12617
12634
|
};
|
|
12635
|
+
function escapeHTML(htmlString, option) {
|
|
12636
|
+
if (!htmlString) return "";
|
|
12637
|
+
const escapeMap = {
|
|
12638
|
+
"&": "&",
|
|
12639
|
+
// 반드시 먼저 처리
|
|
12640
|
+
"<": "<",
|
|
12641
|
+
">": ">",
|
|
12642
|
+
'"': """,
|
|
12643
|
+
"'": "'",
|
|
12644
|
+
// or ' (하지만 HTML4에서는 ' 권장)
|
|
12645
|
+
"/": "/",
|
|
12646
|
+
"`": "`",
|
|
12647
|
+
"=": "=",
|
|
12648
|
+
"{": "{",
|
|
12649
|
+
"}": "}",
|
|
12650
|
+
"#": "#",
|
|
12651
|
+
"$": "$",
|
|
12652
|
+
"\n": " ",
|
|
12653
|
+
// newline
|
|
12654
|
+
"\r": " ",
|
|
12655
|
+
// carriage return
|
|
12656
|
+
" ": "	",
|
|
12657
|
+
// tab
|
|
12658
|
+
"\xA0": " ",
|
|
12659
|
+
// non-breaking space
|
|
12660
|
+
"\xA2": "¢",
|
|
12661
|
+
"\xA3": "£",
|
|
12662
|
+
"\xA5": "¥",
|
|
12663
|
+
"\u20AC": "€",
|
|
12664
|
+
"\xA9": "©",
|
|
12665
|
+
"\xAE": "®",
|
|
12666
|
+
"\u2122": "™",
|
|
12667
|
+
"\xB0": "°",
|
|
12668
|
+
"\xB1": "±",
|
|
12669
|
+
"\xD7": "×",
|
|
12670
|
+
"\xF7": "÷",
|
|
12671
|
+
"\u2212": "−",
|
|
12672
|
+
"\u2022": "•",
|
|
12673
|
+
"\u2026": "…",
|
|
12674
|
+
"\u2190": "←",
|
|
12675
|
+
"\u2192": "→",
|
|
12676
|
+
"\u2191": "↑",
|
|
12677
|
+
"\u2193": "↓",
|
|
12678
|
+
"\u2194": "↔"
|
|
12679
|
+
};
|
|
12680
|
+
const targetsSet = option?.targets ? new Set(option.targets) : null;
|
|
12681
|
+
const filteredEscapeMap = targetsSet ? Object.fromEntries(Object.entries(escapeMap).filter(([key]) => targetsSet.has(key))) : escapeMap;
|
|
12682
|
+
const shouldEscapeAmpersand = !targetsSet || targetsSet.has("&");
|
|
12683
|
+
const charsToEscape = Object.keys(filteredEscapeMap).filter((char) => char !== "&");
|
|
12684
|
+
if (charsToEscape.length === 0 && !shouldEscapeAmpersand) {
|
|
12685
|
+
return htmlString;
|
|
12686
|
+
}
|
|
12687
|
+
const escapedChars = charsToEscape.map((char) => {
|
|
12688
|
+
return char.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
12689
|
+
}).join("");
|
|
12690
|
+
let result = htmlString;
|
|
12691
|
+
if (shouldEscapeAmpersand) {
|
|
12692
|
+
result = result.replace(/&/g, "&");
|
|
12693
|
+
}
|
|
12694
|
+
if (escapedChars.length > 0) {
|
|
12695
|
+
const regex = new RegExp(`[${escapedChars}]`, "g");
|
|
12696
|
+
result = result.replace(regex, (match) => {
|
|
12697
|
+
return filteredEscapeMap[match] || match;
|
|
12698
|
+
});
|
|
12699
|
+
}
|
|
12700
|
+
return result;
|
|
12701
|
+
}
|
|
12702
|
+
ConvertUtils22.escapeHTML = escapeHTML;
|
|
12618
12703
|
ConvertUtils22.copyObject = (obj, update = {}) => {
|
|
12619
12704
|
return { ...obj, ...update };
|
|
12620
12705
|
};
|
|
@@ -12777,6 +12862,29 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
12777
12862
|
ConvertUtils22.stringJsonToKeyPairs = (stringJson) => {
|
|
12778
12863
|
return Array.from(stringJson.matchAll(/(\w+):\s*([^,}]+)/g)).map((match) => ({ key: match[1], value: match[2] }));
|
|
12779
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
|
+
};
|
|
12780
12888
|
})(ConvertUtils2 || (ConvertUtils2 = {}));
|
|
12781
12889
|
|
|
12782
12890
|
// src/models/RequestResponse.ts
|
|
@@ -12897,7 +13005,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
12897
13005
|
const formData = {};
|
|
12898
13006
|
for (const it of m) {
|
|
12899
13007
|
if (it.isFile) {
|
|
12900
|
-
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 });
|
|
12901
13009
|
} else {
|
|
12902
13010
|
const target = formData[it.name];
|
|
12903
13011
|
if (Array.isArray(target)) {
|
|
@@ -13175,7 +13283,28 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
13175
13283
|
this.res.end(data);
|
|
13176
13284
|
}
|
|
13177
13285
|
async resEnd(chunk) {
|
|
13178
|
-
|
|
13286
|
+
if (chunk instanceof Response) {
|
|
13287
|
+
chunk.headers.forEach((value, key) => {
|
|
13288
|
+
this.res.setHeader(`ORIGIN-${key}`, value);
|
|
13289
|
+
});
|
|
13290
|
+
if (!this.resHeader(HttpHeaders.ContentType)) {
|
|
13291
|
+
const contentType = chunk.headers.get(HttpHeaders.ContentType);
|
|
13292
|
+
if (contentType) {
|
|
13293
|
+
this.res.setHeader(HttpHeaders.ContentType, contentType);
|
|
13294
|
+
}
|
|
13295
|
+
}
|
|
13296
|
+
this.res.statusCode = chunk.status;
|
|
13297
|
+
this.resWriteChunk = import_buffer.Buffer.from(await chunk.arrayBuffer());
|
|
13298
|
+
} else if (chunk instanceof import_node_buffer2.Blob) {
|
|
13299
|
+
this.resWriteChunk = import_buffer.Buffer.from(await chunk.arrayBuffer());
|
|
13300
|
+
if (!this.resHeader(HttpHeaders.ContentType)) {
|
|
13301
|
+
this.res.setHeader(HttpHeaders.ContentType, chunk.type);
|
|
13302
|
+
}
|
|
13303
|
+
} else if (chunk instanceof ArrayBuffer) {
|
|
13304
|
+
this.resWriteChunk = import_buffer.Buffer.from(chunk);
|
|
13305
|
+
} else {
|
|
13306
|
+
this.resWriteChunk = chunk ?? this.resWriteChunk;
|
|
13307
|
+
}
|
|
13179
13308
|
if (this.req.readable) {
|
|
13180
13309
|
await this.reqBodyData();
|
|
13181
13310
|
await this.resEndChunk();
|
|
@@ -13192,6 +13321,11 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
13192
13321
|
// // this.res.write(chunk);
|
|
13193
13322
|
// return this.createRequestResponseChain();
|
|
13194
13323
|
// }
|
|
13324
|
+
resRedirect(statusCode, location) {
|
|
13325
|
+
this.res.statusCode = statusCode;
|
|
13326
|
+
this.res.setHeader(HttpHeaders.Location, location);
|
|
13327
|
+
this.res.end();
|
|
13328
|
+
}
|
|
13195
13329
|
resWriteHead(statusCode, headers) {
|
|
13196
13330
|
return this.createRequestResponseChain(this.res.writeHead(statusCode, headers));
|
|
13197
13331
|
}
|
|
@@ -13238,8 +13372,8 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
13238
13372
|
};
|
|
13239
13373
|
|
|
13240
13374
|
// src/models/datas/Resource.ts
|
|
13241
|
-
var
|
|
13242
|
-
var
|
|
13375
|
+
var import_fs = __toESM(__require("fs"), 1);
|
|
13376
|
+
var import_path = __toESM(__require("path"), 1);
|
|
13243
13377
|
var import_mime_types2 = __toESM(require_mime_types(), 1);
|
|
13244
13378
|
var Resource = class {
|
|
13245
13379
|
constructor(path3, rootPath = process.cwd()) {
|
|
@@ -13248,11 +13382,11 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
13248
13382
|
}
|
|
13249
13383
|
get absolutePath() {
|
|
13250
13384
|
if (this.path instanceof RequestResponse) {
|
|
13251
|
-
return
|
|
13385
|
+
return import_path.default.join(this.rootPath, this.path.reqUrlObj().pathname);
|
|
13252
13386
|
} else if (this.path instanceof URL) {
|
|
13253
|
-
return
|
|
13387
|
+
return import_path.default.join(this.rootPath, this.path.pathname);
|
|
13254
13388
|
} else {
|
|
13255
|
-
return
|
|
13389
|
+
return import_path.default.join(this.rootPath, this.path);
|
|
13256
13390
|
}
|
|
13257
13391
|
}
|
|
13258
13392
|
get conTentType() {
|
|
@@ -13260,7 +13394,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
13260
13394
|
}
|
|
13261
13395
|
get data() {
|
|
13262
13396
|
const promise = new Promise((resolve, reject) => {
|
|
13263
|
-
|
|
13397
|
+
import_fs.default.readFile("", (error, fileBuffer) => {
|
|
13264
13398
|
if (error) {
|
|
13265
13399
|
reject(error);
|
|
13266
13400
|
}
|
|
@@ -13273,7 +13407,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
13273
13407
|
async write(rr) {
|
|
13274
13408
|
rr.resStatusCode(200 /* Ok */);
|
|
13275
13409
|
rr.resSetHeader(HttpHeaders.ContentType, this.conTentType);
|
|
13276
|
-
await rr.resEnd(
|
|
13410
|
+
await rr.resEnd(import_fs.default.readFileSync(this.absolutePath));
|
|
13277
13411
|
}
|
|
13278
13412
|
};
|
|
13279
13413
|
|
|
@@ -14198,7 +14332,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
14198
14332
|
}
|
|
14199
14333
|
};
|
|
14200
14334
|
|
|
14201
|
-
// ../core/dist/esm/message/Subscriber
|
|
14335
|
+
// ../core/dist/esm/message/Subscriber.js
|
|
14202
14336
|
var Subscriber = class {
|
|
14203
14337
|
constructor(destination) {
|
|
14204
14338
|
this.destination = destination;
|
|
@@ -14483,17 +14617,37 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
14483
14617
|
return this.routerChains[0];
|
|
14484
14618
|
}
|
|
14485
14619
|
get firstRouteChainValue() {
|
|
14486
|
-
return this.firstRouteChain
|
|
14620
|
+
return this.firstRouteChain?.getValue();
|
|
14487
14621
|
}
|
|
14488
14622
|
get lastRouteChain() {
|
|
14489
14623
|
return this.routerChains[this.routerChains.length - 1];
|
|
14490
14624
|
}
|
|
14491
14625
|
get lastRouteChainValue() {
|
|
14492
|
-
return this.lastRouteChain
|
|
14626
|
+
return this.lastRouteChain?.getValue();
|
|
14493
14627
|
}
|
|
14494
14628
|
hasActivateInLastRoute(obj) {
|
|
14495
14629
|
return this.lastRouteChainValue?.hasActivate(obj) === true;
|
|
14496
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
|
+
}
|
|
14497
14651
|
get queryParams() {
|
|
14498
14652
|
if (this.intent) {
|
|
14499
14653
|
return this.intent.queryParams;
|
|
@@ -14501,7 +14655,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
14501
14655
|
}
|
|
14502
14656
|
get queryParamsAfterDecodeURI() {
|
|
14503
14657
|
if (this.intent) {
|
|
14504
|
-
return this.intent.
|
|
14658
|
+
return this.intent.queryParamsDecodeURI;
|
|
14505
14659
|
}
|
|
14506
14660
|
}
|
|
14507
14661
|
};
|
|
@@ -14866,6 +15020,53 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
14866
15020
|
__metadata("design:paramtypes", [typeof (_a = typeof SimstanceManager !== "undefined" && SimstanceManager) === "function" ? _a : Object, typeof (_b = typeof SimOption !== "undefined" && SimOption) === "function" ? _b : Object])
|
|
14867
15021
|
], RouterManager);
|
|
14868
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
|
+
|
|
14869
15070
|
// ../simple-boot/dist/esm/intent/IntentManager.js
|
|
14870
15071
|
var __decorate3 = function(decorators, target, key, desc) {
|
|
14871
15072
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -14907,7 +15108,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
14907
15108
|
} else if (typeof it === "string") {
|
|
14908
15109
|
it = new Intent(it, data);
|
|
14909
15110
|
}
|
|
14910
|
-
|
|
15111
|
+
const intent = it;
|
|
14911
15112
|
const r = [];
|
|
14912
15113
|
if (!routerMatch) {
|
|
14913
15114
|
if (intent.symbols) {
|
|
@@ -14926,7 +15127,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
14926
15127
|
}
|
|
14927
15128
|
});
|
|
14928
15129
|
this.subject.next(it);
|
|
14929
|
-
|
|
15130
|
+
for (let data2 of targetInstances) {
|
|
14930
15131
|
let orNewSim = data2;
|
|
14931
15132
|
if (orNewSim) {
|
|
14932
15133
|
if (intent.paths.length > 0) {
|
|
@@ -14938,6 +15139,18 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
14938
15139
|
lastProp = i;
|
|
14939
15140
|
});
|
|
14940
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
|
+
}
|
|
14941
15154
|
if (PublishType.DATA_PARAMETERS === intent.publishType) {
|
|
14942
15155
|
r.push(orNewSim.call(callthis, intent.data));
|
|
14943
15156
|
} else if (PublishType.INLINE_DATA_PARAMETERS === intent.publishType) {
|
|
@@ -14951,15 +15164,22 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
14951
15164
|
}
|
|
14952
15165
|
} else {
|
|
14953
15166
|
if (PublishType.DATA_PARAMETERS === intent.publishType) {
|
|
14954
|
-
|
|
15167
|
+
if (isIntentSubscribe(orNewSim)) {
|
|
15168
|
+
r.push(orNewSim.intentSubscribe(intent.data));
|
|
15169
|
+
}
|
|
14955
15170
|
} else if (PublishType.INLINE_DATA_PARAMETERS === intent.publishType) {
|
|
14956
|
-
|
|
15171
|
+
if (isIntentSubscribe(orNewSim)) {
|
|
15172
|
+
r.push(orNewSim.intentSubscribe(...intent.data));
|
|
15173
|
+
}
|
|
14957
15174
|
} else {
|
|
14958
|
-
|
|
15175
|
+
if (isIntentSubscribe(orNewSim)) {
|
|
15176
|
+
r.push(orNewSim?.intentSubscribe?.(intent));
|
|
15177
|
+
}
|
|
14959
15178
|
}
|
|
14960
15179
|
}
|
|
14961
15180
|
}
|
|
14962
|
-
}
|
|
15181
|
+
}
|
|
15182
|
+
;
|
|
14963
15183
|
return r;
|
|
14964
15184
|
}
|
|
14965
15185
|
};
|
|
@@ -15061,42 +15281,6 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
15061
15281
|
var import_http = __require("http");
|
|
15062
15282
|
var import_https = __require("https");
|
|
15063
15283
|
|
|
15064
|
-
// ../simple-boot/dist/esm/decorators/validate/Validation.js
|
|
15065
|
-
var ValidMetadataKey = Symbol("ValidMetadataKey");
|
|
15066
|
-
var getValidIndex = (target, propertyKey) => {
|
|
15067
|
-
if (target !== null && void 0 !== target && typeof target === "object") {
|
|
15068
|
-
target = target.constructor;
|
|
15069
|
-
}
|
|
15070
|
-
if (propertyKey) {
|
|
15071
|
-
const parameters = Reflect.getOwnMetadata(ValidMetadataKey, target, propertyKey);
|
|
15072
|
-
return parameters ?? [];
|
|
15073
|
-
} else {
|
|
15074
|
-
return ReflectUtils.getMetadata(ValidMetadataKey, target) ?? [];
|
|
15075
|
-
}
|
|
15076
|
-
};
|
|
15077
|
-
var ValidationMetadataKey = Symbol("ValidationMetadataKey");
|
|
15078
|
-
var getValidators = (target) => {
|
|
15079
|
-
if (target !== null && void 0 !== target && typeof target === "object") {
|
|
15080
|
-
target = target.constructor;
|
|
15081
|
-
}
|
|
15082
|
-
return ReflectUtils.getMetadata(ValidationMetadataKey, target) ?? [];
|
|
15083
|
-
};
|
|
15084
|
-
var execValidationInValid = (obj) => {
|
|
15085
|
-
return execValidation(obj).filter((it) => !it.valid);
|
|
15086
|
-
};
|
|
15087
|
-
var execValidation = (obj) => {
|
|
15088
|
-
const validators = getValidators(obj);
|
|
15089
|
-
const reesults = [];
|
|
15090
|
-
validators.forEach((it) => {
|
|
15091
|
-
reesults.push({
|
|
15092
|
-
name: it.propertyKey,
|
|
15093
|
-
valid: it.validator(it.propertyKey, it),
|
|
15094
|
-
message: ""
|
|
15095
|
-
});
|
|
15096
|
-
});
|
|
15097
|
-
return reesults;
|
|
15098
|
-
};
|
|
15099
|
-
|
|
15100
15284
|
// ../simple-boot/dist/esm/errors/ValidException.js
|
|
15101
15285
|
var ValidException = class {
|
|
15102
15286
|
constructor(result) {
|
|
@@ -15112,6 +15296,12 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
15112
15296
|
|
|
15113
15297
|
// src/SimpleBootHttpServer.ts
|
|
15114
15298
|
var import_url2 = __require("url");
|
|
15299
|
+
|
|
15300
|
+
// src/models/datas/search/ReqSearchParamsObj.ts
|
|
15301
|
+
var ReqSearchParamsObj = class {
|
|
15302
|
+
};
|
|
15303
|
+
|
|
15304
|
+
// src/SimpleBootHttpServer.ts
|
|
15115
15305
|
var SimpleBootHttpServer = class extends SimpleApplication {
|
|
15116
15306
|
constructor(option = new HttpServerOption()) {
|
|
15117
15307
|
super(option);
|
|
@@ -15246,6 +15436,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
15246
15436
|
const validIndexs = getValidIndex(moduleInstance, it.propertyKey);
|
|
15247
15437
|
if (injects) {
|
|
15248
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 */);
|
|
15249
15440
|
const isFormUrl = injects.find((it2) => it2.config?.situationType === "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_FORM_URL_BODY" /* REQ_FORM_URL_BODY */);
|
|
15250
15441
|
const isTransactionManager = injects.find((it2) => it2.config?.situationType === InjectSituationType.TransactionManager);
|
|
15251
15442
|
const siturationContainers = new SituationTypeContainers();
|
|
@@ -15265,6 +15456,19 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
15265
15456
|
data: data2
|
|
15266
15457
|
}));
|
|
15267
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
|
+
}
|
|
15268
15472
|
if (isFormUrl) {
|
|
15269
15473
|
let data2 = await rr.reqBodyFormUrlData();
|
|
15270
15474
|
if (isFormUrl.type) {
|
|
@@ -15294,6 +15498,8 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
15294
15498
|
otherStorage.set(ReqFormUrlBody, await rr.reqBodyReqFormUrlBody());
|
|
15295
15499
|
} else if (paramType === ReqJsonBody) {
|
|
15296
15500
|
otherStorage.set(ReqJsonBody, await rr.reqBodyReqJsonBody());
|
|
15501
|
+
} else if (paramType === ReqSearchParamsObj) {
|
|
15502
|
+
otherStorage.set(ReqSearchParamsObj, rr.reqUrlSearchParamsObj);
|
|
15297
15503
|
} else if (paramType === import_url2.URLSearchParams) {
|
|
15298
15504
|
otherStorage.set(import_url2.URLSearchParams, rr.reqUrlSearchParams);
|
|
15299
15505
|
} else if (paramType === ReqMultipartFormBody) {
|