@syncular/tauri 0.55.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 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
- /** Shut down the native core, release its keyring, then detach listeners. */
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
- /** Shut down the native core, release its keyring, then detach listeners. */
771
- async close() {
772
- if (this.#closed)
773
- return;
774
- const shutdown = this.#command('shutdown', {});
775
- this.#closed = true;
776
- try {
777
- await shutdown;
778
- }
779
- finally {
780
- this.#unlisten?.();
781
- this.#unlisten = undefined;
782
- this.#invalidationListeners.clear();
783
- this.#progress.clear();
784
- this.#changeListeners.clear();
785
- this.#diagnosticsListeners.clear();
786
- this.#presenceListeners.clear();
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncular/tauri",
3
- "version": "0.55.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.55.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.55.0",
74
- "@syncular/server": "0.55.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
- /** Shut down the native core, release its keyring, then detach listeners. */
1234
- async close(): Promise<void> {
1235
- if (this.#closed) return;
1236
- const shutdown = this.#command('shutdown', {});
1237
- this.#closed = true;
1238
- try {
1239
- await shutdown;
1240
- } finally {
1241
- this.#unlisten?.();
1242
- this.#unlisten = undefined;
1243
- this.#invalidationListeners.clear();
1244
- this.#progress.clear();
1245
- this.#changeListeners.clear();
1246
- this.#diagnosticsListeners.clear();
1247
- this.#presenceListeners.clear();
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