@zerooneit/expressive-tea 1.3.0-beta.5 → 2.0.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.
- package/.gitattributes +4 -0
- package/.swcrc +61 -0
- package/README.md +564 -174
- package/classes/Boot.d.ts +94 -3
- package/classes/Boot.js +171 -51
- package/classes/Engine.d.ts +59 -10
- package/classes/Engine.js +72 -11
- package/classes/EngineRegistry.d.ts +154 -0
- package/classes/EngineRegistry.js +247 -0
- package/classes/LoadBalancer.js +2 -5
- package/classes/ProxyRoute.d.ts +3 -3
- package/classes/ProxyRoute.js +5 -5
- package/classes/Settings.d.ts +31 -2
- package/classes/Settings.js +64 -11
- package/decorators/annotations.d.ts +1 -1
- package/decorators/annotations.js +17 -17
- package/decorators/env.d.ts +145 -0
- package/decorators/env.js +177 -0
- package/decorators/health.d.ts +115 -0
- package/decorators/health.js +124 -0
- package/decorators/module.d.ts +15 -15
- package/decorators/module.js +14 -23
- package/decorators/proxy.d.ts +26 -11
- package/decorators/proxy.js +35 -45
- package/decorators/router.d.ts +17 -16
- package/decorators/router.js +32 -52
- package/decorators/server.d.ts +8 -8
- package/decorators/server.js +48 -50
- package/engines/health/index.d.ts +120 -0
- package/engines/health/index.js +179 -0
- package/engines/http/index.d.ts +6 -7
- package/engines/http/index.js +22 -17
- package/engines/index.d.ts +32 -0
- package/engines/index.js +112 -0
- package/engines/socketio/index.d.ts +2 -1
- package/engines/socketio/index.js +16 -6
- package/engines/teacup/index.d.ts +13 -0
- package/engines/teacup/index.js +61 -11
- package/engines/teapot/index.d.ts +15 -2
- package/engines/teapot/index.js +61 -13
- package/engines/websocket/index.d.ts +4 -1
- package/engines/websocket/index.js +10 -2
- package/eslint.config.mjs +138 -0
- package/exceptions/RequestExceptions.d.ts +3 -3
- package/helpers/boot-helper.d.ts +6 -6
- package/helpers/boot-helper.js +30 -24
- package/helpers/decorators.js +7 -6
- package/helpers/promise-helper.d.ts +1 -1
- package/helpers/promise-helper.js +1 -2
- package/helpers/server.d.ts +32 -6
- package/helpers/server.js +101 -61
- package/helpers/teapot-helper.d.ts +5 -8
- package/helpers/teapot-helper.js +39 -11
- package/helpers/websocket-helper.d.ts +3 -5
- package/helpers/websocket-helper.js +3 -3
- package/interfaces/index.d.ts +1 -1
- package/inversify.config.d.ts +4 -4
- package/inversify.config.js +1 -1
- package/libs/utilities.d.ts +21910 -0
- package/libs/utilities.js +420 -0
- package/mixins/module.d.ts +45 -0
- package/mixins/module.js +71 -0
- package/mixins/proxy.d.ts +46 -0
- package/mixins/proxy.js +86 -0
- package/mixins/route.d.ts +48 -0
- package/mixins/route.js +96 -0
- package/package.json +91 -69
- package/services/DependencyInjection.d.ts +95 -7
- package/services/DependencyInjection.js +123 -5
- package/services/WebsocketService.d.ts +4 -6
- package/services/WebsocketService.js +5 -3
- package/types/core.d.ts +14 -0
- package/types/core.js +2 -0
- package/types/injection-types.d.ts +6 -0
- package/types/injection-types.js +10 -0
- package/types/inversify.d.ts +5 -0
- package/types/inversify.js +3 -0
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import WebSocket from 'ws';
|
|
4
|
-
import * as http from 'http';
|
|
1
|
+
import type WebSocket from 'ws';
|
|
2
|
+
import type * as http from 'http';
|
|
5
3
|
import * as https from 'https';
|
|
6
4
|
export default class WebsocketService {
|
|
7
|
-
static instance: WebsocketService;
|
|
5
|
+
static instance: WebsocketService | undefined;
|
|
8
6
|
private ws;
|
|
9
7
|
private wss;
|
|
10
8
|
httpServer: http.Server;
|
|
11
9
|
httpsServer: https.Server;
|
|
12
|
-
constructor(ws?: WebSocket.Server
|
|
10
|
+
constructor(ws?: WebSocket.Server, wss?: WebSocket.Server);
|
|
13
11
|
getWebsocket(httpServer: http.Server | https.Server): WebSocket.Server;
|
|
14
12
|
setHttpServer(httpServer: http.Server | https.Server): void;
|
|
15
13
|
setWebSocket(ws: WebSocket.Server): void;
|
|
@@ -6,8 +6,10 @@ class WebsocketService {
|
|
|
6
6
|
if (WebsocketService.instance) {
|
|
7
7
|
return WebsocketService.instance;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
if (ws)
|
|
10
|
+
this.ws = ws;
|
|
11
|
+
if (wss)
|
|
12
|
+
this.wss = wss;
|
|
11
13
|
WebsocketService.instance = this;
|
|
12
14
|
}
|
|
13
15
|
getWebsocket(httpServer) {
|
|
@@ -39,7 +41,7 @@ class WebsocketService {
|
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
static clear() {
|
|
42
|
-
|
|
44
|
+
WebsocketService.instance = undefined;
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
exports.default = WebsocketService;
|
package/types/core.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type IExpressiveTeaModule, IExpressiveTeaProxy, type IExpressiveTeaRoute } from '@expressive-tea/commons';
|
|
2
|
+
export type TFunction<T = any> = (...args: any[]) => T;
|
|
3
|
+
export type Constructor<T = Record<string, any>> = new (...args: any[]) => T;
|
|
4
|
+
export type MixinConstructor<T = Record<string, any>> = Constructor<T>;
|
|
5
|
+
export type ExpressiveTeaModule = MixinConstructor<IExpressiveTeaModule>;
|
|
6
|
+
export type ExpressiveTeaRoute = MixinConstructor<IExpressiveTeaRoute>;
|
|
7
|
+
export type ExpressiveTeaProxy = MixinConstructor<IExpressiveTeaProxy>;
|
|
8
|
+
/**
|
|
9
|
+
* Legacy type aliases - kept for backward compatibility
|
|
10
|
+
* @deprecated Use the typed versions from mixins instead
|
|
11
|
+
*/
|
|
12
|
+
export type ModulizedExpressiveTeaModule<TBase> = IExpressiveTeaModule & TBase;
|
|
13
|
+
export type RouterizedExpressiveTeaRoute<TBase> = IExpressiveTeaRoute & TBase;
|
|
14
|
+
export type ProxifyExpressiveTeaRoute<TBase> = IExpressiveTeaProxy & TBase;
|
package/types/core.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TYPES = void 0;
|
|
4
|
+
// Service identifiers for dependency injection
|
|
5
|
+
exports.TYPES = {
|
|
6
|
+
Context: Symbol.for('Context'),
|
|
7
|
+
Server: Symbol.for('Server'),
|
|
8
|
+
SecureServer: Symbol.for('SecureServer'),
|
|
9
|
+
Settings: Symbol.for('Settings')
|
|
10
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ServiceIdentifier as InversifyServiceIdentifier } from 'inversify';
|
|
2
|
+
export type ServiceIdentifier<T = any> = InversifyServiceIdentifier<T> | (abstract new (...args: any[]) => T);
|
|
3
|
+
export type LazyInversifyDecorator<T = any> = (serviceIdentifier: ServiceIdentifier<T>) => (proto: any, key: string) => void;
|
|
4
|
+
export type LazyInversifyNamedDecorator<T = any> = (serviceIdentifier: ServiceIdentifier<T>, named: string) => (proto: any, key: string) => void;
|
|
5
|
+
export type LazyInversifyTaggedDecorator<T = any> = (serviceIdentifier: ServiceIdentifier<T>, key: string, value: any) => (proto: any, propertyName: string) => void;
|