@real-router/types 0.13.0 → 0.14.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.
@@ -433,6 +433,7 @@ interface Options {
433
433
  noValidate?: boolean;
434
434
  }
435
435
  type ActivationFn = (toState: State, fromState: State | undefined) => boolean | Promise<boolean | State | void> | State | void;
436
+ type GuardFn = (toState: State, fromState: State | undefined) => boolean | Promise<boolean>;
436
437
  type DefaultDependencies = object;
437
438
  interface Config {
438
439
  decoders: Record<string, (params: Params) => Params>;
@@ -486,9 +487,9 @@ interface Navigator {
486
487
  * Defines the contract for router implementations. The actual Router class in
487
488
  * @real-router/core implements this interface with full functionality.
488
489
  *
489
- * This interface uses `ActivationFn | boolean` for guard types to avoid circular
490
+ * This interface uses `GuardFn | boolean` for guard types to avoid circular
490
491
  * dependencies. The concrete Router class in @real-router/core narrows this to
491
- * `ActivationFnFactory | boolean` for more precise type checking.
492
+ * `GuardFnFactory | boolean` for more precise type checking.
492
493
  */
493
494
  interface Router {
494
495
  /**
@@ -498,7 +499,7 @@ interface Router {
498
499
  * @param guard - Guard function or boolean
499
500
  * @returns this for method chaining
500
501
  */
501
- addActivateGuard: (name: string, guard: ActivationFn | boolean) => this;
502
+ addActivateGuard: (name: string, guard: GuardFn | boolean) => this;
502
503
  /**
503
504
  * Register a deactivation guard for a route.
504
505
  *
@@ -506,7 +507,7 @@ interface Router {
506
507
  * @param guard - Guard function or boolean
507
508
  * @returns this for method chaining
508
509
  */
509
- addDeactivateGuard: (name: string, guard: ActivationFn | boolean) => this;
510
+ addDeactivateGuard: (name: string, guard: GuardFn | boolean) => this;
510
511
  /**
511
512
  * Remove an activation guard from a route.
512
513
  *
@@ -599,4 +600,4 @@ interface ErrorCodeToValueMap {
599
600
  ROUTER_DISPOSED: "DISPOSED";
600
601
  }
601
602
 
602
- export type { ActivationFn, Config, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventName, EventToNameMap, EventToPluginMap, EventsKeys, ForwardToCallback, LimitsConfig, Listener, Middleware, NavigationOptions, Navigator, Options, Params, Plugin, PluginMethod, QueryParamsMode, QueryParamsOptions, RouteParams, RouteTreeState, Router, RouterError, SimpleState, State, StateMeta, StateMetaInput, SubscribeFn, SubscribeState, Subscription, TransitionMeta, TransitionPhase, TransitionReason, Unsubscribe };
603
+ export type { ActivationFn, Config, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventName, EventToNameMap, EventToPluginMap, EventsKeys, ForwardToCallback, GuardFn, LimitsConfig, Listener, Middleware, NavigationOptions, Navigator, Options, Params, Plugin, PluginMethod, QueryParamsMode, QueryParamsOptions, RouteParams, RouteTreeState, Router, RouterError, SimpleState, State, StateMeta, StateMetaInput, SubscribeFn, SubscribeState, Subscription, TransitionMeta, TransitionPhase, TransitionReason, Unsubscribe };
@@ -1 +1 @@
1
- {"inputs":{"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js":{"bytes":569,"imports":[],"format":"esm"},"src/index.ts":{"bytes":1298,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/cjs/index.js":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":0}}}
1
+ {"inputs":{"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js":{"bytes":569,"imports":[],"format":"esm"},"src/index.ts":{"bytes":1309,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/cjs/index.js":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":0}}}
@@ -433,6 +433,7 @@ interface Options {
433
433
  noValidate?: boolean;
434
434
  }
435
435
  type ActivationFn = (toState: State, fromState: State | undefined) => boolean | Promise<boolean | State | void> | State | void;
436
+ type GuardFn = (toState: State, fromState: State | undefined) => boolean | Promise<boolean>;
436
437
  type DefaultDependencies = object;
437
438
  interface Config {
438
439
  decoders: Record<string, (params: Params) => Params>;
@@ -486,9 +487,9 @@ interface Navigator {
486
487
  * Defines the contract for router implementations. The actual Router class in
487
488
  * @real-router/core implements this interface with full functionality.
488
489
  *
489
- * This interface uses `ActivationFn | boolean` for guard types to avoid circular
490
+ * This interface uses `GuardFn | boolean` for guard types to avoid circular
490
491
  * dependencies. The concrete Router class in @real-router/core narrows this to
491
- * `ActivationFnFactory | boolean` for more precise type checking.
492
+ * `GuardFnFactory | boolean` for more precise type checking.
492
493
  */
493
494
  interface Router {
494
495
  /**
@@ -498,7 +499,7 @@ interface Router {
498
499
  * @param guard - Guard function or boolean
499
500
  * @returns this for method chaining
500
501
  */
501
- addActivateGuard: (name: string, guard: ActivationFn | boolean) => this;
502
+ addActivateGuard: (name: string, guard: GuardFn | boolean) => this;
502
503
  /**
503
504
  * Register a deactivation guard for a route.
504
505
  *
@@ -506,7 +507,7 @@ interface Router {
506
507
  * @param guard - Guard function or boolean
507
508
  * @returns this for method chaining
508
509
  */
509
- addDeactivateGuard: (name: string, guard: ActivationFn | boolean) => this;
510
+ addDeactivateGuard: (name: string, guard: GuardFn | boolean) => this;
510
511
  /**
511
512
  * Remove an activation guard from a route.
512
513
  *
@@ -599,4 +600,4 @@ interface ErrorCodeToValueMap {
599
600
  ROUTER_DISPOSED: "DISPOSED";
600
601
  }
601
602
 
602
- export type { ActivationFn, Config, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventName, EventToNameMap, EventToPluginMap, EventsKeys, ForwardToCallback, LimitsConfig, Listener, Middleware, NavigationOptions, Navigator, Options, Params, Plugin, PluginMethod, QueryParamsMode, QueryParamsOptions, RouteParams, RouteTreeState, Router, RouterError, SimpleState, State, StateMeta, StateMetaInput, SubscribeFn, SubscribeState, Subscription, TransitionMeta, TransitionPhase, TransitionReason, Unsubscribe };
603
+ export type { ActivationFn, Config, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventName, EventToNameMap, EventToPluginMap, EventsKeys, ForwardToCallback, GuardFn, LimitsConfig, Listener, Middleware, NavigationOptions, Navigator, Options, Params, Plugin, PluginMethod, QueryParamsMode, QueryParamsOptions, RouteParams, RouteTreeState, Router, RouterError, SimpleState, State, StateMeta, StateMetaInput, SubscribeFn, SubscribeState, Subscription, TransitionMeta, TransitionPhase, TransitionReason, Unsubscribe };
@@ -1 +1 @@
1
- {"inputs":{"src/index.ts":{"bytes":1298,"imports":[],"format":"esm"}},"outputs":{"dist/esm/index.mjs":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":0}}}
1
+ {"inputs":{"src/index.ts":{"bytes":1309,"imports":[],"format":"esm"}},"outputs":{"dist/esm/index.mjs":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":0}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@real-router/types",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "type": "commonjs",
5
5
  "description": "Shared TypeScript types for Real Router ecosystem",
6
6
  "types": "./dist/esm/index.d.mts",
package/src/index.ts CHANGED
@@ -32,6 +32,7 @@ export type {
32
32
  ForwardToCallback,
33
33
  DefaultParamsCallback,
34
34
  ActivationFn,
35
+ GuardFn,
35
36
  DefaultDependencies,
36
37
  Config,
37
38
  Plugin,
package/src/router.ts CHANGED
@@ -161,6 +161,11 @@ export type ActivationFn = (
161
161
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
162
162
  ) => boolean | Promise<boolean | State | void> | State | void;
163
163
 
164
+ export type GuardFn = (
165
+ toState: State,
166
+ fromState: State | undefined,
167
+ ) => boolean | Promise<boolean>;
168
+
164
169
  export type DefaultDependencies = object;
165
170
 
166
171
  export interface Config {
@@ -241,9 +246,9 @@ export interface Navigator {
241
246
  * Defines the contract for router implementations. The actual Router class in
242
247
  * @real-router/core implements this interface with full functionality.
243
248
  *
244
- * This interface uses `ActivationFn | boolean` for guard types to avoid circular
249
+ * This interface uses `GuardFn | boolean` for guard types to avoid circular
245
250
  * dependencies. The concrete Router class in @real-router/core narrows this to
246
- * `ActivationFnFactory | boolean` for more precise type checking.
251
+ * `GuardFnFactory | boolean` for more precise type checking.
247
252
  */
248
253
  export interface Router {
249
254
  /**
@@ -253,7 +258,7 @@ export interface Router {
253
258
  * @param guard - Guard function or boolean
254
259
  * @returns this for method chaining
255
260
  */
256
- addActivateGuard: (name: string, guard: ActivationFn | boolean) => this;
261
+ addActivateGuard: (name: string, guard: GuardFn | boolean) => this;
257
262
 
258
263
  /**
259
264
  * Register a deactivation guard for a route.
@@ -262,7 +267,7 @@ export interface Router {
262
267
  * @param guard - Guard function or boolean
263
268
  * @returns this for method chaining
264
269
  */
265
- addDeactivateGuard: (name: string, guard: ActivationFn | boolean) => this;
270
+ addDeactivateGuard: (name: string, guard: GuardFn | boolean) => this;
266
271
 
267
272
  /**
268
273
  * Remove an activation guard from a route.