@aeriajs/server 0.0.232 → 0.0.234
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/init.d.ts +3 -4
- package/dist/routes.d.ts +1 -1
- package/dist/warmup.js +7 -8
- package/dist/warmup.mjs +14 -15
- package/package.json +9 -9
package/dist/init.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { RouteContext, Collection, GenericRequest, ApiConfig, AuthenticatedToken, NonCircularJsonSchema } from '@aeriajs/types';
|
|
2
|
-
import { ACError, HTTPStatus } from '@aeriajs/types';
|
|
3
2
|
import { type createRouter } from '@aeriajs/http';
|
|
4
3
|
import { DEFAULT_API_CONFIG } from './constants.js';
|
|
5
4
|
type DeepPartial<T> = T extends object ? {
|
|
@@ -18,7 +17,7 @@ export type InitOptions = {
|
|
|
18
17
|
export declare const getToken: (request: GenericRequest, context: RouteContext) => Promise<{
|
|
19
18
|
readonly _tag: "Result";
|
|
20
19
|
readonly error: undefined;
|
|
21
|
-
readonly result: import("@aeriajs/types").UnauthenticatedToken | AuthenticatedToken<
|
|
20
|
+
readonly result: import("@aeriajs/types").UnauthenticatedToken | AuthenticatedToken<true, import("@aeriajs/types").UserRole, Omit<import("@aeriajs/types").SchemaWithId<{
|
|
22
21
|
readonly $id: "user";
|
|
23
22
|
readonly icon: "users";
|
|
24
23
|
readonly required: readonly ["name", "roles", "email"];
|
|
@@ -126,8 +125,8 @@ export declare const getToken: (request: GenericRequest, context: RouteContext)
|
|
|
126
125
|
} | {
|
|
127
126
|
readonly _tag: "Error";
|
|
128
127
|
readonly error: {
|
|
129
|
-
readonly httpStatus:
|
|
130
|
-
readonly code:
|
|
128
|
+
readonly httpStatus: 401;
|
|
129
|
+
readonly code: "AUTHENTICATION_ERROR";
|
|
131
130
|
};
|
|
132
131
|
readonly result: undefined;
|
|
133
132
|
}>;
|
package/dist/routes.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { RouteContext } from '@aeriajs/types';
|
|
|
2
2
|
export declare const registerRoutes: () => import("@aeriajs/http").ProxiedRouter<{
|
|
3
3
|
route: <const TContractWithRoles extends import("@aeriajs/types").ContractWithRoles, TCallback extends (TContractWithRoles extends {
|
|
4
4
|
response: infer Response;
|
|
5
|
-
} ? import("@aeriajs/types").InferProperties<Response> : unknown) extends infer Response ? (context: Omit<RouteContext<
|
|
5
|
+
} ? import("@aeriajs/types").InferProperties<Response> : unknown) extends infer Response ? (context: Omit<RouteContext<TContractWithRoles["roles"]>, "request"> & {
|
|
6
6
|
request: Omit<import("@aeriajs/types").GenericRequest, "payload" | "query"> & {
|
|
7
7
|
payload: TContractWithRoles extends {
|
|
8
8
|
payload: infer Payload;
|
package/dist/warmup.js
CHANGED
|
@@ -3,14 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.warmup = void 0;
|
|
4
4
|
const core_1 = require("@aeriajs/core");
|
|
5
5
|
const entrypoint_1 = require("@aeriajs/entrypoint");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
})(AnsiColor || (AnsiColor = {}));
|
|
6
|
+
const AnsiColor = {
|
|
7
|
+
Green: '[32m',
|
|
8
|
+
Yellow: '[33m',
|
|
9
|
+
Blue: '[36m',
|
|
10
|
+
Red: '[31m',
|
|
11
|
+
White: '[37m',
|
|
12
|
+
};
|
|
14
13
|
const METHOD_COLORS = {
|
|
15
14
|
GET: AnsiColor.Green,
|
|
16
15
|
PUT: AnsiColor.Blue,
|
package/dist/warmup.mjs
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { getEndpoints } from "@aeriajs/core";
|
|
3
3
|
import { getConfig, getAvailableRoles } from "@aeriajs/entrypoint";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
})(AnsiColor || {});
|
|
4
|
+
const AnsiColor = {
|
|
5
|
+
Green: "[32m",
|
|
6
|
+
Yellow: "[33m",
|
|
7
|
+
Blue: "[36m",
|
|
8
|
+
Red: "[31m",
|
|
9
|
+
White: "[37m"
|
|
10
|
+
};
|
|
12
11
|
const METHOD_COLORS = {
|
|
13
|
-
GET:
|
|
14
|
-
PUT:
|
|
15
|
-
POST:
|
|
16
|
-
DELETE:
|
|
12
|
+
GET: AnsiColor.Green,
|
|
13
|
+
PUT: AnsiColor.Blue,
|
|
14
|
+
POST: AnsiColor.White,
|
|
15
|
+
DELETE: AnsiColor.Red
|
|
17
16
|
};
|
|
18
17
|
const escape = (code, text) => {
|
|
19
18
|
const codeStr = Array.isArray(code) ? code.map((c) => `\x1B${c}`).join("") : `\x1B${code}`;
|
|
@@ -21,8 +20,8 @@ const escape = (code, text) => {
|
|
|
21
20
|
};
|
|
22
21
|
const colorizedRoute = async (method, endpointUri, endpoint) => {
|
|
23
22
|
const config = await getConfig();
|
|
24
|
-
const color = method in METHOD_COLORS ? METHOD_COLORS[method] :
|
|
25
|
-
let rolesLine = "", hasContractLine = escape(
|
|
23
|
+
const color = method in METHOD_COLORS ? METHOD_COLORS[method] : AnsiColor.White;
|
|
24
|
+
let rolesLine = "", hasContractLine = escape(AnsiColor.Yellow, "x");
|
|
26
25
|
if (endpoint) {
|
|
27
26
|
if ("roles" in endpoint) {
|
|
28
27
|
const roles = await (async () => {
|
|
@@ -43,7 +42,7 @@ const colorizedRoute = async (method, endpointUri, endpoint) => {
|
|
|
43
42
|
rolesLine = ` ${escape("[90m", `[${roles.join("|")}]`)}`;
|
|
44
43
|
}
|
|
45
44
|
if ("response" in endpoint || endpoint.builtin) {
|
|
46
|
-
hasContractLine = escape(
|
|
45
|
+
hasContractLine = escape(AnsiColor.Green, "\u2713");
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
let line = escape([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.234",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"mongodb": "^6.5.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.232",
|
|
37
|
+
"@aeriajs/builtins": "^0.0.232",
|
|
38
|
+
"@aeriajs/common": "^0.0.132",
|
|
39
|
+
"@aeriajs/entrypoint": "^0.0.136",
|
|
40
|
+
"@aeriajs/http": "^0.0.160",
|
|
41
|
+
"@aeriajs/node-http": "^0.0.160",
|
|
42
|
+
"@aeriajs/server": "^0.0.234",
|
|
43
|
+
"@aeriajs/types": "^0.0.114",
|
|
44
44
|
"mongodb": "^6.5.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|