@h3ravel/router 1.13.6 → 1.15.0-alpha.2

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.
Files changed (4) hide show
  1. package/dist/index.cjs +4473 -363
  2. package/dist/index.d.ts +2757 -159
  3. package/dist/index.js +4425 -362
  4. package/package.json +13 -11
package/dist/index.d.ts CHANGED
@@ -1,244 +1,2842 @@
1
1
  /// <reference path="./app.globals.d.ts" />
2
+ import * as _h3ravel_contracts0 from "@h3ravel/contracts";
3
+ import { ActionInput, CallableConstructor, ClassConstructor, ConcreteConstructor, GenericObject, IAbstractRouteCollection, IApplication, ICallableDispatcher, IContainer, IController, IControllerDispatcher, IDispatcher, IHttpContext, IMiddleware, IRequest, IResponse, IRoute, IRouteCollection, IRouteUrlGenerator, IRouter, IUrlGenerator, MiddlewareIdentifier, MiddlewareList, ResourceMethod, ResourceOptions, ResponsableType, RouteActions, RouteMethod, RouteParams, UrlRoutable } from "@h3ravel/contracts";
4
+ import { Middleware, Request, Response } from "@h3ravel/http";
5
+ import { H3, Middleware as Middleware$1, MiddlewareOptions } from "h3";
6
+ import * as _h3ravel_support9 from "@h3ravel/support";
7
+ import { Collection, ServiceProvider } from "@h3ravel/support";
8
+ import * as _h3ravel_shared0 from "@h3ravel/shared";
9
+ import { Magic } from "@h3ravel/shared";
2
10
  import { Command } from "@h3ravel/musket";
3
- import { EventHandler, ExtractControllerMethods, HttpContext, IMiddleware, IRouter, RouteEventHandler, RouterEnd } from "@h3ravel/shared";
4
11
  import { Model } from "@h3ravel/database";
5
- import { Application, ServiceProvider } from "@h3ravel/core";
6
- import { H3, Middleware, MiddlewareOptions } from "h3";
12
+ import { FRoute } from "@h3ravel/support/facades";
7
13
 
14
+ //#region src/RouteParameter.d.ts
15
+ declare class RouteParameter {
16
+ private name;
17
+ private type;
18
+ constructor(name: string, type: any);
19
+ /**
20
+ * Ge the route parameter name
21
+ */
22
+ getName(): string;
23
+ /**
24
+ * Ge the route parameter type
25
+ */
26
+ getType(): any;
27
+ }
28
+ //#endregion
29
+ //#region src/Contracts/Utilities.d.ts
30
+ type Pipe = string | (abstract new (...args: any[]) => any) | ((...args: any[]) => any) | IMiddleware;
31
+ type CompiledRouteToken = ['variable', string, string, string, boolean] | ['text', string];
32
+ interface RouteActionConditions {
33
+ [key: string]: any;
34
+ subClass: ConcreteConstructor<UrlRoutable>;
35
+ }
36
+ //#endregion
37
+ //#region src/CompiledRoute.d.ts
38
+ declare class CompiledRoute {
39
+ private path;
40
+ private tokens;
41
+ private variables;
42
+ private paramNames;
43
+ private optionalParams;
44
+ private regex;
45
+ private hostPattern?;
46
+ private hostRegex?;
47
+ constructor(path: string, optionalParams: Record<string, null>, hostPattern?: string);
48
+ /**
49
+ * Get the compiled path regex
50
+ */
51
+ getRegex(): RegExp;
52
+ /**
53
+ * Get the compiled host regex (if any)
54
+ */
55
+ getHostRegex(): RegExp | undefined;
56
+ /**
57
+ * Returns list of all param names (including optional)
58
+ */
59
+ getParamNames(): string[];
60
+ /**
61
+ * Returns list of all path variables
62
+ */
63
+ getVariables(): string[];
64
+ /**
65
+ * Returns list of all compiled tokens
66
+ */
67
+ getTokens(): CompiledRouteToken;
68
+ /**
69
+ * Returns optional params record
70
+ */
71
+ getOptionalParams(): Record<string, null>;
72
+ /**
73
+ * Build the route params
74
+ *
75
+ * @returns
76
+ */
77
+ private buildParams;
78
+ /**
79
+ * Build a regex from a path pattern
80
+ *
81
+ * @param path
82
+ * @param paramNames
83
+ * @param optionalParams
84
+ * @returns
85
+ */
86
+ private buildRegex;
87
+ /**
88
+ * Tokenize the the path
89
+ *
90
+ * @param optionalParams
91
+ * @returns
92
+ */
93
+ private tokenizePath;
94
+ }
95
+ //#endregion
96
+ //#region src/Traits/FiltersControllerMiddleware.d.ts
97
+ declare class FiltersControllerMiddleware {
98
+ /**
99
+ * Determine if the given options exclude a particular method.
100
+ *
101
+ * @param method
102
+ * @param options
103
+ */
104
+ static methodExcludedByOptions(method: RouteMethod, options: IMiddleware['options']): boolean;
105
+ }
106
+ //#endregion
107
+ //#region src/Traits/RouteDependencyResolver.d.ts
108
+ declare class RouteDependencyResolver {
109
+ protected container: IApplication;
110
+ constructor(container: IApplication);
111
+ /**
112
+ * Resolve the object method's type-hinted dependencies.
113
+ *
114
+ * @param parameters
115
+ * @param instance
116
+ * @param method
117
+ */
118
+ resolveClassMethodDependencies(parameters: Record<string, any>, instance: IController, method: ResourceMethod): Promise<Record<string, any>>;
119
+ /**
120
+ * Resolve the given method's type-hinted dependencies.
121
+ *
122
+ * @param parameters
123
+ */
124
+ resolveMethodDependencies(parameters: Record<string, any>): Record<string, any>;
125
+ }
126
+ //#endregion
127
+ //#region src/ControllerDispatcher.d.ts
128
+ declare const ControllerDispatcher_base: typeof RouteDependencyResolver & typeof IControllerDispatcher & typeof FiltersControllerMiddleware & (new (...args: any[]) => RouteDependencyResolver & IControllerDispatcher & FiltersControllerMiddleware);
129
+ declare class ControllerDispatcher extends ControllerDispatcher_base {
130
+ protected container: IApplication;
131
+ /**
132
+ *
133
+ * @param container The container instance.
134
+ */
135
+ constructor(container: IApplication);
136
+ /**
137
+ * Dispatch a request to a given controller and method.
138
+ *
139
+ * @param route
140
+ * @param controller
141
+ * @param method
142
+ */
143
+ dispatch(route: Route, controller: Required<IController>, method: ResourceMethod): Promise<any>;
144
+ /**
145
+ * Resolve the parameters for the controller.
146
+ *
147
+ * @param route
148
+ * @param controller
149
+ * @param method
150
+ */
151
+ protected resolveParameters(route: Route, controller: IController, method: ResourceMethod): Promise<Record<string, any>>;
152
+ /**
153
+ * Get the middleware for the controller instance.
154
+ *
155
+ * @param controller
156
+ * @param method
157
+ */
158
+ getMiddleware(controller: IController, method: RouteMethod): never[];
159
+ }
160
+ //#endregion
161
+ //#region src/Contracts/IRouteValidator.d.ts
162
+ declare abstract class IRouteValidator {
163
+ abstract matches(route: IRoute, request: IRequest): boolean | undefined;
164
+ }
165
+ //#endregion
166
+ //#region src/Matchers/HostValidator.d.ts
167
+ declare class HostValidator extends IRouteValidator {
168
+ /**
169
+ * Validate a given rule against a route and request.
170
+ *
171
+ * @param route
172
+ * @param request
173
+ */
174
+ matches(route: Route, request: Request): boolean;
175
+ }
176
+ //#endregion
177
+ //#region src/Matchers/MethodValidator.d.ts
178
+ declare class MethodValidator extends IRouteValidator {
179
+ /**
180
+ * Validate a given rule against a route and request.
181
+ *
182
+ * @param route
183
+ * @param request
184
+ */
185
+ matches(route: Route, request: Request): boolean;
186
+ }
187
+ //#endregion
188
+ //#region src/RouteCollection.d.ts
189
+ declare class RouteCollection extends AbstractRouteCollection implements IRouteCollection {
190
+ /**
191
+ * An array of the routes keyed by method.
192
+ */
193
+ protected routes: Record<string, Record<string, Route>>;
194
+ /**
195
+ * A flattened array of all of the routes.
196
+ */
197
+ protected allRoutes: Record<string, Route>;
198
+ /**
199
+ * A look-up table of routes by their names.
200
+ */
201
+ protected nameList: Record<string, Route>;
202
+ /**
203
+ * A look-up table of routes by controller action.
204
+ */
205
+ protected actionList: Record<string, Route>;
206
+ /**
207
+ * Add a Route instance to the collection.
208
+ */
209
+ add(route: Route): Route;
210
+ /**
211
+ * Add the given route to the arrays of routes.
212
+ */
213
+ protected addToCollections(route: Route): void;
214
+ /**
215
+ * Add the route to any look-up tables if necessary.
216
+ */
217
+ protected addLookups(route: Route): void;
218
+ /**
219
+ * Add a route to the controller action dictionary.
220
+ */
221
+ protected addToActionList(action: RouteActions, route: Route): void;
222
+ /**
223
+ * Determine if the given controller is in the action lookup table.
224
+ */
225
+ protected inActionLookup(controller: string): boolean;
226
+ /**
227
+ * Determine if the given name is in the name lookup table.
228
+ */
229
+ protected inNameLookup(name: string): boolean;
230
+ /**
231
+ * Refresh the name look-up table.
232
+ *
233
+ * This is done in case any names are fluently defined or if routes are overwritten.
234
+ */
235
+ refreshNameLookups(): void;
236
+ /**
237
+ * Refresh the action look-up table.
238
+ *
239
+ * This is done in case any actions are overwritten with new controllers.
240
+ */
241
+ refreshActionLookups(): void;
242
+ /**
243
+ * Find the first route matching a given request.
244
+ *
245
+ * May throw framework-specific exceptions (MethodNotAllowed / NotFound).
246
+ */
247
+ match(request: Request): Route;
248
+ /**
249
+ * Get routes from the collection by method.
250
+ */
251
+ get(): Route[];
252
+ get(method: string): Record<string, Route>;
253
+ /**
254
+ * Determine if the route collection contains a given named route.
255
+ */
256
+ hasNamedRoute(name: string): boolean;
257
+ /**
258
+ * Get a route instance by its name.
259
+ */
260
+ getByName(name: string): Route | undefined;
261
+ /**
262
+ * Get a route instance by its controller action.
263
+ */
264
+ getByAction(action: string): Route | undefined;
265
+ /**
266
+ * Get all of the routes in the collection.
267
+ */
268
+ getRoutes(): Route[];
269
+ /**
270
+ * Get all of the routes keyed by their HTTP verb / method.
271
+ */
272
+ getRoutesByMethod(): Record<string, Record<string, Route>>;
273
+ /**
274
+ * Get all of the routes keyed by their name.
275
+ */
276
+ getRoutesByName(): Record<string, Route>;
277
+ }
278
+ //#endregion
279
+ //#region src/ResourceRegistrar.d.ts
280
+ declare class ResourceRegistrar {
281
+ /**
282
+ * The router instance.
283
+ */
284
+ protected router: Router;
285
+ /**
286
+ * The default actions for a resourceful controller.
287
+ */
288
+ protected resourceDefaults: ResourceMethod[];
289
+ /**
290
+ * The default actions for a singleton resource controller.
291
+ */
292
+ protected singletonResourceDefaults: ResourceMethod[];
293
+ /**
294
+ * The parameters set for this resource instance.
295
+ */
296
+ protected parameters?: string | GenericObject<string>;
297
+ /**
298
+ * The global parameter mapping.
299
+ */
300
+ protected static parameterMap: GenericObject;
301
+ /**
302
+ * Singular global parameters.
303
+ */
304
+ protected static _singularParameters: boolean;
305
+ /**
306
+ * The verbs used in the resource URIs.
307
+ */
308
+ protected static _verbs: {
309
+ create: string;
310
+ edit: string;
311
+ };
312
+ /**
313
+ * Create a new resource registrar instance.
314
+ *
315
+ * @param router
316
+ */
317
+ constructor(router: Router);
318
+ /**
319
+ * Route a resource to a controller.
320
+ *
321
+ * @param name
322
+ * @param controller
323
+ * @param options
324
+ */
325
+ register<C extends typeof IController>(name: string, controller: C, options?: ResourceOptions): RouteCollection | undefined;
326
+ /**
327
+ * Route a singleton resource to a controller.
328
+ *
329
+ * @param name
330
+ * @param controller
331
+ * @param options
332
+ */
333
+ singleton<C extends typeof IController>(name: string, controller: C, options?: ResourceOptions): RouteCollection | undefined;
334
+ /**
335
+ * Build a set of prefixed resource routes.
336
+ *
337
+ * @param name
338
+ * @param controller
339
+ * @param options
340
+ */
341
+ protected prefixedResource<C extends typeof IController>(name: string, controller: C, options: ResourceOptions): Router;
342
+ /**
343
+ * Build a set of prefixed singleton routes.
344
+ *
345
+ * @param name
346
+ * @param controller
347
+ * @param options
348
+ */
349
+ protected prefixedSingleton<C extends typeof IController>(name: string, controller: C, options: ResourceOptions): Router;
350
+ /**
351
+ * Extract the resource and prefix from a resource name.
352
+ *
353
+ * @param name
354
+ *
355
+ */
356
+ protected getResourcePrefix(name: string): string[];
357
+ /**
358
+ * Get the applicable resource methods.
359
+ *
360
+ * @param defaults
361
+ * @param options
362
+ *
363
+ */
364
+ protected getResourceMethods(defaults: ResourceMethod[], options: ResourceOptions): ResourceMethod[];
365
+ /**
366
+ * Add the index method for a resourceful route.
367
+ *
368
+ * @param name
369
+ * @param base
370
+ * @param controller
371
+ * @param options
372
+ */
373
+ protected addResourceIndex<C extends typeof IController>(name: string, _base: string, controller: C, options: ResourceOptions): Route;
374
+ /**
375
+ * Add the create method for a resourceful route.
376
+ *
377
+ * @param name
378
+ * @param base
379
+ * @param controller
380
+ * @param options
381
+ */
382
+ protected addResourceCreate<C extends typeof IController>(name: string, base: string, controller: C, options: ResourceOptions): Route;
383
+ /**
384
+ * Add the store method for a resourceful route.
385
+ *
386
+ * @param name
387
+ * @param base
388
+ * @param controller
389
+ * @param options
390
+ */
391
+ protected addResourceStore<C extends typeof IController>(name: string, base: string, controller: C, options: ResourceOptions): Route;
392
+ /**
393
+ * Add the show method for a resourceful route.
394
+ *
395
+ * @param name
396
+ * @param base
397
+ * @param controller
398
+ * @param options
399
+ */
400
+ protected addResourceShow<C extends typeof IController>(name: string, base: string, controller: C, options: ResourceOptions): Route;
401
+ /**
402
+ * Add the edit method for a resourceful route.
403
+ *
404
+ * @param name
405
+ * @param base
406
+ * @param controller
407
+ * @param options
408
+ */
409
+ protected addResourceEdit<C extends typeof IController>(name: string, base: string, controller: C, options: ResourceOptions): Route;
410
+ /**
411
+ * Add the update method for a resourceful route.
412
+ *
413
+ * @param name
414
+ * @param base
415
+ * @param controller
416
+ * @param options
417
+ */
418
+ protected addResourceUpdate<C extends typeof IController>(name: string, base: string, controller: C, options: ResourceOptions): Route;
419
+ /**
420
+ * Add the destroy method for a resourceful route.
421
+ *
422
+ * @param name
423
+ * @param base
424
+ * @param controller
425
+ * @param options
426
+ */
427
+ protected addResourceDestroy<C extends typeof IController>(name: string, base: string, controller: C, options: ResourceOptions): Route;
428
+ /**
429
+ * Add the create method for a singleton route.
430
+ *
431
+ * @param name
432
+ * @param controller
433
+ * @param options
434
+ */
435
+ protected addSingletonCreate<C extends typeof IController>(name: string, controller: C, options: ResourceOptions): Route;
436
+ /**
437
+ * Add the store method for a singleton route.
438
+ *
439
+ * @param name
440
+ * @param controller
441
+ * @param options
442
+ */
443
+ protected addSingletonStore<C extends typeof IController>(name: string, controller: C, options: ResourceOptions): Route;
444
+ /**
445
+ * Add the show method for a singleton route.
446
+ *
447
+ * @param name
448
+ * @param controller
449
+ * @param options
450
+ */
451
+ protected addSingletonShow<C extends typeof IController>(name: string, controller: C, options: ResourceOptions): Route;
452
+ /**
453
+ * Add the edit method for a singleton route.
454
+ *
455
+ * @param name
456
+ * @param controller
457
+ * @param options
458
+ */
459
+ protected addSingletonEdit<C extends typeof IController>(name: string, controller: C, options: ResourceOptions): Route;
460
+ /**
461
+ * Add the update method for a singleton route.
462
+ *
463
+ * @param name
464
+ * @param controller
465
+ * @param options
466
+ */
467
+ protected addSingletonUpdate<C extends typeof IController>(name: string, controller: C, options: ResourceOptions): Route;
468
+ /**
469
+ * Add the destroy method for a singleton route.
470
+ *
471
+ * @param name
472
+ * @param controller
473
+ * @param options
474
+ */
475
+ protected addSingletonDestroy<C extends typeof IController>(name: string, controller: C, options: ResourceOptions): Route;
476
+ /**
477
+ * Get the name for a given resource with shallowness applied when applicable.
478
+ *
479
+ * @param name
480
+ * @param options
481
+ *
482
+ */
483
+ protected getShallowName(name: string, options: ResourceOptions): string;
484
+ /**
485
+ * Set the route's binding fields if the resource is scoped.
486
+ *
487
+ * @param \Illuminate\Routing\Route route
488
+ * @param bindingFields
489
+ *
490
+ */
491
+ protected setResourceBindingFields(route: Route, bindingFields: Record<string, any>): void;
492
+ /**
493
+ * Get the base resource URI for a given resource.
494
+ *
495
+ * @param resource
496
+ *
497
+ */
498
+ getResourceUri(resource: string): string;
499
+ /**
500
+ * Get the URI for a nested resource segment array.
501
+ *
502
+ * @param segments
503
+ */
504
+ protected getNestedResourceUri(segments: string[]): string;
505
+ /**
506
+ * Format a resource parameter for usage.
507
+ *
508
+ * @param value
509
+ */
510
+ getResourceWildcard(value: string): string;
511
+ /**
512
+ * Get the action array for a resource route.
513
+ *
514
+ * @param resource
515
+ * @param controller
516
+ * @param method
517
+ * @param options
518
+ *
519
+ */
520
+ protected getResourceAction<C extends typeof IController>(resource: string, controller: C, method: string, options: ResourceOptions): RouteActions;
521
+ /**
522
+ * Get the name for a given resource.
523
+ *
524
+ * @param resource
525
+ * @param method
526
+ * @param options
527
+ *
528
+ */
529
+ protected getResourceRouteName(resource: string, method: string, options: ResourceOptions): string;
530
+ /**
531
+ * Set or unset the unmapped global parameters to singular.
532
+ *
533
+ * @param singular
534
+ */
535
+ static singularParameters(singular?: boolean): void;
536
+ /**
537
+ * Get the global parameter map.
538
+ */
539
+ static getParameters(): GenericObject;
540
+ /**
541
+ * Set the global parameter mapping.
542
+ *
543
+ * @param $parameters
544
+ *
545
+ */
546
+ static setParameters(parameters?: never[]): void;
547
+ /**
548
+ * Get or set the action verbs used in the resource URIs.
549
+ *
550
+ * @param verbs
551
+ *
552
+ */
553
+ static verbs(verbs?: GenericObject): {
554
+ create: string;
555
+ edit: string;
556
+ } | undefined;
557
+ }
558
+ //#endregion
559
+ //#region src/PendingSingletonResourceRegistration.d.ts
560
+ declare const PendingSingletonResourceRegistration_base: (new () => {
561
+ [x: string]: any;
562
+ } & {
563
+ [x: string]: any;
564
+ where(_wheres: any): /*elided*/any;
565
+ whereAlpha(parameters: string | string[]): /*elided*/any;
566
+ whereAlphaNumeric(parameters: string | string[]): /*elided*/any;
567
+ whereNumber(parameters: string | string[]): /*elided*/any;
568
+ whereUlid(parameters: string | string[]): /*elided*/any;
569
+ whereUuid(parameters: string | string[]): /*elided*/any;
570
+ whereIn(parameters: string | string[], values: any[]): /*elided*/any;
571
+ assignExpressionToParameters(parameters: string | string[], expression: string): /*elided*/any;
572
+ } & {
573
+ [x: string]: any;
574
+ macroCall(method: string, parameters?: any[]): any;
575
+ }) & {
576
+ [x: string]: any;
577
+ prototype: {
578
+ [x: string]: any;
579
+ };
580
+ } & {
581
+ [x: string]: any;
582
+ prototype: {
583
+ [x: string]: any;
584
+ where(_wheres: any): /*elided*/any;
585
+ whereAlpha(parameters: string | string[]): /*elided*/any;
586
+ whereAlphaNumeric(parameters: string | string[]): /*elided*/any;
587
+ whereNumber(parameters: string | string[]): /*elided*/any;
588
+ whereUlid(parameters: string | string[]): /*elided*/any;
589
+ whereUuid(parameters: string | string[]): /*elided*/any;
590
+ whereIn(parameters: string | string[], values: any[]): /*elided*/any;
591
+ assignExpressionToParameters(parameters: string | string[], expression: string): /*elided*/any;
592
+ };
593
+ } & {
594
+ [x: string]: any;
595
+ prototype: {
596
+ [x: string]: any;
597
+ macroCall(method: string, parameters?: any[]): any;
598
+ };
599
+ macros: Record<string, _h3ravel_support9.Macro>;
600
+ macro: (name: string, macro: _h3ravel_support9.Macro) => void;
601
+ hasMacro: (name: string) => boolean;
602
+ flushMacros: () => void;
603
+ mixin: (mixin: object, replace?: boolean) => void;
604
+ createProxy: <T extends {
605
+ new (...args: any[]): {
606
+ [x: string]: any;
607
+ macroCall(method: string, parameters?: any[]): any;
608
+ };
609
+ [x: string]: any;
610
+ macros: Record<string, _h3ravel_support9.Macro>;
611
+ macro(name: string, macro: _h3ravel_support9.Macro): void;
612
+ hasMacro(name: string): boolean;
613
+ flushMacros(): void;
614
+ mixin(mixin: object, replace?: boolean): void;
615
+ createProxy<T extends /*elided*/any>(this: T): T;
616
+ macroCallStatic(method: string, parameters?: any[]): any;
617
+ }>(this: T) => T;
618
+ macroCallStatic: (method: string, parameters?: any[]) => any;
619
+ };
620
+ declare class PendingSingletonResourceRegistration extends PendingSingletonResourceRegistration_base {
621
+ /**
622
+ * The resource registrar.
623
+ */
624
+ protected registrar: ResourceRegistrar;
625
+ /**
626
+ * The resource name.
627
+ */
628
+ protected name: string;
629
+ /**
630
+ * The resource controller.
631
+ */
632
+ protected controller: typeof IController;
633
+ /**
634
+ * The resource options.
635
+ */
636
+ protected options: ResourceOptions;
637
+ /**
638
+ * The resource's registration status.
639
+ */
640
+ protected registered: boolean;
641
+ /**
642
+ * Create a new pending singleton resource registration instance.
643
+ *
644
+ * @param registrar
645
+ * @param name
646
+ * @param controller
647
+ * @param options
648
+ */
649
+ constructor(registrar: ResourceRegistrar, name: string, controller: typeof IController, options: ResourceOptions);
650
+ /**
651
+ * Set the methods the controller should apply to.
652
+ *
653
+ * @param methods
654
+ */
655
+ only(...methods: ResourceMethod[]): this;
656
+ /**
657
+ * Set the methods the controller should exclude.
658
+ *
659
+ * @param methods
660
+ */
661
+ except(...methods: ResourceMethod[]): this;
662
+ /**
663
+ * Indicate that the resource should have creation and storage routes.
664
+ *
665
+ * @return this
666
+ */
667
+ creatable(): this;
668
+ /**
669
+ * Indicate that the resource should have a deletion route.
670
+ *
671
+ * @return this
672
+ */
673
+ destroyable(): this;
674
+ /**
675
+ * Set the route names for controller actions.
676
+ *
677
+ * @param names
678
+ */
679
+ names(names: Record<string, string>): this;
680
+ /**
681
+ * Set the route name for a controller action.
682
+ *
683
+ * @param method
684
+ * @param name
685
+ */
686
+ setName(method: string, name: string): this;
687
+ /**
688
+ * Override the route parameter names.
689
+ *
690
+ * @param parameters
691
+ */
692
+ parameters(parameters: any): this;
693
+ /**
694
+ * Override a route parameter's name.
695
+ *
696
+ * @param previous
697
+ * @param newValue
698
+ */
699
+ parameter(previous: string, newValue: any): this;
700
+ /**
701
+ * Add middleware to the resource routes.
702
+ *
703
+ * @param middleware
704
+ */
705
+ middleware(middleware: MiddlewareList | MiddlewareIdentifier): this;
706
+ /**
707
+ * Specify middleware that should be added to the specified resource routes.
708
+ *
709
+ * @param methods
710
+ * @param middleware
711
+ */
712
+ middlewareFor(methods: ResourceMethod[], middleware: MiddlewareList | MiddlewareIdentifier): this;
713
+ /**
714
+ * Specify middleware that should be removed from the resource routes.
715
+ *
716
+ * @param middleware
717
+ */
718
+ withoutMiddleware(middleware: MiddlewareList | MiddlewareIdentifier): this;
719
+ /**
720
+ * Specify middleware that should be removed from the specified resource routes.
721
+ *
722
+ * @param methods
723
+ * @param middleware
724
+ */
725
+ withoutMiddlewareFor(methods: ResourceMethod[], middleware: MiddlewareList | MiddlewareIdentifier): this;
726
+ /**
727
+ * Add "where" constraints to the resource routes.
728
+ *
729
+ * @param wheres
730
+ */
731
+ where(wheres: any): this;
732
+ /**
733
+ * Register the singleton resource route.
734
+ */
735
+ register(): RouteCollection | undefined;
736
+ $finalize(e?: this): this;
737
+ }
738
+ //#endregion
739
+ //#region src/PendingResourceRegistration.d.ts
740
+ declare const PendingResourceRegistration_base: (new (...args: any[]) => {
741
+ [x: string]: any;
742
+ where(_wheres: any): /*elided*/any;
743
+ whereAlpha(parameters: string | string[]): /*elided*/any;
744
+ whereAlphaNumeric(parameters: string | string[]): /*elided*/any;
745
+ whereNumber(parameters: string | string[]): /*elided*/any;
746
+ whereUlid(parameters: string | string[]): /*elided*/any;
747
+ whereUuid(parameters: string | string[]): /*elided*/any;
748
+ whereIn(parameters: string | string[], values: any[]): /*elided*/any;
749
+ assignExpressionToParameters(parameters: string | string[], expression: string): /*elided*/any;
750
+ } & {
751
+ [x: string]: any;
752
+ macroCall(method: string, parameters?: any[]): any;
753
+ }) & {
754
+ [x: string]: any;
755
+ prototype: {
756
+ [x: string]: any;
757
+ where(_wheres: any): /*elided*/any;
758
+ whereAlpha(parameters: string | string[]): /*elided*/any;
759
+ whereAlphaNumeric(parameters: string | string[]): /*elided*/any;
760
+ whereNumber(parameters: string | string[]): /*elided*/any;
761
+ whereUlid(parameters: string | string[]): /*elided*/any;
762
+ whereUuid(parameters: string | string[]): /*elided*/any;
763
+ whereIn(parameters: string | string[], values: any[]): /*elided*/any;
764
+ assignExpressionToParameters(parameters: string | string[], expression: string): /*elided*/any;
765
+ };
766
+ } & {
767
+ [x: string]: any;
768
+ prototype: {
769
+ [x: string]: any;
770
+ macroCall(method: string, parameters?: any[]): any;
771
+ };
772
+ macros: Record<string, _h3ravel_support9.Macro>;
773
+ macro: (name: string, macro: _h3ravel_support9.Macro) => void;
774
+ hasMacro: (name: string) => boolean;
775
+ flushMacros: () => void;
776
+ mixin: (mixin: object, replace?: boolean) => void;
777
+ createProxy: <T extends {
778
+ new (...args: any[]): {
779
+ [x: string]: any;
780
+ macroCall(method: string, parameters?: any[]): any;
781
+ };
782
+ [x: string]: any;
783
+ macros: Record<string, _h3ravel_support9.Macro>;
784
+ macro(name: string, macro: _h3ravel_support9.Macro): void;
785
+ hasMacro(name: string): boolean;
786
+ flushMacros(): void;
787
+ mixin(mixin: object, replace?: boolean): void;
788
+ createProxy<T extends /*elided*/any>(this: T): T;
789
+ macroCallStatic(method: string, parameters?: any[]): any;
790
+ }>(this: T) => T;
791
+ macroCallStatic: (method: string, parameters?: any[]) => any;
792
+ };
793
+ declare class PendingResourceRegistration extends PendingResourceRegistration_base {
794
+ /**
795
+ * The resource registrar.
796
+ */
797
+ protected registrar: ResourceRegistrar;
798
+ /**
799
+ * The resource name.
800
+ */
801
+ protected name: string;
802
+ /**
803
+ * The resource controller.
804
+ */
805
+ protected controller: typeof IController;
806
+ /**
807
+ * The resource options.
808
+ */
809
+ protected options: ResourceOptions;
810
+ /**
811
+ * The resource's registration status.
812
+ */
813
+ protected registered: boolean;
814
+ /**
815
+ * Create a new pending resource registration instance.
816
+ *
817
+ * @param registrar
818
+ * @param name
819
+ * @param controller
820
+ * @param options
821
+ */
822
+ constructor(registrar: ResourceRegistrar, name: string, controller: typeof IController, options: ResourceOptions);
823
+ /**
824
+ * Set the methods the controller should apply to.
825
+ *
826
+ * @param methods
827
+ */
828
+ only(...methods: ResourceMethod[]): this;
829
+ /**
830
+ * Set the methods the controller should exclude.
831
+ *
832
+ * @param methods
833
+ */
834
+ except(...methods: ResourceMethod[]): this;
835
+ /**
836
+ * Set the route names for controller actions.
837
+ *
838
+ * @param names
839
+ */
840
+ names(names: Record<string, string>): this;
841
+ /**
842
+ * Set the route name for a controller action.
843
+ *
844
+ * @param method
845
+ * @param name
846
+ */
847
+ setName(method: string, name: string): this;
848
+ /**
849
+ * Override the route parameter names.
850
+ *
851
+ * @param parameters
852
+ */
853
+ parameters(parameters: any): this;
854
+ /**
855
+ * Override a route parameter's name.
856
+ *
857
+ * @param previous
858
+ * @param newValue
859
+ */
860
+ parameter(previous: string, newValue: any): this;
861
+ /**
862
+ * Add middleware to the resource routes.
863
+ *
864
+ * @param middleware
865
+ */
866
+ middleware(middleware: MiddlewareList | MiddlewareIdentifier): this;
867
+ /**
868
+ * Specify middleware that should be added to the specified resource routes.
869
+ *
870
+ * @param methods
871
+ * @param middleware
872
+ */
873
+ middlewareFor(methods: ResourceMethod[], middleware: MiddlewareList | MiddlewareIdentifier): this;
874
+ /**
875
+ * Specify middleware that should be removed from the resource routes.
876
+ *
877
+ * @param middleware
878
+ */
879
+ withoutMiddleware(middleware: MiddlewareList | MiddlewareIdentifier): this;
880
+ /**
881
+ * Specify middleware that should be removed from the specified resource routes.
882
+ *
883
+ * @param methods
884
+ * @param middleware
885
+ */
886
+ withoutMiddlewareFor(methods: ResourceMethod[], middleware: MiddlewareList | MiddlewareIdentifier): this;
887
+ /**
888
+ * Add "where" constraints to the resource routes.
889
+ *
890
+ * @param wheres
891
+ */
892
+ where(wheres: any): this;
893
+ /**
894
+ * Indicate that the resource routes should have "shallow" nesting.
895
+ *
896
+ * @param shallow
897
+ */
898
+ shallow(shallow?: boolean): this;
899
+ /**
900
+ * Define the callable that should be invoked on a missing model exception.
901
+ *
902
+ * @param callback
903
+ */
904
+ missing(callback: string): this;
905
+ /**
906
+ * Indicate that the resource routes should be scoped using the given binding fields.
907
+ *
908
+ * @param fields
909
+ */
910
+ scoped(fields?: string[]): this;
911
+ /**
912
+ * Define which routes should allow "trashed" models to be retrieved when resolving implicit model bindings.
913
+ *
914
+ * @param array methods
915
+ */
916
+ withTrashed(methods?: never[]): this;
917
+ /**
918
+ * Register the singleton resource route.
919
+ */
920
+ register(): RouteCollection | undefined;
921
+ $finalize(e?: this): this;
922
+ }
923
+ //#endregion
924
+ //#region src/Router.d.ts
925
+ declare const Router_base: typeof IRouter & {
926
+ new (...args: any[]): {
927
+ [x: string]: any;
928
+ macroCall(method: string, parameters?: any[]): any;
929
+ };
930
+ [x: string]: any;
931
+ macros: Record<string, _h3ravel_support9.Macro>;
932
+ macro(name: string, macro: _h3ravel_support9.Macro): void;
933
+ hasMacro(name: string): boolean;
934
+ flushMacros(): void;
935
+ mixin(mixin: object, replace?: boolean): void;
936
+ createProxy<T extends /*elided*/any>(this: T): T;
937
+ macroCallStatic(method: string, parameters?: any[]): any;
938
+ } & typeof Magic & (new (...args: any[]) => IRouter & Magic & {
939
+ [x: string]: any;
940
+ macroCall(method: string, parameters?: any[]): any;
941
+ });
942
+ declare class Router extends Router_base {
943
+ protected h3App: H3;
944
+ private app;
945
+ private DIST_DIR;
946
+ private routes;
947
+ private routeNames;
948
+ private current?;
949
+ private currentRequest;
950
+ private middlewareMap;
951
+ private groupMiddleware;
952
+ /**
953
+ * The registered route value binders.
954
+ */
955
+ protected binders: Record<string, any>;
956
+ /**
957
+ * All of the short-hand keys for middlewares.
958
+ */
959
+ private middlewares;
960
+ /**
961
+ * All of the middleware groups.
962
+ */
963
+ protected middlewareGroups: GenericObject<MiddlewareList>;
964
+ /**
965
+ * The route group attribute stack.
966
+ */
967
+ protected groupStack: GenericObject<any>[];
968
+ /**
969
+ * The event dispatcher instance.
970
+ */
971
+ protected events?: IDispatcher;
972
+ /**
973
+ * The priority-sorted list of middleware.
974
+ *
975
+ * Forces the listed middleware to always be in the given order.
976
+ */
977
+ middlewarePriority: MiddlewareList;
978
+ /**
979
+ * The registered custom implicit binding callback.
980
+ */
981
+ protected implicitBindingCallback?: (container: IApplication, route: Route, defaultFn: CallableConstructor) => any;
982
+ /**
983
+ * All of the verbs supported by the router.
984
+ */
985
+ static verbs: RouteMethod[];
986
+ constructor(h3App: H3, app: IApplication);
987
+ /**
988
+ * Add a route to the underlying route collection.
989
+ *
990
+ * @param method
991
+ * @param uri
992
+ * @param action
993
+ */
994
+ addRoute(methods: RouteMethod | RouteMethod[], uri: string, action: ActionInput): Route;
995
+ /**
996
+ * Get the currently dispatched route instance.
997
+ */
998
+ getCurrentRoute(): Route | undefined;
999
+ /**
1000
+ * Check if a route with the given name exists.
1001
+ *
1002
+ * @param name
1003
+ */
1004
+ has(...name: string[]): boolean;
1005
+ /**
1006
+ * Get the current route name.
1007
+ */
1008
+ currentRouteName(): string | undefined;
1009
+ /**
1010
+ * Alias for the "currentRouteNamed" method.
1011
+ *
1012
+ * @param patterns
1013
+ */
1014
+ is(...patterns: string[]): boolean;
1015
+ /**
1016
+ * Determine if the current route matches a pattern.
1017
+ *
1018
+ * @param patterns
1019
+ */
1020
+ currentRouteNamed(...patterns: string[]): boolean;
1021
+ /**
1022
+ * Get the underlying route collection.
1023
+ */
1024
+ getRoutes(): RouteCollection;
1025
+ /**
1026
+ * Determine if the action is routing to a controller.
1027
+ *
1028
+ * @param action
1029
+ */
1030
+ protected actionReferencesController(action: ActionInput): any;
1031
+ /**
1032
+ * Create a new route instance.
1033
+ *
1034
+ * @param methods
1035
+ * @param uri
1036
+ * @param action
1037
+ */
1038
+ protected createRoute(methods: RouteMethod | RouteMethod[], uri: string, action: ActionInput): Route;
1039
+ /**
1040
+ * Create a new Route object.
1041
+ *
1042
+ * @param methods
1043
+ * @param uri
1044
+ * @param action
1045
+ */
1046
+ newRoute(methods: RouteMethod | RouteMethod[], uri: string, action: ActionInput): Route;
1047
+ /**
1048
+ * Dispatch the request to the application.
1049
+ *
1050
+ * @param request
1051
+ */
1052
+ dispatch(request: Request): Promise<IResponse>;
1053
+ /**
1054
+ * Dispatch the request to a route and return the response.
1055
+ *
1056
+ * @param request
1057
+ */
1058
+ dispatchToRoute(request: Request): Promise<IResponse>;
1059
+ /**
1060
+ * Find the route matching a given request.
1061
+ *
1062
+ * @param request
1063
+ */
1064
+ protected findRoute(request: Request): Route;
1065
+ /**
1066
+ * Return the response for the given route.
1067
+ *
1068
+ * @param request
1069
+ * @param route
1070
+ */
1071
+ protected runRoute(request: Request, route: Route): Promise<IResponse>;
1072
+ /**
1073
+ * Run the given route within a Stack (onion) instance.
1074
+ *
1075
+ * @param route
1076
+ * @param request
1077
+ */
1078
+ protected runRouteWithinStack(route: Route, request: Request): Promise<IResponse>;
1079
+ /**
1080
+ * Get all of the defined middleware short-hand names.
1081
+ */
1082
+ getMiddleware(): GenericObject;
1083
+ /**
1084
+ * Register a short-hand name for a middleware.
1085
+ *
1086
+ * @param name
1087
+ * @param class
1088
+ */
1089
+ aliasMiddleware(name: string, cls: IMiddleware): this;
1090
+ /**
1091
+ * Gather the middleware for the given route with resolved class names.
1092
+ *
1093
+ * @param route
1094
+ */
1095
+ gatherRouteMiddleware(route: Route): MiddlewareList;
1096
+ /**
1097
+ * Resolve a flat array of middleware classes from the provided array.
1098
+ *
1099
+ * @param middleware
1100
+ * @param excluded
1101
+ */
1102
+ resolveMiddleware(middleware: MiddlewareList, excluded?: MiddlewareList): any;
1103
+ /**
1104
+ * Sort the given middleware by priority.
1105
+ *
1106
+ * @param middlewares
1107
+ */
1108
+ protected sortMiddleware(middlewares: Collection): any;
1109
+ /**
1110
+ * Register a group of middleware.
1111
+ *
1112
+ * @param name
1113
+ * @param middleware
1114
+ */
1115
+ middlewareGroup(name: string, middleware: MiddlewareList): this;
1116
+ /**
1117
+ * Create a response instance from the given value.
1118
+ *
1119
+ * @param request
1120
+ * @param response
1121
+ */
1122
+ prepareResponse(request: IRequest, response: ResponsableType): Promise<IResponse>;
1123
+ /**
1124
+ * Static version of prepareResponse.
1125
+ *
1126
+ * @param request
1127
+ * @param response
1128
+ */
1129
+ static toResponse(request: IRequest, response: ResponsableType<Response>): IResponse;
1130
+ /**
1131
+ * Substitute the route bindings onto the route.
1132
+ *
1133
+ * @param route
1134
+ *
1135
+ * @throws {ModelNotFoundException<IModel>}
1136
+ */
1137
+ substituteBindings(route: Route): Promise<Route>;
1138
+ /**
1139
+ * Substitute the implicit route bindings for the given route.
1140
+ *
1141
+ * @param route
1142
+ *
1143
+ * @throws {ModelNotFoundException<IModel>}
1144
+ */
1145
+ substituteImplicitBindings(route: Route): Promise<any | undefined>;
1146
+ /**
1147
+ * Register a callback to run after implicit bindings are substituted.
1148
+ *
1149
+ * @param callback
1150
+ */
1151
+ substituteImplicitBindingsUsing(callback: CallableConstructor): this;
1152
+ /**
1153
+ * Call the binding callback for the given key.
1154
+ *
1155
+ * @param key
1156
+ * @param value
1157
+ * @param route
1158
+ *
1159
+ * @throws {ModelNotFoundException<IModel>}
1160
+ */
1161
+ protected performBinding(key: string, value: string, route: Route): Promise<any>;
1162
+ /**
1163
+ * Remove any duplicate middleware from the given array.
1164
+ *
1165
+ * @param middleware
1166
+ */
1167
+ static uniqueMiddleware(middleware: MiddlewareList): MiddlewareIdentifier[];
1168
+ /**
1169
+ * Registers a route that responds to HTTP GET requests.
1170
+ *
1171
+ * @param uri - The route uri.
1172
+ * @param action - The handler function or [controller class, method] array.
1173
+ * @returns
1174
+ */
1175
+ get<C extends typeof IController>(uri: string, action: ActionInput<C>): Route;
1176
+ /**
1177
+ * Registers a route that responds to HTTP HEAD requests.
1178
+ *
1179
+ * @param uri - The route uri.
1180
+ * @param action - The handler function or [controller class, method] array.
1181
+ * @returns
1182
+ */
1183
+ head<C extends typeof IController>(uri: string, action: ActionInput<C>): Route;
1184
+ /**
1185
+ * Registers a route that responds to HTTP POST requests.
1186
+ *
1187
+ * @param uri - The route uri.
1188
+ * @param action - The handler function or [controller class, method] array.
1189
+ * @returns
1190
+ */
1191
+ post<C extends typeof IController>(uri: string, action: ActionInput<C>): Route;
1192
+ /**
1193
+ * Registers a route that responds to HTTP PUT requests.
1194
+ *
1195
+ * @param uri - The route uri.
1196
+ * @param action - The handler function or [controller class, method] array.
1197
+ * @returns
1198
+ */
1199
+ put<C extends typeof IController>(uri: string, action: ActionInput<C>): Route;
1200
+ /**
1201
+ * Registers a route that responds to HTTP PATCH requests.
1202
+ *
1203
+ * @param uri - The route uri.
1204
+ * @param action - The handler function or [controller class, method] array.
1205
+ * @returns
1206
+ */
1207
+ patch<C extends typeof IController>(uri: string, action: ActionInput<C>): Route;
1208
+ /**
1209
+ * Registers a route that responds to HTTP OPTIONS requests.
1210
+ *
1211
+ * @param uri - The route uri.
1212
+ * @param action - The handler function or [controller class, method] array.
1213
+ * @returns
1214
+ */
1215
+ options<C extends typeof IController>(uri: string, action: ActionInput<C>): Route;
1216
+ /**
1217
+ * Registers a route that responds to HTTP DELETE requests.
1218
+ *
1219
+ * @param uri - The route uri.
1220
+ * @param action - The handler function or [controller class, method] array.
1221
+ * @returns
1222
+ */
1223
+ delete<C extends typeof IController>(uri: string, action: ActionInput<C>): Route;
1224
+ /**
1225
+ * Registers a route the matches the provided methods.
1226
+ *
1227
+ * @param methods - The route methods to match.
1228
+ * @param uri - The route uri.
1229
+ * @param action - The handler function or [controller class, method] array.
1230
+ */
1231
+ match<C extends typeof IController>(methods: RouteMethod | RouteMethod[], uri: string, action: ActionInput<C>): Route;
1232
+ /**
1233
+ * Route a resource to a controller.
1234
+ *
1235
+ * @param name
1236
+ * @param controller
1237
+ * @param options
1238
+ */
1239
+ resource<C extends typeof IController>(name: string, controller: C, options?: ResourceOptions): PendingResourceRegistration;
1240
+ /**
1241
+ * Register an array of API resource controllers.
1242
+ *
1243
+ * @param resources
1244
+ * @param options
1245
+ */
1246
+ apiResources(resources: GenericObject<typeof IController>, options?: ResourceOptions): void;
1247
+ /**
1248
+ * Route an API resource to a controller.
1249
+ *
1250
+ * @param name
1251
+ * @param controller
1252
+ * @param options
1253
+ */
1254
+ apiResource<C extends typeof IController>(name: string, controller: C, options?: ResourceOptions): PendingResourceRegistration;
1255
+ /**
1256
+ * Register an array of singleton resource controllers.
1257
+ *
1258
+ * @param singletons
1259
+ * @param options
1260
+ */
1261
+ singletons(singletons: GenericObject<typeof IController>, options?: ResourceOptions): void;
1262
+ /**
1263
+ * Route a singleton resource to a controller.
1264
+ *
1265
+ * @param name
1266
+ * @param controller
1267
+ * @param options
1268
+ */
1269
+ singleton<C extends typeof IController>(name: string, controller: C, options?: ResourceOptions): PendingSingletonResourceRegistration;
1270
+ /**
1271
+ * Register an array of API singleton resource controllers.
1272
+ *
1273
+ * @param singletons
1274
+ * @param options
1275
+ */
1276
+ apiSingletons(singletons: GenericObject<typeof IController>, options?: ResourceOptions): void;
1277
+ /**
1278
+ * Route an API singleton resource to a controller.
1279
+ *
1280
+ * @param name
1281
+ * @param controller
1282
+ * @param options
1283
+ */
1284
+ apiSingleton<C extends typeof IController>(name: string, controller: C, options?: ResourceOptions): PendingSingletonResourceRegistration;
1285
+ /**
1286
+ * Create a route group with shared attributes.
1287
+ *
1288
+ * @param attributes
1289
+ * @param routes
1290
+ */
1291
+ group<C extends ((_e: this) => void) | string>(attributes: RouteActions, routes: C | C[]): this;
1292
+ /**
1293
+ * Update the group stack with the given attributes.
1294
+ *
1295
+ * @param attributes
1296
+ */
1297
+ protected updateGroupStack(attributes: RouteActions): void;
1298
+ /**
1299
+ * Merge the given array with the last group stack.
1300
+ *
1301
+ * @param newItems
1302
+ * @param prependExistingPrefix
1303
+ */
1304
+ mergeWithLastGroup(newItems: RouteActions, prependExistingPrefix?: boolean): RouteActions;
1305
+ /**
1306
+ * Load the provided routes.
1307
+ *
1308
+ * @param routes
1309
+ */
1310
+ protected loadRoutes(routes: string | ((_e: this) => void)): Promise<void>;
1311
+ /**
1312
+ * Get the prefix from the last group on the stack.
1313
+ */
1314
+ getLastGroupPrefix(): any;
1315
+ /**
1316
+ * Merge the group stack with the controller action.
1317
+ *
1318
+ * @param route
1319
+ */
1320
+ protected mergeGroupAttributesIntoRoute(route: Route): void;
1321
+ /**
1322
+ * Determine if the router currently has a group stack.
1323
+ */
1324
+ hasGroupStack(): boolean;
1325
+ /**
1326
+ * Set the name of the current route
1327
+ *
1328
+ * @param name
1329
+ */
1330
+ name(name: string): this;
1331
+ /**
1332
+ * Prefix the given URI with the last prefix.
1333
+ *
1334
+ * @param uri
1335
+ */
1336
+ protected prefix(uri: string): string;
1337
+ /**
1338
+ * Registers H3 middleware for a specific path.
1339
+ *
1340
+ * @param path - The middleware or path to apply the middleware.
1341
+ * @param handler - The middleware handler.
1342
+ * @param opts - Optional middleware options.
1343
+ */
1344
+ h3middleware(path: string | IMiddleware[] | Middleware$1, handler?: Middleware$1 | MiddlewareOptions, opts?: MiddlewareOptions): this;
1345
+ /**
1346
+ * Dynamically handle calls into the router instance.
1347
+ *
1348
+ * @param method
1349
+ * @param parameters
1350
+ */
1351
+ protected __call(method: string, parameters: any[]): any;
1352
+ }
1353
+ //#endregion
1354
+ //#region src/Matchers/SchemeValidator.d.ts
1355
+ declare class SchemeValidator extends IRouteValidator {
1356
+ /**
1357
+ * Validate a given rule against a route and request.
1358
+ *
1359
+ * @param route
1360
+ * @param request
1361
+ */
1362
+ matches(route: Route, request: Request): boolean;
1363
+ }
1364
+ //#endregion
1365
+ //#region src/Matchers/UriValidator.d.ts
1366
+ declare class UriValidator extends IRouteValidator {
1367
+ /**
1368
+ * Validate a given rule against a route and request.
1369
+ *
1370
+ * @param route
1371
+ * @param request
1372
+ */
1373
+ matches(route: Route, request: Request): boolean;
1374
+ }
1375
+ //#endregion
1376
+ //#region src/Route.d.ts
1377
+ declare class Route extends IRoute {
1378
+ #private;
1379
+ /**
1380
+ * The default values for the route.
1381
+ */
1382
+ _defaults: Record<string, any>;
1383
+ /**
1384
+ * The router instance used by the route.
1385
+ */
1386
+ protected router: Router;
1387
+ /**
1388
+ * The compiled version of the route.
1389
+ */
1390
+ compiled?: CompiledRoute;
1391
+ /**
1392
+ * The matched parameters object.
1393
+ */
1394
+ parameters?: Record<string, any>;
1395
+ /**
1396
+ * The container instance used by the route.
1397
+ */
1398
+ protected container: IApplication;
1399
+ /**
1400
+ * The fields that implicit binding should use for a given parameter.
1401
+ */
1402
+ protected bindingFields: GenericObject<string>;
1403
+ /**
1404
+ * Indicates "trashed" models can be retrieved when resolving implicit model bindings for this route.
1405
+ */
1406
+ protected withTrashedBindings: boolean;
1407
+ /**
1408
+ * Indicates whether the route is a fallback route.
1409
+ */
1410
+ isFallback: boolean;
1411
+ /**
1412
+ * The route action array.
1413
+ */
1414
+ action: RouteActions;
1415
+ /**
1416
+ * The HTTP methods the route responds to.
1417
+ */
1418
+ methods: RouteMethod[];
1419
+ /**
1420
+ * The route path that can be handled by H3.
1421
+ */
1422
+ path: string;
1423
+ /**
1424
+ * The computed gathered middleware.
1425
+ */
1426
+ computedMiddleware?: MiddlewareList;
1427
+ /**
1428
+ * The controller instance.
1429
+ */
1430
+ controller?: Required<IController>;
1431
+ /**
1432
+ * The validators used by the routes.
1433
+ */
1434
+ static validators: IRouteValidator[];
1435
+ /**
1436
+ *
1437
+ * @param methods The HTTP methods the route responds to.
1438
+ * @param uri The URI pattern the route responds to.
1439
+ */
1440
+ constructor(methods: RouteMethod | RouteMethod[], uri: string, action: ActionInput);
1441
+ /**
1442
+ * Set the router instance on the route.
1443
+ *
1444
+ * @param router
1445
+ */
1446
+ setRouter(router: Router): this;
1447
+ /**
1448
+ * Set the container instance on the route.
1449
+ *
1450
+ * @param container
1451
+ */
1452
+ setContainer(container: IApplication): this;
1453
+ /**
1454
+ * Set the URI that the route responds to.
1455
+ *
1456
+ * @param uri
1457
+ */
1458
+ setUri(uri: string): this;
1459
+ /**
1460
+ * Parse the route URI and normalize / store any implicit binding fields.
1461
+ *
1462
+ * @param uri
1463
+ */
1464
+ protected parseUri(uri: string): string;
1465
+ /**
1466
+ * Get the URI associated with the route.
1467
+ */
1468
+ uri(): string;
1469
+ /**
1470
+ * Add a prefix to the route URI.
1471
+ *
1472
+ * @param prefix
1473
+ */
1474
+ prefix(prefix: string): this;
1475
+ /**
1476
+ * Update the "prefix" attribute on the action array.
1477
+ *
1478
+ * @param prefix
1479
+ */
1480
+ protected updatePrefixOnAction(prefix: string): void;
1481
+ /**
1482
+ * Get the name of the route instance.
1483
+ */
1484
+ getName(): string | undefined;
1485
+ /**
1486
+ * Add or change the route name.
1487
+ *
1488
+ * @param name
1489
+ *
1490
+ * @throws {InvalidArgumentException}
1491
+ */
1492
+ name(name: string): this;
1493
+ /**
1494
+ * Determine whether the route's name matches the given patterns.
1495
+ *
1496
+ * @param patterns
1497
+ */
1498
+ named(...patterns: string[]): boolean;
1499
+ /**
1500
+ * Get the action name for the route.
1501
+ */
1502
+ getActionName(): any;
1503
+ /**
1504
+ * Get the method name of the route action.
1505
+ *
1506
+ * @return string
1507
+ */
1508
+ getActionMethod(): any;
1509
+ /**
1510
+ * Get the action array or one of its properties for the route.
1511
+ * @param key
1512
+ */
1513
+ getAction(key?: string): any;
1514
+ /**
1515
+ * Mark this route as a fallback route.
1516
+ */
1517
+ fallback(): this;
1518
+ /**
1519
+ * Set the fallback value.
1520
+ *
1521
+ * @param sFallback
1522
+ */
1523
+ setFallback(isFallback: boolean): this;
1524
+ /**
1525
+ * Get the HTTP verbs the route responds to.
1526
+ */
1527
+ getMethods(): RouteMethod[];
1528
+ /**
1529
+ * Determine if the route only responds to HTTP requests.
1530
+ */
1531
+ httpOnly(): boolean;
1532
+ /**
1533
+ * Determine if the route only responds to HTTPS requests.
1534
+ */
1535
+ httpsOnly(): boolean;
1536
+ /**
1537
+ * Get or set the middlewares attached to the route.
1538
+ *
1539
+ * @param middleware
1540
+ */
1541
+ middleware(): any[];
1542
+ middleware(middleware?: string | string[]): this;
1543
+ /**
1544
+ * Specify that the "Authorize" / "can" middleware should be applied to the route with the given options.
1545
+ *
1546
+ * @param ability
1547
+ * @param models
1548
+ */
1549
+ can(ability: string, models?: string | string[]): this;
1550
+ /**
1551
+ * Set the action array for the route.
1552
+ *
1553
+ * @param action
1554
+ */
1555
+ setAction(action: RouteActions): this;
1556
+ /**
1557
+ * Determine if the route only responds to HTTPS requests.
1558
+ */
1559
+ secure(): boolean;
1560
+ /**
1561
+ * Sync the current route with H3
1562
+ *
1563
+ * @param h3App
1564
+ */
1565
+ sync(h3App: H3): void;
1566
+ /**
1567
+ * Bind the route to a given request for execution.
1568
+ *
1569
+ * @param request
1570
+ */
1571
+ bind(request: Request): this;
1572
+ /**
1573
+ * Get or set the domain for the route.
1574
+ *
1575
+ * @param domain
1576
+ *
1577
+ * @throws {InvalidArgumentException}
1578
+ */
1579
+ domain<D extends string | undefined = undefined>(domain?: D): D extends undefined ? string : this;
1580
+ /**
1581
+ * Parse the route action into a standard array.
1582
+ *
1583
+ * @param action
1584
+ *
1585
+ * @throws {UnexpectedValueException}
1586
+ */
1587
+ protected parseAction(action: ActionInput): RouteActions;
1588
+ /**
1589
+ * Run the route action and return the response.
1590
+ */
1591
+ run(): Promise<ResponsableType>;
1592
+ /**
1593
+ * Get the key / value list of parameters without empty values.
1594
+ */
1595
+ parametersWithoutNulls(): {
1596
+ [k: string]: any;
1597
+ };
1598
+ /**
1599
+ * Get the key / value list of original parameters for the route.
1600
+ *
1601
+ * @throws {LogicException}
1602
+ */
1603
+ originalParameters(): Record<string, any>;
1604
+ /**
1605
+ * Get the matched parameters object.
1606
+ */
1607
+ getParameters(): Record<string, any>;
1608
+ /**
1609
+ * Get a given parameter from the route.
1610
+ *
1611
+ * @param name
1612
+ * @param defaultParam
1613
+ */
1614
+ parameter(name: string, defaultParam?: any): any;
1615
+ /**
1616
+ * Get the domain defined for the route.
1617
+ */
1618
+ getDomain(): string | undefined;
1619
+ /**
1620
+ * Get the compiled version of the route.
1621
+ */
1622
+ getCompiled(): CompiledRoute | undefined;
1623
+ /**
1624
+ * Get the binding field for the given parameter.
1625
+ *
1626
+ * @param parameter
1627
+ */
1628
+ bindingFieldFor(parameter: string | number): string | undefined;
1629
+ /**
1630
+ * Get the binding fields for the route.
1631
+ */
1632
+ getBindingFields(): GenericObject<string>;
1633
+ /**
1634
+ * Set the binding fields for the route.
1635
+ *
1636
+ * @param bindingFields
1637
+ */
1638
+ setBindingFields(bindingFields: GenericObject<string>): this;
1639
+ /**
1640
+ * Get the parent parameter of the given parameter.
1641
+ *
1642
+ * @param parameter
1643
+ */
1644
+ parentOfParameter(parameter: string): any;
1645
+ /**
1646
+ * Determines if the route allows "trashed" models to be retrieved when resolving implicit model bindings.
1647
+ */
1648
+ allowsTrashedBindings(): boolean;
1649
+ /**
1650
+ * Set a default value for the route.
1651
+ *
1652
+ * @param key
1653
+ * @param value
1654
+ */
1655
+ defaults(key: string, value: any): this;
1656
+ /**
1657
+ * Set the default values for the route.
1658
+ *
1659
+ * @param defaults
1660
+ */
1661
+ setDefaults(defaults: Record<string, any>): this;
1662
+ /**
1663
+ * Get the optional parameter names for the route.
1664
+ */
1665
+ getOptionalParameterNames(): Record<string, null>;
1666
+ /**
1667
+ * Get all of the parameter names for the route.
1668
+ */
1669
+ parameterNames(): string[];
1670
+ /**
1671
+ * Checks whether the route's action is a controller.
1672
+ */
1673
+ protected isControllerAction(): boolean;
1674
+ protected compileParameterNames(): string[];
1675
+ /**
1676
+ * Get the parameters that are listed in the route / controller signature.
1677
+ *
1678
+ * @param conditions
1679
+ */
1680
+ signatureParameters(conditions: ClassConstructor | RouteActionConditions): RouteParameter[];
1681
+ /**
1682
+ * Compile the route once, cache the result, return compiled data
1683
+ */
1684
+ compileRoute(): CompiledRoute;
1685
+ /**
1686
+ * Set a parameter to the given value.
1687
+ *
1688
+ * @param name
1689
+ * @param value
1690
+ */
1691
+ setParameter(name: string, value?: string | GenericObject): void;
1692
+ /**
1693
+ * Unset a parameter on the route if it is set.
1694
+ *
1695
+ * @param name
1696
+ */
1697
+ forgetParameter(name: string): void;
1698
+ /**
1699
+ * Get the value of the action that should be taken on a missing model exception.
1700
+ */
1701
+ getMissing(): CallableConstructor | undefined;
1702
+ /**
1703
+ * The route path that can be handled by H3.
1704
+ */
1705
+ getPath(): string;
1706
+ /**
1707
+ * Define the callable that should be invoked on a missing model exception.
1708
+ *
1709
+ * @param missing
1710
+ */
1711
+ missing(missing: CallableConstructor): this;
1712
+ /**
1713
+ * Specify middleware that should be removed from the given route.
1714
+ *
1715
+ * @param middleware
1716
+ */
1717
+ withoutMiddleware(middleware: any): this;
1718
+ /**
1719
+ * Get the middleware that should be removed from the route.
1720
+ */
1721
+ excludedMiddleware(): MiddlewareList;
1722
+ /**
1723
+ * Get all middleware, including the ones from the controller.
1724
+ */
1725
+ gatherMiddleware(): MiddlewareList;
1726
+ /**
1727
+ * Indicate that the route should enforce scoping of multiple implicit Eloquent bindings.
1728
+ */
1729
+ scopeBindings(): this;
1730
+ /**
1731
+ * Indicate that the route should not enforce scoping of multiple implicit Eloquent bindings.
1732
+ */
1733
+ withoutScopedBindings(): this;
1734
+ /**
1735
+ * Determine if the route should enforce scoping of multiple implicit Eloquent bindings.
1736
+ */
1737
+ enforcesScopedBindings(): boolean;
1738
+ /**
1739
+ * Determine if the route should prevent scoping of multiple implicit Eloquent bindings.
1740
+ */
1741
+ preventsScopedBindings(): boolean;
1742
+ /**
1743
+ * Get the dispatcher for the route's controller.
1744
+ *
1745
+ * @throws {BindingResolutionException}
1746
+ */
1747
+ controllerDispatcher(): ControllerDispatcher | IControllerDispatcher;
1748
+ /**
1749
+ * Get the route validators for the instance.
1750
+ *
1751
+ * @return array
1752
+ */
1753
+ static getValidators(): IRouteValidator[] | (UriValidator | HostValidator | MethodValidator | SchemeValidator)[];
1754
+ /**
1755
+ * Run the route action and return the response.
1756
+ *
1757
+ * @return mixed
1758
+ * @throws {NotFoundHttpException}
1759
+ */
1760
+ protected runController(): Promise<any>;
1761
+ protected runCallable(): Promise<any>;
1762
+ /**
1763
+ * Get the controller instance for the route.
1764
+ *
1765
+ * @return mixed
1766
+ *
1767
+ * @throws {BindingResolutionException}
1768
+ */
1769
+ getController(): Required<IController> | undefined;
1770
+ /**
1771
+ * Flush the cached container instance on the route.
1772
+ */
1773
+ flushController(): void;
1774
+ /**
1775
+ * Determine if the route matches a given request.
1776
+ *
1777
+ * @param request
1778
+ * @param includingMethod
1779
+ */
1780
+ matches(request: Request, includingMethod?: boolean): boolean;
1781
+ /**
1782
+ * Get the controller class used for the route.
1783
+ */
1784
+ getControllerClass(): any;
1785
+ /**
1786
+ * Get the controller method used for the route.
1787
+ */
1788
+ getControllerMethod(): ResourceMethod;
1789
+ /**
1790
+ * Get the middleware for the route's controller.
1791
+ *
1792
+ * @return array
1793
+ */
1794
+ controllerMiddleware(): never[];
1795
+ }
1796
+ //#endregion
1797
+ //#region src/AbstractRouteCollection.d.ts
1798
+ declare abstract class AbstractRouteCollection implements IAbstractRouteCollection {
1799
+ static verbs: RouteMethod[];
1800
+ abstract get(): Route[];
1801
+ abstract get(method: string): Record<string, Route>;
1802
+ abstract getRoutes(): Route[];
1803
+ /**
1804
+ * Match a request against a set of routes belonging to one HTTP verb.
1805
+ *
1806
+ * @param routes
1807
+ * @param req
1808
+ * @param includingMethod
1809
+ * @returns
1810
+ */
1811
+ protected matchAgainstRoutes(routes: Record<string, Route>, req: Request, includingMethod?: boolean): Route | undefined;
1812
+ /**
1813
+ * Final handler for a matched route. Responsible for:
1814
+ * - Throwing for not found
1815
+ * - Throwing for method not allowed
1816
+ * - Attaching params extracted from the match
1817
+ *
1818
+ * @param req
1819
+ * @param route
1820
+ * @returns
1821
+ */
1822
+ protected handleMatchedRoute(req: Request, route?: Route | null): Route;
1823
+ /**
1824
+ * Determine if any routes match on another HTTP verb.
1825
+ *
1826
+ * @param request
1827
+ */
1828
+ protected checkForAlternateVerbs(request: Request): string[];
1829
+ protected matchDomain(domain: string, host: string): boolean;
1830
+ protected matchUri(route: Route, path: string): boolean;
1831
+ /**
1832
+ * Count the number of items in the collection.
1833
+ */
1834
+ count(): number;
1835
+ }
1836
+ //#endregion
1837
+ //#region src/CallableDispatcher.d.ts
1838
+ declare const CallableDispatcher_base: typeof ICallableDispatcher & typeof RouteDependencyResolver & (new (...args: any[]) => ICallableDispatcher & RouteDependencyResolver);
1839
+ declare class CallableDispatcher extends CallableDispatcher_base {
1840
+ protected container: IApplication;
1841
+ /**
1842
+ *
1843
+ * @param container The container instance.
1844
+ */
1845
+ constructor(container: IApplication);
1846
+ /**
1847
+ * Dispatch a request to a given callback.
1848
+ *
1849
+ * @param route
1850
+ * @param handler
1851
+ * @param method
1852
+ */
1853
+ dispatch(route: Route, handler: CallableConstructor): Promise<any>;
1854
+ /**
1855
+ * Resolve the parameters for the callable.
1856
+ *
1857
+ * @param route
1858
+ * @param handler
1859
+ */
1860
+ protected resolveParameters(route: Route): Record<string, any>;
1861
+ }
1862
+ //#endregion
8
1863
  //#region src/Commands/RouteListCommand.d.ts
9
- declare class RouteListCommand extends Command {
1864
+ declare class RouteListCommand extends Command<IApplication> {
1865
+ /**
1866
+ * The name and signature of the console command.
1867
+ *
1868
+ * @var string
1869
+ */
1870
+ protected signature: string;
1871
+ /**
1872
+ * The console command description.
1873
+ *
1874
+ * @var string
1875
+ */
1876
+ protected description: string;
1877
+ /**
1878
+ * Execute the console command.
1879
+ */
1880
+ handle(): Promise<void>;
1881
+ /**
1882
+ * Compile the routes into a displayable format.
1883
+ */
1884
+ protected getRoutes(): IRoute[];
1885
+ /**
1886
+ * List all registered routes.
1887
+ */
1888
+ protected showRoutes(list: IRoute[]): Promise<void | {
1889
+ methods: RouteMethod[];
1890
+ uri: string;
1891
+ name: string | undefined;
1892
+ action: _h3ravel_contracts0.RouteActions;
1893
+ }[]>;
1894
+ private forCli;
1895
+ private asJson;
1896
+ /**
1897
+ * Get the color
1898
+ *
1899
+ * @param method
1900
+ * @returns
1901
+ */
1902
+ private color;
1903
+ /**
1904
+ * Get the alternate method
1905
+ *
1906
+ * @param method
1907
+ * @returns
1908
+ */
1909
+ private pair;
1910
+ }
1911
+ //#endregion
1912
+ //#region src/Events/PreparingResponse.d.ts
1913
+ declare class PreparingResponse {
1914
+ request: IRequest;
1915
+ response: ResponsableType;
1916
+ /**
1917
+ * Create a new event instance.
1918
+ *
1919
+ *
1920
+ * @param $request The request instance.
1921
+ * @param $response The response instance.
1922
+ */
1923
+ constructor(request: IRequest, response: ResponsableType);
1924
+ }
1925
+ //#endregion
1926
+ //#region src/Events/ResponsePrepared.d.ts
1927
+ declare class ResponsePrepared {
1928
+ request: IRequest;
1929
+ response: ResponsableType;
1930
+ /**
1931
+ * Create a new event instance.
1932
+ *
1933
+ *
1934
+ * @param $request The request instance.
1935
+ * @param $response The response instance.
1936
+ */
1937
+ constructor(request: IRequest, response: ResponsableType);
1938
+ }
1939
+ //#endregion
1940
+ //#region src/Events/RouteMatched.d.ts
1941
+ declare class RouteMatched {
1942
+ route: Route;
1943
+ request: Request;
1944
+ /**
1945
+ * Create a new event instance.
1946
+ *
1947
+ * @param route The route instance.
1948
+ * @param request The request instance.
1949
+ */
1950
+ constructor(route: Route, request: Request);
1951
+ }
1952
+ //#endregion
1953
+ //#region src/Events/Routing.d.ts
1954
+ declare class Routing {
1955
+ request: Request;
1956
+ /**
1957
+ * Create a new event instance.
1958
+ *
1959
+ * @param request The request instance.
1960
+ */
1961
+ constructor(request: Request);
1962
+ }
1963
+ //#endregion
1964
+ //#region src/Helpers.d.ts
1965
+ declare class Helpers {
1966
+ /**
1967
+ * Extracts parameter names from a route path string.
1968
+ *
1969
+ * - Looks for segments prefixed with ":" (e.g. "/users/:id")
1970
+ * - Captures only the param name (without the ":")
1971
+ * - Returns all matches in order of appearance
1972
+ *
1973
+ * @param path - The route path string (e.g. "/groups/:group/users/:user")
1974
+ * @returns An array of parameter names (e.g. ["group", "user"])
1975
+ */
1976
+ static extractParams(path: string): string[];
1977
+ /**
1978
+ * Resolves route model binding for a given path, HTTP context, and model.
1979
+ *
1980
+ * - Extracts all route parameters from the given path
1981
+ * - If a parameter matches the model name, it attempts to resolve the model binding
1982
+ * using the provided value and binding field (defaults to "id" unless specified).
1983
+ * - For non-matching parameters, it simply returns the key-value pair as is.
1984
+ * - If no parameters are found, returns an empty object.
1985
+ *
1986
+ * @param path - The route path (e.g. "/groups/:group/users/:user")
1987
+ * @param ctx - The HTTP context containing the request
1988
+ * @param model - The model instance to resolve bindings against
1989
+ * @returns A resolved model instance or an object containing param values
1990
+ */
1991
+ static resolveRouteModelBinding(path: string, ctx: IHttpContext, model: Model): Promise<any>;
1992
+ }
1993
+ //#endregion
1994
+ //#region src/ImplicitRouteBinding.d.ts
1995
+ declare class ImplicitRouteBinding {
1996
+ /**
1997
+ * Resolve the implicit route bindings for the given route.
1998
+ *
1999
+ * @param container
2000
+ * @param route
2001
+ */
2002
+ static resolveForRoute(container: IApplication, route: Route): Promise<void>;
2003
+ /**
2004
+ * Return the parameter name if it exists in the given parameters.
2005
+ *
2006
+ * @param name
2007
+ * @param parameters
2008
+ * @returns
2009
+ */
2010
+ protected static getParameterName(name: string, parameters: GenericObject): string | undefined;
2011
+ }
2012
+ //#endregion
2013
+ //#region src/Middleware/SubstituteBindings.d.ts
2014
+ declare class SubstituteBindings extends Middleware {
2015
+ protected app: IApplication;
2016
+ protected router: IRouter;
2017
+ /**
2018
+ *
2019
+ * @param router The router instance.
2020
+ */
2021
+ constructor(app: IApplication, router: IRouter);
2022
+ /**
2023
+ * Handle an incoming request.
2024
+ *
2025
+ * @param request
2026
+ * @param next
2027
+ */
2028
+ handle(request: Request, next: (request: Request) => Promise<unknown>): Promise<any>;
2029
+ }
2030
+ //#endregion
2031
+ //#region src/MiddlewareResolver.d.ts
2032
+ type MiddlewareMap = Record<string, MiddlewareIdentifier>;
2033
+ type MiddlewareGroups = Record<string, MiddlewareIdentifier[]>;
2034
+ declare class MiddlewareResolver {
2035
+ static app: IApplication;
2036
+ static setApp(app: IApplication): typeof MiddlewareResolver;
2037
+ /**
2038
+ * Resolve the middleware name to a class name(s) preserving passed parameters.
2039
+ */
2040
+ static resolve(name: MiddlewareIdentifier, map: MiddlewareMap, middlewareGroups: MiddlewareGroups): MiddlewareIdentifier | MiddlewareList;
2041
+ /**
2042
+ * Parse the middleware group and format it for usage.
2043
+ */
2044
+ protected static parseMiddlewareGroup(name: string, map: MiddlewareMap, middlewareGroups: MiddlewareGroups): MiddlewareList;
2045
+ }
2046
+ //#endregion
2047
+ //#region src/Pipeline.d.ts
2048
+ declare class Pipeline<XP = any> {
2049
+ /**
2050
+ * The final callback to be executed after the pipeline ends regardless of the outcome.
2051
+ */
2052
+ finally?: (...args: any[]) => any;
2053
+ /**
2054
+ * Indicates whether to wrap the pipeline in a database transaction.
2055
+ */
2056
+ protected withinTransaction?: string | false;
2057
+ /**
2058
+ * The container implementation.
2059
+ */
2060
+ protected container?: IContainer;
2061
+ /**
2062
+ * The object being passed through the pipeline.
2063
+ */
2064
+ private passable;
2065
+ /**
2066
+ * The array of class pipes.
2067
+ */
2068
+ private pipes;
2069
+ /**
2070
+ * The method to call on each pipe.
2071
+ */
2072
+ protected method: string;
2073
+ constructor(app?: IContainer);
2074
+ /**
2075
+ * Set the method to call on the pipes.
2076
+ *
2077
+ * @param method
2078
+ */
2079
+ via(method: string): this;
2080
+ send(passable: XP): this;
2081
+ through(pipes: any[]): this;
10
2082
  /**
11
- * The name and signature of the console command.
2083
+ * Run the pipeline with a final destination callback.
12
2084
  *
13
- * @var string
2085
+ * @param destination
14
2086
  */
15
- protected signature: string;
2087
+ then<R>(destination: (passable: XP) => Promise<R>): Promise<R>;
16
2088
  /**
17
- * The console command description.
2089
+ * Run the pipeline and return the result.
2090
+ */
2091
+ thenReturn(): Promise<XP>;
2092
+ private carry;
2093
+ private handleCarry;
2094
+ /**
2095
+ * Get the final piece of the Closure onion.
18
2096
  *
19
- * @var string
2097
+ * @param destination
20
2098
  */
21
- protected description: string;
2099
+ private prepareDestination;
22
2100
  /**
23
- * Execute the console command.
2101
+ * Handle the given exception.
2102
+ *
2103
+ * @param _passable
2104
+ * @param e
2105
+ * @throws {Error}
24
2106
  */
25
- handle(this: any): Promise<void>;
2107
+ protected handleException(_passable: any, e: Error): void;
26
2108
  /**
27
- * List all registered routes.
2109
+ * Parse full pipe string to get name and parameters.
2110
+ *
2111
+ * @param pipe
28
2112
  */
29
- protected list(): Promise<void>;
2113
+ private parsePipeString;
30
2114
  /**
31
- * Get the color
2115
+ * Set the container instance.
32
2116
  *
33
- * @param method
34
- * @returns
2117
+ * @param container
35
2118
  */
36
- private color;
2119
+ setContainer(container: IContainer): this;
37
2120
  /**
38
- * Get the alternate method
2121
+ * Execute each pipeline step within a database transaction.
39
2122
  *
40
- * @param method
41
- * @returns
2123
+ * @param withinTransaction
42
2124
  */
43
- private pair;
2125
+ setWithinTransaction(withinTransaction?: string | false): this;
2126
+ /**
2127
+ * Set a final callback to be executed after the pipeline ends regardless of the outcome.
2128
+ *
2129
+ * @param callback
2130
+ */
2131
+ setFinally(callback: (...args: any[]) => any): this;
2132
+ /**
2133
+ * Get the container instance.
2134
+ */
2135
+ protected getContainer(): IContainer;
44
2136
  }
45
2137
  //#endregion
46
- //#region src/Helpers.d.ts
47
- declare class Helpers {
2138
+ //#region src/Providers/RoutingServiceProvider.d.ts
2139
+ declare class RoutingServiceProvider extends ServiceProvider {
2140
+ static order: string;
2141
+ register(): Promise<void>;
48
2142
  /**
49
- * Extracts parameter names from a route path string.
2143
+ * Bind the URL generator service.
50
2144
  *
51
- * - Looks for segments prefixed with ":" (e.g. "/users/:id")
52
- * - Captures only the param name (without the ":")
53
- * - Returns all matches in order of appearance
2145
+ * @return void
2146
+ */
2147
+ protected bindUrlGenerator(): void;
2148
+ }
2149
+ //#endregion
2150
+ //#region src/RouteAction.d.ts
2151
+ declare class RouteAction {
2152
+ /**
2153
+ * The route action array.
2154
+ */
2155
+ private static action;
2156
+ static parse(uri: string, action?: ActionInput): RouteActions;
2157
+ /**
2158
+ * Normalize the "uses" field
2159
+ */
2160
+ private static normalizeUses;
2161
+ /**
2162
+ * Missing action fallback
2163
+ */
2164
+ private static missingAction;
2165
+ /**
2166
+ * Make an action for an invokable controller.
54
2167
  *
55
- * @param path - The route path string (e.g. "/groups/:group/users/:user")
56
- * @returns An array of parameter names (e.g. ["group", "user"])
2168
+ * @param action
2169
+ *
2170
+ * @throws {UnexpectedValueException}
57
2171
  */
58
- static extractParams(path: string): string[];
2172
+ protected static makeInvokable(action: IController): (...ctx: any[]) => any;
59
2173
  /**
60
- * Resolves route model binding for a given path, HTTP context, and model.
2174
+ * Detect if a value is a class constructor
2175
+ */
2176
+ private static isClass;
2177
+ }
2178
+ //#endregion
2179
+ //#region src/RouteGroup.d.ts
2180
+ declare class RouteGroup {
2181
+ /**
2182
+ * Merge route groups into a new array.
61
2183
  *
62
- * - Extracts all route parameters from the given path
63
- * - If a parameter matches the model name, it attempts to resolve the model binding
64
- * using the provided value and binding field (defaults to "id" unless specified).
65
- * - For non-matching parameters, it simply returns the key-value pair as is.
66
- * - If no parameters are found, returns an empty object.
2184
+ * @param newAct
2185
+ * @param old
2186
+ * @param prependExistingPrefix
2187
+ */
2188
+ static merge(newAct: RouteActions, old: RouteActions, prependExistingPrefix?: boolean): RouteActions;
2189
+ /**
2190
+ * Format the namespace for the new group attributes.
67
2191
  *
68
- * @param path - The route path (e.g. "/groups/:group/users/:user")
69
- * @param ctx - The HTTP context containing the request
70
- * @param model - The model instance to resolve bindings against
71
- * @returns A resolved model instance or an object containing param values
2192
+ * @param newAct
2193
+ * @param old
2194
+ */
2195
+ protected static formatNamespace(newAct: RouteActions, old: RouteActions): string | undefined;
2196
+ /**
2197
+ * Format the prefix for the new group attributes.
2198
+ *
2199
+ * @param newAct
2200
+ * @param old
2201
+ * @param prependExistingPrefix
2202
+ */
2203
+ protected static formatPrefix(newAct: RouteActions, old: RouteActions, prependExistingPrefix?: boolean): string;
2204
+ /**
2205
+ * Format the "wheres" for the new group attributes.
2206
+ *
2207
+ * @param newAct
2208
+ * @param old
2209
+ */
2210
+ protected static formatWhere(newAct: RouteActions, old: RouteActions): Record<string, _h3ravel_contracts0.RouteEventHandler>;
2211
+ /**
2212
+ * Format the "as" clause of the new group attributes.
2213
+ *
2214
+ * @param newAct
2215
+ * @param old
2216
+ * @param prependExistingPrefix
72
2217
  */
73
- static resolveRouteModelBinding(path: string, ctx: HttpContext, model: Model): Promise<any>;
2218
+ protected static formatAs(newAct: RouteActions, old: RouteActions): RouteActions;
74
2219
  }
75
2220
  //#endregion
76
- //#region src/Providers/AssetsServiceProvider.d.ts
77
- /**
78
- * Handles public assets loading
79
- *
80
- * Auto-Registered
81
- */
82
- declare class AssetsServiceProvider extends ServiceProvider {
83
- static priority: number;
84
- register(): void;
2221
+ //#region src/RouteParameterBinder.d.ts
2222
+ declare class RouteParameterBinder {
2223
+ protected route: Route;
2224
+ /**
2225
+ * Create a new Route parameter binder instance.
2226
+ *
2227
+ * @param route The route instance.
2228
+ */
2229
+ constructor(route: Route);
2230
+ /**
2231
+ * Get the parameters for the route.
2232
+ *
2233
+ * @param request
2234
+ */
2235
+ parameters(request: Request): Record<string, any>;
2236
+ /**
2237
+ * Get the parameter matches for the path portion of the URI.
2238
+ *
2239
+ * @param request
2240
+ */
2241
+ protected bindPathParameters(request: Request): Record<string, string>;
2242
+ /**
2243
+ * Extract the parameter list from the host part of the request.
2244
+ *
2245
+ * @param request
2246
+ * @param parameters
2247
+ */
2248
+ protected bindHostParameters(request: Request, parameters: Record<string, any>): Record<string, string>;
2249
+ /**
2250
+ * Combine a set of parameter matches with the route's keys.
2251
+ *
2252
+ * @param matches
2253
+ */
2254
+ protected matchToKeys(matches: string[]): Record<string, string>;
2255
+ /**
2256
+ * Replace null parameters with their defaults.
2257
+ *
2258
+ * @param parameters
2259
+ * @return array
2260
+ */
2261
+ protected replaceDefaults(parameters: Record<string, any>): Record<string, any>;
85
2262
  }
86
2263
  //#endregion
87
- //#region src/Providers/RouteServiceProvider.d.ts
88
- /**
89
- * Handles routing registration
90
- *
91
- * Load route files (web.ts, api.ts).
92
- * Map controllers to routes.
93
- * Register route-related middleware.
94
- *
95
- * Auto-Registered
96
- */
97
- declare class RouteServiceProvider extends ServiceProvider {
98
- static priority: number;
99
- register(): void;
2264
+ //#region src/RouteRegisterer.d.ts
2265
+ declare const RouteRegistrar_base: (new () => FRoute & {
2266
+ [x: string]: any;
2267
+ where(_wheres: any): /*elided*/any;
2268
+ whereAlpha(parameters: string | string[]): /*elided*/any;
2269
+ whereAlphaNumeric(parameters: string | string[]): /*elided*/any;
2270
+ whereNumber(parameters: string | string[]): /*elided*/any;
2271
+ whereUlid(parameters: string | string[]): /*elided*/any;
2272
+ whereUuid(parameters: string | string[]): /*elided*/any;
2273
+ whereIn(parameters: string | string[], values: any[]): /*elided*/any;
2274
+ assignExpressionToParameters(parameters: string | string[], expression: string): /*elided*/any;
2275
+ } & {
2276
+ [x: string]: any;
2277
+ macroCall(method: string, parameters?: any[]): any;
2278
+ } & {
2279
+ [x: string]: any;
2280
+ }) & {} & {
2281
+ [x: string]: any;
2282
+ prototype: {
2283
+ [x: string]: any;
2284
+ where(_wheres: any): /*elided*/any;
2285
+ whereAlpha(parameters: string | string[]): /*elided*/any;
2286
+ whereAlphaNumeric(parameters: string | string[]): /*elided*/any;
2287
+ whereNumber(parameters: string | string[]): /*elided*/any;
2288
+ whereUlid(parameters: string | string[]): /*elided*/any;
2289
+ whereUuid(parameters: string | string[]): /*elided*/any;
2290
+ whereIn(parameters: string | string[], values: any[]): /*elided*/any;
2291
+ assignExpressionToParameters(parameters: string | string[], expression: string): /*elided*/any;
2292
+ };
2293
+ } & {
2294
+ [x: string]: any;
2295
+ prototype: {
2296
+ [x: string]: any;
2297
+ macroCall(method: string, parameters?: any[]): any;
2298
+ };
2299
+ macros: Record<string, _h3ravel_support9.Macro>;
2300
+ macro: (name: string, macro: _h3ravel_support9.Macro) => void;
2301
+ hasMacro: (name: string) => boolean;
2302
+ flushMacros: () => void;
2303
+ mixin: (mixin: object, replace?: boolean) => void;
2304
+ createProxy: <T extends {
2305
+ new (...args: any[]): {
2306
+ [x: string]: any;
2307
+ macroCall(method: string, parameters?: any[]): any;
2308
+ };
2309
+ [x: string]: any;
2310
+ macros: Record<string, _h3ravel_support9.Macro>;
2311
+ macro(name: string, macro: _h3ravel_support9.Macro): void;
2312
+ hasMacro(name: string): boolean;
2313
+ flushMacros(): void;
2314
+ mixin(mixin: object, replace?: boolean): void;
2315
+ createProxy<T extends /*elided*/any>(this: T): T;
2316
+ macroCallStatic(method: string, parameters?: any[]): any;
2317
+ }>(this: T) => T;
2318
+ macroCallStatic: (method: string, parameters?: any[]) => any;
2319
+ } & {
2320
+ [x: string]: any;
2321
+ prototype: {
2322
+ [x: string]: any;
2323
+ };
2324
+ };
2325
+ declare class RouteRegistrar extends RouteRegistrar_base {
2326
+ protected router: Router;
2327
+ protected attributes: RouteActions;
2328
+ protected passthru: string[];
2329
+ protected allowedAttributes: (keyof RouteActions)[];
2330
+ protected aliases: Record<keyof RouteActions, string>;
2331
+ constructor(router: Router);
2332
+ attribute(key: string, value: any): this;
2333
+ resource<C extends typeof IController>(name: string, controller: C, options?: ResourceOptions): PendingResourceRegistration;
2334
+ apiResource<C extends typeof IController>(name: string, controller: C, options?: ResourceOptions): PendingResourceRegistration;
2335
+ singleton<C extends typeof IController>(name: string, controller: C, options?: ResourceOptions): PendingSingletonResourceRegistration;
2336
+ apiSingleton<C extends typeof IController>(name: string, controller: C, options?: ResourceOptions): PendingSingletonResourceRegistration;
2337
+ group(callback: CallableConstructor | any[] | string): this;
2338
+ match(methods: RouteMethod | RouteMethod[], uri: string, action?: RouteActions): Route;
2339
+ protected registerRoute(method: Lowercase<RouteMethod>, uri: string, action?: RouteActions): Route;
2340
+ protected compileAction(action?: RouteActions): ResourceOptions;
100
2341
  /**
101
- * Load routes from src/routes
2342
+ * PHP __call equivalent
2343
+ * Handled via Proxy in Magic
102
2344
  */
103
- boot(): Promise<void>;
2345
+ __call(method: string, parameters: any[]): any;
104
2346
  }
105
2347
  //#endregion
106
- //#region src/Route.d.ts
107
- declare class Router implements IRouter {
108
- protected h3App: H3;
109
- private app;
110
- private routes;
111
- private nameMap;
112
- private groupPrefix;
113
- private middlewareMap;
114
- private groupMiddleware;
115
- constructor(h3App: H3, app: Application);
2348
+ //#region src/RouteSignatureParameters.d.ts
2349
+ declare class RouteSignatureParameters {
2350
+ private static app;
2351
+ private static route;
116
2352
  /**
117
- * Route Resolver
2353
+ * set the current Application and Route instances
118
2354
  *
119
- * @param handler
120
- * @param middleware
121
- * @returns
2355
+ * @param app
122
2356
  */
123
- private resolveHandler;
2357
+ static setRequirements(app: IApplication, route: Route): typeof RouteSignatureParameters;
124
2358
  /**
125
- * Add a route to the stack
2359
+ * Extract the route action's signature parameters.
126
2360
  *
127
- * @param method
128
- * @param path
129
- * @param handler
130
- * @param name
131
- * @param middleware
2361
+ * @param action
2362
+ * @param conditions
2363
+ * @returns
132
2364
  */
133
- private addRoute;
2365
+ static fromAction(action: RouteActions, conditions?: RouteActionConditions): RouteParameter[];
134
2366
  /**
135
- * Resolves a route handler definition into an executable EventHandler.
2367
+ * Get the controller method used for the route.
136
2368
  *
137
- * A handler can be:
138
- * - A function matching the EventHandler signature
139
- * - A controller class (optionally decorated for IoC resolution)
2369
+ * @param action
2370
+ * @returns
2371
+ */
2372
+ private static getControllerMethod;
2373
+ }
2374
+ //#endregion
2375
+ //#region src/RouteUri.d.ts
2376
+ declare class RouteUri {
2377
+ /**
2378
+ * The route URI.
2379
+ */
2380
+ uri: string;
2381
+ /**
2382
+ * The fields that should be used when resolving bindings.
2383
+ */
2384
+ bindingFields: Record<string, string>;
2385
+ /**
2386
+ * Create a new route URI instance.
140
2387
  *
141
- * If it’s a controller class, this method will:
142
- * - Instantiate it (via IoC or manually)
143
- * - Call the specified method (defaults to `index`)
2388
+ * @param uri The route URI.
2389
+ * @param bindingFields The fields that should be used when resolving bindings.
2390
+ */
2391
+ constructor(uri: string, bindingFields?: Record<string, string>);
2392
+ /**
2393
+ * Parse the given URI.
144
2394
  *
145
- * @param handler Event handler function OR controller class
146
- * @param methodName Method to invoke on the controller (defaults to 'index')
2395
+ * @param uri The route URI.
2396
+ */
2397
+ static parse(uri: string): RouteUri;
2398
+ }
2399
+ //#endregion
2400
+ //#region src/UrlGenerator.d.ts
2401
+ declare class UrlGenerator extends IUrlGenerator {
2402
+ #private;
2403
+ private routes;
2404
+ private request;
2405
+ protected assetRoot?: string;
2406
+ protected forcedRoot?: string;
2407
+ protected forceScheme?: string;
2408
+ protected cachedRoot?: string;
2409
+ protected cachedScheme?: string;
2410
+ protected keyResolver?: () => string | string[];
2411
+ protected missingNamedRouteResolver?: CallableConstructor;
2412
+ /**
2413
+ * The session resolver callable.
147
2414
  */
148
- private resolveControllerOrHandler;
2415
+ protected sessionResolver?: CallableConstructor;
149
2416
  /**
150
- * Registers a route that responds to HTTP GET requests.
2417
+ * The route URL generator instance.
2418
+ */
2419
+ protected routeGenerator?: RouteUrlGenerator;
2420
+ /**
2421
+ * The named parameter defaults.
2422
+ */
2423
+ defaultParameters: GenericObject;
2424
+ constructor(routes: IRouteCollection, request: IRequest, assetRoot?: string);
2425
+ /**
2426
+ * Get the full URL for the current request,
2427
+ * including the query string.
151
2428
  *
152
- * @param path The URL pattern to match (can include parameters, e.g., '/users/:id').
153
- * @param definition Either:
154
- * - An EventHandler function
155
- * - A tuple: [ControllerClass, methodName]
156
- * @param name Optional route name (for URL generation or referencing).
157
- * @param middleware Optional array of middleware functions to execute before the handler.
2429
+ * Example:
2430
+ * https://example.com/users?page=2
158
2431
  */
159
- get<C extends new (...args: any) => any>(path: string, definition: RouteEventHandler | [C, methodName: ExtractControllerMethods<InstanceType<C>>], name?: string, middleware?: IMiddleware[]): Omit<this, RouterEnd>;
2432
+ full(): string;
160
2433
  /**
161
- * Registers a route that responds to HTTP POST requests.
2434
+ * Get the URL for the current request path
2435
+ * without modifying the query string.
2436
+ */
2437
+ current(): string;
2438
+ /**
2439
+ * Get the URL for the previous request.
2440
+ *
2441
+ * Resolution order:
2442
+ * 1. HTTP Referer header
2443
+ * 2. Session-stored previous URL
2444
+ * 3. Fallback (if provided)
2445
+ * 4. Root "/"
162
2446
  *
163
- * @param path The URL pattern to match (can include parameters, e.g., '/users').
164
- * @param definition Either:
165
- * - An EventHandler function
166
- * - A tuple: [ControllerClass, methodName]
167
- * @param name Optional route name (for URL generation or referencing).
168
- * @param middleware Optional array of middleware functions to execute before the handler.
2447
+ * @param fallback Optional fallback path or URL
169
2448
  */
170
- post<C extends new (...args: any) => any>(path: string, definition: RouteEventHandler | [C, methodName: ExtractControllerMethods<InstanceType<C>>], name?: string, middleware?: IMiddleware[]): Omit<this, RouterEnd>;
2449
+ previous(fallback?: string | false): string;
171
2450
  /**
172
- * Registers a route that responds to HTTP PUT requests.
2451
+ * Generate an absolute URL to the given path.
2452
+ *
2453
+ * - Accepts relative paths or full URLs
2454
+ * - Automatically prefixes scheme + host
2455
+ * - Encodes extra path parameters safely
173
2456
  *
174
- * @param path The URL pattern to match (can include parameters, e.g., '/users/:id').
175
- * @param definition Either:
176
- * - An EventHandler function
177
- * - A tuple: [ControllerClass, methodName]
178
- * @param name Optional route name (for URL generation or referencing).
179
- * @param middleware Optional array of middleware functions to execute before the handler.
2457
+ * @param path Relative or absolute path
2458
+ * @param extra Additional path segments
2459
+ * @param secure Force HTTPS or HTTP
180
2460
  */
181
- put<C extends new (...args: any) => any>(path: string, definition: RouteEventHandler | [C, methodName: ExtractControllerMethods<InstanceType<C>>], name?: string, middleware?: IMiddleware[]): Omit<this, RouterEnd>;
2461
+ to(path: string, extra?: (string | number)[], secure?: boolean | null): string;
182
2462
  /**
183
- * Registers a route that responds to HTTP PATCH requests.
2463
+ * Generate a secure (HTTPS) absolute URL.
184
2464
  *
185
- * @param path The URL pattern to match (can include parameters, e.g., '/users/:id').
186
- * @param definition Either:
187
- * - An EventHandler function
188
- * - A tuple: [ControllerClass, methodName]
189
- * @param name Optional route name (for URL generation or referencing).
190
- * @param middleware Optional array of middleware functions to execute before the handler.
2465
+ * @param path
2466
+ * @param parameters
2467
+ * @returns
191
2468
  */
192
- patch<C extends new (...args: any) => any>(path: string, definition: RouteEventHandler | [C, methodName: ExtractControllerMethods<InstanceType<C>>], name?: string, middleware?: IMiddleware[]): Omit<this, RouterEnd>;
2469
+ secure(path: string, parameters?: any[]): string;
193
2470
  /**
194
- * Registers a route that responds to HTTP DELETE requests.
2471
+ * Generate a URL to a public asset.
195
2472
  *
196
- * @param path The URL pattern to match (can include parameters, e.g., '/users/:id').
197
- * @param definition Either:
198
- * - An EventHandler function
199
- * - A tuple: [ControllerClass, methodName]
200
- * @param name Optional route name (for URL generation or referencing).
201
- * @param middleware Optional array of middleware functions to execute before the handler.
2473
+ * - Skips URL generation if path is already absolute
2474
+ * - Removes index.php from root if present
2475
+ *
2476
+ * @param path Asset path
2477
+ * @param secure Force HTTPS
202
2478
  */
203
- delete<C extends new (...args: any) => any>(path: string, definition: RouteEventHandler | [C, methodName: ExtractControllerMethods<InstanceType<C>>], name?: string, middleware?: IMiddleware[]): Omit<this, RouterEnd>;
2479
+ asset(path: string, secure?: boolean | null): string;
204
2480
  /**
205
- * API Resource support
2481
+ * Generate a secure (HTTPS) asset URL.
206
2482
  *
207
2483
  * @param path
208
- * @param controller
2484
+ * @returns
2485
+ */
2486
+ secureAsset(path: string): string;
2487
+ /**
2488
+ * Resolve the URL scheme to use.
2489
+ *
2490
+ * Priority:
2491
+ * 1. Explicit `secure` flag
2492
+ * 2. Forced scheme
2493
+ * 3. Request scheme (cached)
2494
+ *
2495
+ * @param secure
2496
+ */
2497
+ formatScheme(secure?: boolean | null): string;
2498
+ /**
2499
+ * Format the base root URL.
2500
+ *
2501
+ * - Applies forced root if present
2502
+ * - Replaces scheme while preserving host
2503
+ * - Result is cached per request
2504
+ *
2505
+ * @param scheme URL scheme
2506
+ * @param root Optional custom root
209
2507
  */
210
- apiResource<C extends new (...args: any) => any>(path: string, Controller: C, middleware?: IMiddleware[]): Omit<this, RouterEnd | 'name'>;
2508
+ formatRoot(scheme: string, root?: string): string;
211
2509
  /**
212
- * Named route URL generator
2510
+ * Create a signed route URL for a named route.
213
2511
  *
214
2512
  * @param name
215
- * @param params
2513
+ * @param parameters
2514
+ * @param expiration
2515
+ * @param absolute
216
2516
  * @returns
217
2517
  */
218
- route(name: string, params?: Record<string, string>): string | undefined;
2518
+ signedRoute(name: string, parameters?: Record<string, any>, expiration?: number, absolute?: boolean): string;
219
2519
  /**
220
- * Grouping
2520
+ * Check if the given request has a valid signature for a relative URL.
221
2521
  *
222
- * @param options
223
- * @param callback
2522
+ * @param request
2523
+ * @returns
224
2524
  */
225
- group(options: {
226
- prefix?: string;
227
- middleware?: EventHandler[];
228
- }, callback: (_e: this) => void): this;
2525
+ hasValidSignature(request: IRequest): boolean;
229
2526
  /**
230
- * Set the name of the current route
2527
+ * Get the URL to a named route.
231
2528
  *
232
2529
  * @param name
2530
+ * @param parameters
2531
+ * @param absolute
2532
+ * @returns
233
2533
  */
234
- name(name: string): this;
2534
+ route(name: string, parameters?: RouteParams, absolute?: boolean): string;
235
2535
  /**
236
- * Registers middleware for a specific path.
237
- * @param path - The path to apply the middleware.
238
- * @param handler - The middleware handler.
239
- * @param opts - Optional middleware options.
2536
+ * Get the URL for a given route instance.
2537
+ *
2538
+ * @param route
2539
+ * @param parameters
2540
+ * @param absolute
2541
+ */
2542
+ toRoute(route: IRoute, parameters?: RouteParams, absolute?: boolean): string;
2543
+ /**
2544
+ * Combine root and path into a final URL.
2545
+ *
2546
+ * Allows optional host and path formatters
2547
+ * to modify the output dynamically.
2548
+ *
2549
+ * @param root
2550
+ * @param path
2551
+ * @param route
2552
+ * @returns
2553
+ */
2554
+ format(root: string, path: string, route?: IRoute): string;
2555
+ /**
2556
+ * Format the array of URL parameters.
2557
+ *
2558
+ * @param parameters
2559
+ */
2560
+ formatParameters(parameters: GenericObject<UrlRoutable> | RouteParams): GenericObject;
2561
+ protected extractQueryString(path: string): [string, string];
2562
+ /**
2563
+ * @param root
2564
+ */
2565
+ protected removeIndex(root: string): string;
2566
+ /**
2567
+ * Determine whether a string is a valid URL.
2568
+ *
2569
+ * Supports:
2570
+ * - Absolute URLs
2571
+ * - Protocol-relative URLs
2572
+ * - Anchors and special schemes
2573
+ *
2574
+ * @param path
2575
+ * @returns
2576
+ */
2577
+ isValidUrl(path: string): boolean;
2578
+ /**
2579
+ * Get the Route URL generator instance.
2580
+ */
2581
+ protected routeUrl(): RouteUrlGenerator;
2582
+ /**
2583
+ * Force HTTPS for all generated URLs.
2584
+ *
2585
+ * @param force
2586
+ */
2587
+ forceHttps(force?: boolean): void;
2588
+ /**
2589
+ * Set the origin (scheme + host) for generated URLs.
2590
+ *
2591
+ * @param root
2592
+ */
2593
+ useOrigin(root?: string): void;
2594
+ useAssetOrigin(root?: string): void;
2595
+ setKeyResolver(resolver: () => string | string[]): void;
2596
+ resolveMissingNamedRoutesUsing(resolver: CallableConstructor): void;
2597
+ formatHostUsing(callback: CallableConstructor): this;
2598
+ formatPathUsing(callback: CallableConstructor): this;
2599
+ /**
2600
+ * Get the request instance.
2601
+ */
2602
+ getRequest(): IRequest;
2603
+ /**
2604
+ * Set the current request instance.
2605
+ *
2606
+ * @param request
2607
+ */
2608
+ setRequest(request: IRequest): void;
2609
+ /**
2610
+ * Set the route collection.
2611
+ *
2612
+ * @param routes
2613
+ */
2614
+ setRoutes(routes: IRouteCollection): this;
2615
+ /**
2616
+ * Get the route collection.
2617
+ */
2618
+ getRoutes(): IRouteCollection;
2619
+ /**
2620
+ * Get the session implementation from the resolver.
2621
+ */
2622
+ protected getSession(): any;
2623
+ /**
2624
+ * Set the session resolver for the generator.
2625
+ *
2626
+ * @param sessionResolver
240
2627
  */
241
- middleware(path: string | IMiddleware[] | Middleware, handler: Middleware | MiddlewareOptions, opts?: MiddlewareOptions): this;
2628
+ setSessionResolver(sessionResolver: CallableConstructor): this;
2629
+ /**
2630
+ * Clone a new instance of the URL generator with a different encryption key resolver.
2631
+ *
2632
+ * @param keyResolver
2633
+ */
2634
+ withKeyResolver(keyResolver: () => string | string[]): void;
2635
+ /**
2636
+ * Set the default named parameters used by the URL generator.
2637
+ *
2638
+ * @param array $defaults
2639
+ * @return void
2640
+ */
2641
+ defaults(defaults: GenericObject): void;
2642
+ /**
2643
+ * Get the previous URL from the session if possible.
2644
+ */
2645
+ protected getPreviousUrlFromSession(): string;
2646
+ }
2647
+ //#endregion
2648
+ //#region src/RouteUrlGenerator.d.ts
2649
+ declare class RouteUrlGenerator extends IRouteUrlGenerator {
2650
+ /**
2651
+ * The URL generator instance.
2652
+ */
2653
+ protected url: UrlGenerator;
2654
+ /**
2655
+ * The request instance.
2656
+ */
2657
+ protected request: IRequest;
2658
+ /**
2659
+ * The named parameter defaults.
2660
+ */
2661
+ defaultParameters: RouteParams;
2662
+ /**
2663
+ * Characters that should not be URL encoded.
2664
+ */
2665
+ dontEncode: {
2666
+ '%2F': string;
2667
+ '%40': string;
2668
+ '%3A': string;
2669
+ '%3B': string;
2670
+ '%2C': string;
2671
+ '%3D': string;
2672
+ '%2B': string;
2673
+ '%21': string;
2674
+ '%2A': string;
2675
+ '%7C': string;
2676
+ '%3F': string;
2677
+ '%26': string;
2678
+ '%23': string;
2679
+ '%25': string;
2680
+ };
2681
+ /**
2682
+ * Create a new Route URL generator.
2683
+ *
2684
+ * @param url
2685
+ * @param request
2686
+ */
2687
+ constructor(url: UrlGenerator, request: IRequest);
2688
+ /**
2689
+ * Generate a URL for the given route.
2690
+ *
2691
+ * @param route
2692
+ * @param parameters
2693
+ * @param absolute
2694
+ */
2695
+ to(route: IRoute, parameters?: RouteParams, absolute?: boolean): string;
2696
+ /**
2697
+ * Get the formatted domain for a given route.
2698
+ *
2699
+ * @param route
2700
+ * @param parameters
2701
+ */
2702
+ protected getRouteDomain(route: IRoute, parameters: RouteParams): string | undefined;
2703
+ /**
2704
+ * Format the domain and port for the route and request.
2705
+ *
2706
+ * @param route
2707
+ * @param parameters
2708
+ */
2709
+ protected formatDomain(route: IRoute, parameters: RouteParams): string;
2710
+ /**
2711
+ * Get the scheme for the given route.
2712
+ *
2713
+ * @param route
2714
+ */
2715
+ protected getRouteScheme(route: IRoute): string;
2716
+ /**
2717
+ * Add the port to the domain if necessary.
2718
+ *
2719
+ * @param domain
2720
+ */
2721
+ protected addPortToDomain(domain: string): string;
2722
+ /**
2723
+ * Format the array of route parameters.
2724
+ *
2725
+ * @param route
2726
+ * @param parameters
2727
+ */
2728
+ protected formatParameters(route: IRoute, parameters: RouteParams): _h3ravel_contracts0.GenericObject;
2729
+ /**
2730
+ * Replace the parameters on the root path.
2731
+ *
2732
+ * @param oute
2733
+ * @param domain
2734
+ * @param parameters
2735
+ */
2736
+ protected replaceRootParameters(route: IRoute, domain: string | undefined, parameters: RouteParams): string;
2737
+ /**
2738
+ * Replace all of the wildcard parameters for a route path.
2739
+ *
2740
+ * @param path
2741
+ * @param parameters
2742
+ */
2743
+ protected replaceRouteParameters(path: string, parameters: RouteParams): string;
2744
+ /**
2745
+ * Replace all of the named parameters in the path.
2746
+ *
2747
+ * @param path
2748
+ * @param parameters
2749
+ */
2750
+ protected replaceNamedParameters(path: string, parameters: RouteParams): string;
2751
+ /**
2752
+ * Add a query string to the URI.
2753
+ *
2754
+ * @param uri
2755
+ * @param parameters
2756
+ */
2757
+ protected addQueryString(uri: string, parameters: RouteParams): string;
2758
+ /**
2759
+ * Get the query string for a given route.
2760
+ *
2761
+ * @param parameters
2762
+ * @return string
2763
+ */
2764
+ protected getRouteQueryString(parameters: RouteParams): "" | "?{query}";
2765
+ /**
2766
+ * Get the string parameters from a given list.
2767
+ *
2768
+ * @param parameters
2769
+ */
2770
+ protected getStringParameters(parameters: RouteParams): {
2771
+ [k: string]: any;
2772
+ };
2773
+ /**
2774
+ * Get the numeric parameters from a given list.
2775
+ *
2776
+ * @param parameters
2777
+ */
2778
+ protected getNumericParameters(parameters: RouteParams): {
2779
+ [k: string]: any;
2780
+ };
2781
+ /**
2782
+ * Set the default named parameters used by the URL generator.
2783
+ *
2784
+ * @param $defaults
2785
+ */
2786
+ defaults(defaults: RouteParams): void;
242
2787
  }
243
2788
  //#endregion
244
- export { AssetsServiceProvider, Helpers, RouteListCommand, RouteServiceProvider, Router };
2789
+ //#region src/Traits/CreatesRegularExpressionRouteConstraints.d.ts
2790
+ declare const CreatesRegularExpressionRouteConstraints: _h3ravel_shared0.Trait<(Base: any) => {
2791
+ new (): {
2792
+ [x: string]: any;
2793
+ where(_wheres: any): /*elided*/any;
2794
+ /**
2795
+ * Specify that the given route parameters must be alphabetic.
2796
+ *
2797
+ * @param parameters
2798
+ */
2799
+ whereAlpha(parameters: string | string[]): /*elided*/any;
2800
+ /**
2801
+ * Specify that the given route parameters must be alphanumeric.
2802
+ *
2803
+ * @param parameters
2804
+ */
2805
+ whereAlphaNumeric(parameters: string | string[]): /*elided*/any;
2806
+ /**
2807
+ * Specify that the given route parameters must be numeric.
2808
+ *
2809
+ * @param parameters
2810
+ */
2811
+ whereNumber(parameters: string | string[]): /*elided*/any;
2812
+ /**
2813
+ * Specify that the given route parameters must be ULIDs.
2814
+ *
2815
+ * @param parameters
2816
+ */
2817
+ whereUlid(parameters: string | string[]): /*elided*/any;
2818
+ /**
2819
+ * Specify that the given route parameters must be UUIDs.
2820
+ *
2821
+ * @param parameters
2822
+ */
2823
+ whereUuid(parameters: string | string[]): /*elided*/any;
2824
+ /**
2825
+ * Specify that the given route parameters must be one of the given values.
2826
+ *
2827
+ * @param parameters
2828
+ * @param values
2829
+ */
2830
+ whereIn(parameters: string | string[], values: any[]): /*elided*/any;
2831
+ /**
2832
+ * Apply the given regular expression to the given parameters.
2833
+ *
2834
+ * @param parameters
2835
+ * @param expression
2836
+ */
2837
+ assignExpressionToParameters(parameters: string | string[], expression: string): /*elided*/any;
2838
+ };
2839
+ [x: string]: any;
2840
+ }, undefined>;
2841
+ //#endregion
2842
+ export { AbstractRouteCollection, CallableDispatcher, CompiledRoute, CompiledRouteToken, ControllerDispatcher, CreatesRegularExpressionRouteConstraints, FiltersControllerMiddleware, Helpers, HostValidator, IRouteValidator, ImplicitRouteBinding, MethodValidator, MiddlewareResolver, PendingResourceRegistration, PendingSingletonResourceRegistration, Pipe, Pipeline, PreparingResponse, ResourceRegistrar, ResponsePrepared, Route, RouteAction, RouteActionConditions, RouteCollection, RouteDependencyResolver, RouteGroup, RouteListCommand, RouteMatched, RouteParameter, RouteParameterBinder, RouteRegistrar, RouteSignatureParameters, RouteUri, RouteUrlGenerator, Router, Routing, RoutingServiceProvider, SchemeValidator, SubstituteBindings, UriValidator, UrlGenerator };