@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.cjs
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
|
|
@@ -10913,7 +10916,7 @@ function requireDist () {
|
|
|
10913
10916
|
|
|
10914
10917
|
var distExports = requireDist();
|
|
10915
10918
|
|
|
10916
|
-
var version = "1.
|
|
10919
|
+
var version = "1.56.0";
|
|
10917
10920
|
var PACKAGE = {
|
|
10918
10921
|
version: version};
|
|
10919
10922
|
|
|
@@ -13044,7 +13047,7 @@ class AbstractPowerSyncDatabase extends BaseObserver {
|
|
|
13044
13047
|
this.logger.warn('Schema validation failed. Unexpected behaviour could occur', ex);
|
|
13045
13048
|
}
|
|
13046
13049
|
this._schema = schema;
|
|
13047
|
-
await this.database.execute('SELECT powersync_replace_schema(?)', [JSON.stringify(this.schema.toJSON())]);
|
|
13050
|
+
await this.database.writeTransaction((tx) => tx.execute('SELECT powersync_replace_schema(?)', [JSON.stringify(this.schema.toJSON())]));
|
|
13048
13051
|
await this.database.refreshSchema();
|
|
13049
13052
|
this.iterateListeners(async (cb) => cb.schemaChanged?.(schema));
|
|
13050
13053
|
}
|