microboard-temp 0.13.59 → 0.13.61

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.
@@ -11,7 +11,9 @@ export interface BoardEvent {
11
11
  }
12
12
  export interface BoardEventBody {
13
13
  eventId: string;
14
- userId: number;
14
+ userId?: number | string;
15
+ authorUserId?: string;
16
+ sessionId?: string;
15
17
  boardId: string;
16
18
  operation: Operation;
17
19
  }
@@ -21,7 +23,9 @@ export interface BoardEventPack {
21
23
  }
22
24
  export interface BoardEventPackBody {
23
25
  eventId: string;
24
- userId: number;
26
+ userId?: number | string;
27
+ authorUserId?: string;
28
+ sessionId?: string;
25
29
  boardId: string;
26
30
  operations: (Operation & {
27
31
  actualId?: string;
@@ -29,7 +33,6 @@ export interface BoardEventPackBody {
29
33
  }
30
34
  export interface SyncBoardEvent extends BoardEvent {
31
35
  lastKnownOrder: number;
32
- userId: number;
33
36
  }
34
37
  interface SyncBoardEventPackBody extends BoardEventPackBody {
35
38
  lastKnownOrder: number;
@@ -86,7 +89,9 @@ export declare class Events {
86
89
  private canUndoEvent;
87
90
  private setLatestUserEvent;
88
91
  private getOpKey;
89
- private getUserId;
92
+ private getSessionId;
93
+ private getSessionIds;
94
+ private getAuthorUserId;
90
95
  private getNextEventId;
91
96
  }
92
97
  export declare function createEvents(board: Board, connection: Connection | undefined, // undefined for node or local
@@ -51,11 +51,11 @@ export declare class EventsLog {
51
51
  /**
52
52
  * Finds the most recent undoable record for a specific user
53
53
  */
54
- getUndoRecord(userId: number): HistoryRecord | null;
54
+ getUndoRecord(sessionIds: string[]): HistoryRecord | null;
55
55
  /**
56
56
  * Finds the most recent redoable record for a specific user
57
57
  */
58
- getRedoRecord(userId: number): HistoryRecord | null;
58
+ getRedoRecord(sessionIds: string[]): HistoryRecord | null;
59
59
  /**
60
60
  * Retrieves a specific record by its event ID
61
61
  */
@@ -1,3 +1,3 @@
1
1
  import { EventsList } from "./createEventsList";
2
2
  import { HistoryRecord } from "./EventsLog";
3
- export declare function getRedoRecordFromList(userId: number, list: EventsList): HistoryRecord | null;
3
+ export declare function getRedoRecordFromList(sessionIds: string[], list: EventsList): HistoryRecord | null;
@@ -1,3 +1,3 @@
1
1
  import { EventsList } from "./createEventsList";
2
2
  import { HistoryRecord } from "./EventsLog";
3
- export declare function getUndoRecordFromList(userId: number, list: EventsList): HistoryRecord | null;
3
+ export declare function getUndoRecordFromList(sessionIds: string[], list: EventsList): HistoryRecord | null;
@@ -1,2 +1,2 @@
1
1
  import { HistoryRecord } from "./EventsLog";
2
- export declare function shouldSkipEvent(record: HistoryRecord, userId: number): boolean;
2
+ export declare function shouldSkipEvent(record: HistoryRecord, sessionIds: string[]): boolean;
@@ -42,6 +42,7 @@ export interface VersionCheckMsg {
42
42
  }
43
43
  export interface AuthConfirmationMsg {
44
44
  type: "AuthConfirmation";
45
+ sessionId?: string;
45
46
  }
46
47
  export interface PingMsg {
47
48
  type: "ping";
@@ -75,7 +76,6 @@ export interface BoardEventMsg {
75
76
  boardId: string;
76
77
  event: SyncEvent;
77
78
  sequenceNumber: number;
78
- userId: string;
79
79
  }
80
80
  export interface ConfirmationMsg {
81
81
  type: 'Confirmation';
@@ -95,7 +95,9 @@ export interface SnapshotRequestMsg {
95
95
  export interface UserJoinMsg {
96
96
  type: "UserJoin";
97
97
  timestamp: number;
98
- userId: number;
98
+ userId?: number | string;
99
+ sessionId?: string;
100
+ authorUserId?: string;
99
101
  boardId: string;
100
102
  snapshots: Record<string, PresenceUser>;
101
103
  }
@@ -103,7 +105,9 @@ export interface PresenceEventMsg<T = PresenceEventType> {
103
105
  type: "PresenceEvent";
104
106
  boardId: string;
105
107
  event: T;
106
- userId: string;
108
+ userId?: string;
109
+ sessionId?: string;
110
+ authorUserId?: string;
107
111
  softId: string | null;
108
112
  hardId: string | null;
109
113
  messageId: string;
@@ -0,0 +1,9 @@
1
+ import type { Connection } from "../Settings";
2
+ import type { BoardEventBody, BoardEventPackBody } from "./Events";
3
+ type EventIdentityBody = Pick<BoardEventBody | BoardEventPackBody, "sessionId" | "authorUserId" | "userId">;
4
+ export declare function getBoardEventSessionId(body: EventIdentityBody): string | undefined;
5
+ export declare function getBoardEventAuthorUserId(body: EventIdentityBody): string | undefined;
6
+ export declare function getConnectionSessionId(connection?: Connection): string;
7
+ export declare function getConnectionSessionIds(connection?: Connection): string[];
8
+ export declare function getConnectionAuthorUserId(connection?: Connection): string | undefined;
9
+ export {};
@@ -17,6 +17,8 @@ interface Cursor {
17
17
  export interface PresenceUser {
18
18
  nickname: string;
19
19
  userId: string;
20
+ sessionId?: string;
21
+ authorUserId?: string | null;
20
22
  softId: string | null;
21
23
  hardId: string | null;
22
24
  color: string;
@@ -50,7 +52,6 @@ export declare class Presence {
50
52
  trackedUser: PresenceUser | null;
51
53
  private cursorsEnabled;
52
54
  private drawingContext;
53
- private currentUserId;
54
55
  users: Map<string, PresenceUser>;
55
56
  followers: string[];
56
57
  private svgImageCache;
@@ -64,8 +65,10 @@ export declare class Presence {
64
65
  private sendCameraPresence;
65
66
  private sendSelectionEvent;
66
67
  getIsDisableTrackingNeeded(): boolean;
67
- setCurrentUser(userId: string): void;
68
- private updateCurrentUser;
68
+ private readonly onStorageChange;
69
+ private getCurrentSessionId;
70
+ private getLegacyCurrentUserId;
71
+ private isCurrentSessionTarget;
69
72
  cleanup(): void;
70
73
  setupUpdateInterval(): void;
71
74
  addEvents(events: Events): void;
@@ -87,7 +90,7 @@ export declare class Presence {
87
90
  processPointerMove(msg: PresenceEventMsg<PointerMoveEvent>): void;
88
91
  processSelection(msg: PresenceEventMsg<SelectionEvent>): void;
89
92
  processSetColor(msg: PresenceEventMsg<SetUserColorEvent>): void;
90
- enableTracking(userId: string): void;
93
+ enableTracking(sessionId: string): void;
91
94
  disableTracking(): void;
92
95
  getFollowers(): PresenceUser[];
93
96
  toggleCursorsRendering(): boolean;
@@ -13,7 +13,11 @@ import type { SocketMsg } from "./Events/MessageRouter/boardMessageInterface";
13
13
  import type { Editor, BasePoint } from "slate";
14
14
  export interface Connection {
15
15
  connectionId: number;
16
+ sessionId?: string;
17
+ authorUserId?: string;
16
18
  getCurrentUser: () => string;
19
+ getSessionId?: () => string | undefined;
20
+ getAuthorUserId?: () => string | undefined;
17
21
  connect(): Promise<void>;
18
22
  subscribe(board: Board): void;
19
23
  unsubscribe(board: Board): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.13.59",
3
+ "version": "0.13.61",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",