@syncular/tauri 0.30.12 → 0.30.13
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/README.md +43 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +12 -0
- package/package.json +4 -4
- package/src/index.ts +16 -0
package/README.md
CHANGED
|
@@ -103,6 +103,49 @@ Unchanged tables and their FTS projections stay untouched, so a catalogue's size
|
|
|
103
103
|
does not add a full-table copy to an unrelated edit. A schema reset or restart
|
|
104
104
|
can still rebuild the complete projection.
|
|
105
105
|
|
|
106
|
+
## Local activation with transport closed
|
|
107
|
+
|
|
108
|
+
Create with `transportEnabled: false` to open the replica without starting
|
|
109
|
+
network work. Keep `SyncularConfig.auto_sync: true`; the native owner continues
|
|
110
|
+
handling local reads and commits, and resumes its existing scheduler when the
|
|
111
|
+
gate opens. The gate is independent of security preflight and encryption keys.
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
const client = await createTauriSyncClient({
|
|
115
|
+
schema,
|
|
116
|
+
securityPreflight: true,
|
|
117
|
+
transportEnabled: false,
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// The app verifies its signed offline lease and device authentication first.
|
|
121
|
+
await client.activateSecurity({ encryption: acceptedKeyring });
|
|
122
|
+
// Authorized local queries and mutations now work; commits queue durably.
|
|
123
|
+
|
|
124
|
+
// After online authentication returns a fresh bearer:
|
|
125
|
+
await client.setHeaders({ authorization: `Bearer ${freshBearer}` });
|
|
126
|
+
await client.setTransportEnabled(true);
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`setTransportEnabled(false)` blocks new HTTP rounds, realtime connections,
|
|
130
|
+
presence sends and uncached blob downloads with `sync.offline`. Cached blob
|
|
131
|
+
reads and staged uploads remain local. `setOffline(true)` is the bridge's
|
|
132
|
+
browser-parity alias. Automatic sync and retry intents stay suspended; reopening
|
|
133
|
+
emits one interactive wake and queued commits flush in FIFO order with own pull.
|
|
134
|
+
Header replacement and security activation never reopen the gate.
|
|
135
|
+
|
|
136
|
+
An already-started round finishes its captured network exchange and atomic apply,
|
|
137
|
+
including acknowledgement and revocation checks. Closure does not cancel its
|
|
138
|
+
reply. The owner releases realtime after the round settles, drops unsent control
|
|
139
|
+
frames and starts no follow-up round while closed. Local commands remain available
|
|
140
|
+
while a delayed reply is pending. Security preflight still blocks protected local
|
|
141
|
+
access and invalidates the old authorization context.
|
|
142
|
+
|
|
143
|
+
The gate defaults open on each newly created client and is never stored in
|
|
144
|
+
SQLite. Pass `transportEnabled: false` on every secure offline cold start.
|
|
145
|
+
Repeated pause or resume calls are idempotent. The existing realtime supervisor
|
|
146
|
+
owns reconnect after resume; a closed gate refuses its connect attempts without
|
|
147
|
+
opening a socket.
|
|
148
|
+
|
|
106
149
|
## Secure preflight and native disposal
|
|
107
150
|
|
|
108
151
|
Create with `securityPreflight: true` when authentication, signed device
|
package/dist/index.d.ts
CHANGED
|
@@ -76,6 +76,8 @@ export interface TauriSyncClientConfig {
|
|
|
76
76
|
readonly encryption?: EncryptionKeyringConfig;
|
|
77
77
|
/** Open the native replica behind the fail-closed security gate. */
|
|
78
78
|
readonly securityPreflight?: boolean;
|
|
79
|
+
/** Open local storage with network transport closed until explicitly resumed. */
|
|
80
|
+
readonly transportEnabled?: boolean;
|
|
79
81
|
/**
|
|
80
82
|
* RFC 0005 previous-version context, forwarded to the native `create`. The
|
|
81
83
|
* Rust create handler must read this key to enable capture; while it does
|
|
@@ -140,6 +142,10 @@ export declare class TauriSyncClient implements PromiseMethods<ClientSnapshotMet
|
|
|
140
142
|
present: boolean;
|
|
141
143
|
discarded: boolean;
|
|
142
144
|
}>;
|
|
145
|
+
/** Suspend new network work while retaining local access and queued commits. */
|
|
146
|
+
setTransportEnabled(enabled: boolean): Promise<void>;
|
|
147
|
+
/** Browser offline-control parity; local reads and commits remain available. */
|
|
148
|
+
setOffline(offline: boolean): Promise<void>;
|
|
143
149
|
/**
|
|
144
150
|
* Replace the native transport's request headers at runtime — the auth
|
|
145
151
|
* rotation path. Pass the FULL header set (it replaces,
|
package/dist/index.js
CHANGED
|
@@ -166,6 +166,7 @@ export class TauriSyncClient {
|
|
|
166
166
|
'securityLifecycle',
|
|
167
167
|
'beginSecurityPreflight',
|
|
168
168
|
'activateSecurity',
|
|
169
|
+
'setTransportEnabled',
|
|
169
170
|
'purgeLocalData',
|
|
170
171
|
'previousVersionDiscard',
|
|
171
172
|
'localRevision',
|
|
@@ -432,6 +433,14 @@ export class TauriSyncClient {
|
|
|
432
433
|
async previousVersionDiscard() {
|
|
433
434
|
return decodePreviousVersionDiscardResult(await this.#command('previousVersionDiscard', {}));
|
|
434
435
|
}
|
|
436
|
+
/** Suspend new network work while retaining local access and queued commits. */
|
|
437
|
+
async setTransportEnabled(enabled) {
|
|
438
|
+
await this.#command('setTransportEnabled', { enabled });
|
|
439
|
+
}
|
|
440
|
+
/** Browser offline-control parity; local reads and commits remain available. */
|
|
441
|
+
async setOffline(offline) {
|
|
442
|
+
await this.setTransportEnabled(!offline);
|
|
443
|
+
}
|
|
435
444
|
/**
|
|
436
445
|
* Replace the native transport's request headers at runtime — the auth
|
|
437
446
|
* rotation path. Pass the FULL header set (it replaces,
|
|
@@ -731,6 +740,9 @@ export async function createTauriSyncClient(config) {
|
|
|
731
740
|
...(config.encryption !== undefined
|
|
732
741
|
? { encryption: encodeEncryption(config.encryption) }
|
|
733
742
|
: {}),
|
|
743
|
+
...(config.transportEnabled !== undefined
|
|
744
|
+
? { transportEnabled: config.transportEnabled }
|
|
745
|
+
: {}),
|
|
734
746
|
...(config.securityPreflight !== undefined
|
|
735
747
|
? { securityPreflight: config.securityPreflight }
|
|
736
748
|
: {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncular/tauri",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.13",
|
|
4
4
|
"description": "Tauri integration for the Syncular client",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Benjamin Kniffler",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"test": "bun test"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@syncular/client": "0.30.
|
|
51
|
+
"@syncular/client": "0.30.13"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@tauri-apps/api": ">=2.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@syncular/react": "0.30.
|
|
58
|
-
"@syncular/server": "0.30.
|
|
57
|
+
"@syncular/react": "0.30.13",
|
|
58
|
+
"@syncular/server": "0.30.13"
|
|
59
59
|
}
|
|
60
60
|
}
|
package/src/index.ts
CHANGED
|
@@ -141,6 +141,8 @@ export interface TauriSyncClientConfig {
|
|
|
141
141
|
readonly encryption?: EncryptionKeyringConfig;
|
|
142
142
|
/** Open the native replica behind the fail-closed security gate. */
|
|
143
143
|
readonly securityPreflight?: boolean;
|
|
144
|
+
/** Open local storage with network transport closed until explicitly resumed. */
|
|
145
|
+
readonly transportEnabled?: boolean;
|
|
144
146
|
/**
|
|
145
147
|
* RFC 0005 previous-version context, forwarded to the native `create`. The
|
|
146
148
|
* Rust create handler must read this key to enable capture; while it does
|
|
@@ -347,6 +349,7 @@ export class TauriSyncClient implements PromiseMethods<ClientSnapshotMethods> {
|
|
|
347
349
|
'securityLifecycle',
|
|
348
350
|
'beginSecurityPreflight',
|
|
349
351
|
'activateSecurity',
|
|
352
|
+
'setTransportEnabled',
|
|
350
353
|
'purgeLocalData',
|
|
351
354
|
'previousVersionDiscard',
|
|
352
355
|
'localRevision',
|
|
@@ -706,6 +709,16 @@ export class TauriSyncClient implements PromiseMethods<ClientSnapshotMethods> {
|
|
|
706
709
|
);
|
|
707
710
|
}
|
|
708
711
|
|
|
712
|
+
/** Suspend new network work while retaining local access and queued commits. */
|
|
713
|
+
async setTransportEnabled(enabled: boolean): Promise<void> {
|
|
714
|
+
await this.#command('setTransportEnabled', { enabled });
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/** Browser offline-control parity; local reads and commits remain available. */
|
|
718
|
+
async setOffline(offline: boolean): Promise<void> {
|
|
719
|
+
await this.setTransportEnabled(!offline);
|
|
720
|
+
}
|
|
721
|
+
|
|
709
722
|
/**
|
|
710
723
|
* Replace the native transport's request headers at runtime — the auth
|
|
711
724
|
* rotation path. Pass the FULL header set (it replaces,
|
|
@@ -1103,6 +1116,9 @@ export async function createTauriSyncClient(
|
|
|
1103
1116
|
...(config.encryption !== undefined
|
|
1104
1117
|
? { encryption: encodeEncryption(config.encryption) }
|
|
1105
1118
|
: {}),
|
|
1119
|
+
...(config.transportEnabled !== undefined
|
|
1120
|
+
? { transportEnabled: config.transportEnabled }
|
|
1121
|
+
: {}),
|
|
1106
1122
|
...(config.securityPreflight !== undefined
|
|
1107
1123
|
? { securityPreflight: config.securityPreflight }
|
|
1108
1124
|
: {}),
|