@miqro/core 5.0.11 → 5.0.12
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
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
3
|
/// <reference types="node" resolution-mode="require"/>
|
|
4
4
|
/// <reference types="node" resolution-mode="require"/>
|
|
5
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
5
6
|
import { RequestListener, Server as HttpServer } from "http";
|
|
6
7
|
import { Router } from "./middleware/router.js";
|
|
7
8
|
import { Request, Response, RouterOptions } from "./types.js";
|
|
@@ -477,7 +477,7 @@ export function ResultParser(options, parser) {
|
|
|
477
477
|
}
|
|
478
478
|
else {
|
|
479
479
|
mappedLastResult.status = parsedStatus;
|
|
480
|
-
req.logger.
|
|
480
|
+
req.logger.debug(`ctx.results.status mapped to %o`, mappedLastResult.status);
|
|
481
481
|
}
|
|
482
482
|
mappedLastResult.body = parsePart(req, "body", lastResult.body, bodyParser, options.bodyMode, parser);
|
|
483
483
|
mappedLastResult.headers = parsePart(req, "headers", lastResult.headers, headersParser, options.headersMode, parser);
|
|
@@ -535,7 +535,7 @@ function parsePart(req, part, value, args, mode, parser) {
|
|
|
535
535
|
properties: o,
|
|
536
536
|
mode
|
|
537
537
|
}, `ctx.results.${part}`);
|
|
538
|
-
req.logger.
|
|
538
|
+
req.logger.debug(`ctx.results.%s mapped to %o`, part, mappedResultBody);
|
|
539
539
|
return mappedResultBody;
|
|
540
540
|
}
|
|
541
541
|
catch (e) {
|
|
@@ -74,7 +74,7 @@ export class VerifyEndpointService {
|
|
|
74
74
|
switch (tokenVerifyLocation) {
|
|
75
75
|
case "header":
|
|
76
76
|
const tokenHeaderLocation = typeof this.options.tokenLocationName === "string" ? this.options.tokenLocationName : await this.options.tokenLocationName(req);
|
|
77
|
-
req.logger.
|
|
77
|
+
req.logger.debug(`verifying [${token}] on TOKEN_VERIFY_ENDPOINT=[${process.env.TOKEN_VERIFY_ENDPOINT}] TOKEN_HEADER=[${tokenHeaderLocation}]`);
|
|
78
78
|
response = await this.getResponse({
|
|
79
79
|
url,
|
|
80
80
|
headers: {
|
|
@@ -85,7 +85,7 @@ export class VerifyEndpointService {
|
|
|
85
85
|
break;
|
|
86
86
|
case "query":
|
|
87
87
|
const tokenQueryLocation = typeof this.options.tokenLocationName === "string" ? this.options.tokenLocationName : await this.options.tokenLocationName(req);
|
|
88
|
-
req.logger.
|
|
88
|
+
req.logger.debug(`verifying [${token}] on TOKEN_VERIFY_ENDPOINT=[${process.env.TOKEN_VERIFY_ENDPOINT}] TOKEN_QUERY=[${tokenQueryLocation}]`);
|
|
89
89
|
response = await this.getResponse({
|
|
90
90
|
url,
|
|
91
91
|
query: {
|
|
@@ -96,7 +96,7 @@ export class VerifyEndpointService {
|
|
|
96
96
|
break;
|
|
97
97
|
case "cookie":
|
|
98
98
|
const tokenCookieLocation = typeof this.options.tokenLocationName === "string" ? this.options.tokenLocationName : await this.options.tokenLocationName(req);
|
|
99
|
-
req.logger.
|
|
99
|
+
req.logger.debug(`verifying [${token}] on TOKEN_VERIFY_ENDPOINT=[${process.env.TOKEN_VERIFY_ENDPOINT}] TOKEN_COOKIE=[${tokenCookieLocation}]`);
|
|
100
100
|
response = await this.getResponse({
|
|
101
101
|
url,
|
|
102
102
|
method,
|
|
@@ -115,7 +115,7 @@ export class VerifyEndpointService {
|
|
|
115
115
|
return null;
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
118
|
-
req.logger.
|
|
118
|
+
req.logger.debug("token [%s]authorized!", token);
|
|
119
119
|
if (tokenVerifyLocation === "cookie" && response.headers["set-cookie"]) {
|
|
120
120
|
const tokenCookieLocation = typeof this.options.tokenLocationName === "string" ? this.options.tokenLocationName : await this.options.tokenLocationName(req);
|
|
121
121
|
const cookies = response.headers["set-cookie"].map((c) => cookieParse(c)).filter((c) => c[tokenCookieLocation] !== undefined);
|
package/build/types.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
/// <reference types="node" resolution-mode="require"/>
|
|
5
5
|
/// <reference types="node" resolution-mode="require"/>
|
|
6
6
|
/// <reference types="node" resolution-mode="require"/>
|
|
7
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
7
8
|
import { ParserInterface, Schema } from "@miqro/parser";
|
|
8
9
|
import { CookieSerializeOptions } from "cookie";
|
|
9
10
|
import { IncomingMessage, OutgoingHttpHeaders, ServerResponse } from "http";
|
package/build/websocket.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
3
|
/// <reference types="node" resolution-mode="require"/>
|
|
4
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
4
5
|
import { Duplex } from "stream";
|
|
5
6
|
import { ConnectionUpgrader, WebSocketClient, WebSocketServerOptions, Request } from "./types.js";
|
|
6
7
|
import { Serializable } from "child_process";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miqro/core",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "build/lib.js",
|
|
@@ -28,6 +28,6 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@miqro/parser": "^2.0.4",
|
|
30
30
|
"@miqro/request": "^0.2.3",
|
|
31
|
-
"cookie": "0.
|
|
31
|
+
"cookie": "0.7.1"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -523,7 +523,7 @@ export function ResultParser(options: {
|
|
|
523
523
|
}
|
|
524
524
|
} else {
|
|
525
525
|
mappedLastResult.status = parsedStatus;
|
|
526
|
-
req.logger.
|
|
526
|
+
req.logger.debug(`ctx.results.status mapped to %o`, mappedLastResult.status);
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
mappedLastResult.body = parsePart(req, "body", lastResult.body, bodyParser, options.bodyMode, parser);
|
|
@@ -582,7 +582,7 @@ function parsePart(req: Request, part: "body" | "headers", value: any, args: Arr
|
|
|
582
582
|
properties: o,
|
|
583
583
|
mode
|
|
584
584
|
}, `ctx.results.${part}`);
|
|
585
|
-
req.logger.
|
|
585
|
+
req.logger.debug(`ctx.results.%s mapped to %o`, part, mappedResultBody);
|
|
586
586
|
return mappedResultBody;
|
|
587
587
|
} catch (e) {
|
|
588
588
|
if (i === args.length - 1) {
|
|
@@ -93,7 +93,7 @@ export class VerifyEndpointService implements VerifyTokenService {
|
|
|
93
93
|
switch (tokenVerifyLocation) {
|
|
94
94
|
case "header":
|
|
95
95
|
const tokenHeaderLocation = typeof this.options.tokenLocationName === "string" ? this.options.tokenLocationName : await this.options.tokenLocationName(req);
|
|
96
|
-
req.logger.
|
|
96
|
+
req.logger.debug(`verifying [${token}] on TOKEN_VERIFY_ENDPOINT=[${process.env.TOKEN_VERIFY_ENDPOINT}] TOKEN_HEADER=[${tokenHeaderLocation}]`);
|
|
97
97
|
response = await this.getResponse({
|
|
98
98
|
url,
|
|
99
99
|
headers: {
|
|
@@ -104,7 +104,7 @@ export class VerifyEndpointService implements VerifyTokenService {
|
|
|
104
104
|
break;
|
|
105
105
|
case "query":
|
|
106
106
|
const tokenQueryLocation = typeof this.options.tokenLocationName === "string" ? this.options.tokenLocationName : await this.options.tokenLocationName(req);
|
|
107
|
-
req.logger.
|
|
107
|
+
req.logger.debug(`verifying [${token}] on TOKEN_VERIFY_ENDPOINT=[${process.env.TOKEN_VERIFY_ENDPOINT}] TOKEN_QUERY=[${tokenQueryLocation}]`);
|
|
108
108
|
response = await this.getResponse({
|
|
109
109
|
url,
|
|
110
110
|
query: {
|
|
@@ -115,7 +115,7 @@ export class VerifyEndpointService implements VerifyTokenService {
|
|
|
115
115
|
break;
|
|
116
116
|
case "cookie":
|
|
117
117
|
const tokenCookieLocation = typeof this.options.tokenLocationName === "string" ? this.options.tokenLocationName : await this.options.tokenLocationName(req);
|
|
118
|
-
req.logger.
|
|
118
|
+
req.logger.debug(`verifying [${token}] on TOKEN_VERIFY_ENDPOINT=[${process.env.TOKEN_VERIFY_ENDPOINT}] TOKEN_COOKIE=[${tokenCookieLocation}]`);
|
|
119
119
|
response = await this.getResponse({
|
|
120
120
|
url,
|
|
121
121
|
method,
|
|
@@ -133,7 +133,7 @@ export class VerifyEndpointService implements VerifyTokenService {
|
|
|
133
133
|
req.logger.warn(`unauthorized token not valid [${token}]`);
|
|
134
134
|
return null;
|
|
135
135
|
} else {
|
|
136
|
-
req.logger.
|
|
136
|
+
req.logger.debug("token [%s]authorized!", token);
|
|
137
137
|
|
|
138
138
|
if (tokenVerifyLocation === "cookie" && response.headers["set-cookie"]) {
|
|
139
139
|
const tokenCookieLocation = typeof this.options.tokenLocationName === "string" ? this.options.tokenLocationName : await this.options.tokenLocationName(req);
|