@builder6/rooms 3.0.4 → 3.0.6
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/package.json +10 -7
- package/.prettierrc +0 -4
- package/src/emails/UnreadMention.tsx +0 -37
- package/src/emails/UnreadReplies.tsx +0 -49
- package/src/emails/_components/comment.tsx +0 -70
- package/src/emails/_components/header.tsx +0 -26
- package/src/emails/_components/headline.tsx +0 -20
- package/src/emails/_components/layout.tsx +0 -45
- package/src/emails/_lib/types.ts +0 -10
- package/src/emails/_styles/colors.ts +0 -7
- package/src/emails/_utils/cn.ts +0 -6
- package/src/emails/_utils/comments.ts +0 -61
- package/src/emails/_utils/getProps.ts +0 -7
- package/src/plugin.module.ts +0 -3
- package/src/rooms/app.controller.ts +0 -89
- package/src/rooms/dtos/inbox_notifications.dto.ts +0 -13
- package/src/rooms/dtos/notifications.dto.ts +0 -14
- package/src/rooms/dtos/room_members.dto.ts +0 -32
- package/src/rooms/dtos/rooms.dto.ts +0 -51
- package/src/rooms/emailNotification.service.tsx +0 -126
- package/src/rooms/emails/comment-body.tsx +0 -342
- package/src/rooms/emails/comment-with-body.ts +0 -24
- package/src/rooms/emails/index.ts +0 -25
- package/src/rooms/emails/lib/batch-users-resolver.ts +0 -120
- package/src/rooms/emails/lib/css-properties.ts +0 -123
- package/src/rooms/emails/lib/warning.ts +0 -25
- package/src/rooms/emails/thread-notification.tsx +0 -583
- package/src/rooms/globals/augmentation.ts +0 -89
- package/src/rooms/index.ts +0 -5
- package/src/rooms/lib/DateToString.ts +0 -9
- package/src/rooms/lib/Json.ts +0 -34
- package/src/rooms/lib/utils.ts +0 -240
- package/src/rooms/liveblocks.service.ts +0 -25
- package/src/rooms/notifications.service.ts +0 -235
- package/src/rooms/protocol/AuthToken.ts +0 -126
- package/src/rooms/protocol/Authentication.ts +0 -18
- package/src/rooms/protocol/BaseActivitiesData.ts +0 -5
- package/src/rooms/protocol/BaseRoomInfo.ts +0 -15
- package/src/rooms/protocol/BaseUserMeta.ts +0 -28
- package/src/rooms/protocol/ClientMsg.ts +0 -94
- package/src/rooms/protocol/Comments.ts +0 -202
- package/src/rooms/protocol/InboxNotifications.ts +0 -75
- package/src/rooms/protocol/Op.ts +0 -143
- package/src/rooms/protocol/SerializedCrdt.ts +0 -61
- package/src/rooms/protocol/ServerMsg.ts +0 -307
- package/src/rooms/protocol/VersionHistory.ts +0 -9
- package/src/rooms/rooms.controller.ts +0 -587
- package/src/rooms/rooms.gateway.ts +0 -267
- package/src/rooms/rooms.guard.ts +0 -52
- package/src/rooms/rooms.module.ts +0 -38
- package/src/rooms/rooms.moleculer.ts +0 -80
- package/src/rooms/rooms.service.ts +0 -723
- package/tsconfig.json +0 -10
- package/yarn-error.log +0 -17218
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
import type { Json, JsonObject } from '../lib/Json';
|
|
2
|
-
import type { BaseUserMeta } from './BaseUserMeta';
|
|
3
|
-
import type { Op } from './Op';
|
|
4
|
-
import type { IdTuple, SerializedCrdt } from './SerializedCrdt';
|
|
5
|
-
|
|
6
|
-
export enum ServerMsgCode {
|
|
7
|
-
// For Presence
|
|
8
|
-
UPDATE_PRESENCE = 100,
|
|
9
|
-
USER_JOINED = 101,
|
|
10
|
-
USER_LEFT = 102,
|
|
11
|
-
BROADCASTED_EVENT = 103,
|
|
12
|
-
ROOM_STATE = 104,
|
|
13
|
-
|
|
14
|
-
// For Storage
|
|
15
|
-
INITIAL_STORAGE_STATE = 200,
|
|
16
|
-
UPDATE_STORAGE = 201,
|
|
17
|
-
REJECT_STORAGE_OP = 299,
|
|
18
|
-
|
|
19
|
-
// For Yjs Docs
|
|
20
|
-
UPDATE_YDOC = 300,
|
|
21
|
-
|
|
22
|
-
// For Comments
|
|
23
|
-
THREAD_CREATED = 400,
|
|
24
|
-
THREAD_DELETED = 407,
|
|
25
|
-
THREAD_METADATA_UPDATED = 401,
|
|
26
|
-
THREAD_UPDATED = 408,
|
|
27
|
-
COMMENT_CREATED = 402,
|
|
28
|
-
COMMENT_EDITED = 403,
|
|
29
|
-
COMMENT_DELETED = 404,
|
|
30
|
-
COMMENT_REACTION_ADDED = 405,
|
|
31
|
-
COMMENT_REACTION_REMOVED = 406,
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Messages that can be sent from the server to the client.
|
|
36
|
-
*/
|
|
37
|
-
export type ServerMsg<
|
|
38
|
-
P extends JsonObject,
|
|
39
|
-
U extends BaseUserMeta,
|
|
40
|
-
E extends Json,
|
|
41
|
-
> =
|
|
42
|
-
// For Presence
|
|
43
|
-
| UpdatePresenceServerMsg<P> // Broadcasted
|
|
44
|
-
| UserJoinServerMsg<U> // Broadcasted
|
|
45
|
-
| UserLeftServerMsg // Broadcasted
|
|
46
|
-
| BroadcastedEventServerMsg<E> // Broadcasted
|
|
47
|
-
| RoomStateServerMsg<U> // For a single client
|
|
48
|
-
|
|
49
|
-
// For Storage
|
|
50
|
-
| InitialDocumentStateServerMsg // For a single client
|
|
51
|
-
| UpdateStorageServerMsg // Broadcasted
|
|
52
|
-
| RejectedStorageOpServerMsg // For a single client
|
|
53
|
-
| YDocUpdateServerMsg // For receiving doc from backend
|
|
54
|
-
|
|
55
|
-
// Comments
|
|
56
|
-
| CommentsEventServerMsg;
|
|
57
|
-
|
|
58
|
-
export type CommentsEventServerMsg =
|
|
59
|
-
| ThreadCreatedEvent
|
|
60
|
-
| ThreadDeletedEvent
|
|
61
|
-
| ThreadMetadataUpdatedEvent
|
|
62
|
-
| ThreadUpdatedEvent
|
|
63
|
-
| CommentCreatedEvent
|
|
64
|
-
| CommentEditedEvent
|
|
65
|
-
| CommentDeletedEvent
|
|
66
|
-
| CommentReactionAdded
|
|
67
|
-
| CommentReactionRemoved;
|
|
68
|
-
|
|
69
|
-
type ThreadCreatedEvent = {
|
|
70
|
-
type: ServerMsgCode.THREAD_CREATED;
|
|
71
|
-
threadId: string;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
type ThreadDeletedEvent = {
|
|
75
|
-
type: ServerMsgCode.THREAD_DELETED;
|
|
76
|
-
threadId: string;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
type ThreadMetadataUpdatedEvent = {
|
|
80
|
-
type: ServerMsgCode.THREAD_METADATA_UPDATED;
|
|
81
|
-
threadId: string;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
type ThreadUpdatedEvent = {
|
|
85
|
-
type: ServerMsgCode.THREAD_UPDATED;
|
|
86
|
-
threadId: string;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
type CommentCreatedEvent = {
|
|
90
|
-
type: ServerMsgCode.COMMENT_CREATED;
|
|
91
|
-
threadId: string;
|
|
92
|
-
commentId: string;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
type CommentEditedEvent = {
|
|
96
|
-
type: ServerMsgCode.COMMENT_EDITED;
|
|
97
|
-
threadId: string;
|
|
98
|
-
commentId: string;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
type CommentDeletedEvent = {
|
|
102
|
-
type: ServerMsgCode.COMMENT_DELETED;
|
|
103
|
-
threadId: string;
|
|
104
|
-
commentId: string;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
type CommentReactionAdded = {
|
|
108
|
-
type: ServerMsgCode.COMMENT_REACTION_ADDED;
|
|
109
|
-
threadId: string;
|
|
110
|
-
commentId: string;
|
|
111
|
-
emoji: string;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
type CommentReactionRemoved = {
|
|
115
|
-
type: ServerMsgCode.COMMENT_REACTION_REMOVED;
|
|
116
|
-
threadId: string;
|
|
117
|
-
commentId: string;
|
|
118
|
-
emoji: string;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
123
|
-
* a User updated their presence. For example, when a user moves their cursor.
|
|
124
|
-
*
|
|
125
|
-
* In most cases, the data payload will only include the fields from the
|
|
126
|
-
* Presence that have been changed since the last announcement. However, after
|
|
127
|
-
* a new user joins a room, a "full presence" will be announced so the newly
|
|
128
|
-
* connected user will get each other's user full presence at least once. In
|
|
129
|
-
* those cases, the `targetActor` field indicates the newly connected client,
|
|
130
|
-
* so all other existing clients can ignore this broadcasted message.
|
|
131
|
-
*/
|
|
132
|
-
export type UpdatePresenceServerMsg<P extends JsonObject> =
|
|
133
|
-
//
|
|
134
|
-
// Full Presence™ message
|
|
135
|
-
//
|
|
136
|
-
| {
|
|
137
|
-
readonly type: ServerMsgCode.UPDATE_PRESENCE;
|
|
138
|
-
/**
|
|
139
|
-
* The User whose Presence has changed.
|
|
140
|
-
*/
|
|
141
|
-
readonly actor: number;
|
|
142
|
-
/**
|
|
143
|
-
* When set, signifies that this is a Full Presence™ update, not a patch.
|
|
144
|
-
*
|
|
145
|
-
* The numeric value itself no longer has specific meaning. Historically,
|
|
146
|
-
* this field was intended so that clients could ignore these broadcasted
|
|
147
|
-
* full presence messages, but it turned out that getting a full presence
|
|
148
|
-
* "keyframe" from time to time was useful.
|
|
149
|
-
*
|
|
150
|
-
* So nowadays, the presence (pun intended) of this `targetActor` field
|
|
151
|
-
* is a backward-compatible way of expressing that the `data` contains
|
|
152
|
-
* all presence fields, and isn't a partial "patch".
|
|
153
|
-
*/
|
|
154
|
-
readonly targetActor: number;
|
|
155
|
-
/**
|
|
156
|
-
* The partial or full Presence of a User. If the `targetActor` field is set,
|
|
157
|
-
* this will be the full Presence, otherwise it only contain the fields that
|
|
158
|
-
* have changed since the last broadcast.
|
|
159
|
-
*/
|
|
160
|
-
readonly data: P;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
//
|
|
164
|
-
// Partial Presence™ message
|
|
165
|
-
//
|
|
166
|
-
| {
|
|
167
|
-
readonly type: ServerMsgCode.UPDATE_PRESENCE;
|
|
168
|
-
/**
|
|
169
|
-
* The User whose Presence has changed.
|
|
170
|
-
*/
|
|
171
|
-
readonly actor: number;
|
|
172
|
-
/**
|
|
173
|
-
* Not set for partial presence updates.
|
|
174
|
-
*/
|
|
175
|
-
readonly targetActor?: undefined;
|
|
176
|
-
/**
|
|
177
|
-
* A partial Presence patch to apply to the User. It will only contain the
|
|
178
|
-
* fields that have changed since the last broadcast.
|
|
179
|
-
*/
|
|
180
|
-
readonly data: Partial<P>;
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
185
|
-
* a new User has joined the Room.
|
|
186
|
-
*/
|
|
187
|
-
export type UserJoinServerMsg<U extends BaseUserMeta> = {
|
|
188
|
-
readonly type: ServerMsgCode.USER_JOINED;
|
|
189
|
-
readonly actor: number;
|
|
190
|
-
/**
|
|
191
|
-
* The id of the User that has been set in the authentication endpoint.
|
|
192
|
-
* Useful to get additional information about the connected user.
|
|
193
|
-
*/
|
|
194
|
-
readonly id: U['id'];
|
|
195
|
-
/**
|
|
196
|
-
* Additional user information that has been set in the authentication
|
|
197
|
-
* endpoint.
|
|
198
|
-
*/
|
|
199
|
-
readonly info: U['info'];
|
|
200
|
-
/**
|
|
201
|
-
* Informs the client what (public) permissions this (other) User has.
|
|
202
|
-
*/
|
|
203
|
-
readonly scopes: string[];
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
208
|
-
* a new User has left the Room.
|
|
209
|
-
*/
|
|
210
|
-
export type UserLeftServerMsg = {
|
|
211
|
-
readonly type: ServerMsgCode.USER_LEFT;
|
|
212
|
-
readonly actor: number;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Sent by the WebSocket server when the ydoc is updated or when requested based on stateVector passed.
|
|
217
|
-
* Contains a base64 encoded update
|
|
218
|
-
*/
|
|
219
|
-
export type YDocUpdateServerMsg = {
|
|
220
|
-
readonly type: ServerMsgCode.UPDATE_YDOC;
|
|
221
|
-
readonly update: string;
|
|
222
|
-
readonly isSync: boolean; // dropped after 1.2, we use presence of stateVector instead
|
|
223
|
-
readonly stateVector: string | null; // server's state vector, sent in response to fetch
|
|
224
|
-
readonly guid?: string; // an optional guid to identify which subdoc this update to
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
229
|
-
* a User broadcasted an Event to everyone in the Room.
|
|
230
|
-
*/
|
|
231
|
-
export type BroadcastedEventServerMsg<E extends Json> = {
|
|
232
|
-
readonly type: ServerMsgCode.BROADCASTED_EVENT;
|
|
233
|
-
/**
|
|
234
|
-
* The User who broadcast the Event. Absent when this event is broadcast from
|
|
235
|
-
* the REST API in the backend.
|
|
236
|
-
*/
|
|
237
|
-
readonly actor: number;
|
|
238
|
-
/**
|
|
239
|
-
* The arbitrary payload of the Event. This can be any JSON value. Clients
|
|
240
|
-
* will have to manually verify/decode this event.
|
|
241
|
-
*/
|
|
242
|
-
readonly event: E;
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Sent by the WebSocket server to a single client in response to the client
|
|
247
|
-
* joining the Room, to provide the initial state of the Room. The payload
|
|
248
|
-
* includes a list of all other Users that already are in the Room.
|
|
249
|
-
*/
|
|
250
|
-
export type RoomStateServerMsg<U extends BaseUserMeta> = {
|
|
251
|
-
readonly type: ServerMsgCode.ROOM_STATE;
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Informs the client what their actor ID is going to be.
|
|
255
|
-
* @since v1.2 (WS API v7)
|
|
256
|
-
*/
|
|
257
|
-
readonly actor: number;
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Secure nonce for the current session.
|
|
261
|
-
* @since v1.2 (WS API v7)
|
|
262
|
-
*/
|
|
263
|
-
readonly nonce: string;
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Informs the client what permissions the current User (self) has.
|
|
267
|
-
* @since v1.2 (WS API v7)
|
|
268
|
-
*/
|
|
269
|
-
readonly scopes: string[];
|
|
270
|
-
|
|
271
|
-
readonly users: {
|
|
272
|
-
readonly [otherActor: number]: U & { scopes: string[] };
|
|
273
|
-
};
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Sent by the WebSocket server to a single client in response to the client
|
|
278
|
-
* joining the Room, to provide the initial Storage state of the Room. The
|
|
279
|
-
* payload includes the entire Storage document.
|
|
280
|
-
*/
|
|
281
|
-
export type InitialDocumentStateServerMsg = {
|
|
282
|
-
readonly type: ServerMsgCode.INITIAL_STORAGE_STATE;
|
|
283
|
-
readonly items: IdTuple<SerializedCrdt>[];
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
288
|
-
* a change occurred in the Storage document.
|
|
289
|
-
*
|
|
290
|
-
* The payload of this message contains a list of Ops (aka incremental
|
|
291
|
-
* mutations to make to the initially loaded document).
|
|
292
|
-
*/
|
|
293
|
-
export type UpdateStorageServerMsg = {
|
|
294
|
-
readonly type: ServerMsgCode.UPDATE_STORAGE;
|
|
295
|
-
readonly ops: Op[];
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Sent by the WebSocket server to the client to indicate that certain opIds
|
|
300
|
-
* have been received but were rejected because they caused mutations that are
|
|
301
|
-
* incompatible with the Room's schema.
|
|
302
|
-
*/
|
|
303
|
-
export type RejectedStorageOpServerMsg = {
|
|
304
|
-
readonly type: ServerMsgCode.REJECT_STORAGE_OP;
|
|
305
|
-
readonly opIds: string[];
|
|
306
|
-
readonly reason: string;
|
|
307
|
-
};
|