ttfm-socket 0.2.2
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/LICENSE +21 -0
- package/README.md +212 -0
- package/dist-client/actions/addDj.d.ts +26 -0
- package/dist-client/actions/joinRoom.d.ts +27 -0
- package/dist-client/actions/playOneTimeAnimation.d.ts +31 -0
- package/dist-client/actions/removeDj.d.ts +26 -0
- package/dist-client/actions/skipSong.d.ts +22 -0
- package/dist-client/actions/updateNextSong.d.ts +22 -0
- package/dist-client/actions/voteOnSong.d.ts +27 -0
- package/dist-client/client/ActionheroWebsocketClient.js +3638 -0
- package/dist-client/client/ActionheroWebsocketClient.js.map +1 -0
- package/dist-client/client/SocketClient.d.ts +51 -0
- package/dist-client/client/SocketClient.js +152 -0
- package/dist-client/client/SocketClient.js.map +1 -0
- package/dist-client/client/index.d.ts +14 -0
- package/dist-client/client/index.js +27 -0
- package/dist-client/client/index.js.map +1 -0
- package/dist-client/client/types.d.ts +23 -0
- package/dist-client/client/types.js +4 -0
- package/dist-client/client/types.js.map +1 -0
- package/dist-client/types/messages.d.ts +104 -0
- package/dist-client/types/messages.js +30 -0
- package/dist-client/types/messages.js.map +1 -0
- package/dist-client/types/names.d.ts +46 -0
- package/dist-client/types/names.js +55 -0
- package/dist-client/types/names.js.map +1 -0
- package/dist-client/types/services.d.ts +196 -0
- package/dist-client/types/services.js +18 -0
- package/dist-client/types/services.js.map +1 -0
- package/dist-client/types/state.d.ts +65 -0
- package/dist-client/types/state.js +3 -0
- package/dist-client/types/state.js.map +1 -0
- package/package.json +81 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Operation } from "fast-json-patch";
|
|
2
|
+
import { JoinRoomAction } from "../actions/joinRoom";
|
|
3
|
+
import { ActionResponse } from "./actionhero";
|
|
4
|
+
export declare const StatefulServerMessageName: {
|
|
5
|
+
readonly addedDj: "addedDj";
|
|
6
|
+
readonly lookedUpSong: "lookedUpSong";
|
|
7
|
+
readonly playedSong: "playedSong";
|
|
8
|
+
readonly removedDj: "removedDj";
|
|
9
|
+
readonly updatedRoomSettings: "updatedRoomSettings";
|
|
10
|
+
readonly updatedGuestPassword: "updatedGuestPassword";
|
|
11
|
+
readonly updatedNextSong: "updatedNextSong";
|
|
12
|
+
readonly updatedUserProfile: "updatedUserProfile";
|
|
13
|
+
readonly userJoined: "userJoined";
|
|
14
|
+
readonly userLeft: "userLeft";
|
|
15
|
+
readonly votedOnSong: "votedOnSong";
|
|
16
|
+
};
|
|
17
|
+
export declare const StatelessServerMessageName: {
|
|
18
|
+
readonly kickedFromRoom: "kickedFromRoom";
|
|
19
|
+
readonly playedOneTimeAnimation: "playedOneTimeAnimation";
|
|
20
|
+
readonly roomReset: "roomReset";
|
|
21
|
+
};
|
|
22
|
+
export declare const ServerMessageName: {
|
|
23
|
+
kickedFromRoom: "kickedFromRoom";
|
|
24
|
+
playedOneTimeAnimation: "playedOneTimeAnimation";
|
|
25
|
+
roomReset: "roomReset";
|
|
26
|
+
addedDj: "addedDj";
|
|
27
|
+
lookedUpSong: "lookedUpSong";
|
|
28
|
+
playedSong: "playedSong";
|
|
29
|
+
removedDj: "removedDj";
|
|
30
|
+
updatedRoomSettings: "updatedRoomSettings";
|
|
31
|
+
updatedGuestPassword: "updatedGuestPassword";
|
|
32
|
+
updatedNextSong: "updatedNextSong";
|
|
33
|
+
updatedUserProfile: "updatedUserProfile";
|
|
34
|
+
userJoined: "userJoined";
|
|
35
|
+
userLeft: "userLeft";
|
|
36
|
+
votedOnSong: "votedOnSong";
|
|
37
|
+
};
|
|
38
|
+
export type StatefulServerMessageNameType = (typeof StatefulServerMessageName)[keyof typeof StatefulServerMessageName];
|
|
39
|
+
export type StatelessServerMessageNameType = (typeof StatelessServerMessageName)[keyof typeof StatelessServerMessageName];
|
|
40
|
+
export type ServerMessageNameType = (typeof ServerMessageName)[keyof typeof ServerMessageName];
|
|
41
|
+
export type PlayedOneTimeAnimationParams<O extends OneTimeAnimationType = OneTimeAnimationType> = {
|
|
42
|
+
userUuid: string;
|
|
43
|
+
animation: O;
|
|
44
|
+
emoji: O extends typeof OneTimeAnimation.emoji ? string : undefined;
|
|
45
|
+
};
|
|
46
|
+
export type KickedFromRoomParams = Record<string, never>;
|
|
47
|
+
export type StatelessServerMessageParams = PlayedOneTimeAnimationParams | KickedFromRoomParams;
|
|
48
|
+
export declare const OneTimeAnimation: {
|
|
49
|
+
readonly emoji: "emoji";
|
|
50
|
+
readonly jump: "jump";
|
|
51
|
+
};
|
|
52
|
+
export type OneTimeAnimationType = (typeof OneTimeAnimation)[keyof typeof OneTimeAnimation];
|
|
53
|
+
export type StatefulServerMessage = {
|
|
54
|
+
name: StatefulServerMessageNameType;
|
|
55
|
+
statePatch: Operation[];
|
|
56
|
+
params?: undefined;
|
|
57
|
+
};
|
|
58
|
+
export type PlayedOneTimeAnimationMessage = {
|
|
59
|
+
name: typeof StatelessServerMessageName.playedOneTimeAnimation;
|
|
60
|
+
params: PlayedOneTimeAnimationParams;
|
|
61
|
+
};
|
|
62
|
+
export type KickedFromRoomMessage = {
|
|
63
|
+
name: typeof StatelessServerMessageName.kickedFromRoom;
|
|
64
|
+
params?: undefined;
|
|
65
|
+
};
|
|
66
|
+
export type StatelessServerMessage = {
|
|
67
|
+
statePatch?: undefined;
|
|
68
|
+
} & (PlayedOneTimeAnimationMessage | KickedFromRoomMessage);
|
|
69
|
+
export type CustomServerMessage = StatefulServerMessage | StatelessServerMessage;
|
|
70
|
+
export type ExtractStatelessServerMessage<N extends StatelessServerMessageNameType> = Extract<StatelessServerMessage, {
|
|
71
|
+
name: N;
|
|
72
|
+
}>;
|
|
73
|
+
export type MessageContext = "response" | "user" | "alert" | "api";
|
|
74
|
+
export type EventType = "say" | "action" | "roomView" | "roomAdd" | "roomLeave";
|
|
75
|
+
export type BaseMessage = {
|
|
76
|
+
messageId: number;
|
|
77
|
+
};
|
|
78
|
+
export type ResponseMessage = BaseMessage & {
|
|
79
|
+
context: MessageContext;
|
|
80
|
+
status: string;
|
|
81
|
+
};
|
|
82
|
+
export type ServerMessage = BaseMessage & {
|
|
83
|
+
message: CustomServerMessage;
|
|
84
|
+
room: string;
|
|
85
|
+
from: string;
|
|
86
|
+
context: MessageContext;
|
|
87
|
+
sentAt: number;
|
|
88
|
+
welcome?: string;
|
|
89
|
+
error?: string;
|
|
90
|
+
};
|
|
91
|
+
export type Promises = {
|
|
92
|
+
[messageId: string]: {
|
|
93
|
+
resolve: (message: ServerMessage | Awaited<ActionResponse<JoinRoomAction>>) => void;
|
|
94
|
+
reject: (error: string) => void;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export type SendParams = {
|
|
98
|
+
messageId?: number;
|
|
99
|
+
} & Record<string, unknown>;
|
|
100
|
+
export type SendArgs = {
|
|
101
|
+
event: string;
|
|
102
|
+
room?: string;
|
|
103
|
+
params?: SendParams;
|
|
104
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OneTimeAnimation = exports.ServerMessageName = exports.StatelessServerMessageName = exports.StatefulServerMessageName = void 0;
|
|
4
|
+
exports.StatefulServerMessageName = {
|
|
5
|
+
addedDj: "addedDj",
|
|
6
|
+
lookedUpSong: "lookedUpSong",
|
|
7
|
+
playedSong: "playedSong",
|
|
8
|
+
removedDj: "removedDj",
|
|
9
|
+
updatedRoomSettings: "updatedRoomSettings",
|
|
10
|
+
updatedGuestPassword: "updatedGuestPassword",
|
|
11
|
+
updatedNextSong: "updatedNextSong",
|
|
12
|
+
updatedUserProfile: "updatedUserProfile",
|
|
13
|
+
userJoined: "userJoined",
|
|
14
|
+
userLeft: "userLeft",
|
|
15
|
+
votedOnSong: "votedOnSong",
|
|
16
|
+
};
|
|
17
|
+
exports.StatelessServerMessageName = {
|
|
18
|
+
kickedFromRoom: "kickedFromRoom",
|
|
19
|
+
playedOneTimeAnimation: "playedOneTimeAnimation",
|
|
20
|
+
roomReset: "roomReset",
|
|
21
|
+
};
|
|
22
|
+
exports.ServerMessageName = {
|
|
23
|
+
...exports.StatefulServerMessageName,
|
|
24
|
+
...exports.StatelessServerMessageName,
|
|
25
|
+
};
|
|
26
|
+
exports.OneTimeAnimation = {
|
|
27
|
+
emoji: "emoji",
|
|
28
|
+
jump: "jump",
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/types/messages.ts"],"names":[],"mappings":";;;AAIa,QAAA,yBAAyB,GAAG;IACvC,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,cAAc;IAC5B,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,WAAW;IACtB,mBAAmB,EAAE,qBAAqB;IAC1C,oBAAoB,EAAE,sBAAsB;IAC5C,eAAe,EAAE,iBAAiB;IAClC,kBAAkB,EAAE,oBAAoB;IACxC,UAAU,EAAE,YAAY;IACxB,QAAQ,EAAE,UAAU;IACpB,WAAW,EAAE,aAAa;CAClB,CAAC;AAEE,QAAA,0BAA0B,GAAG;IACxC,cAAc,EAAE,gBAAgB;IAChC,sBAAsB,EAAE,wBAAwB;IAChD,SAAS,EAAE,WAAW;CACd,CAAC;AAEE,QAAA,iBAAiB,GAAG;IAC/B,GAAG,iCAAyB;IAC5B,GAAG,kCAA0B;CAC9B,CAAC;AA0BW,QAAA,gBAAgB,GAAG;IAC9B,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;CACJ,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare enum ActionName {
|
|
2
|
+
addDj = "addDj",
|
|
3
|
+
addUser = "addUser",
|
|
4
|
+
getRoomStates = "getRoomStates",
|
|
5
|
+
joinRoom = "joinRoom",
|
|
6
|
+
kickUserFromRoom = "kickUserFromRoom",
|
|
7
|
+
kickUserGlobally = "kickUserGlobally",
|
|
8
|
+
nextSong = "nextSong",
|
|
9
|
+
playOneTimeAnimation = "playOneTimeAnimation",
|
|
10
|
+
playSong = "playSong",
|
|
11
|
+
removeDj = "removeDj",
|
|
12
|
+
removeUser = "removeUser",
|
|
13
|
+
resetRoom = "resetRoom",
|
|
14
|
+
skipSong = "skipSong",
|
|
15
|
+
updateNextSong = "updateNextSong",
|
|
16
|
+
updateRoomSettings = "updateRoomSettings",
|
|
17
|
+
voteOnSong = "voteOnSong"
|
|
18
|
+
}
|
|
19
|
+
export declare enum TaskName {
|
|
20
|
+
endOfSong = "endOfSong",
|
|
21
|
+
handleDisconnect = "handleDisconnect",
|
|
22
|
+
lookupSong = "lookupSong",
|
|
23
|
+
sendKinesisStreamData = "sendKinesisStreamData",
|
|
24
|
+
sendSongChatMessage = "sendSongChatMessage",
|
|
25
|
+
syncNumberOfUsers = "syncNumberOfUsers",
|
|
26
|
+
updateGuestPassword = "updateGuestPassword",
|
|
27
|
+
updateUserProfile = "updateUserProfile"
|
|
28
|
+
}
|
|
29
|
+
export declare enum QueueName {
|
|
30
|
+
high = "high",
|
|
31
|
+
low = "low"
|
|
32
|
+
}
|
|
33
|
+
export declare enum MiddlewareName {
|
|
34
|
+
auth = "auth",
|
|
35
|
+
chat = "chat",
|
|
36
|
+
sentryAction = "sentryAction",
|
|
37
|
+
sentryTask = "sentryTask",
|
|
38
|
+
serverOnlyAction = "serverOnlyAction",
|
|
39
|
+
serviceSuperUserOrStaff = "serviceSuperUserOrStaff",
|
|
40
|
+
userRoomAction = "userRoomAction"
|
|
41
|
+
}
|
|
42
|
+
export declare enum RedisChannelName {
|
|
43
|
+
kickUser = "kickUser",
|
|
44
|
+
roomConfig = "roomConfig",
|
|
45
|
+
userProfile = "userProfile"
|
|
46
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RedisChannelName = exports.MiddlewareName = exports.QueueName = exports.TaskName = exports.ActionName = void 0;
|
|
4
|
+
var ActionName;
|
|
5
|
+
(function (ActionName) {
|
|
6
|
+
ActionName["addDj"] = "addDj";
|
|
7
|
+
ActionName["addUser"] = "addUser";
|
|
8
|
+
ActionName["getRoomStates"] = "getRoomStates";
|
|
9
|
+
ActionName["joinRoom"] = "joinRoom";
|
|
10
|
+
ActionName["kickUserFromRoom"] = "kickUserFromRoom";
|
|
11
|
+
ActionName["kickUserGlobally"] = "kickUserGlobally";
|
|
12
|
+
ActionName["nextSong"] = "nextSong";
|
|
13
|
+
ActionName["playOneTimeAnimation"] = "playOneTimeAnimation";
|
|
14
|
+
ActionName["playSong"] = "playSong";
|
|
15
|
+
ActionName["removeDj"] = "removeDj";
|
|
16
|
+
ActionName["removeUser"] = "removeUser";
|
|
17
|
+
ActionName["resetRoom"] = "resetRoom";
|
|
18
|
+
ActionName["skipSong"] = "skipSong";
|
|
19
|
+
ActionName["updateNextSong"] = "updateNextSong";
|
|
20
|
+
ActionName["updateRoomSettings"] = "updateRoomSettings";
|
|
21
|
+
ActionName["voteOnSong"] = "voteOnSong";
|
|
22
|
+
})(ActionName || (exports.ActionName = ActionName = {}));
|
|
23
|
+
var TaskName;
|
|
24
|
+
(function (TaskName) {
|
|
25
|
+
TaskName["endOfSong"] = "endOfSong";
|
|
26
|
+
TaskName["handleDisconnect"] = "handleDisconnect";
|
|
27
|
+
TaskName["lookupSong"] = "lookupSong";
|
|
28
|
+
TaskName["sendKinesisStreamData"] = "sendKinesisStreamData";
|
|
29
|
+
TaskName["sendSongChatMessage"] = "sendSongChatMessage";
|
|
30
|
+
TaskName["syncNumberOfUsers"] = "syncNumberOfUsers";
|
|
31
|
+
TaskName["updateGuestPassword"] = "updateGuestPassword";
|
|
32
|
+
TaskName["updateUserProfile"] = "updateUserProfile";
|
|
33
|
+
})(TaskName || (exports.TaskName = TaskName = {}));
|
|
34
|
+
var QueueName;
|
|
35
|
+
(function (QueueName) {
|
|
36
|
+
QueueName["high"] = "high";
|
|
37
|
+
QueueName["low"] = "low";
|
|
38
|
+
})(QueueName || (exports.QueueName = QueueName = {}));
|
|
39
|
+
var MiddlewareName;
|
|
40
|
+
(function (MiddlewareName) {
|
|
41
|
+
MiddlewareName["auth"] = "auth";
|
|
42
|
+
MiddlewareName["chat"] = "chat";
|
|
43
|
+
MiddlewareName["sentryAction"] = "sentryAction";
|
|
44
|
+
MiddlewareName["sentryTask"] = "sentryTask";
|
|
45
|
+
MiddlewareName["serverOnlyAction"] = "serverOnlyAction";
|
|
46
|
+
MiddlewareName["serviceSuperUserOrStaff"] = "serviceSuperUserOrStaff";
|
|
47
|
+
MiddlewareName["userRoomAction"] = "userRoomAction";
|
|
48
|
+
})(MiddlewareName || (exports.MiddlewareName = MiddlewareName = {}));
|
|
49
|
+
var RedisChannelName;
|
|
50
|
+
(function (RedisChannelName) {
|
|
51
|
+
RedisChannelName["kickUser"] = "kickUser";
|
|
52
|
+
RedisChannelName["roomConfig"] = "roomConfig";
|
|
53
|
+
RedisChannelName["userProfile"] = "userProfile";
|
|
54
|
+
})(RedisChannelName || (exports.RedisChannelName = RedisChannelName = {}));
|
|
55
|
+
//# sourceMappingURL=names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.js","sourceRoot":"","sources":["../../src/types/names.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAiBX;AAjBD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,iCAAmB,CAAA;IACnB,6CAA+B,CAAA;IAC/B,mCAAqB,CAAA;IACrB,mDAAqC,CAAA;IACrC,mDAAqC,CAAA;IACrC,mCAAqB,CAAA;IACrB,2DAA6C,CAAA;IAC7C,mCAAqB,CAAA;IACrB,mCAAqB,CAAA;IACrB,uCAAyB,CAAA;IACzB,qCAAuB,CAAA;IACvB,mCAAqB,CAAA;IACrB,+CAAiC,CAAA;IACjC,uDAAyC,CAAA;IACzC,uCAAyB,CAAA;AAC3B,CAAC,EAjBW,UAAU,0BAAV,UAAU,QAiBrB;AAED,IAAY,QASX;AATD,WAAY,QAAQ;IAClB,mCAAuB,CAAA;IACvB,iDAAqC,CAAA;IACrC,qCAAyB,CAAA;IACzB,2DAA+C,CAAA;IAC/C,uDAA2C,CAAA;IAC3C,mDAAuC,CAAA;IACvC,uDAA2C,CAAA;IAC3C,mDAAuC,CAAA;AACzC,CAAC,EATW,QAAQ,wBAAR,QAAQ,QASnB;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,0BAAa,CAAA;IACb,wBAAW,CAAA;AACb,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,IAAY,cAQX;AARD,WAAY,cAAc;IACxB,+BAAa,CAAA;IACb,+BAAa,CAAA;IACb,+CAA6B,CAAA;IAC7B,2CAAyB,CAAA;IACzB,uDAAqC,CAAA;IACrC,qEAAmD,CAAA;IACnD,mDAAiC,CAAA;AACnC,CAAC,EARW,cAAc,8BAAd,cAAc,QAQzB;AAED,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,yCAAqB,CAAA;IACrB,6CAAyB,CAAA;IACzB,+CAA2B,CAAA;AAC7B,CAAC,EAJW,gBAAgB,gCAAhB,gBAAgB,QAI3B"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
export declare enum TokenRole {
|
|
2
|
+
GLOBAL_MODERATOR = "globalModerator",
|
|
3
|
+
STAFF = "staff",
|
|
4
|
+
SUPER_USER = "superUser",
|
|
5
|
+
PROMOTER = "promoter",
|
|
6
|
+
USER = "user",
|
|
7
|
+
BOT = "bot",
|
|
8
|
+
ADMIN = "admin",
|
|
9
|
+
MODERATOR = "moderator",
|
|
10
|
+
GUEST = "guest"
|
|
11
|
+
}
|
|
12
|
+
export declare type MusicProvidersDTO = {
|
|
13
|
+
apple?: string;
|
|
14
|
+
audius?: string;
|
|
15
|
+
napster?: string;
|
|
16
|
+
soundCloudPublic?: string;
|
|
17
|
+
spotify?: string;
|
|
18
|
+
youtube?: string;
|
|
19
|
+
pandora?: string;
|
|
20
|
+
deezer?: string;
|
|
21
|
+
tidal?: string;
|
|
22
|
+
amazonMusic?: string;
|
|
23
|
+
yandex?: string;
|
|
24
|
+
spinrilla?: string;
|
|
25
|
+
uploadService?: string;
|
|
26
|
+
};
|
|
27
|
+
export declare type AppleMusicLinks = {
|
|
28
|
+
url: string;
|
|
29
|
+
nativeAppUriMobile?: string;
|
|
30
|
+
nativeAppUriDesktop?: string;
|
|
31
|
+
};
|
|
32
|
+
export declare type CommonLinks = {
|
|
33
|
+
url: string;
|
|
34
|
+
};
|
|
35
|
+
export declare type SpotifyLinks = {
|
|
36
|
+
url: string;
|
|
37
|
+
nativeAppUriDesktop?: string;
|
|
38
|
+
};
|
|
39
|
+
export declare type ThumbnailsDTO = {
|
|
40
|
+
apple?: string;
|
|
41
|
+
audius?: string;
|
|
42
|
+
napster?: string;
|
|
43
|
+
soundCloudPublic?: string;
|
|
44
|
+
spotify?: string;
|
|
45
|
+
youtube?: string;
|
|
46
|
+
pandora?: string;
|
|
47
|
+
deezer?: string;
|
|
48
|
+
tidal?: string;
|
|
49
|
+
amazonMusic?: string;
|
|
50
|
+
yandex?: string;
|
|
51
|
+
spinrilla?: string;
|
|
52
|
+
uploadService?: string;
|
|
53
|
+
};
|
|
54
|
+
export declare type MinimalCrateSongResDTO = {
|
|
55
|
+
artistName: string;
|
|
56
|
+
trackName: string;
|
|
57
|
+
genre: string | null;
|
|
58
|
+
duration: number;
|
|
59
|
+
isrc: string | null;
|
|
60
|
+
musicProviders: MusicProvidersDTO;
|
|
61
|
+
playbackToken: string | null;
|
|
62
|
+
thumbnails: ThumbnailsDTO;
|
|
63
|
+
songShortId?: string;
|
|
64
|
+
crateSongUuid?: string;
|
|
65
|
+
status?: MinimalCrateSongResDTO.status;
|
|
66
|
+
position?: number;
|
|
67
|
+
};
|
|
68
|
+
export declare namespace MinimalCrateSongResDTO {
|
|
69
|
+
enum status {
|
|
70
|
+
PENDING_UPLOAD = "PENDING_UPLOAD",
|
|
71
|
+
VALID_FILE_TYPE = "VALID_FILE_TYPE",
|
|
72
|
+
MISSING_METADATA = "MISSING_METADATA",
|
|
73
|
+
VERIFIED = "VERIFIED",
|
|
74
|
+
UNVERIFIED = "UNVERIFIED",
|
|
75
|
+
VERIFICATION_ERROR = "VERIFICATION_ERROR",
|
|
76
|
+
VERIFICATION_POSTPONED = "VERIFICATION_POSTPONED",
|
|
77
|
+
DATA_NOT_FOUND = "DATA_NOT_FOUND",
|
|
78
|
+
PENDING_REQUEST = "PENDING_REQUEST",
|
|
79
|
+
SUCCESS = "SUCCESS",
|
|
80
|
+
FETCH_FAILED = "FETCH_FAILED"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export declare type UserRoles = {
|
|
84
|
+
id: number;
|
|
85
|
+
roomId: number;
|
|
86
|
+
room: any;
|
|
87
|
+
userUuid: string;
|
|
88
|
+
role: UserRoles.role;
|
|
89
|
+
expirationTime: string | null;
|
|
90
|
+
createdAt: string;
|
|
91
|
+
updatedAt: string;
|
|
92
|
+
};
|
|
93
|
+
export declare namespace UserRoles {
|
|
94
|
+
enum role {
|
|
95
|
+
MODERATOR = "moderator",
|
|
96
|
+
OWNER = "owner",
|
|
97
|
+
CO_OWNER = "coOwner",
|
|
98
|
+
BANNED = "banned",
|
|
99
|
+
KICKED = "kicked",
|
|
100
|
+
CHAT_DISABLED = "chatDisabled",
|
|
101
|
+
DJ_DISABLED = "djDisabled",
|
|
102
|
+
DJ = "dj"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
export declare type RoomDto = {
|
|
106
|
+
id?: number;
|
|
107
|
+
name: string;
|
|
108
|
+
description: string;
|
|
109
|
+
vibe: string;
|
|
110
|
+
djType: RoomDto.djType;
|
|
111
|
+
musicProviderKeys: Array<"apple" | "audius" | "napster" | "soundCloudPublic" | "spotify" | "uploadService" | "youtube">;
|
|
112
|
+
numberOfDjs: number;
|
|
113
|
+
songsPerDj: number;
|
|
114
|
+
usersInRoomUuids?: Array<string>;
|
|
115
|
+
friendInRoomUuids?: Array<string>;
|
|
116
|
+
slug: string;
|
|
117
|
+
roomSize: number;
|
|
118
|
+
entryFee: number;
|
|
119
|
+
freeEntries: number;
|
|
120
|
+
password?: string;
|
|
121
|
+
guestPassword?: string;
|
|
122
|
+
type: RoomDto.type;
|
|
123
|
+
domain: string;
|
|
124
|
+
socketDomain: string;
|
|
125
|
+
socketPath: string;
|
|
126
|
+
provisionedRoomProductId?: string;
|
|
127
|
+
createdAt: string;
|
|
128
|
+
updatedAt: string;
|
|
129
|
+
isPasswordProtected: boolean;
|
|
130
|
+
numberOfUsersInRoom?: number;
|
|
131
|
+
numberOfActiveDjs?: number;
|
|
132
|
+
song?: any;
|
|
133
|
+
debugCommunication: boolean;
|
|
134
|
+
promoted: boolean;
|
|
135
|
+
neverSuspended: boolean;
|
|
136
|
+
roomServerId?: string;
|
|
137
|
+
roomRoles?: Array<UserRoles>;
|
|
138
|
+
pinnedMessages?: Array<any>;
|
|
139
|
+
lastTimeSuspended?: string;
|
|
140
|
+
design: RoomDto.design;
|
|
141
|
+
isLive: boolean;
|
|
142
|
+
liveAudio: boolean;
|
|
143
|
+
posterUrl?: string | null;
|
|
144
|
+
externalUrl?: string | null;
|
|
145
|
+
uuid: string;
|
|
146
|
+
isGuestPasswordProtected: boolean;
|
|
147
|
+
hasChat: boolean;
|
|
148
|
+
};
|
|
149
|
+
export declare namespace RoomDto {
|
|
150
|
+
enum djType {
|
|
151
|
+
EVERYONE = "EVERYONE",
|
|
152
|
+
INVITE_ONLY = "INVITE_ONLY",
|
|
153
|
+
PRO_PLAN_OWNER = "PRO_PLAN_OWNER"
|
|
154
|
+
}
|
|
155
|
+
enum type {
|
|
156
|
+
PUBLIC = "PUBLIC",
|
|
157
|
+
PRIVATE = "PRIVATE"
|
|
158
|
+
}
|
|
159
|
+
enum design {
|
|
160
|
+
BARN = "BARN",
|
|
161
|
+
BARN_UA = "BARN_UA",
|
|
162
|
+
CHAT_ONLY = "CHAT_ONLY",
|
|
163
|
+
CLUB = "CLUB",
|
|
164
|
+
CLUB_UA = "CLUB_UA",
|
|
165
|
+
FERRY_BUILDING = "FERRY_BUILDING",
|
|
166
|
+
FESTIVAL = "FESTIVAL",
|
|
167
|
+
STADIUM = "STADIUM",
|
|
168
|
+
THEATER = "THEATER",
|
|
169
|
+
TOMORROWLAND = "TOMORROWLAND",
|
|
170
|
+
UNDERGROUND = "UNDERGROUND",
|
|
171
|
+
YACHT = "YACHT"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
export declare type OtherUserProfileResDto = {
|
|
175
|
+
id: number;
|
|
176
|
+
color: string;
|
|
177
|
+
uuid: string;
|
|
178
|
+
avatarId: string;
|
|
179
|
+
nickname: string;
|
|
180
|
+
firstName: string;
|
|
181
|
+
lastName: string;
|
|
182
|
+
pronoun: string;
|
|
183
|
+
displayPronouns: boolean;
|
|
184
|
+
songOfTheWeek: string;
|
|
185
|
+
song: any;
|
|
186
|
+
zodiac: string;
|
|
187
|
+
createdAt: string;
|
|
188
|
+
coverPicture: string;
|
|
189
|
+
facebook: string;
|
|
190
|
+
instagram: string;
|
|
191
|
+
twitter: string;
|
|
192
|
+
snapchat: string;
|
|
193
|
+
tiktok: string;
|
|
194
|
+
badges: Array<"VERIFIED" | "PLATINUM" | "DOUBLE_PLATINUM" | "JQBX" | "STAFF">;
|
|
195
|
+
priceForGig: number;
|
|
196
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenRole = void 0;
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-namespace */
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
+
var TokenRole;
|
|
7
|
+
(function (TokenRole) {
|
|
8
|
+
TokenRole["GLOBAL_MODERATOR"] = "globalModerator";
|
|
9
|
+
TokenRole["STAFF"] = "staff";
|
|
10
|
+
TokenRole["SUPER_USER"] = "superUser";
|
|
11
|
+
TokenRole["PROMOTER"] = "promoter";
|
|
12
|
+
TokenRole["USER"] = "user";
|
|
13
|
+
TokenRole["BOT"] = "bot";
|
|
14
|
+
TokenRole["ADMIN"] = "admin";
|
|
15
|
+
TokenRole["MODERATOR"] = "moderator";
|
|
16
|
+
TokenRole["GUEST"] = "guest";
|
|
17
|
+
})(TokenRole || (exports.TokenRole = TokenRole = {}));
|
|
18
|
+
//# sourceMappingURL=services.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../src/types/services.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACpD,uDAAuD;AACvD,IAAY,SAUX;AAVD,WAAY,SAAS;IACnB,iDAAoC,CAAA;IACpC,4BAAe,CAAA;IACf,qCAAwB,CAAA;IACxB,kCAAqB,CAAA;IACrB,0BAAa,CAAA;IACb,wBAAW,CAAA;IACX,4BAAe,CAAA;IACf,oCAAuB,CAAA;IACvB,4BAAe,CAAA;AACjB,CAAC,EAVW,SAAS,yBAAT,SAAS,QAUpB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { MinimalCrateSongResDTO, OtherUserProfileResDto, RoomDto, TokenRole, UserRoles } from "./services";
|
|
2
|
+
export type GhostUserProfile = Pick<OtherUserProfileResDto, "color" | "uuid" | "avatarId" | "nickname">;
|
|
3
|
+
export type ServerDj = {
|
|
4
|
+
userUuid: string;
|
|
5
|
+
/** The key where the song was saved in the Actionhero cache. */
|
|
6
|
+
nextSongId: string | null;
|
|
7
|
+
};
|
|
8
|
+
export type ClientDj = ClientRoomUser & {
|
|
9
|
+
nextSong: MinimalCrateSongResDTO | null;
|
|
10
|
+
};
|
|
11
|
+
export type AvatarPosition = {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
};
|
|
15
|
+
export type SongVotes = {
|
|
16
|
+
like?: boolean;
|
|
17
|
+
star?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type ServerRoomUser = {
|
|
20
|
+
userProfile: OtherUserProfileResDto | GhostUserProfile;
|
|
21
|
+
position: AvatarPosition;
|
|
22
|
+
songVotes: SongVotes;
|
|
23
|
+
tokenRole: TokenRole;
|
|
24
|
+
};
|
|
25
|
+
export type ClientRoomUser = ServerRoomUser & {
|
|
26
|
+
highestRole: UserRoles.role | undefined;
|
|
27
|
+
canDj: boolean;
|
|
28
|
+
};
|
|
29
|
+
export type ServerNowPlaying = {
|
|
30
|
+
songId: string;
|
|
31
|
+
startTime: number;
|
|
32
|
+
endTime: number;
|
|
33
|
+
};
|
|
34
|
+
export type ClientNowPlaying = {
|
|
35
|
+
song: MinimalCrateSongResDTO;
|
|
36
|
+
startTime: number;
|
|
37
|
+
endTime: number;
|
|
38
|
+
};
|
|
39
|
+
export type ServerRoomState = {
|
|
40
|
+
allUsers: ServerRoomUser[];
|
|
41
|
+
djs: ServerDj[];
|
|
42
|
+
nowPlaying: ServerNowPlaying | null;
|
|
43
|
+
settings?: RoomDto;
|
|
44
|
+
shouldRemoveDjAfterSong: boolean;
|
|
45
|
+
songsRemainingForDj: number;
|
|
46
|
+
};
|
|
47
|
+
export type AllVotes = {
|
|
48
|
+
likes: string[];
|
|
49
|
+
dislikes: string[];
|
|
50
|
+
stars: string[];
|
|
51
|
+
};
|
|
52
|
+
export type VoteCounts = Record<keyof AllVotes, number>;
|
|
53
|
+
export type ClientRoomState = {
|
|
54
|
+
allUsers: ClientRoomUser[];
|
|
55
|
+
allVotes: AllVotes;
|
|
56
|
+
audienceUsers: ClientRoomUser[];
|
|
57
|
+
djs: ClientDj[];
|
|
58
|
+
floorUsers: ClientRoomUser[];
|
|
59
|
+
nowPlaying: ClientNowPlaying | null;
|
|
60
|
+
settings: RoomDto;
|
|
61
|
+
songsRemainingForDj: number;
|
|
62
|
+
vibeMeter: number;
|
|
63
|
+
visibleDjs: ClientDj[];
|
|
64
|
+
voteCounts: VoteCounts;
|
|
65
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/types/state.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ttfm-socket",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"main": "./dist-client/client/index.js",
|
|
5
|
+
"typings": "./dist-client/client/index.d.ts",
|
|
6
|
+
"devDependencies": {
|
|
7
|
+
"@ttfm-labs/nestjs-backend": "^2.0.9",
|
|
8
|
+
"@types/glob": "^8.1.0",
|
|
9
|
+
"@types/jest": "^29.5.3",
|
|
10
|
+
"@types/jsonwebtoken": "^9.0.2",
|
|
11
|
+
"@types/node": "^20.4.2",
|
|
12
|
+
"@types/poisson-disk-sampling": "^2.2.1",
|
|
13
|
+
"@types/react": "^18.2.15",
|
|
14
|
+
"@types/react-dom": "^18.2.7",
|
|
15
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
16
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
17
|
+
"@vitejs/plugin-react": "^4.0.3",
|
|
18
|
+
"aws-sdk-client-mock": "^3.0.0",
|
|
19
|
+
"eslint": "^8.45.0",
|
|
20
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
21
|
+
"jest": "^29.6.1",
|
|
22
|
+
"jest-fetch-mock": "^3.0.3",
|
|
23
|
+
"prettier": "^3.0.0",
|
|
24
|
+
"react": "^18.2.0",
|
|
25
|
+
"react-dom": "^18.2.0",
|
|
26
|
+
"react-json-tree": "^0.18.0",
|
|
27
|
+
"rimraf": "^5.0.1",
|
|
28
|
+
"ts-jest": "^29.1.1",
|
|
29
|
+
"ts-node-dev": "^2.0.0",
|
|
30
|
+
"type-fest": "^4.0.0",
|
|
31
|
+
"typescript": "^5.1.6",
|
|
32
|
+
"vite": "^4.4.4",
|
|
33
|
+
"vite-plugin-commonjs": "^0.8.2",
|
|
34
|
+
"vite-plugin-node-polyfills": "^0.9.0"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"eventemitter3": "^5.0.1"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"dev": "ts-node-dev --no-deps --transpile-only ./src/server",
|
|
41
|
+
"debug": "tsc && ts-node-dev --transpile-only --debounce 300 --no-deps --inspect -- ./src/server ",
|
|
42
|
+
"start": "node ./dist/server.js",
|
|
43
|
+
"actionhero": "actionhero",
|
|
44
|
+
"test": "jest",
|
|
45
|
+
"build": "rimraf ./dist && tsc --project src",
|
|
46
|
+
"build:client": "rimraf ./dist-client && tsc --project src/client",
|
|
47
|
+
"lint": "eslint 'src/*/**.{ts,tsx}' '__tests__/*/**.{ts,tsx}' --max-warnings=0",
|
|
48
|
+
"lint:fix": "eslint 'src/*/**.{ts,tsx}' '__tests__/*/**.{ts,tsx}' --fix",
|
|
49
|
+
"pretty": "prettier --write src/*/** __tests__/*/**",
|
|
50
|
+
"typecheck": "tsc",
|
|
51
|
+
"dev:web": "vite",
|
|
52
|
+
"build:web": "tsc && vite build",
|
|
53
|
+
"preview:web": "vite preview",
|
|
54
|
+
"prepublishOnly": "node scripts/cleanse-pkg",
|
|
55
|
+
"postpublish": "node scripts/restore-pkg"
|
|
56
|
+
},
|
|
57
|
+
"jest": {
|
|
58
|
+
"testEnvironment": "node",
|
|
59
|
+
"transform": {
|
|
60
|
+
"^.+\\.ts?$": "ts-jest"
|
|
61
|
+
},
|
|
62
|
+
"setupFilesAfterEnv": [
|
|
63
|
+
"./__tests__/setup/mocks.ts"
|
|
64
|
+
],
|
|
65
|
+
"testPathIgnorePatterns": [
|
|
66
|
+
"./__tests__/setup",
|
|
67
|
+
"./__tests__/mocks",
|
|
68
|
+
"./dist/"
|
|
69
|
+
],
|
|
70
|
+
"workerIdleMemoryLimit": "512MB"
|
|
71
|
+
},
|
|
72
|
+
"files": [
|
|
73
|
+
"./dist-client/actions/!(addUser|nextSong|playSong|removeUser)*.d.ts",
|
|
74
|
+
"./dist-client/types/names.*",
|
|
75
|
+
"./dist-client/types/messages.*",
|
|
76
|
+
"./dist-client/types/state.*",
|
|
77
|
+
"./dist-client/types/services.*",
|
|
78
|
+
"./dist-client/client/*"
|
|
79
|
+
],
|
|
80
|
+
"license": "MIT"
|
|
81
|
+
}
|