@miqro/core 5.0.14 → 5.0.15
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/build/app.d.ts +3 -1
- package/build/app.js +3 -1
- package/build/app.js.map +1 -1
- package/build/middleware/router.d.ts +2 -1
- package/package.json +1 -1
- package/src/app.ts +5 -2
- package/src/middleware/router.ts +1 -1
package/build/app.d.ts
CHANGED
|
@@ -3,15 +3,17 @@
|
|
|
3
3
|
/// <reference types="node" resolution-mode="require"/>
|
|
4
4
|
/// <reference types="node" resolution-mode="require"/>
|
|
5
5
|
/// <reference types="node" resolution-mode="require"/>
|
|
6
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
6
7
|
import { RequestListener, Server as HttpServer } from "http";
|
|
7
8
|
import { Router } from "./middleware/router.js";
|
|
8
9
|
import { Request, Response, RouterOptions } from "./types.js";
|
|
9
|
-
import { ServerOptions } from "
|
|
10
|
+
import { ServerOptions } from "https";
|
|
10
11
|
import { Duplex } from "stream";
|
|
11
12
|
import { Socket } from "net";
|
|
12
13
|
export interface AppOptions extends RouterOptions {
|
|
13
14
|
onUpgrade?: (req: Request, socket: Duplex, head: Buffer) => Promise<void> | void;
|
|
14
15
|
serverOptions?: ServerOptions<typeof Request, typeof Response>;
|
|
16
|
+
https?: boolean;
|
|
15
17
|
}
|
|
16
18
|
export declare class App extends Router {
|
|
17
19
|
readonly listener: RequestListener<typeof Request, typeof Response>;
|
package/build/app.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createServer } from "http";
|
|
2
|
+
import { createServer as createHttpsServer } from "https";
|
|
2
3
|
import { Router } from "./middleware/router.js";
|
|
3
4
|
import { routerDefaultLoggerFactory, defaultAppErrorHandler, HTML_HEADERS, STATUS } from "./common.js";
|
|
4
5
|
import { randomUUID } from "crypto";
|
|
@@ -61,7 +62,8 @@ export class App extends Router {
|
|
|
61
62
|
console.error(loggerError);
|
|
62
63
|
}
|
|
63
64
|
};
|
|
64
|
-
|
|
65
|
+
const createS = ((config && config.https ? createHttpsServer : createServer));
|
|
66
|
+
this.httpServer = createS(this.serverOptions, this.listener);
|
|
65
67
|
this.httpServer.on("connection", (conn) => {
|
|
66
68
|
const key = randomUUID();
|
|
67
69
|
this.connections[key] = conn;
|
package/build/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAyC,MAAM,MAAM,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIvG,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAyC,MAAM,MAAM,CAAC;AAC3E,OAAO,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIvG,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AASpC,MAAM,OAAO,GAAI,SAAQ,MAAM;IAM7B,YAAY,MAAmB;QAC7B,KAAK,CAAC,MAAM,CAAC,CAAC;QAJR,0BAAqB,GAAY,KAAK,CAAC;QACxC,gBAAW,GAA8B,EAAE,CAAC;QAIjD,IAAI,MAAM,EAAE,aAAa,EAAE,CAAC;YAC1B,IAAI,CAAC,aAAa,GAAG;gBACnB,GAAG,IAAI,CAAC,aAAa;gBACrB,GAAG,MAAM,CAAC,aAAa;aACxB,CAAC;QACJ,CAAC;QACD,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M,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC3C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;QAClC,CAAC;IACH,CAAC;CACF;AAED,MAAM,OAAO,MAAO,SAAQ,GAAG;CAC9B"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
3
|
import { RequestListener } from "http";
|
|
3
4
|
import { Logger } from "../common.js";
|
|
4
5
|
import { Request, Response, ErrorHandler, Handler, Method, HandlerWithOptions, MinimalRouter, RouterHandlerOptions, RouterJSONDoc, RouterOptions, PathParams, PathPart, PathPartToken, APIRouterOptions, MinimalLogger } from "../types.js";
|
|
5
|
-
import { ServerOptions } from "
|
|
6
|
+
import { ServerOptions } from "https";
|
|
6
7
|
/**
|
|
7
8
|
* Router Public
|
|
8
9
|
*/
|
package/package.json
CHANGED
package/src/app.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createServer, RequestListener, Server as HttpServer } from "http";
|
|
2
|
+
import { createServer as createHttpsServer } from "https";
|
|
2
3
|
import { Router } from "./middleware/router.js";
|
|
3
4
|
import { routerDefaultLoggerFactory, defaultAppErrorHandler, HTML_HEADERS, STATUS } from "./common.js";
|
|
4
5
|
import { Request, Response, RouterOptions } from "./types.js";
|
|
5
|
-
import { ServerOptions } from "
|
|
6
|
+
import { ServerOptions } from "https";
|
|
6
7
|
import { Duplex } from "stream";
|
|
7
8
|
import { randomUUID } from "crypto";
|
|
8
9
|
import { Socket } from "net";
|
|
@@ -10,6 +11,7 @@ import { Socket } from "net";
|
|
|
10
11
|
export interface AppOptions extends RouterOptions {
|
|
11
12
|
onUpgrade?: (req: Request, socket: Duplex, head: Buffer) => Promise<void> | void;
|
|
12
13
|
serverOptions?: ServerOptions<typeof Request, typeof Response>;
|
|
14
|
+
https?: boolean;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
export class App extends Router {
|
|
@@ -70,7 +72,8 @@ export class App extends Router {
|
|
|
70
72
|
console.error(loggerError);
|
|
71
73
|
}
|
|
72
74
|
};
|
|
73
|
-
|
|
75
|
+
const createS = (config && config.https ? createHttpsServer : createServer)<typeof Request, typeof Response>;
|
|
76
|
+
this.httpServer = createS(this.serverOptions, this.listener);
|
|
74
77
|
|
|
75
78
|
this.httpServer.on("connection", (conn) => {
|
|
76
79
|
const key = randomUUID();
|
package/src/middleware/router.ts
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
newURL,
|
|
33
33
|
removeStartingBackSlashes,
|
|
34
34
|
} from "../types.js";
|
|
35
|
-
import { ServerOptions } from "
|
|
35
|
+
import { ServerOptions } from "https";
|
|
36
36
|
import { SessionHandler, GroupPolicyHandler } from "./session.js";
|
|
37
37
|
import { DEFAULT_PARSER, assertNotUndefined, ResponseHandler, ResultParser, ParseRequest } from "./body-parser.js";
|
|
38
38
|
import { RequestOptions, request } from "@miqro/request";
|