|
1 | 1 | # Changelog
|
2 | 2 |
|
| 3 | +# 1.0.0 |
| 4 | + |
| 5 | +- Improved the stability of watched queries. Watched queries were previously susceptible to runtime crashes if an exception was thrown in the update stream. Errors are now gracefully handled. |
| 6 | + |
| 7 | +- Deprecated `PowerSyncCredentials` `userId` field. This value is not used by the PowerSync service. |
| 8 | + |
| 9 | +- Added `readLock` and `writeLock` APIs. These methods allow obtaining a SQLite connection context without starting a transaction. |
| 10 | + |
| 11 | +- Removed references to the PowerSync Kotlin SDK from all public API protocols. Dedicated Swift protocols are now defined. These protocols align better with Swift primitives. See the `BRAKING CHANGES` section for more details. Updated protocols include: |
| 12 | + |
| 13 | + - `ConnectionContext` - The context provided by `readLock` and `writeLock` |
| 14 | + - `Transaction` - The context provided by `readTransaction` and `writeTransaction` |
| 15 | + - `CrudBatch` - Response from `getCrudBatch` |
| 16 | + - `CrudTransaction` Response from `getNextCrudTransaction` |
| 17 | + - `CrudEntry` - Crud entries for `CrudBatch` and `CrudTransaction` |
| 18 | + - `UpdateType` - Operation type for `CrudEntry`s |
| 19 | + - `SqlCursor` - Cursor used to map SQLite results to typed result sets |
| 20 | + - `JsonParam` - JSON parameters used to declare client parameters in the `connect` method |
| 21 | + - `JsonValue` - Individual JSON field types for `JsonParam` |
| 22 | + |
| 23 | +- Database and transaction/lock level query `execute` methods now have `@discardableResult` annotation. |
| 24 | + |
| 25 | +- Query methods' `parameters` typing has been updated to `[Any?]` from `[Any]`. This makes passing `nil` or optional values to queries easier. |
| 26 | + |
| 27 | +- `AttachmentContext`, `AttachmentQueue`, `AttachmentService` and `SyncingService` are are now explicitly declared as `open` classes, allowing them to be subclassed outside the defining module. |
| 28 | + |
| 29 | +**BREAKING CHANGES**: |
| 30 | + |
| 31 | +- Completing CRUD transactions or CRUD batches, in the `PowerSyncBackendConnector` `uploadData` handler, now has a simpler invocation. |
| 32 | + |
| 33 | +```diff |
| 34 | +- _ = try await transaction.complete.invoke(p1: nil) |
| 35 | ++ try await transaction.complete() |
| 36 | +``` |
| 37 | + |
| 38 | +- `index` based `SqlCursor` getters now throw if the query result column value is `nil`. This is now consistent with the behaviour of named column getter operations. New `getXxxxxOptional(index: index)` methods are available if the query result value could be `nil`. |
| 39 | + |
| 40 | +```diff |
| 41 | +let results = try transaction.getAll( |
| 42 | + sql: "SELECT * FROM my_table", |
| 43 | + parameters: [id] |
| 44 | + ) { cursor in |
| 45 | +- cursor.getString(index: 0)! |
| 46 | ++ cursor.getStringOptional(index: 0) |
| 47 | ++ // OR |
| 48 | ++ // try cursor.getString(index: 0) // if the value should be required |
| 49 | + } |
| 50 | +``` |
| 51 | + |
| 52 | +- `SqlCursor` getters now directly return Swift types. `getLong` has been replaced with `getInt64`. |
| 53 | + |
| 54 | +```diff |
| 55 | +let results = try transaction.getAll( |
| 56 | + sql: "SELECT * FROM my_table", |
| 57 | + parameters: [id] |
| 58 | + ) { cursor in |
| 59 | +- cursor.getBoolean(index: 0)?.boolValue, |
| 60 | ++ cursor.getBooleanOptional(index: 0), |
| 61 | +- cursor.getLong(index: 0)?.int64Value, |
| 62 | ++ cursor.getInt64Optional(index: 0) |
| 63 | ++ // OR |
| 64 | ++ // try cursor.getInt64(index: 0) // if the value should be required |
| 65 | + } |
| 66 | +``` |
| 67 | + |
| 68 | +- Client parameters now need to be specified with strictly typed `JsonValue` enums. |
| 69 | + |
| 70 | +```diff |
| 71 | +try await database.connect( |
| 72 | + connector: PowerSyncBackendConnector(), |
| 73 | + params: [ |
| 74 | +- "foo": "bar" |
| 75 | ++ "foo": .string("bar") |
| 76 | + ] |
| 77 | +) |
| 78 | +``` |
| 79 | + |
| 80 | +- `SyncStatus` values now use Swift primitives for status attributes. `lastSyncedAt` now is of `Date` type. |
| 81 | + |
| 82 | +```diff |
| 83 | +- let lastTime: Date? = db.currentStatus.lastSyncedAt.map { |
| 84 | +- Date(timeIntervalSince1970: TimeInterval($0.epochSeconds)) |
| 85 | +- } |
| 86 | ++ let time: Date? = db.currentStatus.lastSyncedAt |
| 87 | +``` |
| 88 | + |
| 89 | +- `crudThrottleMs` and `retryDelayMs` in the `connect` method have been updated to `crudThrottle` and `retryDelay` which are now of type `TimeInterval`. Previously the parameters were specified in milliseconds, the `TimeInterval` typing now requires values to be specified in seconds. |
| 90 | + |
| 91 | +```diff |
| 92 | +try await database.connect( |
| 93 | + connector: PowerSyncBackendConnector(), |
| 94 | +- crudThrottleMs: 1000, |
| 95 | +- retryDelayMs: 5000, |
| 96 | ++ crudThrottle: 1, |
| 97 | ++ retryDelay: 5, |
| 98 | + params: [ |
| 99 | + "foo": .string("bar"), |
| 100 | + ] |
| 101 | + ) |
| 102 | +``` |
| 103 | + |
| 104 | +- `throttleMs` in the watched query `WatchOptions` has been updated to `throttle` which is now of type `TimeInterval`. Previously the parameters were specified in milliseconds, the `TimeInterval` typing now requires values to be specified in seconds. |
| 105 | + |
| 106 | +```diff |
| 107 | +let stream = try database.watch( |
| 108 | + options: WatchOptions( |
| 109 | + sql: "SELECT name FROM users ORDER BY id", |
| 110 | +- throttleMs: 1000, |
| 111 | ++ throttle: 1, |
| 112 | + mapper: { cursor in |
| 113 | + try cursor.getString(index: 0) |
| 114 | + } |
| 115 | + )) |
| 116 | +``` |
| 117 | + |
3 | 118 | # 1.0.0-Beta.13
|
4 | 119 |
|
5 | 120 | - Update `powersync-kotlin` dependency to version `1.0.0-BETA32`, which includes:
|
|
0 commit comments