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

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.
@@ -18,6 +18,9 @@ function createUrlBuilder(routesLoader, searchParamsStringifier) {
18
18
  const routeIdentifier = domain ? identifier.replace(new RegExp(`^${domain}@`), "") : identifier;
19
19
  const route = findRoute(domainsRoutes, routeIdentifier, domain, method, true);
20
20
  if (!route) {
21
+ if (method) {
22
+ throw new Error(`Cannot lookup route "${routeIdentifier}" for method "${method}"`);
23
+ }
21
24
  throw new Error(`Cannot lookup route "${routeIdentifier}"`);
22
25
  }
23
26
  return createURL(
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-QDK57QGB.js";
20
20
  import {
21
21
  createUrlBuilder
22
- } from "./chunk-5PWHBE2E.js";
22
+ } from "./chunk-77CSRFCU.js";
23
23
  import {
24
24
  __export,
25
25
  createURL,
@@ -3638,6 +3638,9 @@ var Router = class {
3638
3638
  findOrFail(routeIdentifier, domain, method, disableLegacyLookup) {
3639
3639
  const route = this.find(routeIdentifier, domain, method, disableLegacyLookup);
3640
3640
  if (!route) {
3641
+ if (method) {
3642
+ throw new Error(`Cannot lookup route "${routeIdentifier}" for method "${method}"`);
3643
+ }
3641
3644
  throw new Error(`Cannot lookup route "${routeIdentifier}"`);
3642
3645
  }
3643
3646
  return route;
@@ -3682,15 +3685,15 @@ var Router = class {
3682
3685
  for (let token of route.tokens) {
3683
3686
  if (token.type === 1) {
3684
3687
  hasRequiredParams = true;
3685
- params.push(`'${token.val}': string`);
3686
- paramsTuple.push("string");
3688
+ params.push(`'${token.val}': ParamValue`);
3689
+ paramsTuple.push("ParamValue");
3687
3690
  } else if (token.type === 3) {
3688
- params.push(`'${token.val}'?: string`);
3689
- paramsTuple.push("string?");
3691
+ params.push(`'${token.val}'?: ParamValue`);
3692
+ paramsTuple.push("ParamValue?");
3690
3693
  } else if (token.type === 2) {
3691
3694
  hasRequiredParams = true;
3692
- params.push(`'*': string[]`);
3693
- paramsTuple.push("...string[]");
3695
+ params.push(`'*': ParamValue[]`);
3696
+ paramsTuple.push("...ParamValue[]");
3694
3697
  break;
3695
3698
  }
3696
3699
  }
@@ -3722,21 +3725,24 @@ var Router = class {
3722
3725
  domains.forEach(
3723
3726
  (domain) => this.routes[domain].forEach((route) => trackRoute.bind(this)(route, domain))
3724
3727
  );
3725
- return Object.keys(routesList).reduce((result, method) => {
3726
- result.push(`${" ".repeat(indentation)}${method}: {`);
3727
- Object.keys(routesList[method]).forEach((identifier) => {
3728
- const key = `'${identifier}'`;
3729
- const { paramsTuple, hasRequiredParams, params } = routesList[method][identifier];
3730
- const dictName = hasRequiredParams ? "params" : "params?";
3731
- const tupleName = hasRequiredParams ? "paramsTuple" : "paramsTuple?";
3732
- const dictValue = `{${params.join(",")}}`;
3733
- const tupleValue = `[${paramsTuple?.join(",")}]`;
3734
- const value = `{ ${tupleName}: ${tupleValue}; ${dictName}: ${dictValue} }`;
3735
- result.push(`${" ".repeat(indentation + 2)}${key}: ${value}`);
3736
- });
3737
- result.push(`${" ".repeat(indentation)}}`);
3738
- return result;
3739
- }, []).join("\n");
3728
+ return Object.keys(routesList).reduce(
3729
+ (result, method) => {
3730
+ result.push(`${" ".repeat(indentation)}${method}: {`);
3731
+ Object.keys(routesList[method]).forEach((identifier) => {
3732
+ const key = `'${identifier}'`;
3733
+ const { paramsTuple, hasRequiredParams, params } = routesList[method][identifier];
3734
+ const dictName = hasRequiredParams ? "params" : "params?";
3735
+ const tupleName = hasRequiredParams ? "paramsTuple" : "paramsTuple?";
3736
+ const dictValue = `{${params.join(",")}}`;
3737
+ const tupleValue = `[${paramsTuple?.join(",")}]`;
3738
+ const value = `{ ${tupleName}: ${tupleValue}; ${dictName}: ${dictValue} }`;
3739
+ result.push(`${" ".repeat(indentation + 2)}${key}: ${value}`);
3740
+ });
3741
+ result.push(`${" ".repeat(indentation)}}`);
3742
+ return result;
3743
+ },
3744
+ [`type ParamValue = string | number | bigint | boolean`, ""]
3745
+ ).join("\n");
3740
3746
  }
3741
3747
  /**
3742
3748
  * Find route for a given URL, method and optionally domain
@@ -6,9 +6,9 @@ import {
6
6
  Router,
7
7
  Server,
8
8
  defineConfig
9
- } from "../chunk-YBLFT4O6.js";
9
+ } from "../chunk-Q3DRGJUE.js";
10
10
  import "../chunk-QDK57QGB.js";
11
- import "../chunk-5PWHBE2E.js";
11
+ import "../chunk-77CSRFCU.js";
12
12
  import "../chunk-2QM3D5BN.js";
13
13
 
14
14
  // factories/router.ts
package/build/index.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  Server,
17
17
  defineConfig,
18
18
  errors_exports
19
- } from "./chunk-YBLFT4O6.js";
19
+ } from "./chunk-Q3DRGJUE.js";
20
20
  import {
21
21
  BriskRoute,
22
22
  Route,
@@ -26,7 +26,7 @@ import {
26
26
  parseRange,
27
27
  tracing_channels_exports
28
28
  } from "./chunk-QDK57QGB.js";
29
- import "./chunk-5PWHBE2E.js";
29
+ import "./chunk-77CSRFCU.js";
30
30
  import "./chunk-2QM3D5BN.js";
31
31
 
32
32
  // src/exception_handler.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createUrlBuilder
3
- } from "../../chunk-5PWHBE2E.js";
3
+ } from "../../chunk-77CSRFCU.js";
4
4
  import {
5
5
  createURL,
6
6
  findRoute
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonisjs/http-server",
3
- "version": "8.0.0-next.10",
3
+ "version": "8.0.0-next.11",
4
4
  "description": "AdonisJS HTTP server with support packed with Routing and Cookies",
5
5
  "main": "build/index.js",
6
6
  "type": "module",
@@ -67,7 +67,7 @@
67
67
  "@types/fresh": "^0.5.3",
68
68
  "@types/fs-extra": "^11.0.4",
69
69
  "@types/mime-types": "^3.0.1",
70
- "@types/node": "^24.7.0",
70
+ "@types/node": "^24.8.1",
71
71
  "@types/on-finished": "^2.3.5",
72
72
  "@types/pem": "^1.14.4",
73
73
  "@types/proxy-addr": "^2.0.3",
@@ -75,11 +75,11 @@
75
75
  "@types/supertest": "^6.0.3",
76
76
  "@types/type-is": "^1.6.7",
77
77
  "@types/vary": "^1.1.3",
78
- "@vinejs/vine": "^3.0.1",
78
+ "@vinejs/vine": "^4.0.0",
79
79
  "autocannon": "^8.0.0",
80
80
  "c8": "^10.1.3",
81
81
  "cross-env": "^10.1.0",
82
- "eslint": "^9.37.0",
82
+ "eslint": "^9.38.0",
83
83
  "fastify": "^5.6.1",
84
84
  "fs-extra": "^11.3.2",
85
85
  "get-port": "^7.1.0",
@@ -90,7 +90,7 @@
90
90
  "release-it": "^19.0.5",
91
91
  "supertest": "^7.1.4",
92
92
  "tsup": "^8.5.0",
93
- "typedoc": "^0.28.13",
93
+ "typedoc": "^0.28.14",
94
94
  "typescript": "^5.9.3",
95
95
  "youch": "^4.1.0-beta.11"
96
96
  },