@dooboostore/simple-boot-http-server 1.0.21 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/filters/ResourceFilter.js +59 -19
- package/dist/cjs/filters/ResourceFilter.js.map +2 -2
- package/dist/cjs/models/RequestResponse.js +23 -1
- package/dist/cjs/models/RequestResponse.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 +23 -1
- package/dist/esm/models/RequestResponse.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js +176 -158
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js.map +4 -4
- 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 +2 -1
- package/dist/types/models/RequestResponse.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js +183 -165
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js.map +4 -4
- package/package.json +14 -14
- package/src/filters/ResourceFilter.ts +67 -20
- package/src/models/RequestResponse.ts +26 -2
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import { Filter } from '../filters/Filter';
|
|
2
2
|
import { SimpleBootHttpServer } from '../SimpleBootHttpServer';
|
|
3
3
|
import { RequestResponse } from '../models/RequestResponse';
|
|
4
|
+
import { Blob } from 'node:buffer';
|
|
4
5
|
export type RequestFilterType = string | RegExp | ((rr: RequestResponse, app: SimpleBootHttpServer) => boolean) | ((rr: RequestResponse, app: SimpleBootHttpServer) => Promise<boolean>);
|
|
6
|
+
type PathDist = RequestFilterType | {
|
|
7
|
+
request: RequestFilterType;
|
|
8
|
+
dist: string | ((rr: RequestResponse, app: SimpleBootHttpServer) => string);
|
|
9
|
+
};
|
|
10
|
+
type DataDist = {
|
|
11
|
+
request: RequestFilterType;
|
|
12
|
+
response: (rr: RequestResponse, app: SimpleBootHttpServer) => (string | Promise<Blob | ArrayBuffer | Response>);
|
|
13
|
+
};
|
|
14
|
+
export declare const isPathDist: (item: any) => item is PathDist;
|
|
15
|
+
export declare const isDataDist: (item: any) => item is DataDist;
|
|
5
16
|
export declare class ResourceFilter implements Filter {
|
|
6
|
-
private resourceDistPath
|
|
7
|
-
private
|
|
8
|
-
constructor(resourceDistPath: string, resourceRegex
|
|
9
|
-
|
|
10
|
-
dist: string;
|
|
11
|
-
})[]);
|
|
17
|
+
private resourceDistPath?;
|
|
18
|
+
private resources?;
|
|
19
|
+
constructor(resourceDistPath: string, resourceRegex: PathDist[]);
|
|
20
|
+
constructor(resourceRegex: DataDist[]);
|
|
12
21
|
onInit(app: SimpleBootHttpServer): Promise<void>;
|
|
13
22
|
proceedBefore({ rr, app }: {
|
|
14
23
|
rr: RequestResponse;
|
|
@@ -21,4 +30,5 @@ export declare class ResourceFilter implements Filter {
|
|
|
21
30
|
carrier: Map<string, any>;
|
|
22
31
|
}): Promise<boolean>;
|
|
23
32
|
}
|
|
33
|
+
export {};
|
|
24
34
|
//# sourceMappingURL=ResourceFilter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceFilter.d.ts","sourceRoot":"","sources":["../../../src/filters/ResourceFilter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAM3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"ResourceFilter.d.ts","sourceRoot":"","sources":["../../../src/filters/ResourceFilter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAM3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBA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AAe,CAAC;QAAC,GAAG,EAAE,oBAAoB,CAAC;QAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAC;IAwEpG,YAAY,CAAC,EAAC,EAAE,EAAE,GAAG,EAAC,EAAE;QAAC,EAAE,EAAE,eAAe,CAAC;QAAC,GAAG,EAAE,oBAAoB,CAAC;QAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAC;CAI5G"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,41 +1,3 @@
|
|
|
1
|
-
/// <reference path="codes/HttpHeaders.d.ts" />
|
|
2
|
-
/// <reference path="codes/HttpMethod.d.ts" />
|
|
3
|
-
/// <reference path="codes/HttpStatus.d.ts" />
|
|
4
|
-
/// <reference path="codes/Mimes.d.ts" />
|
|
5
|
-
/// <reference path="codes/index.d.ts" />
|
|
6
|
-
/// <reference path="decorators/MethodMapping.d.ts" />
|
|
7
|
-
/// <reference path="decorators/index.d.ts" />
|
|
8
|
-
/// <reference path="endpoints/CrossDomainHeaderEndPoint.d.ts" />
|
|
9
|
-
/// <reference path="endpoints/EndPoint.d.ts" />
|
|
10
|
-
/// <reference path="endpoints/HeaderEndPoint.d.ts" />
|
|
11
|
-
/// <reference path="endpoints/index.d.ts" />
|
|
12
|
-
/// <reference path="errors/BadRequestError.d.ts" />
|
|
13
|
-
/// <reference path="errors/ForbiddenError.d.ts" />
|
|
14
|
-
/// <reference path="errors/HttpError.d.ts" />
|
|
15
|
-
/// <reference path="errors/InternalServerError.d.ts" />
|
|
16
|
-
/// <reference path="errors/NotFoundError.d.ts" />
|
|
17
|
-
/// <reference path="errors/UnauthorizedError.d.ts" />
|
|
18
|
-
/// <reference path="errors/index.d.ts" />
|
|
19
|
-
/// <reference path="filters/CacheFilter.d.ts" />
|
|
20
|
-
/// <reference path="filters/Filter.d.ts" />
|
|
21
|
-
/// <reference path="filters/HttpStatusFilter.d.ts" />
|
|
22
|
-
/// <reference path="filters/OpenApi3Filter.d.ts" />
|
|
23
|
-
/// <reference path="filters/ResourceFilter.d.ts" />
|
|
24
|
-
/// <reference path="filters/ThrowFilter.d.ts" />
|
|
25
|
-
/// <reference path="filters/index.d.ts" />
|
|
26
|
-
/// <reference path="inject/InjectSituationType.d.ts" />
|
|
27
|
-
/// <reference path="inject/index.d.ts" />
|
|
28
|
-
/// <reference path="lifecycle/OnInit.d.ts" />
|
|
29
|
-
/// <reference path="lifecycle/index.d.ts" />
|
|
30
|
-
/// <reference path="models/RequestResponse.d.ts" />
|
|
31
|
-
/// <reference path="models/index.d.ts" />
|
|
32
|
-
/// <reference path="option/HttpServerOption.d.ts" />
|
|
33
|
-
/// <reference path="option/index.d.ts" />
|
|
34
|
-
/// <reference path="resolvers/Resolver.d.ts" />
|
|
35
|
-
/// <reference path="resolvers/ResourceResolver.d.ts" />
|
|
36
|
-
/// <reference path="resolvers/index.d.ts" />
|
|
37
|
-
/// <reference path="session/SessionManager.d.ts" />
|
|
38
|
-
/// <reference path="session/index.d.ts" />
|
|
39
1
|
declare const _default: {};
|
|
40
2
|
export default _default;
|
|
41
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -11,6 +11,7 @@ import { ReqHeader } from './datas/ReqHeader';
|
|
|
11
11
|
import { HttpStatus } from '../codes/HttpStatus';
|
|
12
12
|
import { SessionManager } from '../session/SessionManager';
|
|
13
13
|
import { HttpServerOption } from '../option/HttpServerOption';
|
|
14
|
+
import { Blob } from 'node:buffer';
|
|
14
15
|
type Config = {
|
|
15
16
|
sessionManager?: SessionManager;
|
|
16
17
|
option: HttpServerOption;
|
|
@@ -82,7 +83,7 @@ export declare class RequestResponse {
|
|
|
82
83
|
[key: string]: string | string[];
|
|
83
84
|
}): RequestResponseChain<any>;
|
|
84
85
|
private resEndChunk;
|
|
85
|
-
resEnd(chunk?: string | Buffer): Promise<void>;
|
|
86
|
+
resEnd(chunk?: string | Buffer | Blob | ArrayBuffer | Response): Promise<void>;
|
|
86
87
|
resWriteHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[] | {
|
|
87
88
|
[key: string]: string | string[];
|
|
88
89
|
}): RequestResponseChain<ServerResponse<IncomingMessage>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestResponse.d.ts","sourceRoot":"","sources":["../../../src/models/RequestResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC;AAChE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"RequestResponse.d.ts","sourceRoot":"","sources":["../../../src/models/RequestResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,KAA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;YAM7C,WAAW;IAUnB,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,WAAW,GAAG,QAAQ;IA4CpE,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,kBAAkB,EAAE,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE;IAG5H,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,kBAAkB,EAAE,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE;IAK/H,SAAS;IAKT,0BAA0B,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC;CAoB7C;AAED,qBAAa,oBAAoB,CAAC,CAAC,CAAE,SAAQ,eAAe;IACoB,MAAM,CAAC,EAAE,CAAC;gBAA5E,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAS,MAAM,CAAC,EAAE,CAAC;CAGzF"}
|
|
@@ -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
|
|
@@ -10258,6 +10260,18 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10258
10260
|
const buffer = config?.option ? node_fs.readFileSync(p, config.option) : node_fs.readFileSync(p);
|
|
10259
10261
|
return buffer;
|
|
10260
10262
|
};
|
|
10263
|
+
FileUtils2.readAsync = async (path22, config) => {
|
|
10264
|
+
const p = FileUtils2.path(path22);
|
|
10265
|
+
return node_fs.promises.readFile(p, config?.option);
|
|
10266
|
+
};
|
|
10267
|
+
FileUtils2.readStringSync = (path22) => {
|
|
10268
|
+
const p = FileUtils2.path(path22);
|
|
10269
|
+
return node_fs.readFileSync(p, "utf-8");
|
|
10270
|
+
};
|
|
10271
|
+
FileUtils2.readStringAsync = async (path22) => {
|
|
10272
|
+
const p = FileUtils2.path(path22);
|
|
10273
|
+
return node_fs.promises.readFile(p, "utf-8");
|
|
10274
|
+
};
|
|
10261
10275
|
FileUtils2.read = async (path22, config) => {
|
|
10262
10276
|
const p = FileUtils2.path(path22);
|
|
10263
10277
|
return node_fs.readFile(p, config.option);
|
|
@@ -10504,21 +10518,34 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10504
10518
|
};
|
|
10505
10519
|
|
|
10506
10520
|
// src/filters/ResourceFilter.ts
|
|
10507
|
-
var
|
|
10508
|
-
var
|
|
10521
|
+
var import_node_fs = __toESM(__require("node:fs"), 1);
|
|
10522
|
+
var import_node_path = __toESM(__require("node:path"), 1);
|
|
10509
10523
|
var import_mime_types = __toESM(require_mime_types(), 1);
|
|
10524
|
+
var import_node_buffer = __require("node:buffer");
|
|
10525
|
+
var isPathDist = (item) => {
|
|
10526
|
+
return typeof item === "object" && "request" in item && "dist" in item;
|
|
10527
|
+
};
|
|
10528
|
+
var isDataDist = (item) => {
|
|
10529
|
+
return typeof item === "object" && "request" in item && "response" in item;
|
|
10530
|
+
};
|
|
10510
10531
|
var ResourceFilter = class {
|
|
10511
|
-
constructor(
|
|
10512
|
-
|
|
10513
|
-
|
|
10532
|
+
constructor(resourceDistPathOrResourceRegex, resourceRegex) {
|
|
10533
|
+
if (typeof resourceDistPathOrResourceRegex === "string") {
|
|
10534
|
+
this.resourceDistPath = resourceDistPathOrResourceRegex;
|
|
10535
|
+
this.resources = resourceRegex;
|
|
10536
|
+
} else {
|
|
10537
|
+
this.resources = resourceDistPathOrResourceRegex;
|
|
10538
|
+
}
|
|
10514
10539
|
}
|
|
10540
|
+
// constructor(private resourceDistPath: string, private resourceRegex: (RequestFilterType | { request: RequestFilterType, dist: string | ((rr: RequestResponse, app: SimpleBootHttpServer) => (string|Promise<Blob |ArrayBuffer| Response>)) })[] = []) {
|
|
10541
|
+
// }
|
|
10515
10542
|
async onInit(app) {
|
|
10516
10543
|
}
|
|
10517
10544
|
async proceedBefore({ rr, app }) {
|
|
10518
10545
|
const url = (rr.reqUrlPathName ?? "").replace(/\.\./g, "");
|
|
10519
10546
|
const urlObj = rr.reqUrlObject;
|
|
10520
10547
|
let sw = true;
|
|
10521
|
-
const regExps = this.
|
|
10548
|
+
const regExps = this.resources?.filter((it) => {
|
|
10522
10549
|
if (it instanceof RegExp) {
|
|
10523
10550
|
return it.test(url);
|
|
10524
10551
|
}
|
|
@@ -10534,21 +10561,44 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10534
10561
|
}
|
|
10535
10562
|
return RegExp(it.request).test(url);
|
|
10536
10563
|
}
|
|
10537
|
-
});
|
|
10564
|
+
}) ?? [];
|
|
10538
10565
|
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
10566
|
sw = false;
|
|
10541
|
-
if (
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10567
|
+
if (isDataDist(it)) {
|
|
10568
|
+
let distValue = typeof it.response === "function" ? it.response(rr, app) : it.response;
|
|
10569
|
+
if (distValue instanceof Promise) {
|
|
10570
|
+
const result = await distValue;
|
|
10571
|
+
if (result instanceof Response) {
|
|
10572
|
+
await rr.resEnd(result);
|
|
10573
|
+
break;
|
|
10574
|
+
} else if (result instanceof import_node_buffer.Blob) {
|
|
10575
|
+
rr.resStatusCode(200 /* Ok */);
|
|
10576
|
+
await rr.resEnd(result);
|
|
10577
|
+
break;
|
|
10578
|
+
}
|
|
10579
|
+
}
|
|
10546
10580
|
} else {
|
|
10547
|
-
|
|
10548
|
-
|
|
10549
|
-
|
|
10581
|
+
const dist = typeof it === "object" && "dist" in it ? it.dist : urlObj.pathname;
|
|
10582
|
+
let distValue = typeof dist === "function" ? dist(rr, app) : dist;
|
|
10583
|
+
if (this.resourceDistPath) {
|
|
10584
|
+
const resourcePath = import_node_path.default.join(this.resourceDistPath, distValue);
|
|
10585
|
+
if (import_node_fs.default.existsSync(resourcePath)) {
|
|
10586
|
+
rr.resStatusCode(200 /* Ok */);
|
|
10587
|
+
rr.resSetHeader(HttpHeaders.ContentType, import_mime_types.default.lookup(resourcePath).toString());
|
|
10588
|
+
await rr.resEnd(import_node_fs.default.readFileSync(resourcePath));
|
|
10589
|
+
break;
|
|
10590
|
+
} else {
|
|
10591
|
+
rr.resStatusCode(404 /* NotFound */);
|
|
10592
|
+
await rr.resEnd();
|
|
10593
|
+
break;
|
|
10594
|
+
}
|
|
10595
|
+
} else {
|
|
10596
|
+
rr.resStatusCode(500 /* InternalServerError */);
|
|
10597
|
+
await rr.resEnd();
|
|
10598
|
+
break;
|
|
10599
|
+
}
|
|
10550
10600
|
}
|
|
10551
|
-
sw =
|
|
10601
|
+
sw = true;
|
|
10552
10602
|
}
|
|
10553
10603
|
return sw;
|
|
10554
10604
|
}
|
|
@@ -10583,117 +10633,6 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10583
10633
|
InjectSituationType2.TransactionManager = Symbol("TransactionManager");
|
|
10584
10634
|
})(InjectSituationType || (InjectSituationType = {}));
|
|
10585
10635
|
|
|
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
10636
|
// ../core/dist/esm/expression/Expression.js
|
|
10698
10637
|
var Expression;
|
|
10699
10638
|
((Expression2) => {
|
|
@@ -10708,17 +10647,6 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10708
10647
|
return binder;
|
|
10709
10648
|
});
|
|
10710
10649
|
};
|
|
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
10650
|
let Path;
|
|
10723
10651
|
((Path2) => {
|
|
10724
10652
|
Path2.pathNameData = (pathName, urlExpression) => {
|
|
@@ -10848,6 +10776,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
10848
10776
|
|
|
10849
10777
|
// src/models/RequestResponse.ts
|
|
10850
10778
|
var import_node_gzip = __toESM(require_dist(), 1);
|
|
10779
|
+
var import_node_buffer2 = __require("node:buffer");
|
|
10851
10780
|
|
|
10852
10781
|
// ../core/dist/esm/entity/Point2D.js
|
|
10853
10782
|
var Point2D = class _Point2D {
|
|
@@ -12403,7 +12332,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
12403
12332
|
const func = new Function("window", "document", "console", `"use strict"; ${script}; `);
|
|
12404
12333
|
func.call(destUser, globalContext.window, globalContext.document, globalContext.console);
|
|
12405
12334
|
} catch (e) {
|
|
12406
|
-
console.error("detectPathFromScript error:", e);
|
|
12335
|
+
console.error("detectPathFromScript error:", script, e);
|
|
12407
12336
|
}
|
|
12408
12337
|
if (options?.excludeThis) {
|
|
12409
12338
|
const filteredVars = /* @__PURE__ */ new Set();
|
|
@@ -12615,6 +12544,74 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
12615
12544
|
ConvertUtils22.decodeHTMLEscape = (data) => {
|
|
12616
12545
|
return data.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(///g, "/");
|
|
12617
12546
|
};
|
|
12547
|
+
function escapeHTML(htmlString, option) {
|
|
12548
|
+
if (!htmlString) return "";
|
|
12549
|
+
const escapeMap = {
|
|
12550
|
+
"&": "&",
|
|
12551
|
+
// 반드시 먼저 처리
|
|
12552
|
+
"<": "<",
|
|
12553
|
+
">": ">",
|
|
12554
|
+
'"': """,
|
|
12555
|
+
"'": "'",
|
|
12556
|
+
// or ' (하지만 HTML4에서는 ' 권장)
|
|
12557
|
+
"/": "/",
|
|
12558
|
+
"`": "`",
|
|
12559
|
+
"=": "=",
|
|
12560
|
+
"{": "{",
|
|
12561
|
+
"}": "}",
|
|
12562
|
+
"#": "#",
|
|
12563
|
+
"$": "$",
|
|
12564
|
+
"\n": " ",
|
|
12565
|
+
// newline
|
|
12566
|
+
"\r": " ",
|
|
12567
|
+
// carriage return
|
|
12568
|
+
" ": "	",
|
|
12569
|
+
// tab
|
|
12570
|
+
"\xA0": " ",
|
|
12571
|
+
// non-breaking space
|
|
12572
|
+
"\xA2": "¢",
|
|
12573
|
+
"\xA3": "£",
|
|
12574
|
+
"\xA5": "¥",
|
|
12575
|
+
"\u20AC": "€",
|
|
12576
|
+
"\xA9": "©",
|
|
12577
|
+
"\xAE": "®",
|
|
12578
|
+
"\u2122": "™",
|
|
12579
|
+
"\xB0": "°",
|
|
12580
|
+
"\xB1": "±",
|
|
12581
|
+
"\xD7": "×",
|
|
12582
|
+
"\xF7": "÷",
|
|
12583
|
+
"\u2212": "−",
|
|
12584
|
+
"\u2022": "•",
|
|
12585
|
+
"\u2026": "…",
|
|
12586
|
+
"\u2190": "←",
|
|
12587
|
+
"\u2192": "→",
|
|
12588
|
+
"\u2191": "↑",
|
|
12589
|
+
"\u2193": "↓",
|
|
12590
|
+
"\u2194": "↔"
|
|
12591
|
+
};
|
|
12592
|
+
const targetsSet = option?.targets ? new Set(option.targets) : null;
|
|
12593
|
+
const filteredEscapeMap = targetsSet ? Object.fromEntries(Object.entries(escapeMap).filter(([key]) => targetsSet.has(key))) : escapeMap;
|
|
12594
|
+
const shouldEscapeAmpersand = !targetsSet || targetsSet.has("&");
|
|
12595
|
+
const charsToEscape = Object.keys(filteredEscapeMap).filter((char) => char !== "&");
|
|
12596
|
+
if (charsToEscape.length === 0 && !shouldEscapeAmpersand) {
|
|
12597
|
+
return htmlString;
|
|
12598
|
+
}
|
|
12599
|
+
const escapedChars = charsToEscape.map((char) => {
|
|
12600
|
+
return char.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
12601
|
+
}).join("");
|
|
12602
|
+
let result = htmlString;
|
|
12603
|
+
if (shouldEscapeAmpersand) {
|
|
12604
|
+
result = result.replace(/&/g, "&");
|
|
12605
|
+
}
|
|
12606
|
+
if (escapedChars.length > 0) {
|
|
12607
|
+
const regex = new RegExp(`[${escapedChars}]`, "g");
|
|
12608
|
+
result = result.replace(regex, (match) => {
|
|
12609
|
+
return filteredEscapeMap[match] || match;
|
|
12610
|
+
});
|
|
12611
|
+
}
|
|
12612
|
+
return result;
|
|
12613
|
+
}
|
|
12614
|
+
ConvertUtils22.escapeHTML = escapeHTML;
|
|
12618
12615
|
ConvertUtils22.copyObject = (obj, update = {}) => {
|
|
12619
12616
|
return { ...obj, ...update };
|
|
12620
12617
|
};
|
|
@@ -13175,7 +13172,28 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
13175
13172
|
this.res.end(data);
|
|
13176
13173
|
}
|
|
13177
13174
|
async resEnd(chunk) {
|
|
13178
|
-
|
|
13175
|
+
if (chunk instanceof Response) {
|
|
13176
|
+
chunk.headers.forEach((value, key) => {
|
|
13177
|
+
this.res.setHeader(`ORIGIN-${key}`, value);
|
|
13178
|
+
});
|
|
13179
|
+
if (!this.resHeader(HttpHeaders.ContentType)) {
|
|
13180
|
+
const contentType = chunk.headers.get(HttpHeaders.ContentType);
|
|
13181
|
+
if (contentType) {
|
|
13182
|
+
this.res.setHeader(HttpHeaders.ContentType, contentType);
|
|
13183
|
+
}
|
|
13184
|
+
}
|
|
13185
|
+
this.res.statusCode = chunk.status;
|
|
13186
|
+
this.resWriteChunk = import_buffer.Buffer.from(await chunk.arrayBuffer());
|
|
13187
|
+
} else if (chunk instanceof import_node_buffer2.Blob) {
|
|
13188
|
+
this.resWriteChunk = import_buffer.Buffer.from(await chunk.arrayBuffer());
|
|
13189
|
+
if (!this.resHeader(HttpHeaders.ContentType)) {
|
|
13190
|
+
this.res.setHeader(HttpHeaders.ContentType, chunk.type);
|
|
13191
|
+
}
|
|
13192
|
+
} else if (chunk instanceof ArrayBuffer) {
|
|
13193
|
+
this.resWriteChunk = import_buffer.Buffer.from(chunk);
|
|
13194
|
+
} else {
|
|
13195
|
+
this.resWriteChunk = chunk ?? this.resWriteChunk;
|
|
13196
|
+
}
|
|
13179
13197
|
if (this.req.readable) {
|
|
13180
13198
|
await this.reqBodyData();
|
|
13181
13199
|
await this.resEndChunk();
|
|
@@ -13238,8 +13256,8 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
13238
13256
|
};
|
|
13239
13257
|
|
|
13240
13258
|
// src/models/datas/Resource.ts
|
|
13241
|
-
var
|
|
13242
|
-
var
|
|
13259
|
+
var import_fs = __toESM(__require("fs"), 1);
|
|
13260
|
+
var import_path = __toESM(__require("path"), 1);
|
|
13243
13261
|
var import_mime_types2 = __toESM(require_mime_types(), 1);
|
|
13244
13262
|
var Resource = class {
|
|
13245
13263
|
constructor(path3, rootPath = process.cwd()) {
|
|
@@ -13248,11 +13266,11 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
13248
13266
|
}
|
|
13249
13267
|
get absolutePath() {
|
|
13250
13268
|
if (this.path instanceof RequestResponse) {
|
|
13251
|
-
return
|
|
13269
|
+
return import_path.default.join(this.rootPath, this.path.reqUrlObj().pathname);
|
|
13252
13270
|
} else if (this.path instanceof URL) {
|
|
13253
|
-
return
|
|
13271
|
+
return import_path.default.join(this.rootPath, this.path.pathname);
|
|
13254
13272
|
} else {
|
|
13255
|
-
return
|
|
13273
|
+
return import_path.default.join(this.rootPath, this.path);
|
|
13256
13274
|
}
|
|
13257
13275
|
}
|
|
13258
13276
|
get conTentType() {
|
|
@@ -13260,7 +13278,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
13260
13278
|
}
|
|
13261
13279
|
get data() {
|
|
13262
13280
|
const promise = new Promise((resolve, reject) => {
|
|
13263
|
-
|
|
13281
|
+
import_fs.default.readFile("", (error, fileBuffer) => {
|
|
13264
13282
|
if (error) {
|
|
13265
13283
|
reject(error);
|
|
13266
13284
|
}
|
|
@@ -13273,7 +13291,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
|
|
|
13273
13291
|
async write(rr) {
|
|
13274
13292
|
rr.resStatusCode(200 /* Ok */);
|
|
13275
13293
|
rr.resSetHeader(HttpHeaders.ContentType, this.conTentType);
|
|
13276
|
-
await rr.resEnd(
|
|
13294
|
+
await rr.resEnd(import_fs.default.readFileSync(this.absolutePath));
|
|
13277
13295
|
}
|
|
13278
13296
|
};
|
|
13279
13297
|
|