@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.node.mjs
CHANGED
|
@@ -6702,7 +6702,7 @@ function requireDist () {
|
|
|
6702
6702
|
|
|
6703
6703
|
var distExports = requireDist();
|
|
6704
6704
|
|
|
6705
|
-
var version = "1.
|
|
6705
|
+
var version = "1.44.0";
|
|
6706
6706
|
var PACKAGE = {
|
|
6707
6707
|
version: version};
|
|
6708
6708
|
|
|
@@ -7629,6 +7629,7 @@ const DEFAULT_STREAMING_SYNC_OPTIONS = {
|
|
|
7629
7629
|
crudUploadThrottleMs: DEFAULT_CRUD_UPLOAD_THROTTLE_MS
|
|
7630
7630
|
};
|
|
7631
7631
|
const DEFAULT_STREAM_CONNECTION_OPTIONS = {
|
|
7632
|
+
appMetadata: {},
|
|
7632
7633
|
connectionMethod: SyncStreamConnectionMethod.WEB_SOCKET,
|
|
7633
7634
|
clientImplementation: DEFAULT_SYNC_CLIENT_IMPLEMENTATION,
|
|
7634
7635
|
fetchStrategy: FetchStrategy.Buffered,
|
|
@@ -8007,6 +8008,11 @@ The next upload iteration will be delayed.`);
|
|
|
8007
8008
|
...DEFAULT_STREAM_CONNECTION_OPTIONS,
|
|
8008
8009
|
...(options ?? {})
|
|
8009
8010
|
};
|
|
8011
|
+
// Validate app metadata
|
|
8012
|
+
const invalidMetadata = Object.entries(resolvedOptions.appMetadata).filter(([_, value]) => typeof value != 'string');
|
|
8013
|
+
if (invalidMetadata.length > 0) {
|
|
8014
|
+
throw new Error(`Invalid appMetadata provided. Only string values are allowed. Invalid values: ${invalidMetadata.map(([key, value]) => `${key}: ${value}`).join(', ')}`);
|
|
8015
|
+
}
|
|
8010
8016
|
const clientImplementation = resolvedOptions.clientImplementation;
|
|
8011
8017
|
this.updateSyncStatus({ clientImplementation });
|
|
8012
8018
|
if (clientImplementation == SyncClientImplementation.JAVASCRIPT) {
|
|
@@ -8042,6 +8048,7 @@ The next upload iteration will be delayed.`);
|
|
|
8042
8048
|
include_checksum: true,
|
|
8043
8049
|
raw_data: true,
|
|
8044
8050
|
parameters: resolvedOptions.params,
|
|
8051
|
+
app_metadata: resolvedOptions.appMetadata,
|
|
8045
8052
|
client_id: clientId
|
|
8046
8053
|
}
|
|
8047
8054
|
};
|
|
@@ -8401,6 +8408,7 @@ The next upload iteration will be delayed.`);
|
|
|
8401
8408
|
try {
|
|
8402
8409
|
const options = {
|
|
8403
8410
|
parameters: resolvedOptions.params,
|
|
8411
|
+
app_metadata: resolvedOptions.appMetadata,
|
|
8404
8412
|
active_streams: this.activeStreams,
|
|
8405
8413
|
include_defaults: resolvedOptions.includeDefaultStreams
|
|
8406
8414
|
};
|
|
@@ -9059,11 +9067,11 @@ class AbstractPowerSyncDatabase extends BaseObserver {
|
|
|
9059
9067
|
.map((n) => parseInt(n));
|
|
9060
9068
|
}
|
|
9061
9069
|
catch (e) {
|
|
9062
|
-
throw new Error(`Unsupported powersync extension version. Need >=0.4.
|
|
9070
|
+
throw new Error(`Unsupported powersync extension version. Need >=0.4.10 <1.0.0, got: ${this.sdkVersion}. Details: ${e.message}`);
|
|
9063
9071
|
}
|
|
9064
|
-
// Validate >=0.4.
|
|
9065
|
-
if (versionInts[0] != 0 || versionInts[1] < 4 || (versionInts[1] == 4 && versionInts[2] <
|
|
9066
|
-
throw new Error(`Unsupported powersync extension version. Need >=0.4.
|
|
9072
|
+
// Validate >=0.4.10 <1.0.0
|
|
9073
|
+
if (versionInts[0] != 0 || versionInts[1] < 4 || (versionInts[1] == 4 && versionInts[2] < 10)) {
|
|
9074
|
+
throw new Error(`Unsupported powersync extension version. Need >=0.4.10 <1.0.0, got: ${this.sdkVersion}`);
|
|
9067
9075
|
}
|
|
9068
9076
|
}
|
|
9069
9077
|
async resolveOfflineSyncStatus() {
|
|
@@ -10055,7 +10063,7 @@ class SqliteBucketStorage extends BaseObserver {
|
|
|
10055
10063
|
// Nothing to update
|
|
10056
10064
|
return false;
|
|
10057
10065
|
}
|
|
10058
|
-
const rs = await this.db.getAll("SELECT seq FROM sqlite_sequence WHERE name = 'ps_crud'");
|
|
10066
|
+
const rs = await this.db.getAll("SELECT seq FROM main.sqlite_sequence WHERE name = 'ps_crud'");
|
|
10059
10067
|
if (!rs.length) {
|
|
10060
10068
|
// Nothing to update
|
|
10061
10069
|
return false;
|
|
@@ -10069,7 +10077,7 @@ class SqliteBucketStorage extends BaseObserver {
|
|
|
10069
10077
|
this.logger.debug(`New data uploaded since write checkpoint ${opId} - need new write checkpoint`);
|
|
10070
10078
|
return false;
|
|
10071
10079
|
}
|
|
10072
|
-
const rs = await tx.execute("SELECT seq FROM sqlite_sequence WHERE name = 'ps_crud'");
|
|
10080
|
+
const rs = await tx.execute("SELECT seq FROM main.sqlite_sequence WHERE name = 'ps_crud'");
|
|
10073
10081
|
if (!rs.rows?.length) {
|
|
10074
10082
|
// assert isNotEmpty
|
|
10075
10083
|
throw new Error('SQLite Sequence should not be empty');
|