@adonisjs/http-server 8.0.0-next.0 → 8.0.0-next.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 (54) hide show
  1. package/build/{chunk-VYBTM3NC.js → chunk-Z5EN426L.js} +141 -192
  2. package/build/factories/http_context.d.ts +3 -3
  3. package/build/factories/main.d.ts +6 -6
  4. package/build/factories/main.js +1 -1
  5. package/build/factories/qs_parser_factory.d.ts +2 -2
  6. package/build/factories/request.d.ts +2 -2
  7. package/build/factories/response.d.ts +3 -3
  8. package/build/factories/router.d.ts +1 -1
  9. package/build/factories/server_factory.d.ts +2 -2
  10. package/build/factories/url_builder_factory.d.ts +3 -3
  11. package/build/index.d.ts +16 -16
  12. package/build/index.js +1 -1
  13. package/build/src/cookies/serializer.d.ts +1 -1
  14. package/build/src/define_config.d.ts +1 -1
  15. package/build/src/define_middleware.d.ts +1 -1
  16. package/build/src/errors.d.ts +7 -5
  17. package/build/src/exception_handler.d.ts +2 -2
  18. package/build/src/helpers.d.ts +3 -4
  19. package/build/src/http_context/local_storage.d.ts +1 -1
  20. package/build/src/http_context/main.d.ts +3 -3
  21. package/build/src/qs.d.ts +1 -1
  22. package/build/src/redirect.d.ts +4 -5
  23. package/build/src/request.d.ts +3 -3
  24. package/build/src/response.d.ts +5 -5
  25. package/build/src/router/brisk.d.ts +4 -4
  26. package/build/src/router/executor.d.ts +3 -3
  27. package/build/src/router/factories/use_return_value.d.ts +1 -1
  28. package/build/src/router/group.d.ts +5 -5
  29. package/build/src/router/legacy/url_builder.d.ts +1 -1
  30. package/build/src/router/main.d.ts +61 -17
  31. package/build/src/router/resource.d.ts +3 -4
  32. package/build/src/router/route.d.ts +2 -3
  33. package/build/src/router/signed_url_builder.d.ts +4 -3
  34. package/build/src/router/store.d.ts +1 -2
  35. package/build/src/{client → router}/url_builder.d.ts +4 -3
  36. package/build/src/server/factories/middleware_handler.d.ts +2 -2
  37. package/build/src/server/factories/route_finder.d.ts +3 -3
  38. package/build/src/server/factories/write_response.d.ts +1 -1
  39. package/build/src/server/main.d.ts +6 -6
  40. package/build/src/tracing_channels.d.ts +1 -1
  41. package/build/src/types/main.d.ts +1 -1
  42. package/build/src/types/middleware.d.ts +1 -1
  43. package/build/src/types/route.d.ts +19 -17
  44. package/build/src/types/server.d.ts +4 -4
  45. package/build/src/types/tracing_channels.d.ts +3 -3
  46. package/build/src/{client/types.d.ts → types/url_builder.d.ts} +16 -50
  47. package/build/src/utils.d.ts +5 -5
  48. package/package.json +9 -14
  49. package/build/client.cjs +0 -232
  50. package/build/client.d.cts +0 -258
  51. package/build/client.d.ts +0 -258
  52. package/build/client.js +0 -229
  53. package/build/src/client/main.d.ts +0 -3
  54. package/build/src/client/router.d.ts +0 -68
@@ -1,5 +1,5 @@
1
1
  import { Exception } from '@poppinss/utils/exception';
2
- import type { HttpContext } from './http_context/main.js';
2
+ import type { HttpContext } from './http_context/main.ts';
3
3
  /**
4
4
  * Thrown when unable to find a matching route for the given request
5
5
  */
@@ -22,7 +22,7 @@ export declare const E_HTTP_EXCEPTION: {
22
22
  code?: string;
23
23
  status: number;
24
24
  toString(): string;
25
- readonly [Symbol.toStringTag]: string;
25
+ get [Symbol.toStringTag](): string;
26
26
  message: string;
27
27
  stack?: string;
28
28
  cause?: unknown;
@@ -38,7 +38,7 @@ export declare const E_HTTP_EXCEPTION: {
38
38
  code?: string;
39
39
  status: number;
40
40
  toString(): string;
41
- readonly [Symbol.toStringTag]: string;
41
+ get [Symbol.toStringTag](): string;
42
42
  message: string;
43
43
  stack?: string;
44
44
  cause?: unknown;
@@ -46,6 +46,7 @@ export declare const E_HTTP_EXCEPTION: {
46
46
  help?: string;
47
47
  status?: number;
48
48
  message?: string;
49
+ isError(error: unknown): error is Error;
49
50
  captureStackTrace(targetObject: object, constructorOpt?: Function): void;
50
51
  prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
51
52
  stackTraceLimit: number;
@@ -65,7 +66,7 @@ export declare const E_HTTP_REQUEST_ABORTED: {
65
66
  code?: string;
66
67
  status: number;
67
68
  toString(): string;
68
- readonly [Symbol.toStringTag]: string;
69
+ get [Symbol.toStringTag](): string;
69
70
  message: string;
70
71
  stack?: string;
71
72
  cause?: unknown;
@@ -81,7 +82,7 @@ export declare const E_HTTP_REQUEST_ABORTED: {
81
82
  code?: string;
82
83
  status: number;
83
84
  toString(): string;
84
- readonly [Symbol.toStringTag]: string;
85
+ get [Symbol.toStringTag](): string;
85
86
  message: string;
86
87
  stack?: string;
87
88
  cause?: unknown;
@@ -89,6 +90,7 @@ export declare const E_HTTP_REQUEST_ABORTED: {
89
90
  help?: string;
90
91
  status?: number;
91
92
  message?: string;
93
+ isError(error: unknown): error is Error;
92
94
  captureStackTrace(targetObject: object, constructorOpt?: Function): void;
93
95
  prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
94
96
  stackTraceLimit: number;
@@ -1,7 +1,7 @@
1
1
  import Macroable from '@poppinss/macroable';
2
2
  import type { Level } from '@adonisjs/logger/types';
3
- import type { HttpContext } from './http_context/main.js';
4
- import type { HttpError, StatusPageRange, StatusPageRenderer } from './types/server.js';
3
+ import type { HttpContext } from './http_context/main.ts';
4
+ import type { HttpError, StatusPageRange, StatusPageRenderer } from './types/server.ts';
5
5
  /**
6
6
  * The base HTTP exception handler one can inherit from to handle
7
7
  * HTTP exceptions.
@@ -1,7 +1,6 @@
1
- import { type CookieOptions } from './types/response.js';
2
- import type { RouteMatchers, RouteJSON } from './types/route.js';
3
- import { type RouteHandlerInfo, type MiddlewareFn, type MiddlewareHandlerInfo, type ParsedGlobalMiddleware, type ParsedNamedMiddleware } from './types/middleware.ts';
4
- import { type MatchItRouteToken } from './client/types.ts';
1
+ import { type CookieOptions } from './types/response.ts';
2
+ import type { RouteMatchers, RouteJSON, MatchItRouteToken } from './types/route.ts';
3
+ import { type MiddlewareFn, type RouteHandlerInfo, type MiddlewareHandlerInfo, type ParsedGlobalMiddleware, type ParsedNamedMiddleware } from './types/middleware.ts';
5
4
  /**
6
5
  * This function is similar to the intrinsic function encodeURI. However, it will not encode:
7
6
  * - The \, ^, or | characters
@@ -1,5 +1,5 @@
1
1
  import { AsyncLocalStorage } from 'node:async_hooks';
2
- import type { HttpContext } from './main.js';
2
+ import type { HttpContext } from './main.ts';
3
3
  /**
4
4
  * Async local storage for HTTP context
5
5
  */
@@ -1,9 +1,9 @@
1
1
  import Macroable from '@poppinss/macroable';
2
2
  import type { Logger } from '@adonisjs/logger';
3
3
  import { type ContainerResolver } from '@adonisjs/fold';
4
- import type { Request } from '../request.js';
5
- import type { Response } from '../response.js';
6
- import type { RouteJSON } from '../types/route.js';
4
+ import type { Request } from '../request.ts';
5
+ import type { Response } from '../response.ts';
6
+ import type { RouteJSON } from '../types/route.ts';
7
7
  /**
8
8
  * Http context encapsulates properties for a given HTTP request. The
9
9
  * context class can be extended using macros and getters.
package/build/src/qs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type QSParserConfig } from './types/qs.js';
1
+ import { type QSParserConfig } from './types/qs.ts';
2
2
  /**
3
3
  * Query string parser used to parse and stringify query
4
4
  * strings.
@@ -1,9 +1,8 @@
1
1
  import type { IncomingMessage } from 'node:http';
2
- import type { Qs } from './qs.js';
3
- import type { Response } from './response.js';
4
- import type { Router } from './router/main.js';
5
- import type { GetRoutesForMethod, RoutesList } from './types/route.js';
6
- import type { RouteBuilderArguments, URLOptions } from './client/types.ts';
2
+ import type { Qs } from './qs.ts';
3
+ import type { Response } from './response.ts';
4
+ import type { Router } from './router/main.ts';
5
+ import type { RoutesList, URLOptions, GetRoutesForMethod, RouteBuilderArguments } from './types/url_builder.ts';
7
6
  /**
8
7
  * Exposes the API to construct redirect routes
9
8
  */
@@ -1,9 +1,9 @@
1
1
  import Macroable from '@poppinss/macroable';
2
2
  import type { Encryption } from '@adonisjs/encryption';
3
3
  import { type ServerResponse, type IncomingMessage, type IncomingHttpHeaders } from 'node:http';
4
- import type { Qs } from './qs.js';
5
- import { type RequestConfig } from './types/request.js';
6
- import type { HttpContext } from './http_context/main.js';
4
+ import type { Qs } from './qs.ts';
5
+ import { type RequestConfig } from './types/request.ts';
6
+ import type { HttpContext } from './http_context/main.ts';
7
7
  /**
8
8
  * HTTP Request class exposes the interface to consistently read values
9
9
  * related to a given HTTP request. The class is wrapper over
@@ -1,11 +1,11 @@
1
1
  import Macroable from '@poppinss/macroable';
2
2
  import type { Encryption } from '@adonisjs/encryption';
3
3
  import { type ServerResponse, type IncomingMessage } from 'node:http';
4
- import type { Qs } from './qs.js';
5
- import { Redirect } from './redirect.js';
6
- import type { Router } from './router/main.js';
7
- import type { HttpContext } from './http_context/main.js';
8
- import type { CastableHeader, CookieOptions, ResponseConfig, ResponseStream } from './types/response.js';
4
+ import type { Qs } from './qs.ts';
5
+ import { Redirect } from './redirect.ts';
6
+ import type { Router } from './router/main.ts';
7
+ import type { HttpContext } from './http_context/main.ts';
8
+ import type { CastableHeader, CookieOptions, ResponseConfig, ResponseStream } from './types/response.ts';
9
9
  /**
10
10
  * The response is a wrapper over [ServerResponse](https://nodejs.org/api/http.html#http_class_http_serverresponse)
11
11
  * streamlining the process of writing response body and automatically setting up appropriate headers.
@@ -1,9 +1,9 @@
1
1
  import Macroable from '@poppinss/macroable';
2
2
  import type { Application } from '@adonisjs/application';
3
- import { Route } from './route.js';
4
- import type { ParsedGlobalMiddleware } from '../types/middleware.js';
5
- import type { RouteBuilderArguments, URLOptions } from '../client/types.ts';
6
- import type { GetRoutesForMethod, RouteFn, RouteMatchers, RoutesList } from '../types/route.js';
3
+ import { Route } from './route.ts';
4
+ import type { RouteFn, RouteMatchers } from '../types/route.ts';
5
+ import type { ParsedGlobalMiddleware } from '../types/middleware.ts';
6
+ import type { RoutesList, 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.
@@ -1,7 +1,7 @@
1
1
  import type { ContainerResolver } from '@adonisjs/fold';
2
- import type { RouteJSON } from '../types/route.js';
3
- import type { HttpContext } from '../http_context/main.js';
4
- import type { ServerErrorHandler } from '../types/server.js';
2
+ import type { RouteJSON } from '../types/route.ts';
3
+ import type { HttpContext } from '../http_context/main.ts';
4
+ import type { ServerErrorHandler } from '../types/server.ts';
5
5
  /**
6
6
  * Executor to execute the route middleware pipeline the route
7
7
  * handler
@@ -1,4 +1,4 @@
1
- import { type HttpContext } from '../../http_context/main.js';
1
+ 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
@@ -1,10 +1,10 @@
1
1
  import Macroable from '@poppinss/macroable';
2
2
  import type { OneOrMore } from '@poppinss/utils/types';
3
- import { type Route } from './route.js';
4
- import { BriskRoute } from './brisk.js';
5
- import { RouteResource } from './resource.js';
6
- import type { RouteMatcher } from '../client/types.ts';
7
- import type { MiddlewareFn, ParsedNamedMiddleware } from '../types/middleware.js';
3
+ import { type Route } from './route.ts';
4
+ import { BriskRoute } from './brisk.ts';
5
+ import { RouteResource } from './resource.ts';
6
+ import { type RouteMatcher } from '../types/route.ts';
7
+ import type { MiddlewareFn, ParsedNamedMiddleware } from '../types/middleware.ts';
8
8
  /**
9
9
  * Group class exposes the API to take action on a group of routes.
10
10
  * The group routes must be pre-defined using the constructor.
@@ -1,4 +1,4 @@
1
- import { type Router } from '../main.js';
1
+ import { type Router } from '../main.ts';
2
2
  /**
3
3
  * URL builder class is used to create URIs for pre-registered
4
4
  * routes.
@@ -1,17 +1,16 @@
1
1
  import type { Encryption } from '@adonisjs/encryption';
2
2
  import type { Application } from '@adonisjs/application';
3
3
  import type { Constructor, LazyImport } from '@poppinss/utils/types';
4
- import type { Qs } from '../qs.js';
5
- import { Route } from './route.js';
6
- import { RouteGroup } from './group.js';
7
- import { BriskRoute } from './brisk.js';
8
- import { RouteResource } from './resource.js';
9
- import { RouterClient } from '../client/router.ts';
10
- import { UrlBuilder } from './legacy/url_builder.js';
11
- import { RouteMatchers as Matchers } from './matchers.js';
12
- import type { MiddlewareAsClass, ParsedGlobalMiddleware } from '../types/middleware.js';
13
- import type { RouteFn, RouteJSON, RoutesList, MatchedRoute, RouteMatchers, MakeUrlOptions, MakeSignedUrlOptions, GetControllerHandlers } from '../types/route.js';
14
- import { type UrlFor, type LookupList, type SignedURLOptions, type RouteMatcher, type MatchItRouteToken } from '../client/types.ts';
4
+ import type { Qs } from '../qs.ts';
5
+ import { Route } from './route.ts';
6
+ import { RouteGroup } from './group.ts';
7
+ import { BriskRoute } from './brisk.ts';
8
+ import { RouteResource } from './resource.ts';
9
+ import { UrlBuilder } from './legacy/url_builder.ts';
10
+ import { RouteMatchers as Matchers } from './matchers.ts';
11
+ import type { MiddlewareAsClass, ParsedGlobalMiddleware } from '../types/middleware.ts';
12
+ import type { RouteFn, RouteJSON, MatchedRoute, RouteMatchers, MakeUrlOptions, MakeSignedUrlOptions, GetControllerHandlers, RouteMatcher } from '../types/route.ts';
13
+ import { type UrlFor, type LookupList, type RoutesList, type SignedURLOptions } from '../types/url_builder.ts';
15
14
  /**
16
15
  * Router class exposes a unified API to register new routes, group them or
17
16
  * create route resources.
@@ -24,7 +23,7 @@ import { type UrlFor, type LookupList, type SignedURLOptions, type RouteMatcher,
24
23
  * })
25
24
  * ```
26
25
  */
27
- export declare class Router extends RouterClient<RouteJSON> {
26
+ export declare class Router {
28
27
  #private;
29
28
  /**
30
29
  * A flag to know if routes for explicit domains have been registered.
@@ -56,11 +55,21 @@ export declare class Router extends RouterClient<RouteJSON> {
56
55
  urlFor: UrlFor<RoutesList extends LookupList ? RoutesList : never>;
57
56
  signedUrlFor: UrlFor<RoutesList extends LookupList ? RoutesList : never, SignedURLOptions>;
58
57
  };
58
+ /**
59
+ * List of route references kept for lookup.
60
+ */
61
+ protected routes: {
62
+ [domain: string]: RouteJSON[];
63
+ };
59
64
  constructor(app: Application<any>, encryption: Encryption, qsParser: Qs);
65
+ /**
66
+ * Register route JSON payload
67
+ */
68
+ protected register(route: RouteJSON): void;
60
69
  /**
61
70
  * Parses the route pattern
62
71
  */
63
- parsePattern(pattern: string, matchers?: RouteMatchers): MatchItRouteToken[];
72
+ parsePattern(pattern: string, matchers?: RouteMatchers): import("../types/route.ts").MatchItRouteToken[];
64
73
  /**
65
74
  * Define an array of middleware to use on all the routes.
66
75
  * Calling this method multiple times pushes to the
@@ -72,7 +81,7 @@ export declare class Router extends RouterClient<RouteJSON> {
72
81
  * not registered anywhere, but instead converted in a new collection
73
82
  * of functions you can apply on the routes, or router groups.
74
83
  */
75
- named<NamedMiddleware extends Record<string, LazyImport<MiddlewareAsClass>>>(collection: NamedMiddleware): { [K in keyof NamedMiddleware]: <Args extends import("../types/middleware.js").GetMiddlewareArgs<import("@poppinss/utils/types").UnWrapLazyImport<NamedMiddleware[K]>>>(...args: Args) => {
84
+ 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) => {
76
85
  name: K;
77
86
  reference: LazyImport<MiddlewareAsClass> | MiddlewareAsClass;
78
87
  args: Args[0];
@@ -114,11 +123,11 @@ export declare class Router extends RouterClient<RouteJSON> {
114
123
  /**
115
124
  * Registers a route resource with conventional set of routes
116
125
  */
117
- resource(resource: string, controller: string | LazyImport<Constructor<any>> | Constructor<any>): RouteResource<import("../types/route.js").ResourceActionNames>;
126
+ resource(resource: string, controller: string | LazyImport<Constructor<any>> | Constructor<any>): RouteResource<import("../types/route.ts").ResourceActionNames>;
118
127
  /**
119
128
  * Register a route resource with shallow nested routes.
120
129
  */
121
- shallowResource(resource: string, controller: string | LazyImport<Constructor<any>> | Constructor<any>): RouteResource<import("../types/route.js").ResourceActionNames>;
130
+ shallowResource(resource: string, controller: string | LazyImport<Constructor<any>> | Constructor<any>): RouteResource<import("../types/route.ts").ResourceActionNames>;
122
131
  /**
123
132
  * Returns a brisk route instance for a given URL pattern
124
133
  */
@@ -133,13 +142,48 @@ export declare class Router extends RouterClient<RouteJSON> {
133
142
  * commit method is called.
134
143
  */
135
144
  commit(): void;
145
+ /**
146
+ * Finds a route by its identifier. The identifier can be the
147
+ * route name, controller.method name or the route pattern
148
+ * itself.
149
+ *
150
+ * When "disableLegacyLookup" is set, the lookup will be performed
151
+ * only using the route name
152
+ */
153
+ find(routeIdentifier: string, domain?: string, method?: string, disableLegacyLookup?: boolean): RouteJSON | null;
154
+ /**
155
+ * Finds a route by its identifier. The identifier can be the
156
+ * route name, controller.method name or the route pattern
157
+ * itself.
158
+ *
159
+ * An error is raised when unable to find the route.
160
+ *
161
+ * When "disableLegacyLookup" is set, the lookup will be performed
162
+ * only using the route name
163
+ */
164
+ findOrFail(routeIdentifier: string, domain?: string, method?: string, disableLegacyLookup?: boolean): RouteJSON;
165
+ /**
166
+ * Check if a route exists. The identifier can be the
167
+ * route name, controller.method name or the route pattern
168
+ * itself.
169
+ *
170
+ * When "followLookupStrategy" is enabled, the lookup will be performed
171
+ * on the basis of the lookup strategy enabled via the "lookupStrategies"
172
+ * method. The default lookupStrategy is "name" and "pattern".
173
+ */
174
+ has(routeIdentifier: string, domain?: string, method?: string, followLookupStrategy?: boolean): boolean;
175
+ /**
176
+ * Returns a list of routes grouped by their domain names
177
+ */
178
+ toJSON(): {
179
+ [domain: string]: RouteJSON[];
180
+ };
136
181
  /**
137
182
  * Generates types for the URL builder. These types must
138
183
  * be written inside a file for the URL builder to
139
184
  * pick them up.
140
185
  */
141
186
  generateTypes(indentation?: number): string;
142
- generateClient(): string;
143
187
  /**
144
188
  * Find route for a given URL, method and optionally domain
145
189
  */
@@ -1,10 +1,9 @@
1
1
  import Macroable from '@poppinss/macroable';
2
2
  import type { Application } from '@adonisjs/application';
3
3
  import type { Constructor, LazyImport, OneOrMore } from '@poppinss/utils/types';
4
- import { Route } from './route.js';
5
- import { type RouteMatcher } from '../client/types.ts';
6
- import type { ResourceActionNames, RouteMatchers } from '../types/route.js';
7
- import type { MiddlewareFn, ParsedNamedMiddleware, ParsedGlobalMiddleware } from '../types/middleware.js';
4
+ import { Route } from './route.ts';
5
+ import type { ResourceActionNames, RouteMatcher, RouteMatchers } from '../types/route.ts';
6
+ import type { MiddlewareFn, ParsedNamedMiddleware, ParsedGlobalMiddleware } from '../types/middleware.ts';
8
7
  /**
9
8
  * Route resource exposes the API to register multiple routes for a resource.
10
9
  */
@@ -1,9 +1,8 @@
1
1
  import Macroable from '@poppinss/macroable';
2
2
  import type { Application } from '@adonisjs/application';
3
3
  import type { Constructor, LazyImport, OneOrMore } from '@poppinss/utils/types';
4
- import { type RouteMatcher } from '../client/types.ts';
5
- import type { MiddlewareFn, ParsedNamedMiddleware, ParsedGlobalMiddleware } from '../types/middleware.js';
6
- import type { RouteFn, RouteJSON, RouteMatchers, StoreRouteMiddleware, GetControllerHandlers } from '../types/route.js';
4
+ import type { MiddlewareFn, ParsedNamedMiddleware, ParsedGlobalMiddleware } from '../types/middleware.ts';
5
+ import type { RouteFn, RouteJSON, RouteMatcher, RouteMatchers, StoreRouteMiddleware, GetControllerHandlers } from '../types/route.ts';
7
6
  /**
8
7
  * The route class exposes the APIs for constructing a route using the
9
8
  * fluent API.
@@ -1,6 +1,7 @@
1
1
  import type { Encryption } from '@adonisjs/encryption';
2
- import { type RouterClient } from '../client/router.ts';
3
- import { type UrlFor, type LookupList, type ClientRouteJSON, type SignedURLOptions, type MatchItRouteToken } from '../client/types.ts';
2
+ import { type Router } from './main.ts';
3
+ import { type MatchItRouteToken } from '../types/route.ts';
4
+ import { type UrlFor, type LookupList, type SignedURLOptions } from '../types/url_builder.ts';
4
5
  /**
5
6
  * Makes signed URL for a given route pattern. The route pattern could be an
6
7
  * identifier or an array of tokens.
@@ -11,4 +12,4 @@ export declare function createSignedURL(identifier: string, tokens: MatchItRoute
11
12
  /**
12
13
  * Creates the URLBuilder helper for making signed URLs
13
14
  */
14
- export declare function createSignedUrlBuilder<Routes extends LookupList>(router: RouterClient<ClientRouteJSON>, encryption: Encryption, searchParamsStringifier: (qs: Record<string, any>) => string): UrlFor<Routes, SignedURLOptions>;
15
+ export declare function createSignedUrlBuilder<Routes extends LookupList>(router: Router, encryption: Encryption, searchParamsStringifier: (qs: Record<string, any>) => string): UrlFor<Routes, SignedURLOptions>;
@@ -1,5 +1,4 @@
1
- import type { RouteJSON, MatchedRoute, StoreRoutesTree } from '../types/route.js';
2
- import { type MatchItRouteToken } from '../client/types.ts';
1
+ import type { RouteJSON, MatchedRoute, StoreRoutesTree, MatchItRouteToken } from '../types/route.ts';
3
2
  /**
4
3
  * Store class is used to store a list of routes, along side with their tokens
5
4
  * to match the URLs.
@@ -1,5 +1,6 @@
1
- import { type RouterClient } from './router.ts';
2
- import { type UrlFor, type LookupList, type URLOptions, type ClientRouteJSON, type MatchItRouteToken } from './types.ts';
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';
3
4
  /**
4
5
  * Makes URL for a given route pattern. The route pattern could be an
5
6
  * identifier or an array of tokens.
@@ -10,4 +11,4 @@ export declare function createURL(identifier: string, tokens: Pick<MatchItRouteT
10
11
  /**
11
12
  * Creates the URLBuilder helper
12
13
  */
13
- export declare function createUrlBuilder<Routes extends LookupList>(router: RouterClient<ClientRouteJSON>, searchParamsStringifier: (qs: Record<string, any>) => string): UrlFor<Routes>;
14
+ export declare function createUrlBuilder<Routes extends LookupList>(router: Router, searchParamsStringifier: (qs: Record<string, any>) => string): UrlFor<Routes>;
@@ -1,7 +1,7 @@
1
1
  import type { ContainerResolver } from '@adonisjs/fold';
2
2
  import type { NextFn } from '@poppinss/middleware/types';
3
- import type { HttpContext } from '../../http_context/main.js';
4
- import { type ParsedGlobalMiddleware } from '../../types/middleware.js';
3
+ import type { HttpContext } from '../../http_context/main.ts';
4
+ import { type ParsedGlobalMiddleware } from '../../types/middleware.ts';
5
5
  /**
6
6
  * The middleware handler invokes the middleware functions.
7
7
  */
@@ -1,7 +1,7 @@
1
1
  import type { ContainerResolver } from '@adonisjs/fold';
2
- import type { Router } from '../../router/main.js';
3
- import type { HttpContext } from '../../http_context/main.js';
4
- import type { ServerErrorHandler } from '../../types/server.js';
2
+ import type { Router } from '../../router/main.ts';
3
+ import type { HttpContext } from '../../http_context/main.ts';
4
+ import type { ServerErrorHandler } from '../../types/server.ts';
5
5
  /**
6
6
  * The route finder is executed after the server middleware stack.
7
7
  * It looks for a matching route and executes the route middleware
@@ -1,4 +1,4 @@
1
- import type { HttpContext } from '../../http_context/main.js';
1
+ import type { HttpContext } from '../../http_context/main.ts';
2
2
  /**
3
3
  * Writes the response to the socket. The "finish" method can
4
4
  * raise error when unable to serialize the response.
@@ -6,12 +6,12 @@ import type { Application } from '@adonisjs/application';
6
6
  import type { EmitterLike } from '@adonisjs/events/types';
7
7
  import { type ContainerResolver } from '@adonisjs/fold';
8
8
  import type { ServerResponse, IncomingMessage, Server as HttpServer } from 'node:http';
9
- import type { MiddlewareAsClass, ParsedGlobalMiddleware } from '../types/middleware.js';
10
- import type { ServerConfig, HttpServerEvents, ErrorHandlerAsAClass, TestingMiddlewarePipeline } from '../types/server.js';
11
- import { Request } from '../request.js';
12
- import { Response } from '../response.js';
13
- import { Router } from '../router/main.js';
14
- import { HttpContext } from '../http_context/main.js';
9
+ import type { MiddlewareAsClass, ParsedGlobalMiddleware } from '../types/middleware.ts';
10
+ import type { ServerConfig, HttpServerEvents, ErrorHandlerAsAClass, TestingMiddlewarePipeline } from '../types/server.ts';
11
+ import { Request } from '../request.ts';
12
+ import { Response } from '../response.ts';
13
+ import { Router } from '../router/main.ts';
14
+ import { HttpContext } from '../http_context/main.ts';
15
15
  /**
16
16
  * The HTTP server implementation to handle incoming requests and respond using the
17
17
  * registered routes.
@@ -1,5 +1,5 @@
1
1
  import diagnostics_channel from 'node:diagnostics_channel';
2
- import type { MiddlewareTracingData } from './types/tracing_channels.js';
2
+ import type { MiddlewareTracingData } from './types/tracing_channels.ts';
3
3
  /**
4
4
  * Traces every HTTP request handled by the {@link Server} class.
5
5
  */
@@ -3,5 +3,5 @@ export * from './route.ts';
3
3
  export * from './server.ts';
4
4
  export * from './request.ts';
5
5
  export * from './response.ts';
6
- export * from '../client/types.ts';
6
+ export * from './url_builder.ts';
7
7
  export * from './middleware.ts';
@@ -1,7 +1,7 @@
1
1
  import type { ContainerResolver } from '@adonisjs/fold';
2
2
  import type { NextFn } from '@poppinss/middleware/types';
3
3
  import type { Constructor, LazyImport } from '@poppinss/utils/types';
4
- import type { HttpContext } from '../http_context/main.js';
4
+ import type { HttpContext } from '../http_context/main.ts';
5
5
  /**
6
6
  * Middleware represented as a class
7
7
  */
@@ -1,10 +1,25 @@
1
1
  import type Middleware from '@poppinss/middleware';
2
2
  import type { ContainerResolver } from '@adonisjs/fold';
3
3
  import type { Constructor, LazyImport } from '@poppinss/utils/types';
4
- import type { ServerErrorHandler } from './server.js';
5
- import type { HttpContext } from '../http_context/main.js';
6
- import { type RouteMatcher, type MatchItRouteToken } from '../client/types.ts';
7
- import type { MiddlewareFn, ParsedGlobalMiddleware } from './middleware.js';
4
+ import type { ServerErrorHandler } from './server.ts';
5
+ import type { HttpContext } from '../http_context/main.ts';
6
+ import type { MiddlewareFn, ParsedGlobalMiddleware } from './middleware.ts';
7
+ /**
8
+ * Shape of a route param matcher
9
+ */
10
+ export type RouteMatcher = {
11
+ match?: RegExp;
12
+ cast?: (value: string) => any;
13
+ };
14
+ /**
15
+ * Route token stored by matchit library
16
+ */
17
+ export type MatchItRouteToken = RouteMatcher & {
18
+ old: string;
19
+ type: 0 | 1 | 2 | 3;
20
+ val: string;
21
+ end: string;
22
+ };
8
23
  /**
9
24
  * Returns a union of methods from a controller that accepts
10
25
  * the context as the first argument.
@@ -150,16 +165,3 @@ export type MakeSignedUrlOptions = MakeUrlOptions & {
150
165
  expiresIn?: string | number;
151
166
  purpose?: string;
152
167
  };
153
- /**
154
- * To be generated by the router and used by the URL builder
155
- * and the LookupStore
156
- */
157
- export interface RoutesList {
158
- }
159
- /**
160
- * Helper to get routes for a given method from the RoutesList. The
161
- * RoutesList is extended in the userland code.
162
- */
163
- export type GetRoutesForMethod<Method> = {
164
- [K in keyof RoutesList]: Method extends K ? RoutesList[Method] : never;
165
- };
@@ -1,9 +1,9 @@
1
1
  import type { Constructor } from '@poppinss/utils/types';
2
2
  import type { ErrorHandler, FinalHandler } from '@poppinss/middleware/types';
3
- import type { QSParserConfig } from './qs.js';
4
- import type { RequestConfig } from './request.js';
5
- import type { ResponseConfig } from './response.js';
6
- import type { HttpContext } from '../http_context/main.js';
3
+ import type { QSParserConfig } from './qs.ts';
4
+ import type { RequestConfig } from './request.ts';
5
+ import type { ResponseConfig } from './response.ts';
6
+ import type { HttpContext } from '../http_context/main.ts';
7
7
  /**
8
8
  * Normalized HTTP error used by the exception
9
9
  * handler.
@@ -1,6 +1,6 @@
1
- import type { RouteJSON } from './route.js';
2
- import type { HttpContext } from '../http_context/main.js';
3
- import type { MiddlewareFn, ParsedGlobalMiddleware, ParsedNamedMiddleware } from './middleware.js';
1
+ import type { RouteJSON } from './route.ts';
2
+ import type { HttpContext } from '../http_context/main.ts';
3
+ import type { MiddlewareFn, ParsedGlobalMiddleware, ParsedNamedMiddleware } from './middleware.ts';
4
4
  export type HTTPRequestTracingData = HttpContext;
5
5
  export type MiddlewareTracingData = ParsedGlobalMiddleware | ParsedNamedMiddleware | MiddlewareFn;
6
6
  export type RouteHandlerTracingData = RouteJSON;