@adonisjs/http-server 8.0.0-next.4 → 8.0.0-next.6

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 (56) hide show
  1. package/build/{chunk-BFGF3A5X.js → chunk-7ROFCP6L.js} +1095 -548
  2. package/build/{chunk-ASX56VAK.js → chunk-NQNHMINZ.js} +59 -0
  3. package/build/factories/http_context.d.ts +2 -1
  4. package/build/factories/http_server.d.ts +7 -0
  5. package/build/factories/main.js +31 -5
  6. package/build/factories/qs_parser_factory.d.ts +3 -2
  7. package/build/factories/request.d.ts +1 -0
  8. package/build/factories/response.d.ts +1 -0
  9. package/build/factories/router.d.ts +1 -0
  10. package/build/factories/server_factory.d.ts +1 -0
  11. package/build/factories/url_builder_factory.d.ts +1 -0
  12. package/build/index.d.ts +3 -1
  13. package/build/index.js +87 -37
  14. package/build/src/cookies/client.d.ts +35 -0
  15. package/build/src/cookies/drivers/encrypted.d.ts +13 -0
  16. package/build/src/cookies/drivers/plain.d.ts +9 -0
  17. package/build/src/cookies/drivers/signed.d.ts +13 -0
  18. package/build/src/cookies/parser.d.ts +18 -0
  19. package/build/src/cookies/serializer.d.ts +20 -0
  20. package/build/src/define_config.d.ts +1 -3
  21. package/build/src/define_middleware.d.ts +1 -1
  22. package/build/src/exception_handler.d.ts +72 -31
  23. package/build/src/helpers.d.ts +50 -0
  24. package/build/src/helpers.js +5 -1
  25. package/build/src/http_context/local_storage.d.ts +17 -0
  26. package/build/src/http_context/main.d.ts +8 -0
  27. package/build/src/qs.d.ts +14 -0
  28. package/build/src/redirect.d.ts +27 -11
  29. package/build/src/request.d.ts +109 -10
  30. package/build/src/response.d.ts +399 -203
  31. package/build/src/router/brisk.d.ts +15 -4
  32. package/build/src/router/executor.d.ts +4 -0
  33. package/build/src/router/factories/use_return_value.d.ts +5 -0
  34. package/build/src/router/group.d.ts +17 -0
  35. package/build/src/router/legacy/url_builder.d.ts +7 -0
  36. package/build/src/router/main.d.ts +72 -1
  37. package/build/src/router/matchers.d.ts +3 -0
  38. package/build/src/router/resource.d.ts +33 -0
  39. package/build/src/router/route.d.ts +8 -0
  40. package/build/src/router/signed_url_builder.d.ts +4 -8
  41. package/build/src/router/store.d.ts +9 -0
  42. package/build/src/router/url_builder.d.ts +4 -9
  43. package/build/src/server/factories/middleware_handler.d.ts +10 -1
  44. package/build/src/server/factories/route_finder.d.ts +13 -3
  45. package/build/src/server/factories/write_response.d.ts +9 -2
  46. package/build/src/server/main.d.ts +77 -23
  47. package/build/src/tracing_channels.d.ts +4 -4
  48. package/build/src/types/middleware.d.ts +33 -8
  49. package/build/src/types/qs.d.ts +5 -0
  50. package/build/src/types/request.d.ts +1 -1
  51. package/build/src/types/response.d.ts +14 -6
  52. package/build/src/types/route.d.ts +40 -17
  53. package/build/src/types/server.d.ts +26 -11
  54. package/build/src/types/tracing_channels.d.ts +21 -3
  55. package/build/src/types/url_builder.d.ts +41 -28
  56. package/package.json +15 -13
@@ -3,7 +3,7 @@ import type { Application } from '@adonisjs/application';
3
3
  import { Route } from './route.ts';
4
4
  import type { RouteFn, RouteMatchers } from '../types/route.ts';
5
5
  import type { ParsedGlobalMiddleware } from '../types/middleware.ts';
6
- import type { RoutesList, URLOptions, GetRoutesForMethod, RouteBuilderArguments } from '../types/url_builder.ts';
6
+ import type { RoutesList, LookupList, URLOptions, GetRoutesForMethod, RouteBuilderArguments } from '../types/url_builder.ts';
7
7
  /**
8
8
  * Brisk routes exposes the API to configure the route handler by chaining
9
9
  * one of the pre-defined methods.
@@ -19,23 +19,34 @@ export declare class BriskRoute extends Macroable {
19
19
  * Reference to route instance. Set after `setHandler` is called
20
20
  */
21
21
  route: null | Route;
22
+ /**
23
+ * Creates a new BriskRoute instance
24
+ * @param app - The AdonisJS application instance
25
+ * @param routerMiddleware - Array of global middleware registered on the router
26
+ * @param options - Configuration options for the brisk route
27
+ */
22
28
  constructor(app: Application<any>, routerMiddleware: ParsedGlobalMiddleware[], options: {
23
29
  pattern: string;
24
30
  globalMatchers: RouteMatchers;
25
31
  });
26
32
  /**
27
33
  * Set handler for the brisk route
34
+ * @param handler - The route handler function
35
+ * @returns The created route instance
28
36
  */
29
37
  setHandler(handler: RouteFn): Route;
30
38
  /**
31
39
  * Redirects to a given route. Params from the original request will
32
40
  * be used when no custom params are defined.
41
+ * @param args - Route identifier, parameters, and options for building the redirect URL
42
+ * @returns The created route instance
33
43
  */
34
- redirect<Identifier extends keyof GetRoutesForMethod<'GET'> & string>(...args: RouteBuilderArguments<RoutesList, Identifier, 'GET', URLOptions & {
35
- status: number;
36
- }>): Route;
44
+ redirect<Identifier extends keyof GetRoutesForMethod<RoutesList, 'GET'> & string>(...args: RoutesList extends LookupList ? RouteBuilderArguments<Identifier, RoutesList['GET'][Identifier], URLOptions> : []): Route;
37
45
  /**
38
46
  * Redirect request to a fixed URL
47
+ * @param url - The URL to redirect to
48
+ * @param options - Optional redirect options including HTTP status code
49
+ * @returns The created route instance
39
50
  */
40
51
  redirectToPath(url: string, options?: {
41
52
  status: number;
@@ -5,5 +5,9 @@ import type { ServerErrorHandler } from '../types/server.ts';
5
5
  /**
6
6
  * Executor to execute the route middleware pipeline the route
7
7
  * handler
8
+ * @param route - The route JSON object containing route information
9
+ * @param resolver - Container resolver for dependency injection
10
+ * @param ctx - The HTTP context instance
11
+ * @param errorResponder - Error handler function for handling errors
8
12
  */
9
13
  export declare function execute(route: RouteJSON, resolver: ContainerResolver<any>, ctx: HttpContext, errorResponder: ServerErrorHandler['handle']): Promise<void>;
@@ -2,10 +2,15 @@ import { type HttpContext } from '../../http_context/main.ts';
2
2
  /**
3
3
  * Check if the value can be used to write the response body. Returns
4
4
  * false when the response body has already been set
5
+ * @param value - The value to check
6
+ * @param ctx - The HTTP context instance
7
+ * @returns True if value can be used for response body
5
8
  */
6
9
  export declare function canWriteResponseBody(value: any, ctx: HttpContext): boolean;
7
10
  /**
8
11
  * A factory function that uses the return value of the request
9
12
  * pipeline as the response
13
+ * @param ctx - The HTTP context instance
14
+ * @returns Function that handles return values
10
15
  */
11
16
  export declare function useReturnValue(ctx: HttpContext): (value: any) => void;
@@ -12,6 +12,10 @@ import type { MiddlewareFn, ParsedNamedMiddleware } from '../types/middleware.ts
12
12
  export declare class RouteGroup extends Macroable {
13
13
  #private;
14
14
  routes: (Route | RouteGroup | RouteResource | BriskRoute)[];
15
+ /**
16
+ * Creates a new RouteGroup instance
17
+ * @param routes - Array of routes that belong to this group
18
+ */
15
19
  constructor(routes: (Route | RouteGroup | RouteResource | BriskRoute)[]);
16
20
  /**
17
21
  * Define route param matcher
@@ -20,6 +24,9 @@ export declare class RouteGroup extends Macroable {
20
24
  * Route.group(() => {
21
25
  * }).where('id', /^[0-9]+/)
22
26
  * ```
27
+ * @param param - The parameter name to match
28
+ * @param matcher - The matcher pattern (RegExp, string, or RouteMatcher)
29
+ * @returns Current RouteGroup instance for method chaining
23
30
  */
24
31
  where(param: string, matcher: RouteMatcher | string | RegExp): this;
25
32
  /**
@@ -29,6 +36,8 @@ export declare class RouteGroup extends Macroable {
29
36
  * Route.group(() => {
30
37
  * }).prefix('v1')
31
38
  * ```
39
+ * @param prefix - The prefix to add to all routes in the group
40
+ * @returns Current RouteGroup instance for method chaining
32
41
  */
33
42
  prefix(prefix: string): this;
34
43
  /**
@@ -38,6 +47,8 @@ export declare class RouteGroup extends Macroable {
38
47
  * Route.group(() => {
39
48
  * }).domain(':name.adonisjs.com')
40
49
  * ```
50
+ * @param domain - The domain pattern for all routes in the group
51
+ * @returns Current RouteGroup instance for method chaining
41
52
  */
42
53
  domain(domain: string): this;
43
54
  /**
@@ -47,6 +58,8 @@ export declare class RouteGroup extends Macroable {
47
58
  * Route.group(() => {
48
59
  * }).as('version1')
49
60
  * ```
61
+ * @param name - The name to prepend to all route names in the group
62
+ * @returns Current RouteGroup instance for method chaining
50
63
  */
51
64
  as(name: string): this;
52
65
  /**
@@ -56,10 +69,14 @@ export declare class RouteGroup extends Macroable {
56
69
  * Route.group(() => {
57
70
  * }).use(middleware.auth())
58
71
  * ```
72
+ * @param middleware - Middleware function(s) to apply to all routes in the group
73
+ * @returns Current RouteGroup instance for method chaining
59
74
  */
60
75
  use(middleware: OneOrMore<MiddlewareFn | ParsedNamedMiddleware>): this;
61
76
  /**
62
77
  * @alias use
78
+ * @param middleware - Middleware function(s) to apply to all routes in the group
79
+ * @returns Current RouteGroup instance for method chaining
63
80
  */
64
81
  middleware(middleware: OneOrMore<MiddlewareFn | ParsedNamedMiddleware>): this;
65
82
  }
@@ -17,6 +17,11 @@ import { type Router } from '../main.ts';
17
17
  */
18
18
  export declare class UrlBuilder {
19
19
  #private;
20
+ /**
21
+ * Creates a new UrlBuilder instance
22
+ * @param router - The router instance
23
+ * @param domain - Optional domain for URL generation
24
+ */
20
25
  constructor(router: Router, domain?: string);
21
26
  /**
22
27
  * Prefix a custom base URL to the final URI
@@ -50,6 +55,8 @@ export declare class UrlBuilder {
50
55
  *
51
56
  * @deprecated
52
57
  * Instead use "@adonisjs/core/services/url_builder" instead
58
+ * @param identifier - Route identifier to generate URL for
59
+ * @returns Generated URL string
53
60
  */
54
61
  make(identifier: string): string;
55
62
  /**
@@ -9,7 +9,7 @@ import { RouteResource } from './resource.ts';
9
9
  import { UrlBuilder } from './legacy/url_builder.ts';
10
10
  import { RouteMatchers as Matchers } from './matchers.ts';
11
11
  import type { MiddlewareAsClass, ParsedGlobalMiddleware } from '../types/middleware.ts';
12
- import type { RouteFn, RouteJSON, MatchedRoute, RouteMatchers, MakeUrlOptions, MakeSignedUrlOptions, GetControllerHandlers, RouteMatcher } from '../types/route.ts';
12
+ import type { RouteFn, RouteJSON, MatchedRoute, RouteMatcher, RouteMatchers, MakeUrlOptions, MakeSignedUrlOptions, GetControllerHandlers } from '../types/route.ts';
13
13
  import { type UrlFor, type LookupList, type RoutesList, type SignedURLOptions } from '../types/url_builder.ts';
14
14
  /**
15
15
  * Router class exposes a unified API to register new routes, group them or
@@ -61,6 +61,12 @@ export declare class Router {
61
61
  protected routes: {
62
62
  [domain: string]: RouteJSON[];
63
63
  };
64
+ /**
65
+ * Creates a new Router instance
66
+ * @param app - The AdonisJS application instance
67
+ * @param encryption - Encryption service for signed URLs
68
+ * @param qsParser - Query string parser for URL generation
69
+ */
64
70
  constructor(app: Application<any>, encryption: Encryption, qsParser: Qs);
65
71
  /**
66
72
  * Register route JSON payload
@@ -68,18 +74,24 @@ export declare class Router {
68
74
  protected register(route: RouteJSON): void;
69
75
  /**
70
76
  * Parses the route pattern
77
+ * @param pattern - The route pattern to parse
78
+ * @param matchers - Optional route matchers
71
79
  */
72
80
  parsePattern(pattern: string, matchers?: RouteMatchers): import("../types/route.ts").MatchItRouteToken[];
73
81
  /**
74
82
  * Define an array of middleware to use on all the routes.
75
83
  * Calling this method multiple times pushes to the
76
84
  * existing list of middleware
85
+ * @param middleware - Array of middleware classes to apply globally
86
+ * @returns Current Router instance for method chaining
77
87
  */
78
88
  use(middleware: LazyImport<MiddlewareAsClass>[]): this;
79
89
  /**
80
90
  * Define a collection of named middleware. The defined collection is
81
91
  * not registered anywhere, but instead converted in a new collection
82
92
  * of functions you can apply on the routes, or router groups.
93
+ * @param collection - Object mapping middleware names to middleware classes
94
+ * @returns Named middleware functions
83
95
  */
84
96
  named<NamedMiddleware extends Record<string, LazyImport<MiddlewareAsClass>>>(collection: NamedMiddleware): { [K in keyof NamedMiddleware]: <Args extends import("../types/middleware.ts").GetMiddlewareArgs<import("@poppinss/utils/types").UnWrapLazyImport<NamedMiddleware[K]>>>(...args: Args) => {
85
97
  name: K;
@@ -89,52 +101,87 @@ export declare class Router {
89
101
  }; };
90
102
  /**
91
103
  * Add route for a given pattern and methods
104
+ * @param pattern - The route pattern
105
+ * @param methods - Array of HTTP methods
106
+ * @param handler - Route handler (function, string, or controller tuple)
107
+ * @returns The created route instance
92
108
  */
93
109
  route<T extends Constructor<any>>(pattern: string, methods: string[], handler: string | RouteFn | [LazyImport<T> | T, GetControllerHandlers<T>?]): Route<T>;
94
110
  /**
95
111
  * Define a route that handles all common HTTP methods
112
+ * @param pattern - The route pattern
113
+ * @param handler - Route handler (function, string, or controller tuple)
114
+ * @returns The created route instance
96
115
  */
97
116
  any<T extends Constructor<any>>(pattern: string, handler: string | RouteFn | [LazyImport<T> | T, GetControllerHandlers<T>?]): Route<T>;
98
117
  /**
99
118
  * Define `GET` route
119
+ * @param pattern - The route pattern
120
+ * @param handler - Route handler (function, string, or controller tuple)
121
+ * @returns The created route instance
100
122
  */
101
123
  get<T extends Constructor<any>>(pattern: string, handler: string | RouteFn | [LazyImport<T> | T, GetControllerHandlers<T>?]): Route<T>;
102
124
  /**
103
125
  * Define `POST` route
126
+ * @param pattern - The route pattern
127
+ * @param handler - Route handler (function, string, or controller tuple)
128
+ * @returns The created route instance
104
129
  */
105
130
  post<T extends Constructor<any>>(pattern: string, handler: string | RouteFn | [LazyImport<T> | T, GetControllerHandlers<T>?]): Route<T>;
106
131
  /**
107
132
  * Define `PUT` route
133
+ * @param pattern - The route pattern
134
+ * @param handler - Route handler (function, string, or controller tuple)
135
+ * @returns The created route instance
108
136
  */
109
137
  put<T extends Constructor<any>>(pattern: string, handler: string | RouteFn | [LazyImport<T> | T, GetControllerHandlers<T>?]): Route<T>;
110
138
  /**
111
139
  * Define `PATCH` route
140
+ * @param pattern - The route pattern
141
+ * @param handler - Route handler (function, string, or controller tuple)
142
+ * @returns The created route instance
112
143
  */
113
144
  patch<T extends Constructor<any>>(pattern: string, handler: string | RouteFn | [LazyImport<T> | T, GetControllerHandlers<T>?]): Route<T>;
114
145
  /**
115
146
  * Define `DELETE` route
147
+ * @param pattern - The route pattern
148
+ * @param handler - Route handler (function, string, or controller tuple)
149
+ * @returns The created route instance
116
150
  */
117
151
  delete<T extends Constructor<any>>(pattern: string, handler: string | RouteFn | [LazyImport<T> | T, GetControllerHandlers<T>?]): Route<T>;
118
152
  /**
119
153
  * Creates a group of routes. A route group can apply transforms
120
154
  * to routes in bulk
155
+ * @param callback - Function that defines routes within the group
156
+ * @returns The created route group instance
121
157
  */
122
158
  group(callback: () => void): RouteGroup;
123
159
  /**
124
160
  * Registers a route resource with conventional set of routes
161
+ * @param resource - The resource name
162
+ * @param controller - Controller to handle the resource
163
+ * @returns The created route resource instance
125
164
  */
126
165
  resource(resource: string, controller: string | LazyImport<Constructor<any>> | Constructor<any>): RouteResource<import("../types/route.ts").ResourceActionNames>;
127
166
  /**
128
167
  * Register a route resource with shallow nested routes.
168
+ * @param resource - The resource name
169
+ * @param controller - Controller to handle the resource
170
+ * @returns The created route resource instance
129
171
  */
130
172
  shallowResource(resource: string, controller: string | LazyImport<Constructor<any>> | Constructor<any>): RouteResource<import("../types/route.ts").ResourceActionNames>;
131
173
  /**
132
174
  * Returns a brisk route instance for a given URL pattern
175
+ * @param pattern - The route pattern
176
+ * @returns The created brisk route instance
133
177
  */
134
178
  on(pattern: string): BriskRoute;
135
179
  /**
136
180
  * Define matcher for a given param. The global params are applied
137
181
  * on all the routes (unless overridden at the route level).
182
+ * @param param - The parameter name to match
183
+ * @param matcher - The matcher pattern (RegExp, string, or RouteMatcher)
184
+ * @returns Current Router instance for method chaining
138
185
  */
139
186
  where(param: string, matcher: RouteMatcher | string | RegExp): this;
140
187
  /**
@@ -149,6 +196,11 @@ export declare class Router {
149
196
  *
150
197
  * When "disableLegacyLookup" is set, the lookup will be performed
151
198
  * only using the route name
199
+ * @param routeIdentifier - Route name, pattern, or controller reference
200
+ * @param domain - Optional domain to search within
201
+ * @param method - Optional HTTP method to filter by
202
+ * @param disableLegacyLookup - Whether to disable legacy lookup strategies
203
+ * @returns Found route or null if not found
152
204
  */
153
205
  find(routeIdentifier: string, domain?: string, method?: string, disableLegacyLookup?: boolean): RouteJSON | null;
154
206
  /**
@@ -160,6 +212,12 @@ export declare class Router {
160
212
  *
161
213
  * When "disableLegacyLookup" is set, the lookup will be performed
162
214
  * only using the route name
215
+ * @param routeIdentifier - Route name, pattern, or controller reference
216
+ * @param domain - Optional domain to search within
217
+ * @param method - Optional HTTP method to filter by
218
+ * @param disableLegacyLookup - Whether to disable legacy lookup strategies
219
+ * @returns Found route
220
+ * @throws Error when route is not found
163
221
  */
164
222
  findOrFail(routeIdentifier: string, domain?: string, method?: string, disableLegacyLookup?: boolean): RouteJSON;
165
223
  /**
@@ -170,10 +228,16 @@ export declare class Router {
170
228
  * When "followLookupStrategy" is enabled, the lookup will be performed
171
229
  * on the basis of the lookup strategy enabled via the "lookupStrategies"
172
230
  * method. The default lookupStrategy is "name" and "pattern".
231
+ * @param routeIdentifier - Route name, pattern, or controller reference
232
+ * @param domain - Optional domain to search within
233
+ * @param method - Optional HTTP method to filter by
234
+ * @param followLookupStrategy - Whether to follow the configured lookup strategy
235
+ * @returns True if route exists, false otherwise
173
236
  */
174
237
  has(routeIdentifier: string, domain?: string, method?: string, followLookupStrategy?: boolean): boolean;
175
238
  /**
176
239
  * Returns a list of routes grouped by their domain names
240
+ * @returns Object mapping domain names to route arrays
177
241
  */
178
242
  toJSON(): {
179
243
  [domain: string]: RouteJSON[];
@@ -182,10 +246,17 @@ export declare class Router {
182
246
  * Generates types for the URL builder. These types must
183
247
  * be written inside a file for the URL builder to
184
248
  * pick them up.
249
+ * @param indentation - Indentation level for generated types
250
+ * @returns Generated TypeScript types as string
185
251
  */
186
252
  generateTypes(indentation?: number): string;
187
253
  /**
188
254
  * Find route for a given URL, method and optionally domain
255
+ * @param uri - The URI to match
256
+ * @param method - HTTP method
257
+ * @param shouldDecodeParam - Whether to decode parameters
258
+ * @param hostname - Optional hostname for domain matching
259
+ * @returns Matched route or null if no match found
189
260
  */
190
261
  match(uri: string, method: string, shouldDecodeParam: boolean, hostname?: string | null): null | MatchedRoute;
191
262
  /**
@@ -6,6 +6,7 @@ export declare class RouteMatchers extends Macroable {
6
6
  /**
7
7
  * Enforce value to be a number and also casts it to number data
8
8
  * type
9
+ * @returns Route matcher configuration for numeric values
9
10
  */
10
11
  number(): {
11
12
  match: RegExp;
@@ -13,6 +14,7 @@ export declare class RouteMatchers extends Macroable {
13
14
  };
14
15
  /**
15
16
  * Enforce value to be formatted as uuid
17
+ * @returns Route matcher configuration for UUID values
16
18
  */
17
19
  uuid(): {
18
20
  match: RegExp;
@@ -20,6 +22,7 @@ export declare class RouteMatchers extends Macroable {
20
22
  };
21
23
  /**
22
24
  * Enforce value to be formatted as slug
25
+ * @returns Route matcher configuration for slug values
23
26
  */
24
27
  slug(): {
25
28
  match: RegExp;
@@ -13,6 +13,12 @@ export declare class RouteResource<ActionNames extends ResourceActionNames = Res
13
13
  * A collection of routes instances that belongs to this resource
14
14
  */
15
15
  routes: Route[];
16
+ /**
17
+ * Creates a new RouteResource instance
18
+ * @param app - The AdonisJS application instance
19
+ * @param routerMiddleware - Array of global middleware registered on the router
20
+ * @param options - Configuration options for the route resource
21
+ */
16
22
  constructor(app: Application<any>, routerMiddleware: ParsedGlobalMiddleware[], options: {
17
23
  resource: string;
18
24
  controller: string | LazyImport<Constructor<any>> | Constructor<any>;
@@ -21,28 +27,46 @@ export declare class RouteResource<ActionNames extends ResourceActionNames = Res
21
27
  });
22
28
  /**
23
29
  * Register only given routes and remove others
30
+ * @param names - Array of action names to keep
31
+ * @returns Current RouteResource instance with filtered actions
24
32
  */
25
33
  only<Name extends ActionNames>(names: Name[]): RouteResource<Name>;
26
34
  /**
27
35
  * Register all routes, except the one's defined
36
+ * @param names - Array of action names to exclude
37
+ * @returns Current RouteResource instance with filtered actions
28
38
  */
29
39
  except<Name extends ActionNames>(names: Name[]): RouteResource<Exclude<ActionNames, Name>>;
30
40
  /**
31
41
  * Register api only routes. The `create` and `edit` routes, which
32
42
  * are meant to show forms will not be registered
43
+ * @returns Current RouteResource instance without create and edit actions
33
44
  */
34
45
  apiOnly(): RouteResource<Exclude<ActionNames, 'create' | 'edit'>>;
35
46
  /**
36
47
  * Define matcher for params inside the resource
48
+ * @param key - The parameter name to match
49
+ * @param matcher - The matcher pattern (RegExp, string, or RouteMatcher)
50
+ * @returns Current RouteResource instance for method chaining
37
51
  */
38
52
  where(key: string, matcher: RouteMatcher | string | RegExp): this;
39
53
  /**
40
54
  * Tap into multiple routes to configure them by their name
55
+ * @param callback - Function to configure routes
56
+ * @returns Current RouteResource instance for method chaining
41
57
  */
42
58
  tap(callback: (route: Route) => void): this;
59
+ /**
60
+ * Tap into multiple routes to configure them by their name
61
+ * @param actions - Action name(s) to configure
62
+ * @param callback - Function to configure matching routes
63
+ * @returns Current RouteResource instance for method chaining
64
+ */
43
65
  tap(actions: ActionNames | ActionNames[], callback: (route: Route) => void): this;
44
66
  /**
45
67
  * Set the param name for a given resource
68
+ * @param resources - Object mapping resource names to parameter names
69
+ * @returns Current RouteResource instance for method chaining
46
70
  */
47
71
  params(resources: {
48
72
  [resource: string]: string;
@@ -53,14 +77,23 @@ export declare class RouteResource<ActionNames extends ResourceActionNames = Res
53
77
  *
54
78
  * Calling this method multiple times will append middleware
55
79
  * to existing list.
80
+ * @param actions - Action name(s) or '*' for all actions
81
+ * @param middleware - Middleware function(s) to apply
82
+ * @returns Current RouteResource instance for method chaining
56
83
  */
57
84
  use(actions: ActionNames | ActionNames[] | '*', middleware: OneOrMore<MiddlewareFn | ParsedNamedMiddleware>): this;
58
85
  /**
59
86
  * @alias use
87
+ * @param actions - Action name(s) or '*' for all actions
88
+ * @param middleware - Middleware function(s) to apply
89
+ * @returns Current RouteResource instance for method chaining
60
90
  */
61
91
  middleware(actions: ActionNames | ActionNames[] | '*', middleware: OneOrMore<MiddlewareFn | ParsedNamedMiddleware>): this;
62
92
  /**
63
93
  * Prepend name to all the routes
94
+ * @param name - The name to prepend to all route names
95
+ * @param normalizeName - Whether to normalize the name to snake_case
96
+ * @returns Current RouteResource instance for method chaining
64
97
  */
65
98
  as(name: string, normalizeName?: boolean): this;
66
99
  }
@@ -9,6 +9,12 @@ import type { RouteFn, RouteJSON, RouteMatcher, RouteMatchers, StoreRouteMiddlew
9
9
  */
10
10
  export declare class Route<Controller extends Constructor<any> = any> extends Macroable {
11
11
  #private;
12
+ /**
13
+ * Creates a new Route instance
14
+ * @param app - The AdonisJS application instance
15
+ * @param routerMiddleware - Array of global middleware registered on the router
16
+ * @param options - Configuration options for the route
17
+ */
12
18
  constructor(app: Application<any>, routerMiddleware: ParsedGlobalMiddleware[], options: {
13
19
  pattern: string;
14
20
  methods: string[];
@@ -33,6 +39,8 @@ export declare class Route<Controller extends Constructor<any> = any> extends Ma
33
39
  /**
34
40
  * Define prefix for the route. Calling this method multiple times
35
41
  * applies multiple prefixes in the reverse order.
42
+ * @param prefix - The prefix to add to the route
43
+ * @returns Current Route instance for method chaining
36
44
  */
37
45
  prefix(prefix: string): this;
38
46
  /**
@@ -1,15 +1,11 @@
1
1
  import type { Encryption } from '@adonisjs/encryption';
2
2
  import { type Router } from './main.ts';
3
- import { type MatchItRouteToken } from '../types/route.ts';
4
3
  import { type UrlFor, type LookupList, type SignedURLOptions } from '../types/url_builder.ts';
5
- /**
6
- * Makes signed URL for a given route pattern. The route pattern could be an
7
- * identifier or an array of tokens.
8
- */
9
- export declare function createSignedURL(identifier: string, tokens: MatchItRouteToken[], searchParamsStringifier: (qs: Record<string, any>) => string, encryption: Encryption, params?: any[] | {
10
- [param: string]: any;
11
- }, options?: SignedURLOptions): string;
12
4
  /**
13
5
  * Creates the URLBuilder helper for making signed URLs
6
+ * @param router - The router instance
7
+ * @param encryption - Encryption service for signing URLs
8
+ * @param searchParamsStringifier - Function to stringify query string parameters
9
+ * @returns URL builder function for creating signed URLs
14
10
  */
15
11
  export declare function createSignedUrlBuilder<Routes extends LookupList>(router: Router, encryption: Encryption, searchParamsStringifier: (qs: Record<string, any>) => string): UrlFor<Routes, SignedURLOptions>;
@@ -44,6 +44,8 @@ export declare class RoutesStore {
44
44
  * }
45
45
  * })
46
46
  * ```
47
+ * @param route - The route to add to the store
48
+ * @returns Current RoutesStore instance for method chaining
47
49
  */
48
50
  add(route: RouteJSON): this;
49
51
  /**
@@ -54,6 +56,11 @@ export declare class RoutesStore {
54
56
  * The domain parameter has to be a registered pattern and not the fully
55
57
  * qualified runtime domain. You must call `matchDomain` first to fetch
56
58
  * the pattern for qualified domain
59
+ * @param url - The URL to match
60
+ * @param method - HTTP method
61
+ * @param shouldDecodeParam - Whether to decode parameters
62
+ * @param domain - Optional domain tokens and hostname
63
+ * @returns Matched route or null if no match found
57
64
  */
58
65
  match(url: string, method: string, shouldDecodeParam: boolean, domain?: {
59
66
  tokens: MatchItRouteToken[];
@@ -61,6 +68,8 @@ export declare class RoutesStore {
61
68
  }): null | MatchedRoute;
62
69
  /**
63
70
  * Match hostname against registered domains.
71
+ * @param hostname - The hostname to match
72
+ * @returns Array of matched domain tokens
64
73
  */
65
74
  matchDomain(hostname?: string | null): MatchItRouteToken[];
66
75
  }
@@ -1,14 +1,9 @@
1
1
  import { type Router } from './main.ts';
2
- import { type MatchItRouteToken } from '../types/route.ts';
3
- import { type UrlFor, type LookupList, type URLOptions } from '../types/url_builder.ts';
4
- /**
5
- * Makes URL for a given route pattern. The route pattern could be an
6
- * identifier or an array of tokens.
7
- */
8
- export declare function createURL(identifier: string, tokens: Pick<MatchItRouteToken, 'val' | 'type' | 'end'>[], searchParamsStringifier: (qs: Record<string, any>) => string, params?: any[] | {
9
- [param: string]: any;
10
- }, options?: URLOptions): string;
2
+ import { type UrlFor, type LookupList } from '../types/url_builder.ts';
11
3
  /**
12
4
  * Creates the URLBuilder helper
5
+ * @param router - The router instance
6
+ * @param searchParamsStringifier - Function to stringify query string parameters
7
+ * @returns URL builder function for creating URLs
13
8
  */
14
9
  export declare function createUrlBuilder<Routes extends LookupList>(router: Router, searchParamsStringifier: (qs: Record<string, any>) => string): UrlFor<Routes>;
@@ -3,6 +3,15 @@ import type { NextFn } from '@poppinss/middleware/types';
3
3
  import type { HttpContext } from '../../http_context/main.ts';
4
4
  import { type ParsedGlobalMiddleware } from '../../types/middleware.ts';
5
5
  /**
6
- * The middleware handler invokes the middleware functions.
6
+ * Creates a middleware execution handler that invokes middleware functions with tracing support
7
+ *
8
+ * This factory function returns a middleware execution handler that:
9
+ * - Executes middleware with debug logging
10
+ * - Provides distributed tracing through tracing channels
11
+ * - Passes the container resolver, HTTP context, and next function to middleware
12
+ *
13
+ * @param resolver - Container resolver for dependency injection
14
+ * @param ctx - HTTP context containing request/response data
15
+ * @returns Middleware execution function
7
16
  */
8
17
  export declare function middlewareHandler(resolver: ContainerResolver<any>, ctx: HttpContext): (fn: ParsedGlobalMiddleware, next: NextFn) => Promise<any>;
@@ -3,8 +3,18 @@ import type { Router } from '../../router/main.ts';
3
3
  import type { HttpContext } from '../../http_context/main.ts';
4
4
  import type { ServerErrorHandler } from '../../types/server.ts';
5
5
  /**
6
- * The route finder is executed after the server middleware stack.
7
- * It looks for a matching route and executes the route middleware
8
- * stack.
6
+ * Creates a route finder function that matches HTTP requests to registered routes
7
+ *
8
+ * This factory function returns a route handler that:
9
+ * - Matches incoming requests against registered routes
10
+ * - Extracts route parameters and subdomains
11
+ * - Executes the matched route's handler and middleware
12
+ * - Throws E_ROUTE_NOT_FOUND error for unmatched requests
13
+ *
14
+ * @param router - Router instance containing registered routes
15
+ * @param resolver - Container resolver for dependency injection
16
+ * @param ctx - HTTP context containing request/response data
17
+ * @param errorResponder - Error handler for route execution errors
18
+ * @returns Route execution function
9
19
  */
10
20
  export declare function routeFinder(router: Router, resolver: ContainerResolver<any>, ctx: HttpContext, errorResponder: ServerErrorHandler['handle']): () => any;
@@ -1,6 +1,13 @@
1
1
  import type { HttpContext } from '../../http_context/main.ts';
2
2
  /**
3
- * Writes the response to the socket. The "finish" method can
4
- * raise error when unable to serialize the response.
3
+ * Creates a response writer function that finalizes HTTP responses with error handling
4
+ *
5
+ * This factory function returns a response finalizer that:
6
+ * - Calls the response.finish() method to send the response
7
+ * - Catches serialization errors and sends a 500 error response
8
+ * - Logs fatal errors for debugging and monitoring
9
+ *
10
+ * @param ctx - HTTP context containing the response to finalize
11
+ * @returns Response finalization function
5
12
  */
6
13
  export declare function writeResponse(ctx: HttpContext): () => void;