@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.cjs
CHANGED
|
@@ -2131,16 +2131,12 @@ class SyncStatus {
|
|
|
2131
2131
|
*
|
|
2132
2132
|
* This returns null when the database is currently being opened and we don't have reliable information about all
|
|
2133
2133
|
* included streams yet.
|
|
2134
|
-
*
|
|
2135
|
-
* @experimental Sync streams are currently in alpha.
|
|
2136
2134
|
*/
|
|
2137
2135
|
get syncStreams() {
|
|
2138
2136
|
return this.options.dataFlow?.internalStreamSubscriptions?.map((core) => new SyncStreamStatusView(this, core));
|
|
2139
2137
|
}
|
|
2140
2138
|
/**
|
|
2141
2139
|
* If the `stream` appears in {@link syncStreams}, returns the current status for that stream.
|
|
2142
|
-
*
|
|
2143
|
-
* @experimental Sync streams are currently in alpha.
|
|
2144
2140
|
*/
|
|
2145
2141
|
forStream(stream) {
|
|
2146
2142
|
const asJson = JSON.stringify(stream.parameters);
|
|
@@ -10745,7 +10741,7 @@ function requireDist () {
|
|
|
10745
10741
|
|
|
10746
10742
|
var distExports = requireDist();
|
|
10747
10743
|
|
|
10748
|
-
var version = "1.
|
|
10744
|
+
var version = "1.52.0";
|
|
10749
10745
|
var PACKAGE = {
|
|
10750
10746
|
version: version};
|
|
10751
10747
|
|
|
@@ -11724,6 +11720,7 @@ class AbstractStreamingSyncImplementation extends BaseObserver {
|
|
|
11724
11720
|
streamingSyncPromise;
|
|
11725
11721
|
logger;
|
|
11726
11722
|
activeStreams;
|
|
11723
|
+
connectionMayHaveChanged = false;
|
|
11727
11724
|
isUploadingCrud = false;
|
|
11728
11725
|
notifyCompletedUploads;
|
|
11729
11726
|
handleActiveStreamsChange;
|
|
@@ -12003,6 +12000,11 @@ The next upload iteration will be delayed.`);
|
|
|
12003
12000
|
shouldDelayRetry = false;
|
|
12004
12001
|
// A disconnect was requested, we should not delay since there is no explicit retry
|
|
12005
12002
|
}
|
|
12003
|
+
else if (this.connectionMayHaveChanged && ex.message?.indexOf('No iteration is active') >= 0) {
|
|
12004
|
+
this.connectionMayHaveChanged = false;
|
|
12005
|
+
this.logger.info('Sync error after changed connection, retrying immediately');
|
|
12006
|
+
shouldDelayRetry = false;
|
|
12007
|
+
}
|
|
12006
12008
|
else {
|
|
12007
12009
|
this.logger.error(ex);
|
|
12008
12010
|
}
|
|
@@ -12033,6 +12035,15 @@ The next upload iteration will be delayed.`);
|
|
|
12033
12035
|
// Mark as disconnected if here
|
|
12034
12036
|
this.updateSyncStatus({ connected: false, connecting: false });
|
|
12035
12037
|
}
|
|
12038
|
+
markConnectionMayHaveChanged() {
|
|
12039
|
+
// By setting this field, we'll immediately retry if the next sync event causes an error triggered by us not having
|
|
12040
|
+
// an active sync iteration on the connection in use.
|
|
12041
|
+
this.connectionMayHaveChanged = true;
|
|
12042
|
+
// This triggers a `powersync_control` invocation if a sync iteration is currently active. This is a cheap call to
|
|
12043
|
+
// make when no subscriptions have actually changed, we're mainly interested in this immediately throwing if no
|
|
12044
|
+
// iteration is active. That allows us to reconnect ASAP, instead of having to wait for the next sync line.
|
|
12045
|
+
this.handleActiveStreamsChange?.();
|
|
12046
|
+
}
|
|
12036
12047
|
async collectLocalBucketState() {
|
|
12037
12048
|
const bucketEntries = await this.options.adapter.getBucketStates();
|
|
12038
12049
|
const req = bucketEntries.map((entry) => ({
|
|
@@ -12405,6 +12416,10 @@ The next upload iteration will be delayed.`);
|
|
|
12405
12416
|
const rawResponse = await adapter.control(op, payload ?? null);
|
|
12406
12417
|
const logger = syncImplementation.logger;
|
|
12407
12418
|
logger.trace('powersync_control', op, payload == null || typeof payload == 'string' ? payload : '<bytes>', rawResponse);
|
|
12419
|
+
if (op != exports.PowerSyncControlCommand.STOP) {
|
|
12420
|
+
// Evidently we have a working connection here, otherwise powersync_control would have failed.
|
|
12421
|
+
syncImplementation.connectionMayHaveChanged = false;
|
|
12422
|
+
}
|
|
12408
12423
|
await handleInstructions(JSON.parse(rawResponse));
|
|
12409
12424
|
}
|
|
12410
12425
|
async function handleInstruction(instruction) {
|
|
@@ -14474,10 +14489,8 @@ class Schema {
|
|
|
14474
14489
|
* developer instead of automatically by PowerSync.
|
|
14475
14490
|
* Since raw tables are not backed by JSON, running complex queries on them may be more efficient. Further, they allow
|
|
14476
14491
|
* using client-side table and column constraints.
|
|
14477
|
-
* Note that raw tables are only supported when using the new `SyncClientImplementation.rust` sync client.
|
|
14478
14492
|
*
|
|
14479
14493
|
* @param tables An object of (table name, raw table definition) entries.
|
|
14480
|
-
* @experimental Note that the raw tables API is still experimental and may change in the future.
|
|
14481
14494
|
*/
|
|
14482
14495
|
withRawTables(tables) {
|
|
14483
14496
|
for (const [name, rawTableDefinition] of Object.entries(tables)) {
|