@zudojs/middleware 1.0.0 → 1.0.1

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.
@@ -6,8 +6,13 @@
6
6
  import { MiddlewareError, MiddlewareRateLimitError, MiddlewareTimeoutError, } from "../middlewareErrors/middlewareError.base.js";
7
7
  /** Longest field value written into a log line before truncation. */
8
8
  const MAX_LOG_FIELD_LENGTH = 256;
9
- /** Control characters, which are what let a value break out of its log line. */
10
- const CONTROL_CHARACTERS = /[\u0000-\u001F\u007F]/g;
9
+ /**
10
+ * Characters that let a value break out of its log line: the C0 and C1
11
+ * control ranges, plus the Unicode line and paragraph separators, which
12
+ * JavaScript and many log viewers treat as line terminators even though
13
+ * they are not control characters.
14
+ */
15
+ const CONTROL_CHARACTERS = /[\u0000-\u001F\u007F-\u009F\u2028\u2029]/g;
11
16
  /**
12
17
  * Make a caller-supplied value safe to write into a single-line log.
13
18
  *
@@ -24,7 +29,10 @@ export function sanitizeLogValue(value, maxLength = MAX_LOG_FIELD_LENGTH) {
24
29
  return "\\r";
25
30
  if (char === "\t")
26
31
  return "\\t";
27
- return `\\x${char.charCodeAt(0).toString(16).padStart(2, "0")}`;
32
+ const code = char.charCodeAt(0);
33
+ return code <= 0xff
34
+ ? `\\x${code.toString(16).padStart(2, "0")}`
35
+ : `\\u${code.toString(16).padStart(4, "0")}`;
28
36
  });
29
37
  return escaped.length > maxLength
30
38
  ? `${escaped.slice(0, maxLength)}…`
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@zudojs/middleware",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Composable middleware pipeline with composition, timing, error handling, and context propagation.",
5
5
  "license": "MIT",
6
+ "author": {
7
+ "name": "Oluwayemi Oyinlola",
8
+ "url": "https://github.com/oyinlola-tech"
9
+ },
6
10
  "type": "module",
7
11
  "main": "./dist/index.js",
8
12
  "module": "./dist/index.js",
@@ -21,7 +25,7 @@
21
25
  "!dist/.tsbuildinfo"
22
26
  ],
23
27
  "dependencies": {
24
- "@zudojs/errors": "1.0.0"
28
+ "@zudojs/errors": "1.0.1"
25
29
  },
26
30
  "engines": {
27
31
  "node": ">=24.0.0"