@powersync/common 1.43.1 → 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.
@@ -6704,7 +6704,7 @@ function requireDist () {
6704
6704
 
6705
6705
  var distExports = requireDist();
6706
6706
 
6707
- var version = "1.43.1";
6707
+ var version = "1.44.0";
6708
6708
  var PACKAGE = {
6709
6709
  version: version};
6710
6710
 
@@ -7631,6 +7631,7 @@ const DEFAULT_STREAMING_SYNC_OPTIONS = {
7631
7631
  crudUploadThrottleMs: DEFAULT_CRUD_UPLOAD_THROTTLE_MS
7632
7632
  };
7633
7633
  const DEFAULT_STREAM_CONNECTION_OPTIONS = {
7634
+ appMetadata: {},
7634
7635
  connectionMethod: exports.SyncStreamConnectionMethod.WEB_SOCKET,
7635
7636
  clientImplementation: DEFAULT_SYNC_CLIENT_IMPLEMENTATION,
7636
7637
  fetchStrategy: exports.FetchStrategy.Buffered,
@@ -8009,6 +8010,11 @@ The next upload iteration will be delayed.`);
8009
8010
  ...DEFAULT_STREAM_CONNECTION_OPTIONS,
8010
8011
  ...(options ?? {})
8011
8012
  };
8013
+ // Validate app metadata
8014
+ const invalidMetadata = Object.entries(resolvedOptions.appMetadata).filter(([_, value]) => typeof value != 'string');
8015
+ if (invalidMetadata.length > 0) {
8016
+ throw new Error(`Invalid appMetadata provided. Only string values are allowed. Invalid values: ${invalidMetadata.map(([key, value]) => `${key}: ${value}`).join(', ')}`);
8017
+ }
8012
8018
  const clientImplementation = resolvedOptions.clientImplementation;
8013
8019
  this.updateSyncStatus({ clientImplementation });
8014
8020
  if (clientImplementation == exports.SyncClientImplementation.JAVASCRIPT) {
@@ -8044,6 +8050,7 @@ The next upload iteration will be delayed.`);
8044
8050
  include_checksum: true,
8045
8051
  raw_data: true,
8046
8052
  parameters: resolvedOptions.params,
8053
+ app_metadata: resolvedOptions.appMetadata,
8047
8054
  client_id: clientId
8048
8055
  }
8049
8056
  };
@@ -8403,6 +8410,7 @@ The next upload iteration will be delayed.`);
8403
8410
  try {
8404
8411
  const options = {
8405
8412
  parameters: resolvedOptions.params,
8413
+ app_metadata: resolvedOptions.appMetadata,
8406
8414
  active_streams: this.activeStreams,
8407
8415
  include_defaults: resolvedOptions.includeDefaultStreams
8408
8416
  };
@@ -9061,11 +9069,11 @@ class AbstractPowerSyncDatabase extends BaseObserver {
9061
9069
  .map((n) => parseInt(n));
9062
9070
  }
9063
9071
  catch (e) {
9064
- throw new Error(`Unsupported powersync extension version. Need >=0.4.5 <1.0.0, got: ${this.sdkVersion}. Details: ${e.message}`);
9072
+ throw new Error(`Unsupported powersync extension version. Need >=0.4.10 <1.0.0, got: ${this.sdkVersion}. Details: ${e.message}`);
9065
9073
  }
9066
- // Validate >=0.4.5 <1.0.0
9067
- if (versionInts[0] != 0 || versionInts[1] < 4 || (versionInts[1] == 4 && versionInts[2] < 5)) {
9068
- throw new Error(`Unsupported powersync extension version. Need >=0.4.5 <1.0.0, got: ${this.sdkVersion}`);
9074
+ // Validate >=0.4.10 <1.0.0
9075
+ if (versionInts[0] != 0 || versionInts[1] < 4 || (versionInts[1] == 4 && versionInts[2] < 10)) {
9076
+ throw new Error(`Unsupported powersync extension version. Need >=0.4.10 <1.0.0, got: ${this.sdkVersion}`);
9069
9077
  }
9070
9078
  }
9071
9079
  async resolveOfflineSyncStatus() {