@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.
package/dist/bundle.cjs CHANGED
@@ -11055,7 +11055,7 @@ function requireDist () {
11055
11055
 
11056
11056
  var distExports = requireDist();
11057
11057
 
11058
- var version = "1.43.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.5 <1.0.0, got: ${this.sdkVersion}. Details: ${e.message}`);
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.5 <1.0.0
13418
- if (versionInts[0] != 0 || versionInts[1] < 4 || (versionInts[1] == 4 && versionInts[2] < 5)) {
13419
- throw new Error(`Unsupported powersync extension version. Need >=0.4.5 <1.0.0, got: ${this.sdkVersion}`);
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() {