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