Comparing version 1.3.2 to 1.3.3
import { Logger, LogLevel } from "./logger.js"; | ||
import { ConfigMan, ConfigTypes } from "./config-man.js"; | ||
import { HttpMan, Middleware, EndpointCallback, EndpointCallbackDetails, HttpError } from "./http-man"; | ||
export { Logger, LogLevel, ConfigTypes, HttpMan, Middleware, EndpointCallback, EndpointCallbackDetails, HttpError, }; | ||
import { HttpMan, Middleware, EndpointCallback, EndpointCallbackDetails, HttpConfig, HttpError, HttpConfigError } from "./http-man"; | ||
export { Logger, LogLevel, ConfigTypes, HttpMan, Middleware, EndpointCallback, EndpointCallbackDetails, HttpConfig, HttpError, HttpConfigError, }; | ||
export type ConfigOptions = { | ||
@@ -19,3 +19,2 @@ cmdLineFlag?: string; | ||
logTimestampTz?: string; | ||
enableHttpMan?: boolean; | ||
}; | ||
@@ -67,3 +66,3 @@ export type QuestionOptions = { | ||
private _plugins; | ||
private _httpMan?; | ||
private _httpManList; | ||
private _finally?; | ||
@@ -76,7 +75,7 @@ constructor(appShConfig: AppShConfig); | ||
get configMan(): ConfigMan; | ||
get httpMan(): HttpMan | undefined; | ||
set level(level: LogLevel); | ||
set logLevel(level: LogLevel); | ||
finally(handler: () => Promise<void>): void; | ||
shutdownError(code?: number, testing?: boolean): Promise<void>; | ||
exit(code: number, hard?: boolean): Promise<void>; | ||
addHttpMan(networkInterface: string, networkPort: number, httpConfig?: HttpConfig): HttpMan; | ||
getConfigStr(config: string, defaultVal?: string, options?: ConfigOptions): string; | ||
@@ -83,0 +82,0 @@ getConfigBool(config: string, defaultVal?: boolean, options?: ConfigOptions): boolean; |
@@ -16,2 +16,6 @@ import { Logger } from "./logger.js"; | ||
}; | ||
export declare class ConfigError { | ||
message: string; | ||
constructor(message: string); | ||
} | ||
export declare class ConfigMan { | ||
@@ -18,0 +22,0 @@ private _logger; |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { AppSh } from "./app-sh.js"; | ||
@@ -6,3 +7,3 @@ import { SseServer, SseServerOptions } from "./sse-server"; | ||
export { SseServer, SseServerOptions }; | ||
export type Middleware = (req: http.IncomingMessage, res: http.ServerResponse, details: EndpointCallbackDetails, next: () => Promise<void>) => Promise<void>; | ||
export type Middleware = (req: http.IncomingMessage, res: HttpServerResponse, details: EndpointCallbackDetails, next: () => Promise<void>) => Promise<void>; | ||
export type HealthcheckCallback = () => Promise<boolean>; | ||
@@ -19,2 +20,3 @@ export type CorsOptions = { | ||
export type EndpointOptions = { | ||
noDefaultMiddlewares?: boolean; | ||
middlewareList?: Middleware[]; | ||
@@ -34,3 +36,8 @@ sseServerOptions?: SseServerOptions; | ||
}; | ||
export type EndpointCallback = (req: http.IncomingMessage, res: http.ServerResponse, details: EndpointCallbackDetails) => Promise<void> | void; | ||
export type EndpointCallback = (req: http.IncomingMessage, res: HttpServerResponse, details: EndpointCallbackDetails) => Promise<void> | void; | ||
export declare class HttpServerResponse extends http.ServerResponse { | ||
json?: object | [] | string | number | boolean; | ||
html?: string | Buffer; | ||
text?: string | Buffer; | ||
} | ||
type Method = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS"; | ||
@@ -42,8 +49,10 @@ export declare class HttpError { | ||
} | ||
export declare class HttpConfigError { | ||
message: string; | ||
constructor(message: string); | ||
} | ||
export type HttpConfig = { | ||
appSh: AppSh; | ||
loggerTag?: string; | ||
keepAliveTimeout?: number; | ||
headerTimeout?: number; | ||
networkInterface?: string; | ||
networkPort?: number; | ||
healthcheckPath?: string; | ||
@@ -53,5 +62,10 @@ healthcheckGoodRes?: number; | ||
enableHttps?: boolean; | ||
httpsKeyFile?: string; | ||
httpsCertFile?: string; | ||
defaultMiddlewareList?: Middleware[]; | ||
}; | ||
export declare class HttpMan { | ||
private _sh; | ||
private _networkInterface; | ||
private _networkPort; | ||
private _loggerTag; | ||
private _logger; | ||
@@ -62,11 +76,12 @@ private _healthcheckCallbacks; | ||
private _httpHeaderTimeout; | ||
private _networkInterface; | ||
private _networkPort; | ||
private _enableHttps; | ||
private _healthCheckPath; | ||
private _healthCheckGoodResCode; | ||
private _healthCheckBadResCode; | ||
private _enableHttps; | ||
private _keyFile?; | ||
private _certFile?; | ||
private _defaultMiddlewareList; | ||
private _server?; | ||
private _ip?; | ||
constructor(httpConfig: HttpConfig); | ||
constructor(appSh: AppSh, networkInterface: string, networkPort: number, httpConfig?: HttpConfig); | ||
private setupHttpServer; | ||
@@ -78,2 +93,3 @@ private handlePreflightReq; | ||
private callEndpoint; | ||
private handleUserResponse; | ||
private healthcheckCallback; | ||
@@ -80,0 +96,0 @@ stop(): Promise<void>; |
@@ -6,3 +6,3 @@ /// <reference types="node" /> | ||
pingInterval?: number; | ||
pingEvent?: string; | ||
pingEventName?: string; | ||
}; | ||
@@ -9,0 +9,0 @@ export declare class SseServer { |
{ | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"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
68408
528