Skip to content

Commit 11a4173

Browse files
committed
Merge branch 'feat/progress-priorities' into feat/app-metadata
2 parents f08a8f8 + e629fa3 commit 11a4173

15 files changed

Lines changed: 281 additions & 50 deletions

File tree

.github/workflows/dev-packages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup .NET SDK
1919
uses: actions/setup-dotnet@v4
2020
with:
21-
dotnet-version: '8.0'
21+
dotnet-version: '8.0.x'
2222

2323
- name: Install MAUI Workloads
2424
run: dotnet workload restore

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup .NET SDK
1919
uses: actions/setup-dotnet@v4
2020
with:
21-
dotnet-version: '8.0'
21+
dotnet-version: '8.0.x'
2222

2323
- name: Install MAUI Workloads
2424
run: dotnet workload restore

PowerSync/PowerSync.Common/CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# PowerSync.Common Changelog
22

33
## 0.0.6-alpha.1
4-
- Added ability to specify `AppMetadata` for sync/stream requests.
5-
4+
- Dropping support for the legacy C# sync implementation.
5+
- Add `trackPreviousValues` option on `TableOptions` which sets `CrudEntry.PreviousValues` to previous values on updates.
6+
- Add `trackMetadata` option on `TableOptions` which adds a `_metadata` column that can be used for updates. The configured metadata is available through `CrudEntry.Metadata`.
7+
- Add `ignoreEmptyUpdates` option on `TableOptions` which skips creating CRUD entries for updates that don't change any values.
8+
- Reporting progress information about downloaded rows. Sync progress is available through `SyncStatus.DownloadProgress()`.
9+
- Support bucket priorities.
10+
- Report `PriorityStatusEntries` on `SyncStatus`.
11+
- Added ability to specify `AppMetadata` for sync/stream requests
612
Note: This requires a PowerSync service version `>=1.17.0` in order for logs to display metadata.
713

814
```csharp

PowerSync/PowerSync.Common/Client/PowerSyncDatabase.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ public interface IPowerSyncDatabase : IEventStream<PowerSyncDBEvent>
8080

8181
public class PowerSyncDatabase : EventStream<PowerSyncDBEvent>, IPowerSyncDatabase
8282
{
83-
private static readonly int FULL_SYNC_PRIORITY = 2147483647;
84-
8583
public IDBAdapter Database;
8684
private Schema schema;
8785

PowerSync/PowerSync.Common/Client/Sync/Stream/CoreInstructions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public static DB.Crud.SyncPriorityStatus PriorityToStatus(SyncPriorityStatus sta
138138
{
139139
Priority = status.Priority,
140140
HasSynced = status.HasSynced ?? null,
141-
LastSyncedAt = status?.LastSyncedAt != null ? new DateTime(status!.LastSyncedAt) : null
141+
LastSyncedAt = status?.LastSyncedAt != null ? DateTimeOffset.FromUnixTimeSeconds(status!.LastSyncedAt).DateTime : null
142142
};
143143
}
144144

PowerSync/PowerSync.Common/DB/Crud/CrudEntry.cs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,6 @@ public class CrudEntryDataJSON
4848
public string? Metadata { get; set; }
4949
}
5050

51-
public class CrudEntryOutputJSON
52-
{
53-
[JsonProperty("op_id")]
54-
public int OpId { get; set; }
55-
56-
[JsonProperty("op")]
57-
public UpdateType Op { get; set; }
58-
59-
[JsonProperty("type")]
60-
public string Type { get; set; } = null!;
61-
62-
[JsonProperty("id")]
63-
public string Id { get; set; } = null!;
64-
65-
[JsonProperty("tx_id")]
66-
public long? TransactionId { get; set; }
67-
68-
[JsonProperty("data")]
69-
public Dictionary<string, object>? Data { get; set; }
70-
}
71-
72-
7351
public class CrudEntry(
7452
int clientId,
7553
UpdateType op,
@@ -84,6 +62,7 @@ public class CrudEntry(
8462
public int ClientId { get; private set; } = clientId;
8563
public string Id { get; private set; } = id;
8664
public UpdateType Op { get; private set; } = op;
65+
8766
public Dictionary<string, object>? OpData { get; private set; } = opData;
8867
public string Table { get; private set; } = table;
8968
public long? TransactionId { get; private set; } = transactionId;

PowerSync/PowerSync.Common/DB/Crud/SyncProgress.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public class ProgressWithOperations
6868
public int TotalOperations { get; set; }
6969

7070
/// <summary>
71-
/// The numnber of operations that have already been downloaded.
71+
/// The number of operations that have already been downloaded.
7272
/// </summary>
7373
public int DownloadedOperations { get; set; }
7474

PowerSync/PowerSync.Common/DB/Schema/Table.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class TableOptions(
99
bool? insertOnly = null,
1010
string? viewName = null,
1111
bool? trackMetadata = null,
12-
TrackPreviousOptions? trackPreviousOptions = null,
12+
TrackPreviousOptions? trackPreviousValues = null,
1313
bool? ignoreEmptyUpdates = null
1414
)
1515
{
@@ -25,18 +25,18 @@ public class TableOptions(
2525
/// Whether to add a hidden `_metadata` column that will be enabled for updates to attach custom
2626
/// information about writes that will be reported through [CrudEntry.metadata].
2727
/// </summary>
28-
public bool TrackMetadata { get; } = trackMetadata ?? false;
28+
public bool TrackMetadata { get; set; } = trackMetadata ?? false;
2929

3030
/// <summary>
3131
/// When set to a non-null value, track old values of columns
3232
/// </summary>
33-
public TrackPreviousOptions? TrackPreviousOptions { get; } = trackPreviousOptions ?? null;
33+
public TrackPreviousOptions? TrackPreviousValues { get; set; } = trackPreviousValues ?? null;
3434

3535
/// <summary>
3636
/// Whether an `UPDATE` statement that doesn't change any values should be ignored when creating
3737
/// CRUD entries.
3838
/// </summary>
39-
public bool IgnoreEmptyUpdates { get; } = ignoreEmptyUpdates ?? false;
39+
public bool IgnoreEmptyUpdates { get; set; } = ignoreEmptyUpdates ?? false;
4040
}
4141

4242
/// <summary>
@@ -53,8 +53,7 @@ public class TrackPreviousOptions
5353
public List<string>? Columns { get; set; }
5454

5555
/// <summary>
56-
/// Whether to only include old values when they were changed by an update, instead of always
57-
/// including all old values,
56+
/// When enabled, only include values that have actually been changed by an update.
5857
/// </summary>
5958
[JsonProperty("onlyWhenChanged")]
6059
public bool? OnlyWhenChanged { get; set; }
@@ -117,7 +116,7 @@ public void Validate()
117116
throw new Exception("Can't include metadata for local-only tables.");
118117
}
119118

120-
if (Options.TrackPreviousOptions != null && Options.LocalOnly)
119+
if (Options.TrackPreviousValues != null && Options.LocalOnly)
121120
{
122121
throw new Exception("Can't include old values for local-only tables.");
123122
}
@@ -161,7 +160,7 @@ public void Validate()
161160

162161
public string ToJSON(string Name = "")
163162
{
164-
var trackPrevious = Options.TrackPreviousOptions;
163+
var trackPrevious = Options.TrackPreviousValues;
165164

166165
var jsonObject = new
167166
{

PowerSync/PowerSync.Maui/CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# PowerSync.Maui Changelog
22

33
## 0.0.4-alpha.1
4-
- Upstream PowerSync.Common version bump
5-
- Added ability to specify `AppMetadata` sync/stream requests (see Common changelog).
4+
- Upstream PowerSync.Common version bump (See Powersync.Common changelog for more information)
65

76
## 0.0.3-alpha.1
87
- Upstream PowerSync.Common version bump

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<a href="https://www.powersync.com" target="_blank"><img src="https://github.com/powersync-ja/.github/assets/7372448/d2538c43-c1a0-4c47-9a76-41462dba484f"/></a>
33
</p>
44

5-
_[PowerSync](https://www.powersync.com) is a sync engine for building local-first apps with instantly-responsive UI/UX and simplified state transfer. Syncs between SQLite on the client-side and Postgres, MongoDB or MySQL on the server-side._
5+
_[PowerSync](https://www.powersync.com) is a sync engine for building local-first apps with instantly-responsive UI/UX and simplified state transfer. Syncs between SQLite on the client-side and Postgres, MongoDB, MySQL or SQL Server on the server-side._
66

77
# PowerSync .NET SDKs
88

0 commit comments

Comments
 (0)