polfan-server-js-client 0.0.5

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 (152) hide show
  1. package/README.md +25 -0
  2. package/dist/Client.d.ts +76 -0
  3. package/dist/ObservableInterface.d.ts +9 -0
  4. package/dist/Token.d.ts +5 -0
  5. package/dist/connections/ConnectionInterface.d.ts +17 -0
  6. package/dist/connections/WebApiConnection.d.ts +15 -0
  7. package/dist/connections/WebSocketConnection.d.ts +19 -0
  8. package/dist/dtos/Dto.d.ts +16 -0
  9. package/dist/dtos/Message.d.ts +9 -0
  10. package/dist/dtos/Permission.d.ts +7 -0
  11. package/dist/dtos/Role.d.ts +7 -0
  12. package/dist/dtos/Room.d.ts +8 -0
  13. package/dist/dtos/RoomMember.d.ts +6 -0
  14. package/dist/dtos/RoomSummary.d.ts +7 -0
  15. package/dist/dtos/Space.d.ts +8 -0
  16. package/dist/dtos/SpaceMember.d.ts +7 -0
  17. package/dist/dtos/Topic.d.ts +7 -0
  18. package/dist/dtos/User.d.ts +9 -0
  19. package/dist/dtos/UserState.d.ts +8 -0
  20. package/dist/dtos/protocol/Envelope.d.ts +7 -0
  21. package/dist/dtos/protocol/EnvelopeMeta.d.ts +6 -0
  22. package/dist/dtos/protocol/ProtocolMessage.d.ts +7 -0
  23. package/dist/dtos/protocol/ProtocolMetaData.d.ts +6 -0
  24. package/dist/dtos/protocol/commands/AssignRole.d.ts +7 -0
  25. package/dist/dtos/protocol/commands/CreateMessage.d.ts +7 -0
  26. package/dist/dtos/protocol/commands/CreateRole.d.ts +7 -0
  27. package/dist/dtos/protocol/commands/CreateRoom.d.ts +7 -0
  28. package/dist/dtos/protocol/commands/CreateSpace.d.ts +5 -0
  29. package/dist/dtos/protocol/commands/CreateTopic.d.ts +7 -0
  30. package/dist/dtos/protocol/commands/DeassignRole.d.ts +7 -0
  31. package/dist/dtos/protocol/commands/DeleteRole.d.ts +6 -0
  32. package/dist/dtos/protocol/commands/DeleteRoom.d.ts +5 -0
  33. package/dist/dtos/protocol/commands/DeleteSpace.d.ts +5 -0
  34. package/dist/dtos/protocol/commands/DeleteTopic.d.ts +5 -0
  35. package/dist/dtos/protocol/commands/GetComputedPermissions.d.ts +8 -0
  36. package/dist/dtos/protocol/commands/GetRolePermissions.d.ts +8 -0
  37. package/dist/dtos/protocol/commands/GetRoomMembers.d.ts +5 -0
  38. package/dist/dtos/protocol/commands/GetSession.d.ts +4 -0
  39. package/dist/dtos/protocol/commands/GetSpaceMembers.d.ts +5 -0
  40. package/dist/dtos/protocol/commands/GetSpaceRooms.d.ts +5 -0
  41. package/dist/dtos/protocol/commands/GetUserPermissions.d.ts +8 -0
  42. package/dist/dtos/protocol/commands/JoinRoom.d.ts +5 -0
  43. package/dist/dtos/protocol/commands/JoinSpace.d.ts +5 -0
  44. package/dist/dtos/protocol/commands/LeaveRoom.d.ts +5 -0
  45. package/dist/dtos/protocol/commands/LeaveSpace.d.ts +5 -0
  46. package/dist/dtos/protocol/commands/SetRolePermissions.d.ts +9 -0
  47. package/dist/dtos/protocol/commands/SetUserPermissions.d.ts +9 -0
  48. package/dist/dtos/protocol/events/Bye.d.ts +5 -0
  49. package/dist/dtos/protocol/events/Error.d.ts +6 -0
  50. package/dist/dtos/protocol/events/NewMessage.d.ts +6 -0
  51. package/dist/dtos/protocol/events/NewRole.d.ts +7 -0
  52. package/dist/dtos/protocol/events/NewRoom.d.ts +7 -0
  53. package/dist/dtos/protocol/events/NewTopic.d.ts +7 -0
  54. package/dist/dtos/protocol/events/Ok.d.ts +4 -0
  55. package/dist/dtos/protocol/events/Permissions.d.ts +6 -0
  56. package/dist/dtos/protocol/events/RoleDeleted.d.ts +6 -0
  57. package/dist/dtos/protocol/events/RoomDeleted.d.ts +5 -0
  58. package/dist/dtos/protocol/events/RoomJoined.d.ts +6 -0
  59. package/dist/dtos/protocol/events/RoomLeft.d.ts +5 -0
  60. package/dist/dtos/protocol/events/RoomMemberJoined.d.ts +6 -0
  61. package/dist/dtos/protocol/events/RoomMemberLeft.d.ts +5 -0
  62. package/dist/dtos/protocol/events/RoomMembers.d.ts +6 -0
  63. package/dist/dtos/protocol/events/Session.d.ts +9 -0
  64. package/dist/dtos/protocol/events/SpaceDeleted.d.ts +5 -0
  65. package/dist/dtos/protocol/events/SpaceJoined.d.ts +6 -0
  66. package/dist/dtos/protocol/events/SpaceLeft.d.ts +5 -0
  67. package/dist/dtos/protocol/events/SpaceMemberJoined.d.ts +6 -0
  68. package/dist/dtos/protocol/events/SpaceMemberLeft.d.ts +5 -0
  69. package/dist/dtos/protocol/events/SpaceMemberUpdate.d.ts +6 -0
  70. package/dist/dtos/protocol/events/SpaceMembers.d.ts +6 -0
  71. package/dist/dtos/protocol/events/SpaceRooms.d.ts +6 -0
  72. package/dist/dtos/protocol/events/TopicDeleted.d.ts +5 -0
  73. package/dist/index.d.ts +27 -0
  74. package/dist/index.js +1916 -0
  75. package/dist/index.js.map +1 -0
  76. package/dist/protocol.d.ts +7 -0
  77. package/dist/pserv-js-client.js +2 -0
  78. package/dist/pserv-js-client.js.map +1 -0
  79. package/package.json +22 -0
  80. package/src/Client.ts +166 -0
  81. package/src/ObservableInterface.ts +22 -0
  82. package/src/Token.ts +21 -0
  83. package/src/connections/ConnectionInterface.ts +20 -0
  84. package/src/connections/WebApiConnection.ts +43 -0
  85. package/src/connections/WebSocketConnection.ts +47 -0
  86. package/src/dtos/Dto.ts +45 -0
  87. package/src/dtos/Message.ts +16 -0
  88. package/src/dtos/Permission.ts +12 -0
  89. package/src/dtos/Role.ts +12 -0
  90. package/src/dtos/Room.ts +15 -0
  91. package/src/dtos/RoomMember.ts +13 -0
  92. package/src/dtos/RoomSummary.ts +12 -0
  93. package/src/dtos/Space.ts +15 -0
  94. package/src/dtos/SpaceMember.ts +14 -0
  95. package/src/dtos/Topic.ts +12 -0
  96. package/src/dtos/User.ts +15 -0
  97. package/src/dtos/UserState.ts +16 -0
  98. package/src/dtos/protocol/Envelope.ts +14 -0
  99. package/src/dtos/protocol/EnvelopeMeta.ts +11 -0
  100. package/src/dtos/protocol/commands/AssignRole.ts +12 -0
  101. package/src/dtos/protocol/commands/CreateMessage.ts +12 -0
  102. package/src/dtos/protocol/commands/CreateRole.ts +12 -0
  103. package/src/dtos/protocol/commands/CreateRoom.ts +12 -0
  104. package/src/dtos/protocol/commands/CreateSpace.ts +10 -0
  105. package/src/dtos/protocol/commands/CreateTopic.ts +12 -0
  106. package/src/dtos/protocol/commands/DeassignRole.ts +12 -0
  107. package/src/dtos/protocol/commands/DeleteRole.ts +11 -0
  108. package/src/dtos/protocol/commands/DeleteRoom.ts +10 -0
  109. package/src/dtos/protocol/commands/DeleteSpace.ts +10 -0
  110. package/src/dtos/protocol/commands/DeleteTopic.ts +10 -0
  111. package/src/dtos/protocol/commands/GetComputedPermissions.ts +13 -0
  112. package/src/dtos/protocol/commands/GetRolePermissions.ts +13 -0
  113. package/src/dtos/protocol/commands/GetRoomMembers.ts +10 -0
  114. package/src/dtos/protocol/commands/GetSession.ts +8 -0
  115. package/src/dtos/protocol/commands/GetSpaceMembers.ts +10 -0
  116. package/src/dtos/protocol/commands/GetSpaceRooms.ts +10 -0
  117. package/src/dtos/protocol/commands/GetUserPermissions.ts +13 -0
  118. package/src/dtos/protocol/commands/JoinRoom.ts +10 -0
  119. package/src/dtos/protocol/commands/JoinSpace.ts +10 -0
  120. package/src/dtos/protocol/commands/LeaveRoom.ts +10 -0
  121. package/src/dtos/protocol/commands/LeaveSpace.ts +10 -0
  122. package/src/dtos/protocol/commands/SetRolePermissions.ts +16 -0
  123. package/src/dtos/protocol/commands/SetUserPermissions.ts +16 -0
  124. package/src/dtos/protocol/events/Bye.ts +10 -0
  125. package/src/dtos/protocol/events/Error.ts +11 -0
  126. package/src/dtos/protocol/events/NewMessage.ts +13 -0
  127. package/src/dtos/protocol/events/NewRole.ts +14 -0
  128. package/src/dtos/protocol/events/NewRoom.ts +14 -0
  129. package/src/dtos/protocol/events/NewTopic.ts +14 -0
  130. package/src/dtos/protocol/events/Ok.ts +8 -0
  131. package/src/dtos/protocol/events/Permissions.ts +13 -0
  132. package/src/dtos/protocol/events/RoleDeleted.ts +11 -0
  133. package/src/dtos/protocol/events/RoomDeleted.ts +10 -0
  134. package/src/dtos/protocol/events/RoomJoined.ts +13 -0
  135. package/src/dtos/protocol/events/RoomLeft.ts +10 -0
  136. package/src/dtos/protocol/events/RoomMemberJoined.ts +13 -0
  137. package/src/dtos/protocol/events/RoomMemberLeft.ts +10 -0
  138. package/src/dtos/protocol/events/RoomMembers.ts +13 -0
  139. package/src/dtos/protocol/events/Session.ts +17 -0
  140. package/src/dtos/protocol/events/SpaceDeleted.ts +10 -0
  141. package/src/dtos/protocol/events/SpaceJoined.ts +13 -0
  142. package/src/dtos/protocol/events/SpaceLeft.ts +10 -0
  143. package/src/dtos/protocol/events/SpaceMemberJoined.ts +13 -0
  144. package/src/dtos/protocol/events/SpaceMemberLeft.ts +10 -0
  145. package/src/dtos/protocol/events/SpaceMemberUpdate.ts +13 -0
  146. package/src/dtos/protocol/events/SpaceMembers.ts +13 -0
  147. package/src/dtos/protocol/events/SpaceRooms.ts +13 -0
  148. package/src/dtos/protocol/events/TopicDeleted.ts +10 -0
  149. package/src/index.ts +26 -0
  150. package/src/protocol.ts +113 -0
  151. package/tsconfig.json +12 -0
  152. package/webpack.config.js +24 -0
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # pserv-js-client-library
2
+ JavaScript client library to handle connection with Polfan chat service with TypeScript support.
3
+
4
+ ## How to use?
5
+
6
+ ```js
7
+ // Create a client; WebSocket and WebApi connections are supported.
8
+ const connection = new PServ.connections.WebSocket({
9
+ url: 'wss://s1.polfan.pl/ws',
10
+ token: await PServ.getToken('login', 'password', 'Client Name')
11
+ });
12
+ const client = new PServ.Client(connection);
13
+
14
+ // Bind the listener for each NewMessage events.
15
+ client.on('NewMessage', ev => `${ev.message.author.nick} wrote: ${ev.message.content}`);
16
+
17
+ // Send a message to the server on connect.
18
+ connection.on('connect', () => client.exec(new PServ.data.commands.CreateMessage({
19
+ content: 'Hello world!',
20
+ topicId: 'xxxxxx-xxxxx-xxxxx-xxxxx-xxxxx'
21
+ })));
22
+
23
+ // Connect to server.
24
+ connection.connect();
25
+ ```
@@ -0,0 +1,76 @@
1
+ import { ConnectionInterface } from "./connections/ConnectionInterface";
2
+ import { EventTarget } from "./ObservableInterface";
3
+ import { JoinRoom } from "./dtos/protocol/commands/JoinRoom";
4
+ import { Dto } from "./dtos/Dto";
5
+ import { RoomJoined } from "./dtos/protocol/events/RoomJoined";
6
+ import { LeaveRoom } from "./dtos/protocol/commands/LeaveRoom";
7
+ import { RoomLeft } from "./dtos/protocol/events/RoomLeft";
8
+ import { CreateRoom } from "./dtos/protocol/commands/CreateRoom";
9
+ import { Error } from "./dtos/protocol/events/Error";
10
+ import { SpaceRooms } from "./dtos/protocol/events/SpaceRooms";
11
+ import { DeleteRoom } from "./dtos/protocol/commands/DeleteRoom";
12
+ import { RoomDeleted } from "./dtos/protocol/events/RoomDeleted";
13
+ import { GetRoomMembers } from "./dtos/protocol/commands/GetRoomMembers";
14
+ import { RoomMembers } from "./dtos/protocol/events/RoomMembers";
15
+ import { JoinSpace } from "./dtos/protocol/commands/JoinSpace";
16
+ import { SpaceJoined } from "./dtos/protocol/events/SpaceJoined";
17
+ import { LeaveSpace } from "./dtos/protocol/commands/LeaveSpace";
18
+ import { SpaceLeft } from "./dtos/protocol/events/SpaceLeft";
19
+ import { CreateSpace } from "./dtos/protocol/commands/CreateSpace";
20
+ import { DeleteSpace } from "./dtos/protocol/commands/DeleteSpace";
21
+ import { SpaceDeleted } from "./dtos/protocol/events/SpaceDeleted";
22
+ import { GetSpaceMembers } from "./dtos/protocol/commands/GetSpaceMembers";
23
+ import { SpaceMembers } from "./dtos/protocol/events/SpaceMembers";
24
+ import { GetSpaceRooms } from "./dtos/protocol/commands/GetSpaceRooms";
25
+ import { GetSession } from "./dtos/protocol/commands/GetSession";
26
+ import { Session } from "./dtos/protocol/events/Session";
27
+ import { AssignRole } from "./dtos/protocol/commands/AssignRole";
28
+ import { SpaceMemberUpdate } from "./dtos/protocol/events/SpaceMemberUpdate";
29
+ import { DeassignRole } from "./dtos/protocol/commands/DeassignRole";
30
+ import { CreateRole } from "./dtos/protocol/commands/CreateRole";
31
+ import { NewRole } from "./dtos/protocol/events/NewRole";
32
+ import { DeleteRole } from "./dtos/protocol/commands/DeleteRole";
33
+ import { RoleDeleted } from "./dtos/protocol/events/RoleDeleted";
34
+ import { SetRolePermissions } from "./dtos/protocol/commands/SetRolePermissions";
35
+ import { Permissions } from "./dtos/protocol/events/Permissions";
36
+ import { SetUserPermissions } from "./dtos/protocol/commands/SetUserPermissions";
37
+ import { CreateTopic } from "./dtos/protocol/commands/CreateTopic";
38
+ import { NewTopic } from "./dtos/protocol/events/NewTopic";
39
+ import { DeleteTopic } from "./dtos/protocol/commands/DeleteTopic";
40
+ import { TopicDeleted } from "./dtos/protocol/events/TopicDeleted";
41
+ import { CreateMessage } from "./dtos/protocol/commands/CreateMessage";
42
+ import { NewMessage } from "./dtos/protocol/events/NewMessage";
43
+ import { GetComputedPermissions } from "./dtos/protocol/commands/GetComputedPermissions";
44
+ import { GetRolePermissions } from "./dtos/protocol/commands/GetRolePermissions";
45
+ import { GetUserPermissions } from "./dtos/protocol/commands/GetUserPermissions";
46
+ declare type ArrayOfPromiseResolvers = [(value: any) => void, (reason?: any) => void];
47
+ declare type CmdResult<EventDto> = EventDto | Error;
48
+ declare type CommandsToEventsType<CommandT> = CommandT extends GetSession ? CmdResult<Session> : CommandT extends SetUserPermissions ? CmdResult<Permissions> : CommandT extends GetUserPermissions ? CmdResult<Permissions> : CommandT extends GetComputedPermissions ? CmdResult<Permissions> : CommandT extends JoinSpace ? CmdResult<SpaceJoined> : CommandT extends LeaveSpace ? CmdResult<SpaceLeft> : CommandT extends CreateSpace ? CmdResult<SpaceJoined> : CommandT extends DeleteSpace ? CmdResult<SpaceDeleted> : CommandT extends GetSpaceMembers ? CmdResult<SpaceMembers> : CommandT extends GetSpaceRooms ? CmdResult<SpaceRooms> : CommandT extends CreateRole ? CmdResult<NewRole> : CommandT extends DeleteRole ? CmdResult<RoleDeleted> : CommandT extends AssignRole ? CmdResult<SpaceMemberUpdate> : CommandT extends DeassignRole ? CmdResult<SpaceMemberUpdate> : CommandT extends SetRolePermissions ? CmdResult<Permissions> : CommandT extends GetRolePermissions ? CmdResult<Permissions> : CommandT extends JoinRoom ? CmdResult<RoomJoined> : CommandT extends LeaveRoom ? CmdResult<RoomLeft> : CommandT extends CreateRoom ? CmdResult<RoomJoined> : CommandT extends DeleteRoom ? CmdResult<RoomDeleted> : CommandT extends GetRoomMembers ? CmdResult<RoomMembers> : CommandT extends CreateTopic ? CmdResult<NewTopic> : CommandT extends DeleteTopic ? CmdResult<TopicDeleted> : CommandT extends CreateMessage ? CmdResult<NewMessage> : any;
49
+ export declare class Client extends EventTarget {
50
+ private connection;
51
+ protected commandsCount: number;
52
+ protected awaitingResponse: Map<string, ArrayOfPromiseResolvers>;
53
+ protected eventsMap: {
54
+ [x: string]: typeof Dto;
55
+ };
56
+ constructor(connection: ConnectionInterface);
57
+ /**
58
+ * Send command to server.
59
+ * @param commandPayload Command payload object.
60
+ * @param commandType Command type; if not specified, it will be guessed from the command payload class name.
61
+ * @return Promise which resolves to the event returned by server (including `Error`)
62
+ * in response to command and rejects with connection error.
63
+ */
64
+ exec<CommandT extends Dto = any>(commandPayload: CommandT, commandType?: string): Promise<CommandsToEventsType<CommandT>>;
65
+ /**
66
+ * Set custom DTO classes for events.
67
+ */
68
+ setCustomEventMap(customMap: {
69
+ [x: string]: typeof Dto;
70
+ }): this;
71
+ private onMessage;
72
+ private onDisconnect;
73
+ private createEnvelope;
74
+ private createEventByEnvelope;
75
+ }
76
+ export {};
@@ -0,0 +1,9 @@
1
+ export declare type EventHandler<T = any> = (...args: T[]) => void;
2
+ export interface ObservableInterface {
3
+ on(eventName: string, handler: EventHandler): ObservableInterface;
4
+ }
5
+ export declare abstract class EventTarget implements ObservableInterface {
6
+ protected events: Map<string, EventHandler[]>;
7
+ on(eventName: string, handler: EventHandler): EventTarget;
8
+ emit(eventName: string, ...args: any): EventTarget;
9
+ }
@@ -0,0 +1,5 @@
1
+ export interface TokenInterface {
2
+ token: string;
3
+ expiration: string;
4
+ }
5
+ export declare function getToken(login: string, password: string, clientName?: string): Promise<TokenInterface>;
@@ -0,0 +1,17 @@
1
+ import { ObservableInterface } from "../ObservableInterface";
2
+ export declare enum ConnectionState {
3
+ pending = 0,
4
+ ready = 1,
5
+ disconnected = 2
6
+ }
7
+ export declare enum ConnectionEvent {
8
+ message = "message",
9
+ connect = "connect",
10
+ disconnect = "disconnect"
11
+ }
12
+ export interface ConnectionInterface extends ObservableInterface {
13
+ state: ConnectionState;
14
+ connect(): void;
15
+ disconnect(): void;
16
+ send(data: string): void;
17
+ }
@@ -0,0 +1,15 @@
1
+ import { ConnectionInterface, ConnectionState } from "./ConnectionInterface";
2
+ import { EventTarget } from "../ObservableInterface";
3
+ export interface WebApiConnectionConfig {
4
+ token: string;
5
+ url: string;
6
+ }
7
+ export declare class WebApiConnection extends EventTarget implements ConnectionInterface {
8
+ private readonly config;
9
+ state: ConnectionState;
10
+ constructor(config: WebApiConnectionConfig);
11
+ connect(): void;
12
+ disconnect(): void;
13
+ send(data: string): void;
14
+ private onMessage;
15
+ }
@@ -0,0 +1,19 @@
1
+ import { EventTarget } from "../ObservableInterface";
2
+ import { ConnectionInterface, ConnectionState } from "./ConnectionInterface";
3
+ interface WebSocketConnectionConfig {
4
+ url: string;
5
+ token: string;
6
+ }
7
+ export declare class WebSocketConnection extends EventTarget implements ConnectionInterface {
8
+ private config;
9
+ state: ConnectionState;
10
+ private ws;
11
+ constructor(config: WebSocketConnectionConfig);
12
+ connect(): void;
13
+ disconnect(): void;
14
+ send(data: string): void;
15
+ private onMessage;
16
+ private onClose;
17
+ private onOpen;
18
+ }
19
+ export {};
@@ -0,0 +1,16 @@
1
+ export declare function cast<T extends typeof Dto>(data: any, dto: T): T;
2
+ export declare function castArray<T extends typeof Dto>(data: any[], dto: T): T[];
3
+ declare type ExcludeMethods<T> = Pick<T, {
4
+ [K in keyof T]: T[K] extends Function ? never : K;
5
+ }[keyof T]>;
6
+ export declare type DtoData<T> = {
7
+ [K in keyof ExcludeMethods<T>]: any;
8
+ };
9
+ export declare abstract class Dto {
10
+ constructor(...args: any[]);
11
+ toJson(overrideBy?: any): string;
12
+ toRaw(overrideBy?: any): DtoData<this>;
13
+ clone(overrideBy?: any): this;
14
+ protected fill(data: any, overrideBy?: any): void;
15
+ }
16
+ export {};
@@ -0,0 +1,9 @@
1
+ import { Dto, DtoData } from "./Dto";
2
+ import { User } from "./User";
3
+ export declare class Message extends Dto {
4
+ readonly id: string;
5
+ readonly author: User;
6
+ readonly topicId: string;
7
+ readonly content: string;
8
+ constructor(data: DtoData<Message>);
9
+ }
@@ -0,0 +1,7 @@
1
+ import { Dto, DtoData } from "./Dto";
2
+ export declare class Permission extends Dto {
3
+ readonly name: string;
4
+ readonly value: boolean;
5
+ readonly skip: boolean;
6
+ constructor(data: DtoData<Permission>);
7
+ }
@@ -0,0 +1,7 @@
1
+ import { Dto, DtoData } from "./Dto";
2
+ export declare class Role extends Dto {
3
+ readonly id: string;
4
+ readonly name: string;
5
+ readonly color?: string;
6
+ constructor(data: DtoData<Role>);
7
+ }
@@ -0,0 +1,8 @@
1
+ import { Dto, DtoData } from "./Dto";
2
+ import { Topic } from "./Topic";
3
+ export declare class Room extends Dto {
4
+ readonly id: string;
5
+ readonly name: string;
6
+ readonly topics: Topic[];
7
+ constructor(data: DtoData<Room>);
8
+ }
@@ -0,0 +1,6 @@
1
+ import { Dto, DtoData } from "./Dto";
2
+ import { User } from "./User";
3
+ export declare class RoomMember extends Dto {
4
+ readonly user: User;
5
+ constructor(data: DtoData<RoomMember>);
6
+ }
@@ -0,0 +1,7 @@
1
+ import { Dto, DtoData } from "./Dto";
2
+ export declare class RoomSummary extends Dto {
3
+ readonly id: string;
4
+ readonly name: string;
5
+ readonly description: string;
6
+ constructor(data: DtoData<RoomSummary>);
7
+ }
@@ -0,0 +1,8 @@
1
+ import { Dto, DtoData } from "./Dto";
2
+ import { Role } from "./Role";
3
+ export declare class Space extends Dto {
4
+ readonly id: string;
5
+ readonly name: string;
6
+ readonly roles: Role[];
7
+ constructor(data: DtoData<Space>);
8
+ }
@@ -0,0 +1,7 @@
1
+ import { Dto, DtoData } from "./Dto";
2
+ import { User } from "./User";
3
+ export declare class SpaceMember extends Dto {
4
+ readonly user: User;
5
+ readonly roles: string[];
6
+ constructor(data: DtoData<SpaceMember>);
7
+ }
@@ -0,0 +1,7 @@
1
+ import { Dto, DtoData } from "./Dto";
2
+ export declare class Topic extends Dto {
3
+ readonly id: string;
4
+ readonly name: string;
5
+ readonly description: string;
6
+ constructor(data: DtoData<Topic>);
7
+ }
@@ -0,0 +1,9 @@
1
+ import { Dto, DtoData } from "./Dto";
2
+ export declare type UserFlag = 'bot' | 'temp';
3
+ export declare class User extends Dto {
4
+ readonly id: string;
5
+ readonly nick: string;
6
+ readonly avatar: string;
7
+ readonly flags: UserFlag[];
8
+ constructor(data: DtoData<User>);
9
+ }
@@ -0,0 +1,8 @@
1
+ import { Space } from "./Space";
2
+ import { Room } from "./Room";
3
+ import { Dto, DtoData } from "./Dto";
4
+ export declare class UserState extends Dto {
5
+ readonly spaces: Space[];
6
+ readonly rooms: Room[];
7
+ constructor(data: DtoData<UserState>);
8
+ }
@@ -0,0 +1,7 @@
1
+ import { Dto, DtoData } from "../Dto";
2
+ import { EnvelopeMeta } from "./EnvelopeMeta";
3
+ export declare class Envelope<T = any> extends Dto {
4
+ readonly meta: EnvelopeMeta;
5
+ readonly data: T;
6
+ constructor(data: DtoData<Envelope>);
7
+ }
@@ -0,0 +1,6 @@
1
+ import { Dto, DtoData } from "../Dto";
2
+ export declare class EnvelopeMeta extends Dto {
3
+ readonly type: string;
4
+ readonly ref?: string;
5
+ constructor(data: DtoData<EnvelopeMeta>);
6
+ }
@@ -0,0 +1,7 @@
1
+ import { Dto, DtoData } from "../Dto";
2
+ import { ProtocolMetaData } from "./ProtocolMetaData";
3
+ export declare class ProtocolMessage<T = any> extends Dto {
4
+ readonly meta: ProtocolMetaData;
5
+ readonly data: T;
6
+ constructor(data: DtoData<ProtocolMessage>);
7
+ }
@@ -0,0 +1,6 @@
1
+ import { Dto, DtoData } from "../Dto";
2
+ export declare class ProtocolMetaData extends Dto {
3
+ readonly type: string;
4
+ readonly ref?: string;
5
+ constructor(data: DtoData<ProtocolMetaData>);
6
+ }
@@ -0,0 +1,7 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class AssignRole extends Dto {
3
+ readonly roleId: string;
4
+ readonly spaceId: string;
5
+ readonly userId: string;
6
+ constructor(data: DtoData<AssignRole>);
7
+ }
@@ -0,0 +1,7 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ import { Message } from "../../Message";
3
+ export declare class CreateMessage extends Dto {
4
+ readonly topicId: string;
5
+ readonly content: string;
6
+ constructor(data: DtoData<Message>);
7
+ }
@@ -0,0 +1,7 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class CreateRole extends Dto {
3
+ readonly spaceId: string;
4
+ readonly name: string;
5
+ readonly color: string;
6
+ constructor(data: DtoData<CreateRole>);
7
+ }
@@ -0,0 +1,7 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class CreateRoom extends Dto {
3
+ readonly spaceId: string;
4
+ readonly name: string;
5
+ readonly description: string;
6
+ constructor(data: DtoData<CreateRoom>);
7
+ }
@@ -0,0 +1,5 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class CreateSpace extends Dto {
3
+ readonly name: string;
4
+ constructor(data: DtoData<CreateSpace>);
5
+ }
@@ -0,0 +1,7 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class CreateTopic extends Dto {
3
+ readonly roomId: string;
4
+ readonly name: string;
5
+ readonly description: string;
6
+ constructor(data: DtoData<CreateTopic>);
7
+ }
@@ -0,0 +1,7 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class DeassignRole extends Dto {
3
+ readonly roleId: string;
4
+ readonly spaceId: string;
5
+ readonly userId: string;
6
+ constructor(data: DtoData<DeassignRole>);
7
+ }
@@ -0,0 +1,6 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class DeleteRole extends Dto {
3
+ readonly roleId: string;
4
+ readonly spaceId: string;
5
+ constructor(data: DtoData<DeleteRole>);
6
+ }
@@ -0,0 +1,5 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class DeleteRoom extends Dto {
3
+ readonly id: string;
4
+ constructor(data: DtoData<DeleteRoom>);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class DeleteSpace extends Dto {
3
+ readonly id: string;
4
+ constructor(data: DtoData<DeleteSpace>);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class DeleteTopic extends Dto {
3
+ readonly id: string;
4
+ constructor(data: DtoData<DeleteTopic>);
5
+ }
@@ -0,0 +1,8 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class GetComputedPermissions extends Dto {
3
+ readonly names: string[] | null | undefined;
4
+ readonly spaceId: string;
5
+ readonly roomId: string;
6
+ readonly topicId: string;
7
+ constructor(data: DtoData<GetComputedPermissions>);
8
+ }
@@ -0,0 +1,8 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class GetRolePermissions extends Dto {
3
+ readonly layer: 'Space' | 'Room' | 'Topic';
4
+ readonly layerId: string;
5
+ readonly roleId: string;
6
+ readonly names: string[] | null | undefined;
7
+ constructor(data: DtoData<GetRolePermissions>);
8
+ }
@@ -0,0 +1,5 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class GetRoomMembers extends Dto {
3
+ readonly id: string;
4
+ constructor(data: DtoData<GetRoomMembers>);
5
+ }
@@ -0,0 +1,4 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class GetSession extends Dto {
3
+ constructor(data: DtoData<GetSession>);
4
+ }
@@ -0,0 +1,5 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class GetSpaceMembers extends Dto {
3
+ readonly id: string;
4
+ constructor(data: DtoData<GetSpaceMembers>);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class GetSpaceRooms extends Dto {
3
+ readonly id: string;
4
+ constructor(data: DtoData<GetSpaceRooms>);
5
+ }
@@ -0,0 +1,8 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class GetUserPermissions extends Dto {
3
+ readonly layer: 'Global' | 'Space' | 'Room' | 'Topic';
4
+ readonly layerId: string;
5
+ readonly userId: string;
6
+ readonly names: string[] | null | undefined;
7
+ constructor(data: DtoData<GetUserPermissions>);
8
+ }
@@ -0,0 +1,5 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class JoinRoom extends Dto {
3
+ readonly id: string;
4
+ constructor(data: DtoData<JoinRoom>);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class JoinSpace extends Dto {
3
+ readonly id: string;
4
+ constructor(data: DtoData<JoinSpace>);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class LeaveRoom extends Dto {
3
+ readonly id: string;
4
+ constructor(data: DtoData<LeaveRoom>);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class LeaveSpace extends Dto {
3
+ readonly id: string;
4
+ constructor(data: DtoData<LeaveSpace>);
5
+ }
@@ -0,0 +1,9 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ import { Permission } from "../../Permission";
3
+ export declare class SetRolePermissions extends Dto {
4
+ readonly permissions: Permission[];
5
+ readonly layer: 'Space' | 'Room' | 'Topic';
6
+ readonly layerId: string;
7
+ readonly roleId: string;
8
+ constructor(data: DtoData<SetRolePermissions>);
9
+ }
@@ -0,0 +1,9 @@
1
+ import { Permission } from "../../Permission";
2
+ import { Dto, DtoData } from "../../Dto";
3
+ export declare class SetUserPermissions extends Dto {
4
+ readonly permissions: Permission[];
5
+ readonly layer: 'Global' | 'Space' | 'Room' | 'Topic';
6
+ readonly layerId: string;
7
+ readonly userId: string;
8
+ constructor(data: DtoData<SetUserPermissions>);
9
+ }
@@ -0,0 +1,5 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class Bye extends Dto {
3
+ readonly reason: string;
4
+ constructor(data: DtoData<Bye>);
5
+ }
@@ -0,0 +1,6 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class Error extends Dto {
3
+ readonly code: string;
4
+ readonly message: string;
5
+ constructor(data: DtoData<Error>);
6
+ }
@@ -0,0 +1,6 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ import { Message } from "../../Message";
3
+ export declare class NewMessage extends Dto {
4
+ readonly message: Message;
5
+ constructor(data: DtoData<NewMessage>);
6
+ }
@@ -0,0 +1,7 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ import { Role } from "../../Role";
3
+ export declare class NewRole extends Dto {
4
+ readonly spaceId: string;
5
+ readonly role: Role;
6
+ constructor(data: DtoData<NewRole>);
7
+ }
@@ -0,0 +1,7 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ import { RoomSummary } from "../../RoomSummary";
3
+ export declare class NewRoom extends Dto {
4
+ readonly summary: RoomSummary;
5
+ readonly spaceId: string;
6
+ constructor(data: DtoData<NewRoom>);
7
+ }
@@ -0,0 +1,7 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ import { Topic } from "../../Topic";
3
+ export declare class NewTopic extends Dto {
4
+ readonly roomId: string;
5
+ readonly topic: Topic;
6
+ constructor(data: DtoData<NewTopic>);
7
+ }
@@ -0,0 +1,4 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class Ok extends Dto {
3
+ constructor(data: DtoData<Ok>);
4
+ }
@@ -0,0 +1,6 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ import { Permission } from "../../Permission";
3
+ export declare class Permissions extends Dto {
4
+ readonly permissions: Permission[];
5
+ constructor(data: DtoData<Permissions>);
6
+ }
@@ -0,0 +1,6 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class RoleDeleted extends Dto {
3
+ readonly roleId: string;
4
+ readonly spaceId: string;
5
+ constructor(data: DtoData<RoleDeleted>);
6
+ }
@@ -0,0 +1,5 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class RoomDeleted extends Dto {
3
+ readonly id: string;
4
+ constructor(data: DtoData<RoomDeleted>);
5
+ }
@@ -0,0 +1,6 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ import { Room } from "../../Room";
3
+ export declare class RoomJoined extends Dto {
4
+ readonly room: Room;
5
+ constructor(data: DtoData<RoomJoined>);
6
+ }
@@ -0,0 +1,5 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ export declare class RoomLeft extends Dto {
3
+ readonly id: string;
4
+ constructor(data: DtoData<RoomLeft>);
5
+ }
@@ -0,0 +1,6 @@
1
+ import { Dto, DtoData } from "../../Dto";
2
+ import { RoomMember } from "../../RoomMember";
3
+ export declare class RoomMemberJoined extends Dto {
4
+ readonly member: RoomMember;
5
+ constructor(data: DtoData<RoomMemberJoined>);
6
+ }