@interncom/diplomatic 0.2.0 → 0.2.1

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.
@@ -18,5 +18,10 @@ export default class DiplomaticClientAPI<Handle extends HostHandle> {
18
18
  peek: (lastSeq: number) => Promise<ValStat<import("./codecs/peekItem.ts").IBagPeekItem[]>>;
19
19
  push: (bags: IBag[]) => Promise<ValStat<import("./codecs/pushItem.ts").IBagPushItem[]>>;
20
20
  pull: (seqs: number[]) => Promise<ValStat<import("./codecs/pullItem.ts").IBagPullItem[]>>;
21
- listen: (recv: PushReceiver) => Promise<Status>;
21
+ listen: (recv: PushReceiver, onDisconnect?: () => void, onConnect?: () => void) => Promise<Status>;
22
+ /** Returns whether this client has an active connection to its host.
23
+ * If a push listener is active, reports the listener's connected state.
24
+ * Otherwise (listen=false), reports true if registered.
25
+ */
26
+ isConnected(): boolean;
22
27
  }
@@ -6,6 +6,6 @@ export declare class WebsocketListener implements IPushListener {
6
6
  private websocket?;
7
7
  constructor(url: URL);
8
8
  connected(): boolean;
9
- connect(authTS: IAuthTimestamp, recv: PushReceiver, onDisconnect: () => void): Promise<Status>;
9
+ connect(authTS: IAuthTimestamp, recv: PushReceiver, onDisconnect?: () => void, onConnect?: () => void): Promise<Status>;
10
10
  disconnect(): void;
11
11
  }
@@ -11,6 +11,6 @@ export declare class CallbackListener implements IPushListener {
11
11
  private _shut?;
12
12
  constructor(notifier: IPushNotifier, crypto: IHostCrypto, clock: IClock);
13
13
  connected(): boolean;
14
- connect(authTS: IAuthTimestamp, recv: PushReceiver, _onDisconnect: () => void): Promise<Status>;
14
+ connect(authTS: IAuthTimestamp, recv: PushReceiver, _onDisconnect?: () => void, onConnect?: () => void): Promise<Status>;
15
15
  disconnect(): void;
16
16
  }
@@ -115,7 +115,7 @@ export interface IPushNotifier {
115
115
  push(pubKey: PublicKey, data: Uint8Array): void;
116
116
  }
117
117
  export interface IPushListener {
118
- connect(authTS: IAuthTimestamp, recv: PushReceiver, onDisconnect: () => void): Promise<Status>;
118
+ connect(authTS: IAuthTimestamp, recv: PushReceiver, onDisconnect?: () => void, onConnect?: () => void): Promise<Status>;
119
119
  connected(): boolean;
120
120
  disconnect(): void;
121
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interncom/diplomatic",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "Secure sync layer and CLI utilities for DIPLOMATIC",
6
6
  "files": [
@@ -37,15 +37,14 @@
37
37
  "access": "public"
38
38
  },
39
39
  "devDependencies": {
40
- "@types/bun": "latest",
41
- "@types/file-saver": "^2.0.7",
42
- "@types/node": "^20.14.11",
43
- "@types/react": "^19.1.0",
44
- "@vitest/coverage-v8": "^4.0.17",
45
- "esbuild": "0.21.5",
46
- "react": "^19.1.0",
47
- "typescript": "^5.8.3",
48
- "vitest": "^4.0.17"
40
+ "@types/bun": "1.3.13",
41
+ "@types/file-saver": "2.0.7",
42
+ "@types/node": "20.14.11",
43
+ "@types/react": "19.1.0",
44
+ "@vitest/coverage-v8": "4.0.17",
45
+ "react": "19.1.0",
46
+ "typescript": "5.8.3",
47
+ "vitest": "4.0.17"
49
48
  },
50
49
  "peerDependencies": {
51
50
  "react": "^19.0.0"