@aeriajs/server 0.0.266 → 0.0.268
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/warmup.js +12 -11
- package/dist/warmup.mjs +10 -9
- package/package.json +9 -9
package/dist/warmup.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.warmup = void 0;
|
|
4
|
-
const
|
|
4
|
+
const types_1 = require("@aeriajs/types");
|
|
5
5
|
const core_1 = require("@aeriajs/core");
|
|
6
6
|
const entrypoint_1 = require("@aeriajs/entrypoint");
|
|
7
|
+
const node_util_1 = require("node:util");
|
|
7
8
|
const colorizedRoute = async (method, endpointUri, endpoint) => {
|
|
8
9
|
const config = await (0, entrypoint_1.getConfig)();
|
|
9
|
-
const color = method in
|
|
10
|
-
?
|
|
11
|
-
:
|
|
12
|
-
let rolesLine = '', hasContractLine = (0,
|
|
10
|
+
const color = method in types_1.METHOD_COLORS
|
|
11
|
+
? types_1.METHOD_COLORS[method]
|
|
12
|
+
: 'white';
|
|
13
|
+
let rolesLine = '', hasContractLine = (0, node_util_1.styleText)(['yellow'], 'x');
|
|
13
14
|
if (endpoint) {
|
|
14
15
|
if ('roles' in endpoint) {
|
|
15
16
|
const roles = await (async () => {
|
|
@@ -24,21 +25,21 @@ const colorizedRoute = async (method, endpointUri, endpoint) => {
|
|
|
24
25
|
}
|
|
25
26
|
return endpoint.roles;
|
|
26
27
|
})();
|
|
27
|
-
rolesLine = ` ${(0,
|
|
28
|
+
rolesLine = ` ${(0, node_util_1.styleText)(['grey'], `[${roles.join('|')}]`)}`;
|
|
28
29
|
}
|
|
29
30
|
if ('response' in endpoint || endpoint.builtin) {
|
|
30
|
-
hasContractLine = (0,
|
|
31
|
+
hasContractLine = (0, node_util_1.styleText)(['green'], '✓');
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
let line = (0,
|
|
34
|
-
'
|
|
34
|
+
let line = (0, node_util_1.styleText)([
|
|
35
|
+
'bold',
|
|
35
36
|
color,
|
|
36
37
|
], method) + '\t';
|
|
37
38
|
line += hasContractLine;
|
|
38
|
-
line += (0,
|
|
39
|
+
line += (0, node_util_1.styleText)(['grey'], ` ${config.baseUrl === '/'
|
|
39
40
|
? ''
|
|
40
41
|
: config.baseUrl}`);
|
|
41
|
-
line += (0,
|
|
42
|
+
line += (0, node_util_1.styleText)(['bold'], endpointUri);
|
|
42
43
|
line += rolesLine;
|
|
43
44
|
return line;
|
|
44
45
|
};
|
package/dist/warmup.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
2
|
+
import { METHOD_COLORS } from "@aeriajs/types";
|
|
3
3
|
import { getEndpoints } from "@aeriajs/core";
|
|
4
4
|
import { getConfig, getAvailableRoles } from "@aeriajs/entrypoint";
|
|
5
|
+
import { styleText } from "node:util";
|
|
5
6
|
const colorizedRoute = async (method, endpointUri, endpoint) => {
|
|
6
7
|
const config = await getConfig();
|
|
7
|
-
const color = method in METHOD_COLORS ? METHOD_COLORS[method] :
|
|
8
|
-
let rolesLine = "", hasContractLine =
|
|
8
|
+
const color = method in METHOD_COLORS ? METHOD_COLORS[method] : "white";
|
|
9
|
+
let rolesLine = "", hasContractLine = styleText(["yellow"], "x");
|
|
9
10
|
if (endpoint) {
|
|
10
11
|
if ("roles" in endpoint) {
|
|
11
12
|
const roles = await (async () => {
|
|
@@ -23,19 +24,19 @@ const colorizedRoute = async (method, endpointUri, endpoint) => {
|
|
|
23
24
|
}
|
|
24
25
|
return endpoint.roles;
|
|
25
26
|
})();
|
|
26
|
-
rolesLine = ` ${
|
|
27
|
+
rolesLine = ` ${styleText(["grey"], `[${roles.join("|")}]`)}`;
|
|
27
28
|
}
|
|
28
29
|
if ("response" in endpoint || endpoint.builtin) {
|
|
29
|
-
hasContractLine =
|
|
30
|
+
hasContractLine = styleText(["green"], "\u2713");
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
|
-
let line =
|
|
33
|
-
"
|
|
33
|
+
let line = styleText([
|
|
34
|
+
"bold",
|
|
34
35
|
color
|
|
35
36
|
], method) + " ";
|
|
36
37
|
line += hasContractLine;
|
|
37
|
-
line +=
|
|
38
|
-
line +=
|
|
38
|
+
line += styleText(["grey"], ` ${config.baseUrl === "/" ? "" : config.baseUrl}`);
|
|
39
|
+
line += styleText(["bold"], endpointUri);
|
|
39
40
|
line += rolesLine;
|
|
40
41
|
return line;
|
|
41
42
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.268",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"mongodb": "^6.16.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@aeriajs/core": "^0.0.
|
|
37
|
-
"@aeriajs/builtins": "^0.0.
|
|
38
|
-
"@aeriajs/common": "^0.0.
|
|
39
|
-
"@aeriajs/entrypoint": "^0.0.
|
|
40
|
-
"@aeriajs/http": "^0.0.
|
|
41
|
-
"@aeriajs/node-http": "^0.0.
|
|
42
|
-
"@aeriajs/server": "^0.0.
|
|
43
|
-
"@aeriajs/types": "^0.0.
|
|
36
|
+
"@aeriajs/core": "^0.0.266",
|
|
37
|
+
"@aeriajs/builtins": "^0.0.266",
|
|
38
|
+
"@aeriajs/common": "^0.0.151",
|
|
39
|
+
"@aeriajs/entrypoint": "^0.0.156",
|
|
40
|
+
"@aeriajs/http": "^0.0.182",
|
|
41
|
+
"@aeriajs/node-http": "^0.0.182",
|
|
42
|
+
"@aeriajs/server": "^0.0.268",
|
|
43
|
+
"@aeriajs/types": "^0.0.129",
|
|
44
44
|
"mongodb": "^6.16.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|