@vex-chat/libvex 0.27.1 → 1.0.0-rc.1

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/dist/Client.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- /// <reference types="node" />
2
- import { XTypes } from "@vex-chat/types";
1
+ import type { IChannel, IDevice, IEmoji, IFileResponse, IFileSQL, IInvite, IPermission, IServer, ISessionSQL } from "@vex-chat/types";
3
2
  import { AxiosError } from "axios";
4
3
  import { EventEmitter } from "events";
5
- import { IStorage } from "./IStorage";
4
+ import type { IStorage } from "./IStorage.js";
6
5
  interface ICensoredUser {
7
6
  lastSeen: number;
8
7
  userID: string;
@@ -28,8 +27,7 @@ export interface IMessage {
28
27
  /**
29
28
  * IPermission is a permission to a resource.
30
29
  */
31
- export interface IPermission extends XTypes.SQL.IPermission {
32
- }
30
+ export type { IPermission } from "@vex-chat/types";
33
31
  /**
34
32
  * IKeys are a pair of ed25519 public and private keys,
35
33
  * encoded as hex strings.
@@ -38,8 +36,7 @@ export interface IKeys {
38
36
  public: string;
39
37
  private: string;
40
38
  }
41
- export interface IDevice extends XTypes.SQL.IDevice {
42
- }
39
+ export type { IDevice } from "@vex-chat/types";
43
40
  /**
44
41
  * IUser is a single user on the vex platform.
45
42
  */
@@ -48,34 +45,32 @@ export interface IUser extends ICensoredUser {
48
45
  /**
49
46
  * ISession is an end to end encryption session with another peer.
50
47
  */
51
- export interface ISession extends XTypes.SQL.ISession {
48
+ export interface ISession extends ISessionSQL {
52
49
  }
53
50
  /**
54
51
  * IChannel is a chat channel on a server.
55
52
  */
56
- export interface IChannel extends XTypes.SQL.IChannel {
57
- }
53
+ export type { IChannel } from "@vex-chat/types";
58
54
  /**
59
55
  * IServer is a single chat server.
60
56
  */
61
- export interface IServer extends XTypes.SQL.IServer {
62
- }
57
+ export type { IServer } from "@vex-chat/types";
63
58
  /**
64
59
  * Ifile is an uploaded encrypted file.
65
60
  */
66
- export interface IFile extends XTypes.SQL.IFile {
61
+ export interface IFile extends IFileSQL {
67
62
  }
68
63
  /**
69
64
  * IFileRes is a server response to a file retrieval request.
70
65
  */
71
- export interface IFileRes extends XTypes.HTTP.IFileResponse {
66
+ export interface IFileRes extends IFileResponse {
72
67
  }
73
68
  /**
74
69
  * @ignore
75
70
  */
76
71
  interface IMe {
77
72
  user: () => ICensoredUser;
78
- device: () => XTypes.SQL.IDevice;
73
+ device: () => IDevice;
79
74
  setAvatar: (avatar: Buffer) => Promise<void>;
80
75
  }
81
76
  /**
@@ -100,9 +95,9 @@ interface IMessages {
100
95
  * @ignore
101
96
  */
102
97
  interface IServers {
103
- retrieve: () => Promise<XTypes.SQL.IServer[]>;
104
- retrieveByID: (serverID: string) => Promise<XTypes.SQL.IServer | null>;
105
- create: (name: string) => Promise<XTypes.SQL.IServer>;
98
+ retrieve: () => Promise<IServer[]>;
99
+ retrieveByID: (serverID: string) => Promise<IServer | null>;
100
+ create: (name: string) => Promise<IServer>;
106
101
  delete: (serverID: string) => Promise<void>;
107
102
  leave: (serverID: string) => Promise<void>;
108
103
  }
@@ -111,30 +106,30 @@ interface IServers {
111
106
  */
112
107
  interface IModeration {
113
108
  kick: (userID: string, serverID: string) => Promise<void>;
114
- fetchPermissionList: (serverID: string) => Promise<XTypes.SQL.IPermission[]>;
109
+ fetchPermissionList: (serverID: string) => Promise<IPermission[]>;
115
110
  }
116
111
  /**
117
112
  * @ignore
118
113
  */
119
114
  interface IPermissions {
120
- retrieve: () => Promise<XTypes.SQL.IPermission[]>;
115
+ retrieve: () => Promise<IPermission[]>;
121
116
  delete: (permissionID: string) => Promise<void>;
122
117
  }
123
118
  /**
124
119
  * @ignore
125
120
  */
126
121
  interface IInvites {
127
- redeem: (inviteID: string) => Promise<XTypes.SQL.IPermission>;
128
- create: (serverID: string, duration: string) => Promise<XTypes.SQL.IInvite>;
129
- retrieve: (serverID: string) => Promise<XTypes.SQL.IInvite[]>;
122
+ redeem: (inviteID: string) => Promise<IPermission>;
123
+ create: (serverID: string, duration: string) => Promise<IInvite>;
124
+ retrieve: (serverID: string) => Promise<IInvite[]>;
130
125
  }
131
126
  /**
132
127
  * @ignore
133
128
  */
134
129
  interface IChannels {
135
- retrieve: (serverID: string) => Promise<XTypes.SQL.IChannel[]>;
136
- retrieveByID: (channelID: string) => Promise<XTypes.SQL.IChannel | null>;
137
- create: (name: string, serverID: string) => Promise<XTypes.SQL.IChannel>;
130
+ retrieve: (serverID: string) => Promise<IChannel[]>;
131
+ retrieveByID: (channelID: string) => Promise<IChannel | null>;
132
+ create: (name: string, serverID: string) => Promise<IChannel>;
138
133
  delete: (channelID: string) => Promise<void>;
139
134
  userList: (channelID: string) => Promise<IUser[]>;
140
135
  }
@@ -142,32 +137,32 @@ interface IChannels {
142
137
  * @ignore
143
138
  */
144
139
  interface ISessions {
145
- retrieve: () => Promise<XTypes.SQL.ISession[]>;
146
- verify: (session: XTypes.SQL.ISession) => string;
140
+ retrieve: () => Promise<ISessionSQL[]>;
141
+ verify: (session: ISessionSQL) => string;
147
142
  markVerified: (fingerprint: string) => Promise<void>;
148
143
  }
149
144
  /**
150
145
  * @ignore
151
146
  */
152
147
  interface IDevices {
153
- retrieve: (deviceIdentifier: string) => Promise<XTypes.SQL.IDevice | null>;
154
- register: () => Promise<XTypes.SQL.IDevice | null>;
148
+ retrieve: (deviceIdentifier: string) => Promise<IDevice | null>;
149
+ register: () => Promise<IDevice | null>;
155
150
  delete: (deviceID: string) => Promise<void>;
156
151
  }
157
152
  /**
158
153
  * @ignore
159
154
  */
160
155
  interface IFiles {
161
- create: (file: Buffer) => Promise<[XTypes.SQL.IFile, string]>;
162
- retrieve: (fileID: string, key: string) => Promise<XTypes.HTTP.IFileResponse | null>;
156
+ create: (file: Buffer) => Promise<[IFileSQL, string]>;
157
+ retrieve: (fileID: string, key: string) => Promise<IFileResponse | null>;
163
158
  }
164
159
  /**
165
160
  * @ignore
166
161
  */
167
- interface IEmoji {
168
- create: (emoji: Buffer, name: string, serverID: string) => Promise<XTypes.SQL.IEmoji | null>;
169
- retrieveList: (serverID: string) => Promise<XTypes.SQL.IEmoji[]>;
170
- retrieve: (emojiID: string) => Promise<XTypes.SQL.IEmoji | null>;
162
+ interface IEmojis {
163
+ create: (emoji: Buffer, name: string, serverID: string) => Promise<IEmoji | null>;
164
+ retrieveList: (serverID: string) => Promise<IEmoji[]>;
165
+ retrieve: (emojiID: string) => Promise<IEmoji | null>;
171
166
  }
172
167
  export interface IFileProgress {
173
168
  token: string;
@@ -359,8 +354,8 @@ export declare interface Client {
359
354
  */
360
355
  export declare class Client extends EventEmitter {
361
356
  static loadKeyFile: (path: string, password: string) => string;
362
- static saveKeyFile: (path: string, password: string, keyToSave: string, iterationOverride?: number | undefined) => void;
363
- static create: (privateKey?: string | undefined, options?: IClientOptions | undefined, storage?: IStorage | undefined) => Promise<Client>;
357
+ static saveKeyFile: (path: string, password: string, keyToSave: string, iterationOverride?: number) => void;
358
+ static create: (privateKey?: string, options?: IClientOptions, storage?: IStorage) => Promise<Client>;
364
359
  /**
365
360
  * Generates an ed25519 secret key as a hex string.
366
361
  *
@@ -379,7 +374,7 @@ export declare class Client extends EventEmitter {
379
374
  * The IUsers interface contains methods for dealing with users.
380
375
  */
381
376
  users: IUsers;
382
- emoji: IEmoji;
377
+ emoji: IEmojis;
383
378
  me: IMe;
384
379
  devices: IDevices;
385
380
  /**
@@ -561,4 +556,3 @@ export declare class Client extends EventEmitter {
561
556
  private ping;
562
557
  private censorPreKey;
563
558
  }
564
- export {};