@aeriajs/http 0.0.160 → 0.0.162
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/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/log.d.ts +2 -0
- package/dist/log.js +26 -0
- package/dist/log.mjs +19 -0
- package/package.json +5 -5
- package/dist/options.d.ts +0 -5
- package/dist/options.js +0 -7
- package/dist/options.mjs +0 -4
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -15,6 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./cors.js"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./log.js"), exports);
|
|
19
19
|
__exportStar(require("./routing.js"), exports);
|
|
20
20
|
__exportStar(require("./payload.js"), exports);
|
package/dist/index.mjs
CHANGED
package/dist/log.d.ts
ADDED
package/dist/log.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logResponse = void 0;
|
|
4
|
+
const common_1 = require("@aeriajs/common");
|
|
5
|
+
const logResponse = (response) => {
|
|
6
|
+
const { statusCode, req: { method, url } } = response;
|
|
7
|
+
if (!method) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const statusColor = statusCode >= 400 && statusCode <= 599
|
|
11
|
+
? common_1.AnsiColor.Red
|
|
12
|
+
: common_1.AnsiColor.White;
|
|
13
|
+
const methodColor = method in common_1.METHOD_COLORS
|
|
14
|
+
? common_1.METHOD_COLORS[method]
|
|
15
|
+
: common_1.AnsiColor.White;
|
|
16
|
+
const now = new Date();
|
|
17
|
+
let line = `[${(0, common_1.escape)(statusColor, statusCode.toString())}] `;
|
|
18
|
+
line += `[${now.toLocaleString()}] `;
|
|
19
|
+
line += (0, common_1.escape)([
|
|
20
|
+
'[1m',
|
|
21
|
+
methodColor,
|
|
22
|
+
], method) + ' ';
|
|
23
|
+
line += url;
|
|
24
|
+
console.log(line);
|
|
25
|
+
};
|
|
26
|
+
exports.logResponse = logResponse;
|
package/dist/log.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { escape, AnsiColor, METHOD_COLORS } from "@aeriajs/common";
|
|
3
|
+
export const logResponse = (response) => {
|
|
4
|
+
const { statusCode, req: { method, url } } = response;
|
|
5
|
+
if (!method) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const statusColor = statusCode >= 400 && statusCode <= 599 ? AnsiColor.Red : AnsiColor.White;
|
|
9
|
+
const methodColor = method in METHOD_COLORS ? METHOD_COLORS[method] : AnsiColor.White;
|
|
10
|
+
const now = /* @__PURE__ */ new Date();
|
|
11
|
+
let line = `[${escape(statusColor, statusCode.toString())}] `;
|
|
12
|
+
line += `[${now.toLocaleString()}] `;
|
|
13
|
+
line += escape([
|
|
14
|
+
"[1m",
|
|
15
|
+
methodColor
|
|
16
|
+
], method) + " ";
|
|
17
|
+
line += url;
|
|
18
|
+
console.log(line);
|
|
19
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/http",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.162",
|
|
4
4
|
"description": "## Installation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"@aeriajs/validation": "link:../validation"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@aeriajs/common": "^0.0.
|
|
32
|
-
"@aeriajs/entrypoint": "^0.0.
|
|
33
|
-
"@aeriajs/types": "^0.0.
|
|
34
|
-
"@aeriajs/validation": "^0.0.
|
|
31
|
+
"@aeriajs/common": "^0.0.134",
|
|
32
|
+
"@aeriajs/entrypoint": "^0.0.138",
|
|
33
|
+
"@aeriajs/types": "^0.0.116",
|
|
34
|
+
"@aeriajs/validation": "^0.0.150"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"test": "vitest run",
|
package/dist/options.d.ts
DELETED
package/dist/options.js
DELETED
package/dist/options.mjs
DELETED