@adonisjs/http-server 5.9.0 → 5.10.0

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.
@@ -7,6 +7,7 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  /// <reference types="node" />
10
+ /// <reference types="node" />
10
11
  declare module '@ioc:Adonis/Core/Server' {
11
12
  import { Server as HttpsServer } from 'https';
12
13
  import { RouterContract } from '@ioc:Adonis/Core/Route';
@@ -7,6 +7,7 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  /// <reference types="node" />
10
+ /// <reference types="node" />
10
11
  declare module '@ioc:Adonis/Core/Request' {
11
12
  import { UrlWithStringQuery } from 'url';
12
13
  import { MacroableConstructorContract } from 'macroable';
@@ -7,6 +7,8 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  /// <reference types="node" />
10
+ /// <reference types="node" />
11
+ /// <reference types="node" />
10
12
  declare module '@ioc:Adonis/Core/Response' {
11
13
  import { ServerResponse, IncomingMessage } from 'http';
12
14
  import { MacroableConstructorContract } from 'macroable';
@@ -89,7 +89,9 @@ declare module '@ioc:Adonis/Core/Route' {
89
89
  export type MethodNode = {
90
90
  tokens: any[];
91
91
  routes: {
92
- [pattern: string]: RouteNode;
92
+ [pattern: string]: RouteNode & {
93
+ params: string[];
94
+ };
93
95
  };
94
96
  };
95
97
  /**
@@ -127,7 +129,9 @@ declare module '@ioc:Adonis/Core/Route' {
127
129
  * them as spread options to the context.
128
130
  */
129
131
  export type MatchedRoute = {
130
- route: RouteNode;
132
+ route: RouteNode & {
133
+ params: string[];
134
+ };
131
135
  /**
132
136
  * A unique key for the looked up route
133
137
  */
@@ -8,6 +8,7 @@
8
8
  */
9
9
  /// <reference path="../../adonis-typings/index.d.ts" />
10
10
  /// <reference types="node" />
11
+ /// <reference types="node" />
11
12
  import { Macroable } from 'macroable';
12
13
  import { UrlWithStringQuery } from 'url';
13
14
  import { ServerResponse, IncomingMessage, IncomingHttpHeaders } from 'http';
@@ -8,6 +8,7 @@
8
8
  */
9
9
  /// <reference path="../../adonis-typings/index.d.ts" />
10
10
  /// <reference types="node" />
11
+ /// <reference types="node" />
11
12
  import { Macroable } from 'macroable';
12
13
  import { ServerResponse, IncomingMessage } from 'http';
13
14
  import { CookieOptions, CastableHeader, ResponseConfig, ResponseStream, ResponseContract, RedirectContract } from '@ioc:Adonis/Core/Response';
@@ -143,6 +143,7 @@ class Store {
143
143
  }
144
144
  }
145
145
  }
146
+ routeJSON.params = new Array(...collectedParams);
146
147
  collectedParams.clear();
147
148
  route.methods.forEach((method) => {
148
149
  const methodRoutes = this.getMethodRoutes(route.domain || 'root', method);
@@ -44,7 +44,15 @@ class PreCompiler {
44
44
  returnValue = await routeHandler.handler(ctx);
45
45
  }
46
46
  else {
47
- returnValue = await this.resolver.call(routeHandler, undefined, [ctx]);
47
+ returnValue = await this.resolver.call(routeHandler, undefined, (controller) => {
48
+ /**
49
+ * Allowing controller to provide the controller method argument
50
+ */
51
+ if (typeof controller['getHandlerArguments'] === 'function') {
52
+ return controller['getHandlerArguments'](ctx);
53
+ }
54
+ return [ctx];
55
+ });
48
56
  }
49
57
  if ((0, helpers_2.useReturnValue)(returnValue, ctx)) {
50
58
  ctx.response.send(returnValue);
@@ -8,6 +8,7 @@
8
8
  */
9
9
  /// <reference path="../../adonis-typings/index.d.ts" />
10
10
  /// <reference types="node" />
11
+ /// <reference types="node" />
11
12
  import { Server as HttpsServer } from 'https';
12
13
  import { EncryptionContract } from '@ioc:Adonis/Core/Encryption';
13
14
  import { ApplicationContract } from '@ioc:Adonis/Core/Application';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonisjs/http-server",
3
- "version": "5.9.0",
3
+ "version": "5.10.0",
4
4
  "description": "AdonisJS HTTP server with support packed with Routing and Cookies",
5
5
  "main": "build/providers/HttpServerProvider.js",
6
6
  "files": [
@@ -36,18 +36,18 @@
36
36
  "author": "virk,adonisjs",
37
37
  "license": "MIT",
38
38
  "devDependencies": {
39
- "@adonisjs/application": "^5.2.4",
39
+ "@adonisjs/application": "^5.2.5",
40
40
  "@adonisjs/encryption": "^4.0.8",
41
41
  "@adonisjs/mrm-preset": "^5.0.3",
42
- "@adonisjs/require-ts": "^2.0.11",
42
+ "@adonisjs/require-ts": "^2.0.12",
43
43
  "@japa/assert": "^1.3.4",
44
44
  "@japa/run-failed-tests": "^1.0.7",
45
- "@japa/runner": "^2.0.7",
45
+ "@japa/runner": "^2.0.8",
46
46
  "@japa/spec-reporter": "^1.1.12",
47
47
  "@poppinss/dev-utils": "^2.0.3",
48
48
  "@types/cookie": "^0.5.1",
49
49
  "@types/ms": "^0.7.31",
50
- "@types/node": "^17.0.31",
50
+ "@types/node": "^17.0.35",
51
51
  "@types/pluralize": "0.0.29",
52
52
  "@types/proxy-addr": "^2.0.0",
53
53
  "@types/qs": "^6.9.7",
@@ -57,23 +57,23 @@
57
57
  "cross-env": "^7.0.3",
58
58
  "cz-conventional-changelog": "^3.3.0",
59
59
  "del-cli": "^4.0.1",
60
- "eslint": "^8.15.0",
60
+ "eslint": "^8.16.0",
61
61
  "eslint-config-prettier": "^8.5.0",
62
62
  "eslint-plugin-adonis": "^2.1.0",
63
63
  "eslint-plugin-prettier": "^4.0.0",
64
64
  "fastify": "^3.29.0",
65
65
  "github-label-sync": "^2.2.0",
66
66
  "http-status-codes": "^2.2.0",
67
- "husky": "^8.0.0",
68
- "middie": "^6.0.0",
67
+ "husky": "^8.0.1",
68
+ "middie": "^6.1.0",
69
69
  "mrm": "^4.0.0",
70
70
  "np": "^7.6.1",
71
71
  "pem": "^1.14.6",
72
72
  "prettier": "^2.6.2",
73
73
  "reflect-metadata": "^0.1.13",
74
74
  "supertest": "^6.2.3",
75
- "ts-node": "^10.7.0",
76
- "typescript": "^4.6.4"
75
+ "ts-node": "^10.8.0",
76
+ "typescript": "^4.7.2"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "@adonisjs/application": "^5.0.0",