@aeriajs/http 0.0.180 → 0.0.182
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/log.d.ts +1 -1
- package/dist/log.js +10 -9
- package/dist/log.mjs +7 -6
- package/package.json +5 -5
package/dist/log.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type GenericResponse } from '@aeriajs/types';
|
|
2
2
|
export declare const logResponse: (response: GenericResponse) => void;
|
package/dist/log.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logResponse = void 0;
|
|
4
|
-
const
|
|
4
|
+
const types_1 = require("@aeriajs/types");
|
|
5
|
+
const node_util_1 = require("node:util");
|
|
5
6
|
const logResponse = (response) => {
|
|
6
7
|
const { statusCode, req: { method, url } } = response;
|
|
7
8
|
if (!method) {
|
|
8
9
|
return;
|
|
9
10
|
}
|
|
10
11
|
const statusColor = statusCode >= 400 && statusCode <= 599
|
|
11
|
-
?
|
|
12
|
-
:
|
|
13
|
-
const methodColor = method in
|
|
14
|
-
?
|
|
15
|
-
:
|
|
12
|
+
? 'red'
|
|
13
|
+
: 'white';
|
|
14
|
+
const methodColor = method in types_1.METHOD_COLORS
|
|
15
|
+
? types_1.METHOD_COLORS[method]
|
|
16
|
+
: 'white';
|
|
16
17
|
const now = new Date();
|
|
17
|
-
let line = `[${(0,
|
|
18
|
+
let line = `[${(0, node_util_1.styleText)([statusColor], statusCode.toString())}] `;
|
|
18
19
|
line += `[${now.toLocaleString()}] `;
|
|
19
|
-
line += (0,
|
|
20
|
-
'
|
|
20
|
+
line += (0, node_util_1.styleText)([
|
|
21
|
+
'bold',
|
|
21
22
|
methodColor,
|
|
22
23
|
], method) + ' ';
|
|
23
24
|
line += url;
|
package/dist/log.mjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
2
|
+
import { METHOD_COLORS } from "@aeriajs/types";
|
|
3
|
+
import { styleText } from "node:util";
|
|
3
4
|
export const logResponse = (response) => {
|
|
4
5
|
const { statusCode, req: { method, url } } = response;
|
|
5
6
|
if (!method) {
|
|
6
7
|
return;
|
|
7
8
|
}
|
|
8
|
-
const statusColor = statusCode >= 400 && statusCode <= 599 ?
|
|
9
|
-
const methodColor = method in METHOD_COLORS ? METHOD_COLORS[method] :
|
|
9
|
+
const statusColor = statusCode >= 400 && statusCode <= 599 ? "red" : "white";
|
|
10
|
+
const methodColor = method in METHOD_COLORS ? METHOD_COLORS[method] : "white";
|
|
10
11
|
const now = /* @__PURE__ */ new Date();
|
|
11
|
-
let line = `[${
|
|
12
|
+
let line = `[${styleText([statusColor], statusCode.toString())}] `;
|
|
12
13
|
line += `[${now.toLocaleString()}] `;
|
|
13
|
-
line +=
|
|
14
|
-
"
|
|
14
|
+
line += styleText([
|
|
15
|
+
"bold",
|
|
15
16
|
methodColor
|
|
16
17
|
], method) + " ";
|
|
17
18
|
line += url;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/http",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.182",
|
|
4
4
|
"description": "## Installation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"mongodb": "^6.16.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@aeriajs/common": "^0.0.
|
|
33
|
-
"@aeriajs/entrypoint": "^0.0.
|
|
34
|
-
"@aeriajs/types": "^0.0.
|
|
35
|
-
"@aeriajs/validation": "^0.0.
|
|
32
|
+
"@aeriajs/common": "^0.0.151",
|
|
33
|
+
"@aeriajs/entrypoint": "^0.0.156",
|
|
34
|
+
"@aeriajs/types": "^0.0.129",
|
|
35
|
+
"@aeriajs/validation": "^0.0.169",
|
|
36
36
|
"mongodb": "^6.16.0"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|