@borealise/pipeline 1.0.0-alpha.1 → 1.0.0-alpha.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/dist/index.d.mts +4 -130
- package/dist/index.d.ts +4 -130
- package/dist/index.js +25 -156
- package/dist/index.mjs +53 -148
- package/package.json +4 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,132 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
declare const Opcodes: {
|
|
5
|
-
readonly IDENTIFY: 0;
|
|
6
|
-
readonly HEARTBEAT: 1;
|
|
7
|
-
readonly PRESENCE_UPDATE: 2;
|
|
8
|
-
readonly SUBSCRIBE: 3;
|
|
9
|
-
readonly UNSUBSCRIBE: 4;
|
|
10
|
-
readonly REQUEST: 5;
|
|
11
|
-
readonly CHAT_SEND: 6;
|
|
12
|
-
readonly HELLO: 16;
|
|
13
|
-
readonly HEARTBEAT_ACK: 17;
|
|
14
|
-
readonly READY: 18;
|
|
15
|
-
readonly INVALID_SESSION: 19;
|
|
16
|
-
readonly RECONNECT: 20;
|
|
17
|
-
readonly DISPATCH: 21;
|
|
18
|
-
readonly ERROR: 255;
|
|
19
|
-
};
|
|
20
|
-
type Opcode = typeof Opcodes[keyof typeof Opcodes];
|
|
21
|
-
declare const Events: {
|
|
22
|
-
readonly USER_UPDATE: 0;
|
|
23
|
-
readonly USER_PRESENCE_UPDATE: 1;
|
|
24
|
-
readonly USER_TYPING: 2;
|
|
25
|
-
readonly USER_LEVEL_UP: 3;
|
|
26
|
-
readonly SESSION_CREATE: 16;
|
|
27
|
-
readonly SESSION_DELETE: 17;
|
|
28
|
-
readonly SESSION_UPDATE: 18;
|
|
29
|
-
readonly NOTIFICATION_CREATE: 32;
|
|
30
|
-
readonly NOTIFICATION_DELETE: 33;
|
|
31
|
-
readonly ROOM_JOIN: 48;
|
|
32
|
-
readonly ROOM_LEAVE: 49;
|
|
33
|
-
readonly ROOM_UPDATE: 50;
|
|
34
|
-
readonly ROOM_DELETE: 51;
|
|
35
|
-
readonly ROOM_USER_JOIN: 64;
|
|
36
|
-
readonly ROOM_USER_LEAVE: 65;
|
|
37
|
-
readonly ROOM_USER_KICK: 66;
|
|
38
|
-
readonly ROOM_USER_BAN: 67;
|
|
39
|
-
readonly ROOM_USER_MUTE: 68;
|
|
40
|
-
readonly ROOM_USER_UNMUTE: 69;
|
|
41
|
-
readonly ROOM_USER_ROLE_UPDATE: 70;
|
|
42
|
-
readonly ROOM_USER_AVATAR_UPDATE: 71;
|
|
43
|
-
readonly ROOM_USER_SUBSCRIPTION_UPDATE: 72;
|
|
44
|
-
readonly ROOM_CHAT_MESSAGE: 80;
|
|
45
|
-
readonly ROOM_CHAT_DELETE: 81;
|
|
46
|
-
readonly ROOM_DJ_ADVANCE: 96;
|
|
47
|
-
readonly ROOM_DJ_UPDATE: 97;
|
|
48
|
-
readonly ROOM_WAITLIST_JOIN: 98;
|
|
49
|
-
readonly ROOM_WAITLIST_LEAVE: 99;
|
|
50
|
-
readonly ROOM_WAITLIST_UPDATE: 100;
|
|
51
|
-
readonly ROOM_WAITLIST_LOCK: 101;
|
|
52
|
-
readonly ROOM_WAITLIST_CYCLE: 102;
|
|
53
|
-
readonly ROOM_TIME_SYNC: 103;
|
|
54
|
-
readonly ROOM_VOTE: 112;
|
|
55
|
-
readonly ROOM_GRAB: 113;
|
|
56
|
-
readonly FRIEND_REQUEST: 128;
|
|
57
|
-
readonly FRIEND_REQUEST_CANCEL: 129;
|
|
58
|
-
readonly FRIEND_ACCEPT: 130;
|
|
59
|
-
readonly FRIEND_REMOVE: 131;
|
|
60
|
-
readonly SYSTEM_MESSAGE: 240;
|
|
61
|
-
readonly MAINTENANCE: 241;
|
|
62
|
-
readonly RATE_LIMIT: 242;
|
|
63
|
-
};
|
|
64
|
-
type EventCode = typeof Events[keyof typeof Events];
|
|
65
|
-
declare const Presence: {
|
|
66
|
-
readonly ONLINE: 0;
|
|
67
|
-
readonly IDLE: 1;
|
|
68
|
-
readonly DND: 2;
|
|
69
|
-
readonly INVISIBLE: 3;
|
|
70
|
-
readonly OFFLINE: 4;
|
|
71
|
-
};
|
|
72
|
-
type PresenceCode = typeof Presence[keyof typeof Presence];
|
|
73
|
-
declare const Activity: {
|
|
74
|
-
readonly NONE: 0;
|
|
75
|
-
readonly VIEWING: 1;
|
|
76
|
-
readonly EDITING: 2;
|
|
77
|
-
readonly IDLE: 3;
|
|
78
|
-
readonly STREAMING: 4;
|
|
79
|
-
readonly LISTENING: 5;
|
|
80
|
-
readonly WATCHING: 6;
|
|
81
|
-
readonly CUSTOM: 255;
|
|
82
|
-
};
|
|
83
|
-
type ActivityCode = typeof Activity[keyof typeof Activity];
|
|
84
|
-
declare const Roles: {
|
|
85
|
-
readonly USER: 0;
|
|
86
|
-
readonly MODERATOR: 1;
|
|
87
|
-
readonly ADMIN: 2;
|
|
88
|
-
readonly OWNER: 255;
|
|
89
|
-
};
|
|
90
|
-
type RoleCode = typeof Roles[keyof typeof Roles];
|
|
91
|
-
declare const CloseCodes: {
|
|
92
|
-
readonly NORMAL: 1000;
|
|
93
|
-
readonly GOING_AWAY: 1001;
|
|
94
|
-
readonly PROTOCOL_ERROR: 1002;
|
|
95
|
-
readonly UNKNOWN_ERROR: 4000;
|
|
96
|
-
readonly UNKNOWN_OPCODE: 4001;
|
|
97
|
-
readonly DECODE_ERROR: 4002;
|
|
98
|
-
readonly NOT_AUTHENTICATED: 4003;
|
|
99
|
-
readonly AUTHENTICATION_FAILED: 4004;
|
|
100
|
-
readonly ALREADY_AUTHENTICATED: 4005;
|
|
101
|
-
readonly INVALID_SESSION: 4006;
|
|
102
|
-
readonly RATE_LIMITED: 4008;
|
|
103
|
-
readonly SESSION_TIMEOUT: 4009;
|
|
104
|
-
readonly SERVER_SHUTDOWN: 4010;
|
|
105
|
-
};
|
|
106
|
-
type CloseCode = typeof CloseCodes[keyof typeof CloseCodes];
|
|
107
|
-
declare const PipelineErrors: {
|
|
108
|
-
readonly CHAT_MESSAGE_EMPTY: 4100;
|
|
109
|
-
readonly CHAT_MESSAGE_TOO_LONG: 4101;
|
|
110
|
-
readonly CHAT_ROOM_NOT_FOUND: 4102;
|
|
111
|
-
readonly CHAT_NOT_IN_ROOM: 4103;
|
|
112
|
-
readonly CHAT_USER_MUTED: 4104;
|
|
113
|
-
readonly ROOM_NOT_FOUND: 4200;
|
|
114
|
-
readonly ROOM_NOT_ACTIVE: 4201;
|
|
115
|
-
readonly ROOM_ALREADY_MEMBER: 4202;
|
|
116
|
-
readonly ROOM_NOT_MEMBER: 4203;
|
|
117
|
-
readonly ROOM_BANNED: 4204;
|
|
118
|
-
readonly ROOM_FULL: 4205;
|
|
119
|
-
readonly WAITLIST_LOCKED: 4300;
|
|
120
|
-
readonly WAITLIST_FULL: 4301;
|
|
121
|
-
readonly WAITLIST_ALREADY_IN: 4302;
|
|
122
|
-
readonly WAITLIST_NOT_IN: 4303;
|
|
123
|
-
readonly VOTE_INVALID: 4400;
|
|
124
|
-
readonly VOTE_ALREADY_VOTED: 4401;
|
|
125
|
-
readonly VOTE_NO_TRACK: 4402;
|
|
126
|
-
};
|
|
127
|
-
type PipelineError = typeof PipelineErrors[keyof typeof PipelineErrors];
|
|
128
|
-
declare function getPipelineErrorName(code: PipelineError): string;
|
|
129
|
-
declare function getEventName(code: EventCode): string;
|
|
1
|
+
import { RoleCode, PresenceCode, ActivityCode, EventCode, Opcode } from '@borealise/shared';
|
|
2
|
+
export * from '@borealise/shared';
|
|
3
|
+
export { PipelineError, PipelineErrors, getPipelineErrorName } from '@borealise/shared';
|
|
130
4
|
|
|
131
5
|
interface PipelineMessage<T = unknown> {
|
|
132
6
|
op: Opcode;
|
|
@@ -265,4 +139,4 @@ declare class PipelineClient {
|
|
|
265
139
|
}
|
|
266
140
|
declare function createPipeline(options: PipelineClientOptions): PipelineClient;
|
|
267
141
|
|
|
268
|
-
export {
|
|
142
|
+
export { type ChatSendPayload, type ConnectionState, type DispatchHandler, type ErrorPayload, type EventListener, type HeartbeatPayload, type HelloPayload, type IdentifyPayload, type InvalidSessionPayload, PipelineClient, type PipelineClientOptions, type PipelineEvents, type PipelineMessage, type PresenceUpdatePayload, type ReadyPayload, type SubscribePayload, type UnsubscribePayload, createPipeline };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,132 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
declare const Opcodes: {
|
|
5
|
-
readonly IDENTIFY: 0;
|
|
6
|
-
readonly HEARTBEAT: 1;
|
|
7
|
-
readonly PRESENCE_UPDATE: 2;
|
|
8
|
-
readonly SUBSCRIBE: 3;
|
|
9
|
-
readonly UNSUBSCRIBE: 4;
|
|
10
|
-
readonly REQUEST: 5;
|
|
11
|
-
readonly CHAT_SEND: 6;
|
|
12
|
-
readonly HELLO: 16;
|
|
13
|
-
readonly HEARTBEAT_ACK: 17;
|
|
14
|
-
readonly READY: 18;
|
|
15
|
-
readonly INVALID_SESSION: 19;
|
|
16
|
-
readonly RECONNECT: 20;
|
|
17
|
-
readonly DISPATCH: 21;
|
|
18
|
-
readonly ERROR: 255;
|
|
19
|
-
};
|
|
20
|
-
type Opcode = typeof Opcodes[keyof typeof Opcodes];
|
|
21
|
-
declare const Events: {
|
|
22
|
-
readonly USER_UPDATE: 0;
|
|
23
|
-
readonly USER_PRESENCE_UPDATE: 1;
|
|
24
|
-
readonly USER_TYPING: 2;
|
|
25
|
-
readonly USER_LEVEL_UP: 3;
|
|
26
|
-
readonly SESSION_CREATE: 16;
|
|
27
|
-
readonly SESSION_DELETE: 17;
|
|
28
|
-
readonly SESSION_UPDATE: 18;
|
|
29
|
-
readonly NOTIFICATION_CREATE: 32;
|
|
30
|
-
readonly NOTIFICATION_DELETE: 33;
|
|
31
|
-
readonly ROOM_JOIN: 48;
|
|
32
|
-
readonly ROOM_LEAVE: 49;
|
|
33
|
-
readonly ROOM_UPDATE: 50;
|
|
34
|
-
readonly ROOM_DELETE: 51;
|
|
35
|
-
readonly ROOM_USER_JOIN: 64;
|
|
36
|
-
readonly ROOM_USER_LEAVE: 65;
|
|
37
|
-
readonly ROOM_USER_KICK: 66;
|
|
38
|
-
readonly ROOM_USER_BAN: 67;
|
|
39
|
-
readonly ROOM_USER_MUTE: 68;
|
|
40
|
-
readonly ROOM_USER_UNMUTE: 69;
|
|
41
|
-
readonly ROOM_USER_ROLE_UPDATE: 70;
|
|
42
|
-
readonly ROOM_USER_AVATAR_UPDATE: 71;
|
|
43
|
-
readonly ROOM_USER_SUBSCRIPTION_UPDATE: 72;
|
|
44
|
-
readonly ROOM_CHAT_MESSAGE: 80;
|
|
45
|
-
readonly ROOM_CHAT_DELETE: 81;
|
|
46
|
-
readonly ROOM_DJ_ADVANCE: 96;
|
|
47
|
-
readonly ROOM_DJ_UPDATE: 97;
|
|
48
|
-
readonly ROOM_WAITLIST_JOIN: 98;
|
|
49
|
-
readonly ROOM_WAITLIST_LEAVE: 99;
|
|
50
|
-
readonly ROOM_WAITLIST_UPDATE: 100;
|
|
51
|
-
readonly ROOM_WAITLIST_LOCK: 101;
|
|
52
|
-
readonly ROOM_WAITLIST_CYCLE: 102;
|
|
53
|
-
readonly ROOM_TIME_SYNC: 103;
|
|
54
|
-
readonly ROOM_VOTE: 112;
|
|
55
|
-
readonly ROOM_GRAB: 113;
|
|
56
|
-
readonly FRIEND_REQUEST: 128;
|
|
57
|
-
readonly FRIEND_REQUEST_CANCEL: 129;
|
|
58
|
-
readonly FRIEND_ACCEPT: 130;
|
|
59
|
-
readonly FRIEND_REMOVE: 131;
|
|
60
|
-
readonly SYSTEM_MESSAGE: 240;
|
|
61
|
-
readonly MAINTENANCE: 241;
|
|
62
|
-
readonly RATE_LIMIT: 242;
|
|
63
|
-
};
|
|
64
|
-
type EventCode = typeof Events[keyof typeof Events];
|
|
65
|
-
declare const Presence: {
|
|
66
|
-
readonly ONLINE: 0;
|
|
67
|
-
readonly IDLE: 1;
|
|
68
|
-
readonly DND: 2;
|
|
69
|
-
readonly INVISIBLE: 3;
|
|
70
|
-
readonly OFFLINE: 4;
|
|
71
|
-
};
|
|
72
|
-
type PresenceCode = typeof Presence[keyof typeof Presence];
|
|
73
|
-
declare const Activity: {
|
|
74
|
-
readonly NONE: 0;
|
|
75
|
-
readonly VIEWING: 1;
|
|
76
|
-
readonly EDITING: 2;
|
|
77
|
-
readonly IDLE: 3;
|
|
78
|
-
readonly STREAMING: 4;
|
|
79
|
-
readonly LISTENING: 5;
|
|
80
|
-
readonly WATCHING: 6;
|
|
81
|
-
readonly CUSTOM: 255;
|
|
82
|
-
};
|
|
83
|
-
type ActivityCode = typeof Activity[keyof typeof Activity];
|
|
84
|
-
declare const Roles: {
|
|
85
|
-
readonly USER: 0;
|
|
86
|
-
readonly MODERATOR: 1;
|
|
87
|
-
readonly ADMIN: 2;
|
|
88
|
-
readonly OWNER: 255;
|
|
89
|
-
};
|
|
90
|
-
type RoleCode = typeof Roles[keyof typeof Roles];
|
|
91
|
-
declare const CloseCodes: {
|
|
92
|
-
readonly NORMAL: 1000;
|
|
93
|
-
readonly GOING_AWAY: 1001;
|
|
94
|
-
readonly PROTOCOL_ERROR: 1002;
|
|
95
|
-
readonly UNKNOWN_ERROR: 4000;
|
|
96
|
-
readonly UNKNOWN_OPCODE: 4001;
|
|
97
|
-
readonly DECODE_ERROR: 4002;
|
|
98
|
-
readonly NOT_AUTHENTICATED: 4003;
|
|
99
|
-
readonly AUTHENTICATION_FAILED: 4004;
|
|
100
|
-
readonly ALREADY_AUTHENTICATED: 4005;
|
|
101
|
-
readonly INVALID_SESSION: 4006;
|
|
102
|
-
readonly RATE_LIMITED: 4008;
|
|
103
|
-
readonly SESSION_TIMEOUT: 4009;
|
|
104
|
-
readonly SERVER_SHUTDOWN: 4010;
|
|
105
|
-
};
|
|
106
|
-
type CloseCode = typeof CloseCodes[keyof typeof CloseCodes];
|
|
107
|
-
declare const PipelineErrors: {
|
|
108
|
-
readonly CHAT_MESSAGE_EMPTY: 4100;
|
|
109
|
-
readonly CHAT_MESSAGE_TOO_LONG: 4101;
|
|
110
|
-
readonly CHAT_ROOM_NOT_FOUND: 4102;
|
|
111
|
-
readonly CHAT_NOT_IN_ROOM: 4103;
|
|
112
|
-
readonly CHAT_USER_MUTED: 4104;
|
|
113
|
-
readonly ROOM_NOT_FOUND: 4200;
|
|
114
|
-
readonly ROOM_NOT_ACTIVE: 4201;
|
|
115
|
-
readonly ROOM_ALREADY_MEMBER: 4202;
|
|
116
|
-
readonly ROOM_NOT_MEMBER: 4203;
|
|
117
|
-
readonly ROOM_BANNED: 4204;
|
|
118
|
-
readonly ROOM_FULL: 4205;
|
|
119
|
-
readonly WAITLIST_LOCKED: 4300;
|
|
120
|
-
readonly WAITLIST_FULL: 4301;
|
|
121
|
-
readonly WAITLIST_ALREADY_IN: 4302;
|
|
122
|
-
readonly WAITLIST_NOT_IN: 4303;
|
|
123
|
-
readonly VOTE_INVALID: 4400;
|
|
124
|
-
readonly VOTE_ALREADY_VOTED: 4401;
|
|
125
|
-
readonly VOTE_NO_TRACK: 4402;
|
|
126
|
-
};
|
|
127
|
-
type PipelineError = typeof PipelineErrors[keyof typeof PipelineErrors];
|
|
128
|
-
declare function getPipelineErrorName(code: PipelineError): string;
|
|
129
|
-
declare function getEventName(code: EventCode): string;
|
|
1
|
+
import { RoleCode, PresenceCode, ActivityCode, EventCode, Opcode } from '@borealise/shared';
|
|
2
|
+
export * from '@borealise/shared';
|
|
3
|
+
export { PipelineError, PipelineErrors, getPipelineErrorName } from '@borealise/shared';
|
|
130
4
|
|
|
131
5
|
interface PipelineMessage<T = unknown> {
|
|
132
6
|
op: Opcode;
|
|
@@ -265,4 +139,4 @@ declare class PipelineClient {
|
|
|
265
139
|
}
|
|
266
140
|
declare function createPipeline(options: PipelineClientOptions): PipelineClient;
|
|
267
141
|
|
|
268
|
-
export {
|
|
142
|
+
export { type ChatSendPayload, type ConnectionState, type DispatchHandler, type ErrorPayload, type EventListener, type HeartbeatPayload, type HelloPayload, type IdentifyPayload, type InvalidSessionPayload, PipelineClient, type PipelineClientOptions, type PipelineEvents, type PipelineMessage, type PresenceUpdatePayload, type ReadyPayload, type SubscribePayload, type UnsubscribePayload, createPipeline };
|
package/dist/index.js
CHANGED
|
@@ -15,149 +15,25 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
}
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
20
|
|
|
20
21
|
// src/index.ts
|
|
21
22
|
var index_exports = {};
|
|
22
23
|
__export(index_exports, {
|
|
23
|
-
Activity: () => Activity,
|
|
24
|
-
CloseCodes: () => CloseCodes,
|
|
25
|
-
Events: () => Events,
|
|
26
|
-
Opcodes: () => Opcodes,
|
|
27
24
|
PipelineClient: () => PipelineClient,
|
|
28
|
-
PipelineErrors: () => PipelineErrors,
|
|
29
|
-
Presence: () => Presence,
|
|
30
|
-
Roles: () => Roles,
|
|
25
|
+
PipelineErrors: () => opcodes_exports.PipelineErrors,
|
|
31
26
|
createPipeline: () => createPipeline,
|
|
32
|
-
|
|
33
|
-
getPipelineErrorName: () => getPipelineErrorName
|
|
27
|
+
getPipelineErrorName: () => opcodes_exports.getPipelineErrorName
|
|
34
28
|
});
|
|
35
29
|
module.exports = __toCommonJS(index_exports);
|
|
36
30
|
|
|
37
31
|
// src/constants/opcodes.ts
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
UNSUBSCRIBE: 4,
|
|
44
|
-
REQUEST: 5,
|
|
45
|
-
CHAT_SEND: 6,
|
|
46
|
-
HELLO: 16,
|
|
47
|
-
HEARTBEAT_ACK: 17,
|
|
48
|
-
READY: 18,
|
|
49
|
-
INVALID_SESSION: 19,
|
|
50
|
-
RECONNECT: 20,
|
|
51
|
-
DISPATCH: 21,
|
|
52
|
-
ERROR: 255
|
|
53
|
-
};
|
|
54
|
-
var Events = {
|
|
55
|
-
USER_UPDATE: 0,
|
|
56
|
-
USER_PRESENCE_UPDATE: 1,
|
|
57
|
-
USER_TYPING: 2,
|
|
58
|
-
USER_LEVEL_UP: 3,
|
|
59
|
-
SESSION_CREATE: 16,
|
|
60
|
-
SESSION_DELETE: 17,
|
|
61
|
-
SESSION_UPDATE: 18,
|
|
62
|
-
NOTIFICATION_CREATE: 32,
|
|
63
|
-
NOTIFICATION_DELETE: 33,
|
|
64
|
-
ROOM_JOIN: 48,
|
|
65
|
-
ROOM_LEAVE: 49,
|
|
66
|
-
ROOM_UPDATE: 50,
|
|
67
|
-
ROOM_DELETE: 51,
|
|
68
|
-
ROOM_USER_JOIN: 64,
|
|
69
|
-
ROOM_USER_LEAVE: 65,
|
|
70
|
-
ROOM_USER_KICK: 66,
|
|
71
|
-
ROOM_USER_BAN: 67,
|
|
72
|
-
ROOM_USER_MUTE: 68,
|
|
73
|
-
ROOM_USER_UNMUTE: 69,
|
|
74
|
-
ROOM_USER_ROLE_UPDATE: 70,
|
|
75
|
-
ROOM_USER_AVATAR_UPDATE: 71,
|
|
76
|
-
ROOM_USER_SUBSCRIPTION_UPDATE: 72,
|
|
77
|
-
ROOM_CHAT_MESSAGE: 80,
|
|
78
|
-
ROOM_CHAT_DELETE: 81,
|
|
79
|
-
ROOM_DJ_ADVANCE: 96,
|
|
80
|
-
ROOM_DJ_UPDATE: 97,
|
|
81
|
-
ROOM_WAITLIST_JOIN: 98,
|
|
82
|
-
ROOM_WAITLIST_LEAVE: 99,
|
|
83
|
-
ROOM_WAITLIST_UPDATE: 100,
|
|
84
|
-
ROOM_WAITLIST_LOCK: 101,
|
|
85
|
-
ROOM_WAITLIST_CYCLE: 102,
|
|
86
|
-
ROOM_TIME_SYNC: 103,
|
|
87
|
-
ROOM_VOTE: 112,
|
|
88
|
-
ROOM_GRAB: 113,
|
|
89
|
-
FRIEND_REQUEST: 128,
|
|
90
|
-
FRIEND_REQUEST_CANCEL: 129,
|
|
91
|
-
FRIEND_ACCEPT: 130,
|
|
92
|
-
FRIEND_REMOVE: 131,
|
|
93
|
-
SYSTEM_MESSAGE: 240,
|
|
94
|
-
MAINTENANCE: 241,
|
|
95
|
-
RATE_LIMIT: 242
|
|
96
|
-
};
|
|
97
|
-
var Presence = {
|
|
98
|
-
ONLINE: 0,
|
|
99
|
-
IDLE: 1,
|
|
100
|
-
DND: 2,
|
|
101
|
-
INVISIBLE: 3,
|
|
102
|
-
OFFLINE: 4
|
|
103
|
-
};
|
|
104
|
-
var Activity = {
|
|
105
|
-
NONE: 0,
|
|
106
|
-
VIEWING: 1,
|
|
107
|
-
EDITING: 2,
|
|
108
|
-
IDLE: 3,
|
|
109
|
-
STREAMING: 4,
|
|
110
|
-
LISTENING: 5,
|
|
111
|
-
WATCHING: 6,
|
|
112
|
-
CUSTOM: 255
|
|
113
|
-
};
|
|
114
|
-
var Roles = {
|
|
115
|
-
USER: 0,
|
|
116
|
-
MODERATOR: 1,
|
|
117
|
-
ADMIN: 2,
|
|
118
|
-
OWNER: 255
|
|
119
|
-
};
|
|
120
|
-
var CloseCodes = {
|
|
121
|
-
NORMAL: 1e3,
|
|
122
|
-
GOING_AWAY: 1001,
|
|
123
|
-
PROTOCOL_ERROR: 1002,
|
|
124
|
-
UNKNOWN_ERROR: 4e3,
|
|
125
|
-
UNKNOWN_OPCODE: 4001,
|
|
126
|
-
DECODE_ERROR: 4002,
|
|
127
|
-
NOT_AUTHENTICATED: 4003,
|
|
128
|
-
AUTHENTICATION_FAILED: 4004,
|
|
129
|
-
ALREADY_AUTHENTICATED: 4005,
|
|
130
|
-
INVALID_SESSION: 4006,
|
|
131
|
-
RATE_LIMITED: 4008,
|
|
132
|
-
SESSION_TIMEOUT: 4009,
|
|
133
|
-
SERVER_SHUTDOWN: 4010
|
|
134
|
-
};
|
|
135
|
-
var PipelineErrors = {
|
|
136
|
-
CHAT_MESSAGE_EMPTY: 4100,
|
|
137
|
-
CHAT_MESSAGE_TOO_LONG: 4101,
|
|
138
|
-
CHAT_ROOM_NOT_FOUND: 4102,
|
|
139
|
-
CHAT_NOT_IN_ROOM: 4103,
|
|
140
|
-
CHAT_USER_MUTED: 4104,
|
|
141
|
-
ROOM_NOT_FOUND: 4200,
|
|
142
|
-
ROOM_NOT_ACTIVE: 4201,
|
|
143
|
-
ROOM_ALREADY_MEMBER: 4202,
|
|
144
|
-
ROOM_NOT_MEMBER: 4203,
|
|
145
|
-
ROOM_BANNED: 4204,
|
|
146
|
-
ROOM_FULL: 4205,
|
|
147
|
-
WAITLIST_LOCKED: 4300,
|
|
148
|
-
WAITLIST_FULL: 4301,
|
|
149
|
-
WAITLIST_ALREADY_IN: 4302,
|
|
150
|
-
WAITLIST_NOT_IN: 4303,
|
|
151
|
-
VOTE_INVALID: 4400,
|
|
152
|
-
VOTE_ALREADY_VOTED: 4401,
|
|
153
|
-
VOTE_NO_TRACK: 4402
|
|
154
|
-
};
|
|
155
|
-
function getPipelineErrorName(code) {
|
|
156
|
-
return Object.entries(PipelineErrors).find(([, value]) => value === code)?.[0] || "UNKNOWN_ERROR";
|
|
157
|
-
}
|
|
158
|
-
function getEventName(code) {
|
|
159
|
-
return Object.entries(Events).find(([, value]) => value === code)?.[0] || "UNKNOWN";
|
|
160
|
-
}
|
|
32
|
+
var opcodes_exports = {};
|
|
33
|
+
__reExport(opcodes_exports, require("@borealise/shared"));
|
|
34
|
+
|
|
35
|
+
// src/index.ts
|
|
36
|
+
__reExport(index_exports, opcodes_exports, module.exports);
|
|
161
37
|
|
|
162
38
|
// src/logger.ts
|
|
163
39
|
var _Logger = class _Logger {
|
|
@@ -260,7 +136,7 @@ var _PipelineClient = class _PipelineClient {
|
|
|
260
136
|
this.clearTimers();
|
|
261
137
|
this.reconnectAttempts = 0;
|
|
262
138
|
if (this.ws) {
|
|
263
|
-
this.ws.close(CloseCodes.NORMAL, "client disconnect");
|
|
139
|
+
this.ws.close(opcodes_exports.CloseCodes.NORMAL, "client disconnect");
|
|
264
140
|
this.ws = null;
|
|
265
141
|
}
|
|
266
142
|
this.sessionId = null;
|
|
@@ -268,17 +144,17 @@ var _PipelineClient = class _PipelineClient {
|
|
|
268
144
|
this.setState("disconnected");
|
|
269
145
|
}
|
|
270
146
|
identify(token) {
|
|
271
|
-
this.send(Opcodes.IDENTIFY, { token });
|
|
147
|
+
this.send(opcodes_exports.Opcodes.IDENTIFY, { token });
|
|
272
148
|
}
|
|
273
149
|
updatePresence(status, activity) {
|
|
274
|
-
this.send(Opcodes.PRESENCE_UPDATE, { status, activity });
|
|
150
|
+
this.send(opcodes_exports.Opcodes.PRESENCE_UPDATE, { status, activity });
|
|
275
151
|
}
|
|
276
152
|
subscribe(events) {
|
|
277
153
|
for (const event of events) {
|
|
278
154
|
this.subscriptions.add(event);
|
|
279
155
|
}
|
|
280
156
|
if (this.isIdentified) {
|
|
281
|
-
this.send(Opcodes.SUBSCRIBE, { events });
|
|
157
|
+
this.send(opcodes_exports.Opcodes.SUBSCRIBE, { events });
|
|
282
158
|
}
|
|
283
159
|
}
|
|
284
160
|
unsubscribe(events) {
|
|
@@ -286,7 +162,7 @@ var _PipelineClient = class _PipelineClient {
|
|
|
286
162
|
this.subscriptions.delete(event);
|
|
287
163
|
}
|
|
288
164
|
if (this.isIdentified) {
|
|
289
|
-
this.send(Opcodes.UNSUBSCRIBE, { events });
|
|
165
|
+
this.send(opcodes_exports.Opcodes.UNSUBSCRIBE, { events });
|
|
290
166
|
}
|
|
291
167
|
}
|
|
292
168
|
sendChatMessage(roomSlug, content) {
|
|
@@ -294,7 +170,7 @@ var _PipelineClient = class _PipelineClient {
|
|
|
294
170
|
this.logger.warn("Cannot send chat: not identified");
|
|
295
171
|
return false;
|
|
296
172
|
}
|
|
297
|
-
this.send(Opcodes.CHAT_SEND, {
|
|
173
|
+
this.send(opcodes_exports.Opcodes.CHAT_SEND, {
|
|
298
174
|
room_slug: roomSlug,
|
|
299
175
|
content
|
|
300
176
|
});
|
|
@@ -346,24 +222,24 @@ var _PipelineClient = class _PipelineClient {
|
|
|
346
222
|
try {
|
|
347
223
|
const message = JSON.parse(String(event.data));
|
|
348
224
|
switch (message.op) {
|
|
349
|
-
case Opcodes.HELLO:
|
|
225
|
+
case opcodes_exports.Opcodes.HELLO:
|
|
350
226
|
this.handleHello(message.d);
|
|
351
227
|
break;
|
|
352
|
-
case Opcodes.HEARTBEAT_ACK:
|
|
228
|
+
case opcodes_exports.Opcodes.HEARTBEAT_ACK:
|
|
353
229
|
break;
|
|
354
|
-
case Opcodes.READY:
|
|
230
|
+
case opcodes_exports.Opcodes.READY:
|
|
355
231
|
this.handleReady(message.d);
|
|
356
232
|
break;
|
|
357
|
-
case Opcodes.INVALID_SESSION:
|
|
233
|
+
case opcodes_exports.Opcodes.INVALID_SESSION:
|
|
358
234
|
this.handleInvalidSession(message.d);
|
|
359
235
|
break;
|
|
360
|
-
case Opcodes.RECONNECT:
|
|
236
|
+
case opcodes_exports.Opcodes.RECONNECT:
|
|
361
237
|
this.handleReconnect();
|
|
362
238
|
break;
|
|
363
|
-
case Opcodes.DISPATCH:
|
|
239
|
+
case opcodes_exports.Opcodes.DISPATCH:
|
|
364
240
|
this.handleDispatch(message.t, message.d, message.s);
|
|
365
241
|
break;
|
|
366
|
-
case Opcodes.ERROR:
|
|
242
|
+
case opcodes_exports.Opcodes.ERROR:
|
|
367
243
|
this.handleServerError(message.d);
|
|
368
244
|
break;
|
|
369
245
|
default:
|
|
@@ -379,9 +255,9 @@ var _PipelineClient = class _PipelineClient {
|
|
|
379
255
|
this.ws = null;
|
|
380
256
|
this.emit("onDisconnect", event.code, event.reason);
|
|
381
257
|
const noReconnectCodes = [
|
|
382
|
-
CloseCodes.AUTHENTICATION_FAILED,
|
|
383
|
-
CloseCodes.NOT_AUTHENTICATED,
|
|
384
|
-
CloseCodes.NORMAL
|
|
258
|
+
opcodes_exports.CloseCodes.AUTHENTICATION_FAILED,
|
|
259
|
+
opcodes_exports.CloseCodes.NOT_AUTHENTICATED,
|
|
260
|
+
opcodes_exports.CloseCodes.NORMAL
|
|
385
261
|
];
|
|
386
262
|
if (!noReconnectCodes.includes(event.code)) {
|
|
387
263
|
this.scheduleReconnect();
|
|
@@ -448,7 +324,7 @@ var _PipelineClient = class _PipelineClient {
|
|
|
448
324
|
this.sendHeartbeat();
|
|
449
325
|
}
|
|
450
326
|
sendHeartbeat() {
|
|
451
|
-
this.send(Opcodes.HEARTBEAT, {
|
|
327
|
+
this.send(opcodes_exports.Opcodes.HEARTBEAT, {
|
|
452
328
|
seq: this.lastSequence || null
|
|
453
329
|
});
|
|
454
330
|
}
|
|
@@ -512,15 +388,8 @@ function createPipeline(options) {
|
|
|
512
388
|
}
|
|
513
389
|
// Annotate the CommonJS export names for ESM import in node:
|
|
514
390
|
0 && (module.exports = {
|
|
515
|
-
Activity,
|
|
516
|
-
CloseCodes,
|
|
517
|
-
Events,
|
|
518
|
-
Opcodes,
|
|
519
391
|
PipelineClient,
|
|
520
392
|
PipelineErrors,
|
|
521
|
-
Presence,
|
|
522
|
-
Roles,
|
|
523
393
|
createPipeline,
|
|
524
|
-
getEventName,
|
|
525
394
|
getPipelineErrorName
|
|
526
395
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,127 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
REQUEST: 5,
|
|
9
|
-
CHAT_SEND: 6,
|
|
10
|
-
HELLO: 16,
|
|
11
|
-
HEARTBEAT_ACK: 17,
|
|
12
|
-
READY: 18,
|
|
13
|
-
INVALID_SESSION: 19,
|
|
14
|
-
RECONNECT: 20,
|
|
15
|
-
DISPATCH: 21,
|
|
16
|
-
ERROR: 255
|
|
17
|
-
};
|
|
18
|
-
var Events = {
|
|
19
|
-
USER_UPDATE: 0,
|
|
20
|
-
USER_PRESENCE_UPDATE: 1,
|
|
21
|
-
USER_TYPING: 2,
|
|
22
|
-
USER_LEVEL_UP: 3,
|
|
23
|
-
SESSION_CREATE: 16,
|
|
24
|
-
SESSION_DELETE: 17,
|
|
25
|
-
SESSION_UPDATE: 18,
|
|
26
|
-
NOTIFICATION_CREATE: 32,
|
|
27
|
-
NOTIFICATION_DELETE: 33,
|
|
28
|
-
ROOM_JOIN: 48,
|
|
29
|
-
ROOM_LEAVE: 49,
|
|
30
|
-
ROOM_UPDATE: 50,
|
|
31
|
-
ROOM_DELETE: 51,
|
|
32
|
-
ROOM_USER_JOIN: 64,
|
|
33
|
-
ROOM_USER_LEAVE: 65,
|
|
34
|
-
ROOM_USER_KICK: 66,
|
|
35
|
-
ROOM_USER_BAN: 67,
|
|
36
|
-
ROOM_USER_MUTE: 68,
|
|
37
|
-
ROOM_USER_UNMUTE: 69,
|
|
38
|
-
ROOM_USER_ROLE_UPDATE: 70,
|
|
39
|
-
ROOM_USER_AVATAR_UPDATE: 71,
|
|
40
|
-
ROOM_USER_SUBSCRIPTION_UPDATE: 72,
|
|
41
|
-
ROOM_CHAT_MESSAGE: 80,
|
|
42
|
-
ROOM_CHAT_DELETE: 81,
|
|
43
|
-
ROOM_DJ_ADVANCE: 96,
|
|
44
|
-
ROOM_DJ_UPDATE: 97,
|
|
45
|
-
ROOM_WAITLIST_JOIN: 98,
|
|
46
|
-
ROOM_WAITLIST_LEAVE: 99,
|
|
47
|
-
ROOM_WAITLIST_UPDATE: 100,
|
|
48
|
-
ROOM_WAITLIST_LOCK: 101,
|
|
49
|
-
ROOM_WAITLIST_CYCLE: 102,
|
|
50
|
-
ROOM_TIME_SYNC: 103,
|
|
51
|
-
ROOM_VOTE: 112,
|
|
52
|
-
ROOM_GRAB: 113,
|
|
53
|
-
FRIEND_REQUEST: 128,
|
|
54
|
-
FRIEND_REQUEST_CANCEL: 129,
|
|
55
|
-
FRIEND_ACCEPT: 130,
|
|
56
|
-
FRIEND_REMOVE: 131,
|
|
57
|
-
SYSTEM_MESSAGE: 240,
|
|
58
|
-
MAINTENANCE: 241,
|
|
59
|
-
RATE_LIMIT: 242
|
|
60
|
-
};
|
|
61
|
-
var Presence = {
|
|
62
|
-
ONLINE: 0,
|
|
63
|
-
IDLE: 1,
|
|
64
|
-
DND: 2,
|
|
65
|
-
INVISIBLE: 3,
|
|
66
|
-
OFFLINE: 4
|
|
67
|
-
};
|
|
68
|
-
var Activity = {
|
|
69
|
-
NONE: 0,
|
|
70
|
-
VIEWING: 1,
|
|
71
|
-
EDITING: 2,
|
|
72
|
-
IDLE: 3,
|
|
73
|
-
STREAMING: 4,
|
|
74
|
-
LISTENING: 5,
|
|
75
|
-
WATCHING: 6,
|
|
76
|
-
CUSTOM: 255
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
77
8
|
};
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
NORMAL: 1e3,
|
|
86
|
-
GOING_AWAY: 1001,
|
|
87
|
-
PROTOCOL_ERROR: 1002,
|
|
88
|
-
UNKNOWN_ERROR: 4e3,
|
|
89
|
-
UNKNOWN_OPCODE: 4001,
|
|
90
|
-
DECODE_ERROR: 4002,
|
|
91
|
-
NOT_AUTHENTICATED: 4003,
|
|
92
|
-
AUTHENTICATION_FAILED: 4004,
|
|
93
|
-
ALREADY_AUTHENTICATED: 4005,
|
|
94
|
-
INVALID_SESSION: 4006,
|
|
95
|
-
RATE_LIMITED: 4008,
|
|
96
|
-
SESSION_TIMEOUT: 4009,
|
|
97
|
-
SERVER_SHUTDOWN: 4010
|
|
98
|
-
};
|
|
99
|
-
var PipelineErrors = {
|
|
100
|
-
CHAT_MESSAGE_EMPTY: 4100,
|
|
101
|
-
CHAT_MESSAGE_TOO_LONG: 4101,
|
|
102
|
-
CHAT_ROOM_NOT_FOUND: 4102,
|
|
103
|
-
CHAT_NOT_IN_ROOM: 4103,
|
|
104
|
-
CHAT_USER_MUTED: 4104,
|
|
105
|
-
ROOM_NOT_FOUND: 4200,
|
|
106
|
-
ROOM_NOT_ACTIVE: 4201,
|
|
107
|
-
ROOM_ALREADY_MEMBER: 4202,
|
|
108
|
-
ROOM_NOT_MEMBER: 4203,
|
|
109
|
-
ROOM_BANNED: 4204,
|
|
110
|
-
ROOM_FULL: 4205,
|
|
111
|
-
WAITLIST_LOCKED: 4300,
|
|
112
|
-
WAITLIST_FULL: 4301,
|
|
113
|
-
WAITLIST_ALREADY_IN: 4302,
|
|
114
|
-
WAITLIST_NOT_IN: 4303,
|
|
115
|
-
VOTE_INVALID: 4400,
|
|
116
|
-
VOTE_ALREADY_VOTED: 4401,
|
|
117
|
-
VOTE_NO_TRACK: 4402
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
118
16
|
};
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
17
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
+
|
|
19
|
+
// src/index.ts
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
22
|
+
PipelineClient: () => PipelineClient,
|
|
23
|
+
PipelineErrors: () => opcodes_exports.PipelineErrors,
|
|
24
|
+
createPipeline: () => createPipeline,
|
|
25
|
+
getPipelineErrorName: () => opcodes_exports.getPipelineErrorName
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// src/constants/opcodes.ts
|
|
29
|
+
var opcodes_exports = {};
|
|
30
|
+
__reExport(opcodes_exports, shared_star);
|
|
31
|
+
import * as shared_star from "@borealise/shared";
|
|
32
|
+
|
|
33
|
+
// src/index.ts
|
|
34
|
+
__reExport(index_exports, opcodes_exports);
|
|
125
35
|
|
|
126
36
|
// src/logger.ts
|
|
127
37
|
var _Logger = class _Logger {
|
|
@@ -224,7 +134,7 @@ var _PipelineClient = class _PipelineClient {
|
|
|
224
134
|
this.clearTimers();
|
|
225
135
|
this.reconnectAttempts = 0;
|
|
226
136
|
if (this.ws) {
|
|
227
|
-
this.ws.close(CloseCodes.NORMAL, "client disconnect");
|
|
137
|
+
this.ws.close(opcodes_exports.CloseCodes.NORMAL, "client disconnect");
|
|
228
138
|
this.ws = null;
|
|
229
139
|
}
|
|
230
140
|
this.sessionId = null;
|
|
@@ -232,17 +142,17 @@ var _PipelineClient = class _PipelineClient {
|
|
|
232
142
|
this.setState("disconnected");
|
|
233
143
|
}
|
|
234
144
|
identify(token) {
|
|
235
|
-
this.send(Opcodes.IDENTIFY, { token });
|
|
145
|
+
this.send(opcodes_exports.Opcodes.IDENTIFY, { token });
|
|
236
146
|
}
|
|
237
147
|
updatePresence(status, activity) {
|
|
238
|
-
this.send(Opcodes.PRESENCE_UPDATE, { status, activity });
|
|
148
|
+
this.send(opcodes_exports.Opcodes.PRESENCE_UPDATE, { status, activity });
|
|
239
149
|
}
|
|
240
150
|
subscribe(events) {
|
|
241
151
|
for (const event of events) {
|
|
242
152
|
this.subscriptions.add(event);
|
|
243
153
|
}
|
|
244
154
|
if (this.isIdentified) {
|
|
245
|
-
this.send(Opcodes.SUBSCRIBE, { events });
|
|
155
|
+
this.send(opcodes_exports.Opcodes.SUBSCRIBE, { events });
|
|
246
156
|
}
|
|
247
157
|
}
|
|
248
158
|
unsubscribe(events) {
|
|
@@ -250,7 +160,7 @@ var _PipelineClient = class _PipelineClient {
|
|
|
250
160
|
this.subscriptions.delete(event);
|
|
251
161
|
}
|
|
252
162
|
if (this.isIdentified) {
|
|
253
|
-
this.send(Opcodes.UNSUBSCRIBE, { events });
|
|
163
|
+
this.send(opcodes_exports.Opcodes.UNSUBSCRIBE, { events });
|
|
254
164
|
}
|
|
255
165
|
}
|
|
256
166
|
sendChatMessage(roomSlug, content) {
|
|
@@ -258,7 +168,7 @@ var _PipelineClient = class _PipelineClient {
|
|
|
258
168
|
this.logger.warn("Cannot send chat: not identified");
|
|
259
169
|
return false;
|
|
260
170
|
}
|
|
261
|
-
this.send(Opcodes.CHAT_SEND, {
|
|
171
|
+
this.send(opcodes_exports.Opcodes.CHAT_SEND, {
|
|
262
172
|
room_slug: roomSlug,
|
|
263
173
|
content
|
|
264
174
|
});
|
|
@@ -310,24 +220,24 @@ var _PipelineClient = class _PipelineClient {
|
|
|
310
220
|
try {
|
|
311
221
|
const message = JSON.parse(String(event.data));
|
|
312
222
|
switch (message.op) {
|
|
313
|
-
case Opcodes.HELLO:
|
|
223
|
+
case opcodes_exports.Opcodes.HELLO:
|
|
314
224
|
this.handleHello(message.d);
|
|
315
225
|
break;
|
|
316
|
-
case Opcodes.HEARTBEAT_ACK:
|
|
226
|
+
case opcodes_exports.Opcodes.HEARTBEAT_ACK:
|
|
317
227
|
break;
|
|
318
|
-
case Opcodes.READY:
|
|
228
|
+
case opcodes_exports.Opcodes.READY:
|
|
319
229
|
this.handleReady(message.d);
|
|
320
230
|
break;
|
|
321
|
-
case Opcodes.INVALID_SESSION:
|
|
231
|
+
case opcodes_exports.Opcodes.INVALID_SESSION:
|
|
322
232
|
this.handleInvalidSession(message.d);
|
|
323
233
|
break;
|
|
324
|
-
case Opcodes.RECONNECT:
|
|
234
|
+
case opcodes_exports.Opcodes.RECONNECT:
|
|
325
235
|
this.handleReconnect();
|
|
326
236
|
break;
|
|
327
|
-
case Opcodes.DISPATCH:
|
|
237
|
+
case opcodes_exports.Opcodes.DISPATCH:
|
|
328
238
|
this.handleDispatch(message.t, message.d, message.s);
|
|
329
239
|
break;
|
|
330
|
-
case Opcodes.ERROR:
|
|
240
|
+
case opcodes_exports.Opcodes.ERROR:
|
|
331
241
|
this.handleServerError(message.d);
|
|
332
242
|
break;
|
|
333
243
|
default:
|
|
@@ -343,9 +253,9 @@ var _PipelineClient = class _PipelineClient {
|
|
|
343
253
|
this.ws = null;
|
|
344
254
|
this.emit("onDisconnect", event.code, event.reason);
|
|
345
255
|
const noReconnectCodes = [
|
|
346
|
-
CloseCodes.AUTHENTICATION_FAILED,
|
|
347
|
-
CloseCodes.NOT_AUTHENTICATED,
|
|
348
|
-
CloseCodes.NORMAL
|
|
256
|
+
opcodes_exports.CloseCodes.AUTHENTICATION_FAILED,
|
|
257
|
+
opcodes_exports.CloseCodes.NOT_AUTHENTICATED,
|
|
258
|
+
opcodes_exports.CloseCodes.NORMAL
|
|
349
259
|
];
|
|
350
260
|
if (!noReconnectCodes.includes(event.code)) {
|
|
351
261
|
this.scheduleReconnect();
|
|
@@ -412,7 +322,7 @@ var _PipelineClient = class _PipelineClient {
|
|
|
412
322
|
this.sendHeartbeat();
|
|
413
323
|
}
|
|
414
324
|
sendHeartbeat() {
|
|
415
|
-
this.send(Opcodes.HEARTBEAT, {
|
|
325
|
+
this.send(opcodes_exports.Opcodes.HEARTBEAT, {
|
|
416
326
|
seq: this.lastSequence || null
|
|
417
327
|
});
|
|
418
328
|
}
|
|
@@ -474,16 +384,11 @@ var PipelineClient = _PipelineClient;
|
|
|
474
384
|
function createPipeline(options) {
|
|
475
385
|
return new PipelineClient(options);
|
|
476
386
|
}
|
|
387
|
+
var export_PipelineErrors = opcodes_exports.PipelineErrors;
|
|
388
|
+
var export_getPipelineErrorName = opcodes_exports.getPipelineErrorName;
|
|
477
389
|
export {
|
|
478
|
-
Activity,
|
|
479
|
-
CloseCodes,
|
|
480
|
-
Events,
|
|
481
|
-
Opcodes,
|
|
482
390
|
PipelineClient,
|
|
483
|
-
PipelineErrors,
|
|
484
|
-
Presence,
|
|
485
|
-
Roles,
|
|
391
|
+
export_PipelineErrors as PipelineErrors,
|
|
486
392
|
createPipeline,
|
|
487
|
-
|
|
488
|
-
getPipelineErrorName
|
|
393
|
+
export_getPipelineErrorName as getPipelineErrorName
|
|
489
394
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@borealise/pipeline",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.2",
|
|
4
4
|
"description": "Official realtime pipeline client for Borealise",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -42,5 +42,8 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"tsup": "^8.5.0",
|
|
44
44
|
"typescript": "^5.9.2"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@borealise/shared": "^1.0.0"
|
|
45
48
|
}
|
|
46
49
|
}
|