@adonisjs/http-server 6.0.0-0 → 6.0.2-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.
@@ -1,4 +1,4 @@
1
- import type Encryption from '@adonisjs/encryption';
1
+ import type { Encryption } from '@adonisjs/encryption';
2
2
  export declare class CookieClient {
3
3
  #private;
4
4
  constructor(encryption: Encryption);
@@ -1,4 +1,4 @@
1
- import type Encryption from '@adonisjs/encryption';
1
+ import type { Encryption } from '@adonisjs/encryption';
2
2
  export declare function pack(key: string, value: any, encryption: Encryption): null | string;
3
3
  export declare function canUnpack(encryptedValue: string): boolean;
4
4
  export declare function unpack(key: string, encryptedValue: string, encryption: Encryption): null | any;
@@ -1,4 +1,4 @@
1
- import type Encryption from '@adonisjs/encryption';
1
+ import type { Encryption } from '@adonisjs/encryption';
2
2
  export declare function pack(key: string, value: any, encryption: Encryption): null | string;
3
3
  export declare function canUnpack(signedValue: string): boolean;
4
4
  export declare function unpack(key: string, signedValue: string, encryption: Encryption): null | any;
@@ -1,4 +1,4 @@
1
- import type Encryption from '@adonisjs/encryption';
1
+ import type { Encryption } from '@adonisjs/encryption';
2
2
  export declare class CookieParser {
3
3
  #private;
4
4
  constructor(cookieHeader: string, encryption: Encryption);
@@ -1,4 +1,4 @@
1
- import type Encryption from '@adonisjs/encryption';
1
+ import type { Encryption } from '@adonisjs/encryption';
2
2
  import type { CookieOptions } from '../types/response.js';
3
3
  export declare class CookieSerializer {
4
4
  #private;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
3
  import { Macroable } from '@poppinss/macroable';
4
- import type Encryption from '@adonisjs/encryption';
4
+ import type { Encryption } from '@adonisjs/encryption';
5
5
  import { UrlWithStringQuery } from 'node:url';
6
6
  import { ServerResponse, IncomingMessage, IncomingHttpHeaders } from 'node:http';
7
7
  import type { Qs } from './qs.js';
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
3
  import { Macroable } from '@poppinss/macroable';
4
- import type Encryption from '@adonisjs/encryption';
4
+ import type { Encryption } from '@adonisjs/encryption';
5
5
  import { ServerResponse, IncomingMessage } from 'node:http';
6
6
  import type { Qs } from './qs.js';
7
7
  import { Redirect } from './redirect.js';
@@ -8,7 +8,7 @@ import type { MakeUrlOptions, RouteFn, RouteMatchers } from '../types/route.js';
8
8
  export declare class BriskRoute<NamedMiddleware extends Record<string, LazyImport<MiddlewareAsClass>> = any> extends Macroable {
9
9
  #private;
10
10
  route: null | Route<NamedMiddleware>;
11
- constructor(app: Application, middlewareStore: MiddlewareStore<NamedMiddleware>, options: {
11
+ constructor(app: Application<any, any, any>, middlewareStore: MiddlewareStore<NamedMiddleware>, options: {
12
12
  pattern: string;
13
13
  globalMatchers: RouteMatchers;
14
14
  });
@@ -1,4 +1,4 @@
1
1
  import type { ContainerResolver } from '@adonisjs/fold';
2
2
  import type { StoreRouteNode } from '../types/route.js';
3
3
  import type { HttpContext } from '../http_context/main.js';
4
- export declare function execute(route: StoreRouteNode, resolver: ContainerResolver, ctx: HttpContext): Promise<void>;
4
+ export declare function execute(route: StoreRouteNode, resolver: ContainerResolver<any>, ctx: HttpContext): Promise<void>;
@@ -1,4 +1,4 @@
1
- import type Encryption from '@adonisjs/encryption';
1
+ import type { Encryption } from '@adonisjs/encryption';
2
2
  import type { Qs } from '../../qs.js';
3
3
  import { UrlBuilder } from './url_builder.js';
4
4
  import type { RouteJSON } from '../../types/route.js';
@@ -1,4 +1,4 @@
1
- import type Encryption from '@adonisjs/encryption';
1
+ import type { Encryption } from '@adonisjs/encryption';
2
2
  import type { Qs } from '../../qs.js';
3
3
  import type { RouteFinder } from './route_finder.js';
4
4
  export declare class UrlBuilder {
@@ -1,4 +1,4 @@
1
- import type Encryption from '@adonisjs/encryption';
1
+ import type { Encryption } from '@adonisjs/encryption';
2
2
  import type { Application } from '@adonisjs/application';
3
3
  import type { Qs } from '../qs.js';
4
4
  import { Route } from './route.js';
@@ -16,7 +16,7 @@ export declare class Router<NamedMiddleware extends Record<string, LazyImport<Mi
16
16
  routes: (Route<NamedMiddleware> | RouteResource<NamedMiddleware> | RouteGroup<NamedMiddleware> | BriskRoute<NamedMiddleware>)[];
17
17
  usingDomains: boolean;
18
18
  matchers: Matchers;
19
- constructor(app: Application, encryption: Encryption, middlewareStore: MiddlewareStore<NamedMiddleware>, qsParser: Qs);
19
+ constructor(app: Application<any, any, any>, encryption: Encryption, middlewareStore: MiddlewareStore<NamedMiddleware>, qsParser: Qs);
20
20
  route(pattern: string, methods: string[], handler: string | RouteFn): Route<NamedMiddleware>;
21
21
  any(pattern: string, handler: string | RouteFn): Route<NamedMiddleware>;
22
22
  get(pattern: string, handler: string | RouteFn): Route<NamedMiddleware>;
@@ -8,7 +8,7 @@ import type { ResourceActionNames, RouteMatcher, RouteMatchers } from '../types/
8
8
  export declare class RouteResource<NamedMiddleware extends Record<string, LazyImport<MiddlewareAsClass>> = any> extends Macroable {
9
9
  #private;
10
10
  routes: Route[];
11
- constructor(app: Application, middlewareStore: MiddlewareStore<NamedMiddleware>, options: {
11
+ constructor(app: Application<any, any, any>, middlewareStore: MiddlewareStore<NamedMiddleware>, options: {
12
12
  resource: string;
13
13
  controller: string;
14
14
  globalMatchers: RouteMatchers;
@@ -6,7 +6,7 @@ import type { GetMiddlewareArgs, MiddlewareAsClass, MiddlewareFn } from '../type
6
6
  import type { RouteFn, RouteJSON, RouteMatcher, RouteMatchers, StoreRouteMiddleware } from '../types/route.js';
7
7
  export declare class Route<NamedMiddleware extends Record<string, LazyImport<MiddlewareAsClass>> = any> extends Macroable {
8
8
  #private;
9
- constructor(app: Application, middlewareStore: MiddlewareStore<NamedMiddleware>, options: {
9
+ constructor(app: Application<any, any, any>, middlewareStore: MiddlewareStore<NamedMiddleware>, options: {
10
10
  pattern: string;
11
11
  methods: string[];
12
12
  handler: RouteFn | string;
@@ -1,4 +1,4 @@
1
1
  import type { ContainerResolver } from '@adonisjs/fold';
2
2
  import type { Router } from '../../router/main.js';
3
3
  import type { HttpContext } from '../../http_context/main.js';
4
- export declare function finalHandler(router: Router, resolver: ContainerResolver, ctx: HttpContext): () => any;
4
+ export declare function finalHandler(router: Router, resolver: ContainerResolver<any>, ctx: HttpContext): () => any;
@@ -2,4 +2,4 @@ import type { NextFn } from '@poppinss/middleware/types';
2
2
  import type { ContainerResolver } from '@adonisjs/fold';
3
3
  import type { HttpContext } from '../../http_context/main.js';
4
4
  import { ParsedGlobalMiddleware } from '../../types/middleware.js';
5
- export declare function middlewareHandler(resolver: ContainerResolver, ctx: HttpContext): (fn: ParsedGlobalMiddleware, next: NextFn) => any;
5
+ export declare function middlewareHandler(resolver: ContainerResolver<any>, ctx: HttpContext): (fn: ParsedGlobalMiddleware, next: NextFn) => any;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
- import type Encryption from '@adonisjs/encryption';
3
+ import type { Encryption } from '@adonisjs/encryption';
4
4
  import type { Application } from '@adonisjs/application';
5
5
  import type { Server as HttpsServer } from 'node:https';
6
6
  import type { ServerResponse, IncomingMessage, Server as HttpServer } from 'node:http';
@@ -11,13 +11,12 @@ import { Router } from '../router/main.js';
11
11
  export declare class Server<NamedMiddleware extends Record<string, LazyImport<MiddlewareAsClass>> = any> {
12
12
  #private;
13
13
  get usingAsyncLocalStorage(): boolean;
14
- constructor(app: Application, encryption: Encryption, config: ServerConfig);
14
+ constructor(app: Application<any, any, any>, encryption: Encryption, config: ServerConfig);
15
15
  use(serverMiddleware: LazyImport<MiddlewareAsClass>[], routerMiddleware: LazyImport<MiddlewareAsClass>[], namedMiddleware: NamedMiddleware): this;
16
16
  errorHandler(handler: LazyImport<ErrorHandlerAsAClass>): this;
17
17
  boot(): Promise<void>;
18
18
  setNodeServer(server: HttpServer | HttpsServer): void;
19
- close(): Promise<void>;
20
19
  getNodeServer(): HttpServer<typeof IncomingMessage, typeof ServerResponse> | HttpsServer<typeof IncomingMessage, typeof ServerResponse> | undefined;
21
- getRouter(): Router<any> | undefined;
20
+ getRouter(): Router<NamedMiddleware> | undefined;
22
21
  handle(req: IncomingMessage, res: ServerResponse): Promise<any>;
23
22
  }
@@ -93,20 +93,6 @@ export class Server {
93
93
  setNodeServer(server) {
94
94
  this.#underlyingHttpServer = server;
95
95
  }
96
- close() {
97
- return new Promise((resolve, reject) => {
98
- if (!this.#underlyingHttpServer || !this.#underlyingHttpServer.listening) {
99
- resolve();
100
- return;
101
- }
102
- this.#underlyingHttpServer.close((error) => {
103
- if (error) {
104
- return reject(error);
105
- }
106
- resolve();
107
- });
108
- });
109
- }
110
96
  getNodeServer() {
111
97
  return this.#underlyingHttpServer;
112
98
  }
@@ -1,3 +1,4 @@
1
+ export type { NextFn } from '@poppinss/middleware/types';
1
2
  export type Constructor<T> = new (...args: any[]) => T;
2
3
  export type LazyImport<DefaultExport> = () => Promise<{
3
4
  default: DefaultExport;
@@ -0,0 +1,7 @@
1
+ export * from './base.js';
2
+ export * from './middleware.js';
3
+ export * from './qs.js';
4
+ export * from './request.js';
5
+ export * from './response.js';
6
+ export * from './route.js';
7
+ export * from './server.js';
@@ -0,0 +1,7 @@
1
+ export * from './base.js';
2
+ export * from './middleware.js';
3
+ export * from './qs.js';
4
+ export * from './request.js';
5
+ export * from './response.js';
6
+ export * from './route.js';
7
+ export * from './server.js';
@@ -1,6 +1,5 @@
1
1
  import type { ContainerResolver } from '@adonisjs/fold';
2
- import type { NextFn } from '@poppinss/middleware/types';
3
- import type { Constructor } from './base.js';
2
+ import type { Constructor, NextFn } from './base.js';
4
3
  import type { HttpContext } from '../http_context/main.js';
5
4
  export type MiddlewareAsClass = Constructor<{
6
5
  handle: (ctx: HttpContext, next: NextFn, args?: any) => any;
@@ -9,6 +8,6 @@ type HasUndefined<T> = T extends NonNullable<T> ? true : false;
9
8
  export type GetMiddlewareArgs<Middleware extends MiddlewareAsClass> = HasUndefined<Parameters<InstanceType<Middleware>['handle']>[2]> extends true ? [Parameters<InstanceType<Middleware>['handle']>[2]] : [Parameters<InstanceType<Middleware>['handle']>[2]?];
10
9
  export type MiddlewareFn = (ctx: HttpContext, next: NextFn) => any;
11
10
  export type ParsedGlobalMiddleware = {
12
- handle: (resolver: ContainerResolver, ...args: [ctx: HttpContext, next: NextFn, params?: any]) => any;
11
+ handle: (resolver: ContainerResolver<any>, ...args: [ctx: HttpContext, next: NextFn, params?: any]) => any;
13
12
  };
14
13
  export {};
@@ -11,14 +11,14 @@ export type MatchItRouteToken = RouteMatcher & {
11
11
  export type RouteFn = (ctx: HttpContext) => any;
12
12
  export type StoreRouteHandler = RouteFn | {
13
13
  name: string;
14
- handle: (resolver: ContainerResolver, ...args: [ctx: HttpContext, ...injections: any[]]) => any;
14
+ handle: (resolver: ContainerResolver<any>, ...args: [ctx: HttpContext, ...injections: any[]]) => any;
15
15
  };
16
16
  export type StoreRouteMiddleware = MiddlewareFn | ({
17
17
  name?: string;
18
18
  args?: any[];
19
19
  } & ParsedGlobalMiddleware);
20
20
  export type StoreRouteNode = {
21
- execute: (route: StoreRouteNode, resolver: ContainerResolver, ctx: HttpContext) => any;
21
+ execute: (route: StoreRouteNode, resolver: ContainerResolver<any>, ctx: HttpContext) => any;
22
22
  name?: string;
23
23
  pattern: string;
24
24
  handler: StoreRouteHandler;
@@ -1,8 +1,8 @@
1
+ import type { QSParserConfig } from './qs.js';
1
2
  import type { Constructor } from './base.js';
2
3
  import type { RequestConfig } from './request.js';
3
4
  import type { ResponseConfig } from './response.js';
4
5
  import type { HttpContext } from '../http_context/main.js';
5
- import { QSParserConfig } from './qs.js';
6
6
  export type ServerErrorHandler = {
7
7
  handle: (error: any, ctx: HttpContext) => any;
8
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonisjs/http-server",
3
- "version": "6.0.0-0",
3
+ "version": "6.0.2-0",
4
4
  "description": "AdonisJS HTTP server with support packed with Routing and Cookies",
5
5
  "main": "build/index.js",
6
6
  "type": "module",
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "exports": {
13
13
  ".": "./build/index.js",
14
- "./types": "./build/src/types.js"
14
+ "./types": "./build/src/types/main.js"
15
15
  },
16
16
  "scripts": {
17
17
  "pretest": "npm run lint",
@@ -37,22 +37,22 @@
37
37
  "author": "virk,adonisjs",
38
38
  "license": "MIT",
39
39
  "devDependencies": {
40
- "@adonisjs/application": "^6.1.2-0",
40
+ "@adonisjs/application": "^6.2.0-0",
41
41
  "@adonisjs/config": "^4.1.1-0",
42
- "@adonisjs/encryption": "^5.0.1-0",
42
+ "@adonisjs/encryption": "^5.0.2-0",
43
43
  "@adonisjs/env": "^4.0.3-0",
44
- "@adonisjs/fold": "^9.4.1-0",
45
- "@adonisjs/logger": "^5.0.2-0",
44
+ "@adonisjs/fold": "^9.5.0-0",
45
+ "@adonisjs/logger": "^5.1.0-0",
46
46
  "@commitlint/cli": "^17.3.0",
47
47
  "@commitlint/config-conventional": "^17.3.0",
48
- "@fastify/middie": "^8.0.0",
48
+ "@fastify/middie": "^8.1.0",
49
49
  "@japa/api-client": "^1.4.2",
50
50
  "@japa/assert": "^1.3.6",
51
51
  "@japa/expect-type": "^1.0.2",
52
52
  "@japa/run-failed-tests": "^1.1.0",
53
53
  "@japa/runner": "^2.2.2",
54
54
  "@japa/spec-reporter": "^1.3.2",
55
- "@swc/core": "^1.3.21",
55
+ "@swc/core": "^1.3.22",
56
56
  "@types/accepts": "^1.3.5",
57
57
  "@types/content-disposition": "^0.5.5",
58
58
  "@types/cookie": "^0.5.1",
@@ -85,11 +85,11 @@
85
85
  "husky": "^8.0.2",
86
86
  "np": "^7.6.2",
87
87
  "pem": "^1.14.6",
88
- "prettier": "^2.8.0",
88
+ "prettier": "^2.8.1",
89
89
  "reflect-metadata": "^0.1.13",
90
- "supertest": "^6.3.1",
90
+ "supertest": "^6.3.3",
91
91
  "ts-node": "^10.9.1",
92
- "typescript": "^4.9.3"
92
+ "typescript": "^4.9.4"
93
93
  },
94
94
  "dependencies": {
95
95
  "@poppinss/macroable": "^1.0.0-0",
@@ -114,9 +114,9 @@
114
114
  "vary": "^1.1.2"
115
115
  },
116
116
  "peerDependencies": {
117
- "@adonisjs/application": "^6.1.2-0",
118
- "@adonisjs/encryption": "^5.0.1-0",
119
- "@adonisjs/fold": "^9.4.1-0"
117
+ "@adonisjs/application": "^6.2.0-0",
118
+ "@adonisjs/encryption": "^5.0.2-0",
119
+ "@adonisjs/fold": "^9.5.0-0"
120
120
  },
121
121
  "repository": {
122
122
  "type": "git",