@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.
- package/build/{chunk-VYBTM3NC.js → chunk-Z5EN426L.js} +141 -192
- package/build/factories/http_context.d.ts +3 -3
- package/build/factories/main.d.ts +6 -6
- package/build/factories/main.js +1 -1
- package/build/factories/qs_parser_factory.d.ts +2 -2
- package/build/factories/request.d.ts +2 -2
- package/build/factories/response.d.ts +3 -3
- package/build/factories/router.d.ts +1 -1
- package/build/factories/server_factory.d.ts +2 -2
- package/build/factories/url_builder_factory.d.ts +3 -3
- package/build/index.d.ts +16 -16
- package/build/index.js +1 -1
- package/build/src/cookies/serializer.d.ts +1 -1
- package/build/src/define_config.d.ts +1 -1
- package/build/src/define_middleware.d.ts +1 -1
- package/build/src/errors.d.ts +7 -5
- package/build/src/exception_handler.d.ts +2 -2
- package/build/src/helpers.d.ts +3 -4
- package/build/src/http_context/local_storage.d.ts +1 -1
- package/build/src/http_context/main.d.ts +3 -3
- package/build/src/qs.d.ts +1 -1
- package/build/src/redirect.d.ts +4 -5
- package/build/src/request.d.ts +3 -3
- package/build/src/response.d.ts +5 -5
- package/build/src/router/brisk.d.ts +4 -4
- package/build/src/router/executor.d.ts +3 -3
- package/build/src/router/factories/use_return_value.d.ts +1 -1
- package/build/src/router/group.d.ts +5 -5
- package/build/src/router/legacy/url_builder.d.ts +1 -1
- package/build/src/router/main.d.ts +61 -17
- package/build/src/router/resource.d.ts +3 -4
- package/build/src/router/route.d.ts +2 -3
- package/build/src/router/signed_url_builder.d.ts +4 -3
- package/build/src/router/store.d.ts +1 -2
- package/build/src/{client → router}/url_builder.d.ts +4 -3
- package/build/src/server/factories/middleware_handler.d.ts +2 -2
- package/build/src/server/factories/route_finder.d.ts +3 -3
- package/build/src/server/factories/write_response.d.ts +1 -1
- package/build/src/server/main.d.ts +6 -6
- package/build/src/tracing_channels.d.ts +1 -1
- package/build/src/types/main.d.ts +1 -1
- package/build/src/types/middleware.d.ts +1 -1
- package/build/src/types/route.d.ts +19 -17
- package/build/src/types/server.d.ts +4 -4
- package/build/src/types/tracing_channels.d.ts +3 -3
- package/build/src/{client/types.d.ts → types/url_builder.d.ts} +16 -50
- package/build/src/utils.d.ts +5 -5
- package/package.json +9 -14
- package/build/client.cjs +0 -232
- package/build/client.d.cts +0 -258
- package/build/client.d.ts +0 -258
- package/build/client.js +0 -229
- package/build/src/client/main.d.ts +0 -3
- package/build/src/client/router.d.ts +0 -68
package/build/src/errors.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Exception } from '@poppinss/utils/exception';
|
|
2
|
-
import type { HttpContext } from './http_context/main.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
4
|
-
import type { HttpError, StatusPageRange, StatusPageRenderer } from './types/server.
|
|
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.
|
package/build/src/helpers.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { type CookieOptions } from './types/response.
|
|
2
|
-
import type { RouteMatchers, RouteJSON } from './types/route.
|
|
3
|
-
import { type
|
|
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,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.
|
|
5
|
-
import type { Response } from '../response.
|
|
6
|
-
import type { RouteJSON } from '../types/route.
|
|
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
package/build/src/redirect.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { IncomingMessage } from 'node:http';
|
|
2
|
-
import type { Qs } from './qs.
|
|
3
|
-
import type { Response } from './response.
|
|
4
|
-
import type { Router } from './router/main.
|
|
5
|
-
import type { GetRoutesForMethod,
|
|
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
|
*/
|
package/build/src/request.d.ts
CHANGED
|
@@ -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.
|
|
5
|
-
import { type RequestConfig } from './types/request.
|
|
6
|
-
import type { HttpContext } from './http_context/main.
|
|
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
|
package/build/src/response.d.ts
CHANGED
|
@@ -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.
|
|
5
|
-
import { Redirect } from './redirect.
|
|
6
|
-
import type { Router } from './router/main.
|
|
7
|
-
import type { HttpContext } from './http_context/main.
|
|
8
|
-
import type { CastableHeader, CookieOptions, ResponseConfig, ResponseStream } from './types/response.
|
|
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.
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
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.
|
|
3
|
-
import type { HttpContext } from '../http_context/main.
|
|
4
|
-
import type { ServerErrorHandler } from '../types/server.
|
|
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,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.
|
|
4
|
-
import { BriskRoute } from './brisk.
|
|
5
|
-
import { RouteResource } from './resource.
|
|
6
|
-
import type
|
|
7
|
-
import type { MiddlewareFn, ParsedNamedMiddleware } from '../types/middleware.
|
|
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,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.
|
|
5
|
-
import { Route } from './route.
|
|
6
|
-
import { RouteGroup } from './group.
|
|
7
|
-
import { BriskRoute } from './brisk.
|
|
8
|
-
import { RouteResource } from './resource.
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import type {
|
|
13
|
-
import
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
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 {
|
|
5
|
-
import type {
|
|
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
|
|
3
|
-
import { type
|
|
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:
|
|
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.
|
|
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
|
|
2
|
-
import { type
|
|
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:
|
|
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.
|
|
4
|
-
import { type ParsedGlobalMiddleware } from '../../types/middleware.
|
|
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.
|
|
3
|
-
import type { HttpContext } from '../../http_context/main.
|
|
4
|
-
import type { ServerErrorHandler } from '../../types/server.
|
|
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
|
|
@@ -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.
|
|
10
|
-
import type { ServerConfig, HttpServerEvents, ErrorHandlerAsAClass, TestingMiddlewarePipeline } from '../types/server.
|
|
11
|
-
import { Request } from '../request.
|
|
12
|
-
import { Response } from '../response.
|
|
13
|
-
import { Router } from '../router/main.
|
|
14
|
-
import { HttpContext } from '../http_context/main.
|
|
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.
|
|
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
|
*/
|
|
@@ -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.
|
|
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.
|
|
5
|
-
import type { HttpContext } from '../http_context/main.
|
|
6
|
-
import {
|
|
7
|
-
|
|
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.
|
|
4
|
-
import type { RequestConfig } from './request.
|
|
5
|
-
import type { ResponseConfig } from './response.
|
|
6
|
-
import type { HttpContext } from '../http_context/main.
|
|
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.
|
|
2
|
-
import type { HttpContext } from '../http_context/main.
|
|
3
|
-
import type { MiddlewareFn, ParsedGlobalMiddleware, ParsedNamedMiddleware } from './middleware.
|
|
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;
|