@syncular/tauri 0.54.0 → 0.55.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.
- package/dist/remote.d.ts +5 -1
- package/dist/remote.js +46 -17
- package/package.json +4 -4
- package/src/remote.ts +48 -15
package/dist/remote.d.ts
CHANGED
|
@@ -245,7 +245,11 @@ export declare class TauriSyncClient implements PromiseMethods<ClientSnapshotMet
|
|
|
245
245
|
setPresence(scopeKey: string, doc: Record<string, unknown> | null): Promise<void>;
|
|
246
246
|
connectRealtime(): Promise<void>;
|
|
247
247
|
disconnectRealtime(): Promise<void>;
|
|
248
|
-
/**
|
|
248
|
+
/**
|
|
249
|
+
* Shut down the native core, release its keyring, then detach listeners.
|
|
250
|
+
* Every call returns the same promise, so a concurrent or repeated close
|
|
251
|
+
* settles only when the one native shutdown settles, with its outcome.
|
|
252
|
+
*/
|
|
249
253
|
close(): Promise<void>;
|
|
250
254
|
}
|
|
251
255
|
/** The error a `{error}` reply surfaces (mirrors the web-client `ClientSyncError`). */
|
package/dist/remote.js
CHANGED
|
@@ -226,6 +226,7 @@ export class TauriSyncClient {
|
|
|
226
226
|
#presenceListeners = new Set();
|
|
227
227
|
#unlisten;
|
|
228
228
|
#closed = false;
|
|
229
|
+
#closing;
|
|
229
230
|
#securityLifecycle;
|
|
230
231
|
#preflightBarrier;
|
|
231
232
|
#diagnosticsEnabled = false;
|
|
@@ -767,24 +768,28 @@ export class TauriSyncClient {
|
|
|
767
768
|
async disconnectRealtime() {
|
|
768
769
|
await this.#command('disconnectRealtime', {});
|
|
769
770
|
}
|
|
770
|
-
/**
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
771
|
+
/**
|
|
772
|
+
* Shut down the native core, release its keyring, then detach listeners.
|
|
773
|
+
* Every call returns the same promise, so a concurrent or repeated close
|
|
774
|
+
* settles only when the one native shutdown settles, with its outcome.
|
|
775
|
+
*/
|
|
776
|
+
close() {
|
|
777
|
+
if (this.#closing === undefined) {
|
|
778
|
+
const shutdown = this.#command('shutdown', {});
|
|
779
|
+
this.#closed = true;
|
|
780
|
+
this.#closing = shutdown
|
|
781
|
+
.then(() => { })
|
|
782
|
+
.finally(() => {
|
|
783
|
+
this.#unlisten?.();
|
|
784
|
+
this.#unlisten = undefined;
|
|
785
|
+
this.#invalidationListeners.clear();
|
|
786
|
+
this.#progress.clear();
|
|
787
|
+
this.#changeListeners.clear();
|
|
788
|
+
this.#diagnosticsListeners.clear();
|
|
789
|
+
this.#presenceListeners.clear();
|
|
790
|
+
});
|
|
787
791
|
}
|
|
792
|
+
return this.#closing;
|
|
788
793
|
}
|
|
789
794
|
}
|
|
790
795
|
function decodeDiagnosticsSnapshot(value, kind) {
|
|
@@ -859,10 +864,34 @@ function decodeChangeBatch(value) {
|
|
|
859
864
|
];
|
|
860
865
|
})
|
|
861
866
|
: [];
|
|
867
|
+
const appliedCommits = [];
|
|
868
|
+
if (raw.appliedCommits !== undefined) {
|
|
869
|
+
if (!Array.isArray(raw.appliedCommits))
|
|
870
|
+
return undefined;
|
|
871
|
+
for (const entry of raw.appliedCommits) {
|
|
872
|
+
if (entry === null || typeof entry !== 'object')
|
|
873
|
+
return undefined;
|
|
874
|
+
const item = entry;
|
|
875
|
+
if (typeof item.subscriptionId !== 'string' ||
|
|
876
|
+
typeof item.table !== 'string' ||
|
|
877
|
+
typeof item.commitSeq !== 'number' ||
|
|
878
|
+
!Number.isSafeInteger(item.commitSeq) ||
|
|
879
|
+
item.commitSeq < 1 ||
|
|
880
|
+
(item.source !== 'delta' && item.source !== 'pull'))
|
|
881
|
+
return undefined;
|
|
882
|
+
appliedCommits.push({
|
|
883
|
+
subscriptionId: item.subscriptionId,
|
|
884
|
+
table: item.table,
|
|
885
|
+
commitSeq: item.commitSeq,
|
|
886
|
+
source: item.source,
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
}
|
|
862
890
|
return {
|
|
863
891
|
revision: BigInt(raw.revision),
|
|
864
892
|
tables,
|
|
865
893
|
windows,
|
|
894
|
+
...(raw.appliedCommits !== undefined ? { appliedCommits } : {}),
|
|
866
895
|
...(raw.status !== undefined
|
|
867
896
|
? { status: raw.status }
|
|
868
897
|
: {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncular/tauri",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.55.1",
|
|
4
4
|
"description": "Tauri integration for the Syncular client",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Benjamin Kniffler",
|
|
@@ -64,13 +64,13 @@
|
|
|
64
64
|
"test": "bun test"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@syncular/client": "0.
|
|
67
|
+
"@syncular/client": "0.55.1"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@tauri-apps/api": ">=2.0.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@syncular/react": "0.
|
|
74
|
-
"@syncular/server": "0.
|
|
73
|
+
"@syncular/react": "0.55.1",
|
|
74
|
+
"@syncular/server": "0.55.1"
|
|
75
75
|
}
|
|
76
76
|
}
|
package/src/remote.ts
CHANGED
|
@@ -440,6 +440,7 @@ export class TauriSyncClient implements PromiseMethods<ClientSnapshotMethods> {
|
|
|
440
440
|
readonly #presenceListeners = new Set<(scopeKey: string) => void>();
|
|
441
441
|
#unlisten: (() => void) | undefined;
|
|
442
442
|
#closed = false;
|
|
443
|
+
#closing: Promise<void> | undefined;
|
|
443
444
|
#securityLifecycle: SecurityLifecycle;
|
|
444
445
|
#preflightBarrier: Promise<void> | undefined;
|
|
445
446
|
#diagnosticsEnabled = false;
|
|
@@ -1230,22 +1231,28 @@ export class TauriSyncClient implements PromiseMethods<ClientSnapshotMethods> {
|
|
|
1230
1231
|
await this.#command('disconnectRealtime', {});
|
|
1231
1232
|
}
|
|
1232
1233
|
|
|
1233
|
-
/**
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
this.#
|
|
1242
|
-
this.#
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1234
|
+
/**
|
|
1235
|
+
* Shut down the native core, release its keyring, then detach listeners.
|
|
1236
|
+
* Every call returns the same promise, so a concurrent or repeated close
|
|
1237
|
+
* settles only when the one native shutdown settles, with its outcome.
|
|
1238
|
+
*/
|
|
1239
|
+
close(): Promise<void> {
|
|
1240
|
+
if (this.#closing === undefined) {
|
|
1241
|
+
const shutdown = this.#command('shutdown', {});
|
|
1242
|
+
this.#closed = true;
|
|
1243
|
+
this.#closing = shutdown
|
|
1244
|
+
.then(() => {})
|
|
1245
|
+
.finally(() => {
|
|
1246
|
+
this.#unlisten?.();
|
|
1247
|
+
this.#unlisten = undefined;
|
|
1248
|
+
this.#invalidationListeners.clear();
|
|
1249
|
+
this.#progress.clear();
|
|
1250
|
+
this.#changeListeners.clear();
|
|
1251
|
+
this.#diagnosticsListeners.clear();
|
|
1252
|
+
this.#presenceListeners.clear();
|
|
1253
|
+
});
|
|
1248
1254
|
}
|
|
1255
|
+
return this.#closing;
|
|
1249
1256
|
}
|
|
1250
1257
|
}
|
|
1251
1258
|
|
|
@@ -1327,10 +1334,36 @@ function decodeChangeBatch(value: unknown): ClientChangeBatch | undefined {
|
|
|
1327
1334
|
];
|
|
1328
1335
|
})
|
|
1329
1336
|
: [];
|
|
1337
|
+
const appliedCommits: NonNullable<
|
|
1338
|
+
ClientChangeBatch['appliedCommits']
|
|
1339
|
+
>[number][] = [];
|
|
1340
|
+
if (raw.appliedCommits !== undefined) {
|
|
1341
|
+
if (!Array.isArray(raw.appliedCommits)) return undefined;
|
|
1342
|
+
for (const entry of raw.appliedCommits) {
|
|
1343
|
+
if (entry === null || typeof entry !== 'object') return undefined;
|
|
1344
|
+
const item = entry as Record<string, unknown>;
|
|
1345
|
+
if (
|
|
1346
|
+
typeof item.subscriptionId !== 'string' ||
|
|
1347
|
+
typeof item.table !== 'string' ||
|
|
1348
|
+
typeof item.commitSeq !== 'number' ||
|
|
1349
|
+
!Number.isSafeInteger(item.commitSeq) ||
|
|
1350
|
+
item.commitSeq < 1 ||
|
|
1351
|
+
(item.source !== 'delta' && item.source !== 'pull')
|
|
1352
|
+
)
|
|
1353
|
+
return undefined;
|
|
1354
|
+
appliedCommits.push({
|
|
1355
|
+
subscriptionId: item.subscriptionId,
|
|
1356
|
+
table: item.table,
|
|
1357
|
+
commitSeq: item.commitSeq,
|
|
1358
|
+
source: item.source,
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1330
1362
|
return {
|
|
1331
1363
|
revision: BigInt(raw.revision),
|
|
1332
1364
|
tables,
|
|
1333
1365
|
windows,
|
|
1366
|
+
...(raw.appliedCommits !== undefined ? { appliedCommits } : {}),
|
|
1334
1367
|
...(raw.status !== undefined
|
|
1335
1368
|
? { status: raw.status as SyncStatusSnapshot }
|
|
1336
1369
|
: {}),
|