@powersync/common 1.43.0 → 1.44.0
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 +15 -7
- package/dist/bundle.cjs.map +1 -1
- package/dist/bundle.mjs +15 -7
- package/dist/bundle.mjs.map +1 -1
- package/dist/bundle.node.cjs +15 -7
- package/dist/bundle.node.cjs.map +1 -1
- package/dist/bundle.node.mjs +15 -7
- package/dist/bundle.node.mjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/lib/client/AbstractPowerSyncDatabase.d.ts +1 -1
- package/lib/client/AbstractPowerSyncDatabase.js +5 -5
- package/lib/client/AbstractPowerSyncDatabase.js.map +1 -1
- package/lib/client/sync/bucket/SqliteBucketStorage.js +2 -2
- package/lib/client/sync/bucket/SqliteBucketStorage.js.map +1 -1
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.d.ts +4 -0
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js +8 -0
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js.map +1 -1
- package/lib/client/sync/stream/streaming-sync-types.d.ts +4 -0
- package/lib/client/sync/stream/streaming-sync-types.js.map +1 -1
- package/package.json +1 -1
- package/src/client/AbstractPowerSyncDatabase.ts +8 -8
- package/src/client/sync/bucket/SqliteBucketStorage.ts +2 -2
- package/src/client/sync/stream/AbstractStreamingSyncImplementation.ts +19 -1
- package/src/client/sync/stream/streaming-sync-types.ts +5 -0
package/dist/bundle.cjs
CHANGED
|
@@ -11055,7 +11055,7 @@ function requireDist () {
|
|
|
11055
11055
|
|
|
11056
11056
|
var distExports = requireDist();
|
|
11057
11057
|
|
|
11058
|
-
var version = "1.
|
|
11058
|
+
var version = "1.44.0";
|
|
11059
11059
|
var PACKAGE = {
|
|
11060
11060
|
version: version};
|
|
11061
11061
|
|
|
@@ -11982,6 +11982,7 @@ const DEFAULT_STREAMING_SYNC_OPTIONS = {
|
|
|
11982
11982
|
crudUploadThrottleMs: DEFAULT_CRUD_UPLOAD_THROTTLE_MS
|
|
11983
11983
|
};
|
|
11984
11984
|
const DEFAULT_STREAM_CONNECTION_OPTIONS = {
|
|
11985
|
+
appMetadata: {},
|
|
11985
11986
|
connectionMethod: exports.SyncStreamConnectionMethod.WEB_SOCKET,
|
|
11986
11987
|
clientImplementation: DEFAULT_SYNC_CLIENT_IMPLEMENTATION,
|
|
11987
11988
|
fetchStrategy: exports.FetchStrategy.Buffered,
|
|
@@ -12360,6 +12361,11 @@ The next upload iteration will be delayed.`);
|
|
|
12360
12361
|
...DEFAULT_STREAM_CONNECTION_OPTIONS,
|
|
12361
12362
|
...(options ?? {})
|
|
12362
12363
|
};
|
|
12364
|
+
// Validate app metadata
|
|
12365
|
+
const invalidMetadata = Object.entries(resolvedOptions.appMetadata).filter(([_, value]) => typeof value != 'string');
|
|
12366
|
+
if (invalidMetadata.length > 0) {
|
|
12367
|
+
throw new Error(`Invalid appMetadata provided. Only string values are allowed. Invalid values: ${invalidMetadata.map(([key, value]) => `${key}: ${value}`).join(', ')}`);
|
|
12368
|
+
}
|
|
12363
12369
|
const clientImplementation = resolvedOptions.clientImplementation;
|
|
12364
12370
|
this.updateSyncStatus({ clientImplementation });
|
|
12365
12371
|
if (clientImplementation == exports.SyncClientImplementation.JAVASCRIPT) {
|
|
@@ -12395,6 +12401,7 @@ The next upload iteration will be delayed.`);
|
|
|
12395
12401
|
include_checksum: true,
|
|
12396
12402
|
raw_data: true,
|
|
12397
12403
|
parameters: resolvedOptions.params,
|
|
12404
|
+
app_metadata: resolvedOptions.appMetadata,
|
|
12398
12405
|
client_id: clientId
|
|
12399
12406
|
}
|
|
12400
12407
|
};
|
|
@@ -12754,6 +12761,7 @@ The next upload iteration will be delayed.`);
|
|
|
12754
12761
|
try {
|
|
12755
12762
|
const options = {
|
|
12756
12763
|
parameters: resolvedOptions.params,
|
|
12764
|
+
app_metadata: resolvedOptions.appMetadata,
|
|
12757
12765
|
active_streams: this.activeStreams,
|
|
12758
12766
|
include_defaults: resolvedOptions.includeDefaultStreams
|
|
12759
12767
|
};
|
|
@@ -13412,11 +13420,11 @@ class AbstractPowerSyncDatabase extends BaseObserver {
|
|
|
13412
13420
|
.map((n) => parseInt(n));
|
|
13413
13421
|
}
|
|
13414
13422
|
catch (e) {
|
|
13415
|
-
throw new Error(`Unsupported powersync extension version. Need >=0.4.
|
|
13423
|
+
throw new Error(`Unsupported powersync extension version. Need >=0.4.10 <1.0.0, got: ${this.sdkVersion}. Details: ${e.message}`);
|
|
13416
13424
|
}
|
|
13417
|
-
// Validate >=0.4.
|
|
13418
|
-
if (versionInts[0] != 0 || versionInts[1] < 4 || (versionInts[1] == 4 && versionInts[2] <
|
|
13419
|
-
throw new Error(`Unsupported powersync extension version. Need >=0.4.
|
|
13425
|
+
// Validate >=0.4.10 <1.0.0
|
|
13426
|
+
if (versionInts[0] != 0 || versionInts[1] < 4 || (versionInts[1] == 4 && versionInts[2] < 10)) {
|
|
13427
|
+
throw new Error(`Unsupported powersync extension version. Need >=0.4.10 <1.0.0, got: ${this.sdkVersion}`);
|
|
13420
13428
|
}
|
|
13421
13429
|
}
|
|
13422
13430
|
async resolveOfflineSyncStatus() {
|
|
@@ -14408,7 +14416,7 @@ class SqliteBucketStorage extends BaseObserver {
|
|
|
14408
14416
|
// Nothing to update
|
|
14409
14417
|
return false;
|
|
14410
14418
|
}
|
|
14411
|
-
const rs = await this.db.getAll("SELECT seq FROM sqlite_sequence WHERE name = 'ps_crud'");
|
|
14419
|
+
const rs = await this.db.getAll("SELECT seq FROM main.sqlite_sequence WHERE name = 'ps_crud'");
|
|
14412
14420
|
if (!rs.length) {
|
|
14413
14421
|
// Nothing to update
|
|
14414
14422
|
return false;
|
|
@@ -14422,7 +14430,7 @@ class SqliteBucketStorage extends BaseObserver {
|
|
|
14422
14430
|
this.logger.debug(`New data uploaded since write checkpoint ${opId} - need new write checkpoint`);
|
|
14423
14431
|
return false;
|
|
14424
14432
|
}
|
|
14425
|
-
const rs = await tx.execute("SELECT seq FROM sqlite_sequence WHERE name = 'ps_crud'");
|
|
14433
|
+
const rs = await tx.execute("SELECT seq FROM main.sqlite_sequence WHERE name = 'ps_crud'");
|
|
14426
14434
|
if (!rs.rows?.length) {
|
|
14427
14435
|
// assert isNotEmpty
|
|
14428
14436
|
throw new Error('SQLite Sequence should not be empty');
|