@selvajs/server 0.2.0-beta.4 → 0.2.0-beta.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 +10 -2
- package/dist/compute/client-cache.d.ts +7 -0
- package/dist/compute/client-cache.d.ts.map +1 -1
- package/dist/compute/client-cache.js +6 -1
- package/dist/compute/client-cache.js.map +1 -1
- package/dist/compute/index.d.ts +2 -2
- package/dist/compute/index.d.ts.map +1 -1
- package/dist/compute/index.js +2 -2
- package/dist/compute/index.js.map +1 -1
- package/dist/compute/limits.d.ts +26 -5
- package/dist/compute/limits.d.ts.map +1 -1
- package/dist/compute/limits.js +51 -25
- package/dist/compute/limits.js.map +1 -1
- package/dist/compute/rate-limit.d.ts +40 -0
- package/dist/compute/rate-limit.d.ts.map +1 -1
- package/dist/compute/rate-limit.js +72 -1
- package/dist/compute/rate-limit.js.map +1 -1
- package/dist/compute/remote-definition.d.ts +7 -0
- package/dist/compute/remote-definition.d.ts.map +1 -1
- package/dist/compute/remote-definition.js +3 -1
- package/dist/compute/remote-definition.js.map +1 -1
- package/dist/compute/safe-url.d.ts +2 -1
- package/dist/compute/safe-url.d.ts.map +1 -1
- package/dist/compute/safe-url.js +18 -4
- package/dist/compute/safe-url.js.map +1 -1
- package/dist/compute/solve-cache-key.d.ts +5 -6
- package/dist/compute/solve-cache-key.d.ts.map +1 -1
- package/dist/compute/solve-cache-key.js +4 -3
- package/dist/compute/solve-cache-key.js.map +1 -1
- package/dist/compute/solve-pipeline.d.ts +31 -0
- package/dist/compute/solve-pipeline.d.ts.map +1 -1
- package/dist/compute/solve-pipeline.js +40 -1
- package/dist/compute/solve-pipeline.js.map +1 -1
- package/dist/definitions/load-for-render.d.ts +10 -1
- package/dist/definitions/load-for-render.d.ts.map +1 -1
- package/dist/definitions/load-for-render.js +33 -6
- package/dist/definitions/load-for-render.js.map +1 -1
- package/dist/logging/PinoLogger.d.ts +39 -0
- package/dist/logging/PinoLogger.d.ts.map +1 -0
- package/dist/logging/PinoLogger.js +189 -0
- package/dist/logging/PinoLogger.js.map +1 -0
- package/dist/logging/index.d.ts +3 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +5 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/requestId.d.ts +45 -0
- package/dist/logging/requestId.d.ts.map +1 -0
- package/dist/logging/requestId.js +82 -0
- package/dist/logging/requestId.js.map +1 -0
- package/dist/providers/create-selva-providers.d.ts +11 -1
- package/dist/providers/create-selva-providers.d.ts.map +1 -1
- package/dist/providers/create-selva-providers.js +21 -8
- package/dist/providers/create-selva-providers.js.map +1 -1
- package/package.json +11 -3
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field paths scrubbed before a record is written. Defense-in-depth only — call
|
|
3
|
+
* sites are required not to log secrets in the first place (see `LogFields`).
|
|
4
|
+
* This catches the accident where a whole object is spread into fields and
|
|
5
|
+
* happens to carry a token, which is exactly how credentials reach log indexes.
|
|
6
|
+
*/
|
|
7
|
+
const REDACTED_PATHS = [
|
|
8
|
+
'token',
|
|
9
|
+
'sessionToken',
|
|
10
|
+
'refreshToken',
|
|
11
|
+
'apiKey',
|
|
12
|
+
'api_key',
|
|
13
|
+
'password',
|
|
14
|
+
'authorization',
|
|
15
|
+
'cookie',
|
|
16
|
+
'*.token',
|
|
17
|
+
'*.sessionToken',
|
|
18
|
+
'*.refreshToken',
|
|
19
|
+
'*.apiKey',
|
|
20
|
+
'*.password'
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* Minimal `ILogger` over `console.*`, used when pino isn't installed.
|
|
24
|
+
*
|
|
25
|
+
* Renders as `LEVEL message {fields}` — readable in a terminal, greppable, and
|
|
26
|
+
* honest about not being machine-parseable. `child` fields are merged eagerly
|
|
27
|
+
* so correlation still works without pino.
|
|
28
|
+
*/
|
|
29
|
+
export class ConsoleLogger {
|
|
30
|
+
bound;
|
|
31
|
+
minLevel;
|
|
32
|
+
constructor(bound = {}, minLevel = 'info') {
|
|
33
|
+
this.bound = bound;
|
|
34
|
+
this.minLevel = minLevel;
|
|
35
|
+
}
|
|
36
|
+
static ORDER = {
|
|
37
|
+
debug: 10,
|
|
38
|
+
info: 20,
|
|
39
|
+
warn: 30,
|
|
40
|
+
error: 40
|
|
41
|
+
};
|
|
42
|
+
write(level, message, fields) {
|
|
43
|
+
if (ConsoleLogger.ORDER[level] < ConsoleLogger.ORDER[this.minLevel])
|
|
44
|
+
return;
|
|
45
|
+
const merged = { ...this.bound, ...fields };
|
|
46
|
+
const suffix = Object.keys(merged).length > 0 ? ` ${safeStringify(merged)}` : '';
|
|
47
|
+
const line = `${level.toUpperCase()} ${message}${suffix}`;
|
|
48
|
+
// Route to the matching console method so stderr/stdout split as expected.
|
|
49
|
+
// `info` (not `log`) carries debug too — both go to stdout, and the level
|
|
50
|
+
// is already spelled out in the line's own prefix.
|
|
51
|
+
if (level === 'error')
|
|
52
|
+
console.error(line);
|
|
53
|
+
else if (level === 'warn')
|
|
54
|
+
console.warn(line);
|
|
55
|
+
else
|
|
56
|
+
console.info(line);
|
|
57
|
+
}
|
|
58
|
+
debug(message, fields) {
|
|
59
|
+
this.write('debug', message, fields);
|
|
60
|
+
}
|
|
61
|
+
info(message, fields) {
|
|
62
|
+
this.write('info', message, fields);
|
|
63
|
+
}
|
|
64
|
+
warn(message, fields) {
|
|
65
|
+
this.write('warn', message, fields);
|
|
66
|
+
}
|
|
67
|
+
error(message, fields) {
|
|
68
|
+
this.write('error', message, fields);
|
|
69
|
+
}
|
|
70
|
+
child(fields) {
|
|
71
|
+
return new ConsoleLogger({ ...this.bound, ...fields }, this.minLevel);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** Fields can hold anything, including cycles. Never let rendering throw. */
|
|
75
|
+
function safeStringify(value) {
|
|
76
|
+
try {
|
|
77
|
+
return JSON.stringify(value) ?? String(value);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return '[unserializable]';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
class PinoLogger {
|
|
84
|
+
pino;
|
|
85
|
+
constructor(pino) {
|
|
86
|
+
this.pino = pino;
|
|
87
|
+
}
|
|
88
|
+
// pino takes (fields, message); ILogger takes (message, fields) — the flip is
|
|
89
|
+
// deliberate, since the message is what a human scans for first.
|
|
90
|
+
debug(message, fields) {
|
|
91
|
+
try {
|
|
92
|
+
this.pino.debug(fields ?? {}, message);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
/* logging must never throw */
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
info(message, fields) {
|
|
99
|
+
try {
|
|
100
|
+
this.pino.info(fields ?? {}, message);
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
/* logging must never throw */
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
warn(message, fields) {
|
|
107
|
+
try {
|
|
108
|
+
this.pino.warn(fields ?? {}, message);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
/* logging must never throw */
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
error(message, fields) {
|
|
115
|
+
try {
|
|
116
|
+
this.pino.error(fields ?? {}, message);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
/* logging must never throw */
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
child(fields) {
|
|
123
|
+
try {
|
|
124
|
+
return new PinoLogger(this.pino.child(fields));
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
return this;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Build the app's root logger. Never throws and never returns `null`: a
|
|
133
|
+
* deployment with no pino installed gets {@link ConsoleLogger}, because losing
|
|
134
|
+
* warnings and errors is a worse outcome than losing JSON formatting.
|
|
135
|
+
*/
|
|
136
|
+
export async function createLogger(opts = {}) {
|
|
137
|
+
const level = opts.level ?? 'info';
|
|
138
|
+
try {
|
|
139
|
+
const factory = await loadPinoFactory();
|
|
140
|
+
if (!factory)
|
|
141
|
+
return new ConsoleLogger(opts.base ?? {}, level);
|
|
142
|
+
const pino = factory({
|
|
143
|
+
level,
|
|
144
|
+
base: opts.base,
|
|
145
|
+
redact: { paths: REDACTED_PATHS, censor: '[redacted]' },
|
|
146
|
+
transport: opts.pretty
|
|
147
|
+
? { target: 'pino-pretty', options: { colorize: true, ignore: 'pid,hostname' } }
|
|
148
|
+
: undefined
|
|
149
|
+
});
|
|
150
|
+
return new PinoLogger(pino);
|
|
151
|
+
}
|
|
152
|
+
catch (err) {
|
|
153
|
+
// pino resolved but could not be constructed — a real misconfiguration
|
|
154
|
+
// (e.g. `pretty: true` with pino-pretty absent). Unlike a plain absent
|
|
155
|
+
// package, this one is worth complaining about: the operator asked for
|
|
156
|
+
// something they didn't get. Fall back rather than go quiet.
|
|
157
|
+
console.warn(`[Logger] pino was found but could not be initialized; falling back to console logging. ${String(err)}`);
|
|
158
|
+
return new ConsoleLogger(opts.base ?? {}, level);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Load pino's factory, or `null` when it isn't installed.
|
|
163
|
+
*
|
|
164
|
+
* The indirection through a variable specifier is load-bearing, not stylistic.
|
|
165
|
+
* A literal `import('pino')` is statically analyzable, so bundlers rewrite it —
|
|
166
|
+
* and Vite, applying browser-field mapping to this server build, resolved it to
|
|
167
|
+
* pino's `server_false` browser shim: a stub whose factory throws. That turned
|
|
168
|
+
* "use pino" into a silent fall back to the console. Computing the specifier
|
|
169
|
+
* defeats that resolution and leaves the import to Node at runtime, which is
|
|
170
|
+
* exactly what an optional peer dependency needs.
|
|
171
|
+
*
|
|
172
|
+
* `@vite-ignore` alone was NOT sufficient — it suppressed the warning while the
|
|
173
|
+
* rewrite happened anyway.
|
|
174
|
+
*/
|
|
175
|
+
async function loadPinoFactory() {
|
|
176
|
+
const specifier = 'pino';
|
|
177
|
+
try {
|
|
178
|
+
const mod = await import(/* @vite-ignore */ specifier);
|
|
179
|
+
const factory = (mod.default ?? mod);
|
|
180
|
+
return typeof factory === 'function' ? factory : null;
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
// Not installed — the expected path on a base install, where the console
|
|
184
|
+
// fallback is the intended behavior. Staying quiet here on purpose: a
|
|
185
|
+
// boot-time complaint about an optional package nobody asked for is noise.
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=PinoLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PinoLogger.js","sourceRoot":"","sources":["../../src/logging/PinoLogger.ts"],"names":[],"mappings":"AAkCA;;;;;GAKG;AACH,MAAM,cAAc,GAAG;IACtB,OAAO;IACP,cAAc;IACd,cAAc;IACd,QAAQ;IACR,SAAS;IACT,UAAU;IACV,eAAe;IACf,QAAQ;IACR,SAAS;IACT,gBAAgB;IAChB,gBAAgB;IAChB,UAAU;IACV,YAAY;CACZ,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,OAAO,aAAa;IAEP;IACA;IAFlB,YACkB,QAAmB,EAAE,EACrB,WAAqB,MAAM;QAD3B,UAAK,GAAL,KAAK,CAAgB;QACrB,aAAQ,GAAR,QAAQ,CAAmB;IAC1C,CAAC;IAEI,MAAM,CAAU,KAAK,GAA6B;QACzD,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,EAAE;QACR,KAAK,EAAE,EAAE;KACT,CAAC;IAEM,KAAK,CAAC,KAAe,EAAE,OAAe,EAAE,MAAkB;QACjE,IAAI,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;YAAE,OAAO;QAC5E,MAAM,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,MAAM,EAAE,CAAC;QAC5C,MAAM,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AC,CAAC;QACvD,MAAM,OAAO,GAAG,CAAE,GAA6B,CAAC,OAAO,IAAI,GAAG,CAAgB,CAAC;QAC/E,OAAO,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACR,yEAAyE;QACzE,sEAAsE;QACtE,2EAA2E;QAC3E,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logging/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,EACN,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Structured logging — pino-backed ILogger (optional `pino` peer, console
|
|
2
|
+
// fallback) plus request-id resolution for correlation.
|
|
3
|
+
export { createLogger, ConsoleLogger } from './PinoLogger.js';
|
|
4
|
+
export { resolveRequestId, sanitizeRequestId, renderThrown, REQUEST_ID_HEADER } from './requestId.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logging/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,wDAAwD;AAExD,OAAO,EAAE,YAAY,EAAE,aAAa,EAA4B,MAAM,iBAAiB,CAAC;AACxF,OAAO,EACN,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request-id resolution for log correlation.
|
|
3
|
+
*
|
|
4
|
+
* Every log record on a request path carries the same `requestId`, so an
|
|
5
|
+
* operator handed one id can reconstruct that request's whole story — which is
|
|
6
|
+
* the thing 199 uncorrelated `console.*` calls could never offer.
|
|
7
|
+
*
|
|
8
|
+
* Inbound ids are TRUSTED when present. Selva is documented as running behind a
|
|
9
|
+
* reverse proxy (Caddy/nginx), and those proxies mint a request id for their own
|
|
10
|
+
* access logs; generating a second one here would split a single request across
|
|
11
|
+
* two ids and make cross-tier correlation impossible. The trade is that a direct
|
|
12
|
+
* caller can choose their own id — acceptable, because a request id is a
|
|
13
|
+
* correlation hint, never an authorization or uniqueness input. It is used only
|
|
14
|
+
* as a log field and an echoed response header.
|
|
15
|
+
*
|
|
16
|
+
* That trust is exactly why {@link sanitizeRequestId} exists: an attacker-chosen
|
|
17
|
+
* id is untrusted *content*. Unbounded or newline-carrying values would let a
|
|
18
|
+
* caller forge log lines (log injection) or bloat every record on the request.
|
|
19
|
+
*/
|
|
20
|
+
/** Header carrying a caller/proxy-supplied id. The de-facto standard spelling. */
|
|
21
|
+
export declare const REQUEST_ID_HEADER = "x-request-id";
|
|
22
|
+
/**
|
|
23
|
+
* Reduce an untrusted inbound id to something safe to stamp on every record.
|
|
24
|
+
* Returns `null` when nothing usable survives, so the caller generates instead.
|
|
25
|
+
*/
|
|
26
|
+
export declare function sanitizeRequestId(raw: string | null | undefined): string | null;
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the id for a request: reuse the proxy's when it survives
|
|
29
|
+
* sanitization, otherwise mint a fresh UUID.
|
|
30
|
+
*
|
|
31
|
+
* @param headers the inbound request headers
|
|
32
|
+
* @param generate id source; injectable so tests get deterministic ids
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveRequestId(headers: Headers, generate?: () => string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Render a thrown value into a log field.
|
|
37
|
+
*
|
|
38
|
+
* Not every rejection is an `Error` — provider adapters occasionally reject with
|
|
39
|
+
* a plain `{ message, status }` object, which would otherwise stringify to a
|
|
40
|
+
* useless `[object Object]` and destroy the only record of the failure. Errors
|
|
41
|
+
* keep their stack (that's the diagnostic); anything else is JSON-serialized,
|
|
42
|
+
* with `String()` as the last resort for cycles and exotic values.
|
|
43
|
+
*/
|
|
44
|
+
export declare function renderThrown(error: unknown): string;
|
|
45
|
+
//# sourceMappingURL=requestId.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestId.d.ts","sourceRoot":"","sources":["../../src/logging/requestId.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAahD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAI/E;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,GAAE,MAAM,MAAiB,GAAG,MAAM,CAE5F;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAOnD"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request-id resolution for log correlation.
|
|
3
|
+
*
|
|
4
|
+
* Every log record on a request path carries the same `requestId`, so an
|
|
5
|
+
* operator handed one id can reconstruct that request's whole story — which is
|
|
6
|
+
* the thing 199 uncorrelated `console.*` calls could never offer.
|
|
7
|
+
*
|
|
8
|
+
* Inbound ids are TRUSTED when present. Selva is documented as running behind a
|
|
9
|
+
* reverse proxy (Caddy/nginx), and those proxies mint a request id for their own
|
|
10
|
+
* access logs; generating a second one here would split a single request across
|
|
11
|
+
* two ids and make cross-tier correlation impossible. The trade is that a direct
|
|
12
|
+
* caller can choose their own id — acceptable, because a request id is a
|
|
13
|
+
* correlation hint, never an authorization or uniqueness input. It is used only
|
|
14
|
+
* as a log field and an echoed response header.
|
|
15
|
+
*
|
|
16
|
+
* That trust is exactly why {@link sanitizeRequestId} exists: an attacker-chosen
|
|
17
|
+
* id is untrusted *content*. Unbounded or newline-carrying values would let a
|
|
18
|
+
* caller forge log lines (log injection) or bloat every record on the request.
|
|
19
|
+
*/
|
|
20
|
+
/** Header carrying a caller/proxy-supplied id. The de-facto standard spelling. */
|
|
21
|
+
export const REQUEST_ID_HEADER = 'x-request-id';
|
|
22
|
+
/** Max retained length. Long enough for a UUID or a W3C trace-id, short enough to bound a record. */
|
|
23
|
+
const MAX_REQUEST_ID_LENGTH = 128;
|
|
24
|
+
/**
|
|
25
|
+
* Characters allowed through verbatim. Deliberately strict: UUIDs, ULIDs, hex
|
|
26
|
+
* trace-ids and nginx's `$request_id` all fit. Anything else (whitespace,
|
|
27
|
+
* control chars, quotes, CR/LF) is dropped rather than escaped — there is no
|
|
28
|
+
* legitimate id that needs them, and dropping can't be un-escaped downstream.
|
|
29
|
+
*/
|
|
30
|
+
const UNSAFE_REQUEST_ID_CHARS = /[^A-Za-z0-9._:-]/g;
|
|
31
|
+
/**
|
|
32
|
+
* Reduce an untrusted inbound id to something safe to stamp on every record.
|
|
33
|
+
* Returns `null` when nothing usable survives, so the caller generates instead.
|
|
34
|
+
*/
|
|
35
|
+
export function sanitizeRequestId(raw) {
|
|
36
|
+
if (!raw)
|
|
37
|
+
return null;
|
|
38
|
+
const cleaned = raw.replace(UNSAFE_REQUEST_ID_CHARS, '').slice(0, MAX_REQUEST_ID_LENGTH);
|
|
39
|
+
return cleaned.length > 0 ? cleaned : null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Resolve the id for a request: reuse the proxy's when it survives
|
|
43
|
+
* sanitization, otherwise mint a fresh UUID.
|
|
44
|
+
*
|
|
45
|
+
* @param headers the inbound request headers
|
|
46
|
+
* @param generate id source; injectable so tests get deterministic ids
|
|
47
|
+
*/
|
|
48
|
+
export function resolveRequestId(headers, generate = randomId) {
|
|
49
|
+
return sanitizeRequestId(headers.get(REQUEST_ID_HEADER)) ?? generate();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Render a thrown value into a log field.
|
|
53
|
+
*
|
|
54
|
+
* Not every rejection is an `Error` — provider adapters occasionally reject with
|
|
55
|
+
* a plain `{ message, status }` object, which would otherwise stringify to a
|
|
56
|
+
* useless `[object Object]` and destroy the only record of the failure. Errors
|
|
57
|
+
* keep their stack (that's the diagnostic); anything else is JSON-serialized,
|
|
58
|
+
* with `String()` as the last resort for cycles and exotic values.
|
|
59
|
+
*/
|
|
60
|
+
export function renderThrown(error) {
|
|
61
|
+
if (error instanceof Error)
|
|
62
|
+
return error.stack ?? error.message;
|
|
63
|
+
try {
|
|
64
|
+
return JSON.stringify(error) ?? String(error);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return String(error);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* `crypto.randomUUID` is available in every runtime Selva targets (Node 22+,
|
|
72
|
+
* workers, modern browsers). The fallback covers non-secure contexts where
|
|
73
|
+
* `randomUUID` is missing — ids only need to be collision-free enough to
|
|
74
|
+
* correlate logs, never unguessable.
|
|
75
|
+
*/
|
|
76
|
+
function randomId() {
|
|
77
|
+
const c = globalThis.crypto;
|
|
78
|
+
if (c && typeof c.randomUUID === 'function')
|
|
79
|
+
return c.randomUUID();
|
|
80
|
+
return `req-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=requestId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestId.js","sourceRoot":"","sources":["../../src/logging/requestId.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,kFAAkF;AAClF,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAEhD,qGAAqG;AACrG,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC;;;;;GAKG;AACH,MAAM,uBAAu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EAAE,EAAE,CAAC,EAAE,CAAC;AACpF,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IAuthProvider, IDataProvider, IStorageProvider, ISolveMetricSink, SelvaBranding, SelvaConfig, SelvaFlags, TenancyMode } from '@selvajs/platform';
|
|
2
|
+
import { type ILogger } from '@selvajs/platform';
|
|
2
3
|
import { type EnvRecord } from '../compute/limits.js';
|
|
3
4
|
export type ProviderFactory<T> = (env: EnvRecord) => T;
|
|
4
5
|
/**
|
|
@@ -21,8 +22,17 @@ export interface CreateSelvaProvidersOptions {
|
|
|
21
22
|
* export (a `SelvaConfig` or factory) replaces the env-driven wiring.
|
|
22
23
|
*/
|
|
23
24
|
configPath?: string;
|
|
24
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Boot-summary sink, called once on first `resolve()`. Kept for callers that
|
|
27
|
+
* want the rendered one-line string. Default: none — the summary goes to
|
|
28
|
+
* `logger` instead, so this library never writes to stdout unbidden.
|
|
29
|
+
*/
|
|
25
30
|
onBoot?: (summary: string) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Structured logger. Receives the boot summary as fields on first `resolve()`
|
|
33
|
+
* when `onBoot` is not supplied. Defaults to `NoopLogger`.
|
|
34
|
+
*/
|
|
35
|
+
logger?: ILogger;
|
|
26
36
|
}
|
|
27
37
|
export interface SelvaProviderRuntime {
|
|
28
38
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-selva-providers.d.ts","sourceRoot":"","sources":["../../src/providers/create-selva-providers.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EACX,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,WAAW,EAEX,UAAU,EACV,WAAW,EACX,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-selva-providers.d.ts","sourceRoot":"","sources":["../../src/providers/create-selva-providers.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EACX,a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IAC9E,eAAe,IAAI,gBAAgB,CAAC;CACpC;AAkGD;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACzC,GAAG,EAAE,SAAS,EACd,OAAO,EAAE,2BAA2B,GAClC,OAAO,CAAC,oBAAoB,CAAC,CA+D/B"}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
import { pathToFileURL } from 'node:url';
|
|
22
22
|
import { resolve as resolvePath } from 'node:path';
|
|
23
23
|
import { existsSync } from 'node:fs';
|
|
24
|
-
import { isFlagEnabled, NoopSolveMetricSink } from '@selvajs/platform';
|
|
24
|
+
import { isFlagEnabled, NoopSolveMetricSink, NoopLogger } from '@selvajs/platform';
|
|
25
25
|
import { readBool } from '../compute/limits.js';
|
|
26
26
|
// Every SelvaFlags key, mapped from `SELVA_FLAG_<KEY>`. The `satisfies` +
|
|
27
27
|
// exhaustiveness check below make adding a platform flag without listing it
|
|
@@ -107,7 +107,7 @@ async function loadConfigSource(options) {
|
|
|
107
107
|
*/
|
|
108
108
|
export async function createSelvaProviders(env, options) {
|
|
109
109
|
const raw = await loadConfigSource(options);
|
|
110
|
-
const
|
|
110
|
+
const logger = options.logger ?? new NoopLogger();
|
|
111
111
|
let config;
|
|
112
112
|
let solveMetricSink;
|
|
113
113
|
function resolve() {
|
|
@@ -118,12 +118,25 @@ export async function createSelvaProviders(env, options) {
|
|
|
118
118
|
// wired without grepping env vars or reading the config file. Provider
|
|
119
119
|
// names come from the IAuthProvider.name field; data/storage adapters
|
|
120
120
|
// don't expose a name, so we infer from the constructor.
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
const wiring = {
|
|
122
|
+
component: 'selva',
|
|
123
|
+
auth: config.auth.name,
|
|
124
|
+
data: config.data.constructor.name,
|
|
125
|
+
storage: config.storage.constructor.name,
|
|
126
|
+
tenancy: config.tenancy ?? 'single',
|
|
127
|
+
...(options.configPath ? { configPath: options.configPath } : {})
|
|
128
|
+
};
|
|
129
|
+
if (options.onBoot) {
|
|
130
|
+
options.onBoot(`[selva] providers wired: ` +
|
|
131
|
+
`auth=${wiring.auth} ` +
|
|
132
|
+
`data=${wiring.data} ` +
|
|
133
|
+
`storage=${wiring.storage} ` +
|
|
134
|
+
`tenancy=${wiring.tenancy}` +
|
|
135
|
+
(options.configPath ? ` config=${options.configPath}` : ''));
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
logger.info('Providers wired', wiring);
|
|
139
|
+
}
|
|
127
140
|
return config;
|
|
128
141
|
}
|
|
129
142
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-selva-providers.js","sourceRoot":"","sources":["../../src/providers/create-selva-providers.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,2EAA2E;AAC3E,2EAA2E;AAC3E,oCAAoC;AACpC,EAAE;AACF,oEAAoE;AACpE,8EAA8E;AAC9E,6EAA6E;AAC7E,4EAA4E;AAC5E,gDAAgD;AAChD,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,4EAA4E;AAC5E,6DAA6D;AAC7D,EAAE;AACF,6EAA6E;AAC7E,wEAAwE;AACxE,8EAA8E;AAC9E,8EAA8E;AAE9E,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAYrC,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-selva-providers.js","sourceRoot":"","sources":["../../src/providers/create-selva-providers.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,2EAA2E;AAC3E,2EAA2E;AAC3E,oCAAoC;AACpC,EAAE;AACF,oEAAoE;AACpE,8EAA8E;AAC9E,6EAA6E;AAC7E,4EAA4E;AAC5E,gDAAgD;AAChD,EAAE;A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C,OAAO;gBACN,IAAI;gBACJ,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,IAAI;gBAClD,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,yDAAyD;gBAC3F,WAAW,EACV,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE;oBACzB,yFAAyF,IAAI,GAAG;aACjG,CAAC;QACH,CAAC;QACD,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC;QAC9C,eAAe,EAAE,GAAG,EAAE;YACrB,IAAI,CAAC,eAAe,EAAE,CAAC;gBACtB,eAAe,GAAG,OAAO,EAAE,CAAC,YAAY,IAAI,IAAI,mBAAmB,EAAE,CAAC;YACvE,CAAC;YACD,OAAO,eAAe,CAAC;QACxB,CAAC;KACD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selvajs/server",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.5",
|
|
4
4
|
"description": "Transport-agnostic compute/solve/definitions server building blocks for apps built on the Selva engine (limits, rate limiting, SSRF guard, input transform, solve pipeline, definition service + render loader)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
"types": "./dist/errors/index.d.ts",
|
|
43
43
|
"import": "./dist/errors/index.js"
|
|
44
44
|
},
|
|
45
|
+
"./logging": {
|
|
46
|
+
"types": "./dist/logging/index.d.ts",
|
|
47
|
+
"import": "./dist/logging/index.js"
|
|
48
|
+
},
|
|
45
49
|
"./http": {
|
|
46
50
|
"types": "./dist/http/index.d.ts",
|
|
47
51
|
"import": "./dist/http/index.js"
|
|
@@ -62,16 +66,20 @@
|
|
|
62
66
|
"!**/*.spec.*"
|
|
63
67
|
],
|
|
64
68
|
"dependencies": {
|
|
65
|
-
"@selvajs/compute": "^3.1.0-beta.
|
|
69
|
+
"@selvajs/compute": "^3.1.0-beta.12",
|
|
66
70
|
"@selvajs/platform": "^0.15.0-beta.1",
|
|
67
71
|
"@selvajs/schemas": "^4.7.0-beta.0"
|
|
68
72
|
},
|
|
69
73
|
"peerDependencies": {
|
|
70
|
-
"@sentry/node": ">=8"
|
|
74
|
+
"@sentry/node": ">=8",
|
|
75
|
+
"pino": ">=9"
|
|
71
76
|
},
|
|
72
77
|
"peerDependenciesMeta": {
|
|
73
78
|
"@sentry/node": {
|
|
74
79
|
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"pino": {
|
|
82
|
+
"optional": true
|
|
75
83
|
}
|
|
76
84
|
},
|
|
77
85
|
"devDependencies": {
|