@powersync/common 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/bundle.cjs +20 -7
- package/dist/bundle.cjs.map +1 -1
- package/dist/bundle.mjs +20 -7
- package/dist/bundle.mjs.map +1 -1
- package/dist/bundle.node.cjs +20 -7
- package/dist/bundle.node.cjs.map +1 -1
- package/dist/bundle.node.mjs +20 -7
- package/dist/bundle.node.mjs.map +1 -1
- package/dist/index.d.cts +3 -11
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.d.ts +3 -0
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js +19 -0
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js.map +1 -1
- package/lib/db/crud/SyncStatus.d.ts +0 -4
- package/lib/db/crud/SyncStatus.js +0 -4
- package/lib/db/crud/SyncStatus.js.map +1 -1
- package/lib/db/schema/RawTable.d.ts +0 -5
- package/lib/db/schema/Schema.d.ts +0 -2
- package/lib/db/schema/Schema.js +0 -2
- package/lib/db/schema/Schema.js.map +1 -1
- package/package.json +1 -1
- package/src/client/sync/stream/AbstractStreamingSyncImplementation.ts +22 -8
- package/src/db/crud/SyncStatus.ts +0 -4
- package/src/db/schema/RawTable.ts +0 -5
- package/src/db/schema/Schema.ts +0 -2
package/dist/bundle.node.cjs
CHANGED
|
@@ -1979,16 +1979,12 @@ class SyncStatus {
|
|
|
1979
1979
|
*
|
|
1980
1980
|
* This returns null when the database is currently being opened and we don't have reliable information about all
|
|
1981
1981
|
* included streams yet.
|
|
1982
|
-
*
|
|
1983
|
-
* @experimental Sync streams are currently in alpha.
|
|
1984
1982
|
*/
|
|
1985
1983
|
get syncStreams() {
|
|
1986
1984
|
return this.options.dataFlow?.internalStreamSubscriptions?.map((core) => new SyncStreamStatusView(this, core));
|
|
1987
1985
|
}
|
|
1988
1986
|
/**
|
|
1989
1987
|
* If the `stream` appears in {@link syncStreams}, returns the current status for that stream.
|
|
1990
|
-
*
|
|
1991
|
-
* @experimental Sync streams are currently in alpha.
|
|
1992
1988
|
*/
|
|
1993
1989
|
forStream(stream) {
|
|
1994
1990
|
const asJson = JSON.stringify(stream.parameters);
|
|
@@ -8222,7 +8218,7 @@ function requireDist () {
|
|
|
8222
8218
|
|
|
8223
8219
|
var distExports = requireDist();
|
|
8224
8220
|
|
|
8225
|
-
var version = "1.
|
|
8221
|
+
var version = "1.52.0";
|
|
8226
8222
|
var PACKAGE = {
|
|
8227
8223
|
version: version};
|
|
8228
8224
|
|
|
@@ -9201,6 +9197,7 @@ class AbstractStreamingSyncImplementation extends BaseObserver {
|
|
|
9201
9197
|
streamingSyncPromise;
|
|
9202
9198
|
logger;
|
|
9203
9199
|
activeStreams;
|
|
9200
|
+
connectionMayHaveChanged = false;
|
|
9204
9201
|
isUploadingCrud = false;
|
|
9205
9202
|
notifyCompletedUploads;
|
|
9206
9203
|
handleActiveStreamsChange;
|
|
@@ -9480,6 +9477,11 @@ The next upload iteration will be delayed.`);
|
|
|
9480
9477
|
shouldDelayRetry = false;
|
|
9481
9478
|
// A disconnect was requested, we should not delay since there is no explicit retry
|
|
9482
9479
|
}
|
|
9480
|
+
else if (this.connectionMayHaveChanged && ex.message?.indexOf('No iteration is active') >= 0) {
|
|
9481
|
+
this.connectionMayHaveChanged = false;
|
|
9482
|
+
this.logger.info('Sync error after changed connection, retrying immediately');
|
|
9483
|
+
shouldDelayRetry = false;
|
|
9484
|
+
}
|
|
9483
9485
|
else {
|
|
9484
9486
|
this.logger.error(ex);
|
|
9485
9487
|
}
|
|
@@ -9510,6 +9512,15 @@ The next upload iteration will be delayed.`);
|
|
|
9510
9512
|
// Mark as disconnected if here
|
|
9511
9513
|
this.updateSyncStatus({ connected: false, connecting: false });
|
|
9512
9514
|
}
|
|
9515
|
+
markConnectionMayHaveChanged() {
|
|
9516
|
+
// By setting this field, we'll immediately retry if the next sync event causes an error triggered by us not having
|
|
9517
|
+
// an active sync iteration on the connection in use.
|
|
9518
|
+
this.connectionMayHaveChanged = true;
|
|
9519
|
+
// This triggers a `powersync_control` invocation if a sync iteration is currently active. This is a cheap call to
|
|
9520
|
+
// make when no subscriptions have actually changed, we're mainly interested in this immediately throwing if no
|
|
9521
|
+
// iteration is active. That allows us to reconnect ASAP, instead of having to wait for the next sync line.
|
|
9522
|
+
this.handleActiveStreamsChange?.();
|
|
9523
|
+
}
|
|
9513
9524
|
async collectLocalBucketState() {
|
|
9514
9525
|
const bucketEntries = await this.options.adapter.getBucketStates();
|
|
9515
9526
|
const req = bucketEntries.map((entry) => ({
|
|
@@ -9882,6 +9893,10 @@ The next upload iteration will be delayed.`);
|
|
|
9882
9893
|
const rawResponse = await adapter.control(op, payload ?? null);
|
|
9883
9894
|
const logger = syncImplementation.logger;
|
|
9884
9895
|
logger.trace('powersync_control', op, payload == null || typeof payload == 'string' ? payload : '<bytes>', rawResponse);
|
|
9896
|
+
if (op != exports.PowerSyncControlCommand.STOP) {
|
|
9897
|
+
// Evidently we have a working connection here, otherwise powersync_control would have failed.
|
|
9898
|
+
syncImplementation.connectionMayHaveChanged = false;
|
|
9899
|
+
}
|
|
9885
9900
|
await handleInstructions(JSON.parse(rawResponse));
|
|
9886
9901
|
}
|
|
9887
9902
|
async function handleInstruction(instruction) {
|
|
@@ -11951,10 +11966,8 @@ class Schema {
|
|
|
11951
11966
|
* developer instead of automatically by PowerSync.
|
|
11952
11967
|
* Since raw tables are not backed by JSON, running complex queries on them may be more efficient. Further, they allow
|
|
11953
11968
|
* using client-side table and column constraints.
|
|
11954
|
-
* Note that raw tables are only supported when using the new `SyncClientImplementation.rust` sync client.
|
|
11955
11969
|
*
|
|
11956
11970
|
* @param tables An object of (table name, raw table definition) entries.
|
|
11957
|
-
* @experimental Note that the raw tables API is still experimental and may change in the future.
|
|
11958
11971
|
*/
|
|
11959
11972
|
withRawTables(tables) {
|
|
11960
11973
|
for (const [name, rawTableDefinition] of Object.entries(tables)) {
|