polfan-server-js-client 0.0.96 → 0.1.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 (154) hide show
  1. package/build/index.js +1 -1
  2. package/build/index.js.map +1 -1
  3. package/build/types/AbstractClient.d.ts +78 -0
  4. package/build/types/EventTarget.d.ts +16 -0
  5. package/build/types/IndexedObjectCollection.d.ts +53 -0
  6. package/build/types/WebApiClient.d.ts +30 -0
  7. package/build/types/WebSocketClient.d.ts +36 -0
  8. package/build/types/WebSocketStateTracker.d.ts +54 -0
  9. package/build/types/index.d.ts +4 -68
  10. package/package.json +65 -64
  11. package/src/AbstractClient.ts +174 -0
  12. package/src/EventTarget.ts +39 -0
  13. package/src/IndexedObjectCollection.ts +209 -0
  14. package/src/{connections/WebApiConnection.ts → WebApiClient.ts} +94 -81
  15. package/src/WebSocketClient.ts +125 -0
  16. package/src/WebSocketStateTracker.ts +326 -0
  17. package/src/index.ts +13 -123
  18. package/build/types/Client.d.ts +0 -107
  19. package/build/types/ObservableInterface.d.ts +0 -16
  20. package/build/types/connections/ConnectionAssets.d.ts +0 -17
  21. package/build/types/connections/RestApiConnection.d.ts +0 -14
  22. package/build/types/connections/WebApiConnection.d.ts +0 -21
  23. package/build/types/connections/WebSocketConnection.d.ts +0 -22
  24. package/build/types/dtos/Dto.d.ts +0 -16
  25. package/build/types/dtos/Message.d.ts +0 -9
  26. package/build/types/dtos/Permission.d.ts +0 -7
  27. package/build/types/dtos/Role.d.ts +0 -7
  28. package/build/types/dtos/Room.d.ts +0 -10
  29. package/build/types/dtos/RoomMember.d.ts +0 -6
  30. package/build/types/dtos/RoomSummary.d.ts +0 -7
  31. package/build/types/dtos/Space.d.ts +0 -8
  32. package/build/types/dtos/SpaceMember.d.ts +0 -7
  33. package/build/types/dtos/Topic.d.ts +0 -7
  34. package/build/types/dtos/User.d.ts +0 -9
  35. package/build/types/dtos/UserState.d.ts +0 -8
  36. package/build/types/dtos/protocol/Envelope.d.ts +0 -7
  37. package/build/types/dtos/protocol/commands/AssignRole.d.ts +0 -7
  38. package/build/types/dtos/protocol/commands/CreateMessage.d.ts +0 -7
  39. package/build/types/dtos/protocol/commands/CreateRole.d.ts +0 -7
  40. package/build/types/dtos/protocol/commands/CreateRoom.d.ts +0 -7
  41. package/build/types/dtos/protocol/commands/CreateSpace.d.ts +0 -5
  42. package/build/types/dtos/protocol/commands/CreateTopic.d.ts +0 -7
  43. package/build/types/dtos/protocol/commands/DeassignRole.d.ts +0 -7
  44. package/build/types/dtos/protocol/commands/DeleteRole.d.ts +0 -6
  45. package/build/types/dtos/protocol/commands/DeleteRoom.d.ts +0 -5
  46. package/build/types/dtos/protocol/commands/DeleteSpace.d.ts +0 -5
  47. package/build/types/dtos/protocol/commands/DeleteTopic.d.ts +0 -5
  48. package/build/types/dtos/protocol/commands/GetComputedPermissions.d.ts +0 -8
  49. package/build/types/dtos/protocol/commands/GetRolePermissions.d.ts +0 -8
  50. package/build/types/dtos/protocol/commands/GetRoomMembers.d.ts +0 -5
  51. package/build/types/dtos/protocol/commands/GetSession.d.ts +0 -4
  52. package/build/types/dtos/protocol/commands/GetSpaceMembers.d.ts +0 -5
  53. package/build/types/dtos/protocol/commands/GetSpaceRooms.d.ts +0 -5
  54. package/build/types/dtos/protocol/commands/GetUserPermissions.d.ts +0 -8
  55. package/build/types/dtos/protocol/commands/JoinRoom.d.ts +0 -5
  56. package/build/types/dtos/protocol/commands/JoinSpace.d.ts +0 -5
  57. package/build/types/dtos/protocol/commands/LeaveRoom.d.ts +0 -5
  58. package/build/types/dtos/protocol/commands/LeaveSpace.d.ts +0 -5
  59. package/build/types/dtos/protocol/commands/SetRolePermissions.d.ts +0 -9
  60. package/build/types/dtos/protocol/commands/SetUserPermissions.d.ts +0 -9
  61. package/build/types/dtos/protocol/events/Bye.d.ts +0 -5
  62. package/build/types/dtos/protocol/events/Error.d.ts +0 -6
  63. package/build/types/dtos/protocol/events/NewMessage.d.ts +0 -6
  64. package/build/types/dtos/protocol/events/NewRole.d.ts +0 -7
  65. package/build/types/dtos/protocol/events/NewRoom.d.ts +0 -7
  66. package/build/types/dtos/protocol/events/NewTopic.d.ts +0 -7
  67. package/build/types/dtos/protocol/events/Ok.d.ts +0 -4
  68. package/build/types/dtos/protocol/events/Permissions.d.ts +0 -6
  69. package/build/types/dtos/protocol/events/RoleDeleted.d.ts +0 -6
  70. package/build/types/dtos/protocol/events/RoomDeleted.d.ts +0 -5
  71. package/build/types/dtos/protocol/events/RoomJoined.d.ts +0 -6
  72. package/build/types/dtos/protocol/events/RoomLeft.d.ts +0 -5
  73. package/build/types/dtos/protocol/events/RoomMemberJoined.d.ts +0 -6
  74. package/build/types/dtos/protocol/events/RoomMemberLeft.d.ts +0 -5
  75. package/build/types/dtos/protocol/events/RoomMembers.d.ts +0 -6
  76. package/build/types/dtos/protocol/events/Session.d.ts +0 -9
  77. package/build/types/dtos/protocol/events/SpaceDeleted.d.ts +0 -5
  78. package/build/types/dtos/protocol/events/SpaceJoined.d.ts +0 -6
  79. package/build/types/dtos/protocol/events/SpaceLeft.d.ts +0 -5
  80. package/build/types/dtos/protocol/events/SpaceMemberJoined.d.ts +0 -6
  81. package/build/types/dtos/protocol/events/SpaceMemberLeft.d.ts +0 -5
  82. package/build/types/dtos/protocol/events/SpaceMemberUpdate.d.ts +0 -6
  83. package/build/types/dtos/protocol/events/SpaceMembers.d.ts +0 -6
  84. package/build/types/dtos/protocol/events/SpaceRooms.d.ts +0 -6
  85. package/build/types/dtos/protocol/events/TopicDeleted.d.ts +0 -5
  86. package/build/types/protocol.d.ts +0 -102
  87. package/src/Client.ts +0 -267
  88. package/src/ObservableInterface.ts +0 -39
  89. package/src/connections/ConnectionAssets.ts +0 -20
  90. package/src/connections/RestApiConnection.ts +0 -47
  91. package/src/connections/WebSocketConnection.ts +0 -103
  92. package/src/dtos/Dto.ts +0 -45
  93. package/src/dtos/Message.ts +0 -16
  94. package/src/dtos/Permission.ts +0 -12
  95. package/src/dtos/Role.ts +0 -12
  96. package/src/dtos/Room.ts +0 -17
  97. package/src/dtos/RoomMember.ts +0 -13
  98. package/src/dtos/RoomSummary.ts +0 -12
  99. package/src/dtos/Space.ts +0 -15
  100. package/src/dtos/SpaceMember.ts +0 -14
  101. package/src/dtos/Topic.ts +0 -12
  102. package/src/dtos/User.ts +0 -15
  103. package/src/dtos/UserState.ts +0 -16
  104. package/src/dtos/protocol/Envelope.ts +0 -12
  105. package/src/dtos/protocol/commands/AssignRole.ts +0 -12
  106. package/src/dtos/protocol/commands/CreateMessage.ts +0 -12
  107. package/src/dtos/protocol/commands/CreateRole.ts +0 -12
  108. package/src/dtos/protocol/commands/CreateRoom.ts +0 -12
  109. package/src/dtos/protocol/commands/CreateSpace.ts +0 -10
  110. package/src/dtos/protocol/commands/CreateTopic.ts +0 -12
  111. package/src/dtos/protocol/commands/DeassignRole.ts +0 -12
  112. package/src/dtos/protocol/commands/DeleteRole.ts +0 -11
  113. package/src/dtos/protocol/commands/DeleteRoom.ts +0 -10
  114. package/src/dtos/protocol/commands/DeleteSpace.ts +0 -10
  115. package/src/dtos/protocol/commands/DeleteTopic.ts +0 -10
  116. package/src/dtos/protocol/commands/GetComputedPermissions.ts +0 -13
  117. package/src/dtos/protocol/commands/GetRolePermissions.ts +0 -13
  118. package/src/dtos/protocol/commands/GetRoomMembers.ts +0 -10
  119. package/src/dtos/protocol/commands/GetSession.ts +0 -8
  120. package/src/dtos/protocol/commands/GetSpaceMembers.ts +0 -10
  121. package/src/dtos/protocol/commands/GetSpaceRooms.ts +0 -10
  122. package/src/dtos/protocol/commands/GetUserPermissions.ts +0 -13
  123. package/src/dtos/protocol/commands/JoinRoom.ts +0 -10
  124. package/src/dtos/protocol/commands/JoinSpace.ts +0 -10
  125. package/src/dtos/protocol/commands/LeaveRoom.ts +0 -10
  126. package/src/dtos/protocol/commands/LeaveSpace.ts +0 -10
  127. package/src/dtos/protocol/commands/SetRolePermissions.ts +0 -16
  128. package/src/dtos/protocol/commands/SetUserPermissions.ts +0 -16
  129. package/src/dtos/protocol/events/Bye.ts +0 -10
  130. package/src/dtos/protocol/events/Error.ts +0 -11
  131. package/src/dtos/protocol/events/NewMessage.ts +0 -13
  132. package/src/dtos/protocol/events/NewRole.ts +0 -14
  133. package/src/dtos/protocol/events/NewRoom.ts +0 -14
  134. package/src/dtos/protocol/events/NewTopic.ts +0 -14
  135. package/src/dtos/protocol/events/Ok.ts +0 -8
  136. package/src/dtos/protocol/events/Permissions.ts +0 -13
  137. package/src/dtos/protocol/events/RoleDeleted.ts +0 -11
  138. package/src/dtos/protocol/events/RoomDeleted.ts +0 -10
  139. package/src/dtos/protocol/events/RoomJoined.ts +0 -13
  140. package/src/dtos/protocol/events/RoomLeft.ts +0 -10
  141. package/src/dtos/protocol/events/RoomMemberJoined.ts +0 -13
  142. package/src/dtos/protocol/events/RoomMemberLeft.ts +0 -10
  143. package/src/dtos/protocol/events/RoomMembers.ts +0 -13
  144. package/src/dtos/protocol/events/Session.ts +0 -17
  145. package/src/dtos/protocol/events/SpaceDeleted.ts +0 -10
  146. package/src/dtos/protocol/events/SpaceJoined.ts +0 -13
  147. package/src/dtos/protocol/events/SpaceLeft.ts +0 -10
  148. package/src/dtos/protocol/events/SpaceMemberJoined.ts +0 -13
  149. package/src/dtos/protocol/events/SpaceMemberLeft.ts +0 -10
  150. package/src/dtos/protocol/events/SpaceMemberUpdate.ts +0 -13
  151. package/src/dtos/protocol/events/SpaceMembers.ts +0 -13
  152. package/src/dtos/protocol/events/SpaceRooms.ts +0 -13
  153. package/src/dtos/protocol/events/TopicDeleted.ts +0 -10
  154. package/src/protocol.ts +0 -113
@@ -1,20 +0,0 @@
1
- import {ObservableInterface} from "../ObservableInterface";
2
-
3
- export enum ChatConnectionEvent {
4
- message = 'message',
5
- destroy = 'destroy',
6
- ready = 'ready',
7
- error = 'error',
8
- }
9
-
10
- export interface ConnectionOptionsInterface {
11
- url: string;
12
- token?: string;
13
- temporaryNick?: string;
14
- }
15
-
16
- export interface ChatConnectionInterface extends ObservableInterface {
17
- init(): void;
18
- send(data: any): void;
19
- destroy(): void;
20
- }
@@ -1,47 +0,0 @@
1
- import {ConnectionOptionsInterface} from "./ConnectionAssets";
2
-
3
- export interface RestResponseInterface {
4
- ok: boolean;
5
- status: number;
6
- data: any;
7
- }
8
-
9
- export class RestApiConnection {
10
- public constructor(protected options: ConnectionOptionsInterface) {
11
- if (this.options.temporaryNick) {
12
- throw new Error('Temporary nick is not supported authentication method for REST API');
13
- }
14
- }
15
-
16
- public async send(method: string, uri: string, data: any = undefined): Promise<RestResponseInterface> {
17
- const headers: any = {
18
- 'Content-Type': 'application/json',
19
- Accept: 'application/json'
20
- };
21
-
22
- if (this.options.token) {
23
- headers.Authorization = `Bearer ${this.options.token}`;
24
- }
25
-
26
- const body = data === undefined ? undefined : JSON.stringify(data);
27
- const result = await fetch(this.getUrl(uri), {method, body, headers});
28
-
29
- return {
30
- ok: result.ok,
31
- status: result.status,
32
- data: await result.json(),
33
- };
34
- }
35
-
36
- protected getUrl(uri: string): string {
37
- return this.removeEndingSlash(this.options.url) + '/' + this.removeStartingSlash(uri);
38
- }
39
-
40
- private removeStartingSlash(text: string): string {
41
- return text.replace(/^\/+/, '');
42
- }
43
-
44
- private removeEndingSlash(text: string): string {
45
- return text.replace(/\/+$/, '');
46
- }
47
- }
@@ -1,103 +0,0 @@
1
- import {EventTarget} from "../ObservableInterface";
2
- import {
3
- ChatConnectionEvent,
4
- ChatConnectionInterface,
5
- ConnectionOptionsInterface,
6
- } from "./ConnectionAssets";
7
-
8
- export interface WebSocketConnectionInterface extends ConnectionOptionsInterface {
9
- awaitQueueSendDelayMs?: number;
10
- connectingTimeoutMs?: number;
11
- }
12
-
13
- export class WebSocketConnection extends EventTarget implements ChatConnectionInterface {
14
- protected ws: WebSocket|null = null;
15
- protected sendQueue: any[] = [];
16
- protected connectingTimeoutId: any;
17
- protected authenticated: boolean;
18
-
19
- public constructor(private readonly options: WebSocketConnectionInterface) {
20
- super();
21
- if (!this.options.token && !this.options.temporaryNick) {
22
- throw new Error('Token or temporary nick is required');
23
- }
24
- }
25
-
26
- public init() {
27
- if (this.ws) {
28
- this.destroy();
29
- }
30
- this.connect();
31
- }
32
-
33
- public send(data: any): void {
34
- if (!this.ws || this.ws.readyState === this.ws.CLOSED) {
35
- this.connect();
36
- }
37
- if (this.ws.readyState === this.ws.CONNECTING || !this.authenticated) {
38
- this.sendQueue.push(data);
39
- return;
40
- }
41
- const dataJson = JSON.stringify(data);
42
- if (this.ws.readyState !== this.ws.OPEN) {
43
- this.emit(ChatConnectionEvent.error, new Error(`Cannot send ${dataJson}; invalid connection state`));
44
- return;
45
- }
46
- this.ws.send(dataJson);
47
- }
48
-
49
- public destroy(): void {
50
- this.sendQueue = [];
51
- this.ws?.close();
52
- this.ws = null;
53
- }
54
-
55
- private connect(): void {
56
- this.authenticated = false;
57
- const authString = this.options.token ? `token=${this.options.token}` : `nick=${this.options.temporaryNick}`;
58
- this.ws = new WebSocket(`${this.options.url}?${authString}`);
59
- this.ws.onclose = ev => this.onClose(ev);
60
- this.ws.onmessage = ev => this.onMessage(ev);
61
- this.connectingTimeoutId = setTimeout(
62
- () => this.triggerConnectionTimeout(),
63
- this.options.connectingTimeoutMs ?? 10000
64
- );
65
- }
66
-
67
- private onMessage(event: MessageEvent): void {
68
- const payload = JSON.parse(event.data);
69
- // Login successfully
70
- if (!this.authenticated && payload.type && payload.type !== 'Error') {
71
- this.authenticated = true;
72
- this.emit(ChatConnectionEvent.ready);
73
- this.sendFromQueue();
74
- }
75
- this.emit(ChatConnectionEvent.message, payload);
76
- }
77
-
78
- private onClose(event: CloseEvent): void {
79
- clearTimeout(this.connectingTimeoutId);
80
- const reconnect = event.code !== 1000; // Connection was closed because of error
81
- if (reconnect) {
82
- this.connect();
83
- }
84
- this.emit(ChatConnectionEvent.destroy, reconnect);
85
- }
86
-
87
- private sendFromQueue(): void {
88
- // Send awaiting data to server
89
- let lastDelay = 0;
90
- for (const dataIndex in this.sendQueue) {
91
- const data = this.sendQueue[dataIndex];
92
- setTimeout(() => this.send(data), lastDelay);
93
- lastDelay += this.options.awaitQueueSendDelayMs ?? 500;
94
- }
95
- this.sendQueue = [];
96
- clearTimeout(this.connectingTimeoutId);
97
- }
98
-
99
- private triggerConnectionTimeout(): void {
100
- this.destroy();
101
- this.emit(ChatConnectionEvent.error, new Error('Connection timeout'));
102
- }
103
- }
package/src/dtos/Dto.ts DELETED
@@ -1,45 +0,0 @@
1
- export function cast<T extends typeof Dto>(data: any, dto: T): T|undefined {
2
- if (data instanceof dto) {
3
- return data as any;
4
- }
5
- return new (dto as any)(data);
6
- }
7
-
8
- export function castArray<T extends typeof Dto>(data: any[], dto: T): T[] {
9
- if (!Array.isArray(data)) throw new Error(`Passed data is not an array of ${dto.name}`);
10
- return data.map(item => cast(item, dto));
11
- }
12
-
13
- type ExcludeMethods<T> = Pick<T, { [K in keyof T]: T[K] extends Function ? never : K }[keyof T]>;
14
- export type DtoData<T> = { [K in keyof ExcludeMethods<T>]: any };
15
-
16
- export abstract class Dto {
17
- public constructor(...args: any[]) {
18
- }
19
-
20
- public toJson(overrideBy: any = {}): string {
21
- return JSON.stringify(this.toRaw(overrideBy));
22
- }
23
-
24
- public toRaw(overrideBy: any = {}): DtoData<this> {
25
- const object: {[key: string]: any} = {};
26
- Object.keys(this).forEach(key => {
27
- if (overrideBy.hasOwnProperty(key)) {
28
- object[key] = overrideBy[key];
29
- } else if ((this as any)[key] instanceof Dto) {
30
- object[key] = (this as any)[key].toRaw();
31
- } else {
32
- object[key] = (this as any)[key]
33
- }
34
- });
35
- return object as DtoData<this>;
36
- }
37
-
38
- public clone(overrideBy: any = {}): this {
39
- return new (this.constructor as any)(this.toRaw(overrideBy));
40
- }
41
-
42
- protected fill(data: any, overrideBy: any = {}) {
43
- Object.assign(this, {...data, ...overrideBy});
44
- }
45
- }
@@ -1,16 +0,0 @@
1
- import {cast, Dto, DtoData} from "./Dto";
2
- import {User} from "./User";
3
-
4
- export class Message extends Dto {
5
- public readonly id: string;
6
- public readonly author: User;
7
- public readonly topicId: string;
8
- public readonly content: string;
9
-
10
- public constructor(data: DtoData<Message>) {
11
- super();
12
- this.fill(data, {
13
- author: cast(data.author, User),
14
- });
15
- }
16
- }
@@ -1,12 +0,0 @@
1
- import {Dto, DtoData} from "./Dto";
2
-
3
- export class Permission extends Dto {
4
- public readonly name: string;
5
- public readonly value: boolean;
6
- public readonly skip: boolean;
7
-
8
- public constructor(data: DtoData<Permission>) {
9
- super(data);
10
- this.fill(data);
11
- }
12
- }
package/src/dtos/Role.ts DELETED
@@ -1,12 +0,0 @@
1
- import {Dto, DtoData} from "./Dto";
2
-
3
- export class Role extends Dto {
4
- public readonly id: string;
5
- public readonly name: string;
6
- public readonly color?: string;
7
-
8
- public constructor(data: DtoData<Role>) {
9
- super();
10
- this.fill(data);
11
- }
12
- }
package/src/dtos/Room.ts DELETED
@@ -1,17 +0,0 @@
1
- import {castArray, Dto, DtoData} from "./Dto";
2
- import {Topic} from "./Topic";
3
-
4
- export class Room extends Dto {
5
- public readonly id: string;
6
- public readonly spaceId: string|null;
7
- public readonly name: string;
8
- public readonly description: string;
9
- public readonly topics: Topic[];
10
-
11
- public constructor(data: DtoData<Room>) {
12
- super();
13
- this.fill(data, {
14
- topics: castArray(data.topics, Topic),
15
- });
16
- }
17
- }
@@ -1,13 +0,0 @@
1
- import {cast, Dto, DtoData} from "./Dto";
2
- import {User} from "./User";
3
-
4
- export class RoomMember extends Dto {
5
- public readonly user: User;
6
-
7
- public constructor(data: DtoData<RoomMember>) {
8
- super();
9
- this.fill(data, {
10
- user: cast(data.user, User),
11
- });
12
- }
13
- }
@@ -1,12 +0,0 @@
1
- import {Dto, DtoData} from "./Dto";
2
-
3
- export class RoomSummary extends Dto {
4
- public readonly id: string;
5
- public readonly name: string;
6
- public readonly description: string;
7
-
8
- public constructor(data: DtoData<RoomSummary>) {
9
- super();
10
- this.fill(data);
11
- }
12
- }
package/src/dtos/Space.ts DELETED
@@ -1,15 +0,0 @@
1
- import {castArray, Dto, DtoData} from "./Dto";
2
- import {Role} from "./Role";
3
-
4
- export class Space extends Dto {
5
- public readonly id: string;
6
- public readonly name: string;
7
- public readonly roles: Role[];
8
-
9
- public constructor(data: DtoData<Space>) {
10
- super();
11
- this.fill(data, {
12
- roles: castArray(data.roles, Role)
13
- });
14
- }
15
- }
@@ -1,14 +0,0 @@
1
- import {castArray, Dto, DtoData} from "./Dto";
2
- import {User} from "./User";
3
-
4
- export class SpaceMember extends Dto {
5
- public readonly user: User;
6
- public readonly roles: string[];
7
-
8
- public constructor(data: DtoData<SpaceMember>) {
9
- super();
10
- this.fill(data, {
11
- user: castArray(data.user, User),
12
- });
13
- }
14
- }
package/src/dtos/Topic.ts DELETED
@@ -1,12 +0,0 @@
1
- import {Dto, DtoData} from "./Dto";
2
-
3
- export class Topic extends Dto {
4
- public readonly id: string;
5
- public readonly name: string;
6
- public readonly description: string;
7
-
8
- public constructor(data: DtoData<Topic>) {
9
- super();
10
- this.fill(data);
11
- }
12
- }
package/src/dtos/User.ts DELETED
@@ -1,15 +0,0 @@
1
- import {Dto, DtoData} from "./Dto";
2
-
3
- export type UserFlag = 'bot' | 'temp';
4
-
5
- export class User extends Dto {
6
- public readonly id: string;
7
- public readonly nick: string;
8
- public readonly avatar: string;
9
- public readonly flags: UserFlag[];
10
-
11
- public constructor(data: DtoData<User>) {
12
- super();
13
- this.fill(data);
14
- }
15
- }
@@ -1,16 +0,0 @@
1
- import {Space} from "./Space";
2
- import {Room} from "./Room";
3
- import {castArray, Dto, DtoData} from "./Dto";
4
-
5
- export class UserState extends Dto {
6
- public readonly spaces: Space[];
7
- public readonly rooms: Room[];
8
-
9
- public constructor(data: DtoData<UserState>) {
10
- super();
11
- this.fill(data, {
12
- spaces: castArray(data.spaces, Space),
13
- rooms: castArray(data.rooms, Room),
14
- });
15
- }
16
- }
@@ -1,12 +0,0 @@
1
- import {Dto, DtoData} from "../Dto";
2
-
3
- export class Envelope<T = any> extends Dto {
4
- public readonly type: string;
5
- public readonly ref?: string;
6
- public readonly data: T;
7
-
8
- public constructor(data: DtoData<Envelope>) {
9
- super();
10
- this.fill(data);
11
- }
12
- }
@@ -1,12 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class AssignRole extends Dto {
4
- public readonly roleId: string;
5
- public readonly spaceId: string;
6
- public readonly userId: string;
7
-
8
- public constructor(data: DtoData<AssignRole>) {
9
- super();
10
- this.fill(data);
11
- }
12
- }
@@ -1,12 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
- import {Message} from "../../Message";
3
-
4
- export class CreateMessage extends Dto {
5
- public readonly topicId: string;
6
- public readonly content: string;
7
-
8
- public constructor(data: DtoData<Message>) {
9
- super();
10
- this.fill(data);
11
- }
12
- }
@@ -1,12 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class CreateRole extends Dto {
4
- public readonly spaceId: string;
5
- public readonly name: string;
6
- public readonly color: string;
7
-
8
- public constructor(data: DtoData<CreateRole>) {
9
- super();
10
- this.fill(data);
11
- }
12
- }
@@ -1,12 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class CreateRoom extends Dto {
4
- public readonly spaceId: string;
5
- public readonly name: string;
6
- public readonly description: string;
7
-
8
- public constructor(data: DtoData<CreateRoom>) {
9
- super();
10
- this.fill(data);
11
- }
12
- }
@@ -1,10 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class CreateSpace extends Dto {
4
- public readonly name: string;
5
-
6
- public constructor(data: DtoData<CreateSpace>) {
7
- super();
8
- this.fill(data);
9
- }
10
- }
@@ -1,12 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class CreateTopic extends Dto {
4
- public readonly roomId: string;
5
- public readonly name: string;
6
- public readonly description: string;
7
-
8
- public constructor(data: DtoData<CreateTopic>) {
9
- super();
10
- this.fill(data);
11
- }
12
- }
@@ -1,12 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class DeassignRole extends Dto {
4
- public readonly roleId: string;
5
- public readonly spaceId: string;
6
- public readonly userId: string;
7
-
8
- public constructor(data: DtoData<DeassignRole>) {
9
- super();
10
- this.fill(data);
11
- }
12
- }
@@ -1,11 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class DeleteRole extends Dto {
4
- public readonly roleId: string;
5
- public readonly spaceId: string;
6
-
7
- public constructor(data: DtoData<DeleteRole>) {
8
- super();
9
- this.fill(data);
10
- }
11
- }
@@ -1,10 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class DeleteRoom extends Dto {
4
- public readonly id: string;
5
-
6
- public constructor(data: DtoData<DeleteRoom>) {
7
- super();
8
- this.fill(data);
9
- }
10
- }
@@ -1,10 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class DeleteSpace extends Dto {
4
- public readonly id: string;
5
-
6
- public constructor(data: DtoData<DeleteSpace>) {
7
- super();
8
- this.fill(data);
9
- }
10
- }
@@ -1,10 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class DeleteTopic extends Dto {
4
- public readonly id: string;
5
-
6
- public constructor(data: DtoData<DeleteTopic>) {
7
- super();
8
- this.fill(data);
9
- }
10
- }
@@ -1,13 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class GetComputedPermissions extends Dto {
4
- public readonly names: string[] | null | undefined;
5
- public readonly spaceId: string;
6
- public readonly roomId: string;
7
- public readonly topicId: string;
8
-
9
- public constructor(data: DtoData<GetComputedPermissions>) {
10
- super();
11
- this.fill(data);
12
- }
13
- }
@@ -1,13 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class GetRolePermissions extends Dto {
4
- public readonly layer: 'Space' | 'Room' | 'Topic';
5
- public readonly layerId: string;
6
- public readonly roleId: string;
7
- public readonly names: string[] | null | undefined;
8
-
9
- public constructor(data: DtoData<GetRolePermissions>) {
10
- super();
11
- this.fill(data);
12
- }
13
- }
@@ -1,10 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class GetRoomMembers extends Dto {
4
- public readonly id: string;
5
-
6
- public constructor(data: DtoData<GetRoomMembers>) {
7
- super();
8
- this.fill(data);
9
- }
10
- }
@@ -1,8 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class GetSession extends Dto {
4
- public constructor(data: DtoData<GetSession>) {
5
- super();
6
- this.fill(data);
7
- }
8
- }
@@ -1,10 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class GetSpaceMembers extends Dto {
4
- public readonly id: string;
5
-
6
- public constructor(data: DtoData<GetSpaceMembers>) {
7
- super();
8
- this.fill(data);
9
- }
10
- }
@@ -1,10 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class GetSpaceRooms extends Dto {
4
- public readonly id: string;
5
-
6
- public constructor(data: DtoData<GetSpaceRooms>) {
7
- super();
8
- this.fill(data);
9
- }
10
- }
@@ -1,13 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class GetUserPermissions extends Dto {
4
- public readonly layer: 'Global' | 'Space' | 'Room' | 'Topic';
5
- public readonly layerId: string;
6
- public readonly userId: string;
7
- public readonly names: string[] | null | undefined;
8
-
9
- public constructor(data: DtoData<GetUserPermissions>) {
10
- super();
11
- this.fill(data);
12
- }
13
- }
@@ -1,10 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class JoinRoom extends Dto {
4
- public readonly id: string;
5
-
6
- public constructor(data: DtoData<JoinRoom>) {
7
- super();
8
- this.fill(data);
9
- }
10
- }
@@ -1,10 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class JoinSpace extends Dto {
4
- public readonly id: string;
5
-
6
- public constructor(data: DtoData<JoinSpace>) {
7
- super();
8
- this.fill(data);
9
- }
10
- }
@@ -1,10 +0,0 @@
1
- import {Dto, DtoData} from "../../Dto";
2
-
3
- export class LeaveRoom extends Dto {
4
- public readonly id: string;
5
-
6
- public constructor(data: DtoData<LeaveRoom>) {
7
- super();
8
- this.fill(data);
9
- }
10
- }