@bluecopa/core 0.1.30 → 0.1.32

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.
@@ -0,0 +1,53 @@
1
+ import { IWebsocketProvider } from './websocketProviderFactory';
2
+ export declare const NotebookChannel = "notebook";
3
+ export declare const NotificationChannel = "user-notification";
4
+ export declare const StatementResultChannel = "report-result";
5
+ export declare const ReconResultChannel = "recon-result";
6
+ export type PresenceMember = {
7
+ id: string;
8
+ info: {
9
+ name: string;
10
+ email: string;
11
+ isEditing?: boolean;
12
+ };
13
+ };
14
+ export type PresenceMembers = {
15
+ count: number;
16
+ each: (callback: (member: PresenceMember) => void) => void;
17
+ members: Record<string, PresenceMember['info']>;
18
+ };
19
+ declare class PusherWebsocket implements IWebsocketProvider {
20
+ private pusher;
21
+ isConnected: boolean;
22
+ userId: string;
23
+ private pusherKey?;
24
+ private pusherCluster?;
25
+ private notebookChannel;
26
+ private notificationChannel;
27
+ private reconResultChannel;
28
+ private statementResultChannel;
29
+ private otherChannels;
30
+ constructor(userId: string, pusherKey: string, pusherCluster: string);
31
+ /**
32
+ * Set user info for presence channels.
33
+ * Note: For Pusher, presence info is set via the server-side auth endpoint.
34
+ * This method is a no-op but provided for interface compatibility.
35
+ */
36
+ setPresenceInfo(_info: {
37
+ name: string;
38
+ email: string;
39
+ }): void;
40
+ connect(): void;
41
+ bind(channel: string, event: string, callback: (data: any) => void): void;
42
+ bindGlobal(channel: string, callback: (data: any) => void): void;
43
+ unbind(channel: string, event: string): void;
44
+ unbindAll(channel: string): void;
45
+ trigger(channel: string, event: string, data: any): void;
46
+ disconnect(): void;
47
+ /**
48
+ * Get members of a presence channel.
49
+ * Returns PresenceMembers synchronously for Pusher.
50
+ */
51
+ getPresenceChannelMembers(channel: string): PresenceMembers;
52
+ }
53
+ export default PusherWebsocket;
@@ -8,8 +8,10 @@ export interface IWebsocketProvider {
8
8
  }
9
9
  export declare class WebsocketContextFactory {
10
10
  static create(mechanism: "pusher" | "centrifugo", args: {
11
- connectionUrl: string;
12
- token: string;
11
+ connectionUrl?: string;
12
+ token?: string;
13
13
  userId: string;
14
+ pusherKey?: string;
15
+ pusherCluster?: string;
14
16
  }): IWebsocketProvider;
15
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluecopa/core",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "type": "module",
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",
@@ -34,7 +34,8 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "axios": "1.12.0",
37
+ "centrifuge": "5.2.2",
37
38
  "lodash": "4.17.21",
38
- "centrifuge": "5.2.2"
39
+ "pusher-js": "^8.3.0"
39
40
  }
40
41
  }