@clairejs/server 3.3.7 → 3.3.10

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 (81) hide show
  1. package/.prettierrc +8 -8
  2. package/README.md +616 -613
  3. package/dist/common/FileOperation.d.ts +5 -5
  4. package/dist/common/ServerModelMetadata.d.ts +10 -10
  5. package/dist/common/auth/AbstractPrincipalResolver.d.ts +4 -4
  6. package/dist/common/auth/IPrincipal.d.ts +4 -4
  7. package/dist/common/constants.d.ts +1 -1
  8. package/dist/common/request/EndpointMetadata.d.ts +40 -40
  9. package/dist/common/request/HttpData.d.ts +1 -1
  10. package/dist/common/request/HttpEndpoint.d.ts +8 -8
  11. package/dist/common/request/JobData.d.ts +1 -1
  12. package/dist/common/request/MountedEndpointInfo.d.ts +6 -6
  13. package/dist/common/request/RequestOptions.d.ts +6 -6
  14. package/dist/common/request/SocketData.d.ts +1 -1
  15. package/dist/common/request/types.d.ts +1 -1
  16. package/dist/database/adapter/AbstractDatabaseAdapter.d.ts +20 -20
  17. package/dist/database/adapter/AbstractQuery.d.ts +52 -52
  18. package/dist/database/adapter/DefaultSqlDatabaseAdapter.d.ts +17 -18
  19. package/dist/database/adapter/IQuery.d.ts +75 -75
  20. package/dist/database/adapter/IQueryProvider.d.ts +9 -9
  21. package/dist/database/adapter/aggregators.d.ts +21 -21
  22. package/dist/database/adapter/providers.d.ts +8 -8
  23. package/dist/database/decorators.d.ts +2 -2
  24. package/dist/database/migrator/AbstractDatabaseMigrator.d.ts +4 -4
  25. package/dist/database/migrator/DefaultSqlDatabaseMigrator.d.ts +27 -30
  26. package/dist/database/transaction/ITransaction.d.ts +10 -10
  27. package/dist/database/transaction/ITransactionFactory.d.ts +4 -4
  28. package/dist/database/transaction/ITransactionProvider.d.ts +4 -4
  29. package/dist/database/transaction/TransactionLink.d.ts +14 -14
  30. package/dist/database/transaction/TransactionObjectMetadata.d.ts +4 -4
  31. package/dist/database/transaction/TransactionState.d.ts +5 -5
  32. package/dist/database/util/transaction-provider.d.ts +1 -1
  33. package/dist/http/auth/AbstractHttpAuthorizationProvider.d.ts +9 -9
  34. package/dist/http/auth/AbstractRbacAuthProvider.d.ts +18 -18
  35. package/dist/http/auth/RedisRbacAuthProvider.d.ts +23 -23
  36. package/dist/http/auth/SocketRbacAuthProvider.d.ts +25 -25
  37. package/dist/http/auth/rbac.d.ts +34 -34
  38. package/dist/http/common/HttpRequest.d.ts +37 -37
  39. package/dist/http/common/HttpResponse.d.ts +25 -25
  40. package/dist/http/controller/AbstractHttpController.d.ts +10 -10
  41. package/dist/http/controller/AbstractHttpMiddleware.d.ts +5 -5
  42. package/dist/http/controller/AbstractHttpRequestHandler.d.ts +16 -16
  43. package/dist/http/controller/ControllerMetadata.d.ts +6 -6
  44. package/dist/http/controller/CrudHttpController.d.ts +56 -56
  45. package/dist/http/controller/DefaultHttpRequestHandler.d.ts +19 -19
  46. package/dist/http/decorators.d.ts +32 -32
  47. package/dist/http/file-upload/AbstractFileUploadHandler.d.ts +6 -6
  48. package/dist/http/file-upload/FileUploadHandler.d.ts +10 -10
  49. package/dist/http/file-upload/types.d.ts +3 -3
  50. package/dist/http/repository/AbstractRepository.d.ts +10 -10
  51. package/dist/http/repository/DtoRepository.d.ts +59 -59
  52. package/dist/http/repository/ICrudRepository.d.ts +28 -28
  53. package/dist/http/repository/ModelRepository.d.ts +38 -38
  54. package/dist/http/security/AbstractAccessCondition.d.ts +7 -7
  55. package/dist/http/security/access-conditions/DtoFieldValidation.d.ts +4 -4
  56. package/dist/http/security/access-conditions/FilterModelFieldAccessCondition.d.ts +4 -4
  57. package/dist/http/security/access-conditions/MaximumQueryLimit.d.ts +8 -8
  58. package/dist/index.d.ts +58 -58
  59. package/dist/index.js +1 -1
  60. package/dist/job/AbstractJobController.d.ts +2 -2
  61. package/dist/job/AbstractJobManager.d.ts +5 -5
  62. package/dist/job/Job.d.ts +4 -4
  63. package/dist/job/RedisJobManager.d.ts +6 -6
  64. package/dist/job/SnsJobManager.d.ts +6 -6
  65. package/dist/logging/FileLogMedium.d.ts +13 -13
  66. package/dist/service/AbstractCacheService.d.ts +22 -22
  67. package/dist/service/AbstractFileService.d.ts +8 -8
  68. package/dist/service/AbstractService.d.ts +8 -8
  69. package/dist/socket/AbstractServerSocket.d.ts +19 -19
  70. package/dist/socket/AbstractServerSocketManager.d.ts +41 -42
  71. package/dist/socket/AbstractSocketConnectionHandler.d.ts +6 -6
  72. package/dist/socket/AbstractSocketController.d.ts +14 -14
  73. package/dist/socket/AwsSocketManager.d.ts +32 -33
  74. package/dist/socket/IServerSocket.d.ts +16 -16
  75. package/dist/socket/LocalSocketManager.d.ts +37 -38
  76. package/dist/system/ClaireServer.d.ts +13 -13
  77. package/dist/system/ExpressWrapper.d.ts +17 -17
  78. package/dist/system/LambdaWrapper.d.ts +19 -17
  79. package/dist/system/ServerGlobalStore.d.ts +5 -5
  80. package/dist/system/errors.d.ts +14 -14
  81. package/package.json +60 -60
@@ -1,5 +1,5 @@
1
- import { Job } from "./Job";
2
- export declare abstract class AbstractJobManager {
3
- abstract publishJobs(jobs: Job[]): Promise<void>;
4
- abstract retrieveJob(): Promise<Job | undefined>;
5
- }
1
+ import { Job } from "./Job";
2
+ export declare abstract class AbstractJobManager {
3
+ abstract publishJobs(jobs: Job[]): Promise<void>;
4
+ abstract retrieveJob(): Promise<Job | undefined>;
5
+ }
package/dist/job/Job.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export interface Job {
2
- name: string;
3
- data: any;
4
- }
1
+ export interface Job {
2
+ name: string;
3
+ data: any;
4
+ }
@@ -1,6 +1,6 @@
1
- import { AbstractJobManager } from "./AbstractJobManager";
2
- import { Job } from "./Job";
3
- export declare class RedisJobManager extends AbstractJobManager {
4
- publishJobs(jobs: Job[]): Promise<void>;
5
- retrieveJob(): Promise<Job | undefined>;
6
- }
1
+ import { AbstractJobManager } from "./AbstractJobManager";
2
+ import { Job } from "./Job";
3
+ export declare class RedisJobManager extends AbstractJobManager {
4
+ publishJobs(jobs: Job[]): Promise<void>;
5
+ retrieveJob(): Promise<Job | undefined>;
6
+ }
@@ -1,6 +1,6 @@
1
- import { AbstractJobManager } from "./AbstractJobManager";
2
- import { Job } from "./Job";
3
- export declare class SnsJobManager extends AbstractJobManager {
4
- publishJobs(jobs: Job[]): Promise<void>;
5
- retrieveJob(): Promise<Job | undefined>;
6
- }
1
+ import { AbstractJobManager } from "./AbstractJobManager";
2
+ import { Job } from "./Job";
3
+ export declare class SnsJobManager extends AbstractJobManager {
4
+ publishJobs(jobs: Job[]): Promise<void>;
5
+ retrieveJob(): Promise<Job | undefined>;
6
+ }
@@ -1,13 +1,13 @@
1
- import { LogLevel, ILogMedium } from "@clairejs/core";
2
- export declare class FileLogMedium implements ILogMedium {
3
- private static readonly levels;
4
- private readonly destination;
5
- private readonly separated;
6
- constructor(config: {
7
- destination: string;
8
- separated?: boolean;
9
- });
10
- init(): Promise<void>;
11
- exit(): void;
12
- write(level: LogLevel, content: string): void;
13
- }
1
+ import { LogLevel, ILogMedium } from "@clairejs/core";
2
+ export declare class FileLogMedium implements ILogMedium {
3
+ private static readonly levels;
4
+ private readonly destination;
5
+ private readonly separated;
6
+ constructor(config: {
7
+ destination: string;
8
+ separated?: boolean;
9
+ });
10
+ init(): Promise<void>;
11
+ exit(): void;
12
+ write(level: LogLevel, content: string): void;
13
+ }
@@ -1,22 +1,22 @@
1
- export interface MutexLock {
2
- unlock(): Promise<void>;
3
- }
4
- export interface ICacheTransaction {
5
- hset(hash: string, key: string, value: any): void;
6
- set(key: string, value: any): void;
7
- del(key: string): void;
8
- hdel(hash: string, key: string): void;
9
- exec(): Promise<any[]>;
10
- }
11
- export declare abstract class AbstractCacheService {
12
- abstract hget<T>(hash: string, key: string): Promise<T | undefined>;
13
- abstract hset<T>(hash: string, key: string, value: T): Promise<void>;
14
- abstract hkeys(hash: string): Promise<string[]>;
15
- abstract get<T>(key: string): Promise<T | undefined>;
16
- abstract set<T>(key: string, value: T): Promise<void>;
17
- abstract del(key: string): Promise<void>;
18
- abstract hdel(hash: string, key: string): Promise<void>;
19
- abstract flush(): Promise<void>;
20
- abstract lock(key: string, durationMs: number, timeoutMs?: number): Promise<MutexLock>;
21
- abstract createTransaction(): ICacheTransaction;
22
- }
1
+ export interface MutexLock {
2
+ unlock(): Promise<void>;
3
+ }
4
+ export interface ICacheTransaction {
5
+ hset(hash: string, key: string, value: any): void;
6
+ set(key: string, value: any): void;
7
+ del(key: string): void;
8
+ hdel(hash: string, key: string): void;
9
+ exec(): Promise<any[]>;
10
+ }
11
+ export declare abstract class AbstractCacheService {
12
+ abstract hget<T>(hash: string, key: string): Promise<T | undefined>;
13
+ abstract hset<T>(hash: string, key: string, value: T): Promise<void>;
14
+ abstract hkeys(hash: string): Promise<string[]>;
15
+ abstract get<T>(key: string): Promise<T | undefined>;
16
+ abstract set<T>(key: string, value: T): Promise<void>;
17
+ abstract del(key: string): Promise<void>;
18
+ abstract hdel(hash: string, key: string): Promise<void>;
19
+ abstract flush(): Promise<void>;
20
+ abstract lock(key: string, durationMs: number, timeoutMs?: number): Promise<MutexLock>;
21
+ abstract createTransaction(): ICacheTransaction;
22
+ }
@@ -1,8 +1,8 @@
1
- import { FileOperation } from "../common/FileOperation";
2
- export declare abstract class AbstractFileService {
3
- abstract getFileSize(objectKey: string): Promise<number>;
4
- abstract getAccessUrl(objectKey: string, isPublic: boolean): string;
5
- abstract getPresignedUrl(operation: FileOperation, objectKey: string): string;
6
- abstract moveObject(fromObjectKey: string, toObjectKey: string): Promise<void>;
7
- abstract removeObject(objectKey: string): Promise<void>;
8
- }
1
+ import { FileOperation } from "../common/FileOperation";
2
+ export declare abstract class AbstractFileService {
3
+ abstract getFileSize(objectKey: string): Promise<number>;
4
+ abstract getAccessUrl(objectKey: string, isPublic: boolean): string;
5
+ abstract getPresignedUrl(operation: FileOperation, objectKey: string): string;
6
+ abstract moveObject(fromObjectKey: string, toObjectKey: string): Promise<void>;
7
+ abstract removeObject(objectKey: string): Promise<void>;
8
+ }
@@ -1,8 +1,8 @@
1
- import { ITransactionFactory } from "../database/transaction/ITransactionFactory";
2
- import { ITransactionProvider } from "../database/transaction/ITransactionProvider";
3
- export declare abstract class AbstractService implements ITransactionProvider, ITransactionFactory {
4
- protected readonly databaseAdapter: ITransactionFactory;
5
- constructor(databaseAdapter: ITransactionFactory);
6
- createTransaction(): Promise<import("..").ITransaction>;
7
- getCurrentTransaction(): Promise<import("..").ITransaction>;
8
- }
1
+ import { ITransactionFactory } from "../database/transaction/ITransactionFactory";
2
+ import { ITransactionProvider } from "../database/transaction/ITransactionProvider";
3
+ export declare abstract class AbstractService implements ITransactionProvider, ITransactionFactory {
4
+ protected readonly databaseAdapter: ITransactionFactory;
5
+ constructor(databaseAdapter: ITransactionFactory);
6
+ createTransaction(): Promise<import("..").ITransaction>;
7
+ getCurrentTransaction(): Promise<import("..").ITransaction>;
8
+ }
@@ -1,19 +1,19 @@
1
- import { SocketMessage } from "@clairejs/core";
2
- import { IPrincipal } from "../common/auth/IPrincipal";
3
- import { IServerSocket } from "./IServerSocket";
4
- import { ChannelInfo, ServerSocketInfo } from "./AbstractServerSocketManager";
5
- export declare abstract class AbstractServerSocket implements IServerSocket {
6
- readonly socketInfo: ServerSocketInfo;
7
- constructor(socketInfo: ServerSocketInfo);
8
- getId(): string;
9
- getAuthInfo(): IPrincipal | undefined;
10
- send(data: any, channel?: string): void;
11
- sendRaw(data: SocketMessage): void;
12
- disconnect(): void;
13
- removeChannels(channels: string[]): void;
14
- addChannels(channelInfos: ChannelInfo[]): void;
15
- getChannelsInfo(): ChannelInfo[];
16
- abstract physicSend(data: any): void;
17
- abstract physicClose(): void;
18
- abstract saveSocketInfo(): Promise<void>;
19
- }
1
+ import { SocketMessage } from "@clairejs/core";
2
+ import { IPrincipal } from "../common/auth/IPrincipal";
3
+ import { IServerSocket } from "./IServerSocket";
4
+ import { ChannelInfo, ServerSocketInfo } from "./AbstractServerSocketManager";
5
+ export declare abstract class AbstractServerSocket implements IServerSocket {
6
+ readonly socketInfo: ServerSocketInfo;
7
+ constructor(socketInfo: ServerSocketInfo);
8
+ getId(): string;
9
+ getAuthInfo(): IPrincipal | undefined;
10
+ send(data: any, channel?: string): void;
11
+ sendRaw(data: SocketMessage): void;
12
+ disconnect(): void;
13
+ removeChannels(channels: string[]): void;
14
+ addChannels(channelInfos: ChannelInfo[]): void;
15
+ getChannelsInfo(): ChannelInfo[];
16
+ abstract physicSend(data: any): void;
17
+ abstract physicClose(): void;
18
+ abstract saveSocketInfo(): Promise<void>;
19
+ }
@@ -1,42 +1,41 @@
1
- import { AbstractLogger, SocketMessage } from "@clairejs/core";
2
- import { SocketData } from "../common/request/SocketData";
3
- import { AbstractSocketConnectionHandler } from "./AbstractSocketConnectionHandler";
4
- import { IPrincipal } from "../common/auth/IPrincipal";
5
- import { AbstractServerSocket } from "./AbstractServerSocket";
6
- import { MountedEndpointInfo } from "../common/request/MountedEndpointInfo";
7
- import { AbstractHttpAuthorizationProvider } from "../http/auth/AbstractHttpAuthorizationProvider";
8
- import { IServerSocket } from "./IServerSocket";
9
- import { RedisClient } from "redis";
10
- export interface ChannelInfo {
11
- name: string;
12
- clientToServerAllowed: boolean;
13
- serverToClientAllowed: boolean;
14
- }
15
- export interface ServerSocketInfo {
16
- id: string;
17
- createdAt: number;
18
- channels: ChannelInfo[];
19
- authInfo?: IPrincipal;
20
- }
21
- export declare abstract class AbstractServerSocketManager {
22
- protected readonly requireAuthentication: boolean;
23
- protected readonly logger: AbstractLogger;
24
- protected readonly redisClient: RedisClient;
25
- protected readonly connectionHandler: AbstractSocketConnectionHandler;
26
- protected readonly authProvider: AbstractHttpAuthorizationProvider;
27
- private mountedEndpointInfo?;
28
- protected constructor(requireAuthentication: boolean, logger: AbstractLogger, redisClient: RedisClient, connectionHandler: AbstractSocketConnectionHandler, authProvider: AbstractHttpAuthorizationProvider);
29
- abstract configure(data?: any): void;
30
- protected getUniqueChannelPrefix(): string;
31
- protected formatBroadcastData(channel: string, data: any): SocketMessage;
32
- protected getUniqueChannelName(channel: string): string;
33
- protected getSocketIdsOfChannel(channel: string): Promise<string[]>;
34
- abstract createCustomChannel(channel: string): Promise<void>;
35
- addSocketToChannel(socketId: string, channelInfos: ChannelInfo[]): Promise<void>;
36
- removeSocketFromChannel(socketId: string, channels: string[]): Promise<void>;
37
- abstract getSocketsByChannel(channel: string): Promise<IServerSocket[]>;
38
- abstract broadcastToChannel(channel: string, data: any): Promise<void>;
39
- abstract getById(socketId: string): Promise<AbstractServerSocket | undefined>;
40
- handle(socketData: SocketData): Promise<void>;
41
- getMountedEndpointInfo(): Promise<MountedEndpointInfo[]>;
42
- }
1
+ import { AbstractLogger, SocketMessage } from "@clairejs/core";
2
+ import { SocketData } from "../common/request/SocketData";
3
+ import { AbstractSocketConnectionHandler } from "./AbstractSocketConnectionHandler";
4
+ import { IPrincipal } from "../common/auth/IPrincipal";
5
+ import { AbstractServerSocket } from "./AbstractServerSocket";
6
+ import { MountedEndpointInfo } from "../common/request/MountedEndpointInfo";
7
+ import { AbstractHttpAuthorizationProvider } from "../http/auth/AbstractHttpAuthorizationProvider";
8
+ import { IServerSocket } from "./IServerSocket";
9
+ import { RedisClient } from "redis";
10
+ export interface ChannelInfo {
11
+ name: string;
12
+ clientToServerAllowed: boolean;
13
+ serverToClientAllowed: boolean;
14
+ }
15
+ export interface ServerSocketInfo {
16
+ id: string;
17
+ createdAt: number;
18
+ channels: ChannelInfo[];
19
+ authInfo?: IPrincipal;
20
+ }
21
+ export declare abstract class AbstractServerSocketManager {
22
+ protected readonly requireAuthentication: boolean;
23
+ protected readonly logger: AbstractLogger;
24
+ protected readonly redisClient: RedisClient;
25
+ protected readonly connectionHandler: AbstractSocketConnectionHandler;
26
+ protected readonly authProvider: AbstractHttpAuthorizationProvider;
27
+ private mountedEndpointInfo?;
28
+ protected constructor(requireAuthentication: boolean, logger: AbstractLogger, redisClient: RedisClient, connectionHandler: AbstractSocketConnectionHandler, authProvider: AbstractHttpAuthorizationProvider);
29
+ abstract configure(data?: any): void;
30
+ protected getUniqueChannelPrefix(): string;
31
+ protected formatBroadcastData(channel: string, data: any): SocketMessage;
32
+ protected getUniqueChannelName(channel: string): string;
33
+ protected getSocketIdsOfChannel(channel: string): Promise<string[]>;
34
+ addSocketToChannel(socketId: string, channelInfos: ChannelInfo[]): Promise<void>;
35
+ removeSocketFromChannel(socketId: string, channels: string[]): Promise<void>;
36
+ abstract getSocketsByChannel(channel: string): Promise<IServerSocket[]>;
37
+ abstract broadcastToChannel(channel: string, data: any): Promise<void>;
38
+ abstract getById(socketId: string): Promise<AbstractServerSocket | undefined>;
39
+ handle(socketData: SocketData): Promise<void>;
40
+ getMountedEndpointInfo(): Promise<MountedEndpointInfo[]>;
41
+ }
@@ -1,6 +1,6 @@
1
- import { IServerSocket } from "./IServerSocket";
2
- export declare abstract class AbstractSocketConnectionHandler {
3
- abstract onSocketConnect(socket: IServerSocket): void;
4
- abstract onSocketDisconnect(socket: IServerSocket): void;
5
- abstract onMessage(socket: IServerSocket, data: any): void;
6
- }
1
+ import { IServerSocket } from "./IServerSocket";
2
+ export declare abstract class AbstractSocketConnectionHandler {
3
+ abstract onSocketConnect(socket: IServerSocket): void;
4
+ abstract onSocketDisconnect(socket: IServerSocket): void;
5
+ abstract onMessage(socket: IServerSocket, message: any, channel?: string): void;
6
+ }
@@ -1,14 +1,14 @@
1
- import { IServerSocket } from "./IServerSocket";
2
- export declare abstract class AbstractSocketController {
3
- readonly channel: string;
4
- constructor(channel: string);
5
- onChannelJoin(socket: IServerSocket): void;
6
- onChannelLeave(socket: IServerSocket): void;
7
- /**
8
- * Handle the message sent to this channel
9
- * @param socket the socket sending message
10
- * @param data the data payload being sent
11
- * @returns return false to prevent message broadcast
12
- */
13
- onMessage(socket: IServerSocket, data: any): boolean | void;
14
- }
1
+ import { IServerSocket } from "./IServerSocket";
2
+ export declare abstract class AbstractSocketController {
3
+ readonly channel: string;
4
+ constructor(channel: string);
5
+ onChannelJoin(socket: IServerSocket): void;
6
+ onChannelLeave(socket: IServerSocket): void;
7
+ /**
8
+ * Handle the message sent to this channel
9
+ * @param socket the socket sending message
10
+ * @param data the data payload being sent
11
+ * @returns return false to prevent message broadcast
12
+ */
13
+ onMessage(socket: IServerSocket, message: any): boolean | void;
14
+ }
@@ -1,33 +1,32 @@
1
- import { AbstractLogger, IInit } from "@clairejs/core";
2
- import { RedisClient } from "redis";
3
- import { AbstractHttpRequestHandler } from "../http/controller/AbstractHttpRequestHandler";
4
- import { AbstractServerSocketManager, ServerSocketInfo } from "./AbstractServerSocketManager";
5
- import { AbstractServerSocket } from "./AbstractServerSocket";
6
- import { AbstractHttpAuthorizationProvider } from "../http/auth/AbstractHttpAuthorizationProvider";
7
- import { IPrincipal } from "../common/auth/IPrincipal";
8
- import { AbstractSocketConnectionHandler } from "./AbstractSocketConnectionHandler";
9
- import { IServerSocket } from "./IServerSocket";
10
- export declare class AwsSocketManager extends AbstractServerSocketManager implements IInit {
11
- protected readonly authenticationRequired: boolean;
12
- protected readonly region: string;
13
- protected readonly socketDomainUrl: string;
14
- protected readonly redisClient: RedisClient;
15
- protected readonly connectionHandler: AbstractSocketConnectionHandler;
16
- protected readonly httpRequestHandler: AbstractHttpRequestHandler;
17
- protected readonly authorizationProvider: AbstractHttpAuthorizationProvider<IPrincipal>;
18
- protected readonly logger: AbstractLogger;
19
- private readonly apiGatewayManagement;
20
- constructor(authenticationRequired: boolean, region: string, socketDomainUrl: string, redisClient: RedisClient, connectionHandler: AbstractSocketConnectionHandler, httpRequestHandler: AbstractHttpRequestHandler, authorizationProvider: AbstractHttpAuthorizationProvider<IPrincipal>, logger: AbstractLogger);
21
- init(): Promise<void>;
22
- exit(): void;
23
- protected getSocketInfoHashKey(): string;
24
- physicSend(socketId: string, data: any): Promise<void>;
25
- configure(data?: any): void;
26
- createCustomChannel(channel: string): Promise<void>;
27
- getSocketsByChannel(channel: string): Promise<IServerSocket[]>;
28
- broadcastToChannel(channel: string, data: any): Promise<void>;
29
- addSocket(socketInfo: ServerSocketInfo, data: any): Promise<AbstractServerSocket>;
30
- removeSocket(socketId: string): Promise<void>;
31
- private getSocketBySerialized;
32
- getById(socketId: string): Promise<AbstractServerSocket | undefined>;
33
- }
1
+ import { AbstractLogger, IInit } from "@clairejs/core";
2
+ import { RedisClient } from "redis";
3
+ import { AbstractHttpRequestHandler } from "../http/controller/AbstractHttpRequestHandler";
4
+ import { AbstractServerSocketManager, ServerSocketInfo } from "./AbstractServerSocketManager";
5
+ import { AbstractServerSocket } from "./AbstractServerSocket";
6
+ import { AbstractHttpAuthorizationProvider } from "../http/auth/AbstractHttpAuthorizationProvider";
7
+ import { IPrincipal } from "../common/auth/IPrincipal";
8
+ import { AbstractSocketConnectionHandler } from "./AbstractSocketConnectionHandler";
9
+ import { IServerSocket } from "./IServerSocket";
10
+ export declare class AwsSocketManager extends AbstractServerSocketManager implements IInit {
11
+ protected readonly authenticationRequired: boolean;
12
+ protected readonly region: string;
13
+ protected readonly socketDomainUrl: string;
14
+ protected readonly redisClient: RedisClient;
15
+ protected readonly connectionHandler: AbstractSocketConnectionHandler;
16
+ protected readonly httpRequestHandler: AbstractHttpRequestHandler;
17
+ protected readonly authorizationProvider: AbstractHttpAuthorizationProvider<IPrincipal>;
18
+ protected readonly logger: AbstractLogger;
19
+ private readonly apiGatewayManagement;
20
+ constructor(authenticationRequired: boolean, region: string, socketDomainUrl: string, redisClient: RedisClient, connectionHandler: AbstractSocketConnectionHandler, httpRequestHandler: AbstractHttpRequestHandler, authorizationProvider: AbstractHttpAuthorizationProvider<IPrincipal>, logger: AbstractLogger);
21
+ init(): Promise<void>;
22
+ exit(): void;
23
+ protected getSocketInfoHashKey(): string;
24
+ physicSend(socketId: string, data: any): Promise<void>;
25
+ configure(data?: any): void;
26
+ getSocketsByChannel(channel: string): Promise<IServerSocket[]>;
27
+ broadcastToChannel(channel: string, data: any): Promise<void>;
28
+ addSocket(socketInfo: ServerSocketInfo, data: any): Promise<AbstractServerSocket>;
29
+ removeSocket(socketId: string): Promise<void>;
30
+ private getSocketBySerialized;
31
+ getById(socketId: string): Promise<AbstractServerSocket | undefined>;
32
+ }
@@ -1,16 +1,16 @@
1
- import { IPrincipal } from "../common/auth/IPrincipal";
2
- export interface IServerSocket {
3
- getId(): string;
4
- getAuthInfo(): IPrincipal | undefined;
5
- /**
6
- * Send back data to client
7
- * @param data The data to send, will be serialized using JSON.stringify
8
- */
9
- send(data: any, channel?: string): void;
10
- /**
11
- * Disconnect the socket and optionally provide the error which cause the disconnection.
12
- * The client socket will treat this error as intended reason for socket termination.
13
- * @param err The error which cause the disconnection
14
- */
15
- disconnect(err?: any): void;
16
- }
1
+ import { IPrincipal } from "../common/auth/IPrincipal";
2
+ export interface IServerSocket {
3
+ getId(): string;
4
+ getAuthInfo(): IPrincipal | undefined;
5
+ /**
6
+ * Send back data to client
7
+ * @param data The data to send, will be serialized using JSON.stringify
8
+ */
9
+ send(data: any, channel?: string): void;
10
+ /**
11
+ * Disconnect the socket and optionally provide the error which cause the disconnection.
12
+ * The client socket will treat this error as intended reason for socket termination.
13
+ * @param err The error which cause the disconnection
14
+ */
15
+ disconnect(err?: any): void;
16
+ }
@@ -1,38 +1,37 @@
1
- /// <reference types="node" />
2
- import { AbstractLogger, IInit } from "@clairejs/core";
3
- import WebSocket from "ws";
4
- import { Server } from "http";
5
- import { RedisClient } from "redis";
6
- import { AbstractServerSocketManager, ChannelInfo, ServerSocketInfo } from "./AbstractServerSocketManager";
7
- import { AbstractSocketConnectionHandler } from "./AbstractSocketConnectionHandler";
8
- import { AbstractServerSocket } from "./AbstractServerSocket";
9
- import { AbstractHttpAuthorizationProvider } from "../http/auth/AbstractHttpAuthorizationProvider";
10
- import { IServerSocket } from "./IServerSocket";
11
- export declare class LocalSocketManager extends AbstractServerSocketManager implements IInit {
12
- protected readonly authenticationRequired: boolean;
13
- protected readonly redisClient: RedisClient;
14
- protected readonly logger: AbstractLogger;
15
- protected readonly authProvider: AbstractHttpAuthorizationProvider;
16
- protected readonly connectionHandler: AbstractSocketConnectionHandler;
17
- private readonly subClient;
18
- private readonly channelSubClient;
19
- private readonly sendClient;
20
- private allSockets;
21
- constructor(authenticationRequired: boolean, redisClient: RedisClient, logger: AbstractLogger, authProvider: AbstractHttpAuthorizationProvider, connectionHandler: AbstractSocketConnectionHandler);
22
- init(): Promise<void>;
23
- exit(): void;
24
- protected getSocketChannelKeyPrefix(): string;
25
- protected getSocketInfoHashKey(): string;
26
- protected getSocketChannelKey(socketId: string): string;
27
- createCustomChannel(channel: string): Promise<void>;
28
- broadcastToChannel(channel: string, data: any): Promise<void>;
29
- addSocketToChannel(socketId: string, channelInfos: ChannelInfo[]): Promise<void>;
30
- removeSocketFromChannel(socketId: string, channels: string[]): Promise<void>;
31
- addSocket(socketInfo: ServerSocketInfo, { socket }: {
32
- socket: WebSocket;
33
- }): Promise<AbstractServerSocket>;
34
- removeSocket(socketId: string): Promise<void>;
35
- getById(socketId: string): Promise<AbstractServerSocket | undefined>;
36
- getSocketsByChannel(channel: string): Promise<IServerSocket[]>;
37
- configure(httpServer?: Server): void;
38
- }
1
+ /// <reference types="node" />
2
+ import { AbstractLogger, IInit } from "@clairejs/core";
3
+ import WebSocket from "ws";
4
+ import { Server } from "http";
5
+ import { RedisClient } from "redis";
6
+ import { AbstractServerSocketManager, ChannelInfo, ServerSocketInfo } from "./AbstractServerSocketManager";
7
+ import { AbstractSocketConnectionHandler } from "./AbstractSocketConnectionHandler";
8
+ import { AbstractServerSocket } from "./AbstractServerSocket";
9
+ import { AbstractHttpAuthorizationProvider } from "../http/auth/AbstractHttpAuthorizationProvider";
10
+ import { IServerSocket } from "./IServerSocket";
11
+ export declare class LocalSocketManager extends AbstractServerSocketManager implements IInit {
12
+ protected readonly authenticationRequired: boolean;
13
+ protected readonly redisClient: RedisClient;
14
+ protected readonly logger: AbstractLogger;
15
+ protected readonly authProvider: AbstractHttpAuthorizationProvider;
16
+ protected readonly connectionHandler: AbstractSocketConnectionHandler;
17
+ private readonly subClient;
18
+ private readonly channelSubClient;
19
+ private readonly sendClient;
20
+ private allSockets;
21
+ constructor(authenticationRequired: boolean, redisClient: RedisClient, logger: AbstractLogger, authProvider: AbstractHttpAuthorizationProvider, connectionHandler: AbstractSocketConnectionHandler);
22
+ init(): Promise<void>;
23
+ exit(): void;
24
+ protected getSocketChannelKeyPrefix(): string;
25
+ protected getSocketInfoHashKey(): string;
26
+ protected getSocketChannelKey(socketId: string): string;
27
+ broadcastToChannel(channel: string, data: any): Promise<void>;
28
+ addSocketToChannel(socketId: string, channelInfos: ChannelInfo[]): Promise<void>;
29
+ removeSocketFromChannel(socketId: string, channels: string[]): Promise<void>;
30
+ addSocket(socketInfo: ServerSocketInfo, { socket }: {
31
+ socket: WebSocket;
32
+ }): Promise<AbstractServerSocket>;
33
+ removeSocket(socketId: string): Promise<void>;
34
+ getById(socketId: string): Promise<AbstractServerSocket | undefined>;
35
+ getSocketsByChannel(channel: string): Promise<IServerSocket[]>;
36
+ configure(httpServer?: Server): void;
37
+ }
@@ -1,13 +1,13 @@
1
- import { AbstractLogger, ClaireApp } from "@clairejs/core";
2
- import { AbstractHttpRequestHandler } from "../http/controller/AbstractHttpRequestHandler";
3
- import { AbstractServerSocketManager } from "../socket/AbstractServerSocketManager";
4
- export declare class ClaireServer extends ClaireApp {
5
- readonly logger: AbstractLogger;
6
- readonly httpRequestHandler: AbstractHttpRequestHandler | undefined;
7
- readonly socketManager: AbstractServerSocketManager | undefined;
8
- private booted;
9
- constructor(logger: AbstractLogger, httpRequestHandler: AbstractHttpRequestHandler | undefined, socketManager: AbstractServerSocketManager | undefined);
10
- init(): Promise<void>;
11
- exit(): void;
12
- private stop;
13
- }
1
+ import { AbstractLogger, ClaireApp } from "@clairejs/core";
2
+ import { AbstractHttpRequestHandler } from "../http/controller/AbstractHttpRequestHandler";
3
+ import { AbstractServerSocketManager } from "../socket/AbstractServerSocketManager";
4
+ export declare class ClaireServer extends ClaireApp {
5
+ readonly logger: AbstractLogger;
6
+ readonly httpRequestHandler: AbstractHttpRequestHandler | undefined;
7
+ readonly socketManager: AbstractServerSocketManager | undefined;
8
+ private booted;
9
+ constructor(logger: AbstractLogger, httpRequestHandler: AbstractHttpRequestHandler | undefined, socketManager: AbstractServerSocketManager | undefined);
10
+ init(): Promise<void>;
11
+ exit(): void;
12
+ private stop;
13
+ }
@@ -1,17 +1,17 @@
1
- import { ClaireServer } from "./ClaireServer";
2
- interface ExpressWrapperConfig {
3
- maxBodySizeKB?: number;
4
- }
5
- export declare class ExpressWrapper {
6
- private readonly injector;
7
- private readonly socketManager?;
8
- private readonly logger;
9
- private readonly server;
10
- private readonly config?;
11
- private readonly httpRequestHandler?;
12
- private httpServer?;
13
- constructor(server: ClaireServer, config?: ExpressWrapperConfig);
14
- close(): void;
15
- listen(listenPort: number): Promise<void>;
16
- }
17
- export {};
1
+ import { ClaireServer } from "./ClaireServer";
2
+ interface ExpressWrapperConfig {
3
+ maxBodySizeKB?: number;
4
+ }
5
+ export declare class ExpressWrapper {
6
+ private readonly injector;
7
+ private readonly socketManager?;
8
+ private readonly logger;
9
+ private readonly server;
10
+ private readonly config?;
11
+ private readonly httpRequestHandler?;
12
+ private httpServer?;
13
+ constructor(server: ClaireServer, config?: ExpressWrapperConfig);
14
+ close(): void;
15
+ listen(listenPort: number): Promise<void>;
16
+ }
17
+ export {};
@@ -1,17 +1,19 @@
1
- import { RequestOptions } from "../common/request/RequestOptions";
2
- import { ClaireServer } from "./ClaireServer";
3
- interface LambdaResponse {
4
- statusCode: number;
5
- body: string;
6
- headers: any;
7
- }
8
- export declare class LambdaWrapper {
9
- private readonly injector;
10
- private readonly httpRequestHandler?;
11
- private readonly socketManager?;
12
- private readonly server;
13
- private readonly requestMapper;
14
- constructor(server: ClaireServer, requestMapper: (event: any) => RequestOptions | undefined);
15
- handler(event: any): Promise<LambdaResponse>;
16
- }
17
- export {};
1
+ import { RequestOptions } from "../common/request/RequestOptions";
2
+ import { ClaireServer } from "./ClaireServer";
3
+ interface LambdaResponse {
4
+ statusCode: number;
5
+ body: string;
6
+ headers: any;
7
+ }
8
+ export declare class LambdaWrapper {
9
+ readonly serverFactory: () => Promise<ClaireServer>;
10
+ readonly requestMapper: (event: any) => RequestOptions | undefined;
11
+ private readonly injector;
12
+ private readonly httpRequestHandler?;
13
+ private readonly socketManager?;
14
+ private _server?;
15
+ constructor(serverFactory: () => Promise<ClaireServer>, requestMapper: (event: any) => RequestOptions | undefined);
16
+ private bootServer;
17
+ handler(event: any): Promise<LambdaResponse>;
18
+ }
19
+ export {};
@@ -1,5 +1,5 @@
1
- import { CoreGlobalStore } from "@clairejs/core";
2
- import { MountedEndpointInfo } from "../common/request/MountedEndpointInfo";
3
- export interface ServerGlobalStore extends CoreGlobalStore {
4
- mountedEndpointInfo?: MountedEndpointInfo[];
5
- }
1
+ import { CoreGlobalStore } from "@clairejs/core";
2
+ import { MountedEndpointInfo } from "../common/request/MountedEndpointInfo";
3
+ export interface ServerGlobalStore extends CoreGlobalStore {
4
+ mountedEndpointInfo?: MountedEndpointInfo[];
5
+ }