@syncular/tauri 0.19.0 → 0.20.0
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.ts +3 -0
- package/dist/index.js +13 -0
- package/package.json +3 -3
- package/src/index.ts +18 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SyncProgress, type SyncProgressListener } from '@syncular/client';
|
|
1
2
|
import type { ClientSnapshotMethods, PromiseMethods } from '@syncular/client';
|
|
2
3
|
/**
|
|
3
4
|
* @syncular/tauri — the JS bridge to the native syncular instance running
|
|
@@ -97,6 +98,8 @@ export declare class TauriSyncClient implements PromiseMethods<ClientSnapshotMet
|
|
|
97
98
|
readonly headers?: Readonly<Record<string, string>>;
|
|
98
99
|
}): Promise<void>;
|
|
99
100
|
onInvalidate(listener: InvalidationListener): () => void;
|
|
101
|
+
onProgress(listener: SyncProgressListener): () => void;
|
|
102
|
+
progressSnapshot(): SyncProgress | undefined;
|
|
100
103
|
onChange(listener: ClientChangeListener): () => void;
|
|
101
104
|
onDiagnostics(listener: ClientDiagnosticsListener): () => void;
|
|
102
105
|
onPresence(listener: (scopeKey: string) => void): () => void;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ProgressEmitter, } from '@syncular/client';
|
|
1
2
|
// -- Types the bridge speaks (structurally the web-client's) -----------------
|
|
2
3
|
// Most imports stay type-only; the stable preflight error code is shared at
|
|
3
4
|
// runtime so every host surfaces byte-identical policy evidence.
|
|
@@ -124,6 +125,7 @@ export class TauriSyncClient {
|
|
|
124
125
|
#tauri;
|
|
125
126
|
#invalidationListeners = new Set();
|
|
126
127
|
#changeListeners = new Set();
|
|
128
|
+
#progress = new ProgressEmitter();
|
|
127
129
|
#diagnosticsListeners = new Set();
|
|
128
130
|
#presenceListeners = new Set();
|
|
129
131
|
#unlisten;
|
|
@@ -170,6 +172,10 @@ export class TauriSyncClient {
|
|
|
170
172
|
/** @internal — fan an incoming plugin event out to the local listeners. */
|
|
171
173
|
__dispatchEvent(event) {
|
|
172
174
|
switch (event.type) {
|
|
175
|
+
case 'progress': {
|
|
176
|
+
this.#progress.emit(event.progress);
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
173
179
|
case 'change': {
|
|
174
180
|
const batch = decodeChangeBatch(event.batch);
|
|
175
181
|
if (batch === undefined)
|
|
@@ -274,6 +280,12 @@ export class TauriSyncClient {
|
|
|
274
280
|
this.#invalidationListeners.add(listener);
|
|
275
281
|
return () => this.#invalidationListeners.delete(listener);
|
|
276
282
|
}
|
|
283
|
+
onProgress(listener) {
|
|
284
|
+
return this.#progress.on(listener);
|
|
285
|
+
}
|
|
286
|
+
progressSnapshot() {
|
|
287
|
+
return this.#progress.snapshot();
|
|
288
|
+
}
|
|
277
289
|
onChange(listener) {
|
|
278
290
|
this.#changeListeners.add(listener);
|
|
279
291
|
return () => this.#changeListeners.delete(listener);
|
|
@@ -524,6 +536,7 @@ export class TauriSyncClient {
|
|
|
524
536
|
this.#unlisten?.();
|
|
525
537
|
this.#unlisten = undefined;
|
|
526
538
|
this.#invalidationListeners.clear();
|
|
539
|
+
this.#progress.clear();
|
|
527
540
|
this.#changeListeners.clear();
|
|
528
541
|
this.#diagnosticsListeners.clear();
|
|
529
542
|
this.#presenceListeners.clear();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncular/tauri",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Tauri integration for the Syncular client",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Benjamin Kniffler",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"test": "bun test"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@syncular/client": "0.
|
|
51
|
+
"@syncular/client": "0.20.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@tauri-apps/api": ">=2.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@syncular/react": "0.
|
|
57
|
+
"@syncular/react": "0.20.0"
|
|
58
58
|
}
|
|
59
59
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ProgressEmitter,
|
|
3
|
+
type SyncProgress,
|
|
4
|
+
type SyncProgressListener,
|
|
5
|
+
} from '@syncular/client';
|
|
1
6
|
import type { ClientSnapshotMethods, PromiseMethods } from '@syncular/client';
|
|
2
7
|
/**
|
|
3
8
|
* @syncular/tauri — the JS bridge to the native syncular instance running
|
|
@@ -258,6 +263,7 @@ export class TauriSyncClient implements PromiseMethods<ClientSnapshotMethods> {
|
|
|
258
263
|
readonly #tauri: TauriApi;
|
|
259
264
|
readonly #invalidationListeners = new Set<InvalidationListener>();
|
|
260
265
|
readonly #changeListeners = new Set<ClientChangeListener>();
|
|
266
|
+
readonly #progress = new ProgressEmitter();
|
|
261
267
|
readonly #diagnosticsListeners = new Set<ClientDiagnosticsListener>();
|
|
262
268
|
readonly #presenceListeners = new Set<(scopeKey: string) => void>();
|
|
263
269
|
#unlisten: (() => void) | undefined;
|
|
@@ -326,6 +332,10 @@ export class TauriSyncClient implements PromiseMethods<ClientSnapshotMethods> {
|
|
|
326
332
|
/** @internal — fan an incoming plugin event out to the local listeners. */
|
|
327
333
|
__dispatchEvent(event: SyncularEvent): void {
|
|
328
334
|
switch (event.type) {
|
|
335
|
+
case 'progress': {
|
|
336
|
+
this.#progress.emit(event.progress as SyncProgress);
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
329
339
|
case 'change': {
|
|
330
340
|
const batch = decodeChangeBatch(event.batch);
|
|
331
341
|
if (batch === undefined) break;
|
|
@@ -442,6 +452,13 @@ export class TauriSyncClient implements PromiseMethods<ClientSnapshotMethods> {
|
|
|
442
452
|
return () => this.#invalidationListeners.delete(listener);
|
|
443
453
|
}
|
|
444
454
|
|
|
455
|
+
onProgress(listener: SyncProgressListener): () => void {
|
|
456
|
+
return this.#progress.on(listener);
|
|
457
|
+
}
|
|
458
|
+
progressSnapshot(): SyncProgress | undefined {
|
|
459
|
+
return this.#progress.snapshot();
|
|
460
|
+
}
|
|
461
|
+
|
|
445
462
|
onChange(listener: ClientChangeListener): () => void {
|
|
446
463
|
this.#changeListeners.add(listener);
|
|
447
464
|
return () => this.#changeListeners.delete(listener);
|
|
@@ -802,6 +819,7 @@ export class TauriSyncClient implements PromiseMethods<ClientSnapshotMethods> {
|
|
|
802
819
|
this.#unlisten?.();
|
|
803
820
|
this.#unlisten = undefined;
|
|
804
821
|
this.#invalidationListeners.clear();
|
|
822
|
+
this.#progress.clear();
|
|
805
823
|
this.#changeListeners.clear();
|
|
806
824
|
this.#diagnosticsListeners.clear();
|
|
807
825
|
this.#presenceListeners.clear();
|