@real-router/types 0.4.0 → 0.6.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/cjs/index.d.ts +69 -9
- package/dist/cjs/metafile-cjs.json +1 -1
- package/dist/esm/index.d.mts +69 -9
- package/dist/esm/metafile-esm.json +1 -1
- package/package.json +2 -2
package/dist/cjs/index.d.ts
CHANGED
|
@@ -294,6 +294,55 @@ interface Params {
|
|
|
294
294
|
[key: string]: string | string[] | number | number[] | boolean | boolean[] | Params | Params[] | Record<string, string | number | boolean> | null | undefined;
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
+
/**
|
|
298
|
+
* Configuration for router resource limits.
|
|
299
|
+
* Controls maximum allowed values for various router operations to prevent resource exhaustion.
|
|
300
|
+
*/
|
|
301
|
+
interface LimitsConfig {
|
|
302
|
+
/**
|
|
303
|
+
* Maximum number of route dependencies allowed.
|
|
304
|
+
* Prevents circular dependency chains and excessive dependency graphs.
|
|
305
|
+
*
|
|
306
|
+
* @default 100
|
|
307
|
+
*/
|
|
308
|
+
maxDependencies: number;
|
|
309
|
+
/**
|
|
310
|
+
* Maximum number of plugins that can be registered.
|
|
311
|
+
* Limits plugin stack depth to prevent performance degradation.
|
|
312
|
+
*
|
|
313
|
+
* @default 50
|
|
314
|
+
*/
|
|
315
|
+
maxPlugins: number;
|
|
316
|
+
/**
|
|
317
|
+
* Maximum number of middleware functions in the navigation pipeline.
|
|
318
|
+
* Controls middleware chain length to prevent stack overflow and performance issues.
|
|
319
|
+
*
|
|
320
|
+
* @default 50
|
|
321
|
+
*/
|
|
322
|
+
maxMiddleware: number;
|
|
323
|
+
/**
|
|
324
|
+
* Maximum number of event listeners per event type.
|
|
325
|
+
* Prevents memory leaks from excessive listener registration.
|
|
326
|
+
*
|
|
327
|
+
* @default 10000
|
|
328
|
+
*/
|
|
329
|
+
maxListeners: number;
|
|
330
|
+
/**
|
|
331
|
+
* Maximum depth of nested event propagation.
|
|
332
|
+
* Prevents infinite recursion in event handling chains.
|
|
333
|
+
*
|
|
334
|
+
* @default 5
|
|
335
|
+
*/
|
|
336
|
+
maxEventDepth: number;
|
|
337
|
+
/**
|
|
338
|
+
* Maximum number of lifecycle handlers (canActivate/canDeactivate) per route.
|
|
339
|
+
* Controls guard function stack to prevent excessive validation overhead.
|
|
340
|
+
*
|
|
341
|
+
* @default 200
|
|
342
|
+
*/
|
|
343
|
+
maxLifecycleHandlers: number;
|
|
344
|
+
}
|
|
345
|
+
|
|
297
346
|
/**
|
|
298
347
|
* Base router types without Router class dependency.
|
|
299
348
|
*
|
|
@@ -310,6 +359,16 @@ interface LoggerConfig {
|
|
|
310
359
|
callback?: LogCallback | undefined;
|
|
311
360
|
callbackIgnoresLevel?: boolean;
|
|
312
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* Callback function for dynamically resolving the default route.
|
|
364
|
+
* Receives a dependency getter function to access router dependencies.
|
|
365
|
+
*/
|
|
366
|
+
type DefaultRouteCallback<Dependencies = object> = (getDependency: <K extends keyof Dependencies>(name: K) => Dependencies[K]) => string;
|
|
367
|
+
/**
|
|
368
|
+
* Callback function for dynamically resolving the default parameters.
|
|
369
|
+
* Receives a dependency getter function to access router dependencies.
|
|
370
|
+
*/
|
|
371
|
+
type DefaultParamsCallback<Dependencies = object> = (getDependency: <K extends keyof Dependencies>(name: K) => Dependencies[K]) => Params;
|
|
313
372
|
/**
|
|
314
373
|
* Router configuration options.
|
|
315
374
|
*
|
|
@@ -323,13 +382,13 @@ interface Options {
|
|
|
323
382
|
*
|
|
324
383
|
* @default ""
|
|
325
384
|
*/
|
|
326
|
-
defaultRoute: string;
|
|
385
|
+
defaultRoute: string | DefaultRouteCallback;
|
|
327
386
|
/**
|
|
328
387
|
* Default parameters for the default route.
|
|
329
388
|
*
|
|
330
389
|
* @default {}
|
|
331
390
|
*/
|
|
332
|
-
defaultParams: Params;
|
|
391
|
+
defaultParams: Params | DefaultParamsCallback;
|
|
333
392
|
/**
|
|
334
393
|
* How to handle trailing slashes in URLs.
|
|
335
394
|
* - "strict": Route must match exactly
|
|
@@ -340,12 +399,6 @@ interface Options {
|
|
|
340
399
|
* @default "preserve"
|
|
341
400
|
*/
|
|
342
401
|
trailingSlash: "strict" | "never" | "always" | "preserve";
|
|
343
|
-
/**
|
|
344
|
-
* Whether route names are case-sensitive.
|
|
345
|
-
*
|
|
346
|
-
* @default false
|
|
347
|
-
*/
|
|
348
|
-
caseSensitive: boolean;
|
|
349
402
|
/**
|
|
350
403
|
* How to encode URL parameters.
|
|
351
404
|
* - "default": Standard encoding
|
|
@@ -387,6 +440,13 @@ interface Options {
|
|
|
387
440
|
* @default undefined
|
|
388
441
|
*/
|
|
389
442
|
logger?: Partial<LoggerConfig>;
|
|
443
|
+
/**
|
|
444
|
+
* Router resource limits configuration.
|
|
445
|
+
* Controls maximum allowed values for various router operations.
|
|
446
|
+
*
|
|
447
|
+
* @default DEFAULT_LIMITS (from LimitsNamespace)
|
|
448
|
+
*/
|
|
449
|
+
limits?: Partial<LimitsConfig>;
|
|
390
450
|
/**
|
|
391
451
|
* Disables argument validation in public router methods.
|
|
392
452
|
* Use in production for performance. Keep false in development for early error detection.
|
|
@@ -500,4 +560,4 @@ interface ErrorCodeToValueMap {
|
|
|
500
560
|
TRANSITION_CANCELLED: "CANCELLED";
|
|
501
561
|
}
|
|
502
562
|
|
|
503
|
-
export type { ActivationFn, CancelFn, Config, DefaultDependencies, DoneFn, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventName, EventToNameMap, EventToPluginMap, EventsKeys, Listener, Middleware, NavigationOptions, Navigator, Options, Params, Plugin, PluginMethod, QueryParamsMode, QueryParamsOptions, RouteTreeState, RouterError, SimpleState, State, StateMeta, StateMetaInput, SubscribeFn, SubscribeState, Subscription, Unsubscribe };
|
|
563
|
+
export type { ActivationFn, CancelFn, Config, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, DoneFn, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventName, EventToNameMap, EventToPluginMap, EventsKeys, LimitsConfig, Listener, Middleware, NavigationOptions, Navigator, Options, Params, Plugin, PluginMethod, QueryParamsMode, QueryParamsOptions, RouteTreeState, RouterError, SimpleState, State, StateMeta, StateMetaInput, SubscribeFn, SubscribeState, Subscription, 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":
|
|
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":1217,"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}}}
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -294,6 +294,55 @@ interface Params {
|
|
|
294
294
|
[key: string]: string | string[] | number | number[] | boolean | boolean[] | Params | Params[] | Record<string, string | number | boolean> | null | undefined;
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
+
/**
|
|
298
|
+
* Configuration for router resource limits.
|
|
299
|
+
* Controls maximum allowed values for various router operations to prevent resource exhaustion.
|
|
300
|
+
*/
|
|
301
|
+
interface LimitsConfig {
|
|
302
|
+
/**
|
|
303
|
+
* Maximum number of route dependencies allowed.
|
|
304
|
+
* Prevents circular dependency chains and excessive dependency graphs.
|
|
305
|
+
*
|
|
306
|
+
* @default 100
|
|
307
|
+
*/
|
|
308
|
+
maxDependencies: number;
|
|
309
|
+
/**
|
|
310
|
+
* Maximum number of plugins that can be registered.
|
|
311
|
+
* Limits plugin stack depth to prevent performance degradation.
|
|
312
|
+
*
|
|
313
|
+
* @default 50
|
|
314
|
+
*/
|
|
315
|
+
maxPlugins: number;
|
|
316
|
+
/**
|
|
317
|
+
* Maximum number of middleware functions in the navigation pipeline.
|
|
318
|
+
* Controls middleware chain length to prevent stack overflow and performance issues.
|
|
319
|
+
*
|
|
320
|
+
* @default 50
|
|
321
|
+
*/
|
|
322
|
+
maxMiddleware: number;
|
|
323
|
+
/**
|
|
324
|
+
* Maximum number of event listeners per event type.
|
|
325
|
+
* Prevents memory leaks from excessive listener registration.
|
|
326
|
+
*
|
|
327
|
+
* @default 10000
|
|
328
|
+
*/
|
|
329
|
+
maxListeners: number;
|
|
330
|
+
/**
|
|
331
|
+
* Maximum depth of nested event propagation.
|
|
332
|
+
* Prevents infinite recursion in event handling chains.
|
|
333
|
+
*
|
|
334
|
+
* @default 5
|
|
335
|
+
*/
|
|
336
|
+
maxEventDepth: number;
|
|
337
|
+
/**
|
|
338
|
+
* Maximum number of lifecycle handlers (canActivate/canDeactivate) per route.
|
|
339
|
+
* Controls guard function stack to prevent excessive validation overhead.
|
|
340
|
+
*
|
|
341
|
+
* @default 200
|
|
342
|
+
*/
|
|
343
|
+
maxLifecycleHandlers: number;
|
|
344
|
+
}
|
|
345
|
+
|
|
297
346
|
/**
|
|
298
347
|
* Base router types without Router class dependency.
|
|
299
348
|
*
|
|
@@ -310,6 +359,16 @@ interface LoggerConfig {
|
|
|
310
359
|
callback?: LogCallback | undefined;
|
|
311
360
|
callbackIgnoresLevel?: boolean;
|
|
312
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* Callback function for dynamically resolving the default route.
|
|
364
|
+
* Receives a dependency getter function to access router dependencies.
|
|
365
|
+
*/
|
|
366
|
+
type DefaultRouteCallback<Dependencies = object> = (getDependency: <K extends keyof Dependencies>(name: K) => Dependencies[K]) => string;
|
|
367
|
+
/**
|
|
368
|
+
* Callback function for dynamically resolving the default parameters.
|
|
369
|
+
* Receives a dependency getter function to access router dependencies.
|
|
370
|
+
*/
|
|
371
|
+
type DefaultParamsCallback<Dependencies = object> = (getDependency: <K extends keyof Dependencies>(name: K) => Dependencies[K]) => Params;
|
|
313
372
|
/**
|
|
314
373
|
* Router configuration options.
|
|
315
374
|
*
|
|
@@ -323,13 +382,13 @@ interface Options {
|
|
|
323
382
|
*
|
|
324
383
|
* @default ""
|
|
325
384
|
*/
|
|
326
|
-
defaultRoute: string;
|
|
385
|
+
defaultRoute: string | DefaultRouteCallback;
|
|
327
386
|
/**
|
|
328
387
|
* Default parameters for the default route.
|
|
329
388
|
*
|
|
330
389
|
* @default {}
|
|
331
390
|
*/
|
|
332
|
-
defaultParams: Params;
|
|
391
|
+
defaultParams: Params | DefaultParamsCallback;
|
|
333
392
|
/**
|
|
334
393
|
* How to handle trailing slashes in URLs.
|
|
335
394
|
* - "strict": Route must match exactly
|
|
@@ -340,12 +399,6 @@ interface Options {
|
|
|
340
399
|
* @default "preserve"
|
|
341
400
|
*/
|
|
342
401
|
trailingSlash: "strict" | "never" | "always" | "preserve";
|
|
343
|
-
/**
|
|
344
|
-
* Whether route names are case-sensitive.
|
|
345
|
-
*
|
|
346
|
-
* @default false
|
|
347
|
-
*/
|
|
348
|
-
caseSensitive: boolean;
|
|
349
402
|
/**
|
|
350
403
|
* How to encode URL parameters.
|
|
351
404
|
* - "default": Standard encoding
|
|
@@ -387,6 +440,13 @@ interface Options {
|
|
|
387
440
|
* @default undefined
|
|
388
441
|
*/
|
|
389
442
|
logger?: Partial<LoggerConfig>;
|
|
443
|
+
/**
|
|
444
|
+
* Router resource limits configuration.
|
|
445
|
+
* Controls maximum allowed values for various router operations.
|
|
446
|
+
*
|
|
447
|
+
* @default DEFAULT_LIMITS (from LimitsNamespace)
|
|
448
|
+
*/
|
|
449
|
+
limits?: Partial<LimitsConfig>;
|
|
390
450
|
/**
|
|
391
451
|
* Disables argument validation in public router methods.
|
|
392
452
|
* Use in production for performance. Keep false in development for early error detection.
|
|
@@ -500,4 +560,4 @@ interface ErrorCodeToValueMap {
|
|
|
500
560
|
TRANSITION_CANCELLED: "CANCELLED";
|
|
501
561
|
}
|
|
502
562
|
|
|
503
|
-
export type { ActivationFn, CancelFn, Config, DefaultDependencies, DoneFn, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventName, EventToNameMap, EventToPluginMap, EventsKeys, Listener, Middleware, NavigationOptions, Navigator, Options, Params, Plugin, PluginMethod, QueryParamsMode, QueryParamsOptions, RouteTreeState, RouterError, SimpleState, State, StateMeta, StateMetaInput, SubscribeFn, SubscribeState, Subscription, Unsubscribe };
|
|
563
|
+
export type { ActivationFn, CancelFn, Config, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, DoneFn, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventName, EventToNameMap, EventToPluginMap, EventsKeys, LimitsConfig, Listener, Middleware, NavigationOptions, Navigator, Options, Params, Plugin, PluginMethod, QueryParamsMode, QueryParamsOptions, RouteTreeState, RouterError, SimpleState, State, StateMeta, StateMetaInput, SubscribeFn, SubscribeState, Subscription, Unsubscribe };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/index.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/index.ts":{"bytes":1217,"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.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "Shared TypeScript types for Real Router ecosystem",
|
|
6
6
|
"types": "./dist/esm/index.d.mts",
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsup",
|
|
40
40
|
"type-check": "tsc --noEmit",
|
|
41
|
-
"lint": "eslint --cache --ext .ts src/ --fix"
|
|
41
|
+
"lint": "eslint --cache --ext .ts src/ --fix --max-warnings 0"
|
|
42
42
|
}
|
|
43
43
|
}
|