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

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 (74) hide show
  1. package/build/chunk-2QM3D5BN.js +87 -0
  2. package/build/chunk-5PWHBE2E.js +128 -0
  3. package/build/chunk-QDK57QGB.js +1176 -0
  4. package/build/{chunk-VYBTM3NC.js → chunk-YBLFT4O6.js} +1161 -1719
  5. package/build/factories/http_context.d.ts +5 -4
  6. package/build/factories/http_server.d.ts +7 -0
  7. package/build/factories/main.d.ts +6 -6
  8. package/build/factories/main.js +33 -5
  9. package/build/factories/qs_parser_factory.d.ts +5 -4
  10. package/build/factories/request.d.ts +3 -2
  11. package/build/factories/response.d.ts +4 -3
  12. package/build/factories/router.d.ts +2 -1
  13. package/build/factories/server_factory.d.ts +3 -2
  14. package/build/factories/url_builder_factory.d.ts +3 -2
  15. package/build/index.d.ts +19 -16
  16. package/build/index.js +97 -42
  17. package/build/src/client/helpers.d.ts +37 -0
  18. package/build/src/client/types.d.ts +88 -66
  19. package/build/src/client/url_builder.d.ts +12 -10
  20. package/build/src/client/url_builder.js +12 -0
  21. package/build/src/cookies/client.d.ts +61 -3
  22. package/build/src/cookies/drivers/encrypted.d.ts +13 -0
  23. package/build/src/cookies/drivers/plain.d.ts +9 -0
  24. package/build/src/cookies/drivers/signed.d.ts +13 -0
  25. package/build/src/cookies/parser.d.ts +18 -0
  26. package/build/src/cookies/serializer.d.ts +22 -3
  27. package/build/src/debug.d.ts +13 -0
  28. package/build/src/define_config.d.ts +21 -5
  29. package/build/src/define_middleware.d.ts +20 -4
  30. package/build/src/errors.d.ts +67 -10
  31. package/build/src/exception_handler.d.ts +95 -41
  32. package/build/src/helpers.d.ts +60 -4
  33. package/build/src/helpers.js +9 -1
  34. package/build/src/http_context/local_storage.d.ts +18 -1
  35. package/build/src/http_context/main.d.ts +71 -13
  36. package/build/src/qs.d.ts +31 -3
  37. package/build/src/redirect.d.ts +87 -16
  38. package/build/src/request.d.ts +121 -15
  39. package/build/src/response.d.ts +421 -208
  40. package/build/src/response_status.d.ts +14 -0
  41. package/build/src/router/brisk.d.ts +18 -7
  42. package/build/src/router/executor.d.ts +7 -3
  43. package/build/src/router/factories/use_return_value.d.ts +6 -1
  44. package/build/src/router/group.d.ts +23 -6
  45. package/build/src/router/legacy/url_builder.d.ts +15 -15
  46. package/build/src/router/main.d.ts +133 -20
  47. package/build/src/router/matchers.d.ts +3 -0
  48. package/build/src/router/resource.d.ts +37 -5
  49. package/build/src/router/route.d.ts +30 -6
  50. package/build/src/router/signed_url_builder.d.ts +7 -10
  51. package/build/src/router/store.d.ts +10 -2
  52. package/build/src/server/factories/middleware_handler.d.ts +12 -3
  53. package/build/src/server/factories/route_finder.d.ts +16 -6
  54. package/build/src/server/factories/write_response.d.ts +10 -3
  55. package/build/src/server/main.d.ts +83 -29
  56. package/build/src/tracing_channels.d.ts +4 -4
  57. package/build/src/types/main.d.ts +1 -1
  58. package/build/src/types/middleware.d.ts +35 -10
  59. package/build/src/types/qs.d.ts +5 -0
  60. package/build/src/types/request.d.ts +1 -1
  61. package/build/src/types/response.d.ts +14 -6
  62. package/build/src/types/route.d.ts +53 -51
  63. package/build/src/types/server.d.ts +30 -15
  64. package/build/src/types/tracing_channels.d.ts +24 -6
  65. package/build/src/types/url_builder.d.ts +22 -0
  66. package/build/src/utils.d.ts +76 -11
  67. package/package.json +29 -30
  68. package/build/chunk-ASX56VAK.js +0 -76
  69. package/build/client.cjs +0 -232
  70. package/build/client.d.cts +0 -258
  71. package/build/client.d.ts +0 -258
  72. package/build/client.js +0 -229
  73. package/build/src/client/main.d.ts +0 -3
  74. package/build/src/client/router.d.ts +0 -68
@@ -1,67 +1,93 @@
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
+ import { type ClientRouteJSON, type ClientRouteMatchItTokens } from '../client/types.ts';
8
8
  /**
9
- * Returns a union of methods from a controller that accepts
10
- * the context as the first argument.
9
+ * Configuration for matching and casting route parameters
10
+ */
11
+ export type RouteMatcher = {
12
+ /** Regular expression to match parameter values */
13
+ match?: RegExp;
14
+ /** Function to cast string parameter values to specific types */
15
+ cast?: (value: string) => any;
16
+ };
17
+ /**
18
+ * Route token structure used internally by the matchit routing library
19
+ */
20
+ export type MatchItRouteToken = RouteMatcher & ClientRouteMatchItTokens;
21
+ /**
22
+ * Extracts method names from a controller class that accept HttpContext as first parameter
11
23
  */
12
24
  export type GetControllerHandlers<Controller extends Constructor<any>> = {
13
25
  [K in keyof InstanceType<Controller>]: InstanceType<Controller>[K] extends (ctx: HttpContext, ...args: any[]) => any ? K : never;
14
26
  }[keyof InstanceType<Controller>];
15
27
  /**
16
- * Route handler defined as a function
28
+ * Route handler implemented as a function that accepts HTTP context
17
29
  */
18
30
  export type RouteFn = (ctx: HttpContext) => any;
19
31
  /**
20
- * Route handler persisted with the route store
32
+ * Route handler representation stored in the route registry
21
33
  */
22
34
  export type StoreRouteHandler = RouteFn | {
35
+ /** Optional name for the handler */
36
+ name?: string;
37
+ /** Method name on the controller */
38
+ method: string;
39
+ /** Dynamic import expression for lazy loading */
40
+ importExpression: string | null;
41
+ /** Reference to controller class or method */
23
42
  reference: string | [LazyImport<Constructor<any>> | Constructor<any>, any?];
43
+ /** Handler execution function */
24
44
  handle: (resolver: ContainerResolver<any>, ...args: [ctx: HttpContext, ...injections: any[]]) => any;
25
45
  };
26
46
  /**
27
- * The middleware persisted with the route store
47
+ * Middleware representation stored with route information
28
48
  */
29
49
  export type StoreRouteMiddleware = MiddlewareFn | ({
30
50
  name?: string;
31
51
  args?: any[];
32
52
  } & ParsedGlobalMiddleware);
33
53
  /**
34
- * An object of routes for a given HTTP method
54
+ * Route storage structure for a specific HTTP method containing tokens and route mappings
35
55
  */
36
56
  export type StoreMethodNode = {
57
+ /** Array of route tokens for pattern matching */
37
58
  tokens: MatchItRouteToken[][];
59
+ /** Mapping from route patterns to unique route keys */
38
60
  routeKeys: {
39
61
  [pattern: string]: string;
40
62
  };
63
+ /** Mapping from route patterns to route definitions */
41
64
  routes: {
42
65
  [pattern: string]: RouteJSON;
43
66
  };
44
67
  };
45
68
  /**
46
- * Each domain node container an object of methods. Each method
47
- * object has nested routes.
69
+ * Domain-specific route storage containing method-based route organization
48
70
  */
49
71
  export type StoreDomainNode = {
72
+ /** HTTP method to method node mapping */
50
73
  [method: string]: StoreMethodNode;
51
74
  };
52
75
  /**
53
- * Routes tree stored within the routes store
76
+ * Complete route tree structure organizing routes by domains and methods
54
77
  */
55
78
  export type StoreRoutesTree = {
79
+ /** Global route tokens for pattern matching */
56
80
  tokens: MatchItRouteToken[][];
81
+ /** Domain-based route organization */
57
82
  domains: {
58
83
  [domain: string]: StoreDomainNode;
59
84
  };
60
85
  };
61
86
  /**
62
- * Shape of the matched route for a pattern, method and domain.
87
+ * Result of successful route matching containing route details and extracted parameters
63
88
  */
64
89
  export type MatchedRoute = {
90
+ /** The matched route definition */
65
91
  route: RouteJSON;
66
92
  /**
67
93
  * A unique key for the looked up route
@@ -77,28 +103,21 @@ export type MatchedRoute = {
77
103
  subdomains: Record<string, any>;
78
104
  };
79
105
  /**
80
- * A collection of route matchers
106
+ * Collection of parameter matchers indexed by parameter name
81
107
  */
82
108
  export type RouteMatchers = {
109
+ /** Parameter name to matcher mapping */
83
110
  [param: string]: RouteMatcher;
84
111
  };
85
112
  /**
86
- * Representation of a route as JSON
113
+ * Complete route definition with all metadata, handlers, and execution context
87
114
  */
88
- export type RouteJSON = {
115
+ export type RouteJSON = Pick<ClientRouteJSON, 'name' | 'methods' | 'domain' | 'pattern'> & {
89
116
  /**
90
117
  * The execute function to execute the route middleware
91
118
  * and the handler
92
119
  */
93
120
  execute: (route: RouteJSON, resolver: ContainerResolver<any>, ctx: HttpContext, errorResponder: ServerErrorHandler['handle']) => any;
94
- /**
95
- * A unique name for the route
96
- */
97
- name?: string;
98
- /**
99
- * Route URI pattern
100
- */
101
- pattern: string;
102
121
  /**
103
122
  * Route handler
104
123
  */
@@ -115,51 +134,34 @@ export type RouteJSON = {
115
134
  * Tokens to be used to construct the route URL
116
135
  */
117
136
  tokens: MatchItRouteToken[];
118
- /**
119
- * HTTP methods, the route responds to.
120
- */
121
- methods: string[];
122
- /**
123
- * The domain for which the route is registered.
124
- */
125
- domain: string;
126
137
  /**
127
138
  * Matchers for route params.
128
139
  */
129
140
  matchers: RouteMatchers;
130
141
  };
131
142
  /**
132
- * Resource action names
143
+ * Standard RESTful resource action names for CRUD operations
133
144
  */
134
145
  export type ResourceActionNames = 'create' | 'index' | 'store' | 'show' | 'edit' | 'update' | 'destroy';
135
146
  /**
136
- * Options accepted by makeUrl method
137
- * @deprecated
147
+ * @deprecated Options for URL generation (use URLBuilder instead)
138
148
  */
139
149
  export type MakeUrlOptions = {
150
+ /** Query string parameters to append */
140
151
  qs?: Record<string, any>;
152
+ /** Domain name to use for the URL */
141
153
  domain?: string;
154
+ /** Prefix to prepend to the generated URL */
142
155
  prefixUrl?: string;
156
+ /** Whether to disable route lookup optimization */
143
157
  disableRouteLookup?: boolean;
144
158
  };
145
159
  /**
146
- * Options accepted by makeSignedUrl method
147
- * @deprecated
160
+ * @deprecated Options for signed URL generation (use URLBuilder instead)
148
161
  */
149
162
  export type MakeSignedUrlOptions = MakeUrlOptions & {
163
+ /** Expiration time for the signed URL */
150
164
  expiresIn?: string | number;
165
+ /** Purpose identifier for the signed URL */
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,67 +1,82 @@
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
- * Normalized HTTP error used by the exception
9
- * handler.
8
+ * Normalized HTTP error structure used by exception handlers
10
9
  */
11
10
  export type HttpError = {
11
+ /** Error message describing the issue */
12
12
  message: string;
13
+ /** HTTP status code */
13
14
  status: number;
15
+ /** Optional error code identifier */
14
16
  code?: string;
17
+ /** Optional stack trace */
15
18
  stack?: string;
19
+ /** Optional underlying cause of the error */
16
20
  cause?: any;
21
+ /** Optional additional error messages */
17
22
  messages?: any;
23
+ /** Optional validation or field errors */
18
24
  errors?: any;
25
+ /** Optional custom error handler method */
19
26
  handle?: (...args: any[]) => any;
27
+ /** Optional error reporting method */
20
28
  report?: (...args: any[]) => any;
21
29
  };
22
30
  /**
23
- * The pipeline for executing middleware during tests
31
+ * Pipeline interface for executing middleware chains during testing
24
32
  */
25
33
  export interface TestingMiddlewarePipeline {
34
+ /** Set the final handler for the pipeline */
26
35
  finalHandler(handler: FinalHandler): this;
36
+ /** Set the error handler for the pipeline */
27
37
  errorHandler(handler: ErrorHandler): this;
38
+ /** Execute the middleware pipeline with the given context */
28
39
  run(ctx: HttpContext): Promise<any>;
29
40
  }
30
41
  /**
31
- * The expression to define a status page range
42
+ * Expression format for defining HTTP status code ranges for error pages
32
43
  */
33
44
  export type StatusPageRange = `${number}..${number}` | `${number}` | number;
34
45
  /**
35
- * The callback function to render status page for a given
36
- * error.
46
+ * Callback function to render custom status pages for HTTP errors
37
47
  */
38
48
  export type StatusPageRenderer = (error: HttpError, ctx: HttpContext) => any | Promise<any>;
39
49
  /**
40
- * Data type for the "http:request_completed" event
50
+ * Payload structure for the http:request_completed event
41
51
  */
42
52
  export type HttpRequestFinishedPayload = {
53
+ /** HTTP context for the completed request */
43
54
  ctx: HttpContext;
55
+ /** Request duration as a high-resolution time tuple */
44
56
  duration: [number, number];
45
57
  };
46
58
  /**
47
- * Events emitted by the HttpServer
59
+ * Event types and payloads emitted by the HTTP server
48
60
  */
49
61
  export type HttpServerEvents = {
62
+ /** Event fired when an HTTP request is completed */
50
63
  'http:request_completed': HttpRequestFinishedPayload;
51
64
  };
52
65
  /**
53
- * Error handler to handle HTTP errors
66
+ * Interface for handling and reporting HTTP errors in the server
54
67
  */
55
68
  export type ServerErrorHandler = {
69
+ /** Method to report errors for logging or monitoring */
56
70
  report: (error: any, ctx: HttpContext) => any;
71
+ /** Method to handle errors and send appropriate responses */
57
72
  handle: (error: any, ctx: HttpContext) => any;
58
73
  };
59
74
  /**
60
- * Error handler represented as a class
75
+ * Constructor type for error handler classes that implement ServerErrorHandler
61
76
  */
62
77
  export type ErrorHandlerAsAClass = Constructor<ServerErrorHandler>;
63
78
  /**
64
- * Config accepted by the HTTP server
79
+ * Complete configuration options for the HTTP server extending request and response configs
65
80
  */
66
81
  export type ServerConfig = RequestConfig & ResponseConfig & {
67
82
  /**
@@ -1,6 +1,24 @@
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';
4
- export type HTTPRequestTracingData = HttpContext;
5
- export type MiddlewareTracingData = ParsedGlobalMiddleware | ParsedNamedMiddleware | MiddlewareFn;
6
- export type RouteHandlerTracingData = RouteJSON;
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
+ /**
5
+ * Tracing data structure for HTTP request events
6
+ */
7
+ export type HTTPRequestTracingData = {
8
+ /** HTTP context for the traced request */
9
+ ctx: HttpContext;
10
+ };
11
+ /**
12
+ * Tracing data structure for middleware execution events
13
+ */
14
+ export type MiddlewareTracingData = {
15
+ /** The middleware being traced */
16
+ middleware: ParsedGlobalMiddleware | ParsedNamedMiddleware | MiddlewareFn;
17
+ };
18
+ /**
19
+ * Tracing data structure for route handler execution events
20
+ */
21
+ export type RouteHandlerTracingData = {
22
+ /** The route being traced */
23
+ route: RouteJSON;
24
+ };
@@ -0,0 +1,22 @@
1
+ import { type UrlFor, type LookupList, type URLOptions, type LookupListRoute, type RouteBuilderArguments } from '../client/types.ts';
2
+ export { URLOptions, LookupListRoute, RouteBuilderArguments, LookupList, UrlFor };
3
+ /**
4
+ * Configuration options for signed URL generation helpers
5
+ */
6
+ export type SignedURLOptions = URLOptions & {
7
+ /** Expiration time for the signed URL */
8
+ expiresIn?: string | number;
9
+ /** Purpose identifier for the signed URL */
10
+ purpose?: string;
11
+ };
12
+ /**
13
+ * Utility type to extract routes for a specific HTTP method from the routes collection
14
+ */
15
+ export type GetRoutesForMethod<Routes, Method> = {
16
+ [K in keyof Routes]: Method extends K ? Routes[Method] : never;
17
+ }[keyof Routes];
18
+ /**
19
+ * Interface to be augmented by the router containing all registered routes for type-safe URL generation
20
+ */
21
+ export interface RoutesList {
22
+ }
@@ -1,26 +1,91 @@
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
- * Makes input string consistent by having only the starting
8
- * slash
7
+ * Makes input string consistent by having only the starting slash.
8
+ *
9
+ * Removes trailing slashes and ensures the path starts with a forward slash,
10
+ * except for the root path '/' which remains unchanged.
11
+ *
12
+ * @param input - The input path string to normalize
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * dropSlash('/users/') // '/users'
17
+ * dropSlash('users') // '/users'
18
+ * dropSlash('/') // '/'
19
+ * ```
9
20
  */
10
21
  export declare function dropSlash(input: string): string;
11
22
  /**
12
- * Returns a flat list of routes from the route groups and resources
23
+ * Returns a flat list of routes from route groups, resources, and brisk routes.
24
+ *
25
+ * This function recursively processes route collections, extracting individual routes
26
+ * from groups and resources while filtering out any deleted routes.
27
+ *
28
+ * @param routes - Array containing route groups, individual routes, resources, and brisk routes
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const flatRoutes = toRoutesJSON([
33
+ * routeGroup,
34
+ * singleRoute,
35
+ * resourceRoutes
36
+ * ])
37
+ * ```
13
38
  */
14
39
  export declare function toRoutesJSON(routes: (RouteGroup | Route | RouteResource | BriskRoute)[]): RouteJSON[];
15
40
  /**
16
- * Helper to know if the remote address should
17
- * be trusted.
41
+ * Helper to determine if a remote address should be trusted.
42
+ *
43
+ * Uses caching to avoid repeated expensive proxy function calls for the same
44
+ * remote address. The cache improves performance when the same addresses are
45
+ * checked multiple times.
46
+ *
47
+ * @param remoteAddress - The remote IP address to check
48
+ * @param proxyFn - Function that determines if an address should be trusted
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * const isTrusted = trustProxy('192.168.1.1', proxyAddr.compile('loopback'))
53
+ * ```
18
54
  */
19
55
  export declare function trustProxy(remoteAddress: string, proxyFn: (addr: string, distance: number) => boolean): boolean;
20
56
  /**
21
- * Parses a range expression to an object filled with the range
57
+ * Parses a range expression (e.g., '200..299') into an object with numeric keys.
58
+ *
59
+ * Supports both single values and ranges. For ranges, all numbers between
60
+ * the start and end (inclusive) are mapped to the provided value.
61
+ *
62
+ * @param range - Range expression as a string (e.g., '200', '200..299')
63
+ * @param value - Value to assign to each number in the range
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * parseRange('200', 'success') // { 200: 'success' }
68
+ * parseRange('200..202', 'success') // { 200: 'success', 201: 'success', 202: 'success' }
69
+ * ```
22
70
  */
23
71
  export declare function parseRange<T>(range: string, value: T): Record<number, T>;
72
+ /**
73
+ * Safely decodes a URI path while handling special characters and query strings.
74
+ *
75
+ * This function carefully parses and decodes URI components, handling edge cases
76
+ * like double-encoded characters and non-standard query string delimiters.
77
+ * It separates the pathname from query parameters and determines whether
78
+ * route parameters should be decoded.
79
+ *
80
+ * @param path - The URI path to decode
81
+ * @param useSemicolonDelimiter - Whether to treat semicolons as query string delimiters
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const result = safeDecodeURI('/users/123?name=john', false)
86
+ * // Returns: { pathname: '/users/123', query: 'name=john', shouldDecodeParam: false }
87
+ * ```
88
+ */
24
89
  export declare function safeDecodeURI(path: string, useSemicolonDelimiter: boolean): {
25
90
  pathname: string;
26
91
  query: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonisjs/http-server",
3
- "version": "8.0.0-next.0",
3
+ "version": "8.0.0-next.10",
4
4
  "description": "AdonisJS HTTP server with support packed with Routing and Cookies",
5
5
  "main": "build/index.js",
6
6
  "type": "module",
@@ -13,10 +13,7 @@
13
13
  ".": "./build/index.js",
14
14
  "./helpers": "./build/src/helpers.js",
15
15
  "./types": "./build/src/types/main.js",
16
- "./client": {
17
- "import": "./build/client.js",
18
- "require": "./build/client.cjs"
19
- },
16
+ "./client/url_builder": "./build/src/client/url_builder.js",
20
17
  "./factories": "./build/factories/main.js"
21
18
  },
22
19
  "engines": {
@@ -28,8 +25,7 @@
28
25
  "typecheck": "tsc --noEmit",
29
26
  "precompile": "npm run lint",
30
27
  "compile": "tsup-node && tsc --emitDeclarationOnly --declaration",
31
- "compile:client": "tsup-node --config=bin/build_client.ts",
32
- "build": "npm run compile && npm run compile:client",
28
+ "build": "npm run compile",
33
29
  "prebenchmark": "npm run build",
34
30
  "benchmark": "node benchmarks/index.js",
35
31
  "release": "release-it",
@@ -37,7 +33,8 @@
37
33
  "format": "prettier --write .",
38
34
  "prepublishOnly": "npm run build",
39
35
  "lint": "eslint",
40
- "quick:test": "node --import=@poppinss/ts-exec --enable-source-maps bin/test.ts"
36
+ "quick:test": "node --import=@poppinss/ts-exec --enable-source-maps bin/test.ts",
37
+ "docs": "typedoc"
41
38
  },
42
39
  "keywords": [
43
40
  "http",
@@ -46,21 +43,21 @@
46
43
  "author": "virk,adonisjs",
47
44
  "license": "MIT",
48
45
  "devDependencies": {
49
- "@adonisjs/application": "^9.0.0-next.2",
50
- "@adonisjs/encryption": "^7.0.0-next.0",
51
- "@adonisjs/eslint-config": "^3.0.0-next.0",
52
- "@adonisjs/events": "^10.1.0-next.1",
53
- "@adonisjs/fold": "^11.0.0-next.0",
54
- "@adonisjs/logger": "^7.0.0-next.1",
46
+ "@adonisjs/application": "^9.0.0-next.4",
47
+ "@adonisjs/encryption": "^7.0.0-next.1",
48
+ "@adonisjs/eslint-config": "^3.0.0-next.1",
49
+ "@adonisjs/events": "^10.1.0-next.2",
50
+ "@adonisjs/fold": "^11.0.0-next.2",
51
+ "@adonisjs/logger": "^7.1.0-next.0",
55
52
  "@adonisjs/prettier-config": "^1.4.5",
56
53
  "@adonisjs/tsconfig": "^2.0.0-next.0",
57
54
  "@fastify/middie": "^9.0.3",
58
55
  "@japa/assert": "^4.1.1",
59
56
  "@japa/expect-type": "^2.0.3",
60
57
  "@japa/file-system": "^2.3.2",
61
- "@japa/runner": "^4.3.0",
58
+ "@japa/runner": "^4.4.0",
62
59
  "@japa/snapshot": "^2.0.9",
63
- "@poppinss/ts-exec": "^1.4.0",
60
+ "@poppinss/ts-exec": "^1.4.1",
64
61
  "@release-it/conventional-changelog": "^10.0.1",
65
62
  "@types/accepts": "^1.3.7",
66
63
  "@types/content-disposition": "^0.5.9",
@@ -70,7 +67,7 @@
70
67
  "@types/fresh": "^0.5.3",
71
68
  "@types/fs-extra": "^11.0.4",
72
69
  "@types/mime-types": "^3.0.1",
73
- "@types/node": "^24.1.0",
70
+ "@types/node": "^24.7.0",
74
71
  "@types/on-finished": "^2.3.5",
75
72
  "@types/pem": "^1.14.4",
76
73
  "@types/proxy-addr": "^2.0.3",
@@ -81,27 +78,28 @@
81
78
  "@vinejs/vine": "^3.0.1",
82
79
  "autocannon": "^8.0.0",
83
80
  "c8": "^10.1.3",
84
- "cross-env": "^10.0.0",
85
- "eslint": "^9.32.0",
86
- "fastify": "^5.4.0",
87
- "fs-extra": "^11.3.0",
81
+ "cross-env": "^10.1.0",
82
+ "eslint": "^9.37.0",
83
+ "fastify": "^5.6.1",
84
+ "fs-extra": "^11.3.2",
88
85
  "get-port": "^7.1.0",
89
86
  "http-status-codes": "^2.3.0",
90
87
  "pem": "^1.14.8",
91
88
  "prettier": "^3.6.2",
92
89
  "reflect-metadata": "^0.2.2",
93
- "release-it": "^19.0.4",
90
+ "release-it": "^19.0.5",
94
91
  "supertest": "^7.1.4",
95
92
  "tsup": "^8.5.0",
96
- "typescript": "^5.8.3",
93
+ "typedoc": "^0.28.13",
94
+ "typescript": "^5.9.3",
97
95
  "youch": "^4.1.0-beta.11"
98
96
  },
99
97
  "dependencies": {
100
- "@poppinss/macroable": "^1.0.5",
98
+ "@poppinss/macroable": "^1.1.0",
101
99
  "@poppinss/matchit": "^3.2.0",
102
100
  "@poppinss/middleware": "^3.2.6",
103
101
  "@poppinss/utils": "^7.0.0-next.3",
104
- "@sindresorhus/is": "^7.0.2",
102
+ "@sindresorhus/is": "^7.1.0",
105
103
  "accepts": "^1.3.8",
106
104
  "content-disposition": "^0.5.4",
107
105
  "cookie": "^1.0.2",
@@ -118,11 +116,11 @@
118
116
  "vary": "^1.1.2"
119
117
  },
120
118
  "peerDependencies": {
121
- "@adonisjs/application": "^9.0.0-next.2",
122
- "@adonisjs/encryption": "^7.0.0-next.0",
123
- "@adonisjs/events": "^10.1.0-next.1",
124
- "@adonisjs/fold": "^11.0.0-next.0",
125
- "@adonisjs/logger": "^7.0.0-next.1",
119
+ "@adonisjs/application": "^9.0.0-next.4",
120
+ "@adonisjs/encryption": "^7.0.0-next.1",
121
+ "@adonisjs/events": "^10.1.0-next.2",
122
+ "@adonisjs/fold": "^11.0.0-next.2",
123
+ "@adonisjs/logger": "^7.1.0-next.0",
126
124
  "youch": "^4.1.0-beta.11"
127
125
  },
128
126
  "peerDependenciesMeta": {
@@ -184,6 +182,7 @@
184
182
  "./index.ts",
185
183
  "./src/helpers.ts",
186
184
  "./src/types/main.ts",
185
+ "./src/client/url_builder.ts",
187
186
  "./factories/main.ts"
188
187
  ],
189
188
  "outDir": "./build",
@@ -1,76 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- // src/helpers.ts
8
- import cookie from "cookie";
9
- import matchit from "@poppinss/matchit";
10
- import string from "@poppinss/utils/string";
11
- import { parseBindingReference } from "@adonisjs/fold";
12
- import { default as default2 } from "encodeurl";
13
- import { default as default3 } from "mime-types";
14
- function parseRoute(pattern, matchers) {
15
- const tokens = matchit.parse(pattern, matchers);
16
- return tokens;
17
- }
18
- function matchRoute(url, patterns) {
19
- const tokensBucket = patterns.map((pattern) => parseRoute(pattern));
20
- const match = matchit.match(url, tokensBucket);
21
- if (!match.length) {
22
- return null;
23
- }
24
- return matchit.exec(url, match);
25
- }
26
- function serializeCookie(key, value, options) {
27
- let expires;
28
- let maxAge;
29
- if (options) {
30
- expires = typeof options.expires === "function" ? options.expires() : options.expires;
31
- maxAge = options.maxAge ? string.seconds.parse(options.maxAge) : void 0;
32
- }
33
- return cookie.serialize(key, value, { ...options, maxAge, expires });
34
- }
35
- async function middlewareInfo(middleware) {
36
- if (typeof middleware === "function") {
37
- return {
38
- type: "closure",
39
- name: middleware.name || "closure"
40
- };
41
- }
42
- if ("args" in middleware) {
43
- return {
44
- type: "named",
45
- name: middleware.name,
46
- args: middleware.args,
47
- ...await parseBindingReference([middleware.reference])
48
- };
49
- }
50
- return {
51
- type: "global",
52
- name: middleware.name,
53
- ...await parseBindingReference([middleware.reference])
54
- };
55
- }
56
- async function routeInfo(route) {
57
- return "reference" in route.handler ? {
58
- type: "controller",
59
- ...await parseBindingReference(route.handler.reference)
60
- } : {
61
- type: "closure",
62
- name: route.handler.name || "closure",
63
- args: "listArgs" in route.handler ? String(route.handler.listArgs) : void 0
64
- };
65
- }
66
-
67
- export {
68
- __export,
69
- parseRoute,
70
- matchRoute,
71
- serializeCookie,
72
- middlewareInfo,
73
- routeInfo,
74
- default2 as default,
75
- default3 as default2
76
- };