@dooboostore/simple-boot-http-server 1.0.20 → 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.
Files changed (29) hide show
  1. package/README.MD +24 -248
  2. package/dist/cjs/SimpleBootHttpServer.js +2 -2
  3. package/dist/cjs/SimpleBootHttpServer.js.map +2 -2
  4. package/dist/cjs/filters/ResourceFilter.js +59 -19
  5. package/dist/cjs/filters/ResourceFilter.js.map +2 -2
  6. package/dist/cjs/models/RequestResponse.js +23 -1
  7. package/dist/cjs/models/RequestResponse.js.map +2 -2
  8. package/dist/cjs/package.json +5 -0
  9. package/dist/esm/SimpleBootHttpServer.js +2 -2
  10. package/dist/esm/SimpleBootHttpServer.js.map +2 -2
  11. package/dist/esm/filters/ResourceFilter.js +56 -18
  12. package/dist/esm/filters/ResourceFilter.js.map +2 -2
  13. package/dist/esm/models/RequestResponse.js +23 -1
  14. package/dist/esm/models/RequestResponse.js.map +2 -2
  15. package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js +166 -149
  16. package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js.map +4 -4
  17. package/dist/types/SimpleBootHttpServer.d.ts +1 -2
  18. package/dist/types/SimpleBootHttpServer.d.ts.map +1 -1
  19. package/dist/types/filters/ResourceFilter.d.ts +16 -6
  20. package/dist/types/filters/ResourceFilter.d.ts.map +1 -1
  21. package/dist/types/index.d.ts +0 -38
  22. package/dist/types/models/RequestResponse.d.ts +2 -1
  23. package/dist/types/models/RequestResponse.d.ts.map +1 -1
  24. package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js +173 -156
  25. package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js.map +4 -4
  26. package/package.json +16 -15
  27. package/src/SimpleBootHttpServer.ts +2 -3
  28. package/src/filters/ResourceFilter.ts +67 -20
  29. package/src/models/RequestResponse.ts +26 -2
@@ -3,13 +3,12 @@ import { HttpServerOption } from './option/HttpServerOption';
3
3
  import { ConstructorType } from '@dooboostore/core/types';
4
4
  import { Server as HttpServer } from 'http';
5
5
  import { Server as HttpsServer } from 'https';
6
- import { SimstanceManager } from '@dooboostore/simple-boot/simstance/SimstanceManager';
7
6
  export declare class SimpleBootHttpServer extends SimpleApplication {
8
7
  option: HttpServerOption;
9
8
  server?: HttpServer | HttpsServer;
10
9
  private sessionManager;
11
10
  constructor(option?: HttpServerOption);
12
- run(otherInstanceSim?: Map<ConstructorType<any>, any>): SimstanceManager;
11
+ run(otherInstanceSim?: Map<ConstructorType<any>, any>): this;
13
12
  private startServer;
14
13
  }
15
14
  //# sourceMappingURL=SimpleBootHttpServer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SimpleBootHttpServer.d.ts","sourceRoot":"","sources":["../../src/SimpleBootHttpServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAmB,MAAM,IAAI,UAAU,EAAkB,MAAM,MAAM,CAAA;AAC5E,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,OAAO,CAAC;AAO9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAoBvF,qBAAa,oBAAqB,SAAQ,iBAAiB;IAGpC,MAAM,EAAE,gBAAgB;IAFpC,MAAM,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;IACzC,OAAO,CAAC,cAAc,CAAiB;gBACpB,MAAM,GAAE,gBAAyC;IAM7D,GAAG,CAAC,gBAAgB,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC;IAS5D,OAAO,CAAC,WAAW;CAwRtB"}
1
+ {"version":3,"file":"SimpleBootHttpServer.d.ts","sourceRoot":"","sources":["../../src/SimpleBootHttpServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAmB,MAAM,IAAI,UAAU,EAAkB,MAAM,MAAM,CAAA;AAC5E,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,OAAO,CAAC;AA0B9C,qBAAa,oBAAqB,SAAQ,iBAAiB;IAGpC,MAAM,EAAE,gBAAgB;IAFpC,MAAM,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;IACzC,OAAO,CAAC,cAAc,CAAiB;gBACpB,MAAM,GAAE,gBAAyC;IAM7D,GAAG,CAAC,gBAAgB,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC;IAS5D,OAAO,CAAC,WAAW;CAwRtB"}
@@ -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 resourceRegex;
8
- constructor(resourceDistPath: string, resourceRegex?: (RequestFilterType | {
9
- request: RequestFilterType;
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;AAE5D,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,eAAe,EAAE,GAAG,EAAE,oBAAoB,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,eAAe,EAAE,GAAG,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AAEzL,qBAAa,cAAe,YAAW,MAAM;IAC7B,OAAO,CAAC,gBAAgB;IAAU,OAAO,CAAC,aAAa;gBAA/C,gBAAgB,EAAE,MAAM,EAAU,aAAa,GAAE,CAAC,iBAAiB,GAAG;QAAE,OAAO,EAAE,iBAAiB,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,EAAO;IAGxI,MAAM,CAAC,GAAG,EAAE,oBAAoB;IAGhC,aAAa,CAAC,EAAC,EAAE,EAAE,GAAG,EAAC,EAAE;QAAC,EAAE,EAAE,eAAe,CAAC;QAAC,GAAG,EAAE,oBAAoB,CA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M,UAAU,GAAI,MAAM,GAAG,KAAG,IAAI,IAAI,QAE9C,CAAC;AACF,eAAO,MAAM,UAAU,GAAI,MAAM,GAAG,KAAG,IAAI,IAAI,QAE9C,CAAC;AACF,qBAAa,cAAe,YAAW,MAAM;IAE3C,OAAO,CAAC,gBAAgB,CAAC,CAAS;IAClC,OAAO,CAAC,SAAS,CAAC,CAAwB;gBAC9B,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE;gBACnD,aAAa,EAAE,QAAQ,EAAE;IAa7B,MAAM,CAAC,GAAG,EAAE,oBAAoB;IAGhC,aAAa,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;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"}
@@ -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;AAQ9D,KAAK,MAAM,GAAG;IAAE,cAAc,CAAC,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAG5E,qBAAa,eAAe;IAC1B,SAAS,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACrD,SAAS,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,GAAG,EAAE,eAAe,CAAC;IAC/B,SAAS,CAAC,GAAG,EAA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,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE;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"}
@@ -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 import_fs = __toESM(__require("fs"), 1);
10508
- var import_path = __toESM(__require("path"), 1);
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(resourceDistPath, resourceRegex = []) {
10512
- this.resourceDistPath = resourceDistPath;
10513
- this.resourceRegex = resourceRegex;
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.resourceRegex.filter((it) => {
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 (import_fs.default.existsSync(resourcePath)) {
10542
- rr.resStatusCode(200 /* Ok */);
10543
- rr.resSetHeader(HttpHeaders.ContentType, import_mime_types.default.lookup(resourcePath).toString());
10544
- await rr.resEnd(import_fs.default.readFileSync(resourcePath));
10545
- break;
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
- rr.resStatusCode(404 /* NotFound */);
10548
- await rr.resEnd();
10549
- break;
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 = false;
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(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&#x2F;/g, "/");
12617
12546
  };
12547
+ function escapeHTML(htmlString, option) {
12548
+ if (!htmlString) return "";
12549
+ const escapeMap = {
12550
+ "&": "&amp;",
12551
+ // 반드시 먼저 처리
12552
+ "<": "&lt;",
12553
+ ">": "&gt;",
12554
+ '"': "&quot;",
12555
+ "'": "&#39;",
12556
+ // or &apos; (하지만 HTML4에서는 &#39; 권장)
12557
+ "/": "&#x2F;",
12558
+ "`": "&#x60;",
12559
+ "=": "&#x3D;",
12560
+ "{": "&#123;",
12561
+ "}": "&#125;",
12562
+ "#": "&#35;",
12563
+ "$": "&#36;",
12564
+ "\n": "&#10;",
12565
+ // newline
12566
+ "\r": "&#13;",
12567
+ // carriage return
12568
+ " ": "&#9;",
12569
+ // tab
12570
+ "\xA0": "&nbsp;",
12571
+ // non-breaking space
12572
+ "\xA2": "&cent;",
12573
+ "\xA3": "&pound;",
12574
+ "\xA5": "&yen;",
12575
+ "\u20AC": "&euro;",
12576
+ "\xA9": "&copy;",
12577
+ "\xAE": "&reg;",
12578
+ "\u2122": "&trade;",
12579
+ "\xB0": "&deg;",
12580
+ "\xB1": "&plusmn;",
12581
+ "\xD7": "&times;",
12582
+ "\xF7": "&divide;",
12583
+ "\u2212": "&minus;",
12584
+ "\u2022": "&bull;",
12585
+ "\u2026": "&hellip;",
12586
+ "\u2190": "&larr;",
12587
+ "\u2192": "&rarr;",
12588
+ "\u2191": "&uarr;",
12589
+ "\u2193": "&darr;",
12590
+ "\u2194": "&harr;"
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, "&amp;");
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
- this.resWriteChunk = chunk ?? this.resWriteChunk;
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 import_fs2 = __toESM(__require("fs"), 1);
13242
- var import_path2 = __toESM(__require("path"), 1);
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 import_path2.default.join(this.rootPath, this.path.reqUrlObj().pathname);
13269
+ return import_path.default.join(this.rootPath, this.path.reqUrlObj().pathname);
13252
13270
  } else if (this.path instanceof URL) {
13253
- return import_path2.default.join(this.rootPath, this.path.pathname);
13271
+ return import_path.default.join(this.rootPath, this.path.pathname);
13254
13272
  } else {
13255
- return import_path2.default.join(this.rootPath, this.path);
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
- import_fs2.default.readFile("", (error, fileBuffer) => {
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(import_fs2.default.readFileSync(this.absolutePath));
13294
+ await rr.resEnd(import_fs.default.readFileSync(this.absolutePath));
13277
13295
  }
13278
13296
  };
13279
13297
 
@@ -13832,7 +13850,6 @@ var dooboostoreSimpleBootHttpServer = (() => {
13832
13850
  this.setStoreSet(option.constructor, option);
13833
13851
  this.setStoreSet(SimOption, option);
13834
13852
  this.simProxyHandler = new SimProxyHandler(this.simpleApplication, this, option);
13835
- console.log("simstanceManager constructor", this.name);
13836
13853
  }
13837
13854
  get storage() {
13838
13855
  return this._storage;
@@ -14543,7 +14560,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
14543
14560
  get observable() {
14544
14561
  return this.subject.asObservable();
14545
14562
  }
14546
- routingMap(prefix = "", option) {
14563
+ routingMap(option) {
14547
14564
  const targetRouter = option?.router ?? this.simOption.rootRouter;
14548
14565
  if (!targetRouter) {
14549
14566
  throw new Error("no router");
@@ -14555,7 +14572,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
14555
14572
  const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
14556
14573
  const routerData = routerAtomic.getConfig(RouterMetadataKey);
14557
14574
  if (routerData) {
14558
- const currentPrefix = prefix + routerData.path;
14575
+ const currentPrefix = (option?.prefix ?? "") + routerData.path;
14559
14576
  if (routerData.route && routerData.route[""]) {
14560
14577
  map[currentPrefix] = routerData.route[""];
14561
14578
  }
@@ -14565,7 +14582,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
14565
14582
  });
14566
14583
  }
14567
14584
  routerData.routers?.forEach((it) => {
14568
- Object.assign(map, this.routingMap(currentPrefix, { ...option, router: it }));
14585
+ Object.assign(map, this.routingMap({ ...option, router: it, prefix: currentPrefix }));
14569
14586
  });
14570
14587
  }
14571
14588
  }
@@ -14998,7 +15015,7 @@ var dooboostoreSimpleBootHttpServer = (() => {
14998
15015
  }
14999
15016
  run(otherInstanceSim) {
15000
15017
  this.simstanceManager.run(otherInstanceSim);
15001
- return this.simstanceManager;
15018
+ return this;
15002
15019
  }
15003
15020
  simAtomic(type) {
15004
15021
  if (typeof type === "symbol") {
@@ -15120,12 +15137,12 @@ var dooboostoreSimpleBootHttpServer = (() => {
15120
15137
  this.sessionManager = new SessionManager(this.option);
15121
15138
  }
15122
15139
  run(otherInstanceSim) {
15123
- const simstanceManager = super.run(otherInstanceSim);
15140
+ super.run(otherInstanceSim);
15124
15141
  const targets = [...this.option.closeEndPoints ?? [], ...this.option.errorEndPoints ?? [], ...this.option.requestEndPoints ?? [], ...this.option.filters ?? []];
15125
15142
  Promise.all(targets.map((it) => typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it).map((it) => it.onInit(this))).then((it) => {
15126
15143
  this.startServer();
15127
15144
  });
15128
- return simstanceManager;
15145
+ return this;
15129
15146
  }
15130
15147
  startServer() {
15131
15148
  if (this.option.serverOption && "key" in this.option.serverOption && "cert" in this.option.serverOption) {