@mpen/routekit 0.1.6 → 0.1.7
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.
|
@@ -3,11 +3,12 @@ import { CommonContentTypes, CommonHeaders, HttpStatus } from "@mpen/http";
|
|
|
3
3
|
//#region src/router/lib/fullwide.ts
|
|
4
4
|
const FULL_WIDE_FORMAT = new Intl.NumberFormat("en-US", {
|
|
5
5
|
useGrouping: false,
|
|
6
|
-
|
|
6
|
+
notation: "standard",
|
|
7
|
+
maximumFractionDigits: 100
|
|
7
8
|
});
|
|
8
9
|
const DECIMAL_STRING = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
|
|
9
|
-
const
|
|
10
|
-
const
|
|
10
|
+
const MAX_INTEGER_STRING = String(Number.MAX_SAFE_INTEGER + 1);
|
|
11
|
+
const MIN_INTEGER_STRING = String(Number.MIN_SAFE_INTEGER - 1);
|
|
11
12
|
/**
|
|
12
13
|
* Formats a number with full decimal places.
|
|
13
14
|
*
|
|
@@ -18,13 +19,13 @@ const MIN_SAFE_INTEGER_STRING = String(Number.MIN_SAFE_INTEGER);
|
|
|
18
19
|
function fullWide(n) {
|
|
19
20
|
if (typeof n === "bigint") return n.toString();
|
|
20
21
|
if (typeof n === "string") {
|
|
21
|
-
if (n === "Infinity" || n === "+Infinity") return
|
|
22
|
-
if (n === "-Infinity") return
|
|
22
|
+
if (n === "Infinity" || n === "+Infinity") return MAX_INTEGER_STRING;
|
|
23
|
+
if (n === "-Infinity") return MIN_INTEGER_STRING;
|
|
23
24
|
if (!DECIMAL_STRING.test(n)) return "0";
|
|
24
25
|
return FULL_WIDE_FORMAT.format(n);
|
|
25
26
|
}
|
|
26
|
-
if (n === Number.POSITIVE_INFINITY) return
|
|
27
|
-
if (n === Number.NEGATIVE_INFINITY) return
|
|
27
|
+
if (n === Number.POSITIVE_INFINITY) return MAX_INTEGER_STRING;
|
|
28
|
+
if (n === Number.NEGATIVE_INFINITY) return MIN_INTEGER_STRING;
|
|
28
29
|
if (!Number.isFinite(n)) return "0";
|
|
29
30
|
return FULL_WIDE_FORMAT.format(n);
|
|
30
31
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { A as stream, B as parseMediaType, C as isChunkDirective, D as isStatusDirective, E as isRoutekitDirective, F as mediaRangeToContentType, I as mediaTypeMatches, L as normalizeMediaType, N as mediaRangeAccepts, O as isStreamDirective, P as mediaRangeQuality, R as parseAcceptHeader, S as headers, T as isHeadersDirective, _ as jsonResponseBodySerializer, a as createRoutekitRequest, b as chunk, c as jsonRequestBodyParser, d as urlEncodedRequestBodyParser, f as defineMiddleware, g as defaultResponseBodySerializers, h as createStartStream, i as UnsupportedRequestBodyMediaTypeError, j as mergeRouteSchemas, k as status, l as responseFromRequestBodyError, m as createAsyncStream, n as RequestBodyLengthMismatchError, o as defaultRequestBodyParsers, p as isDeclaredMiddleware, r as RequestBodyTooLargeError, s as formDataRequestBodyParser, t as RequestBodyError, u as textRequestBodyParser, v as jsonLinesFramer, w as isHeadDirective, x as head, y as sseFramer, z as parseContentType } from "./request-Dn0zc-xm.mjs";
|
|
2
2
|
import { a as response, i as isRoutekitResponse, n as isResponseBodyInit, r as isRoutekitBody, t as body } from "./core-DbmQauwS.mjs";
|
|
3
|
-
import { a as text } from "./content-
|
|
3
|
+
import { a as text } from "./content-BJ7JUxmo.mjs";
|
|
4
4
|
import { CommonHeaders, HttpMethod, HttpStatus, StatusText } from "@mpen/http";
|
|
5
5
|
import { ConsoleLogger } from "@mpen/logger";
|
|
6
6
|
//#region src/router/lib/pathname.ts
|
|
@@ -582,6 +582,7 @@ var Router = class Router {
|
|
|
582
582
|
logger: config.logger.withContext({
|
|
583
583
|
"http.request.method": request.method,
|
|
584
584
|
"url.path": url.pathname,
|
|
585
|
+
"url.query": url.search,
|
|
585
586
|
...routePath == null ? {} : { "http.route": routePath }
|
|
586
587
|
})
|
|
587
588
|
};
|
package/dist/middleware.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as isChunkDirective, O as isStreamDirective, R as parseAcceptHeader, S as headers, T as isHeadersDirective, f as defineMiddleware, n as RequestBodyLengthMismatchError, r as RequestBodyTooLargeError, w as isHeadDirective } from "./request-Dn0zc-xm.mjs";
|
|
2
2
|
import { a as response, i as isRoutekitResponse, n as isResponseBodyInit } from "./core-DbmQauwS.mjs";
|
|
3
|
-
import { a as text, t as empty } from "./content-
|
|
3
|
+
import { a as text, t as empty } from "./content-BJ7JUxmo.mjs";
|
|
4
4
|
import { CommonHeaders, HttpMethod, HttpStatus } from "@mpen/http";
|
|
5
5
|
import { LogLevel } from "@mpen/logger";
|
|
6
6
|
//#region src/router/middleware/request-id-ctx.ts
|
|
@@ -133,13 +133,16 @@ const formatRoutekitTerminalLogRecord = (record, terminal) => {
|
|
|
133
133
|
const path = getStringContext(record, "url.path");
|
|
134
134
|
const route = getStringContext(record, "http.route");
|
|
135
135
|
const direction = getActivityDirection(record);
|
|
136
|
+
const query = getStringContext(record, "url.query");
|
|
137
|
+
let formattedQuery = "";
|
|
138
|
+
if (query && query !== "?") formattedQuery = query.length > 40 ? query.slice(0, 39) + "…" : query;
|
|
136
139
|
const parts = [
|
|
137
140
|
formatServiceName(getStringContext(record, "service.name"), colors),
|
|
138
141
|
requestId == null ? void 0 : formatRequestId(requestId, colors),
|
|
139
142
|
requestId == null ? void 0 : formatDirection(direction, colors),
|
|
140
143
|
requestId == null ? formatDirection(direction, colors) : void 0,
|
|
141
144
|
colors.bold(colors.whiteBright(method)),
|
|
142
|
-
colors.white(path),
|
|
145
|
+
colors.white(path) + (formattedQuery ? colors.blackBright(formattedQuery) : ""),
|
|
143
146
|
route == null || route === path ? void 0 : colors.blackBright(`route=${route}`),
|
|
144
147
|
formatStatusCode(getNumberContext(context["http.response.status_code"]), colors),
|
|
145
148
|
formatDuration(getNumberContext(context.duration_ms), colors),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as text, i as html, n as noContent, r as redirect, t as empty } from "../content-
|
|
1
|
+
import { a as text, i as html, n as noContent, r as redirect, t as empty } from "../content-BJ7JUxmo.mjs";
|
|
2
2
|
export { empty, html, noContent, redirect, text };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpen/routekit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Typed server-side routing utilities for Fetch-compatible runtimes.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.mjs",
|
|
@@ -81,9 +81,9 @@
|
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
83
|
"publishHash": {
|
|
84
|
-
"buildDate": "2026-05-
|
|
85
|
-
"hgChangesetId": "
|
|
86
|
-
"sha256": "
|
|
84
|
+
"buildDate": "2026-05-31T22:59:15.576-07:00",
|
|
85
|
+
"hgChangesetId": "1e963bb2c32c",
|
|
86
|
+
"sha256": "b6e554ee7a2da74845b44c77bc0895fdd28e40373379647b2de526cb3c830ffd"
|
|
87
87
|
},
|
|
88
88
|
"inlinedDependencies": {
|
|
89
89
|
"@apidevtools/json-schema-ref-parser": "11.9.3",
|