@powersync/web 0.0.0-dev-20260414110516 → 0.0.0-dev-20260503073249
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/2075a31bb151adbb9767.wasm +0 -0
- package/dist/3322bc84de986b63c2cd.wasm +0 -0
- package/dist/8e97452e297be23b5e50.wasm +0 -0
- package/dist/fbc178b70d530e8ce02b.wasm +0 -0
- package/dist/index.umd.js +4323 -156
- package/dist/index.umd.js.map +1 -1
- package/dist/worker/SharedSyncImplementation.umd.js +24 -15
- package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
- package/dist/worker/WASQLiteDB.umd.js +86 -78
- package/dist/worker/WASQLiteDB.umd.js.map +1 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-9af0a7.umd.js +31 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-9af0a7.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-bbf5a9.umd.js +31 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-bbf5a9.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-c26e0f.umd.js +31 -0
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-cc5fcc.umd.js.map → node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-c26e0f.umd.js.map} +1 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js +31 -0
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js.map → node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js.map} +1 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-2fb422.umd.js +3562 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-2fb422.umd.js.map +1 -0
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_src_examples-0df390.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-96fb23.umd.js} +16 -16
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_src_examples-0df390.umd.js.map → node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-96fb23.umd.js.map} +1 -1
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_src_examples-151024.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-c89911.umd.js} +12 -12
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_src_examples-151024.umd.js.map → node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-c89911.umd.js.map} +1 -1
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_src_examples-c01ef0.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-ec4eb1.umd.js} +14 -14
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_src_examples-c01ef0.umd.js.map → node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-ec4eb1.umd.js.map} +1 -1
- package/lib/package.json +3 -3
- package/lib/src/db/PowerSyncDatabase.d.ts +1 -1
- package/lib/src/db/PowerSyncDatabase.js +0 -8
- package/lib/src/db/adapters/AsyncWebAdapter.d.ts +13 -3
- package/lib/src/db/adapters/AsyncWebAdapter.js +115 -21
- package/lib/src/db/adapters/wa-sqlite/DatabaseServer.js +1 -2
- package/lib/src/db/adapters/wa-sqlite/RawSqliteConnection.js +1 -1
- package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.d.ts +16 -2
- package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.js +60 -38
- package/lib/src/db/adapters/wa-sqlite/vfs.d.ts +7 -18
- package/lib/src/db/adapters/wa-sqlite/vfs.js +34 -49
- package/lib/src/db/sync/SSRWebStreamingSyncImplementation.d.ts +4 -0
- package/lib/src/db/sync/SSRWebStreamingSyncImplementation.js +4 -0
- package/lib/src/worker/db/MultiDatabaseServer.js +4 -1
- package/lib/src/worker/db/open-worker-database.js +2 -2
- package/lib/src/worker/sync/SharedSyncImplementation.js +4 -8
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/db/PowerSyncDatabase.ts +1 -9
- package/src/db/adapters/AsyncWebAdapter.ts +138 -22
- package/src/db/adapters/wa-sqlite/DatabaseServer.ts +4 -2
- package/src/db/adapters/wa-sqlite/RawSqliteConnection.ts +4 -1
- package/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.ts +89 -44
- package/src/db/adapters/wa-sqlite/vfs.ts +33 -49
- package/src/db/sync/SSRWebStreamingSyncImplementation.ts +5 -0
- package/src/worker/db/MultiDatabaseServer.ts +4 -1
- package/src/worker/db/open-worker-database.ts +2 -2
- package/src/worker/sync/SharedSyncImplementation.ts +4 -8
- package/dist/26d61ca9f5694d064635.wasm +0 -0
- package/dist/b4c6283dc473b6b3fd24.wasm +0 -0
- package/dist/c78985091a0b22aaef03.wasm +0 -0
- package/dist/ca59e199e1138b553fad.wasm +0 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-b9c070.umd.js +0 -31
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-b9c070.umd.js.map +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-c99c07.umd.js +0 -31
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-c99c07.umd.js.map +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-cc5fcc.umd.js +0 -31
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js +0 -31
|
@@ -1490,14 +1490,10 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
1490
1490
|
// We can poke the crud in case we missed any updates.
|
|
1491
1491
|
const impl = sharedSync.connectionManager.syncStreamImplementation;
|
|
1492
1492
|
impl?.triggerCrudUpload();
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
* StreamingSyncImplementation to reconnect. It would be nicer if we could trigger
|
|
1498
|
-
* this reconnect earlier.
|
|
1499
|
-
* This reconnect is not required for IndexedDB.
|
|
1500
|
-
*/
|
|
1493
|
+
// The Rust client implementation stores sync state on the connection level. Reopening the database causes a
|
|
1494
|
+
// disruption of the connection state and forces us to reconnect. We want to do that as soon as possible to
|
|
1495
|
+
// minimize downtime.
|
|
1496
|
+
impl?.markConnectionMayHaveChanged();
|
|
1501
1497
|
}
|
|
1502
1498
|
}
|
|
1503
1499
|
async readLock(fn, options) {
|
|
@@ -3904,16 +3900,12 @@ class SyncStatus {
|
|
|
3904
3900
|
*
|
|
3905
3901
|
* This returns null when the database is currently being opened and we don't have reliable information about all
|
|
3906
3902
|
* included streams yet.
|
|
3907
|
-
*
|
|
3908
|
-
* @experimental Sync streams are currently in alpha.
|
|
3909
3903
|
*/
|
|
3910
3904
|
get syncStreams() {
|
|
3911
3905
|
return this.options.dataFlow?.internalStreamSubscriptions?.map((core) => new SyncStreamStatusView(this, core));
|
|
3912
3906
|
}
|
|
3913
3907
|
/**
|
|
3914
3908
|
* If the `stream` appears in {@link syncStreams}, returns the current status for that stream.
|
|
3915
|
-
*
|
|
3916
|
-
* @experimental Sync streams are currently in alpha.
|
|
3917
3909
|
*/
|
|
3918
3910
|
forStream(stream) {
|
|
3919
3911
|
const asJson = JSON.stringify(stream.parameters);
|
|
@@ -12518,7 +12510,7 @@ function requireDist () {
|
|
|
12518
12510
|
|
|
12519
12511
|
var distExports = requireDist();
|
|
12520
12512
|
|
|
12521
|
-
var version = "1.
|
|
12513
|
+
var version = "1.52.0";
|
|
12522
12514
|
var PACKAGE = {
|
|
12523
12515
|
version: version};
|
|
12524
12516
|
|
|
@@ -13497,6 +13489,7 @@ class AbstractStreamingSyncImplementation extends BaseObserver {
|
|
|
13497
13489
|
streamingSyncPromise;
|
|
13498
13490
|
logger;
|
|
13499
13491
|
activeStreams;
|
|
13492
|
+
connectionMayHaveChanged = false;
|
|
13500
13493
|
isUploadingCrud = false;
|
|
13501
13494
|
notifyCompletedUploads;
|
|
13502
13495
|
handleActiveStreamsChange;
|
|
@@ -13776,6 +13769,11 @@ The next upload iteration will be delayed.`);
|
|
|
13776
13769
|
shouldDelayRetry = false;
|
|
13777
13770
|
// A disconnect was requested, we should not delay since there is no explicit retry
|
|
13778
13771
|
}
|
|
13772
|
+
else if (this.connectionMayHaveChanged && ex.message?.indexOf('No iteration is active') >= 0) {
|
|
13773
|
+
this.connectionMayHaveChanged = false;
|
|
13774
|
+
this.logger.info('Sync error after changed connection, retrying immediately');
|
|
13775
|
+
shouldDelayRetry = false;
|
|
13776
|
+
}
|
|
13779
13777
|
else {
|
|
13780
13778
|
this.logger.error(ex);
|
|
13781
13779
|
}
|
|
@@ -13806,6 +13804,15 @@ The next upload iteration will be delayed.`);
|
|
|
13806
13804
|
// Mark as disconnected if here
|
|
13807
13805
|
this.updateSyncStatus({ connected: false, connecting: false });
|
|
13808
13806
|
}
|
|
13807
|
+
markConnectionMayHaveChanged() {
|
|
13808
|
+
// By setting this field, we'll immediately retry if the next sync event causes an error triggered by us not having
|
|
13809
|
+
// an active sync iteration on the connection in use.
|
|
13810
|
+
this.connectionMayHaveChanged = true;
|
|
13811
|
+
// This triggers a `powersync_control` invocation if a sync iteration is currently active. This is a cheap call to
|
|
13812
|
+
// make when no subscriptions have actually changed, we're mainly interested in this immediately throwing if no
|
|
13813
|
+
// iteration is active. That allows us to reconnect ASAP, instead of having to wait for the next sync line.
|
|
13814
|
+
this.handleActiveStreamsChange?.();
|
|
13815
|
+
}
|
|
13809
13816
|
async collectLocalBucketState() {
|
|
13810
13817
|
const bucketEntries = await this.options.adapter.getBucketStates();
|
|
13811
13818
|
const req = bucketEntries.map((entry) => ({
|
|
@@ -14178,6 +14185,10 @@ The next upload iteration will be delayed.`);
|
|
|
14178
14185
|
const rawResponse = await adapter.control(op, payload ?? null);
|
|
14179
14186
|
const logger = syncImplementation.logger;
|
|
14180
14187
|
logger.trace('powersync_control', op, payload == null || typeof payload == 'string' ? payload : '<bytes>', rawResponse);
|
|
14188
|
+
if (op != PowerSyncControlCommand.STOP) {
|
|
14189
|
+
// Evidently we have a working connection here, otherwise powersync_control would have failed.
|
|
14190
|
+
syncImplementation.connectionMayHaveChanged = false;
|
|
14191
|
+
}
|
|
14181
14192
|
await handleInstructions(JSON.parse(rawResponse));
|
|
14182
14193
|
}
|
|
14183
14194
|
async function handleInstruction(instruction) {
|
|
@@ -16247,10 +16258,8 @@ class Schema {
|
|
|
16247
16258
|
* developer instead of automatically by PowerSync.
|
|
16248
16259
|
* Since raw tables are not backed by JSON, running complex queries on them may be more efficient. Further, they allow
|
|
16249
16260
|
* using client-side table and column constraints.
|
|
16250
|
-
* Note that raw tables are only supported when using the new `SyncClientImplementation.rust` sync client.
|
|
16251
16261
|
*
|
|
16252
16262
|
* @param tables An object of (table name, raw table definition) entries.
|
|
16253
|
-
* @experimental Note that the raw tables API is still experimental and may change in the future.
|
|
16254
16263
|
*/
|
|
16255
16264
|
withRawTables(tables) {
|
|
16256
16265
|
for (const [name, rawTableDefinition] of Object.entries(tables)) {
|