@voyant-travel/hono 0.115.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/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;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,CAyc5F"}
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
@@ -56,10 +56,14 @@ export function mountApp(config) {
56
56
  const allModules = [...(config.modules ?? []), ...(expanded?.modules ?? [])];
57
57
  const allExtensions = [...(config.extensions ?? []), ...(expanded?.extensions ?? [])];
58
58
  // Anonymous-access allow-list (ADR-0008): assembled from module/extension
59
- // `anonymous` declarations + any explicit `publicPaths` escape-hatch entries.
59
+ // `anonymous` declarations + bundle-declared absolute anonymous paths (e.g. a
60
+ // payment-processor webhook) + any explicit `publicPaths` escape-hatch entries.
60
61
  // Used by both the auth middleware (skip auth / stamp customer actor) and the
61
62
  // public-write rate-limit matcher below, so the two never diverge.
62
- const anonymousPaths = assembleAnonymousPaths(allModules, allExtensions, config.publicPaths);
63
+ const anonymousPaths = assembleAnonymousPaths(allModules, allExtensions, [
64
+ ...(config.publicPaths ?? []),
65
+ ...(expanded?.anonymousPaths ?? []),
66
+ ]);
63
67
  // When the framework owns the bus, route subscriber-dispatch failures
64
68
  // (including the workflow forwarder) to the reporter — they're otherwise
65
69
  // only console-logged per the fire-and-forget EventBus contract (RFC #1553).
@@ -334,11 +338,18 @@ export function mountApp(config) {
334
338
  if (txModuleNames.has(mod.module.name) && mod.publicRoutes) {
335
339
  txPrefixes.push(resolveSurfaceMountPath("/v1/public", mod.publicPath, mod.module.name));
336
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);
337
346
  }
338
347
  for (const ext of allExtensions) {
339
348
  if (txModuleNames.has(ext.extension.module) && ext.publicRoutes) {
340
349
  txPrefixes.push(resolveSurfaceMountPath("/v1/public", ext.publicPath, ext.extension.module));
341
350
  }
351
+ if (ext.transactionalPaths)
352
+ txPrefixes.push(...ext.transactionalPaths);
342
353
  }
343
354
  // With a `dbTransactional` factory, requests are routed per surface:
344
355
  // transactional prefixes get it, everything else gets the cheap
@@ -367,6 +378,14 @@ export function mountApp(config) {
367
378
  if (pathname.startsWith("/v1/admin/") || pathname.startsWith("/v1/public/")) {
368
379
  return next();
369
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
+ }
370
389
  return requireLegacyActor(c, next);
371
390
  });
372
391
  // Admin capability discovery — GET /v1/admin/_meta/capabilities. A built-in
package/dist/module.d.ts CHANGED
@@ -51,6 +51,18 @@ export interface HonoModule {
51
51
  * require a `staff` actor.
52
52
  */
53
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[];
54
66
  }
55
67
  export interface HonoExtension {
56
68
  extension: Extension;
@@ -79,5 +91,10 @@ export interface HonoExtension {
79
91
  * to the extension's public mount.
80
92
  */
81
93
  anonymous?: boolean | readonly string[];
94
+ /**
95
+ * Absolute transactional path prefixes — same semantics as
96
+ * {@link HonoModule.transactionalPaths}.
97
+ */
98
+ transactionalPaths?: readonly string[];
82
99
  }
83
100
  //# sourceMappingURL=module.d.ts.map
@@ -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,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAEhC,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAExE,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAA;IACd;;;;;;OAMG;IAEH,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IAClB,kEAAkE;IAElE,WAAW,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IACvB,uFAAuF;IAEvF,YAAY,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IACxB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,gBAAgB,CAAA;IAClC,4FAA4F;IAC5F,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;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;CACxC;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,SAAS,CAAA;IACpB,0DAA0D;IAE1D,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IAClB,uEAAu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,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"}
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;
@@ -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,CAAA;IAC5B,gEAAgE;IAChE,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;;;;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,M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;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.115.0",
3
+ "version": "0.116.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -129,14 +129,14 @@
129
129
  "@voyant-travel/storage": "^0.105.0",
130
130
  "@voyant-travel/types": "^0.106.0",
131
131
  "@voyant-travel/utils": "^0.105.4",
132
- "@voyant-travel/workflows": "^0.111.5"
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.5"
139
+ "@voyant-travel/workflows-orchestrator": "^0.111.6"
140
140
  },
141
141
  "files": [
142
142
  "dist"