Add types/lib folder.
This commit is contained in:
parent
e22305b58d
commit
b4c676a21c
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,7 +2,6 @@
|
||||
|
||||
keys/
|
||||
node_modules/
|
||||
lib/
|
||||
logs/
|
||||
upload/
|
||||
|
||||
|
10
frontend/src/types/lib/auth.types.d.ts
vendored
Normal file
10
frontend/src/types/lib/auth.types.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
export declare namespace Auth {
|
||||
interface Credentials {
|
||||
email?: string;
|
||||
password: string;
|
||||
username: string;
|
||||
}
|
||||
interface Payload {
|
||||
userId: string;
|
||||
}
|
||||
}
|
3
frontend/src/types/lib/auth.types.js
Normal file
3
frontend/src/types/lib/auth.types.js
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aC50eXBlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9hdXRoLnR5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
|
166
frontend/src/types/lib/entity.types.d.ts
vendored
Normal file
166
frontend/src/types/lib/entity.types.d.ts
vendored
Normal file
@ -0,0 +1,166 @@
|
||||
export declare namespace Entity {
|
||||
interface App {
|
||||
id: string;
|
||||
createdAt: Date;
|
||||
description: string;
|
||||
name: string;
|
||||
ownerId: string;
|
||||
userId: string;
|
||||
token: string | never;
|
||||
}
|
||||
interface Channel {
|
||||
id: string;
|
||||
createdAt: Date;
|
||||
guildId: string;
|
||||
name: string;
|
||||
summary?: string;
|
||||
lastMessageId?: null | string;
|
||||
type: ChannelTypes.Type;
|
||||
overrides?: ChannelTypes.Override[];
|
||||
position: number;
|
||||
}
|
||||
interface Guild {
|
||||
id: string;
|
||||
name: string;
|
||||
createdAt: Date;
|
||||
iconURL?: string;
|
||||
ownerId: string;
|
||||
systemChannelId?: string;
|
||||
}
|
||||
interface GuildMember {
|
||||
/** @deprecated Not the same as user ID. */
|
||||
id: string;
|
||||
createdAt: Date;
|
||||
guildId: string;
|
||||
userId: string;
|
||||
roleIds: string[];
|
||||
}
|
||||
interface Invite {
|
||||
id: string;
|
||||
createdAt: Date;
|
||||
options?: InviteTypes.Options;
|
||||
inviterId: string;
|
||||
guildId: string;
|
||||
uses: number;
|
||||
}
|
||||
interface Message {
|
||||
id: string;
|
||||
attachmentURLs?: string[];
|
||||
authorId: string;
|
||||
channelId: string;
|
||||
content?: string;
|
||||
createdAt: Date;
|
||||
embed?: MessageTypes.Embed;
|
||||
type?: MessageTypes.Type;
|
||||
updatedAt?: Date;
|
||||
system?: boolean;
|
||||
}
|
||||
interface Role {
|
||||
id: string;
|
||||
color?: string;
|
||||
createdAt: Date;
|
||||
guildId: string;
|
||||
hoisted: boolean;
|
||||
mentionable: boolean;
|
||||
name: string;
|
||||
permissions: number;
|
||||
position: number;
|
||||
}
|
||||
interface Theme {
|
||||
id: string;
|
||||
code: string;
|
||||
createdAt: Date;
|
||||
creatorId: string;
|
||||
iconURL?: string;
|
||||
styles: string;
|
||||
name: string;
|
||||
updatedAt?: Date;
|
||||
isFeatured?: boolean;
|
||||
}
|
||||
interface User {
|
||||
id: string;
|
||||
avatarURL: string;
|
||||
badges: UserTypes.Badge[];
|
||||
bot: boolean;
|
||||
createdAt: Date;
|
||||
discriminator: number;
|
||||
guildIds: string[];
|
||||
premium: boolean;
|
||||
status: UserTypes.StatusType;
|
||||
username: string;
|
||||
voice: UserTypes.VoiceState;
|
||||
}
|
||||
}
|
||||
export declare namespace ChannelTypes {
|
||||
type Type = 'TEXT' | 'VOICE';
|
||||
interface Text extends Entity.Channel {
|
||||
type: 'TEXT';
|
||||
}
|
||||
interface Voice extends Entity.Channel {
|
||||
type: 'VOICE';
|
||||
userIds: string[];
|
||||
}
|
||||
interface Override {
|
||||
roleId: string;
|
||||
allow: number;
|
||||
deny: number;
|
||||
}
|
||||
interface VoiceConnection {
|
||||
userId: string;
|
||||
blob?: any;
|
||||
}
|
||||
}
|
||||
export declare namespace GeneralTypes {
|
||||
interface SnowflakeEntity {
|
||||
id: string;
|
||||
}
|
||||
}
|
||||
export declare namespace InviteTypes {
|
||||
interface Options {
|
||||
expiresAt?: Date;
|
||||
maxUses?: number;
|
||||
}
|
||||
}
|
||||
export declare namespace MessageTypes {
|
||||
interface Attachment {
|
||||
id: string;
|
||||
name: string;
|
||||
size: number;
|
||||
url: string;
|
||||
}
|
||||
interface Embed {
|
||||
description: string;
|
||||
imageURL: string;
|
||||
title: string;
|
||||
url: string;
|
||||
}
|
||||
type Type = undefined | 'GUILD_MEMBER_JOIN' | 'GUILD_MEMBER_LEAVE';
|
||||
}
|
||||
export declare namespace UserTypes {
|
||||
type Badge = 'BUG_1' | 'BUG_2' | 'BUG_3' | 'PREMIUM' | 'OG' | 'VIEWER' | 'STAFF';
|
||||
interface Ignored {
|
||||
channelIds: string[];
|
||||
guildIds: string[];
|
||||
userIds: string[];
|
||||
}
|
||||
type StatusType = 'ONLINE' | 'OFFLINE';
|
||||
interface Self extends Entity.User {
|
||||
activeThemeId: string;
|
||||
email: string;
|
||||
ignored?: {
|
||||
channelIds: string[];
|
||||
guildIds: string[];
|
||||
userIds: string[];
|
||||
};
|
||||
lastReadMessageIds: {
|
||||
[k: string]: string;
|
||||
};
|
||||
locked: boolean;
|
||||
premiumExpiration: Date;
|
||||
unlockedThemeIds: string[];
|
||||
verified: true;
|
||||
}
|
||||
interface VoiceState {
|
||||
channelId?: string;
|
||||
}
|
||||
}
|
3
frontend/src/types/lib/entity.types.js
Normal file
3
frontend/src/types/lib/entity.types.js
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW50aXR5LnR5cGVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2VudGl0eS50eXBlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=
|
7
frontend/src/types/lib/main.d.ts
vendored
Normal file
7
frontend/src/types/lib/main.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
export * from './auth.types';
|
||||
export * from './entity.types';
|
||||
export * from './patterns.types';
|
||||
export * from './permissions.types';
|
||||
export * from './rest.types';
|
||||
export * from './util.types';
|
||||
export * from './ws.types';
|
24
frontend/src/types/lib/main.js
Normal file
24
frontend/src/types/lib/main.js
Normal file
@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./auth.types"), exports);
|
||||
__exportStar(require("./entity.types"), exports);
|
||||
__exportStar(require("./patterns.types"), exports);
|
||||
__exportStar(require("./permissions.types"), exports);
|
||||
__exportStar(require("./rest.types"), exports);
|
||||
__exportStar(require("./util.types"), exports);
|
||||
__exportStar(require("./ws.types"), exports);
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9tYWluLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSwrQ0FBNkI7QUFDN0IsaURBQStCO0FBQy9CLG1EQUFpQztBQUNqQyxzREFBb0M7QUFDcEMsK0NBQTZCO0FBQzdCLCtDQUE2QjtBQUM3Qiw2Q0FBMkIifQ==
|
11
frontend/src/types/lib/patterns.types.d.ts
vendored
Normal file
11
frontend/src/types/lib/patterns.types.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
export declare const patterns: {
|
||||
email: RegExp;
|
||||
hexColor: RegExp;
|
||||
password: RegExp;
|
||||
snowflake: RegExp;
|
||||
status: RegExp;
|
||||
textChannelName: RegExp;
|
||||
username: RegExp;
|
||||
roleName: RegExp;
|
||||
url: RegExp;
|
||||
};
|
15
frontend/src/types/lib/patterns.types.js
Normal file
15
frontend/src/types/lib/patterns.types.js
Normal file
@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.patterns = void 0;
|
||||
exports.patterns = {
|
||||
email: /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/,
|
||||
hexColor: /^#(?:[0-9a-fA-F]{3}){1,2}$/,
|
||||
password: /(?=.*[a-zA-Z0-9!@#$%^&*])/,
|
||||
snowflake: /^\d{18}$/,
|
||||
status: /^ONLINE|^BUSY$|^AFK$|^OFFLINE$/,
|
||||
textChannelName: /^[A-Za-z\-\d]{2,32}$/,
|
||||
username: /(^(?! |^everyone$|^here$|^me$|^someone$)[A-Za-z\d\-\_ ]{2,32}(?<! )$)/,
|
||||
roleName: /(^(?! |^everyone$|^here$|^me$|^someone$)(.*){2,32}(?<! )$)/,
|
||||
url: /(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*))/gm,
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGF0dGVybnMudHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcGF0dGVybnMudHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQWEsUUFBQSxRQUFRLEdBQUc7SUFDdEIsS0FBSyxFQUFFLGdjQUFnYztJQUN2YyxRQUFRLEVBQUUsNEJBQTRCO0lBQ3RDLFFBQVEsRUFBRSwyQkFBMkI7SUFDckMsU0FBUyxFQUFFLFVBQVU7SUFDckIsTUFBTSxFQUFFLGdDQUFnQztJQUN4QyxlQUFlLEVBQUUsc0JBQXNCO0lBQ3ZDLFFBQVEsRUFBRSx1RUFBdUU7SUFDakYsUUFBUSxFQUFFLDREQUE0RDtJQUN0RSxHQUFHLEVBQUUsMkdBQTJHO0NBQ2pILENBQUEifQ==
|
45
frontend/src/types/lib/permissions.types.d.ts
vendored
Normal file
45
frontend/src/types/lib/permissions.types.d.ts
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
export declare namespace PermissionTypes {
|
||||
enum General {
|
||||
VIEW_CHANNELS = 1024,
|
||||
MANAGE_INVITES = 256,
|
||||
CREATE_INVITE = 128,
|
||||
KICK_MEMBERS = 64,
|
||||
MANAGE_CHANNELS = 16,
|
||||
MANAGE_ROLES = 8,
|
||||
MANAGE_GUILD = 4,
|
||||
ADMINISTRATOR = 1
|
||||
}
|
||||
enum Text {
|
||||
READ_MESSAGES = 8192,
|
||||
MANAGE_MESSAGES = 4096,
|
||||
SEND_MESSAGES = 2048
|
||||
}
|
||||
enum Voice {
|
||||
MOVE_MEMBERS = 262144,
|
||||
MUTE_MEMBERS = 131072,
|
||||
SPEAK = 65536,
|
||||
CONNECT = 32768
|
||||
}
|
||||
const All: {
|
||||
[x: number]: string;
|
||||
MOVE_MEMBERS: Voice;
|
||||
MUTE_MEMBERS: Voice;
|
||||
SPEAK: Voice;
|
||||
CONNECT: Voice;
|
||||
READ_MESSAGES: Text;
|
||||
MANAGE_MESSAGES: Text;
|
||||
SEND_MESSAGES: Text;
|
||||
VIEW_CHANNELS: General.VIEW_CHANNELS;
|
||||
MANAGE_INVITES: General.MANAGE_INVITES;
|
||||
CREATE_INVITE: General.CREATE_INVITE;
|
||||
KICK_MEMBERS: General.KICK_MEMBERS;
|
||||
MANAGE_CHANNELS: General.MANAGE_CHANNELS;
|
||||
MANAGE_ROLES: General.MANAGE_ROLES;
|
||||
MANAGE_GUILD: General.MANAGE_GUILD;
|
||||
ADMINISTRATOR: General.ADMINISTRATOR;
|
||||
};
|
||||
type Permission = General | Text | Voice;
|
||||
type PermissionString = keyof typeof All;
|
||||
const defaultPermissions: number;
|
||||
}
|
||||
export declare function getPermString(integer: number | string): string;
|
56
frontend/src/types/lib/permissions.types.js
Normal file
56
frontend/src/types/lib/permissions.types.js
Normal file
@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
// REMINDER: 8 is admin in Discord, but 1 in Accord
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getPermString = exports.PermissionTypes = void 0;
|
||||
var PermissionTypes;
|
||||
(function (PermissionTypes) {
|
||||
let General;
|
||||
(function (General) {
|
||||
General[General["VIEW_CHANNELS"] = 1024] = "VIEW_CHANNELS";
|
||||
// MANAGE_NICKNAMES = 512, // change number
|
||||
// CHANGE_NICKNAME = 256, // change number
|
||||
General[General["MANAGE_INVITES"] = 256] = "MANAGE_INVITES";
|
||||
General[General["CREATE_INVITE"] = 128] = "CREATE_INVITE";
|
||||
General[General["KICK_MEMBERS"] = 64] = "KICK_MEMBERS";
|
||||
// BAN_MEMBERS = 32, // change number
|
||||
General[General["MANAGE_CHANNELS"] = 16] = "MANAGE_CHANNELS";
|
||||
General[General["MANAGE_ROLES"] = 8] = "MANAGE_ROLES";
|
||||
General[General["MANAGE_GUILD"] = 4] = "MANAGE_GUILD";
|
||||
// VIEW_AUDIT_LOG = 2, // change number
|
||||
General[General["ADMINISTRATOR"] = 1] = "ADMINISTRATOR";
|
||||
})(General = PermissionTypes.General || (PermissionTypes.General = {}));
|
||||
let Text;
|
||||
(function (Text) {
|
||||
// ADD_REACTIONS = 2048 * 16,
|
||||
// MENTION_EVERYONE = 2048 * 8,
|
||||
Text[Text["READ_MESSAGES"] = 8192] = "READ_MESSAGES";
|
||||
Text[Text["MANAGE_MESSAGES"] = 4096] = "MANAGE_MESSAGES";
|
||||
Text[Text["SEND_MESSAGES"] = 2048] = "SEND_MESSAGES";
|
||||
})(Text = PermissionTypes.Text || (PermissionTypes.Text = {}));
|
||||
let Voice;
|
||||
(function (Voice) {
|
||||
Voice[Voice["MOVE_MEMBERS"] = 262144] = "MOVE_MEMBERS";
|
||||
Voice[Voice["MUTE_MEMBERS"] = 131072] = "MUTE_MEMBERS";
|
||||
Voice[Voice["SPEAK"] = 65536] = "SPEAK";
|
||||
Voice[Voice["CONNECT"] = 32768] = "CONNECT";
|
||||
})(Voice = PermissionTypes.Voice || (PermissionTypes.Voice = {}));
|
||||
PermissionTypes.All = Object.assign(Object.assign(Object.assign({}, General), Text), Voice);
|
||||
PermissionTypes.defaultPermissions = PermissionTypes.General.VIEW_CHANNELS
|
||||
| PermissionTypes.General.CREATE_INVITE
|
||||
| PermissionTypes.Text.SEND_MESSAGES
|
||||
| PermissionTypes.Text.READ_MESSAGES
|
||||
// | PermissionTypes.Text.ADD_REACTIONS
|
||||
| PermissionTypes.Voice.CONNECT
|
||||
| PermissionTypes.Voice.SPEAK;
|
||||
})(PermissionTypes = exports.PermissionTypes || (exports.PermissionTypes = {}));
|
||||
function getPermString(integer) {
|
||||
var _a, _b;
|
||||
return (typeof integer === 'string')
|
||||
? (_b = (_a = Object
|
||||
.entries(PermissionTypes.All)
|
||||
.filter(([k, v]) => Number.isInteger(+v))
|
||||
.find(([k, v]) => k === integer || v === integer)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : ''
|
||||
: integer.toString();
|
||||
}
|
||||
exports.getPermString = getPermString;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGVybWlzc2lvbnMudHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcGVybWlzc2lvbnMudHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLG9EQUFvRDs7O0FBRXBELElBQWlCLGVBQWUsQ0E0Qy9CO0FBNUNELFdBQWlCLGVBQWU7SUFDOUIsSUFBWSxPQWFYO0lBYkQsV0FBWSxPQUFPO1FBQ2pCLDBEQUFvQixDQUFBO1FBQ3BCLDJDQUEyQztRQUMzQywwQ0FBMEM7UUFDMUMsMkRBQW9CLENBQUE7UUFDcEIseURBQW1CLENBQUE7UUFDbkIsc0RBQWlCLENBQUE7UUFDakIscUNBQXFDO1FBQ3JDLDREQUFvQixDQUFBO1FBQ3BCLHFEQUFnQixDQUFBO1FBQ2hCLHFEQUFnQixDQUFBO1FBQ2hCLHVDQUF1QztRQUN2Qyx1REFBaUIsQ0FBQTtJQUNuQixDQUFDLEVBYlcsT0FBTyxHQUFQLHVCQUFPLEtBQVAsdUJBQU8sUUFhbEI7SUFDRCxJQUFZLElBTVg7SUFORCxXQUFZLElBQUk7UUFDZCw2QkFBNkI7UUFDN0IsK0JBQStCO1FBQy9CLG9EQUF3QixDQUFBO1FBQ3hCLHdEQUEwQixDQUFBO1FBQzFCLG9EQUFvQixDQUFBO0lBQ3RCLENBQUMsRUFOVyxJQUFJLEdBQUosb0JBQUksS0FBSixvQkFBSSxRQU1mO0lBQ0QsSUFBWSxLQUtYO0lBTEQsV0FBWSxLQUFLO1FBQ2Ysc0RBQXdCLENBQUE7UUFDeEIsc0RBQXdCLENBQUE7UUFDeEIsdUNBQWlCLENBQUE7UUFDakIsMkNBQWUsQ0FBQTtJQUNqQixDQUFDLEVBTFcsS0FBSyxHQUFMLHFCQUFLLEtBQUwscUJBQUssUUFLaEI7SUFDWSxtQkFBRyxpREFDWCxPQUFPLEdBQ1AsSUFBSSxHQUNKLEtBQUssQ0FDVCxDQUFBO0lBSVksa0NBQWtCLEdBQzdCLGVBQWUsQ0FBQyxPQUFPLENBQUMsYUFBYTtVQUNuQyxlQUFlLENBQUMsT0FBTyxDQUFDLGFBQWE7VUFDckMsZUFBZSxDQUFDLElBQUksQ0FBQyxhQUFhO1VBQ2xDLGVBQWUsQ0FBQyxJQUFJLENBQUMsYUFBYTtRQUNwQyx1Q0FBdUM7VUFDckMsZUFBZSxDQUFDLEtBQUssQ0FBQyxPQUFPO1VBQzdCLGVBQWUsQ0FBQyxLQUFLLENBQUMsS0FBSyxDQUFDO0FBQ2xDLENBQUMsRUE1Q2dCLGVBQWUsR0FBZix1QkFBZSxLQUFmLHVCQUFlLFFBNEMvQjtBQUVELFNBQWdCLGFBQWEsQ0FBQyxPQUF3Qjs7SUFDcEQsT0FBTyxDQUFDLE9BQU8sT0FBTyxLQUFLLFFBQVEsQ0FBQztRQUNsQyxDQUFDLENBQUMsTUFBQSxNQUFBLE1BQU07YUFDTCxPQUFPLENBQUMsZUFBZSxDQUFDLEdBQUcsQ0FBQzthQUM1QixNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsRUFBRSxFQUFFLENBQUMsTUFBTSxDQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO2FBQ3hDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDLEtBQUssT0FBTyxJQUFJLENBQUMsS0FBSyxPQUFPLENBQUMsMENBQUcsQ0FBQyxDQUFDLG1DQUFJLEVBQUU7UUFDOUQsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxRQUFRLEVBQUUsQ0FBQztBQUN6QixDQUFDO0FBUEQsc0NBT0MifQ==
|
56
frontend/src/types/lib/rest.types.d.ts
vendored
Normal file
56
frontend/src/types/lib/rest.types.d.ts
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
import { Entity } from './entity.types';
|
||||
export declare namespace REST {
|
||||
namespace To {
|
||||
interface Post {
|
||||
'/auth/login': {
|
||||
email: string;
|
||||
password: string;
|
||||
};
|
||||
'/auth/register': {
|
||||
email: string;
|
||||
username: string;
|
||||
password: string;
|
||||
};
|
||||
'/auth/change-password': {
|
||||
email: string;
|
||||
oldPassword: string;
|
||||
newPassword: string;
|
||||
};
|
||||
'/themes': Entity.Theme;
|
||||
}
|
||||
}
|
||||
namespace From {
|
||||
interface Get {
|
||||
'/channels/:channelId/messages': {
|
||||
channelId: string;
|
||||
list: Entity.Message[];
|
||||
total: number;
|
||||
};
|
||||
'/users/entities': {
|
||||
channels: Entity.Channel[];
|
||||
guilds: Entity.Guild[];
|
||||
members: Entity.GuildMember[];
|
||||
roles: Entity.Role[];
|
||||
themes: Entity.Theme[];
|
||||
users: Entity.User[];
|
||||
};
|
||||
'/auth/email/verify-email': {
|
||||
message?: 'Email sent';
|
||||
};
|
||||
'/auth/verify': {
|
||||
token?: string;
|
||||
message?: 'Email verified' | 'Password reset';
|
||||
};
|
||||
}
|
||||
interface Post {
|
||||
'/upload': {
|
||||
url: string;
|
||||
hash: string;
|
||||
};
|
||||
'/auth/change-password': {
|
||||
message: string;
|
||||
token: string;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
3
frontend/src/types/lib/rest.types.js
Normal file
3
frontend/src/types/lib/rest.types.js
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzdC50eXBlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9yZXN0LnR5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
|
5
frontend/src/types/lib/util.types.d.ts
vendored
Normal file
5
frontend/src/types/lib/util.types.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
export declare namespace Util {
|
||||
interface Dictionary {
|
||||
[k: string]: string;
|
||||
}
|
||||
}
|
3
frontend/src/types/lib/util.types.js
Normal file
3
frontend/src/types/lib/util.types.js
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC50eXBlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy91dGlsLnR5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
|
383
frontend/src/types/lib/ws.types.d.ts
vendored
Normal file
383
frontend/src/types/lib/ws.types.d.ts
vendored
Normal file
@ -0,0 +1,383 @@
|
||||
import { Entity, ChannelTypes, InviteTypes, MessageTypes, UserTypes } from './entity.types';
|
||||
export declare namespace WS {
|
||||
interface To {
|
||||
/** Create a channel in a guild. */
|
||||
'CHANNEL_CREATE': Params.ChannelCreate;
|
||||
/** Delete a channel in a guild. */
|
||||
'CHANNEL_DELETE': Params.ChannelDelete;
|
||||
/** Update a channel in a guild. */
|
||||
'CHANNEL_UPDATE': Params.ChannelUpdate;
|
||||
/** Join a voice channel and receive voice events. */
|
||||
'CHANNEL_JOIN': Params.ChannelJoin;
|
||||
/** Leave the voice channel that the client is in. */
|
||||
'CHANNEL_LEAVE': Params.ChannelLeave;
|
||||
/** Create a guild. */
|
||||
'GUILD_CREATE': Params.GuildCreate;
|
||||
/** Delete a guild. */
|
||||
'GUILD_DELETE': Params.GuildDelete;
|
||||
/** Accept a guild invite. */
|
||||
'GUILD_MEMBER_ADD': Params.GuildMemberAdd;
|
||||
/** Remove a member from a guild. */
|
||||
'GUILD_MEMBER_REMOVE': Params.GuildMemberRemove;
|
||||
/** Update a members roles or other properties on a member. */
|
||||
'GUILD_MEMBER_UPDATE': Params.GuildMemberUpdate;
|
||||
/** Create a role in a guild. */
|
||||
'GUILD_ROLE_CREATE': Params.GuildRoleCreate;
|
||||
/** Delete a role in a guild. */
|
||||
'GUILD_ROLE_DELETE': Params.GuildRoleDelete;
|
||||
/** Update a guild role permissions or other properties. */
|
||||
'GUILD_ROLE_UPDATE': Params.GuildRoleUpdate;
|
||||
/** Update the settings of a guild. */
|
||||
'GUILD_UPDATE': Params.GuildUpdate;
|
||||
/** Create an invite in a guild */
|
||||
'INVITE_CREATE': Params.InviteCreate;
|
||||
/** Delete an existing invite in a guild. */
|
||||
'INVITE_DELETE': Params.InviteDelete;
|
||||
/** Create a message in a text-based channel. */
|
||||
'MESSAGE_CREATE': Params.MessageCreate;
|
||||
/** Delete an existing message in a text-based channel. */
|
||||
'MESSAGE_DELETE': Params.MessageDelete;
|
||||
/** Update an existing message in a text-based channel. */
|
||||
'MESSAGE_UPDATE': Params.MessageUpdate;
|
||||
/** Bootstrap your websocket client to be able to use other websocket events.
|
||||
* - Associate ws client ID with user ID.
|
||||
* - Join user rooms.
|
||||
* - Set online status. */
|
||||
'READY': Params.Ready;
|
||||
/** Indicate that you are typing in a text-based channel. */
|
||||
'TYPING_START': Params.TypingStart;
|
||||
/** Delete a user with a given token. */
|
||||
'USER_DELETE': Params.UserDelete;
|
||||
/** Update a user with a given token. */
|
||||
'USER_UPDATE': Params.UserUpdate;
|
||||
/** Send voice data to the server. */
|
||||
'VOICE_DATA': Params.VoiceData;
|
||||
}
|
||||
interface On {
|
||||
/** Manually disconnect from the websocket; logout. */
|
||||
'disconnect': any;
|
||||
}
|
||||
/** WS Args are what is received from the websocket. */
|
||||
interface From {
|
||||
/** Called when a guild channel is created. */
|
||||
'CHANNEL_CREATE': Args.ChannelCreate;
|
||||
/** Called when a guild channel is deleted. */
|
||||
'CHANNEL_DELETE': Args.ChannelDelete;
|
||||
/** Called when a guild channel is updated. */
|
||||
'CHANNEL_UPDATE': Args.ChannelUpdate;
|
||||
/** Called when a guild is deleted, or the client leaves a guild. */
|
||||
'GUILD_DELETE': Args.GuildDelete;
|
||||
/** Called when the client joins a guild. */
|
||||
'GUILD_CREATE': Args.GuildCreate;
|
||||
/** Called when someone joins a guild by an invite, a bot is added, or the client joins guild. */
|
||||
'GUILD_MEMBER_ADD': Args.GuildMemberAdd;
|
||||
/** Called when a guild member is removed, or leaves the guild. */
|
||||
'GUILD_MEMBER_REMOVE': Args.GuildMemberRemove;
|
||||
/** Called when member roles are updated, or other properties. */
|
||||
'GUILD_MEMBER_UPDATE': Args.GuildMemberUpdate;
|
||||
/** Called when a guild role is created. */
|
||||
'GUILD_ROLE_CREATE': Args.GuildRoleCreate;
|
||||
/** Called when a guild role is deleted. */
|
||||
'GUILD_ROLE_DELETE': Args.GuildRoleDelete;
|
||||
/** Called when properties on a guild role are updated. */
|
||||
'GUILD_ROLE_UPDATE': Args.GuildRoleUpdate;
|
||||
/** Called when guild settings are updated. */
|
||||
'GUILD_UPDATE': Args.GuildUpdate;
|
||||
/** Called when a guild invite is created. */
|
||||
'INVITE_CREATE': Args.InviteCreate;
|
||||
/** Called when an existing guild invite is deleted. */
|
||||
'INVITE_DELETE': Args.InviteDelete;
|
||||
/** Called when a message is created in a text-based channel. */
|
||||
'MESSAGE_CREATE': Args.MessageCreate;
|
||||
/** Called when a message is deleted in a text-based channel. */
|
||||
'MESSAGE_DELETE': Args.MessageDelete;
|
||||
/** Called when an existing message is updated in a text-based channel. */
|
||||
'MESSAGE_UPDATE': Args.MessageUpdate;
|
||||
/** Called when a message is sent in a channel you are not ignoring. */
|
||||
'PING': Args.Ping;
|
||||
/** Called when a user goes online or offline. */
|
||||
'PRESENCE_UPDATE': Args.PresenceUpdate;
|
||||
/** Called when the websocket accepts that you are ready. */
|
||||
'READY': Args.Ready;
|
||||
/** Called when someone is typing in a text-based channel. */
|
||||
'TYPING_START': Args.TypingStart;
|
||||
/** Called the client user is deleted. */
|
||||
'USER_DELETE': {};
|
||||
/** Called the client user settings are updated. */
|
||||
'USER_UPDATE': Args.UserUpdate;
|
||||
/** Receive voice data from the server. */
|
||||
'VOICE_DATA': Args.VoiceData;
|
||||
/** Called when a user voice state is updated in the client's voice channel. */
|
||||
'VOICE_STATE_UPDATE': Args.VoiceStateUpdate;
|
||||
'error': object;
|
||||
}
|
||||
namespace Params {
|
||||
interface AddFriend {
|
||||
/** Username of user (case insensitive). */
|
||||
username: string;
|
||||
}
|
||||
interface ChannelCreate {
|
||||
/** The guild ID that the channel should be created in. */
|
||||
guildId: string;
|
||||
/** Name of the channel to create. */
|
||||
name: string;
|
||||
/** Type of the channel to create. */
|
||||
type: ChannelTypes.Type;
|
||||
}
|
||||
interface ChannelDelete {
|
||||
/** ID of the channel to delete. */
|
||||
channelId: string;
|
||||
/** ID of the guild that the channel was in. */
|
||||
guildId: string;
|
||||
}
|
||||
interface ChannelUpdate {
|
||||
/** ID of the channel to update. */
|
||||
channelId: string;
|
||||
summary?: string;
|
||||
name?: string;
|
||||
overrides?: ChannelTypes.Override[];
|
||||
position?: number;
|
||||
}
|
||||
interface ChannelJoin {
|
||||
/** ID of the channel to join. */
|
||||
channelId: string;
|
||||
}
|
||||
interface ChannelLeave {
|
||||
}
|
||||
interface GuildCreate {
|
||||
/** Name of the guild. */
|
||||
name: string;
|
||||
}
|
||||
interface GuildDelete {
|
||||
guildId: string;
|
||||
}
|
||||
interface GuildMemberAdd {
|
||||
inviteCode: string;
|
||||
}
|
||||
interface GuildMemberRemove {
|
||||
/** ID of the guild. */
|
||||
guildId: string;
|
||||
/** ID of the user to kick. */
|
||||
userId: string;
|
||||
}
|
||||
interface GuildMemberUpdate {
|
||||
/** ID of the member, not the same as a user ID. */
|
||||
memberId: string;
|
||||
/** List of role IDs to update. */
|
||||
roleIds?: string[];
|
||||
}
|
||||
interface GuildRoleCreate {
|
||||
guildId: string;
|
||||
}
|
||||
interface GuildRoleDelete {
|
||||
roleId: string;
|
||||
guildId: string;
|
||||
}
|
||||
interface GuildRoleUpdate {
|
||||
roleId: string;
|
||||
guildId: string;
|
||||
color?: string;
|
||||
name?: string;
|
||||
permissions?: number;
|
||||
hoisted?: boolean;
|
||||
}
|
||||
interface GuildUpdate {
|
||||
guildId: string;
|
||||
name?: string;
|
||||
iconURL?: string;
|
||||
systemChannelId?: string;
|
||||
}
|
||||
interface InviteCreate {
|
||||
guildId: string;
|
||||
options: InviteTypes.Options;
|
||||
}
|
||||
interface InviteDelete {
|
||||
inviteCode: string;
|
||||
}
|
||||
interface MessageCreate {
|
||||
channelId: string;
|
||||
content?: string;
|
||||
attachmentURLs?: string[];
|
||||
embed?: MessageTypes.Embed;
|
||||
}
|
||||
interface MessageDelete {
|
||||
messageId: string;
|
||||
}
|
||||
interface MessageUpdate {
|
||||
messageId: string;
|
||||
content?: string;
|
||||
embed?: MessageTypes.Embed;
|
||||
}
|
||||
interface MessageCreate {
|
||||
content?: string;
|
||||
}
|
||||
interface Ready {
|
||||
token: string;
|
||||
}
|
||||
interface RemoveFriend {
|
||||
friendId: string;
|
||||
}
|
||||
interface TypingStart {
|
||||
channelId: string;
|
||||
}
|
||||
interface UserDelete {
|
||||
token: string;
|
||||
}
|
||||
interface UserUpdate {
|
||||
/** Token granted on login. Required to update user. */
|
||||
activeThemeId?: string;
|
||||
avatarURL?: string;
|
||||
email?: string;
|
||||
ignored?: UserTypes.Self['ignored'];
|
||||
token: string;
|
||||
username?: string;
|
||||
}
|
||||
interface VoiceData {
|
||||
channelId: string;
|
||||
blob?: any;
|
||||
}
|
||||
}
|
||||
namespace Args {
|
||||
interface ChannelCreate {
|
||||
/** ID of guild that the channel is in. */
|
||||
guildId: string;
|
||||
/** The full object fo the channel that was created. */
|
||||
channel: Entity.Channel;
|
||||
/** ID of the user that created the channel. */
|
||||
creatorId: string;
|
||||
}
|
||||
interface ChannelDelete {
|
||||
/** ID of guild that the channel is in. */
|
||||
guildId: string;
|
||||
/** The ID of the channel that is deleted. */
|
||||
channelId: string;
|
||||
}
|
||||
interface ChannelUpdate {
|
||||
/** ID of the guild that the channel is in. */
|
||||
channelId: string;
|
||||
/** Properties to update a guild. */
|
||||
partialChannel: Partial<Entity.Channel>;
|
||||
}
|
||||
interface GuildCreate {
|
||||
/** The full object of the guild that was joined. */
|
||||
guild: Entity.Guild;
|
||||
/** Channels associated with guild. */
|
||||
channels: Entity.Channel[];
|
||||
/** Roles associated with guild. */
|
||||
roles: Entity.Role[];
|
||||
/** Guild members associated with guild. */
|
||||
members: Entity.GuildMember[];
|
||||
/** Users associated with guild. */
|
||||
users: Entity.User[];
|
||||
}
|
||||
interface GuildDelete {
|
||||
/** ID of the guild that was left. */
|
||||
guildId: string;
|
||||
}
|
||||
/** Called when a member accepts an invite, or a bot was added to a guild. */
|
||||
interface GuildMemberAdd {
|
||||
/** ID of the guild. */
|
||||
guildId: string;
|
||||
/** Full object of the member that was added to the guild. */
|
||||
member: Entity.GuildMember;
|
||||
/** Full object of the member that was added to the guild. */
|
||||
user: Entity.User;
|
||||
}
|
||||
interface GuildMemberRemove {
|
||||
/** ID of the member. */
|
||||
memberId: string;
|
||||
}
|
||||
interface GuildMemberUpdate {
|
||||
/** Properties of updated guild member. */
|
||||
partialMember: Partial<Entity.GuildMember>;
|
||||
/** ID of the guild member. Not the same as a user ID. */
|
||||
memberId: string;
|
||||
}
|
||||
interface GuildRoleCreate {
|
||||
/** ID of the guild. */
|
||||
guildId: string;
|
||||
/** Full object of the role that was created. */
|
||||
role: Entity.Role;
|
||||
}
|
||||
interface GuildRoleDelete {
|
||||
/** ID of the guild. */
|
||||
guildId: string;
|
||||
/** The ID of the role that was deleted. */
|
||||
roleId: string;
|
||||
}
|
||||
interface GuildRoleUpdate {
|
||||
/** Guild ID associated with role. */
|
||||
guildId: string;
|
||||
/** Properties to update the role. */
|
||||
partialRole: Partial<Entity.Role>;
|
||||
/** The ID of the role that was updated. */
|
||||
roleId: string;
|
||||
}
|
||||
interface GuildUpdate {
|
||||
/** ID of the guild. */
|
||||
guildId: string;
|
||||
/** Properties to update a guild. */
|
||||
partialGuild: Partial<Entity.Guild>;
|
||||
}
|
||||
interface InviteCreate {
|
||||
/** ID of the guild. */
|
||||
guildId: string;
|
||||
/** Full object of the invite. */
|
||||
invite: Entity.Invite;
|
||||
}
|
||||
/** Called when a guild invite is delted. */
|
||||
interface InviteDelete {
|
||||
/** ID of the guild. */
|
||||
guildId: string;
|
||||
/** The ID or the code of the invite. */
|
||||
inviteCode: string;
|
||||
}
|
||||
interface MessageCreate {
|
||||
/** Full object of the message that was created. */
|
||||
message: Entity.Message;
|
||||
}
|
||||
interface MessageDelete {
|
||||
/** ID of the channel with the message. */
|
||||
channelId: string;
|
||||
/** The ID of the message that was deleted. */
|
||||
messageId: string;
|
||||
}
|
||||
interface MessageUpdate {
|
||||
/** ID of the message that was updated. */
|
||||
messageId: string;
|
||||
/** Objects with updated properties from the updated message. */
|
||||
partialMessage: Entity.Message;
|
||||
}
|
||||
interface Ping {
|
||||
channelId: string;
|
||||
guildId?: string;
|
||||
}
|
||||
interface PresenceUpdate {
|
||||
userId: string;
|
||||
status: UserTypes.StatusType;
|
||||
}
|
||||
interface Ready {
|
||||
user: UserTypes.Self;
|
||||
}
|
||||
interface TypingStart {
|
||||
channelId: string;
|
||||
userId: string;
|
||||
}
|
||||
interface UserDelete {
|
||||
userId: string;
|
||||
}
|
||||
/** PRIVATE - contains private data */
|
||||
interface UserUpdate {
|
||||
userId: string;
|
||||
partialUser: Partial<UserTypes.Self>;
|
||||
}
|
||||
interface VoiceData {
|
||||
channelId: string;
|
||||
connections: ChannelTypes.VoiceConnection[];
|
||||
}
|
||||
interface VoiceStateUpdate {
|
||||
userId: string;
|
||||
voice: UserTypes.VoiceState;
|
||||
}
|
||||
}
|
||||
}
|
3
frontend/src/types/lib/ws.types.js
Normal file
3
frontend/src/types/lib/ws.types.js
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid3MudHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvd3MudHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
Loading…
x
Reference in New Issue
Block a user