@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.
@@ -6702,7 +6702,7 @@ function requireDist () {
6702
6702
 
6703
6703
  var distExports = requireDist();
6704
6704
 
6705
- var version = "1.43.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.5 <1.0.0, got: ${this.sdkVersion}. Details: ${e.message}`);
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.5 <1.0.0
9065
- if (versionInts[0] != 0 || versionInts[1] < 4 || (versionInts[1] == 4 && versionInts[2] < 5)) {
9066
- throw new Error(`Unsupported powersync extension version. Need >=0.4.5 <1.0.0, got: ${this.sdkVersion}`);
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() {