Update WebSocket server with favicon assets and additional dependencies

* Added favicon assets including various sizes and a manifest file for improved branding
* Updated package.json to include new type definitions and dependencies for body-parser, cors, lru-cache, moment, multer, on-headers, response-time, and serve-favicon
* Enhanced HttpServer class to utilize the favicon and improved
  middleware configuration for handling requests
This commit is contained in:
2025-09-27 18:41:19 -04:00
parent e895704785
commit 9372777296
15 changed files with 394 additions and 39 deletions

View File

@@ -73,27 +73,40 @@ export default class Assert {
}
}
public static isFunction(name: string, value: unknown): asserts value is Function {
public static isFunction(name: string, value: unknown): asserts value is (...args: unknown[]) => unknown {
if (typeof value !== 'function') {
throw new Error(`[${name}] must be a function, instead received [${typeof value}]`);
}
}
public static satisfiesInterface<T>(name: string, obj: unknown, requiredProps: (keyof T)[]): asserts obj is T {
Assert.isObject(name, obj);
for (const prop of requiredProps) {
if (!(prop in (obj as any))) {
if (!(prop in (obj as Record<string, unknown>))) {
throw new Error(`[${name}] missing required property: ${String(prop)}`);
}
}
}
public static isArray<T>(name: string, value: unknown): asserts value is T[] {
public static isArray(name: string, value: unknown): asserts value is unknown[] {
if (!Array.isArray(value)) {
throw new Error(`[${name}] must be an array, instead received [${typeof value}]`);
}
}
public static isArrayOf<T>(name: string, arrayValueType: T, value: unknown): asserts value is T[] {
Assert.isArray(name, value);
for (const item of value) {
const itemTypeof = typeof item;
if (itemTypeof !== arrayValueType) {
throw new Error(`[${name}] must be an array of [${arrayValueType}] received [${itemTypeof}]`);
}
}
}
public static isStringArray(name: string, value: unknown): asserts value is string[] {
if (!Array.isArray(value)) {
throw new Error(`[${name}] must be an array, instead received [${typeof value}]`);
@@ -116,6 +129,7 @@ export default class Assert {
}
}
// eslint-disable-next-line
public static isInstance<T>(name: string, parentClass: new (...args: any[]) => T, object: unknown): asserts object is T {
if (object === null || object === undefined || typeof object !== 'object') {
throw new Error(`[${name}] must be an instance of [${parentClass.constructor.name}], instead received [${typeof object}]`);