@heliosjs/middlewares 7.0.10 → 9.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 (82) hide show
  1. package/dist/catch.d.ts +1 -1
  2. package/dist/catch.js +4 -4
  3. package/dist/catch.js.map +1 -1
  4. package/dist/cors.d.ts +1 -1
  5. package/dist/cors.js +6 -6
  6. package/dist/cors.js.map +1 -1
  7. package/dist/guard.d.ts +2 -2
  8. package/dist/guard.js +5 -5
  9. package/dist/guard.js.map +1 -1
  10. package/dist/index.js.map +1 -1
  11. package/dist/interceptor.d.ts +2 -2
  12. package/dist/interceptor.js +5 -5
  13. package/dist/interceptor.js.map +1 -1
  14. package/dist/pipe.d.ts +2 -2
  15. package/dist/pipe.js +5 -5
  16. package/dist/pipe.js.map +1 -1
  17. package/dist/sanitize.d.ts +2 -2
  18. package/dist/sanitize.js +6 -5
  19. package/dist/sanitize.js.map +1 -1
  20. package/dist/status.js +2 -4
  21. package/dist/status.js.map +1 -1
  22. package/dist/use.d.ts +1 -1
  23. package/dist/use.js +5 -5
  24. package/dist/use.js.map +1 -1
  25. package/package.json +3 -3
  26. package/dist/constants.d.ts +0 -47
  27. package/dist/constants.js +0 -70
  28. package/dist/constants.js.map +0 -1
  29. package/dist/types/core/common.d.ts +0 -46
  30. package/dist/types/core/common.js +0 -16
  31. package/dist/types/core/common.js.map +0 -1
  32. package/dist/types/core/controller.d.ts +0 -121
  33. package/dist/types/core/controller.js +0 -4
  34. package/dist/types/core/controller.js.map +0 -1
  35. package/dist/types/core/cors.d.ts +0 -10
  36. package/dist/types/core/cors.js +0 -3
  37. package/dist/types/core/cors.js.map +0 -1
  38. package/dist/types/core/error.d.ts +0 -90
  39. package/dist/types/core/error.js +0 -19
  40. package/dist/types/core/error.js.map +0 -1
  41. package/dist/types/core/index.d.ts +0 -9
  42. package/dist/types/core/index.js +0 -26
  43. package/dist/types/core/index.js.map +0 -1
  44. package/dist/types/core/multipart.d.ts +0 -8
  45. package/dist/types/core/multipart.js +0 -3
  46. package/dist/types/core/multipart.js.map +0 -1
  47. package/dist/types/core/request.d.ts +0 -65
  48. package/dist/types/core/request.js +0 -3
  49. package/dist/types/core/request.js.map +0 -1
  50. package/dist/types/core/response.d.ts +0 -64
  51. package/dist/types/core/response.js +0 -3
  52. package/dist/types/core/response.js.map +0 -1
  53. package/dist/types/core/sanitize.d.ts +0 -8
  54. package/dist/types/core/sanitize.js +0 -3
  55. package/dist/types/core/sanitize.js.map +0 -1
  56. package/dist/types/core/sse.d.ts +0 -37
  57. package/dist/types/core/sse.js +0 -3
  58. package/dist/types/core/sse.js.map +0 -1
  59. package/dist/types/ws/index.d.ts +0 -50
  60. package/dist/types/ws/index.js +0 -3
  61. package/dist/types/ws/index.js.map +0 -1
  62. package/dist/utils/shared/helpers.d.ts +0 -10
  63. package/dist/utils/shared/helpers.js +0 -91
  64. package/dist/utils/shared/helpers.js.map +0 -1
  65. package/dist/utils/shared/index.d.ts +0 -3
  66. package/dist/utils/shared/index.js +0 -20
  67. package/dist/utils/shared/index.js.map +0 -1
  68. package/dist/utils/shared/parsers.d.ts +0 -11
  69. package/dist/utils/shared/parsers.js +0 -133
  70. package/dist/utils/shared/parsers.js.map +0 -1
  71. package/dist/utils/shared/validate.d.ts +0 -1
  72. package/dist/utils/shared/validate.js +0 -42
  73. package/dist/utils/shared/validate.js.map +0 -1
  74. package/dist/utils/sse/index.d.ts +0 -2
  75. package/dist/utils/sse/index.js +0 -19
  76. package/dist/utils/sse/index.js.map +0 -1
  77. package/dist/utils/sse/server.d.ts +0 -14
  78. package/dist/utils/sse/server.js +0 -86
  79. package/dist/utils/sse/server.js.map +0 -1
  80. package/dist/utils/sse/service.d.ts +0 -17
  81. package/dist/utils/sse/service.js +0 -40
  82. package/dist/utils/sse/service.js.map +0 -1
@@ -1,121 +0,0 @@
1
- import { HANDLE_REQUEST_HASH, WS_HASH } from '../../constants';
2
- import { HTTP_METHODS, InterceptorCB, MiddlewareCB, ParamMetadata } from './common';
3
- import { CORSConfig } from './cors';
4
- import { ErrorHandler } from './error';
5
- import { Request } from './request';
6
- import { Response } from './response';
7
- import { SanitizerConfig } from './sanitize';
8
- export type ControllerClass = {
9
- new (...args: any[]): any;
10
- };
11
- export type ControllerMethods = Array<{
12
- name: string;
13
- httpMethod: HTTP_METHODS;
14
- pattern: string;
15
- middlewares?: MiddlewareCB[];
16
- }>;
17
- export type ControllerType = {
18
- [HANDLE_REQUEST_HASH]?(request: Request, response: Response): Promise<any>;
19
- [WS_HASH]?: WsControllerHandlers;
20
- sse?: SeeControllerHandlers;
21
- new (...args: any[]): any;
22
- };
23
- export type ControllerInstance = InstanceType<ControllerType>;
24
- export interface ControllerConfig {
25
- prefix: string;
26
- middlewares?: Array<MiddlewareCB>;
27
- controllers?: ControllerInstance[];
28
- }
29
- export type SSE_HANDLER_META = {
30
- type: string;
31
- method: string;
32
- };
33
- export type HandlerMeta = {
34
- type: 'connection';
35
- topic: undefined;
36
- method: 'onconnect';
37
- fn: (...args: any[]) => any;
38
- };
39
- export type WsHandlerMeta = HandlerMeta & {
40
- topic?: string;
41
- };
42
- export type WsControllerHandlers = {
43
- handlers: {
44
- connection: WsHandlerMeta[];
45
- message: WsHandlerMeta[];
46
- close: WsHandlerMeta[];
47
- error: WsHandlerMeta[];
48
- };
49
- topics: HandlerMeta[];
50
- };
51
- export type SeeControllerHandlers = {
52
- handlers: {
53
- connection: HandlerMeta[];
54
- close: HandlerMeta[];
55
- error: HandlerMeta[];
56
- };
57
- };
58
- export type FunctionsMeta = {
59
- middlewares: MiddlewareCB[];
60
- errors: ErrorHandler[];
61
- cors: CORSConfig[];
62
- sanitizers: SanitizerConfig[];
63
- pipes: Pipe[];
64
- guards: (Guard | GuardFn)[];
65
- interceptors: InterceptorCB[];
66
- status?: number;
67
- };
68
- export type Route = {
69
- name: string;
70
- route: string;
71
- method: HTTP_METHODS;
72
- cors?: CORSConfig[];
73
- ok: number;
74
- parameters: ParamMetadata[];
75
- interceptor?: InterceptorCB;
76
- functions: FunctionsMeta[];
77
- fn: (...args: any[]) => any;
78
- };
79
- export type NextFunction = (error?: unknown) => void;
80
- export type ControllerMeta = {
81
- prefix: string;
82
- name: string;
83
- routes: Route[];
84
- children?: ControllerMeta[];
85
- functions: MiddlewaresMetadata[];
86
- controllers: ControllerClass[];
87
- };
88
- export type ControllerMetadata = {
89
- prefix: string;
90
- name: string;
91
- middlewares: MiddlewareCB[];
92
- controllers: ControllerInstance[];
93
- };
94
- export type RouteMetadata = {
95
- route: string;
96
- method: HTTP_METHODS;
97
- middlewares: MiddlewareCB[];
98
- parameters: ParamMetadata[];
99
- };
100
- export type PipeKey = 'body' | 'query' | 'params' | 'headers';
101
- export type Pipe = {
102
- body?: (body: unknown, request: Request) => unknown;
103
- query?: (query: Record<string, string | string[]>, request: Request) => Record<string, string | string[]>;
104
- params?: (params: Record<string, string>, request: Request) => Record<string, string>;
105
- headers?: (headers: Record<string, string | string[]>, request: Request) => Record<string, string | string[]>;
106
- };
107
- export interface Guard {
108
- new (...any: any[]): any;
109
- canActivate(request: Request, response: Response): boolean;
110
- }
111
- export type GuardFn = (request: Request, response: Response) => boolean;
112
- export type MiddlewaresMetadata = {
113
- middlewares: MiddlewareCB[];
114
- errors: ErrorHandler[];
115
- cors: CORSConfig[];
116
- sanitizers: SanitizerConfig[];
117
- pipes: Pipe[];
118
- guards: (Guard | GuardFn)[];
119
- interceptors: InterceptorCB[];
120
- status?: number;
121
- };
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const constants_1 = require("../../constants");
4
- //# sourceMappingURL=controller.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/types/core/controller.ts"],"names":[],"mappings":";;AAAA,+CAA+D"}
@@ -1,10 +0,0 @@
1
- export interface CORSConfig {
2
- origin?: string | string[] | ((origin: string) => boolean);
3
- methods?: string[];
4
- allowedHeaders?: string[];
5
- exposedHeaders?: string[];
6
- credentials?: boolean;
7
- maxAge?: number;
8
- preflightContinue?: boolean;
9
- optionsSuccessStatus?: number;
10
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=cors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cors.js","sourceRoot":"","sources":["../../../src/types/core/cors.ts"],"names":[],"mappings":""}
@@ -1,90 +0,0 @@
1
- import { Request } from './request';
2
- import { Response } from './response';
3
- export declare enum ErrorCode {
4
- BAD_REQUEST = "BAD_REQUEST",
5
- UNAUTHORIZED = "UNAUTHORIZED",
6
- FORBIDDEN = "FORBIDDEN",
7
- NOT_FOUND = "NOT_FOUND",
8
- VALIDATION_FAILED = "VALIDATION_FAILED",
9
- RATE_LIMIT_EXCEEDED = "RATE_LIMIT_EXCEEDED",
10
- SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
11
- DATABASE_ERROR = "DATABASE_ERROR",
12
- DUPLICATE_ENTRY = "DUPLICATE_ENTRY",
13
- INVALID_STATE = "INVALID_STATE",
14
- DEPENDENCY_FAILED = "DEPENDENCY_FAILED",
15
- INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR"
16
- }
17
- export interface ErrorDetails {
18
- field?: string;
19
- value?: unknown;
20
- constraint?: string;
21
- [key: string]: unknown;
22
- }
23
- export interface HeliosError extends Error {
24
- code: ErrorCode;
25
- status: number;
26
- details?: ErrorDetails[];
27
- timestamp: Date;
28
- requestId?: string;
29
- path?: string;
30
- method?: string;
31
- toResponse(): ErrorResponse;
32
- }
33
- export interface IValidationError extends HeliosError {
34
- code: ErrorCode.VALIDATION_FAILED;
35
- details?: ErrorDetails[];
36
- }
37
- export interface ErrorResponse {
38
- success: false;
39
- error: {
40
- code: ErrorCode;
41
- status: number;
42
- message: string;
43
- details?: ErrorDetails[];
44
- timestamp: string;
45
- requestId?: string;
46
- path?: string;
47
- };
48
- }
49
- export interface ErrorHandlerConfig {
50
- includeStack?: boolean;
51
- logErrors?: boolean;
52
- logStack?: boolean;
53
- customHandlers?: Record<ErrorCode, (error: HeliosError) => unknown>;
54
- }
55
- export interface SerializedError {
56
- type: 'Error' | 'HttpError' | 'AxiosError' | 'Unknown' | 'ValidationError';
57
- message: string;
58
- status?: number;
59
- code?: string;
60
- stack?: string;
61
- data?: unknown;
62
- original?: unknown;
63
- errors?: unknown[];
64
- details?: ErrorDetails[];
65
- }
66
- export interface ErrorHandlerConfig {
67
- includeStack?: boolean;
68
- logErrors?: boolean;
69
- logStack?: boolean;
70
- customHandlers?: Record<ErrorCode, (error: HeliosError) => unknown>;
71
- }
72
- export type ErrorHandler = (error: Error, req: Request, response: Response) => unknown;
73
- type ErrorChildren = {
74
- property?: string;
75
- value: unknown;
76
- constraints?: unknown[];
77
- children?: ErrorChildren[];
78
- };
79
- export type ErrorObject = Partial<{
80
- name: string;
81
- status: number;
82
- statusCode: number;
83
- code: string;
84
- message: string;
85
- stack: string;
86
- errors: ErrorChildren[];
87
- details: ErrorDetails[];
88
- validationError?: unknown;
89
- }>;
90
- export {};
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ErrorCode = void 0;
4
- var ErrorCode;
5
- (function (ErrorCode) {
6
- ErrorCode["BAD_REQUEST"] = "BAD_REQUEST";
7
- ErrorCode["UNAUTHORIZED"] = "UNAUTHORIZED";
8
- ErrorCode["FORBIDDEN"] = "FORBIDDEN";
9
- ErrorCode["NOT_FOUND"] = "NOT_FOUND";
10
- ErrorCode["VALIDATION_FAILED"] = "VALIDATION_FAILED";
11
- ErrorCode["RATE_LIMIT_EXCEEDED"] = "RATE_LIMIT_EXCEEDED";
12
- ErrorCode["SERVICE_UNAVAILABLE"] = "SERVICE_UNAVAILABLE";
13
- ErrorCode["DATABASE_ERROR"] = "DATABASE_ERROR";
14
- ErrorCode["DUPLICATE_ENTRY"] = "DUPLICATE_ENTRY";
15
- ErrorCode["INVALID_STATE"] = "INVALID_STATE";
16
- ErrorCode["DEPENDENCY_FAILED"] = "DEPENDENCY_FAILED";
17
- ErrorCode["INTERNAL_SERVER_ERROR"] = "INTERNAL_SERVER_ERROR";
18
- })(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
19
- //# sourceMappingURL=error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/types/core/error.ts"],"names":[],"mappings":";;;AAGA,IAAY,SAaX;AAbD,WAAY,SAAS;IACnB,wCAA2B,CAAA;IAC3B,0CAA6B,CAAA;IAC7B,oCAAuB,CAAA;IACvB,oCAAuB,CAAA;IACvB,oDAAuC,CAAA;IACvC,wDAA2C,CAAA;IAC3C,wDAA2C,CAAA;IAC3C,8CAAiC,CAAA;IACjC,gDAAmC,CAAA;IACnC,4CAA+B,CAAA;IAC/B,oDAAuC,CAAA;IACvC,4DAA+C,CAAA;AACjD,CAAC,EAbW,SAAS,yBAAT,SAAS,QAapB"}
@@ -1,9 +0,0 @@
1
- export * from './common';
2
- export * from './controller';
3
- export * from './cors';
4
- export * from './error';
5
- export * from './multipart';
6
- export * from './request';
7
- export * from './response';
8
- export * from './sanitize';
9
- export * from './sse';
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./common"), exports);
18
- __exportStar(require("./controller"), exports);
19
- __exportStar(require("./cors"), exports);
20
- __exportStar(require("./error"), exports);
21
- __exportStar(require("./multipart"), exports);
22
- __exportStar(require("./request"), exports);
23
- __exportStar(require("./response"), exports);
24
- __exportStar(require("./sanitize"), exports);
25
- __exportStar(require("./sse"), exports);
26
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,+CAA6B;AAC7B,yCAAuB;AACvB,0CAAwB;AACxB,8CAA4B;AAC5B,4CAA0B;AAC1B,6CAA2B;AAC3B,6CAA2B;AAC3B,wCAAsB"}
@@ -1,8 +0,0 @@
1
- export interface MultipartFile {
2
- fieldname: string;
3
- filename: string;
4
- contentType: string;
5
- data: Buffer;
6
- size: number;
7
- encoding?: string;
8
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=multipart.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"multipart.js","sourceRoot":"","sources":["../../../src/types/core/multipart.ts"],"names":[],"mappings":""}
@@ -1,65 +0,0 @@
1
- import { IncomingHttpHeaders } from 'http';
2
- export type RequestSource = 'http' | 'lambda' | 'unknown';
3
- export type EventType = 'apigateway' | 'apigatewayv2' | 'alb' | 'cloudfront' | 's3' | 'sns' | 'sqs' | 'dynamodb' | 'unknown';
4
- export interface RequestOptions {
5
- method: string;
6
- requestUrl: URL;
7
- url: string;
8
- path: string;
9
- headers: Record<string, string | string[]>;
10
- query: Record<string, string | string[]>;
11
- body?: any;
12
- params: Record<string, string>;
13
- cookies: Record<string, string>;
14
- sourceIp?: string;
15
- userAgent?: string;
16
- requestId: string;
17
- stage?: string;
18
- timestamp: Date;
19
- raw?: unknown;
20
- context?: unknown;
21
- rawBody?: unknown;
22
- event?: unknown;
23
- isBase64Encoded?: boolean;
24
- source: RequestSource;
25
- }
26
- export interface Request<B = unknown, Q = Record<string, string | string[]>, P = Record<string, string>> {
27
- method: string;
28
- path: string;
29
- url: string;
30
- requestUrl: URL;
31
- headers: Record<string, string | string[]>;
32
- query: Q;
33
- body: B;
34
- params: P;
35
- cookies: Record<string, string>;
36
- sourceIp: string;
37
- userAgent: string;
38
- requestId: string;
39
- stage: string;
40
- timestamp: Date;
41
- source: RequestSource;
42
- raw: any;
43
- context: unknown;
44
- rawBody: unknown;
45
- isBase64Encoded: boolean;
46
- startTime: number;
47
- getHeader(name: string): string | string[] | undefined;
48
- getCookie(name: string): string | undefined;
49
- getQuery(name: string): string | string[] | undefined;
50
- getParam(name: string): string | undefined;
51
- isHttp(): boolean;
52
- isLambda(): boolean;
53
- getLambdaEvent(): unknown;
54
- getLambdaContext(): unknown;
55
- getHttpRequest(): IncomingHttpHeaders | undefined;
56
- setState(key: string, value: unknown): void;
57
- getState<T>(key: string): T | undefined;
58
- getAllState(): Map<string, unknown>;
59
- isSecure(): boolean;
60
- getClientIp(): string;
61
- getHost(): string;
62
- getFullUrl(): string;
63
- clone(overrides?: Partial<RequestOptions>): Request;
64
- toJSON(): Record<string, this>;
65
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=request.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/types/core/request.ts"],"names":[],"mappings":""}
@@ -1,64 +0,0 @@
1
- export type ResponseSource = 'http' | 'lambda' | 'unknown';
2
- export interface CookieOptions {
3
- maxAge?: number;
4
- expires?: Date;
5
- path?: string;
6
- domain?: string;
7
- secure?: boolean;
8
- httpOnly?: boolean;
9
- sameSite?: 'strict' | 'lax' | 'none';
10
- priority?: 'low' | 'medium' | 'high';
11
- partitioned?: boolean;
12
- }
13
- export interface ResponseOptions {
14
- statusCode?: number;
15
- headers?: Record<string, string | string[]>;
16
- body?: any;
17
- cookies?: string[];
18
- isBase64Encoded?: boolean;
19
- encoding?: BufferEncoding;
20
- }
21
- export type _Raw = Partial<{
22
- headersSent: boolean;
23
- statusCode: number;
24
- headers: {
25
- [key: string]: string | string[];
26
- };
27
- cookies: string[];
28
- end(args: unknown): unknown;
29
- requestUrl: URL;
30
- method: string;
31
- requestId: string;
32
- sourceIp: string;
33
- userAgent: string;
34
- startTime: number;
35
- }>;
36
- export interface Response {
37
- headers: Record<string, string | string[]>;
38
- data: any;
39
- cookies: string[];
40
- isBase64Encoded: boolean;
41
- source: ResponseSource;
42
- raw: _Raw;
43
- headersSent: boolean;
44
- ok: boolean;
45
- meta: {
46
- requestUrl: URL;
47
- method: string;
48
- };
49
- status: number;
50
- getStatus(): number;
51
- setHeader(name: string, value: string | string[]): this;
52
- getHeader(name: string): string | string[] | undefined;
53
- hasHeader(name: string): boolean;
54
- removeHeader(name: string): this;
55
- setHeaders(headers: Record<string, string | string[]>): this;
56
- setCookie(name: string, value: string, options?: CookieOptions): this;
57
- clearCookie(name: string, options?: CookieOptions): this;
58
- getCookies(): string[];
59
- redirect(url: string, statusCode?: number): this;
60
- end(data: unknown): unknown;
61
- error(data: unknown): this;
62
- reset(): this;
63
- toJSON(): Record<string, unknown>;
64
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=response.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/types/core/response.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- import * as Joi from 'joi';
2
- export interface SanitizerConfig {
3
- schema: Joi.Schema;
4
- action?: 'validate' | 'sanitize' | 'both';
5
- options?: Joi.ValidationOptions;
6
- stripUnknown?: boolean;
7
- type: 'headers' | 'body' | 'params' | 'query';
8
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=sanitize.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../../../src/types/core/sanitize.ts"],"names":[],"mappings":""}
@@ -1,37 +0,0 @@
1
- import { ServerResponse } from 'http';
2
- export interface SSEClient {
3
- id: string;
4
- response: ServerResponse;
5
- topics: Set<string>;
6
- data: Record<string, unknown>;
7
- connectedAt: Date;
8
- }
9
- export interface SSEMessage {
10
- event?: string;
11
- id?: string;
12
- retry?: number;
13
- data: unknown;
14
- }
15
- export interface SSEEvent {
16
- type: 'connection' | 'close';
17
- client: SSEClient;
18
- data?: unknown;
19
- }
20
- export interface ISSEServer {
21
- createConnection(res: ServerResponse): SSEClient;
22
- sendToClient(clientId: string, message: SSEMessage): boolean;
23
- broadcast(message: SSEMessage, excludeClientId?: string): void;
24
- getStats(): {
25
- clients: number;
26
- };
27
- }
28
- export interface ISSEService {
29
- initialize(sse: ISSEServer): void;
30
- sendToClient(clientId: string, message: SSEMessage): boolean;
31
- broadcast(message: SSEMessage, excludeClientId?: string): void;
32
- getStats(): {
33
- clients: number;
34
- };
35
- isAvailable(): boolean;
36
- createConnection(res: ServerResponse): SSEClient;
37
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=sse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sse.js","sourceRoot":"","sources":["../../../src/types/core/sse.ts"],"names":[],"mappings":""}
@@ -1,50 +0,0 @@
1
- import WebSocket from 'ws';
2
- export type WebSocketHandlerType = 'connection' | 'message' | 'close' | 'error';
3
- export interface WebSocketEvent {
4
- type: WebSocketHandlerType;
5
- client: WebSocketClient;
6
- message?: WebSocketMessage;
7
- data?: unknown;
8
- }
9
- export interface WebSocketClient {
10
- id: string;
11
- socket: WebSocket;
12
- topics: Set<string>;
13
- data: Record<string, unknown>;
14
- connectedAt: Date;
15
- }
16
- export interface WebSocketMessage {
17
- type: string;
18
- topic?: string;
19
- data: any;
20
- clientId?: string;
21
- }
22
- export interface WebSocketStats {
23
- clients: number;
24
- topics: Array<{
25
- topic: string;
26
- subscribers: number;
27
- }>;
28
- }
29
- export interface IWebSocketService {
30
- sendToClient(clientId: string, message: unknown): boolean;
31
- publishToTopic(topic: string, data: any, exclude?: string[]): void;
32
- broadcast(message: unknown, excludeClientId?: string): void;
33
- getStats(): {
34
- clients: number;
35
- topics: Array<{
36
- topic: string;
37
- subscribers: number;
38
- }>;
39
- };
40
- isAvailable(): boolean;
41
- }
42
- export interface IWebSocketServer {
43
- sendToClient(clientId: string, message: unknown): boolean;
44
- publishToTopic(topic: string, data: any, exclude: string[]): void;
45
- broadcast(message: unknown, excludeClientId?: string): void;
46
- getStats(): WebSocketStats;
47
- subscribeToTopic(client: WebSocketClient, topic: string): void;
48
- unsubscribeFromTopic(client: WebSocketClient, topic: string): void;
49
- registerControllers(controllers: (new (...args: any[]) => any)[]): void;
50
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/ws/index.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- import 'reflect-metadata';
2
- import { ControllerMeta, MiddlewaresMetadata, RouteMetadata } from '../../types/core/controller';
3
- export declare const generateUniqueId: () => string;
4
- export declare function reflectControllerMeta(target: object): ControllerMeta;
5
- export declare function defineControllerMeta(meta: Partial<ControllerMeta>, target: object): void;
6
- export declare function reflectMiddlewaresMetadata(target: any, propertie?: string): MiddlewaresMetadata;
7
- export declare function reflectRouteMetadata(target: object, popertie: string): RouteMetadata;
8
- export declare function defineMiddlewaresMeta(meta: Partial<MiddlewaresMetadata>, target: object): void;
9
- export declare function defineMiddlewaresMeta(meta: Partial<MiddlewaresMetadata>, target: object, propertie?: string): void;
10
- export declare function defineRouteMeta(meta: Partial<RouteMetadata>, target: object, propertie: string): void;