Skip to content

Commit c248447

Browse files
committed
Merge branch 'main' into fix/opsqlite-transaction-notifications
2 parents 1e0ca33 + 7db9933 commit c248447

File tree

18 files changed

+963
-801
lines changed

18 files changed

+963
-801
lines changed

.changeset/rude-snakes-report.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/common/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @powersync/common
22

3+
## 1.22.1
4+
5+
### Patch Changes
6+
7+
- 7a47778: Fix issue where local changes could be reverted when a replication delay is present.
8+
- 4a262cd: Add schema validation
9+
310
## 1.22.0
411

512
### Minor Changes

packages/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@powersync/common",
3-
"version": "1.22.0",
3+
"version": "1.22.1",
44
"publishConfig": {
55
"registry": "https://registry.npmjs.org/",
66
"access": "public"

packages/common/src/client/AbstractPowerSyncDatabase.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,12 +582,12 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
582582
if (writeCheckpoint) {
583583
const check = await tx.execute(`SELECT 1 FROM ${PSInternalTable.CRUD} LIMIT 1`);
584584
if (!check.rows?.length) {
585-
await tx.execute(`UPDATE ${PSInternalTable.BUCKETS} SET target_op = ? WHERE name='$local'`, [
585+
await tx.execute(`UPDATE ${PSInternalTable.BUCKETS} SET target_op = CAST(? as INTEGER) WHERE name='$local'`, [
586586
writeCheckpoint
587587
]);
588588
}
589589
} else {
590-
await tx.execute(`UPDATE ${PSInternalTable.BUCKETS} SET target_op = ? WHERE name='$local'`, [
590+
await tx.execute(`UPDATE ${PSInternalTable.BUCKETS} SET target_op = CAST(? as INTEGER) WHERE name='$local'`, [
591591
this.bucketStorageAdapter.getMaxOpId()
592592
]);
593593
}

packages/common/src/client/sync/bucket/SqliteBucketStorage.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class SqliteBucketStorage extends BaseObserver<BucketStorageListener> imp
8585

8686
async getBucketStates(): Promise<BucketState[]> {
8787
const result = await this.db.getAll<BucketState>(
88-
'SELECT name as bucket, cast(last_op as TEXT) as op_id FROM ps_buckets WHERE pending_delete = 0'
88+
"SELECT name as bucket, cast(last_op as TEXT) as op_id FROM ps_buckets WHERE pending_delete = 0 AND name != '$local'"
8989
);
9090
return result;
9191
}
@@ -249,9 +249,10 @@ export class SqliteBucketStorage extends BaseObserver<BucketStorageListener> imp
249249
}
250250

251251
async updateLocalTarget(cb: () => Promise<string>): Promise<boolean> {
252-
const rs1 = await this.db.getAll("SELECT target_op FROM ps_buckets WHERE name = '$local' AND target_op = ?", [
253-
MAX_OP_ID
254-
]);
252+
const rs1 = await this.db.getAll(
253+
"SELECT target_op FROM ps_buckets WHERE name = '$local' AND target_op = CAST(? as INTEGER)",
254+
[MAX_OP_ID]
255+
);
255256
if (!rs1.length) {
256257
// Nothing to update
257258
return false;

packages/drizzle-driver/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"test": "vitest"
2727
},
2828
"peerDependencies": {
29-
"@powersync/common": "workspace:^1.22.0",
29+
"@powersync/common": "workspace:^1.22.1",
3030
"drizzle-orm": "<1.0.0"
3131
},
3232
"devDependencies": {

packages/kysely-driver/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"test": "pnpm build && vitest"
2727
},
2828
"peerDependencies": {
29-
"@powersync/common": "workspace:^1.22.0"
29+
"@powersync/common": "workspace:^1.22.1"
3030
},
3131
"dependencies": {
3232
"kysely": "^0.27.4"

packages/powersync-op-sqlite/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @powersync/op-sqlite
22

3+
## 0.1.4
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [7a47778]
8+
- Updated dependencies [4a262cd]
9+
- @powersync/common@1.22.1
10+
311
## 0.1.3
412

513
### Patch Changes

packages/powersync-op-sqlite/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@powersync/op-sqlite",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"description": "PowerSync - sync Postgres or MongoDB with SQLite in your React Native app for offline-first and real-time data",
55
"source": "./src/index.ts",
66
"main": "./lib/commonjs/index.js",
@@ -66,7 +66,7 @@
6666
},
6767
"peerDependencies": {
6868
"@op-engineering/op-sqlite": "^10.1.0",
69-
"@powersync/common": "workspace:^1.22.0",
69+
"@powersync/common": "workspace:^1.22.1",
7070
"react": "*",
7171
"react-native": "*"
7272
},

packages/react-native/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @powersync/react-native
22

3+
## 1.16.2
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [7a47778]
8+
- Updated dependencies [4a262cd]
9+
- @powersync/common@1.22.1
10+
311
## 1.16.1
412

513
### Patch Changes

0 commit comments

Comments
 (0)