@expressive-tea/core 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.
Files changed (94) hide show
  1. package/.gitattributes +4 -0
  2. package/.swcrc +61 -0
  3. package/LICENSE +201 -0
  4. package/README.md +627 -0
  5. package/banner.png +0 -0
  6. package/classes/Boot.d.ts +145 -0
  7. package/classes/Boot.js +223 -0
  8. package/classes/Engine.d.ts +63 -0
  9. package/classes/Engine.js +90 -0
  10. package/classes/EngineRegistry.d.ts +154 -0
  11. package/classes/EngineRegistry.js +247 -0
  12. package/classes/LoadBalancer.d.ts +8 -0
  13. package/classes/LoadBalancer.js +28 -0
  14. package/classes/ProxyRoute.d.ts +14 -0
  15. package/classes/ProxyRoute.js +40 -0
  16. package/classes/Settings.d.ts +128 -0
  17. package/classes/Settings.js +172 -0
  18. package/decorators/annotations.d.ts +91 -0
  19. package/decorators/annotations.js +132 -0
  20. package/decorators/env.d.ts +145 -0
  21. package/decorators/env.js +177 -0
  22. package/decorators/health.d.ts +115 -0
  23. package/decorators/health.js +124 -0
  24. package/decorators/module.d.ts +34 -0
  25. package/decorators/module.js +39 -0
  26. package/decorators/proxy.d.ts +28 -0
  27. package/decorators/proxy.js +60 -0
  28. package/decorators/router.d.ts +199 -0
  29. package/decorators/router.js +252 -0
  30. package/decorators/server.d.ts +92 -0
  31. package/decorators/server.js +247 -0
  32. package/engines/constants/constants.d.ts +2 -0
  33. package/engines/constants/constants.js +5 -0
  34. package/engines/health/index.d.ts +120 -0
  35. package/engines/health/index.js +179 -0
  36. package/engines/http/index.d.ts +12 -0
  37. package/engines/http/index.js +59 -0
  38. package/engines/index.d.ts +32 -0
  39. package/engines/index.js +112 -0
  40. package/engines/socketio/index.d.ts +7 -0
  41. package/engines/socketio/index.js +30 -0
  42. package/engines/teacup/index.d.ts +27 -0
  43. package/engines/teacup/index.js +136 -0
  44. package/engines/teapot/index.d.ts +32 -0
  45. package/engines/teapot/index.js +167 -0
  46. package/engines/websocket/index.d.ts +9 -0
  47. package/engines/websocket/index.js +39 -0
  48. package/eslint.config.mjs +138 -0
  49. package/exceptions/BootLoaderExceptions.d.ts +26 -0
  50. package/exceptions/BootLoaderExceptions.js +31 -0
  51. package/exceptions/RequestExceptions.d.ts +75 -0
  52. package/exceptions/RequestExceptions.js +89 -0
  53. package/helpers/boot-helper.d.ts +7 -0
  54. package/helpers/boot-helper.js +84 -0
  55. package/helpers/decorators.d.ts +1 -0
  56. package/helpers/decorators.js +15 -0
  57. package/helpers/promise-helper.d.ts +1 -0
  58. package/helpers/promise-helper.js +6 -0
  59. package/helpers/server.d.ts +35 -0
  60. package/helpers/server.js +141 -0
  61. package/helpers/teapot-helper.d.ts +18 -0
  62. package/helpers/teapot-helper.js +88 -0
  63. package/helpers/websocket-helper.d.ts +3 -0
  64. package/helpers/websocket-helper.js +20 -0
  65. package/images/announcement-01.png +0 -0
  66. package/images/logo-sticky-01.png +0 -0
  67. package/images/logo-wp-01.png +0 -0
  68. package/images/logo.png +0 -0
  69. package/images/zero-oneit.png +0 -0
  70. package/interfaces/index.d.ts +4 -0
  71. package/interfaces/index.js +2 -0
  72. package/inversify.config.d.ts +9 -0
  73. package/inversify.config.js +8 -0
  74. package/libs/classNames.d.ts +1 -0
  75. package/libs/classNames.js +4 -0
  76. package/libs/utilities.d.ts +21910 -0
  77. package/libs/utilities.js +420 -0
  78. package/mixins/module.d.ts +45 -0
  79. package/mixins/module.js +71 -0
  80. package/mixins/proxy.d.ts +46 -0
  81. package/mixins/proxy.js +86 -0
  82. package/mixins/route.d.ts +48 -0
  83. package/mixins/route.js +96 -0
  84. package/package.json +137 -0
  85. package/services/DependencyInjection.d.ts +159 -0
  86. package/services/DependencyInjection.js +201 -0
  87. package/services/WebsocketService.d.ts +18 -0
  88. package/services/WebsocketService.js +47 -0
  89. package/types/core.d.ts +14 -0
  90. package/types/core.js +2 -0
  91. package/types/injection-types.d.ts +6 -0
  92. package/types/injection-types.js +10 -0
  93. package/types/inversify.d.ts +5 -0
  94. package/types/inversify.js +3 -0
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const https = require("https");
4
+ class WebsocketService {
5
+ constructor(ws, wss) {
6
+ if (WebsocketService.instance) {
7
+ return WebsocketService.instance;
8
+ }
9
+ if (ws)
10
+ this.ws = ws;
11
+ if (wss)
12
+ this.wss = wss;
13
+ WebsocketService.instance = this;
14
+ }
15
+ getWebsocket(httpServer) {
16
+ return (httpServer instanceof https.Server) ? this.wss : this.ws;
17
+ }
18
+ setHttpServer(httpServer) {
19
+ if (httpServer instanceof https.Server) {
20
+ this.httpsServer = httpServer;
21
+ }
22
+ else {
23
+ this.httpServer = httpServer;
24
+ }
25
+ }
26
+ setWebSocket(ws) {
27
+ this.ws = ws;
28
+ }
29
+ setSecureWebsocket(wss) {
30
+ this.wss = wss;
31
+ }
32
+ static getInstance(ws, wss) {
33
+ if (!WebsocketService.instance) {
34
+ WebsocketService.instance = new WebsocketService(ws, wss);
35
+ }
36
+ return WebsocketService.instance;
37
+ }
38
+ static init(ws, wss) {
39
+ if (!WebsocketService.instance) {
40
+ WebsocketService.instance = new WebsocketService(ws, wss);
41
+ }
42
+ }
43
+ static clear() {
44
+ WebsocketService.instance = undefined;
45
+ }
46
+ }
47
+ exports.default = WebsocketService;
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export declare const TYPES: {
2
+ Context: symbol;
3
+ Server: symbol;
4
+ SecureServer: symbol;
5
+ Settings: symbol;
6
+ };
@@ -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;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* eslint-enable @typescript-eslint/no-explicit-any */