@voyant-travel/hono 0.112.2 → 0.114.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/README.md +13 -0
- package/dist/app-workflows.d.ts.map +1 -1
- package/dist/app-workflows.js +9 -12
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +32 -7
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/lib/auth-forward.d.ts +27 -0
- package/dist/lib/auth-forward.d.ts.map +1 -0
- package/dist/lib/auth-forward.js +33 -0
- package/dist/middleware/error-boundary.d.ts +30 -2
- package/dist/middleware/error-boundary.d.ts.map +1 -1
- package/dist/middleware/error-boundary.js +37 -2
- package/dist/middleware/index.d.ts +2 -2
- package/dist/middleware/index.d.ts.map +1 -1
- package/dist/middleware/index.js +2 -2
- package/dist/middleware/logger.d.ts.map +1 -1
- package/dist/middleware/logger.js +4 -1
- package/dist/middleware/require-actor.d.ts +9 -0
- package/dist/middleware/require-actor.d.ts.map +1 -1
- package/dist/middleware/require-actor.js +29 -0
- package/dist/observability/index.d.ts +4 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +2 -0
- package/dist/observability/reporter.d.ts +52 -0
- package/dist/observability/reporter.d.ts.map +1 -0
- package/dist/observability/reporter.js +59 -0
- package/dist/observability/request-context.d.ts +13 -0
- package/dist/observability/request-context.d.ts.map +1 -0
- package/dist/observability/request-context.js +35 -0
- package/dist/types.d.ts +25 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -8
package/README.md
CHANGED
|
@@ -9,6 +9,19 @@ helpers, and plugin expansion for mounting Voyant modules behind a Hono app.
|
|
|
9
9
|
pnpm add @voyant-travel/hono hono
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
+
## Requirements
|
|
13
|
+
|
|
14
|
+
On **Cloudflare Workers**, enable the `nodejs_compat` (or `nodejs_als`)
|
|
15
|
+
compatibility flag — the request-id correlation context uses
|
|
16
|
+
`AsyncLocalStorage` (`node:async_hooks`) on the always-used request path:
|
|
17
|
+
|
|
18
|
+
```jsonc
|
|
19
|
+
// wrangler.jsonc
|
|
20
|
+
{ "compatibility_flags": ["nodejs_compat"] }
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Voyant starters/templates already set this. **Node** deployments need nothing.
|
|
24
|
+
|
|
12
25
|
## Usage
|
|
13
26
|
|
|
14
27
|
```typescript
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-workflows.d.ts","sourceRoot":"","sources":["../src/app-workflows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,MAAM,EACN,eAAe,EACf,kBAAkB,EACnB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAOrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AASjD,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC9B,kBAAkB,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAA;IACrD,gBAAgB,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAA;IACtD,MAAM,EAAE,cAAc,CAAA;IACtB,WAAW,EAAE,YAAY,GAAG,SAAS,GAAG,aAAa,CAAA;IACrD,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE;QACR,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,OAAO,CAAA;KACvF,CAAA;CACF;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"app-workflows.d.ts","sourceRoot":"","sources":["../src/app-work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"}
|
package/dist/app-workflows.js
CHANGED
|
@@ -41,18 +41,15 @@ export async function wireWorkflowRuntime(args) {
|
|
|
41
41
|
for (const eventType of eventTypes) {
|
|
42
42
|
args.eventBus.subscribe(eventType, async (envelope) => {
|
|
43
43
|
const stamped = ensureMetadataEventId(envelope);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
54
|
-
console.error(`[voyant] workflow forwarder for "${eventType}" failed: ${message}`);
|
|
55
|
-
}
|
|
44
|
+
// Let ingest failures propagate: the EventBus catches every subscriber
|
|
45
|
+
// throw (the emitter and sibling handlers stay unaffected per its
|
|
46
|
+
// fire-and-forget contract) AND routes it through `onSubscriberError`, so
|
|
47
|
+
// a misbehaving driver / network glitch is both logged and reported via
|
|
48
|
+
// the framework reporter — instead of being swallowed here (RFC #1553).
|
|
49
|
+
await args.driver.ingestEvent({
|
|
50
|
+
environment: args.environment,
|
|
51
|
+
envelope: stamped,
|
|
52
|
+
});
|
|
56
53
|
});
|
|
57
54
|
}
|
|
58
55
|
}
|
package/dist/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAgC3B,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAY,eAAe,EAAE,MAAM,YAAY,CAAA;AA2C5F;;;;;;;;;;GAUG;AACH,MAAM,WAAW,mBAAmB,CAAC,SAAS,GAAG,OAAO;IACtD;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1C;;;;;;;;OAQG;IACH,QAAQ,EAAE,OAAO,qBAAqB,EAAE,QAAQ,CAAA;CACjD;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,SAAS,SAAS,cAAc,EACvD,MAAM,EAAE,eAAe,CAAC,SAAS,CAAC,GACjC,IAAI,CAAC;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,eAAe,CAAA;CAAE,CAAC,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAqc5F"}
|
package/dist/app.js
CHANGED
|
@@ -3,6 +3,7 @@ import { createOutboxEventStore } from "@voyant-travel/db/outbox";
|
|
|
3
3
|
import { Hono } from "hono";
|
|
4
4
|
import { containerToServiceResolver, makeFrameworkLogger, wireWorkflowRuntime, } from "./app-workflows.js";
|
|
5
5
|
import { mountLazyRoutePaths, mountLazyRoutesAt } from "./lazy-routes.js";
|
|
6
|
+
import { mountAuthForwarding } from "./lib/auth-forward.js";
|
|
6
7
|
import { createPathDbSelector } from "./lib/db-selector.js";
|
|
7
8
|
import { tryGetExecutionCtx } from "./lib/execution-ctx.js";
|
|
8
9
|
import { matchesPublicPath, normalizePathname } from "./lib/public-paths.js";
|
|
@@ -18,6 +19,8 @@ import { publicResponseCache } from "./middleware/public-cache.js";
|
|
|
18
19
|
import { rateLimit, resolveRateLimitStore, } from "./middleware/rate-limit.js";
|
|
19
20
|
import { requireActor } from "./middleware/require-actor.js";
|
|
20
21
|
import { securityHeaders } from "./middleware/security-headers.js";
|
|
22
|
+
import { noopReporter, safeCaptureException } from "./observability/reporter.js";
|
|
23
|
+
import { getRequestId } from "./observability/request-context.js";
|
|
21
24
|
import { expandHonoPlugins } from "./plugin.js";
|
|
22
25
|
function resolveSurfaceMountPath(prefix, path, fallback) {
|
|
23
26
|
const normalized = path?.trim();
|
|
@@ -51,12 +54,28 @@ function buildRateLimitPolicy(config, env, bucket, defaults) {
|
|
|
51
54
|
*/
|
|
52
55
|
export function mountApp(config) {
|
|
53
56
|
const app = new Hono();
|
|
54
|
-
|
|
57
|
+
// Observability sink (RFC #1553) — resolved once and reused by both the
|
|
58
|
+
// outer onError and the forwarded auth sub-app catch point below.
|
|
59
|
+
const reporter = config.reporter ?? noopReporter;
|
|
60
|
+
const appName = config.appName ?? "voyant";
|
|
61
|
+
app.onError((err, c) => handleApiError(err, c, { reporter, appName }));
|
|
55
62
|
// Expand plugins into their constituent modules/extensions before mounting
|
|
56
63
|
const expanded = config.plugins ? expandHonoPlugins(config.plugins) : null;
|
|
57
64
|
const allModules = [...(config.modules ?? []), ...(expanded?.modules ?? [])];
|
|
58
65
|
const allExtensions = [...(config.extensions ?? []), ...(expanded?.extensions ?? [])];
|
|
59
|
-
|
|
66
|
+
// When the framework owns the bus, route subscriber-dispatch failures
|
|
67
|
+
// (including the workflow forwarder) to the reporter — they're otherwise
|
|
68
|
+
// only console-logged per the fire-and-forget EventBus contract (RFC #1553).
|
|
69
|
+
// A deployment-supplied bus owns its own error routing.
|
|
70
|
+
const eventBus = config.eventBus ??
|
|
71
|
+
createEventBus({
|
|
72
|
+
onSubscriberError: (event, error) => safeCaptureException(reporter, {
|
|
73
|
+
requestId: getRequestId() ?? "",
|
|
74
|
+
app: appName,
|
|
75
|
+
error,
|
|
76
|
+
context: { event, surface: "event-bus" },
|
|
77
|
+
}),
|
|
78
|
+
});
|
|
60
79
|
const query = typeof config.query === "function"
|
|
61
80
|
? config.query
|
|
62
81
|
: config.query
|
|
@@ -158,6 +177,14 @@ export function mountApp(config) {
|
|
|
158
177
|
catch (error) {
|
|
159
178
|
const message = error instanceof Error ? error.message : String(error);
|
|
160
179
|
console.error(`[voyant] bootstrap failed for ${label}: ${message}`);
|
|
180
|
+
// Bootstrap failures are startup-critical but silent today — surface
|
|
181
|
+
// them to the reporter too (RFC #1553). No request context here.
|
|
182
|
+
safeCaptureException(reporter, {
|
|
183
|
+
requestId: getRequestId() ?? "",
|
|
184
|
+
app: appName,
|
|
185
|
+
error,
|
|
186
|
+
context: { label, surface: "bootstrap" },
|
|
187
|
+
});
|
|
161
188
|
}
|
|
162
189
|
};
|
|
163
190
|
for (const plugin of config.plugins ?? []) {
|
|
@@ -276,13 +303,11 @@ export function mountApp(config) {
|
|
|
276
303
|
});
|
|
277
304
|
// Health check (public, no auth)
|
|
278
305
|
app.get("/health", (c) => c.json({ status: "ok" }));
|
|
279
|
-
// App-owned auth handler (must be before auth middleware — these routes are
|
|
306
|
+
// App-owned auth handler (must be before auth middleware — these routes are
|
|
307
|
+
// public). Forwarding + observability bridging live in `mountAuthForwarding`.
|
|
280
308
|
const authHandler = config.auth?.handler;
|
|
281
309
|
if (authHandler) {
|
|
282
|
-
app
|
|
283
|
-
const authApp = authHandler(c.env);
|
|
284
|
-
return authApp.fetch(c.req.raw, c.env, c.executionCtx);
|
|
285
|
-
});
|
|
310
|
+
mountAuthForwarding(app, authHandler, { reporter, appName });
|
|
286
311
|
}
|
|
287
312
|
// Transactional surface map: a request must be served by a
|
|
288
313
|
// transaction-capable db client when its path belongs to (a) a module
|
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,10 @@ export type { DocumentDownloadEnvelope, DocumentDownloadResolution, DocumentDown
|
|
|
7
7
|
export { resolveStoredDocumentDownload } from "./document-download.js";
|
|
8
8
|
export { createLazyRouteHandler, type LazyHonoRoutes, type LazyRoutesLoader, mountLazyRoutePaths, mountLazyRoutesAt, } from "./lazy-routes.js";
|
|
9
9
|
export { createPathDbSelector, type PathDbSelectorOptions } from "./lib/db-selector.js";
|
|
10
|
-
export { clientIpKey, consoleLoggerProvider, cors, DEFAULT_IDEMPOTENCY_TTL_MS, db, enforceRateLimit, errorBoundary, handleApiError, type IdempotencyKeyOptions, idempotencyKey, LIVE_LIMITS, logger, purgeExpiredIdempotencyKeys, rateLimit, requestId, requireActor, requireAuth, requirePermission, } from "./middleware/index.js";
|
|
10
|
+
export { clientIpKey, consoleLoggerProvider, cors, DEFAULT_IDEMPOTENCY_TTL_MS, db, enforceRateLimit, errorBoundary, handleApiError, type IdempotencyKeyOptions, idempotencyKey, isStaffRbacEnforced, LIVE_LIMITS, logger, purgeExpiredIdempotencyKeys, rateLimit, requestId, requireActor, requireAuth, requirePermission, } from "./middleware/index.js";
|
|
11
11
|
export type { HonoExtension, HonoModule } from "./module.js";
|
|
12
|
+
export type { ErrorEvent, Reporter } from "./observability/index.js";
|
|
13
|
+
export { consoleReporter, getRequestId, noopReporter, runWithRequestId, safeCaptureException, } from "./observability/index.js";
|
|
12
14
|
export type { ExpandedHonoBundles, ExpandedHonoPlugins, HonoBundle, HonoPlugin, } from "./plugin.js";
|
|
13
15
|
export { defineHonoBundle, defineHonoPlugin, expandHonoBundles, expandHonoPlugins, } from "./plugin.js";
|
|
14
16
|
export type { CreatePublicCapabilityOptions, PublicCapabilityCookieOptions, PublicCapabilityPayload, VerifyPublicCapabilityOptions, } from "./public-capability.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,EACT,YAAY,EACZ,aAAa,GACd,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,KAAK,eAAe,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACjE,YAAY,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,6BAA6B,EAAE,MAAM,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AAY,EACV,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,cAAc,EACd,QAAQ,EACR,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,GAChB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,wBAAwB,EACxB,aAAa,EACb,qBAAqB,EACrB,UAAU,EACV,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,EACT,YAAY,EACZ,aAAa,GACd,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,KAAK,eAAe,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACjE,YAAY,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAA;AACtE,OAAO,EACL,sBAAsB,EACtB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AACvF,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,IAAI,E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c,EACd,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,cAAc,EACd,QAAQ,EACR,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,GAChB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,wBAAwB,EACxB,aAAa,EACb,qBAAqB,EACrB,UAAU,EACV,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,iBAAiB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,8 @@ export { createApp } from "./create-app.js";
|
|
|
4
4
|
export { resolveStoredDocumentDownload } from "./document-download.js";
|
|
5
5
|
export { createLazyRouteHandler, mountLazyRoutePaths, mountLazyRoutesAt, } from "./lazy-routes.js";
|
|
6
6
|
export { createPathDbSelector } from "./lib/db-selector.js";
|
|
7
|
-
export { clientIpKey, consoleLoggerProvider, cors, DEFAULT_IDEMPOTENCY_TTL_MS, db, enforceRateLimit, errorBoundary, handleApiError, idempotencyKey, LIVE_LIMITS, logger, purgeExpiredIdempotencyKeys, rateLimit, requestId, requireActor, requireAuth, requirePermission, } from "./middleware/index.js";
|
|
7
|
+
export { clientIpKey, consoleLoggerProvider, cors, DEFAULT_IDEMPOTENCY_TTL_MS, db, enforceRateLimit, errorBoundary, handleApiError, idempotencyKey, isStaffRbacEnforced, LIVE_LIMITS, logger, purgeExpiredIdempotencyKeys, rateLimit, requestId, requireActor, requireAuth, requirePermission, } from "./middleware/index.js";
|
|
8
|
+
export { consoleReporter, getRequestId, noopReporter, runWithRequestId, safeCaptureException, } from "./observability/index.js";
|
|
8
9
|
export { defineHonoBundle, defineHonoPlugin, expandHonoBundles, expandHonoPlugins, } from "./plugin.js";
|
|
9
10
|
export { createPublicCapabilityToken, extractPublicCapabilityToken, serializePublicCapabilityCookie, verifyPublicCapabilityToken, } from "./public-capability.js";
|
|
10
11
|
export { createDrizzlePublicDocumentDeliveryGrantStore, createPublicDocumentDeliveryGrant, createPublicDocumentDeliveryHonoModule, createPublicDocumentDeliveryRoutes, resolvePublicDocumentDeliveryGrant, revokePublicDocumentDeliveryGrant, } from "./public-document-delivery.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Hono } from "hono";
|
|
2
|
+
import type { Reporter } from "../observability/reporter.js";
|
|
3
|
+
import type { VoyantBindings, VoyantExecutionContext, VoyantVariables } from "../types.js";
|
|
4
|
+
/** Shape of the deployment-supplied auth sub-app (see `VoyantAuthIntegration.handler`). */
|
|
5
|
+
type AuthAppFactory<TBindings> = (env: TBindings) => {
|
|
6
|
+
fetch: (req: Request, env: TBindings, ctx?: VoyantExecutionContext) => Response | Promise<Response>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Mount the app-owned auth handler at `/auth/*`, forwarding requests into the
|
|
10
|
+
* deployment's auth sub-app. Two observability concerns are handled here so the
|
|
11
|
+
* sub-app — which renders its own error responses and never reaches the outer
|
|
12
|
+
* `onError` — stays consistent with the rest of the app (RFC voyant#1553):
|
|
13
|
+
*
|
|
14
|
+
* 1. The outer correlation id is injected into the forwarded request, so the
|
|
15
|
+
* sub-app reuses it instead of minting a second, uncorrelated id.
|
|
16
|
+
* 2. A 5xx response from the sub-app is bridged into the reporter with that same
|
|
17
|
+
* id, so auth faults aren't an observability blind spot.
|
|
18
|
+
*/
|
|
19
|
+
export declare function mountAuthForwarding<TBindings extends VoyantBindings>(app: Hono<{
|
|
20
|
+
Bindings: TBindings;
|
|
21
|
+
Variables: VoyantVariables;
|
|
22
|
+
}>, authHandler: AuthAppFactory<TBindings>, options: {
|
|
23
|
+
reporter: Reporter;
|
|
24
|
+
appName: string;
|
|
25
|
+
}): void;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=auth-forward.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-forward.d.ts","sourceRoot":"","sources":["../../src/lib/auth-forward.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAGhC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAG1F,2FAA2F;AAC3F,KAAK,cAAc,CAAC,SAAS,IAAI,CAAC,GAAG,EAAE,SAAS,KAAK;IACnD,KAAK,EAAE,CACL,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,SAAS,EACd,GAAG,CAAC,EAAE,sBAAsB,KACzB,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;CAClC,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,SAAS,cAAc,EAClE,GAAG,EAAE,IAAI,CAAC;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,eAAe,CAAA;CAAE,CAAC,EAC9D,WAAW,EAAE,cAAc,CAAC,SAAS,CAAC,EACtC,OAAO,EAAE;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC/C,IAAI,CAkBN"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { reportException } from "../middleware/error-boundary.js";
|
|
2
|
+
import { tryGetExecutionCtx } from "./execution-ctx.js";
|
|
3
|
+
/**
|
|
4
|
+
* Mount the app-owned auth handler at `/auth/*`, forwarding requests into the
|
|
5
|
+
* deployment's auth sub-app. Two observability concerns are handled here so the
|
|
6
|
+
* sub-app — which renders its own error responses and never reaches the outer
|
|
7
|
+
* `onError` — stays consistent with the rest of the app (RFC voyant#1553):
|
|
8
|
+
*
|
|
9
|
+
* 1. The outer correlation id is injected into the forwarded request, so the
|
|
10
|
+
* sub-app reuses it instead of minting a second, uncorrelated id.
|
|
11
|
+
* 2. A 5xx response from the sub-app is bridged into the reporter with that same
|
|
12
|
+
* id, so auth faults aren't an observability blind spot.
|
|
13
|
+
*/
|
|
14
|
+
export function mountAuthForwarding(app, authHandler, options) {
|
|
15
|
+
app.all("/auth/*", async (c) => {
|
|
16
|
+
const authApp = authHandler(c.env);
|
|
17
|
+
const id = c.get("requestId");
|
|
18
|
+
const forwardedHeaders = new Headers(c.req.raw.headers);
|
|
19
|
+
if (id)
|
|
20
|
+
forwardedHeaders.set("x-request-id", id);
|
|
21
|
+
const forwarded = new Request(c.req.raw, { headers: forwardedHeaders });
|
|
22
|
+
const res = await authApp.fetch(forwarded, c.env, tryGetExecutionCtx(c));
|
|
23
|
+
if (res.status >= 500) {
|
|
24
|
+
reportException(options.reporter, c, {
|
|
25
|
+
requestId: id ?? "",
|
|
26
|
+
app: options.appName,
|
|
27
|
+
error: new Error(`auth handler returned HTTP ${res.status}`),
|
|
28
|
+
context: { path: c.req.path, method: c.req.method, status: res.status, surface: "auth" },
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return res;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
import type { Context, MiddlewareHandler } from "hono";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { type ErrorEvent, type Reporter } from "../observability/reporter.js";
|
|
3
|
+
/**
|
|
4
|
+
* Mints (or honors a trusted inbound) `x-request-id`, exposes it on the
|
|
5
|
+
* `X-Request-Id` response header and the `requestId` context variable, and runs
|
|
6
|
+
* the rest of the request inside the async-context store so `getRequestId()`
|
|
7
|
+
* works anywhere downstream (RFC #1553, primitive 1).
|
|
8
|
+
*/
|
|
9
|
+
export declare const requestId: MiddlewareHandler<{
|
|
10
|
+
Variables: {
|
|
11
|
+
requestId?: string;
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
14
|
+
export interface HandleApiErrorOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Observability sink for unhandled 5xx exceptions (RFC #1553, primitive 2).
|
|
17
|
+
* Defaults to {@link noopReporter}.
|
|
18
|
+
*/
|
|
19
|
+
reporter?: Reporter;
|
|
20
|
+
/** Logical app name stamped on emitted {@link ErrorEvent}s. Defaults to `"voyant"`. */
|
|
21
|
+
appName?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Forwards a normalized {@link ErrorEvent} to the reporter. Best-effort: never
|
|
25
|
+
* throws, and flushes an async reporter via `waitUntil` so capture doesn't
|
|
26
|
+
* block the response. Exported so non-`onError` catch points (e.g. the
|
|
27
|
+
* forwarded auth sub-app, which returns its own Response and never reaches the
|
|
28
|
+
* outer `onError`) can emit through the same path.
|
|
29
|
+
*/
|
|
30
|
+
export declare function reportException(reporter: Reporter, c: Context, event: ErrorEvent): void;
|
|
31
|
+
export declare function handleApiError(err: unknown, c: Context, options?: HandleApiErrorOptions): Response;
|
|
4
32
|
export declare const errorBoundary: MiddlewareHandler;
|
|
5
33
|
//# sourceMappingURL=error-boundary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-boundary.d.ts","sourceRoot":"","sources":["../../src/middleware/error-boundary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"error-boundary.d.ts","sourceRoot":"","sources":["../../src/middleware/error-boundary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAA;AAGtD,OAAO,EACL,KAAK,UAAU,EAEf,KAAK,QAAQ,EAEd,MAAM,8BAA8B,CAAA;AAYrC;;;;;GAKG;AACH,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC;IAAE,SAAS,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAS9E,CAAA;AAED,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,uFAAuF;IACvF,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAGvF;AAeD,wBAAgB,cAAc,CAC5B,GAAG,EAAE,OAAO,EACZ,CAAC,EAAE,OAAO,EACV,OAAO,GAAE,qBAA0B,GAClC,QAAQ,CA6DV;AAED,eAAO,MAAM,aAAa,EAAE,iBAM3B,CAAA"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { apiErrorSchema } from "@voyant-travel/types";
|
|
2
|
+
import { tryGetExecutionCtx } from "../lib/execution-ctx.js";
|
|
3
|
+
import { noopReporter, safeCaptureException, } from "../observability/reporter.js";
|
|
4
|
+
import { runWithRequestId } from "../observability/request-context.js";
|
|
2
5
|
import { normalizeValidationError } from "../validation.js";
|
|
3
6
|
function generateRequestId() {
|
|
4
7
|
const bytes = new Uint8Array(16);
|
|
@@ -7,12 +10,30 @@ function generateRequestId() {
|
|
|
7
10
|
.map((b) => b.toString(16).padStart(2, "0"))
|
|
8
11
|
.join("");
|
|
9
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Mints (or honors a trusted inbound) `x-request-id`, exposes it on the
|
|
15
|
+
* `X-Request-Id` response header and the `requestId` context variable, and runs
|
|
16
|
+
* the rest of the request inside the async-context store so `getRequestId()`
|
|
17
|
+
* works anywhere downstream (RFC #1553, primitive 1).
|
|
18
|
+
*/
|
|
10
19
|
export const requestId = async (c, next) => {
|
|
11
20
|
const existing = c.req.header("x-request-id");
|
|
12
21
|
const id = existing?.trim() || generateRequestId();
|
|
22
|
+
c.set("requestId", id);
|
|
13
23
|
c.res.headers.set("X-Request-Id", id);
|
|
14
|
-
await next
|
|
24
|
+
await runWithRequestId(id, next);
|
|
15
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Forwards a normalized {@link ErrorEvent} to the reporter. Best-effort: never
|
|
28
|
+
* throws, and flushes an async reporter via `waitUntil` so capture doesn't
|
|
29
|
+
* block the response. Exported so non-`onError` catch points (e.g. the
|
|
30
|
+
* forwarded auth sub-app, which returns its own Response and never reaches the
|
|
31
|
+
* outer `onError`) can emit through the same path.
|
|
32
|
+
*/
|
|
33
|
+
export function reportException(reporter, c, event) {
|
|
34
|
+
const ctx = tryGetExecutionCtx(c);
|
|
35
|
+
safeCaptureException(reporter, event, ctx ? (promise) => ctx.waitUntil(promise) : undefined);
|
|
36
|
+
}
|
|
16
37
|
const LOGGED_HEADERS = new Set([
|
|
17
38
|
"accept",
|
|
18
39
|
"cf-connecting-ip",
|
|
@@ -25,7 +46,7 @@ const LOGGED_HEADERS = new Set([
|
|
|
25
46
|
"x-forwarded-for",
|
|
26
47
|
"x-request-id",
|
|
27
48
|
]);
|
|
28
|
-
export function handleApiError(err, c) {
|
|
49
|
+
export function handleApiError(err, c, options = {}) {
|
|
29
50
|
const id = c.res.headers.get("X-Request-Id") || generateRequestId();
|
|
30
51
|
const apiError = normalizeValidationError(err);
|
|
31
52
|
const errRecord = err instanceof Object ? err : {};
|
|
@@ -59,10 +80,24 @@ export function handleApiError(err, c) {
|
|
|
59
80
|
/* ignore logging errors */
|
|
60
81
|
}
|
|
61
82
|
const statusCode = status >= 100 && status <= 599 ? status : 500;
|
|
83
|
+
// Emit to the observability sink only for genuine server faults — handled
|
|
84
|
+
// 4xx (validation/auth) are expected and would be noise (RFC #1553).
|
|
85
|
+
if (statusCode >= 500) {
|
|
86
|
+
reportException(options.reporter ?? noopReporter, c, {
|
|
87
|
+
requestId: id,
|
|
88
|
+
app: options.appName ?? "voyant",
|
|
89
|
+
error: err,
|
|
90
|
+
context: { path: c.req.path, method: c.req.method, status: statusCode, code },
|
|
91
|
+
});
|
|
92
|
+
}
|
|
62
93
|
return new Response(JSON.stringify(apiErrorSchema.parse({ error: errorMessage, code, requestId: id, details })), {
|
|
63
94
|
status: statusCode,
|
|
64
95
|
headers: {
|
|
65
96
|
"content-type": "application/json",
|
|
97
|
+
// Carry the correlation id on the error response too — `onError`
|
|
98
|
+
// replaces `c.res`, which would otherwise drop the header set by the
|
|
99
|
+
// `requestId` middleware (RFC #1553).
|
|
100
|
+
"x-request-id": id,
|
|
66
101
|
},
|
|
67
102
|
});
|
|
68
103
|
}
|
|
@@ -2,13 +2,13 @@ export { requireAuth } from "./auth.js";
|
|
|
2
2
|
export { DEFAULT_REQUEST_BODY_LIMIT_BYTES, type RequestBodyLimitOptions, requestBodyLimit, } from "./body-size.js";
|
|
3
3
|
export { cors } from "./cors.js";
|
|
4
4
|
export { db } from "./db.js";
|
|
5
|
-
export { errorBoundary, handleApiError, requestId } from "./error-boundary.js";
|
|
5
|
+
export { errorBoundary, type HandleApiErrorOptions, handleApiError, requestId, } from "./error-boundary.js";
|
|
6
6
|
export { DEFAULT_IDEMPOTENCY_TTL_MS, type IdempotencyKeyOptions, idempotencyKey, purgeExpiredIdempotencyKeys, } from "./idempotency-key.js";
|
|
7
7
|
export { consoleLoggerProvider, logger } from "./logger.js";
|
|
8
8
|
export { type AnalyticsEngineDatasetLike, DB_METRICS_CONTEXT_KEY, type MetricsMiddlewareOptions, metrics, type RequestDbMetrics, withQueryCounting, } from "./metrics.js";
|
|
9
9
|
export { type PublicCacheOptions, publicResponseCache, resetPublicCacheStateForTests, } from "./public-cache.js";
|
|
10
10
|
export { type CloudflareRateLimiterBinding, clientIpKey, createCloudflareRateLimitStore, createKvRateLimitStore, createMemoryRateLimitStore, enforceRateLimit, LIVE_LIMITS, type RateLimitConfig, type RateLimitPolicy, type RateLimitRequestContext, type RateLimitResult, type RateLimitRule, type RateLimitStore, rateLimit, resolveRateLimitStore, } from "./rate-limit.js";
|
|
11
|
-
export { requireActor } from "./require-actor.js";
|
|
11
|
+
export { isStaffRbacEnforced, requireActor } from "./require-actor.js";
|
|
12
12
|
export { requirePermission } from "./require-permission.js";
|
|
13
13
|
export { type SecurityHeadersOptions, securityHeaders } from "./security-headers.js";
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EACL,gCAAgC,EAChC,KAAK,uBAAuB,EAC5B,gBAAgB,GACjB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EACL,gCAAgC,EAChC,KAAK,uBAAuB,EAC5B,gBAAgB,GACjB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EACL,aAAa,EACb,KAAK,qBAAqB,EAC1B,cAAc,EACd,SAAS,GACV,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,0BAA0B,EAC1B,KAAK,qBAAqB,EAC1B,cAAc,EACd,2BAA2B,GAC5B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,EACL,KAAK,0BAA0B,EAC/B,sBAAsB,EACtB,KAAK,wBAAwB,EAC7B,OAAO,EACP,KAAK,gBAAgB,EACrB,iBAAiB,GAClB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,KAAK,kBAAkB,EACvB,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,KAAK,4BAA4B,EACjC,WAAW,EACX,8BAA8B,EAC9B,sBAAsB,EACtB,0BAA0B,EAC1B,gBAAgB,EAChB,WAAW,EACX,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,SAAS,EACT,qBAAqB,GACtB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,KAAK,sBAAsB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA"}
|
package/dist/middleware/index.js
CHANGED
|
@@ -2,12 +2,12 @@ export { requireAuth } from "./auth.js";
|
|
|
2
2
|
export { DEFAULT_REQUEST_BODY_LIMIT_BYTES, requestBodyLimit, } from "./body-size.js";
|
|
3
3
|
export { cors } from "./cors.js";
|
|
4
4
|
export { db } from "./db.js";
|
|
5
|
-
export { errorBoundary, handleApiError, requestId } from "./error-boundary.js";
|
|
5
|
+
export { errorBoundary, handleApiError, requestId, } from "./error-boundary.js";
|
|
6
6
|
export { DEFAULT_IDEMPOTENCY_TTL_MS, idempotencyKey, purgeExpiredIdempotencyKeys, } from "./idempotency-key.js";
|
|
7
7
|
export { consoleLoggerProvider, logger } from "./logger.js";
|
|
8
8
|
export { DB_METRICS_CONTEXT_KEY, metrics, withQueryCounting, } from "./metrics.js";
|
|
9
9
|
export { publicResponseCache, resetPublicCacheStateForTests, } from "./public-cache.js";
|
|
10
10
|
export { clientIpKey, createCloudflareRateLimitStore, createKvRateLimitStore, createMemoryRateLimitStore, enforceRateLimit, LIVE_LIMITS, rateLimit, resolveRateLimitStore, } from "./rate-limit.js";
|
|
11
|
-
export { requireActor } from "./require-actor.js";
|
|
11
|
+
export { isStaffRbacEnforced, requireActor } from "./require-actor.js";
|
|
12
12
|
export { requirePermission } from "./require-permission.js";
|
|
13
13
|
export { securityHeaders } from "./security-headers.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/middleware/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/middleware/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAA;AAG7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,eAAO,MAAM,qBAAqB,EAAE,cAKnC,CAAA;AAUD,wBAAgB,MAAM,CAAC,QAAQ,CAAC,EAAE,cAAc,GAAG,iBAAiB,CAcnE"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { getRequestId } from "../observability/request-context.js";
|
|
1
2
|
export const consoleLoggerProvider = {
|
|
2
3
|
log(entry) {
|
|
3
|
-
|
|
4
|
+
const id = entry.requestId ? ` [${entry.requestId}]` : "";
|
|
5
|
+
console.log(`${entry.method} ${entry.path} → ${entry.status} (${entry.durationMs}ms)${id}`);
|
|
4
6
|
},
|
|
5
7
|
};
|
|
6
8
|
function logPath(c) {
|
|
@@ -22,6 +24,7 @@ export function logger(provider) {
|
|
|
22
24
|
path: logPath(c),
|
|
23
25
|
status: c.res.status,
|
|
24
26
|
durationMs,
|
|
27
|
+
requestId: getRequestId() ?? c.get("requestId"),
|
|
25
28
|
});
|
|
26
29
|
};
|
|
27
30
|
}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { Actor } from "@voyant-travel/core";
|
|
2
2
|
import type { MiddlewareHandler } from "hono";
|
|
3
3
|
import type { VoyantBindings, VoyantVariables } from "../types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Staff-session RBAC enforcement (member-rbac-rfc, voyant#2085). Enforced **by
|
|
6
|
+
* default**: every member's assigned scope set is checked across admin routes.
|
|
7
|
+
* Full-access members hold `*` and bypass, so they're unaffected. The
|
|
8
|
+
* `VOYANT_RBAC_ENFORCE` env var is a kill switch — set it to `0`/`false`/`off`
|
|
9
|
+
* to disable enforcement (e.g. an emergency rollback) without a code change.
|
|
10
|
+
* API-key scope enforcement is always on (unchanged).
|
|
11
|
+
*/
|
|
12
|
+
export declare function isStaffRbacEnforced(env: unknown): boolean;
|
|
4
13
|
/**
|
|
5
14
|
* Guards a route surface by actor type.
|
|
6
15
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-actor.d.ts","sourceRoot":"","sources":["../../src/middleware/require-actor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAEhD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAA;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAuClE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,SAAS,SAAS,cAAc,GAAG,cAAc,EAC5E,GAAG,OAAO,EAAE,KAAK,EAAE,GAClB,iBAAiB,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,EAAE,eAAe,CAAA;CAC3B,CAAC,
|
|
1
|
+
{"version":3,"file":"require-actor.d.ts","sourceRoot":"","sources":["../../src/middleware/require-actor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAEhD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAA;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAuClE;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAIzD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,SAAS,SAAS,cAAc,GAAG,cAAc,EAC5E,GAAG,OAAO,EAAE,KAAK,EAAE,GAClB,iBAAiB,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,EAAE,eAAe,CAAA;CAC3B,CAAC,CA8DD"}
|
|
@@ -31,6 +31,19 @@ function hasAnyApiKeyPermission(scopes, resource, actions) {
|
|
|
31
31
|
const permissions = permissionStringsToPermissions(scopes);
|
|
32
32
|
return actions.some((action) => hasApiKeyPermission(permissions, resource, action));
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Staff-session RBAC enforcement (member-rbac-rfc, voyant#2085). Enforced **by
|
|
36
|
+
* default**: every member's assigned scope set is checked across admin routes.
|
|
37
|
+
* Full-access members hold `*` and bypass, so they're unaffected. The
|
|
38
|
+
* `VOYANT_RBAC_ENFORCE` env var is a kill switch — set it to `0`/`false`/`off`
|
|
39
|
+
* to disable enforcement (e.g. an emergency rollback) without a code change.
|
|
40
|
+
* API-key scope enforcement is always on (unchanged).
|
|
41
|
+
*/
|
|
42
|
+
export function isStaffRbacEnforced(env) {
|
|
43
|
+
const value = env?.VOYANT_RBAC_ENFORCE;
|
|
44
|
+
const normalized = value?.trim().toLowerCase();
|
|
45
|
+
return !(normalized === "0" || normalized === "false" || normalized === "off");
|
|
46
|
+
}
|
|
34
47
|
/**
|
|
35
48
|
* Guards a route surface by actor type.
|
|
36
49
|
*
|
|
@@ -84,6 +97,22 @@ export function requireActor(...allowed) {
|
|
|
84
97
|
if (!allowSet.has(actor)) {
|
|
85
98
|
return c.json({ error: "Forbidden: actor not permitted on this surface" }, 403);
|
|
86
99
|
}
|
|
100
|
+
// Granular RBAC for staff sessions (member-rbac-rfc, voyant#2085). A member
|
|
101
|
+
// with an explicit, non-wildcard scope set is gated exactly like an API key:
|
|
102
|
+
// resource from the path, action from the method. Full-access members hold
|
|
103
|
+
// `*` (the default for unassigned members), so `hasAnyApiKeyPermission`
|
|
104
|
+
// passes them — existing deployments are unaffected. Paths with no mapped
|
|
105
|
+
// resource (e.g. `_meta`) stay open until a module is explicitly covered.
|
|
106
|
+
if (actor === "staff" && c.get("callerType") === "session" && isStaffRbacEnforced(c.env)) {
|
|
107
|
+
const scopes = c.get("scopes");
|
|
108
|
+
const resource = apiKeyResourceFromPath(new URL(c.req.url).pathname);
|
|
109
|
+
if (resource && resource !== "_meta") {
|
|
110
|
+
const actions = apiKeyPermissionActionsForMethod(c.req.method);
|
|
111
|
+
if (!hasAnyApiKeyPermission(scopes, resource, actions)) {
|
|
112
|
+
return c.json({ error: "Forbidden: missing required permission" }, 403);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
87
116
|
return next();
|
|
88
117
|
};
|
|
89
118
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AACnF,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalized error event emitted at every framework catch point (RFC #1553,
|
|
3
|
+
* primitive 2). `requestId` is the same correlation id surfaced to the end user
|
|
4
|
+
* and set on the `X-Request-Id` response header, so an operator can paste a
|
|
5
|
+
* user-reported reference straight into their telemetry backend and find the
|
|
6
|
+
* crash — the gap this RFC was filed to close.
|
|
7
|
+
*/
|
|
8
|
+
export interface ErrorEvent {
|
|
9
|
+
/** Correlation id minted/propagated by the `requestId` middleware. */
|
|
10
|
+
requestId: string;
|
|
11
|
+
/** Logical app/worker name, from `VoyantAppConfig.appName` (default `"voyant"`). */
|
|
12
|
+
app: string;
|
|
13
|
+
/** The thrown value. Adapters typically narrow with `instanceof Error`. */
|
|
14
|
+
error: unknown;
|
|
15
|
+
/** Request/operation metadata (path, method, status, code, …). */
|
|
16
|
+
context?: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The observability seam. A deployment registers ONE reporter (via
|
|
20
|
+
* `VoyantAppConfig.reporter`) that forwards normalized {@link ErrorEvent}s to
|
|
21
|
+
* its backend of choice — Sentry, OpenTelemetry, Datadog, console, or nothing.
|
|
22
|
+
* The framework owns the catch points and the event shape; the sink is a
|
|
23
|
+
* deployment decision. Implementations MUST NOT throw and SHOULD return quickly
|
|
24
|
+
* (returning a promise the runtime flushes via `waitUntil`) — capture is
|
|
25
|
+
* best-effort and must never mask the original error or block the response.
|
|
26
|
+
*/
|
|
27
|
+
export interface Reporter {
|
|
28
|
+
captureException(event: ErrorEvent): void | Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Forward an event to the reporter, defensively. Never throws (a reporter must
|
|
32
|
+
* not break the caller), and when `captureException` returns a promise, flushes
|
|
33
|
+
* it via the optional `waitUntil` (so HTTP catch points don't block the
|
|
34
|
+
* response) or lets it settle detached otherwise. The context-free counterpart
|
|
35
|
+
* to the HTTP `reportException` helper — used by non-request catch points
|
|
36
|
+
* (bootstrap, event-bus subscribers, scheduled jobs) where there is no `Context`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function safeCaptureException(reporter: Reporter, event: ErrorEvent, waitUntil?: (promise: Promise<unknown>) => void): void;
|
|
39
|
+
/**
|
|
40
|
+
* Default reporter: drops every event. Zero vendor coupling out of the box — a
|
|
41
|
+
* deployment opts in by supplying its own {@link Reporter}. The no-op default
|
|
42
|
+
* must stay a valid choice (RFC #1553 §5).
|
|
43
|
+
*/
|
|
44
|
+
export declare const noopReporter: Reporter;
|
|
45
|
+
/**
|
|
46
|
+
* Built-in reporter that writes one structured line per exception to
|
|
47
|
+
* `console.error` (tagged `[voyant:exception]`). Useful for local dev and for
|
|
48
|
+
* deployments whose log drain *is* their telemetry backend, without pulling in
|
|
49
|
+
* a vendor SDK. Never throws.
|
|
50
|
+
*/
|
|
51
|
+
export declare function consoleReporter(sink?: Pick<Console, "error">): Reporter;
|
|
52
|
+
//# sourceMappingURL=reporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../../src/observability/reporter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAA;IACjB,oFAAoF;IACpF,GAAG,EAAE,MAAM,CAAA;IACX,2EAA2E;IAC3E,KAAK,EAAE,OAAO,CAAA;IACd,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,QAAQ;IACvB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1D;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,UAAU,EACjB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,GAC9C,IAAI,CAYN;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,QAI1B,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,GAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAW,GAAG,QAAQ,CAiBhF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forward an event to the reporter, defensively. Never throws (a reporter must
|
|
3
|
+
* not break the caller), and when `captureException` returns a promise, flushes
|
|
4
|
+
* it via the optional `waitUntil` (so HTTP catch points don't block the
|
|
5
|
+
* response) or lets it settle detached otherwise. The context-free counterpart
|
|
6
|
+
* to the HTTP `reportException` helper — used by non-request catch points
|
|
7
|
+
* (bootstrap, event-bus subscribers, scheduled jobs) where there is no `Context`.
|
|
8
|
+
*/
|
|
9
|
+
export function safeCaptureException(reporter, event, waitUntil) {
|
|
10
|
+
let result;
|
|
11
|
+
try {
|
|
12
|
+
result = reporter.captureException(event);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (result && typeof result.then === "function") {
|
|
18
|
+
const settled = result.catch(() => { });
|
|
19
|
+
if (waitUntil)
|
|
20
|
+
waitUntil(settled);
|
|
21
|
+
else
|
|
22
|
+
void settled;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Default reporter: drops every event. Zero vendor coupling out of the box — a
|
|
27
|
+
* deployment opts in by supplying its own {@link Reporter}. The no-op default
|
|
28
|
+
* must stay a valid choice (RFC #1553 §5).
|
|
29
|
+
*/
|
|
30
|
+
export const noopReporter = {
|
|
31
|
+
captureException() {
|
|
32
|
+
// intentionally empty
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Built-in reporter that writes one structured line per exception to
|
|
37
|
+
* `console.error` (tagged `[voyant:exception]`). Useful for local dev and for
|
|
38
|
+
* deployments whose log drain *is* their telemetry backend, without pulling in
|
|
39
|
+
* a vendor SDK. Never throws.
|
|
40
|
+
*/
|
|
41
|
+
export function consoleReporter(sink = console) {
|
|
42
|
+
return {
|
|
43
|
+
captureException(event) {
|
|
44
|
+
try {
|
|
45
|
+
const { requestId, app, error, context } = event;
|
|
46
|
+
sink.error("[voyant:exception]", {
|
|
47
|
+
requestId,
|
|
48
|
+
app,
|
|
49
|
+
error: error instanceof Error ? error.message : String(error),
|
|
50
|
+
stack: error instanceof Error ? error.stack : undefined,
|
|
51
|
+
...(context ? { context } : {}),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// a reporter must never break the response
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run `fn` (and everything it awaits) with `id` bound as the ambient request
|
|
3
|
+
* id. Returns whatever `fn` returns — for the middleware, the `next()` promise.
|
|
4
|
+
*/
|
|
5
|
+
export declare function runWithRequestId<T>(id: string, fn: () => T): T;
|
|
6
|
+
/**
|
|
7
|
+
* Read the ambient request id for the current async context, or `undefined`
|
|
8
|
+
* when called outside a request (or on a runtime without async_hooks). Access
|
|
9
|
+
* is defensive: it never throws, so callers can safely fall back to a context
|
|
10
|
+
* variable or header.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getRequestId(): string | undefined;
|
|
13
|
+
//# sourceMappingURL=request-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-context.d.ts","sourceRoot":"","sources":["../../src/observability/request-context.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,MAAM,GAAG,SAAS,CAMjD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
/**
|
|
3
|
+
* Async-context store carrying the per-request correlation id (RFC #1553,
|
|
4
|
+
* primitive 1). The `requestId` middleware mints/propagates the id and runs the
|
|
5
|
+
* remainder of the request inside {@link runWithRequestId}, so any code on that
|
|
6
|
+
* async call stack — services, event subscribers, error reporters — can read it
|
|
7
|
+
* via {@link getRequestId} without threading it through every signature or
|
|
8
|
+
* reaching for the Hono `Context`. This is the single correlation key shared by
|
|
9
|
+
* the `X-Request-Id` response header, app logs, and emitted error events.
|
|
10
|
+
*
|
|
11
|
+
* Requires the `nodejs_compat` (or `nodejs_als`) compatibility flag on
|
|
12
|
+
* Cloudflare Workers; native on Node.
|
|
13
|
+
*/
|
|
14
|
+
const requestIdStore = new AsyncLocalStorage();
|
|
15
|
+
/**
|
|
16
|
+
* Run `fn` (and everything it awaits) with `id` bound as the ambient request
|
|
17
|
+
* id. Returns whatever `fn` returns — for the middleware, the `next()` promise.
|
|
18
|
+
*/
|
|
19
|
+
export function runWithRequestId(id, fn) {
|
|
20
|
+
return requestIdStore.run(id, fn);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Read the ambient request id for the current async context, or `undefined`
|
|
24
|
+
* when called outside a request (or on a runtime without async_hooks). Access
|
|
25
|
+
* is defensive: it never throws, so callers can safely fall back to a context
|
|
26
|
+
* variable or header.
|
|
27
|
+
*/
|
|
28
|
+
export function getRequestId() {
|
|
29
|
+
try {
|
|
30
|
+
return requestIdStore.getStore();
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { NeonDatabase as NeonWsDatabase } from "drizzle-orm/neon-serverless
|
|
|
7
7
|
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
8
8
|
import type { Hono } from "hono";
|
|
9
9
|
import type { HonoExtension, HonoModule } from "./module.js";
|
|
10
|
+
import type { Reporter } from "./observability/reporter.js";
|
|
10
11
|
import type { HonoBundle } from "./plugin.js";
|
|
11
12
|
export interface VoyantExecutionContext {
|
|
12
13
|
waitUntil?: (promise: Promise<unknown>) => void;
|
|
@@ -35,6 +36,12 @@ export interface VoyantBindings {
|
|
|
35
36
|
export type VoyantDb = PostgresJsDatabase | NeonHttpDatabase | NeonWsDatabase;
|
|
36
37
|
export type VoyantQueryRuntime = QueryRunner;
|
|
37
38
|
export type VoyantVariables = CoreVoyantVariables & {
|
|
39
|
+
/**
|
|
40
|
+
* Per-request correlation id (RFC #1553). Set by the `requestId` middleware;
|
|
41
|
+
* also on the `X-Request-Id` response header and readable from any async
|
|
42
|
+
* context via `getRequestId()`.
|
|
43
|
+
*/
|
|
44
|
+
requestId?: string;
|
|
38
45
|
db: VoyantDb;
|
|
39
46
|
/** Shared app/runtime container for explicit service resolution. */
|
|
40
47
|
container: ModuleContainer;
|
|
@@ -118,6 +125,8 @@ export interface LogEntry {
|
|
|
118
125
|
path: string;
|
|
119
126
|
status: number;
|
|
120
127
|
durationMs: number;
|
|
128
|
+
/** Per-request correlation id (RFC #1553), when available. */
|
|
129
|
+
requestId?: string;
|
|
121
130
|
}
|
|
122
131
|
export interface LoggerProvider {
|
|
123
132
|
log(entry: LogEntry): void;
|
|
@@ -180,6 +189,22 @@ export interface VoyantAppConfig<TBindings extends VoyantBindings = VoyantBindin
|
|
|
180
189
|
auth?: VoyantAuthIntegration<TBindings>;
|
|
181
190
|
publicPaths?: string[];
|
|
182
191
|
logger?: LoggerProvider;
|
|
192
|
+
/**
|
|
193
|
+
* Observability sink for unhandled exceptions at framework catch points
|
|
194
|
+
* (RFC #1553). Receives a normalized `{ requestId, app, error, context }`
|
|
195
|
+
* event for every 5xx — the `requestId` matches the one surfaced to the user
|
|
196
|
+
* on `X-Request-Id`, so a reported reference is findable in the backend.
|
|
197
|
+
* Defaults to a no-op (zero vendor coupling). Supply a `Reporter` — a
|
|
198
|
+
* Sentry/OpenTelemetry adapter, or the built-in `consoleReporter` — to wire a
|
|
199
|
+
* backend. The framework owns the catch points + event shape; the sink is a
|
|
200
|
+
* deployment choice.
|
|
201
|
+
*/
|
|
202
|
+
reporter?: Reporter;
|
|
203
|
+
/**
|
|
204
|
+
* Logical name for this app/worker, stamped on emitted error events and used
|
|
205
|
+
* for log correlation. Defaults to `"voyant"`.
|
|
206
|
+
*/
|
|
207
|
+
appName?: string;
|
|
183
208
|
/**
|
|
184
209
|
* Shared response cache for the public surface (`/v1/public/*` by
|
|
185
210
|
* default). Enabled by default but inert until a route marks its
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{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,MAAM,CAAA;SACvB,CAAC,CAAA;KACH,CAAA;IAED,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAA;CAC5C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,qBAAqB,CAAC,SAAS,GAAG,OAAO;IACxD;;;;OAIG;IACH,MAAM,EAAE,CAAC,QAAQ,EAAE,SAAS,KAAK,aAAa,CAAA;IAC9C;;;;OAIG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,aAAa,CAAA;IACtD;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyant-travel/hono",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.114.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
"import": "./dist/types.js",
|
|
45
45
|
"default": "./dist/types.js"
|
|
46
46
|
},
|
|
47
|
+
"./observability": {
|
|
48
|
+
"types": "./dist/observability/index.d.ts",
|
|
49
|
+
"import": "./dist/observability/index.js",
|
|
50
|
+
"default": "./dist/observability/index.js"
|
|
51
|
+
},
|
|
47
52
|
"./middleware": {
|
|
48
53
|
"types": "./dist/middleware/index.d.ts",
|
|
49
54
|
"import": "./dist/middleware/index.js",
|
|
@@ -119,19 +124,19 @@
|
|
|
119
124
|
"drizzle-orm": "^0.45.2",
|
|
120
125
|
"hono": "^4.12.10",
|
|
121
126
|
"zod": "^4.3.6",
|
|
122
|
-
"@voyant-travel/core": "^0.
|
|
123
|
-
"@voyant-travel/db": "^0.
|
|
124
|
-
"@voyant-travel/
|
|
125
|
-
"@voyant-travel/
|
|
126
|
-
"@voyant-travel/
|
|
127
|
-
"@voyant-travel/
|
|
127
|
+
"@voyant-travel/core": "^0.111.0",
|
|
128
|
+
"@voyant-travel/db": "^0.109.0",
|
|
129
|
+
"@voyant-travel/storage": "^0.105.0",
|
|
130
|
+
"@voyant-travel/types": "^0.105.0",
|
|
131
|
+
"@voyant-travel/utils": "^0.105.3",
|
|
132
|
+
"@voyant-travel/workflows": "^0.111.4"
|
|
128
133
|
},
|
|
129
134
|
"devDependencies": {
|
|
130
135
|
"@cloudflare/workers-types": "^4.20260426.1",
|
|
131
136
|
"typescript": "^6.0.2",
|
|
132
137
|
"vitest": "^4.1.2",
|
|
133
138
|
"@voyant-travel/voyant-typescript-config": "^0.1.0",
|
|
134
|
-
"@voyant-travel/workflows-orchestrator": "^0.111.
|
|
139
|
+
"@voyant-travel/workflows-orchestrator": "^0.111.4"
|
|
135
140
|
},
|
|
136
141
|
"files": [
|
|
137
142
|
"dist"
|