@forinda/kickjs-http 0.7.0 → 1.1.0

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.
@@ -1,87 +0,0 @@
1
- import { AppAdapter, Ref, ComputedRef, Container, AdapterMiddleware } from '@forinda/kickjs-core';
2
-
3
- /** Per-route latency stats */
4
- interface RouteStats {
5
- count: number;
6
- totalMs: number;
7
- minMs: number;
8
- maxMs: number;
9
- }
10
- interface DevToolsOptions {
11
- /** Base path for debug endpoints (default: '/_debug') */
12
- basePath?: string;
13
- /** Only enable when this is true (default: process.env.NODE_ENV !== 'production') */
14
- enabled?: boolean;
15
- /** Include environment variables (sanitized) at /_debug/config (default: false) */
16
- exposeConfig?: boolean;
17
- /** Env var prefixes to expose (default: ['APP_', 'NODE_ENV']). Others are redacted. */
18
- configPrefixes?: string[];
19
- /** Callback when error rate exceeds threshold */
20
- onErrorRateExceeded?: (rate: number) => void;
21
- /** Error rate threshold (default: 0.5 = 50%) */
22
- errorRateThreshold?: number;
23
- /** Other adapters to discover stats from (e.g., WsAdapter) */
24
- adapters?: any[];
25
- }
26
- /**
27
- * DevToolsAdapter — Vue-style reactive introspection for KickJS applications.
28
- *
29
- * Exposes debug endpoints powered by reactive state (ref, computed, watch):
30
- * - `GET /_debug/routes` — all registered routes with middleware
31
- * - `GET /_debug/container` — DI registry with scopes and instantiation status
32
- * - `GET /_debug/metrics` — live request/error counts, error rate, uptime
33
- * - `GET /_debug/health` — deep health check with adapter status
34
- * - `GET /_debug/config` — sanitized environment variables (opt-in)
35
- * - `GET /_debug/state` — full reactive state snapshot
36
- *
37
- * @example
38
- * ```ts
39
- * import { DevToolsAdapter } from '@forinda/kickjs-http/devtools'
40
- *
41
- * bootstrap({
42
- * modules: [UserModule],
43
- * adapters: [
44
- * new DevToolsAdapter({
45
- * enabled: process.env.NODE_ENV !== 'production',
46
- * exposeConfig: true,
47
- * configPrefixes: ['APP_', 'DATABASE_'],
48
- * }),
49
- * ],
50
- * })
51
- * ```
52
- */
53
- declare class DevToolsAdapter implements AppAdapter {
54
- readonly name = "DevToolsAdapter";
55
- private basePath;
56
- private enabled;
57
- private exposeConfig;
58
- private configPrefixes;
59
- private errorRateThreshold;
60
- /** Total requests received */
61
- readonly requestCount: Ref<number>;
62
- /** Total responses with status >= 500 */
63
- readonly errorCount: Ref<number>;
64
- /** Total responses with status >= 400 and < 500 */
65
- readonly clientErrorCount: Ref<number>;
66
- /** Server start time */
67
- readonly startedAt: Ref<number>;
68
- /** Computed error rate (server errors / total requests) */
69
- readonly errorRate: ComputedRef<number>;
70
- /** Computed uptime in seconds */
71
- readonly uptimeSeconds: ComputedRef<number>;
72
- /** Per-route latency tracking */
73
- readonly routeLatency: Record<string, RouteStats>;
74
- private routes;
75
- private container;
76
- private adapterStatuses;
77
- private stopErrorWatch;
78
- private peerAdapters;
79
- constructor(options?: DevToolsOptions);
80
- beforeMount(app: any, container: Container): void;
81
- middleware(): AdapterMiddleware[];
82
- onRouteMount(controllerClass: any, mountPath: string): void;
83
- afterStart(_server: any, _container: Container): void;
84
- shutdown(): void;
85
- }
86
-
87
- export { DevToolsAdapter, type DevToolsOptions };
package/dist/devtools.js DELETED
@@ -1,8 +0,0 @@
1
- import {
2
- DevToolsAdapter
3
- } from "./chunk-PLKCXCBN.js";
4
- import "./chunk-WCQVDF3K.js";
5
- export {
6
- DevToolsAdapter
7
- };
8
- //# sourceMappingURL=devtools.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}