@powersync/web 1.38.4 → 1.38.5

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.
@@ -5028,11 +5028,7 @@ class SyncStatus {
5028
5028
  */
5029
5029
  const replacer = (_, value) => {
5030
5030
  if (value instanceof Error) {
5031
- return {
5032
- name: value.name,
5033
- message: value.message,
5034
- stack: value.stack
5035
- };
5031
+ return this.serializeError(value);
5036
5032
  }
5037
5033
  return value;
5038
5034
  };
@@ -5075,11 +5071,18 @@ class SyncStatus {
5075
5071
  if (typeof error == 'undefined') {
5076
5072
  return undefined;
5077
5073
  }
5078
- return {
5074
+ const serialized = {
5079
5075
  name: error.name,
5080
5076
  message: error.message,
5081
5077
  stack: error.stack
5082
5078
  };
5079
+ // `Error.cause` can be any value (the spec types it as unknown). Preserve it
5080
+ // so consumers reading uploadError/downloadError keep the failure context.
5081
+ // Recurse for Error causes so the whole chain is flattened the same way.
5082
+ if (typeof error.cause != 'undefined') {
5083
+ serialized.cause = error.cause instanceof Error ? this.serializeError(error.cause) : error.cause;
5084
+ }
5085
+ return serialized;
5083
5086
  }
5084
5087
  static comparePriorities(a, b) {
5085
5088
  return b.priority - a.priority; // Reverse because higher priorities have lower numbers
@@ -13804,7 +13807,7 @@ function requireDist () {
13804
13807
 
13805
13808
  var distExports = requireDist();
13806
13809
 
13807
- var version = "1.55.0";
13810
+ var version = "1.56.0";
13808
13811
  var PACKAGE = {
13809
13812
  version: version};
13810
13813
 
@@ -15935,7 +15938,7 @@ class AbstractPowerSyncDatabase extends BaseObserver {
15935
15938
  this.logger.warn('Schema validation failed. Unexpected behaviour could occur', ex);
15936
15939
  }
15937
15940
  this._schema = schema;
15938
- await this.database.execute('SELECT powersync_replace_schema(?)', [JSON.stringify(this.schema.toJSON())]);
15941
+ await this.database.writeTransaction((tx) => tx.execute('SELECT powersync_replace_schema(?)', [JSON.stringify(this.schema.toJSON())]));
15939
15942
  await this.database.refreshSchema();
15940
15943
  this.iterateListeners(async (cb) => cb.schemaChanged?.(schema));
15941
15944
  }