@stacksjs/router 0.75.538 → 0.75.541

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.
@@ -1,6 +1,15 @@
1
1
  import type { EnhancedRequest } from '@stacksjs/bun-router';
2
2
  import type { RequestInstance } from '@stacksjs/types';
3
3
  import type { StacksRequestMarkers } from './request-augmentation';
4
+ /**
5
+ * Read the active trace id, or `undefined` outside any traced scope.
6
+ *
7
+ * Falls back to the request's `_requestId` if no explicit trace was
8
+ * set so the helper is always useful from an HTTP handler — the router
9
+ * sets `_requestId` per request, and that value is the implicit trace
10
+ * for downstream calls until something more specific is configured.
11
+ */
12
+ export declare function getTraceId(): string | undefined;
4
13
  /**
5
14
  * Run `fn` under a fresh trace scope. Used by queue workers and cron
6
15
  * triggers to associate background work with the originating request
@@ -154,19 +154,7 @@ export declare const DEFAULT_ROUTE_BUNDLES_KEY: '__stacksDefaultRouteBundles';
154
154
  * `defaults/bootstrap.ts` gives: `config/auth.ts` ships enabled in every app,
155
155
  * so gating on it would widen existing apps' public surface on upgrade.
156
156
  */
157
- export declare const DEFAULT_ROUTE_BUNDLE_FEATURES: Record<typeof DEFAULT_ROUTE_BUNDLES[number], string>
158
-
159
- /**
160
- * The feature names the router asks about, and nothing wider.
161
- *
162
- * Spelled as literals rather than as `@stacksjs/config`'s `StacksFeature`, so
163
- * the router stays free of config. The check still happens: `feature` only
164
- * fits a `(name: DefaultRouteBundleFeature) => boolean` slot if it accepts
165
- * every name here, so a gate the router invents that `feature()` does not
166
- * know fails to compile at each caller. `email` was exactly that, a name only
167
- * the router knew (stacksjs/stacks#2867).
168
- */
169
- export type DefaultRouteBundleFeature = typeof DEFAULT_ROUTE_BUNDLE_FEATURES[keyof typeof DEFAULT_ROUTE_BUNDLE_FEATURES];
157
+ export declare const DEFAULT_ROUTE_BUNDLE_FEATURES: Record<typeof DEFAULT_ROUTE_BUNDLES[number], string>;
170
158
  export declare interface RootMountedAppRoute {
171
159
  method: string
172
160
  path: string
@@ -178,3 +166,14 @@ export declare interface DefaultRouteBundleSelection {
178
166
  explicit: boolean
179
167
  }
180
168
  export type DefaultRouteBundle = typeof DEFAULT_ROUTE_BUNDLES[number] | typeof OPT_IN_ROUTE_BUNDLES[number];
169
+ /**
170
+ * The feature names the router asks about, and nothing wider.
171
+ *
172
+ * Spelled as literals rather than as `@stacksjs/config`'s `StacksFeature`, so
173
+ * the router stays free of config. The check still happens: `feature` only
174
+ * fits a `(name: DefaultRouteBundleFeature) => boolean` slot if it accepts
175
+ * every name here, so a gate the router invents that `feature()` does not
176
+ * know fails to compile at each caller. `email` was exactly that, a name only
177
+ * the router knew (stacksjs/stacks#2867).
178
+ */
179
+ export type DefaultRouteBundleFeature = typeof DEFAULT_ROUTE_BUNDLE_FEATURES[keyof typeof DEFAULT_ROUTE_BUNDLE_FEATURES];
@@ -642,27 +642,4 @@ declare type ContextRunner = <T>(fn: () => T) => T;
642
642
  declare type NativeRouteHandler = (request: Request) => Response | Promise<Response>;
643
643
  declare type NativeRouteTable = Record<string, Record<string, NativeRouteHandler>>;
644
644
  declare type NativeResponseFinalizer = (response: Response, request: Request) => Response | Promise<Response>;
645
- /**
646
- * FIFO-bounded Map. Wraps `Map` with a hard size cap; on overflow,
647
- * the oldest entry (Map insertion order) is evicted. Used for the
648
- * router's small framework-internal caches whose size is normally
649
- * bounded by action count, but which had no upper limit before —
650
- * tests that instantiate many short-lived routers would leak entries
651
- * across `createStacksRouter()` calls (stacksjs/stacks#1863 T-8).
652
- *
653
- * Insertion-order LRU is appropriate here because the access pattern
654
- * is "set once at action-load time, then many reads" — refreshing on
655
- * get would buy nothing since reads dominate.
656
- */
657
- declare class BoundedMap<K, V> {
658
- private map;
659
- private max;
660
- constructor(max: number);
661
- get(key: K): V | undefined;
662
- has(key: K): boolean;
663
- set(key: K, value: V): this;
664
- delete(key: K): boolean;
665
- clear(): void;
666
- get size(): number;
667
- }
668
645
  export {};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/router",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.538",
5
+ "version": "0.75.541",
6
6
  "description": "The Stacks framework router.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -68,27 +68,27 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@stacksjs/bun-router": "^0.1.24",
71
- "@stacksjs/cache": "0.75.538",
72
- "@stacksjs/collections": "0.75.538",
73
- "@stacksjs/config": "0.75.538",
74
- "@stacksjs/error-handling": "0.75.538",
75
- "@stacksjs/logging": "0.75.538",
76
- "@stacksjs/pagination": "0.75.538",
77
- "@stacksjs/path": "0.75.538",
78
- "@stacksjs/security": "0.75.538",
79
- "@stacksjs/storage": "0.75.538",
71
+ "@stacksjs/cache": "0.75.541",
72
+ "@stacksjs/collections": "0.75.541",
73
+ "@stacksjs/config": "0.75.541",
74
+ "@stacksjs/error-handling": "0.75.541",
75
+ "@stacksjs/logging": "0.75.541",
76
+ "@stacksjs/pagination": "0.75.541",
77
+ "@stacksjs/path": "0.75.541",
78
+ "@stacksjs/security": "0.75.541",
79
+ "@stacksjs/storage": "0.75.541",
80
80
  "ts-rate-limiter": "^0.4.10"
81
81
  },
82
82
  "devDependencies": {
83
- "@stacksjs/actions": "0.75.538",
84
- "@stacksjs/types": "0.75.538",
83
+ "@stacksjs/actions": "0.75.541",
84
+ "@stacksjs/types": "0.75.541",
85
85
  "better-dx": "^0.2.24"
86
86
  },
87
87
  "peerDependencies": {
88
- "@stacksjs/api": "0.75.538",
89
- "@stacksjs/auth": "0.75.538",
90
- "@stacksjs/database": "0.75.538",
91
- "@stacksjs/validation": "0.75.538"
88
+ "@stacksjs/api": "0.75.541",
89
+ "@stacksjs/auth": "0.75.541",
90
+ "@stacksjs/database": "0.75.541",
91
+ "@stacksjs/validation": "0.75.541"
92
92
  },
93
93
  "peerDependenciesMeta": {
94
94
  "@stacksjs/api": {