@voyant-travel/hono 0.114.0 → 0.116.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/dist/anonymous-paths.d.ts +15 -0
- package/dist/anonymous-paths.d.ts.map +1 -0
- package/dist/anonymous-paths.js +35 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +28 -13
- package/dist/composition.d.ts +32 -0
- package/dist/composition.d.ts.map +1 -1
- package/dist/composition.js +28 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/module.d.ts +36 -0
- package/dist/module.d.ts.map +1 -1
- package/dist/mount-paths.d.ts +11 -0
- package/dist/mount-paths.d.ts.map +1 -0
- package/dist/mount-paths.js +19 -0
- package/dist/plugin.d.ts +13 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +4 -1
- package/package.json +5 -5
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HonoExtension, HonoModule } from "./module.js";
|
|
2
|
+
/**
|
|
3
|
+
* Assemble the anonymous-access allow-list (ADR-0008) from module/extension
|
|
4
|
+
* `anonymous` declarations, unioned with any explicit `publicPaths` the
|
|
5
|
+
* deployment still passes (the escape hatch — e.g. plugin/webhook routes that
|
|
6
|
+
* aren't owned by a module, like a payment-processor callback).
|
|
7
|
+
*
|
|
8
|
+
* For each declaring unit the public mount is `resolveSurfaceMountPath` of its
|
|
9
|
+
* `publicPath`/name under `/v1/public`. `anonymous: true` opens the whole mount;
|
|
10
|
+
* a string array opens specific sub-paths relative to it. Pure and sorted for a
|
|
11
|
+
* deterministic, snapshot-auditable result; the global list is what `requireAuth`
|
|
12
|
+
* matches to skip auth (and stamp `actor: "customer"`).
|
|
13
|
+
*/
|
|
14
|
+
export declare function assembleAnonymousPaths(modules: readonly HonoModule[], extensions: readonly HonoExtension[], explicit?: readonly string[]): string[];
|
|
15
|
+
//# sourceMappingURL=anonymous-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anonymous-paths.d.ts","sourceRoot":"","sources":["../src/anonymous-paths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAG5D;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,SAAS,UAAU,EAAE,EAC9B,UAAU,EAAE,SAAS,aAAa,EAAE,EACpC,QAAQ,GAAE,SAAS,MAAM,EAAO,GAC/B,MAAM,EAAE,CAuBV"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { resolveSurfaceMountPath } from "./mount-paths.js";
|
|
2
|
+
/**
|
|
3
|
+
* Assemble the anonymous-access allow-list (ADR-0008) from module/extension
|
|
4
|
+
* `anonymous` declarations, unioned with any explicit `publicPaths` the
|
|
5
|
+
* deployment still passes (the escape hatch — e.g. plugin/webhook routes that
|
|
6
|
+
* aren't owned by a module, like a payment-processor callback).
|
|
7
|
+
*
|
|
8
|
+
* For each declaring unit the public mount is `resolveSurfaceMountPath` of its
|
|
9
|
+
* `publicPath`/name under `/v1/public`. `anonymous: true` opens the whole mount;
|
|
10
|
+
* a string array opens specific sub-paths relative to it. Pure and sorted for a
|
|
11
|
+
* deterministic, snapshot-auditable result; the global list is what `requireAuth`
|
|
12
|
+
* matches to skip auth (and stamp `actor: "customer"`).
|
|
13
|
+
*/
|
|
14
|
+
export function assembleAnonymousPaths(modules, extensions, explicit = []) {
|
|
15
|
+
const paths = new Set(explicit);
|
|
16
|
+
const add = (mount, anonymous) => {
|
|
17
|
+
if (!anonymous)
|
|
18
|
+
return;
|
|
19
|
+
if (anonymous === true) {
|
|
20
|
+
paths.add(mount);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
for (const sub of anonymous) {
|
|
24
|
+
const trimmed = sub.trim().replace(/^\/+|\/+$/g, "");
|
|
25
|
+
paths.add(trimmed ? `${mount}/${trimmed}` : mount);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
for (const m of modules) {
|
|
29
|
+
add(resolveSurfaceMountPath("/v1/public", m.publicPath, m.module.name), m.anonymous);
|
|
30
|
+
}
|
|
31
|
+
for (const e of extensions) {
|
|
32
|
+
add(resolveSurfaceMountPath("/v1/public", e.publicPath, e.extension.module), e.anonymous);
|
|
33
|
+
}
|
|
34
|
+
return [...paths].sort();
|
|
35
|
+
}
|
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;AAkC3B,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAY,eAAe,EAAE,MAAM,YAAY,CAAA;AAyB5F;;;;;;;;;;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,CA0d5F"}
|
package/dist/app.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createContainer, createEventBus, createQueryRunner, } from "@voyant-travel/core";
|
|
2
2
|
import { createOutboxEventStore } from "@voyant-travel/db/outbox";
|
|
3
3
|
import { Hono } from "hono";
|
|
4
|
+
import { assembleAnonymousPaths } from "./anonymous-paths.js";
|
|
4
5
|
import { containerToServiceResolver, makeFrameworkLogger, wireWorkflowRuntime, } from "./app-workflows.js";
|
|
5
6
|
import { mountLazyRoutePaths, mountLazyRoutesAt } from "./lazy-routes.js";
|
|
6
7
|
import { mountAuthForwarding } from "./lib/auth-forward.js";
|
|
@@ -19,19 +20,10 @@ import { publicResponseCache } from "./middleware/public-cache.js";
|
|
|
19
20
|
import { rateLimit, resolveRateLimitStore, } from "./middleware/rate-limit.js";
|
|
20
21
|
import { requireActor } from "./middleware/require-actor.js";
|
|
21
22
|
import { securityHeaders } from "./middleware/security-headers.js";
|
|
23
|
+
import { resolveSurfaceMountPath } from "./mount-paths.js";
|
|
22
24
|
import { noopReporter, safeCaptureException } from "./observability/reporter.js";
|
|
23
25
|
import { getRequestId } from "./observability/request-context.js";
|
|
24
26
|
import { expandHonoPlugins } from "./plugin.js";
|
|
25
|
-
function resolveSurfaceMountPath(prefix, path, fallback) {
|
|
26
|
-
const normalized = path?.trim();
|
|
27
|
-
if (!normalized) {
|
|
28
|
-
return `${prefix}/${fallback}`;
|
|
29
|
-
}
|
|
30
|
-
if (normalized === "/") {
|
|
31
|
-
return prefix;
|
|
32
|
-
}
|
|
33
|
-
return `${prefix}/${normalized.replace(/^\/+|\/+$/g, "")}`;
|
|
34
|
-
}
|
|
35
27
|
const WRITE_METHODS = new Set(["POST", "PUT", "PATCH", "DELETE"]);
|
|
36
28
|
function resolveConfiguredRateLimitStore(config, env) {
|
|
37
29
|
if (!config?.store)
|
|
@@ -63,6 +55,15 @@ export function mountApp(config) {
|
|
|
63
55
|
const expanded = config.plugins ? expandHonoPlugins(config.plugins) : null;
|
|
64
56
|
const allModules = [...(config.modules ?? []), ...(expanded?.modules ?? [])];
|
|
65
57
|
const allExtensions = [...(config.extensions ?? []), ...(expanded?.extensions ?? [])];
|
|
58
|
+
// Anonymous-access allow-list (ADR-0008): assembled from module/extension
|
|
59
|
+
// `anonymous` declarations + bundle-declared absolute anonymous paths (e.g. a
|
|
60
|
+
// payment-processor webhook) + any explicit `publicPaths` escape-hatch entries.
|
|
61
|
+
// Used by both the auth middleware (skip auth / stamp customer actor) and the
|
|
62
|
+
// public-write rate-limit matcher below, so the two never diverge.
|
|
63
|
+
const anonymousPaths = assembleAnonymousPaths(allModules, allExtensions, [
|
|
64
|
+
...(config.publicPaths ?? []),
|
|
65
|
+
...(expanded?.anonymousPaths ?? []),
|
|
66
|
+
]);
|
|
66
67
|
// When the framework owns the bus, route subscriber-dispatch failures
|
|
67
68
|
// (including the workflow forwarder) to the reporter — they're otherwise
|
|
68
69
|
// only console-logged per the fire-and-forget EventBus contract (RFC #1553).
|
|
@@ -235,8 +236,7 @@ export function mountApp(config) {
|
|
|
235
236
|
if (!WRITE_METHODS.has(c.req.method))
|
|
236
237
|
return next();
|
|
237
238
|
const pathname = normalizePathname(new URL(c.req.url).pathname);
|
|
238
|
-
const isPublicWrite = pathname.startsWith("/v1/public/") ||
|
|
239
|
-
matchesPublicPath(pathname, config.publicPaths ?? []);
|
|
239
|
+
const isPublicWrite = pathname.startsWith("/v1/public/") || matchesPublicPath(pathname, anonymousPaths);
|
|
240
240
|
if (!isPublicWrite)
|
|
241
241
|
return next();
|
|
242
242
|
return rateLimit(buildRateLimitPolicy(rateLimitConfig, c.env, "public-write", publicWriteRule))(c, next);
|
|
@@ -338,11 +338,18 @@ export function mountApp(config) {
|
|
|
338
338
|
if (txModuleNames.has(mod.module.name) && mod.publicRoutes) {
|
|
339
339
|
txPrefixes.push(resolveSurfaceMountPath("/v1/public", mod.publicPath, mod.module.name));
|
|
340
340
|
}
|
|
341
|
+
// Absolute transactional prefixes for routes mounted outside the name-based
|
|
342
|
+
// surface (e.g. a lazy family at `/v1/admin/catalog/quote`), so the
|
|
343
|
+
// deployment doesn't hand-maintain them in `dbTransactionalPaths` (ADR-0008).
|
|
344
|
+
if (mod.transactionalPaths)
|
|
345
|
+
txPrefixes.push(...mod.transactionalPaths);
|
|
341
346
|
}
|
|
342
347
|
for (const ext of allExtensions) {
|
|
343
348
|
if (txModuleNames.has(ext.extension.module) && ext.publicRoutes) {
|
|
344
349
|
txPrefixes.push(resolveSurfaceMountPath("/v1/public", ext.publicPath, ext.extension.module));
|
|
345
350
|
}
|
|
351
|
+
if (ext.transactionalPaths)
|
|
352
|
+
txPrefixes.push(...ext.transactionalPaths);
|
|
346
353
|
}
|
|
347
354
|
// With a `dbTransactional` factory, requests are routed per surface:
|
|
348
355
|
// transactional prefixes get it, everything else gets the cheap
|
|
@@ -356,7 +363,7 @@ export function mountApp(config) {
|
|
|
356
363
|
})
|
|
357
364
|
: config.db;
|
|
358
365
|
// Auth middleware for all other routes
|
|
359
|
-
app.use("*", requireAuth(dbSource, { publicPaths:
|
|
366
|
+
app.use("*", requireAuth(dbSource, { publicPaths: anonymousPaths, auth: config.auth }));
|
|
360
367
|
// DB middleware — sets c.var.db for all downstream handlers.
|
|
361
368
|
// Pass the list of modules that need interactive transactions so the
|
|
362
369
|
// middleware can throw a clear startup-style error on first request if
|
|
@@ -371,6 +378,14 @@ export function mountApp(config) {
|
|
|
371
378
|
if (pathname.startsWith("/v1/admin/") || pathname.startsWith("/v1/public/")) {
|
|
372
379
|
return next();
|
|
373
380
|
}
|
|
381
|
+
// Anonymous legacy/webhook routes (ADR-0008) — e.g. a bundle-declared
|
|
382
|
+
// payment-processor callback at `/v1/finance/...`. `requireAuth` already
|
|
383
|
+
// skipped credential resolution for these, but it only stamps an actor on
|
|
384
|
+
// `/v1/public/*`, so without this skip the fail-closed staff guard would 401
|
|
385
|
+
// a route that is meant to be reachable without a session.
|
|
386
|
+
if (matchesPublicPath(pathname, anonymousPaths)) {
|
|
387
|
+
return next();
|
|
388
|
+
}
|
|
374
389
|
return requireLegacyActor(c, next);
|
|
375
390
|
});
|
|
376
391
|
// Admin capability discovery — GET /v1/admin/_meta/capabilities. A built-in
|
package/dist/composition.d.ts
CHANGED
|
@@ -52,6 +52,38 @@ export interface ComposedApp {
|
|
|
52
52
|
* wired" fails loudly at boot rather than silently dropping a module.
|
|
53
53
|
*/
|
|
54
54
|
export declare function composeFromManifest<TCapabilities>(manifest: CompositionManifest, registry: CompositionRegistry<TCapabilities>, capabilities: TCapabilities): ComposedApp;
|
|
55
|
+
/**
|
|
56
|
+
* A module's place in the capability dependency graph (ADR-0007). `provides`
|
|
57
|
+
* are capability tokens the module supplies (e.g. `"people-directory"`);
|
|
58
|
+
* `requires` are tokens it depends on another mounted module — or an injected
|
|
59
|
+
* substitute — to supply. Tokens are opaque strings; the graph is the contract
|
|
60
|
+
* between modules, decoupled from concrete service shapes.
|
|
61
|
+
*
|
|
62
|
+
* `isRequired` marks a module the platform cannot run without: it can be
|
|
63
|
+
* *overridden* by a substitute (a future capability) but never `exclude`d.
|
|
64
|
+
*/
|
|
65
|
+
export interface CapabilityDeclaration {
|
|
66
|
+
provides?: readonly string[];
|
|
67
|
+
requires?: readonly string[];
|
|
68
|
+
isRequired?: boolean;
|
|
69
|
+
}
|
|
70
|
+
/** Maps a module specifier to its capability declaration. */
|
|
71
|
+
export type CapabilityGraph = Record<string, CapabilityDeclaration>;
|
|
72
|
+
/** An unmet `requires`: a capability no mounted module (nor a substitute) provides. */
|
|
73
|
+
export interface CapabilityGap {
|
|
74
|
+
capability: string;
|
|
75
|
+
/** Specifiers of the still-mounted modules that require the missing capability. */
|
|
76
|
+
requiredBy: string[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Pure dependency-graph check for module subsetting (ADR-0007). Given the
|
|
80
|
+
* specifiers that will actually mount (after any `exclude`) and the capability
|
|
81
|
+
* graph, return the gaps: required capabilities that nothing still-mounted
|
|
82
|
+
* provides. An empty array means the subset is safe to compose. Callers turn a
|
|
83
|
+
* non-empty result into a build/boot error so dropping a depended-on module
|
|
84
|
+
* fails loudly here rather than as a runtime 500.
|
|
85
|
+
*/
|
|
86
|
+
export declare function findCapabilityGaps(mountedSpecifiers: readonly string[], graph: CapabilityGraph): CapabilityGap[];
|
|
55
87
|
export interface ManifestRegistryDiff {
|
|
56
88
|
/** In the manifest but with no registered factory. */
|
|
57
89
|
missingFactories: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE5D;;;;;;;;;;;;;;;GAeG;AAEH,oEAAoE;AACpE,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAA;AAE9F,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC5B,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAA;CAChC;AAED,qFAAqF;AACrF,MAAM,WAAW,kBAAkB,CAAC,aAAa;IAC/C,YAAY,EAAE,aAAa,CAAA;IAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACjC;AAED,MAAM,MAAM,aAAa,CAAC,aAAa,IAAI,CACzC,GAAG,EAAE,kBAAkB,CAAC,aAAa,CAAC,KACnC,UAAU,GAAG,UAAU,EAAE,CAAA;AAC9B,MAAM,MAAM,gBAAgB,CAAC,aAAa,IAAI,CAC5C,GAAG,EAAE,kBAAkB,CAAC,aAAa,CAAC,KACnC,aAAa,CAAA;AAElB;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,aAAa;IAChD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC,CAAA;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC,MAA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,aAAa,EAAE,CAmBjB;AAED,MAAM,WAAW,oBAAoB;IACnC,sDAAsD;IACtD,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,2DAA2D;IAC3D,eAAe,EAAE,MAAM,EAAE,CAAA;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,gBAAgB,EAAE,EACnC,YAAY,EAAE,MAAM,EAAE,GACrB,oBAAoB,CAOtB"}
|
package/dist/composition.js
CHANGED
|
@@ -31,6 +31,34 @@ export function composeFromManifest(manifest, registry, capabilities) {
|
|
|
31
31
|
});
|
|
32
32
|
return { modules, extensions };
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Pure dependency-graph check for module subsetting (ADR-0007). Given the
|
|
36
|
+
* specifiers that will actually mount (after any `exclude`) and the capability
|
|
37
|
+
* graph, return the gaps: required capabilities that nothing still-mounted
|
|
38
|
+
* provides. An empty array means the subset is safe to compose. Callers turn a
|
|
39
|
+
* non-empty result into a build/boot error so dropping a depended-on module
|
|
40
|
+
* fails loudly here rather than as a runtime 500.
|
|
41
|
+
*/
|
|
42
|
+
export function findCapabilityGaps(mountedSpecifiers, graph) {
|
|
43
|
+
const provided = new Set();
|
|
44
|
+
for (const spec of mountedSpecifiers) {
|
|
45
|
+
for (const cap of graph[spec]?.provides ?? [])
|
|
46
|
+
provided.add(cap);
|
|
47
|
+
}
|
|
48
|
+
const gaps = new Map();
|
|
49
|
+
for (const spec of mountedSpecifiers) {
|
|
50
|
+
for (const cap of graph[spec]?.requires ?? []) {
|
|
51
|
+
if (provided.has(cap))
|
|
52
|
+
continue;
|
|
53
|
+
const by = gaps.get(cap) ?? new Set();
|
|
54
|
+
by.add(spec);
|
|
55
|
+
gaps.set(cap, by);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return [...gaps.entries()]
|
|
59
|
+
.map(([capability, by]) => ({ capability, requiredBy: [...by].sort() }))
|
|
60
|
+
.sort((a, b) => a.capability.localeCompare(b.capability));
|
|
61
|
+
}
|
|
34
62
|
/**
|
|
35
63
|
* Pure parity check between a manifest's entries and a registry's keys, for
|
|
36
64
|
* tooling (`voyant db doctor`). Reports manifest entries with no factory and
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type { VoyantPermission } from "@voyant-travel/core";
|
|
2
|
+
export { assembleAnonymousPaths } from "./anonymous-paths.js";
|
|
2
3
|
export { mountApp } from "./app.js";
|
|
3
4
|
export type { SessionAuthContext } from "./auth/index.js";
|
|
4
5
|
export { constantTimeEqual, extractBearerToken, generateNumericCode, randomBytesHex, requireUserId, sha256Base64Url, sha256Hex, unsignCookie, verifySession, } from "./auth/index.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,wBAAwB,CAAA;AACtE,OAAO,EACL,sBAAsB,EACtB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,kBAAkB,CAAA;AACzB,OAAO,E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A;AACtC,YAAY,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"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { assembleAnonymousPaths } from "./anonymous-paths.js";
|
|
1
2
|
export { mountApp } from "./app.js";
|
|
2
3
|
export { constantTimeEqual, extractBearerToken, generateNumericCode, randomBytesHex, requireUserId, sha256Base64Url, sha256Hex, unsignCookie, verifySession, } from "./auth/index.js";
|
|
3
4
|
export { createApp } from "./create-app.js";
|
package/dist/module.d.ts
CHANGED
|
@@ -38,6 +38,31 @@ export interface HonoModule {
|
|
|
38
38
|
* public root and omit the extra module segment.
|
|
39
39
|
*/
|
|
40
40
|
publicPath?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Declares which of this module's PUBLIC routes are reachable without a
|
|
43
|
+
* session (ADR-0008). `true` = the whole public mount is anonymous; a string
|
|
44
|
+
* array = specific sub-paths relative to the public mount (e.g.
|
|
45
|
+
* `["/contact-exists"]` on a module mounted at `/v1/public/customer-portal`
|
|
46
|
+
* opens `/v1/public/customer-portal/contact-exists`). The framework assembles
|
|
47
|
+
* the global anonymous allow-list from these declarations, so the
|
|
48
|
+
* "reachable-without-auth" decision lives next to the route rather than in a
|
|
49
|
+
* hand-maintained `publicPaths` list. Anonymous public requests are stamped
|
|
50
|
+
* `actor: "customer"`. Only affects the public surface — admin routes always
|
|
51
|
+
* require a `staff` actor.
|
|
52
|
+
*/
|
|
53
|
+
anonymous?: boolean | readonly string[];
|
|
54
|
+
/**
|
|
55
|
+
* Absolute API path prefixes whose requests must be served by the
|
|
56
|
+
* transaction-capable db client (ADR-0008). For modules whose
|
|
57
|
+
* transaction-needing routes are NOT under the name-based surface — e.g. a
|
|
58
|
+
* lazy family mounted at `/v1/admin/catalog/quote` rather than
|
|
59
|
+
* `/v1/admin/{name}` — and where only a SUBSET of the family's routes
|
|
60
|
+
* transact (so the boolean `module.requiresTransactionalDb` would be too
|
|
61
|
+
* broad). For the common case (all of a module's routes transact) prefer
|
|
62
|
+
* `module.requiresTransactionalDb`. Folded into the transactional-prefix map
|
|
63
|
+
* so the deployment doesn't hand-maintain `dbTransactionalPaths`.
|
|
64
|
+
*/
|
|
65
|
+
transactionalPaths?: readonly string[];
|
|
41
66
|
}
|
|
42
67
|
export interface HonoExtension {
|
|
43
68
|
extension: Extension;
|
|
@@ -60,5 +85,16 @@ export interface HonoExtension {
|
|
|
60
85
|
* at the public root and omit the extra module segment.
|
|
61
86
|
*/
|
|
62
87
|
publicPath?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Declares which of this extension's PUBLIC routes are reachable without a
|
|
90
|
+
* session (ADR-0008). Same semantics as {@link HonoModule.anonymous}, relative
|
|
91
|
+
* to the extension's public mount.
|
|
92
|
+
*/
|
|
93
|
+
anonymous?: boolean | readonly string[];
|
|
94
|
+
/**
|
|
95
|
+
* Absolute transactional path prefixes — same semantics as
|
|
96
|
+
* {@link HonoModule.transactionalPaths}.
|
|
97
|
+
*/
|
|
98
|
+
transactionalPaths?: readonly string[];
|
|
63
99
|
}
|
|
64
100
|
//# sourceMappingURL=module.d.ts.map
|
package/dist/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,KA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A;IACnC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,cAAc,CAAA;IAC3B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAAA;IACvC;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACvC;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,SAAS,CAAA;IACpB,0DAA0D;IAE1D,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IAClB,uEAAuE;IAEvE,WAAW,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IACvB,4FAA4F;IAE5F,YAAY,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IACxB,kGAAkG;IAClG,eAAe,CAAC,EAAE,gBAAgB,CAAA;IAClC,iGAAiG;IACjG,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC,gFAAgF;IAChF,UAAU,CAAC,EAAE,cAAc,CAAA;IAC3B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAAA;IACvC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACvC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve a route family's mount path under a surface prefix (`/v1/admin`,
|
|
3
|
+
* `/v1/public`). `path` is the optional `publicPath` override: empty →
|
|
4
|
+
* `{prefix}/{fallback}` (the module/extension name); `"/"` → the surface root
|
|
5
|
+
* (`prefix`); otherwise `{prefix}/{trimmed path}`.
|
|
6
|
+
*
|
|
7
|
+
* Shared by the route mounting in `app.ts` and the anonymous-path assembly in
|
|
8
|
+
* `anonymous-paths.ts` so both compute the same mount.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveSurfaceMountPath(prefix: string, path: string | undefined, fallback: string): string;
|
|
11
|
+
//# sourceMappingURL=mount-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount-paths.d.ts","sourceRoot":"","sources":["../src/mount-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,QAAQ,EAAE,MAAM,GACf,MAAM,CAYR"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve a route family's mount path under a surface prefix (`/v1/admin`,
|
|
3
|
+
* `/v1/public`). `path` is the optional `publicPath` override: empty →
|
|
4
|
+
* `{prefix}/{fallback}` (the module/extension name); `"/"` → the surface root
|
|
5
|
+
* (`prefix`); otherwise `{prefix}/{trimmed path}`.
|
|
6
|
+
*
|
|
7
|
+
* Shared by the route mounting in `app.ts` and the anonymous-path assembly in
|
|
8
|
+
* `anonymous-paths.ts` so both compute the same mount.
|
|
9
|
+
*/
|
|
10
|
+
export function resolveSurfaceMountPath(prefix, path, fallback) {
|
|
11
|
+
const normalized = path?.trim();
|
|
12
|
+
if (!normalized) {
|
|
13
|
+
return `${prefix}/${fallback}`;
|
|
14
|
+
}
|
|
15
|
+
if (normalized === "/") {
|
|
16
|
+
return prefix;
|
|
17
|
+
}
|
|
18
|
+
return `${prefix}/${normalized.replace(/^\/+|\/+$/g, "")}`;
|
|
19
|
+
}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -27,6 +27,17 @@ export interface HonoBundle {
|
|
|
27
27
|
subscribers?: Subscriber[];
|
|
28
28
|
/** Link definitions contributed by the plugin. */
|
|
29
29
|
links?: LinkDefinition[];
|
|
30
|
+
/**
|
|
31
|
+
* Absolute API paths this bundle exposes that are reachable WITHOUT a session
|
|
32
|
+
* (ADR-0008). Unlike a module/extension's `anonymous` (relative to its
|
|
33
|
+
* `/v1/public` mount), bundle routes can mount anywhere — e.g. a payment
|
|
34
|
+
* processor's webhook at `/v1/finance/providers/netopia/callback`, which the
|
|
35
|
+
* processor's servers POST to without a cookie or bearer. Declaring it here
|
|
36
|
+
* keeps the "reachable-without-auth" decision with the plugin that owns the
|
|
37
|
+
* route, instead of in every deployment's `publicPaths`. The framework folds
|
|
38
|
+
* these into the assembled anonymous allow-list.
|
|
39
|
+
*/
|
|
40
|
+
anonymous?: string[];
|
|
30
41
|
/**
|
|
31
42
|
* Workflows contributed by the plugin. Mirrors the `Plugin.workflows`
|
|
32
43
|
* field in `@voyant-travel/core` — collected at `createApp()` boot and
|
|
@@ -52,6 +63,8 @@ export interface ExpandedHonoBundles {
|
|
|
52
63
|
extensions: HonoExtension[];
|
|
53
64
|
subscribers: Subscriber[];
|
|
54
65
|
links: LinkDefinition[];
|
|
66
|
+
/** Absolute anonymous-access paths declared by bundles (ADR-0008). */
|
|
67
|
+
anonymousPaths: string[];
|
|
55
68
|
}
|
|
56
69
|
/** @deprecated Prefer {@link ExpandedHonoBundles}. */
|
|
57
70
|
export type ExpandedHonoPlugins = ExpandedHonoBundles;
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,UAAU,EACV,kBAAkB,EACnB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE5D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,UAAU;IACzB,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAA;IACZ,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,qEAAqE;IACrE,SAAS,CAAC,EAAE,gBAAgB,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OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;IACtB,sEAAsE;IACtE,UAAU,CAAC,EAAE,aAAa,EAAE,CAAA;IAC5B,wEAAwE;IACxE,WAAW,CAAC,EAAE,UAAU,EAAE,CAAA;IAC1B,kDAAkD;IAClD,KAAK,CAAC,EAAE,cAAc,EAAE,CAAA;IACxB;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;IACzC;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAA;CAChD;AAED,6CAA6C;AAC7C,MAAM,MAAM,UAAU,GAAG,UAAU,CAAA;AAEnC;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAEnE;AAED,mDAAmD;AACnD,eAAO,MAAM,gBAAgB,yBAAmB,CAAA;AAEhD,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,UAAU,EAAE,aAAa,EAAE,CAAA;IAC3B,WAAW,EAAE,UAAU,EAAE,CAAA;IACzB,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,sEAAsE;IACtE,cAAc,EAAE,MAAM,EAAE,CAAA;CACzB;AAED,sDAAsD;AACtD,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,CAAA;AAErD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,mBAAmB,CAsBzF;AAED,oDAAoD;AACpD,eAAO,MAAM,iBAAiB,0BAAoB,CAAA"}
|
package/dist/plugin.js
CHANGED
|
@@ -17,6 +17,7 @@ export function expandHonoBundles(bundles) {
|
|
|
17
17
|
const extensions = [];
|
|
18
18
|
const subscribers = [];
|
|
19
19
|
const links = [];
|
|
20
|
+
const anonymousPaths = [];
|
|
20
21
|
for (const bundle of bundles) {
|
|
21
22
|
if (seen.has(bundle.name)) {
|
|
22
23
|
throw new Error(`Duplicate bundle name: "${bundle.name}"`);
|
|
@@ -30,8 +31,10 @@ export function expandHonoBundles(bundles) {
|
|
|
30
31
|
subscribers.push(...bundle.subscribers);
|
|
31
32
|
if (bundle.links)
|
|
32
33
|
links.push(...bundle.links);
|
|
34
|
+
if (bundle.anonymous)
|
|
35
|
+
anonymousPaths.push(...bundle.anonymous);
|
|
33
36
|
}
|
|
34
|
-
return { modules, extensions, subscribers, links };
|
|
37
|
+
return { modules, extensions, subscribers, links, anonymousPaths };
|
|
35
38
|
}
|
|
36
39
|
/** @deprecated Prefer {@link expandHonoBundles}. */
|
|
37
40
|
export const expandHonoPlugins = expandHonoBundles;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyant-travel/hono",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.116.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -127,16 +127,16 @@
|
|
|
127
127
|
"@voyant-travel/core": "^0.111.0",
|
|
128
128
|
"@voyant-travel/db": "^0.109.0",
|
|
129
129
|
"@voyant-travel/storage": "^0.105.0",
|
|
130
|
-
"@voyant-travel/types": "^0.
|
|
131
|
-
"@voyant-travel/utils": "^0.105.
|
|
132
|
-
"@voyant-travel/workflows": "^0.111.
|
|
130
|
+
"@voyant-travel/types": "^0.106.0",
|
|
131
|
+
"@voyant-travel/utils": "^0.105.4",
|
|
132
|
+
"@voyant-travel/workflows": "^0.111.6"
|
|
133
133
|
},
|
|
134
134
|
"devDependencies": {
|
|
135
135
|
"@cloudflare/workers-types": "^4.20260426.1",
|
|
136
136
|
"typescript": "^6.0.2",
|
|
137
137
|
"vitest": "^4.1.2",
|
|
138
138
|
"@voyant-travel/voyant-typescript-config": "^0.1.0",
|
|
139
|
-
"@voyant-travel/workflows-orchestrator": "^0.111.
|
|
139
|
+
"@voyant-travel/workflows-orchestrator": "^0.111.6"
|
|
140
140
|
},
|
|
141
141
|
"files": [
|
|
142
142
|
"dist"
|