@adonisjs/http-server 8.0.0-next.0 → 8.0.0-next.1

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-HMYAZG76.js} +127 -168
  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 +73 -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} +15 -49
  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,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,60 @@ export declare class Router extends RouterClient<RouteJSON> {
133
142
  * commit method is called.
134
143
  */
135
144
  commit(): void;
145
+ /**
146
+ * The lookup strategies to follow when generating URL builder
147
+ * types and client
148
+ */
149
+ lookupStrategies: ('name' | 'pattern' | 'controller')[];
150
+ /**
151
+ * Define the lookup strategies to follow when generating URL builder
152
+ * types and client.
153
+ */
154
+ updateLookupStrategies(strategies: ('name' | 'pattern' | 'controller')[]): this;
155
+ /**
156
+ * Finds a route by its identifier. The identifier can be the
157
+ * route name, controller.method name or the route pattern
158
+ * itself.
159
+ *
160
+ * When "followLookupStrategy" is enabled, the lookup will be performed
161
+ * on the basis of the lookup strategy enabled via the "lookupStrategies"
162
+ * method. The default lookupStrategy is "name" and "pattern".
163
+ */
164
+ find(routeIdentifier: string, domain?: string, method?: string, followLookupStrategy?: boolean): RouteJSON | null;
165
+ /**
166
+ * Finds a route by its identifier. The identifier can be the
167
+ * route name, controller.method name or the route pattern
168
+ * itself.
169
+ *
170
+ * An error is raised when unable to find the route.
171
+ *
172
+ * When "followLookupStrategy" is enabled, the lookup will be performed
173
+ * on the basis of the lookup strategy enabled via the "lookupStrategies"
174
+ * method. The default lookupStrategy is "name" and "pattern".
175
+ */
176
+ findOrFail(routeIdentifier: string, domain?: string, method?: string, followLookupStrategy?: boolean): RouteJSON;
177
+ /**
178
+ * Check if a route exists. The identifier can be the
179
+ * route name, controller.method name or the route pattern
180
+ * itself.
181
+ *
182
+ * When "followLookupStrategy" is enabled, the lookup will be performed
183
+ * on the basis of the lookup strategy enabled via the "lookupStrategies"
184
+ * method. The default lookupStrategy is "name" and "pattern".
185
+ */
186
+ has(routeIdentifier: string, domain?: string, method?: string, followLookupStrategy?: boolean): boolean;
187
+ /**
188
+ * Returns a list of routes grouped by their domain names
189
+ */
190
+ toJSON(): {
191
+ [domain: string]: RouteJSON[];
192
+ };
136
193
  /**
137
194
  * Generates types for the URL builder. These types must
138
195
  * be written inside a file for the URL builder to
139
196
  * pick them up.
140
197
  */
141
198
  generateTypes(indentation?: number): string;
142
- generateClient(): string;
143
199
  /**
144
200
  * Find route for a given URL, method and optionally domain
145
201
  */
@@ -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;
@@ -3,14 +3,14 @@
3
3
  */
4
4
  import { type Prettify } from '@poppinss/utils/types';
5
5
  /**
6
- * Options accepted by "url" and "route" helper methods
6
+ * Options accepted by "urlFor" helper
7
7
  */
8
8
  export type URLOptions = {
9
9
  qs?: Record<string, any>;
10
10
  prefixUrl?: string;
11
11
  };
12
12
  /**
13
- * Options accepted by "signedUrl" and "signedRoute" helper methods
13
+ * Options accepted by "signedUrlFor" helper
14
14
  */
15
15
  export type SignedURLOptions = URLOptions & {
16
16
  expiresIn?: string | number;
@@ -28,53 +28,6 @@ export type RouteBuilderArguments<Routes, Method extends keyof Routes, Identifie
28
28
  params: Routes[Method][Identifier]['params'] | Routes[Method][Identifier]['paramsTuple'],
29
29
  options?: Options
30
30
  ]> : never;
31
- /**
32
- * Shape of a route param matcher
33
- */
34
- export type RouteMatcher = {
35
- match?: RegExp;
36
- cast?: (value: string) => any;
37
- };
38
- /**
39
- * Route token stored by matchit library
40
- */
41
- export type MatchItRouteToken = RouteMatcher & {
42
- old: string;
43
- type: 0 | 1 | 2 | 3;
44
- val: string;
45
- end: string;
46
- };
47
- /**
48
- * Representation of route shared with the client
49
- */
50
- export type ClientRouteJSON = {
51
- /**
52
- * A unique name for the route
53
- */
54
- name?: string;
55
- /**
56
- * Route URI pattern
57
- */
58
- pattern: string;
59
- /**
60
- * HTTP methods, the route responds to.
61
- */
62
- methods: string[];
63
- /**
64
- * Route domain
65
- */
66
- domain: string;
67
- /**
68
- * Reference to the route handler
69
- */
70
- handler: {
71
- reference?: any;
72
- } | Function;
73
- /**
74
- * Tokens to be used to construct the route URL
75
- */
76
- tokens: MatchItRouteToken[];
77
- };
78
31
  /**
79
32
  * LookupList type is used by the URLBuilder to provide
80
33
  * type-safety when creating URLs.
@@ -179,3 +132,16 @@ export type UrlFor<Routes extends LookupList, Options extends any = URLOptions>
179
132
  url: string;
180
133
  };
181
134
  };
135
+ /**
136
+ * To be generated by the router and used by the URL builder
137
+ * and the LookupStore
138
+ */
139
+ export interface RoutesList {
140
+ }
141
+ /**
142
+ * Helper to get routes for a given method from the RoutesList. The
143
+ * RoutesList is extended in the userland code.
144
+ */
145
+ export type GetRoutesForMethod<Method> = {
146
+ [K in keyof RoutesList]: Method extends K ? RoutesList[Method] : never;
147
+ };
@@ -1,8 +1,8 @@
1
- import { type Route } from './router/route.js';
2
- import { RouteGroup } from './router/group.js';
3
- import { BriskRoute } from './router/brisk.js';
4
- import type { RouteJSON } from './types/route.js';
5
- import { RouteResource } from './router/resource.js';
1
+ import { type Route } from './router/route.ts';
2
+ import { RouteGroup } from './router/group.ts';
3
+ import { BriskRoute } from './router/brisk.ts';
4
+ import type { RouteJSON } from './types/route.ts';
5
+ import { RouteResource } from './router/resource.ts';
6
6
  /**
7
7
  * Makes input string consistent by having only the starting
8
8
  * slash