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.
- package/README.md +25 -0
- package/dist/Client.d.ts +76 -0
- package/dist/ObservableInterface.d.ts +9 -0
- package/dist/Token.d.ts +5 -0
- package/dist/connections/ConnectionInterface.d.ts +17 -0
- package/dist/connections/WebApiConnection.d.ts +15 -0
- package/dist/connections/WebSocketConnection.d.ts +19 -0
- package/dist/dtos/Dto.d.ts +16 -0
- package/dist/dtos/Message.d.ts +9 -0
- package/dist/dtos/Permission.d.ts +7 -0
- package/dist/dtos/Role.d.ts +7 -0
- package/dist/dtos/Room.d.ts +8 -0
- package/dist/dtos/RoomMember.d.ts +6 -0
- package/dist/dtos/RoomSummary.d.ts +7 -0
- package/dist/dtos/Space.d.ts +8 -0
- package/dist/dtos/SpaceMember.d.ts +7 -0
- package/dist/dtos/Topic.d.ts +7 -0
- package/dist/dtos/User.d.ts +9 -0
- package/dist/dtos/UserState.d.ts +8 -0
- package/dist/dtos/protocol/Envelope.d.ts +7 -0
- package/dist/dtos/protocol/EnvelopeMeta.d.ts +6 -0
- package/dist/dtos/protocol/ProtocolMessage.d.ts +7 -0
- package/dist/dtos/protocol/ProtocolMetaData.d.ts +6 -0
- package/dist/dtos/protocol/commands/AssignRole.d.ts +7 -0
- package/dist/dtos/protocol/commands/CreateMessage.d.ts +7 -0
- package/dist/dtos/protocol/commands/CreateRole.d.ts +7 -0
- package/dist/dtos/protocol/commands/CreateRoom.d.ts +7 -0
- package/dist/dtos/protocol/commands/CreateSpace.d.ts +5 -0
- package/dist/dtos/protocol/commands/CreateTopic.d.ts +7 -0
- package/dist/dtos/protocol/commands/DeassignRole.d.ts +7 -0
- package/dist/dtos/protocol/commands/DeleteRole.d.ts +6 -0
- package/dist/dtos/protocol/commands/DeleteRoom.d.ts +5 -0
- package/dist/dtos/protocol/commands/DeleteSpace.d.ts +5 -0
- package/dist/dtos/protocol/commands/DeleteTopic.d.ts +5 -0
- package/dist/dtos/protocol/commands/GetComputedPermissions.d.ts +8 -0
- package/dist/dtos/protocol/commands/GetRolePermissions.d.ts +8 -0
- package/dist/dtos/protocol/commands/GetRoomMembers.d.ts +5 -0
- package/dist/dtos/protocol/commands/GetSession.d.ts +4 -0
- package/dist/dtos/protocol/commands/GetSpaceMembers.d.ts +5 -0
- package/dist/dtos/protocol/commands/GetSpaceRooms.d.ts +5 -0
- package/dist/dtos/protocol/commands/GetUserPermissions.d.ts +8 -0
- package/dist/dtos/protocol/commands/JoinRoom.d.ts +5 -0
- package/dist/dtos/protocol/commands/JoinSpace.d.ts +5 -0
- package/dist/dtos/protocol/commands/LeaveRoom.d.ts +5 -0
- package/dist/dtos/protocol/commands/LeaveSpace.d.ts +5 -0
- package/dist/dtos/protocol/commands/SetRolePermissions.d.ts +9 -0
- package/dist/dtos/protocol/commands/SetUserPermissions.d.ts +9 -0
- package/dist/dtos/protocol/events/Bye.d.ts +5 -0
- package/dist/dtos/protocol/events/Error.d.ts +6 -0
- package/dist/dtos/protocol/events/NewMessage.d.ts +6 -0
- package/dist/dtos/protocol/events/NewRole.d.ts +7 -0
- package/dist/dtos/protocol/events/NewRoom.d.ts +7 -0
- package/dist/dtos/protocol/events/NewTopic.d.ts +7 -0
- package/dist/dtos/protocol/events/Ok.d.ts +4 -0
- package/dist/dtos/protocol/events/Permissions.d.ts +6 -0
- package/dist/dtos/protocol/events/RoleDeleted.d.ts +6 -0
- package/dist/dtos/protocol/events/RoomDeleted.d.ts +5 -0
- package/dist/dtos/protocol/events/RoomJoined.d.ts +6 -0
- package/dist/dtos/protocol/events/RoomLeft.d.ts +5 -0
- package/dist/dtos/protocol/events/RoomMemberJoined.d.ts +6 -0
- package/dist/dtos/protocol/events/RoomMemberLeft.d.ts +5 -0
- package/dist/dtos/protocol/events/RoomMembers.d.ts +6 -0
- package/dist/dtos/protocol/events/Session.d.ts +9 -0
- package/dist/dtos/protocol/events/SpaceDeleted.d.ts +5 -0
- package/dist/dtos/protocol/events/SpaceJoined.d.ts +6 -0
- package/dist/dtos/protocol/events/SpaceLeft.d.ts +5 -0
- package/dist/dtos/protocol/events/SpaceMemberJoined.d.ts +6 -0
- package/dist/dtos/protocol/events/SpaceMemberLeft.d.ts +5 -0
- package/dist/dtos/protocol/events/SpaceMemberUpdate.d.ts +6 -0
- package/dist/dtos/protocol/events/SpaceMembers.d.ts +6 -0
- package/dist/dtos/protocol/events/SpaceRooms.d.ts +6 -0
- package/dist/dtos/protocol/events/TopicDeleted.d.ts +5 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +1916 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol.d.ts +7 -0
- package/dist/pserv-js-client.js +2 -0
- package/dist/pserv-js-client.js.map +1 -0
- package/package.json +22 -0
- package/src/Client.ts +166 -0
- package/src/ObservableInterface.ts +22 -0
- package/src/Token.ts +21 -0
- package/src/connections/ConnectionInterface.ts +20 -0
- package/src/connections/WebApiConnection.ts +43 -0
- package/src/connections/WebSocketConnection.ts +47 -0
- package/src/dtos/Dto.ts +45 -0
- package/src/dtos/Message.ts +16 -0
- package/src/dtos/Permission.ts +12 -0
- package/src/dtos/Role.ts +12 -0
- package/src/dtos/Room.ts +15 -0
- package/src/dtos/RoomMember.ts +13 -0
- package/src/dtos/RoomSummary.ts +12 -0
- package/src/dtos/Space.ts +15 -0
- package/src/dtos/SpaceMember.ts +14 -0
- package/src/dtos/Topic.ts +12 -0
- package/src/dtos/User.ts +15 -0
- package/src/dtos/UserState.ts +16 -0
- package/src/dtos/protocol/Envelope.ts +14 -0
- package/src/dtos/protocol/EnvelopeMeta.ts +11 -0
- package/src/dtos/protocol/commands/AssignRole.ts +12 -0
- package/src/dtos/protocol/commands/CreateMessage.ts +12 -0
- package/src/dtos/protocol/commands/CreateRole.ts +12 -0
- package/src/dtos/protocol/commands/CreateRoom.ts +12 -0
- package/src/dtos/protocol/commands/CreateSpace.ts +10 -0
- package/src/dtos/protocol/commands/CreateTopic.ts +12 -0
- package/src/dtos/protocol/commands/DeassignRole.ts +12 -0
- package/src/dtos/protocol/commands/DeleteRole.ts +11 -0
- package/src/dtos/protocol/commands/DeleteRoom.ts +10 -0
- package/src/dtos/protocol/commands/DeleteSpace.ts +10 -0
- package/src/dtos/protocol/commands/DeleteTopic.ts +10 -0
- package/src/dtos/protocol/commands/GetComputedPermissions.ts +13 -0
- package/src/dtos/protocol/commands/GetRolePermissions.ts +13 -0
- package/src/dtos/protocol/commands/GetRoomMembers.ts +10 -0
- package/src/dtos/protocol/commands/GetSession.ts +8 -0
- package/src/dtos/protocol/commands/GetSpaceMembers.ts +10 -0
- package/src/dtos/protocol/commands/GetSpaceRooms.ts +10 -0
- package/src/dtos/protocol/commands/GetUserPermissions.ts +13 -0
- package/src/dtos/protocol/commands/JoinRoom.ts +10 -0
- package/src/dtos/protocol/commands/JoinSpace.ts +10 -0
- package/src/dtos/protocol/commands/LeaveRoom.ts +10 -0
- package/src/dtos/protocol/commands/LeaveSpace.ts +10 -0
- package/src/dtos/protocol/commands/SetRolePermissions.ts +16 -0
- package/src/dtos/protocol/commands/SetUserPermissions.ts +16 -0
- package/src/dtos/protocol/events/Bye.ts +10 -0
- package/src/dtos/protocol/events/Error.ts +11 -0
- package/src/dtos/protocol/events/NewMessage.ts +13 -0
- package/src/dtos/protocol/events/NewRole.ts +14 -0
- package/src/dtos/protocol/events/NewRoom.ts +14 -0
- package/src/dtos/protocol/events/NewTopic.ts +14 -0
- package/src/dtos/protocol/events/Ok.ts +8 -0
- package/src/dtos/protocol/events/Permissions.ts +13 -0
- package/src/dtos/protocol/events/RoleDeleted.ts +11 -0
- package/src/dtos/protocol/events/RoomDeleted.ts +10 -0
- package/src/dtos/protocol/events/RoomJoined.ts +13 -0
- package/src/dtos/protocol/events/RoomLeft.ts +10 -0
- package/src/dtos/protocol/events/RoomMemberJoined.ts +13 -0
- package/src/dtos/protocol/events/RoomMemberLeft.ts +10 -0
- package/src/dtos/protocol/events/RoomMembers.ts +13 -0
- package/src/dtos/protocol/events/Session.ts +17 -0
- package/src/dtos/protocol/events/SpaceDeleted.ts +10 -0
- package/src/dtos/protocol/events/SpaceJoined.ts +13 -0
- package/src/dtos/protocol/events/SpaceLeft.ts +10 -0
- package/src/dtos/protocol/events/SpaceMemberJoined.ts +13 -0
- package/src/dtos/protocol/events/SpaceMemberLeft.ts +10 -0
- package/src/dtos/protocol/events/SpaceMemberUpdate.ts +13 -0
- package/src/dtos/protocol/events/SpaceMembers.ts +13 -0
- package/src/dtos/protocol/events/SpaceRooms.ts +13 -0
- package/src/dtos/protocol/events/TopicDeleted.ts +10 -0
- package/src/index.ts +26 -0
- package/src/protocol.ts +113 -0
- package/tsconfig.json +12 -0
- 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
|
+
```
|
package/dist/Client.d.ts
ADDED
|
@@ -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
|
+
}
|
package/dist/Token.d.ts
ADDED
|
@@ -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
|
+
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 { 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,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,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
|
+
}
|