@neutron-build/ops 0.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.
- package/LICENSE +21 -0
- package/README.md +25 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +185 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tyler
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @neutron-build/ops
|
|
2
|
+
|
|
3
|
+
Observability and operations middleware for Neutron.
|
|
4
|
+
|
|
5
|
+
Request logging, error tracking, and health monitoring.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @neutron-build/ops
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { opsMiddleware } from "@neutron-build/ops";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Documentation
|
|
20
|
+
|
|
21
|
+
[neutron.build](https://neutron.build)
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
|
|
25
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AppContext, MiddlewareFn, NeutronServerHooks } from "@neutron-build/core";
|
|
2
|
+
export interface RequestContextMiddlewareOptions {
|
|
3
|
+
requestIdHeader?: string;
|
|
4
|
+
responseHeader?: string;
|
|
5
|
+
requestIdContextKey?: string;
|
|
6
|
+
traceIdContextKey?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface HealthcheckMiddlewareOptions {
|
|
9
|
+
healthPath?: string;
|
|
10
|
+
readyPath?: string;
|
|
11
|
+
ready?: () => Promise<boolean> | boolean;
|
|
12
|
+
service?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface JsonLoggingHooksOptions {
|
|
15
|
+
logger?: {
|
|
16
|
+
info: (line: string) => void;
|
|
17
|
+
error: (line: string) => void;
|
|
18
|
+
};
|
|
19
|
+
baseFields?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
export declare function createRequestContextMiddleware(options?: RequestContextMiddlewareOptions): MiddlewareFn;
|
|
22
|
+
export declare function createHealthcheckMiddleware(options?: HealthcheckMiddlewareOptions): MiddlewareFn;
|
|
23
|
+
export declare function createJsonLoggingHooks(options?: JsonLoggingHooksOptions): NeutronServerHooks;
|
|
24
|
+
export declare function getRequestIdFromContext(context: AppContext, contextKey?: string): string | null;
|
|
25
|
+
export declare function getTraceIdFromContext(context: AppContext, contextKey?: string): string | null;
|
|
26
|
+
export declare function mergeNeutronHooks(base: NeutronServerHooks | undefined, extra: NeutronServerHooks | undefined): NeutronServerHooks | undefined;
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EAGZ,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,+BAA+B;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QAC7B,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;KAC/B,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAKD,wBAAgB,8BAA8B,CAC5C,OAAO,GAAE,+BAAoC,GAC5C,YAAY,CAuBd;AAED,wBAAgB,2BAA2B,CACzC,OAAO,GAAE,4BAAiC,GACzC,YAAY,CAiCd;AAED,wBAAgB,sBAAsB,CACpC,OAAO,GAAE,uBAA4B,GACpC,kBAAkB,CAsCpB;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,UAAU,EACnB,UAAU,GAAE,MAAuC,GAClD,MAAM,GAAG,IAAI,CAGf;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,UAAU,EACnB,UAAU,GAAE,MAAqC,GAChD,MAAM,GAAG,IAAI,CAGf;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,kBAAkB,GAAG,SAAS,EACpC,KAAK,EAAE,kBAAkB,GAAG,SAAS,GACpC,kBAAkB,GAAG,SAAS,CAoBhC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
const DEFAULT_REQUEST_ID_CONTEXT_KEY = "requestId";
|
|
2
|
+
const DEFAULT_TRACE_ID_CONTEXT_KEY = "traceId";
|
|
3
|
+
export function createRequestContextMiddleware(options = {}) {
|
|
4
|
+
const requestIdHeader = (options.requestIdHeader || "x-request-id").toLowerCase();
|
|
5
|
+
const responseHeader = options.responseHeader || "x-request-id";
|
|
6
|
+
const requestIdContextKey = options.requestIdContextKey || DEFAULT_REQUEST_ID_CONTEXT_KEY;
|
|
7
|
+
const traceIdContextKey = options.traceIdContextKey || DEFAULT_TRACE_ID_CONTEXT_KEY;
|
|
8
|
+
return async (request, context, next) => {
|
|
9
|
+
const existingRequestId = request.headers.get(requestIdHeader);
|
|
10
|
+
const requestId = existingRequestId || createRequestId();
|
|
11
|
+
const traceId = extractTraceId(request);
|
|
12
|
+
context[requestIdContextKey] = requestId;
|
|
13
|
+
if (traceId) {
|
|
14
|
+
context[traceIdContextKey] = traceId;
|
|
15
|
+
}
|
|
16
|
+
const response = await next();
|
|
17
|
+
if (!response.headers.has(responseHeader)) {
|
|
18
|
+
response.headers.set(responseHeader, requestId);
|
|
19
|
+
}
|
|
20
|
+
return response;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function createHealthcheckMiddleware(options = {}) {
|
|
24
|
+
const healthPath = normalizePath(options.healthPath || "/healthz");
|
|
25
|
+
const readyPath = normalizePath(options.readyPath || "/readyz");
|
|
26
|
+
const service = options.service || "neutron-app";
|
|
27
|
+
return async (request, _context, next) => {
|
|
28
|
+
const pathname = normalizePath(new URL(request.url).pathname);
|
|
29
|
+
if (pathname === healthPath) {
|
|
30
|
+
return jsonResponse(200, {
|
|
31
|
+
ok: true,
|
|
32
|
+
status: "healthy",
|
|
33
|
+
service,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (pathname === readyPath) {
|
|
37
|
+
const isReady = options.ready ? await options.ready() : true;
|
|
38
|
+
if (!isReady) {
|
|
39
|
+
return jsonResponse(503, {
|
|
40
|
+
ok: false,
|
|
41
|
+
status: "not-ready",
|
|
42
|
+
service,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return jsonResponse(200, {
|
|
46
|
+
ok: true,
|
|
47
|
+
status: "ready",
|
|
48
|
+
service,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return await next();
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export function createJsonLoggingHooks(options = {}) {
|
|
55
|
+
const logger = options.logger || {
|
|
56
|
+
info: (line) => console.log(line),
|
|
57
|
+
error: (line) => console.error(line),
|
|
58
|
+
};
|
|
59
|
+
const base = options.baseFields || {};
|
|
60
|
+
return {
|
|
61
|
+
onRequestEnd(event) {
|
|
62
|
+
logger.info(JSON.stringify({
|
|
63
|
+
level: "info",
|
|
64
|
+
event: "request.end",
|
|
65
|
+
...base,
|
|
66
|
+
...toRequestFields(event),
|
|
67
|
+
timestamp: new Date(event.endedAt).toISOString(),
|
|
68
|
+
}));
|
|
69
|
+
},
|
|
70
|
+
onError(event) {
|
|
71
|
+
logger.error(JSON.stringify({
|
|
72
|
+
level: "error",
|
|
73
|
+
event: "request.error",
|
|
74
|
+
...base,
|
|
75
|
+
requestId: event.requestId,
|
|
76
|
+
method: event.method,
|
|
77
|
+
pathname: event.pathname,
|
|
78
|
+
source: event.source,
|
|
79
|
+
routeId: event.routeId,
|
|
80
|
+
routePath: event.routePath,
|
|
81
|
+
error: event.error.message,
|
|
82
|
+
stack: event.error.stack,
|
|
83
|
+
timestamp: new Date().toISOString(),
|
|
84
|
+
}));
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export function getRequestIdFromContext(context, contextKey = DEFAULT_REQUEST_ID_CONTEXT_KEY) {
|
|
89
|
+
const value = context[contextKey];
|
|
90
|
+
return typeof value === "string" ? value : null;
|
|
91
|
+
}
|
|
92
|
+
export function getTraceIdFromContext(context, contextKey = DEFAULT_TRACE_ID_CONTEXT_KEY) {
|
|
93
|
+
const value = context[contextKey];
|
|
94
|
+
return typeof value === "string" ? value : null;
|
|
95
|
+
}
|
|
96
|
+
export function mergeNeutronHooks(base, extra) {
|
|
97
|
+
if (!base && !extra) {
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
if (!base) {
|
|
101
|
+
return extra;
|
|
102
|
+
}
|
|
103
|
+
if (!extra) {
|
|
104
|
+
return base;
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
onRequestStart: chain(base.onRequestStart, extra.onRequestStart),
|
|
108
|
+
onRequestEnd: chain(base.onRequestEnd, extra.onRequestEnd),
|
|
109
|
+
onLoaderStart: chain(base.onLoaderStart, extra.onLoaderStart),
|
|
110
|
+
onLoaderEnd: chain(base.onLoaderEnd, extra.onLoaderEnd),
|
|
111
|
+
onActionStart: chain(base.onActionStart, extra.onActionStart),
|
|
112
|
+
onActionEnd: chain(base.onActionEnd, extra.onActionEnd),
|
|
113
|
+
onError: chain(base.onError, extra.onError),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function chain(left, right) {
|
|
117
|
+
if (!left && !right) {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
if (!left) {
|
|
121
|
+
return async (event) => {
|
|
122
|
+
await right?.(event);
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (!right) {
|
|
126
|
+
return async (event) => {
|
|
127
|
+
await left(event);
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
return async (event) => {
|
|
131
|
+
await left(event);
|
|
132
|
+
await right(event);
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function jsonResponse(status, payload) {
|
|
136
|
+
return new Response(JSON.stringify(payload), {
|
|
137
|
+
status,
|
|
138
|
+
headers: {
|
|
139
|
+
"content-type": "application/json; charset=utf-8",
|
|
140
|
+
"cache-control": "no-store",
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function toRequestFields(event) {
|
|
145
|
+
return {
|
|
146
|
+
requestId: event.requestId,
|
|
147
|
+
method: event.method,
|
|
148
|
+
url: event.url,
|
|
149
|
+
pathname: event.pathname,
|
|
150
|
+
status: event.status,
|
|
151
|
+
durationMs: event.durationMs,
|
|
152
|
+
routeId: event.routeId,
|
|
153
|
+
routePath: event.routePath,
|
|
154
|
+
routeMode: event.routeMode,
|
|
155
|
+
cacheState: event.cacheState,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function extractTraceId(request) {
|
|
159
|
+
const traceparent = request.headers.get("traceparent");
|
|
160
|
+
if (!traceparent) {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
const parts = traceparent.split("-");
|
|
164
|
+
if (parts.length < 4) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
const traceId = parts[1];
|
|
168
|
+
return /^[0-9a-f]{32}$/i.test(traceId) ? traceId : null;
|
|
169
|
+
}
|
|
170
|
+
function normalizePath(pathname) {
|
|
171
|
+
if (!pathname.startsWith("/")) {
|
|
172
|
+
return `/${pathname}`;
|
|
173
|
+
}
|
|
174
|
+
if (pathname.length > 1 && pathname.endsWith("/")) {
|
|
175
|
+
return pathname.slice(0, -1);
|
|
176
|
+
}
|
|
177
|
+
return pathname;
|
|
178
|
+
}
|
|
179
|
+
function createRequestId() {
|
|
180
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
181
|
+
return crypto.randomUUID();
|
|
182
|
+
}
|
|
183
|
+
return `req-${Date.now()}-${Math.random().toString(16).slice(2, 10)}`;
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA8BA,MAAM,8BAA8B,GAAG,WAAW,CAAC;AACnD,MAAM,4BAA4B,GAAG,SAAS,CAAC;AAE/C,MAAM,UAAU,8BAA8B,CAC5C,UAA2C,EAAE;IAE7C,MAAM,eAAe,GAAG,CAAC,OAAO,CAAC,eAAe,IAAI,cAAc,CAAC,CAAC,WAAW,EAAE,CAAC;IAClF,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,cAAc,CAAC;IAChE,MAAM,mBAAmB,GACvB,OAAO,CAAC,mBAAmB,IAAI,8BAA8B,CAAC;IAChE,MAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,IAAI,4BAA4B,CAAC;IAEpF,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACtC,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QAC/D,MAAM,SAAS,GAAG,iBAAiB,IAAI,eAAe,EAAE,CAAC;QACzD,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;QAExC,OAAO,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAC;QACzC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC;QACvC,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;YAC1C,QAAQ,CAAC,OAAO,CAAC,GAAG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AK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AACxE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@neutron-build/ops",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Observability middleware for Neutron. Request tracing, health checks, and structured JSON logging.",
|
|
5
|
+
"author": "Tyler",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://neutron.build",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/neutron-build/neutron",
|
|
11
|
+
"directory": "typescript/packages/neutron-ops"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"neutron",
|
|
15
|
+
"observability",
|
|
16
|
+
"health-check",
|
|
17
|
+
"logging",
|
|
18
|
+
"request-id"
|
|
19
|
+
],
|
|
20
|
+
"type": "module",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"!dist/**/*.test.*"
|
|
30
|
+
],
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@neutron-build/core": "0.1.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^22.10.7",
|
|
36
|
+
"typescript": "^5.7.2"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=20"
|
|
44
|
+
},
|
|
45
|
+
"sideEffects": false,
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsc",
|
|
48
|
+
"dev": "tsc --watch",
|
|
49
|
+
"lint": "tsc --noEmit --pretty false",
|
|
50
|
+
"test": "pnpm run build && node --test --experimental-test-isolation=none dist/index.test.js"
|
|
51
|
+
}
|
|
52
|
+
}
|