Comparing version 1.1.1 to 1.2.0
@@ -5,3 +5,3 @@ import { Logger, LogLevel } from "./logger.js"; | ||
import { Pool } from "undici"; | ||
export { Logger, LogLevel, ConfigTypes, Middleware, EndpointCallback, EndpointCallbackDetails, z, }; | ||
export { Logger, LogLevel, ConfigTypes, HttpMan, Middleware, EndpointCallback, EndpointCallbackDetails, z, }; | ||
export interface ConfigOptions { | ||
@@ -61,2 +61,3 @@ cmdLineFlag?: string; | ||
private _httpMan?; | ||
private _finally?; | ||
constructor(appShConfig: AppShConfig); | ||
@@ -70,2 +71,3 @@ protected stop(): Promise<void>; | ||
set level(level: LogLevel); | ||
finally(handler: () => Promise<void>): void; | ||
shutdownError(code?: number, testing?: boolean): Promise<void>; | ||
@@ -72,0 +74,0 @@ exit(code: number, hard?: boolean): Promise<void>; |
@@ -7,4 +7,3 @@ /// <reference types="node" /> | ||
export { z }; | ||
type MiddlewareNext = (req: http.IncomingMessage, res: http.ServerResponse, details: EndpointCallbackDetails, middlewareStack: Middleware[], callback: EndpointCallback) => Promise<void>; | ||
export type Middleware = (req: http.IncomingMessage, res: http.ServerResponse, details: EndpointCallbackDetails, next: MiddlewareNext) => Promise<void>; | ||
export type Middleware = (req: http.IncomingMessage, res: http.ServerResponse, details: EndpointCallbackDetails, next: () => Promise<void>) => Promise<void>; | ||
export type HealthcheckCallback = () => Promise<boolean>; | ||
@@ -18,6 +17,3 @@ export type EndpointCallbackDetails = { | ||
export type EndpointCallback = (req: http.IncomingMessage, res: http.ServerResponse, details: EndpointCallbackDetails) => Promise<void>; | ||
export type EndpointOptions = { | ||
maxBodySize?: number; | ||
zodInputValidator?: z.ZodTypeAny; | ||
}; | ||
type Method = "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; | ||
export interface HttpConfig { | ||
@@ -34,7 +30,5 @@ appSh: AppSh; | ||
} | ||
type Method = "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; | ||
export declare class HttpMan { | ||
private _sh; | ||
private _logger; | ||
private _middlewareList; | ||
private _healthcheckCallbacks; | ||
@@ -55,10 +49,13 @@ private _methodListMap; | ||
private handleHttpReq; | ||
private processHttpReqBody; | ||
private checkForJsonBody; | ||
private callMiddleware; | ||
private healthcheckCallback; | ||
stop(): Promise<void>; | ||
addMiddleware(middleware: Middleware): void; | ||
addHealthcheck(callback: HealthcheckCallback): void; | ||
addEndpoint(method: Method, path: string, callback: EndpointCallback, endpointOptions?: EndpointOptions): void; | ||
healthcheck(callback: HealthcheckCallback): void; | ||
endpoint(method: Method, path: string, callback: EndpointCallback, middlewareList?: Middleware[]): void; | ||
static body(options?: { | ||
maxBodySize?: number; | ||
}): Middleware; | ||
static json(options?: { | ||
zodInputValidator?: z.ZodTypeAny; | ||
}): Middleware; | ||
} |
{ | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"name": "app-sh", | ||
@@ -4,0 +4,0 @@ "description": "App Shell", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
843985
3452