monten 0.1.4 → 0.1.5

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/README.md CHANGED
@@ -71,7 +71,7 @@ pnpm add monten
71
71
 
72
72
  ```ts
73
73
  import express from 'express'
74
- import { initObservability, httpObservabilityMiddleware } from 'monten'
74
+ import { initObservability, monten } from 'monten'
75
75
 
76
76
  const app = express()
77
77
 
@@ -83,7 +83,7 @@ initObservability({
83
83
  })
84
84
 
85
85
  // Add middleware (single line!)
86
- app.use(httpObservabilityMiddleware())
86
+ app.use(monten())
87
87
 
88
88
  app.get('/health', (_req, res) => {
89
89
  res.status(200).json({ ok: true })
@@ -132,12 +132,12 @@ initObservability({
132
132
  })
133
133
  ```
134
134
 
135
- ### `httpObservabilityMiddleware()`
135
+ ### `monten()`
136
136
 
137
137
  Express middleware that captures request timing, errors, and emits logs/metrics.
138
138
 
139
139
  ```ts
140
- app.use(httpObservabilityMiddleware())
140
+ app.use(monten())
141
141
  ```
142
142
 
143
143
  ### `withDbTiming<T>(fn: () => Promise<T>): Promise<T>`
@@ -175,7 +175,7 @@ Each request produces a structured JSON log entry:
175
175
  ┌─────────────────────────────────────────────────────────┐
176
176
  │ Express App │
177
177
  ├─────────────────────────────────────────────────────────┤
178
- httpObservabilityMiddleware()
178
+ monten()
179
179
  │ ┌───────────────────────────────────────────────────┐ │
180
180
  │ │ AsyncLocalStorage Context │ │
181
181
  │ │ • requestId │ │
@@ -201,7 +201,7 @@ Each request produces a structured JSON log entry:
201
201
  This library is designed to be fully removable:
202
202
 
203
203
  1. Remove `initObservability()` call
204
- 2. Remove `app.use(httpObservabilityMiddleware())`
204
+ 2. Remove `app.use(monten())`
205
205
  3. Remove `withDbTiming()` wrappers (just call the inner function directly)
206
206
 
207
207
  Your application will continue to function normally.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import type { ObservabilityInitConfig } from './types';
2
2
  export declare function initObservability(config: ObservabilityInitConfig): void;
3
- export declare function httpObservabilityMiddleware(): (req: any, res: any, next: (err?: any) => void) => void;
3
+ export declare function monten(): (req: any, res: any, next: (err?: any) => void) => void;
4
4
  export declare function withDbTiming<T>(fn: () => Promise<T>): Promise<T>;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initObservability = initObservability;
4
- exports.httpObservabilityMiddleware = httpObservabilityMiddleware;
4
+ exports.monten = monten;
5
5
  exports.withDbTiming = withDbTiming;
6
6
  const observability_config_1 = require("./config/observability.config");
7
7
  const httpMiddleware_1 = require("./middleware/httpMiddleware");
@@ -9,8 +9,8 @@ const dbTimer_1 = require("./db/dbTimer");
9
9
  function initObservability(config) {
10
10
  (0, observability_config_1.initObservabilityInternal)(config);
11
11
  }
12
- function httpObservabilityMiddleware() {
13
- return (0, httpMiddleware_1.httpObservabilityMiddleware)();
12
+ function monten() {
13
+ return (0, httpMiddleware_1.monten)();
14
14
  }
15
15
  function withDbTiming(fn) {
16
16
  return (0, dbTimer_1.withDbTiming)(fn);
@@ -1 +1 @@
1
- export declare function httpObservabilityMiddleware(): (req: any, res: any, next: (err?: any) => void) => void;
1
+ export declare function monten(): (req: any, res: any, next: (err?: any) => void) => void;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.httpObservabilityMiddleware = httpObservabilityMiddleware;
3
+ exports.monten = monten;
4
4
  const observability_config_1 = require("../config/observability.config");
5
5
  const requestContext_1 = require("../context/requestContext");
6
6
  const logger_1 = require("../logger/logger");
7
7
  const metricsBuffer_1 = require("../metrics/metricsBuffer");
8
8
  const time_1 = require("../utils/time");
9
9
  const uuid_1 = require("../utils/uuid");
10
- function httpObservabilityMiddleware() {
10
+ function monten() {
11
11
  return function httpMiddleware(req, res, next) {
12
12
  const cfg = (0, observability_config_1.getObservabilityConfig)();
13
13
  const requestId = (0, uuid_1.generateRequestId)();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monten",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Lightweight observability utilities for Express-based Node.js backends (experimental).",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",