@powersync/common 1.55.0 → 1.56.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 +11 -8
- package/dist/bundle.cjs.map +1 -1
- package/dist/bundle.mjs +11 -8
- package/dist/bundle.mjs.map +1 -1
- package/dist/bundle.node.cjs +11 -8
- package/dist/bundle.node.cjs.map +1 -1
- package/dist/bundle.node.mjs +11 -8
- package/dist/bundle.node.mjs.map +1 -1
- package/dist/index.d.cts +1 -5
- package/lib/client/AbstractPowerSyncDatabase.js +1 -1
- package/lib/client/AbstractPowerSyncDatabase.js.map +1 -1
- package/lib/db/crud/SyncStatus.d.ts +1 -5
- package/lib/db/crud/SyncStatus.js +9 -6
- package/lib/db/crud/SyncStatus.js.map +1 -1
- package/package.json +1 -1
- package/src/client/AbstractPowerSyncDatabase.ts +3 -1
- package/src/db/crud/SyncStatus.ts +10 -7
package/dist/bundle.node.mjs
CHANGED
|
@@ -2137,11 +2137,7 @@ class SyncStatus {
|
|
|
2137
2137
|
*/
|
|
2138
2138
|
const replacer = (_, value) => {
|
|
2139
2139
|
if (value instanceof Error) {
|
|
2140
|
-
return
|
|
2141
|
-
name: value.name,
|
|
2142
|
-
message: value.message,
|
|
2143
|
-
stack: value.stack
|
|
2144
|
-
};
|
|
2140
|
+
return this.serializeError(value);
|
|
2145
2141
|
}
|
|
2146
2142
|
return value;
|
|
2147
2143
|
};
|
|
@@ -2184,11 +2180,18 @@ class SyncStatus {
|
|
|
2184
2180
|
if (typeof error == 'undefined') {
|
|
2185
2181
|
return undefined;
|
|
2186
2182
|
}
|
|
2187
|
-
|
|
2183
|
+
const serialized = {
|
|
2188
2184
|
name: error.name,
|
|
2189
2185
|
message: error.message,
|
|
2190
2186
|
stack: error.stack
|
|
2191
2187
|
};
|
|
2188
|
+
// `Error.cause` can be any value (the spec types it as unknown). Preserve it
|
|
2189
|
+
// so consumers reading uploadError/downloadError keep the failure context.
|
|
2190
|
+
// Recurse for Error causes so the whole chain is flattened the same way.
|
|
2191
|
+
if (typeof error.cause != 'undefined') {
|
|
2192
|
+
serialized.cause = error.cause instanceof Error ? this.serializeError(error.cause) : error.cause;
|
|
2193
|
+
}
|
|
2194
|
+
return serialized;
|
|
2192
2195
|
}
|
|
2193
2196
|
static comparePriorities(a, b) {
|
|
2194
2197
|
return b.priority - a.priority; // Reverse because higher priorities have lower numbers
|
|
@@ -8542,7 +8545,7 @@ function requireDist () {
|
|
|
8542
8545
|
|
|
8543
8546
|
var distExports = requireDist();
|
|
8544
8547
|
|
|
8545
|
-
var version = "1.
|
|
8548
|
+
var version = "1.56.0";
|
|
8546
8549
|
var PACKAGE = {
|
|
8547
8550
|
version: version};
|
|
8548
8551
|
|
|
@@ -10673,7 +10676,7 @@ class AbstractPowerSyncDatabase extends BaseObserver {
|
|
|
10673
10676
|
this.logger.warn('Schema validation failed. Unexpected behaviour could occur', ex);
|
|
10674
10677
|
}
|
|
10675
10678
|
this._schema = schema;
|
|
10676
|
-
await this.database.execute('SELECT powersync_replace_schema(?)', [JSON.stringify(this.schema.toJSON())]);
|
|
10679
|
+
await this.database.writeTransaction((tx) => tx.execute('SELECT powersync_replace_schema(?)', [JSON.stringify(this.schema.toJSON())]));
|
|
10677
10680
|
await this.database.refreshSchema();
|
|
10678
10681
|
this.iterateListeners(async (cb) => cb.schemaChanged?.(schema));
|
|
10679
10682
|
}
|