@daloyjs/core 1.1.1 → 1.2.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.
- package/README.md +2 -1
- package/dist/adapters/cloudflare.d.ts +8 -1
- package/dist/adapters/cloudflare.js +15 -1
- package/dist/adapters/lambda.js +15 -5
- package/dist/adapters/vercel.d.ts +5 -0
- package/dist/adapters/vercel.js +27 -2
- package/dist/app.d.ts +34 -8
- package/dist/app.js +257 -72
- package/dist/combine.js +14 -8
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/metrics.d.ts +23 -9
- package/dist/metrics.js +37 -10
- package/dist/otlp.d.ts +268 -0
- package/dist/otlp.js +589 -0
- package/dist/sbom.cdx.json +9 -9
- package/dist/sbom.spdx.json +5 -5
- package/dist/types.d.ts +18 -2
- package/package.json +5 -1
package/dist/types.d.ts
CHANGED
|
@@ -268,6 +268,15 @@ export interface BaseContext<P extends string, R extends RequestSchemas | undefi
|
|
|
268
268
|
body: InferRequest<R, P>["body"];
|
|
269
269
|
/** Mutable per-request state. Plugin-augmented context lives here. */
|
|
270
270
|
state: AppState & Record<string, unknown>;
|
|
271
|
+
/**
|
|
272
|
+
* The matched route's path **template** (e.g. `/books/:id`), set as soon as
|
|
273
|
+
* routing succeeds. `undefined` on framework-synthesised contexts (404/405
|
|
274
|
+
* error contexts, OPTIONS preflight). Use it for low-cardinality metric
|
|
275
|
+
* labels (`http.route`) instead of the raw request path.
|
|
276
|
+
*
|
|
277
|
+
* @since 1.2.0
|
|
278
|
+
*/
|
|
279
|
+
routePath?: string;
|
|
271
280
|
/** Convenience response helpers (do not bypass schema validation). */
|
|
272
281
|
set: {
|
|
273
282
|
status?: number;
|
|
@@ -299,6 +308,13 @@ export interface PreBodyContext<P extends string = string> {
|
|
|
299
308
|
body: undefined;
|
|
300
309
|
/** Mutable per-request state shared with later hooks and the handler. */
|
|
301
310
|
state: AppState & Record<string, unknown>;
|
|
311
|
+
/**
|
|
312
|
+
* The matched route's path template (routing has already succeeded when
|
|
313
|
+
* `preBody` runs). See {@link BaseContext.routePath}.
|
|
314
|
+
*
|
|
315
|
+
* @since 1.2.0
|
|
316
|
+
*/
|
|
317
|
+
routePath?: string;
|
|
302
318
|
/** Response headers/status available to a short-circuiting perimeter hook. */
|
|
303
319
|
set: {
|
|
304
320
|
status?: number;
|
|
@@ -376,8 +392,8 @@ export interface Hooks {
|
|
|
376
392
|
* the existing response. Multiple `onSend` hooks compose pipeline-style.
|
|
377
393
|
*/
|
|
378
394
|
onSend?: (res: Response, ctx: BaseContext<any, any> | undefined) => void | Response | Promise<void | Response>;
|
|
379
|
-
/** Fire-and-forget observer of the final outgoing `Response` (logging, metrics). Runs last; cannot alter the response. */
|
|
380
|
-
onResponse?: (res: Response) => void | Promise<void>;
|
|
395
|
+
/** Fire-and-forget observer of the final outgoing `Response` (logging, metrics). Runs last; cannot alter the response. `ctx` is `undefined` when the error occurred before context was built. */
|
|
396
|
+
onResponse?: (res: Response, ctx?: BaseContext<any, any> | undefined) => void | Promise<void>;
|
|
381
397
|
}
|
|
382
398
|
/**
|
|
383
399
|
* Declarative description of one HTTP endpoint. The single source of truth
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daloyjs/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "DaloyJS is a runtime-portable, contract-first TypeScript web framework with built-in OpenAPI (Hey API), typed client generation, large-scale maintainability, and security-first defaults. Hono-grade portability, Elysia-grade DX, FastAPI-grade docs, Fastify-grade ops \u2014 distributed via pnpm.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -154,6 +154,10 @@
|
|
|
154
154
|
"types": "./dist/metrics.d.ts",
|
|
155
155
|
"import": "./dist/metrics.js"
|
|
156
156
|
},
|
|
157
|
+
"./otlp": {
|
|
158
|
+
"types": "./dist/otlp.d.ts",
|
|
159
|
+
"import": "./dist/otlp.js"
|
|
160
|
+
},
|
|
157
161
|
"./fetch-resilience": {
|
|
158
162
|
"types": "./dist/fetch-resilience.d.ts",
|
|
159
163
|
"import": "./dist/fetch-resilience.js"
|