@real-router/core 0.37.0 → 0.39.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 +76 -42
- package/dist/cjs/Router-B-Pev7K2.d.ts +46 -0
- package/dist/cjs/RouterValidator-mx2Zooya.d.ts +136 -0
- package/dist/cjs/api.d.ts +2 -1
- package/dist/cjs/api.js +1 -1
- package/dist/cjs/api.js.map +1 -1
- package/dist/cjs/index.d-y2b-8_3Y.d.ts +236 -0
- package/dist/cjs/index.d.ts +7 -24
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/metafile-cjs.json +1 -1
- package/dist/cjs/utils.d.ts +15 -0
- package/dist/cjs/utils.js +1 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/cjs/validation.d.ts +184 -0
- package/dist/cjs/validation.js +1 -0
- package/dist/cjs/validation.js.map +1 -0
- package/dist/esm/Router-B-Pev7K2.d.mts +46 -0
- package/dist/esm/RouterValidator-mx2Zooya.d.mts +136 -0
- package/dist/esm/api.d.mts +2 -1
- package/dist/esm/api.mjs +1 -1
- package/dist/esm/api.mjs.map +1 -1
- package/dist/esm/chunk-4SLMDQ2M.mjs +1 -0
- package/dist/esm/chunk-4SLMDQ2M.mjs.map +1 -0
- package/dist/esm/chunk-QUUNDESP.mjs +1 -0
- package/dist/esm/chunk-QUUNDESP.mjs.map +1 -0
- package/dist/esm/index.d-y2b-8_3Y.d.mts +236 -0
- package/dist/esm/index.d.mts +7 -24
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/metafile-esm.json +1 -1
- package/dist/esm/utils.d.mts +15 -0
- package/dist/esm/utils.mjs +1 -0
- package/dist/esm/utils.mjs.map +1 -0
- package/dist/esm/validation.d.mts +184 -0
- package/dist/esm/validation.mjs +1 -0
- package/dist/esm/validation.mjs.map +1 -0
- package/package.json +30 -5
- package/src/Router.ts +73 -99
- package/src/api/cloneRouter.ts +1 -30
- package/src/api/getDependenciesApi.ts +45 -86
- package/src/api/getLifecycleApi.ts +24 -19
- package/src/api/getPluginApi.ts +20 -28
- package/src/api/getRoutesApi.ts +49 -106
- package/src/constants.ts +0 -30
- package/src/guards.ts +46 -0
- package/src/helpers.ts +0 -17
- package/src/index.ts +4 -0
- package/src/internals.ts +6 -5
- package/src/namespaces/EventBusNamespace/EventBusNamespace.ts +2 -2
- package/src/namespaces/NavigationNamespace/NavigationNamespace.ts +0 -25
- package/src/namespaces/OptionsNamespace/OptionsNamespace.ts +4 -26
- package/src/namespaces/OptionsNamespace/constants.ts +0 -20
- package/src/namespaces/OptionsNamespace/index.ts +1 -5
- package/src/namespaces/OptionsNamespace/validators.ts +6 -245
- package/src/namespaces/PluginsNamespace/PluginsNamespace.ts +18 -59
- package/src/namespaces/PluginsNamespace/constants.ts +3 -6
- package/src/namespaces/PluginsNamespace/validators.ts +2 -57
- package/src/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.ts +27 -84
- package/src/namespaces/RouterLifecycleNamespace/RouterLifecycleNamespace.ts +0 -16
- package/src/namespaces/RoutesNamespace/RoutesNamespace.ts +3 -12
- package/src/namespaces/RoutesNamespace/constants.ts +0 -8
- package/src/namespaces/RoutesNamespace/forwardChain.ts +34 -0
- package/src/namespaces/RoutesNamespace/index.ts +1 -1
- package/src/namespaces/RoutesNamespace/routeGuards.ts +62 -0
- package/src/namespaces/RoutesNamespace/routesStore.ts +7 -51
- package/src/namespaces/StateNamespace/StateNamespace.ts +0 -33
- package/src/namespaces/StateNamespace/helpers.ts +1 -1
- package/src/namespaces/index.ts +0 -3
- package/src/typeGuards.ts +1 -15
- package/src/types/RouterValidator.ts +155 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/serializeState.ts +22 -0
- package/src/validation.ts +12 -0
- package/src/wiring/RouterWiringBuilder.ts +32 -9
- package/dist/cjs/index.d-DDimDpYc.d.ts +0 -165
- package/dist/esm/chunk-CG7TKDP3.mjs +0 -1
- package/dist/esm/chunk-CG7TKDP3.mjs.map +0 -1
- package/dist/esm/index.d-DDimDpYc.d.mts +0 -165
- package/src/namespaces/DependenciesNamespace/validators.ts +0 -103
- package/src/namespaces/EventBusNamespace/validators.ts +0 -36
- package/src/namespaces/NavigationNamespace/validators.ts +0 -47
- package/src/namespaces/RouteLifecycleNamespace/validators.ts +0 -65
- package/src/namespaces/RoutesNamespace/forwardToValidation.ts +0 -408
- package/src/namespaces/RoutesNamespace/validators.ts +0 -566
- package/src/namespaces/StateNamespace/validators.ts +0 -46
package/README.md
CHANGED
|
@@ -23,9 +23,11 @@ import { browserPluginFactory } from "@real-router/browser-plugin";
|
|
|
23
23
|
|
|
24
24
|
const routes = [
|
|
25
25
|
{ name: "home", path: "/" },
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
{
|
|
27
|
+
name: "users",
|
|
28
|
+
path: "/users",
|
|
29
|
+
children: [{ name: "profile", path: "/:id" }],
|
|
30
|
+
},
|
|
29
31
|
];
|
|
30
32
|
|
|
31
33
|
const router = createRouter(routes);
|
|
@@ -39,21 +41,21 @@ await router.navigate("users.profile", { id: "123" });
|
|
|
39
41
|
|
|
40
42
|
### Lifecycle
|
|
41
43
|
|
|
42
|
-
| Method
|
|
43
|
-
|
|
44
|
-
| `start(path)` | `Promise<State>` | Start the router with an initial path
|
|
45
|
-
| `stop()`
|
|
46
|
-
| `dispose()`
|
|
47
|
-
| `isActive()`
|
|
44
|
+
| Method | Returns | Description |
|
|
45
|
+
| ------------- | ---------------- | ---------------------------------------------- |
|
|
46
|
+
| `start(path)` | `Promise<State>` | Start the router with an initial path |
|
|
47
|
+
| `stop()` | `this` | Stop the router, cancel in-progress transition |
|
|
48
|
+
| `dispose()` | `void` | Permanently terminate (cannot restart) |
|
|
49
|
+
| `isActive()` | `boolean` | Whether the router is started |
|
|
48
50
|
|
|
49
51
|
### Navigation
|
|
50
52
|
|
|
51
|
-
| Method
|
|
52
|
-
|
|
53
|
+
| Method | Returns | Description |
|
|
54
|
+
| ----------------------------------- | ---------------- | ----------------------------------------- |
|
|
53
55
|
| `navigate(name, params?, options?)` | `Promise<State>` | Navigate to a route. Fire-and-forget safe |
|
|
54
|
-
| `navigateToDefault(options?)`
|
|
55
|
-
| `navigateToNotFound(path?)`
|
|
56
|
-
| `canNavigateTo(name, params?)`
|
|
56
|
+
| `navigateToDefault(options?)` | `Promise<State>` | Navigate to the default route |
|
|
57
|
+
| `navigateToNotFound(path?)` | `State` | Synchronously set UNKNOWN_ROUTE state |
|
|
58
|
+
| `canNavigateTo(name, params?)` | `boolean` | Check if guards allow navigation |
|
|
57
59
|
|
|
58
60
|
```typescript
|
|
59
61
|
await router.navigate("users.profile", { id: "123" });
|
|
@@ -67,20 +69,20 @@ controller.abort();
|
|
|
67
69
|
|
|
68
70
|
### State
|
|
69
71
|
|
|
70
|
-
| Method
|
|
71
|
-
|
|
72
|
-
| `getState()`
|
|
73
|
-
| `getPreviousState()`
|
|
74
|
-
| `areStatesEqual(s1, s2, ignoreQP?)`
|
|
75
|
-
| `isActiveRoute(name, params?, strict?, ignoreQP?)` | `boolean`
|
|
76
|
-
| `buildPath(name, params?)`
|
|
72
|
+
| Method | Returns | Description |
|
|
73
|
+
| -------------------------------------------------- | -------------------- | ------------------------------------ |
|
|
74
|
+
| `getState()` | `State \| undefined` | Current router state (deeply frozen) |
|
|
75
|
+
| `getPreviousState()` | `State \| undefined` | Previous router state |
|
|
76
|
+
| `areStatesEqual(s1, s2, ignoreQP?)` | `boolean` | Compare two states |
|
|
77
|
+
| `isActiveRoute(name, params?, strict?, ignoreQP?)` | `boolean` | Check if route is active |
|
|
78
|
+
| `buildPath(name, params?)` | `string` | Build URL path from route name |
|
|
77
79
|
|
|
78
80
|
### Events & Plugins
|
|
79
81
|
|
|
80
|
-
| Method
|
|
81
|
-
|
|
82
|
-
| `subscribe(listener)`
|
|
83
|
-
| `usePlugin(...plugins)` | `Unsubscribe` | Register plugin factories
|
|
82
|
+
| Method | Returns | Description |
|
|
83
|
+
| ----------------------- | ------------- | -------------------------------- |
|
|
84
|
+
| `subscribe(listener)` | `Unsubscribe` | Listen to successful transitions |
|
|
85
|
+
| `usePlugin(...plugins)` | `Unsubscribe` | Register plugin factories |
|
|
84
86
|
|
|
85
87
|
```typescript
|
|
86
88
|
const unsub = router.subscribe(({ route, previousRoute }) => {
|
|
@@ -102,13 +104,28 @@ import {
|
|
|
102
104
|
} from "@real-router/core/api";
|
|
103
105
|
```
|
|
104
106
|
|
|
105
|
-
| Function
|
|
106
|
-
|
|
107
|
-
| `getRoutesApi(router)`
|
|
108
|
-
| `getDependenciesApi(router)` | Dependency injection
|
|
109
|
-
| `getLifecycleApi(router)`
|
|
110
|
-
| `getPluginApi(router)`
|
|
111
|
-
| `cloneRouter(router, deps?)` | SSR cloning
|
|
107
|
+
| Function | Purpose | Key methods |
|
|
108
|
+
| ---------------------------- | --------------------- | ---------------------------------------------------------------------------- |
|
|
109
|
+
| `getRoutesApi(router)` | Dynamic route CRUD | `add`, `remove`, `update`, `replace`, `has`, `get` |
|
|
110
|
+
| `getDependenciesApi(router)` | Dependency injection | `get`, `set`, `setAll`, `remove`, `has` |
|
|
111
|
+
| `getLifecycleApi(router)` | Guard registration | `addActivateGuard`, `addDeactivateGuard`, `remove*` |
|
|
112
|
+
| `getPluginApi(router)` | Plugin infrastructure | `makeState`, `matchPath`, `addInterceptor`, `extendRouter`, `getRouteConfig` |
|
|
113
|
+
| `cloneRouter(router, deps?)` | SSR cloning | Shares route definitions, independent state |
|
|
114
|
+
|
|
115
|
+
## Utilities
|
|
116
|
+
|
|
117
|
+
SSR helpers imported from `@real-router/core/utils`.
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
import { serializeState } from "@real-router/core/utils";
|
|
121
|
+
|
|
122
|
+
const json = serializeState({ name: "home", path: "/" });
|
|
123
|
+
const html = `<script>window.__STATE__=${json}</script>`;
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
| Function | Purpose |
|
|
127
|
+
| ---------------------- | ----------------------------------------------------------------- |
|
|
128
|
+
| `serializeState(data)` | XSS-safe JSON serialization for embedding in HTML `<script>` tags |
|
|
112
129
|
|
|
113
130
|
### `getNavigator(router)` (main entry)
|
|
114
131
|
|
|
@@ -152,7 +169,11 @@ const routes: Route[] = [
|
|
|
152
169
|
return getDep("authService").isAdmin();
|
|
153
170
|
},
|
|
154
171
|
children: [
|
|
155
|
-
{
|
|
172
|
+
{
|
|
173
|
+
name: "dashboard",
|
|
174
|
+
path: "/dashboard",
|
|
175
|
+
defaultParams: { tab: "overview" },
|
|
176
|
+
},
|
|
156
177
|
],
|
|
157
178
|
},
|
|
158
179
|
{
|
|
@@ -188,6 +209,19 @@ try {
|
|
|
188
209
|
|
|
189
210
|
See [RouterError](https://github.com/greydragon888/real-router/wiki/RouterError) and [Error Codes](https://github.com/greydragon888/real-router/wiki/error-codes) for the full reference.
|
|
190
211
|
|
|
212
|
+
## Validation
|
|
213
|
+
|
|
214
|
+
Runtime argument validation is available via [@real-router/validation-plugin](https://www.npmjs.com/package/@real-router/validation-plugin):
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
import { validationPlugin } from "@real-router/validation-plugin";
|
|
218
|
+
|
|
219
|
+
router.usePlugin(validationPlugin()); // register before start()
|
|
220
|
+
await router.start("/");
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
The plugin adds descriptive error messages for every public API call. Register it in development, skip in production.
|
|
224
|
+
|
|
191
225
|
## Documentation
|
|
192
226
|
|
|
193
227
|
Full documentation: [Wiki](https://github.com/greydragon888/real-router/wiki)
|
|
@@ -201,15 +235,15 @@ Full documentation: [Wiki](https://github.com/greydragon888/real-router/wiki)
|
|
|
201
235
|
|
|
202
236
|
## Related Packages
|
|
203
237
|
|
|
204
|
-
| Package
|
|
205
|
-
|
|
206
|
-
| [@real-router/react](https://www.npmjs.com/package/@real-router/react)
|
|
207
|
-
| [@real-router/browser-plugin](https://www.npmjs.com/package/@real-router/browser-plugin)
|
|
208
|
-
| [@real-router/hash-plugin](https://www.npmjs.com/package/@real-router/hash-plugin)
|
|
209
|
-
| [@real-router/rx](https://www.npmjs.com/package/@real-router/rx)
|
|
210
|
-
| [@real-router/logger-plugin](https://www.npmjs.com/package/@real-router/logger-plugin)
|
|
211
|
-
| [@real-router/persistent-params-plugin](https://www.npmjs.com/package/@real-router/persistent-params-plugin) | Parameter persistence
|
|
212
|
-
| [@real-router/route-utils](https://www.npmjs.com/package/@real-router/route-utils)
|
|
238
|
+
| Package | Description |
|
|
239
|
+
| ------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------- |
|
|
240
|
+
| [@real-router/react](https://www.npmjs.com/package/@real-router/react) | React integration (`RouterProvider`, hooks, `Link`, `RouteView`) |
|
|
241
|
+
| [@real-router/browser-plugin](https://www.npmjs.com/package/@real-router/browser-plugin) | Browser History API and URL synchronization |
|
|
242
|
+
| [@real-router/hash-plugin](https://www.npmjs.com/package/@real-router/hash-plugin) | Hash-based routing |
|
|
243
|
+
| [@real-router/rx](https://www.npmjs.com/package/@real-router/rx) | Observable API (`state$`, `events$`, TC39 Observable) |
|
|
244
|
+
| [@real-router/logger-plugin](https://www.npmjs.com/package/@real-router/logger-plugin) | Development logging |
|
|
245
|
+
| [@real-router/persistent-params-plugin](https://www.npmjs.com/package/@real-router/persistent-params-plugin) | Parameter persistence |
|
|
246
|
+
| [@real-router/route-utils](https://www.npmjs.com/package/@real-router/route-utils) | Route tree queries and segment testing |
|
|
213
247
|
|
|
214
248
|
## Contributing
|
|
215
249
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { DefaultDependencies, Router as Router$1, Route, Options, Params, State, PluginFactory, Unsubscribe, SubscribeFn, NavigationOptions } from '@real-router/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Router class with integrated namespace architecture.
|
|
5
|
+
*
|
|
6
|
+
* All functionality is provided by namespace classes:
|
|
7
|
+
* - OptionsNamespace: getOptions (immutable)
|
|
8
|
+
* - DependenciesStore: get/set/remove dependencies
|
|
9
|
+
* - EventEmitter: subscribe
|
|
10
|
+
* - StateNamespace: state storage (getState, setState, getPreviousState)
|
|
11
|
+
* - RoutesNamespace: route tree operations
|
|
12
|
+
* - RouteLifecycleNamespace: canActivate/canDeactivate guards
|
|
13
|
+
* - PluginsNamespace: plugin lifecycle
|
|
14
|
+
* - NavigationNamespace: navigate
|
|
15
|
+
* - RouterLifecycleNamespace: start, stop, isStarted
|
|
16
|
+
*
|
|
17
|
+
* @internal This class implementation is internal. Use createRouter() instead.
|
|
18
|
+
*/
|
|
19
|
+
declare class Router<Dependencies extends DefaultDependencies = DefaultDependencies> implements Router$1<Dependencies> {
|
|
20
|
+
#private;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
/**
|
|
23
|
+
* @param routes - Route definitions
|
|
24
|
+
* @param options - Router options
|
|
25
|
+
* @param dependencies - DI dependencies
|
|
26
|
+
*/
|
|
27
|
+
constructor(routes?: Route<Dependencies>[], options?: Partial<Options>, dependencies?: Dependencies);
|
|
28
|
+
isActiveRoute(name: string, params?: Params, strictEquality?: boolean, ignoreQueryParams?: boolean): boolean;
|
|
29
|
+
buildPath(route: string, params?: Params): string;
|
|
30
|
+
getState<P extends Params = Params, MP extends Params = Params>(): State<P, MP> | undefined;
|
|
31
|
+
getPreviousState(): State | undefined;
|
|
32
|
+
areStatesEqual(state1: State | undefined, state2: State | undefined, ignoreQueryParams?: boolean): boolean;
|
|
33
|
+
shouldUpdateNode(nodeName: string): (toState: State, fromState?: State) => boolean;
|
|
34
|
+
isActive(): boolean;
|
|
35
|
+
start(startPath: string): Promise<State>;
|
|
36
|
+
stop(): this;
|
|
37
|
+
dispose(): void;
|
|
38
|
+
canNavigateTo(name: string, params?: Params): boolean;
|
|
39
|
+
usePlugin(...plugins: (PluginFactory<Dependencies> | false | null | undefined)[]): Unsubscribe;
|
|
40
|
+
subscribe(listener: SubscribeFn): Unsubscribe;
|
|
41
|
+
navigate(routeName: string, routeParams?: Params, options?: NavigationOptions): Promise<State>;
|
|
42
|
+
navigateToDefault(options?: NavigationOptions): Promise<State>;
|
|
43
|
+
navigateToNotFound(path?: string): State;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { Router as R };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { Params, RouteTreeState, LimitsConfig } from '@real-router/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Core-internal types + re-exports from @real-router/types.
|
|
5
|
+
*
|
|
6
|
+
* Factory types (PluginFactory, GuardFnFactory) and
|
|
7
|
+
* route config types (Route, RouteConfigUpdate) are canonical in @real-router/types
|
|
8
|
+
* and re-exported here for backward compatibility.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Immutable limits configuration type.
|
|
13
|
+
*/
|
|
14
|
+
type Limits = Readonly<LimitsConfig>;
|
|
15
|
+
/**
|
|
16
|
+
* Extended build result that includes segments for path building.
|
|
17
|
+
* Used internally to avoid duplicate getSegmentsByName calls.
|
|
18
|
+
*
|
|
19
|
+
* @param segments - Route segments from getSegmentsByName (typed as unknown[] for cross-package compatibility)
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
interface BuildStateResultWithSegments<P extends Params = Params> {
|
|
23
|
+
readonly state: RouteTreeState<P>;
|
|
24
|
+
readonly segments: readonly unknown[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* RouterValidator interface - defines all validation methods used by the router.
|
|
29
|
+
*
|
|
30
|
+
* This interface is implemented by the validation plugin and injected into RouterInternals.
|
|
31
|
+
* When ctx.validator is null (default), validation is skipped.
|
|
32
|
+
* When ctx.validator is set (by validation plugin), all methods are called.
|
|
33
|
+
*
|
|
34
|
+
* All parameters use `unknown` type to avoid coupling to internal type names.
|
|
35
|
+
*/
|
|
36
|
+
interface RouterValidator {
|
|
37
|
+
/**
|
|
38
|
+
* Route validation methods
|
|
39
|
+
*/
|
|
40
|
+
routes: {
|
|
41
|
+
validateBuildPathArgs: (route: unknown) => void;
|
|
42
|
+
validateMatchPathArgs: (path: unknown) => void;
|
|
43
|
+
validateIsActiveRouteArgs: (name: unknown, params: unknown, strict: unknown, ignoreQP: unknown) => void;
|
|
44
|
+
validateShouldUpdateNodeArgs: (name: unknown) => void;
|
|
45
|
+
validateStateBuilderArgs: (name: unknown, params: unknown, caller: string) => void;
|
|
46
|
+
validateAddRouteArgs: (routes: unknown) => void;
|
|
47
|
+
validateRoutes: (routes: unknown[], tree: unknown) => void;
|
|
48
|
+
validateRemoveRouteArgs: (name: unknown) => void;
|
|
49
|
+
validateUpdateRouteBasicArgs: (name: unknown, updates: unknown) => void;
|
|
50
|
+
validateUpdateRoutePropertyTypes: (name: string, updates: unknown) => void;
|
|
51
|
+
validateUpdateRoute: (name: string, updates: unknown, tree: unknown) => void;
|
|
52
|
+
validateParentOption: (parent: unknown, tree: unknown) => void;
|
|
53
|
+
validateRouteName: (name: unknown, caller: string) => void;
|
|
54
|
+
throwIfInternalRoute: (name: unknown, caller: string) => void;
|
|
55
|
+
throwIfInternalRouteInArray: (routes: unknown[], caller: string) => void;
|
|
56
|
+
validateExistingRoutes: (store: unknown) => void;
|
|
57
|
+
validateForwardToConsistency: (store: unknown) => void;
|
|
58
|
+
validateSetRootPathArgs: (rootPath: unknown) => void;
|
|
59
|
+
guardRouteCallbacks: (route: unknown) => void;
|
|
60
|
+
guardNoAsyncCallbacks: (route: unknown) => void;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Options validation methods
|
|
64
|
+
*/
|
|
65
|
+
options: {
|
|
66
|
+
validateLimitValue: (name: string, value: unknown) => void;
|
|
67
|
+
validateLimits: (limits: unknown) => void;
|
|
68
|
+
validateOptions: (options: unknown, methodName: string) => void;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Dependencies validation methods
|
|
72
|
+
*/
|
|
73
|
+
dependencies: {
|
|
74
|
+
validateDependencyName: (name: unknown, caller: string) => void;
|
|
75
|
+
validateSetDependencyArgs: (name: unknown, value: unknown, caller: string) => void;
|
|
76
|
+
validateDependenciesObject: (deps: unknown, caller: string) => void;
|
|
77
|
+
validateDependencyExists: (name: string, store: unknown) => void;
|
|
78
|
+
validateDependencyLimit: (store: unknown, limits: unknown) => void;
|
|
79
|
+
validateDependenciesStructure: (store: unknown) => void;
|
|
80
|
+
validateDependencyCount: (store: unknown, methodName: string) => void;
|
|
81
|
+
validateCloneArgs: (dependencies: unknown) => void;
|
|
82
|
+
warnOverwrite: (name: string, methodName: string) => void;
|
|
83
|
+
warnBatchOverwrite: (keys: string[], methodName: string) => void;
|
|
84
|
+
warnRemoveNonExistent: (name: unknown) => void;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Plugin validation methods
|
|
88
|
+
*/
|
|
89
|
+
plugins: {
|
|
90
|
+
validatePluginLimit: (count: number, limits: unknown) => void;
|
|
91
|
+
validateNoDuplicatePlugins: (factory: unknown, factories: unknown[]) => void;
|
|
92
|
+
validatePluginKeys: (plugin: unknown) => void;
|
|
93
|
+
validateCountThresholds: (count: number) => void;
|
|
94
|
+
warnBatchDuplicates: (plugins: unknown[]) => void;
|
|
95
|
+
warnPluginMethodType: (methodName: string) => void;
|
|
96
|
+
warnPluginAfterStart: (methodName: string) => void;
|
|
97
|
+
validateAddInterceptorArgs: (method: unknown, fn: unknown) => void;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Lifecycle guard validation methods
|
|
101
|
+
*/
|
|
102
|
+
lifecycle: {
|
|
103
|
+
validateHandler: (handler: unknown, caller: string) => void;
|
|
104
|
+
validateNotRegistering: (name: string, guards: unknown, caller: string) => void;
|
|
105
|
+
validateHandlerLimit: (count: number, limits: unknown, caller: string) => void;
|
|
106
|
+
validateCountThresholds: (count: number, methodName: string) => void;
|
|
107
|
+
warnOverwrite: (name: string, type: string, methodName: string) => void;
|
|
108
|
+
warnAsyncGuardSync: (name: string, methodName: string) => void;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Navigation validation methods
|
|
112
|
+
*/
|
|
113
|
+
navigation: {
|
|
114
|
+
validateNavigateArgs: (name: unknown) => void;
|
|
115
|
+
validateNavigateToDefaultArgs: (options: unknown) => void;
|
|
116
|
+
validateNavigationOptions: (options: unknown, caller: string) => void;
|
|
117
|
+
validateParams: (params: unknown, methodName: string) => void;
|
|
118
|
+
validateStartArgs: (path: unknown) => void;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* State validation methods
|
|
122
|
+
*/
|
|
123
|
+
state: {
|
|
124
|
+
validateMakeStateArgs: (name: unknown, params: unknown, path: unknown, forceId: unknown) => void;
|
|
125
|
+
validateAreStatesEqualArgs: (s1: unknown, s2: unknown, ignoreQP: unknown) => void;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Event bus validation methods
|
|
129
|
+
*/
|
|
130
|
+
eventBus: {
|
|
131
|
+
validateEventName: (name: unknown) => void;
|
|
132
|
+
validateListenerArgs: (name: unknown, cb: unknown) => void;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export type { BuildStateResultWithSegments as B, Limits as L, RouterValidator as R };
|
package/dist/cjs/api.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PluginApi as PluginApi$1, DefaultDependencies, Router, RoutesApi, DependenciesApi, LifecycleApi } from '@real-router/types';
|
|
2
2
|
export { DependenciesApi, LifecycleApi, RoutesApi } from '@real-router/types';
|
|
3
|
-
import {
|
|
3
|
+
import { R as RouteTree } from './index.d-y2b-8_3Y.js';
|
|
4
|
+
import { R as Router$1 } from './Router-B-Pev7K2.js';
|
|
4
5
|
|
|
5
6
|
interface PluginApi extends Omit<PluginApi$1, "getTree"> {
|
|
6
7
|
getTree: () => RouteTree;
|