Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
378 changes: 378 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion IsExternalInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ namespace System.Runtime.CompilerServices
{
[EditorBrowsable(EditorBrowsableState.Never)]
internal class IsExternalInit { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ public class PowerSyncCredentials(string endpoint, string token, DateTime? expir
public string Endpoint { get; set; } = endpoint;
public string Token { get; set; } = token;
public DateTime? ExpiresAt { get; set; } = expiresAt;
}
}
2 changes: 1 addition & 1 deletion PowerSync/PowerSync.Common/Client/PowerSyncDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -789,4 +789,4 @@ public class WatchOnChangeHandler
{
public Func<WatchOnChangeEvent, Task> OnChange { get; set; } = null!;
public Action<Exception>? OnError { get; set; }
}
}
2 changes: 1 addition & 1 deletion PowerSync/PowerSync.Common/Client/SQLOpenFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class SQLOpenOptions : IDatabaseSource
public string? DbLocation { get; set; }
}

public interface ISQLOpenFactory: IDatabaseSource
public interface ISQLOpenFactory : IDatabaseSource
{
/// <summary>
/// Opens a connection adapter to a SQLite Database.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ namespace PowerSync.Common.Client.Sync.Bucket;
using System;
using System.Threading.Tasks;

using Newtonsoft.Json;

using PowerSync.Common.DB.Crud;
using PowerSync.Common.Utils;
using Newtonsoft.Json;

public static class PowerSyncControlCommand
{
Expand Down Expand Up @@ -129,4 +130,4 @@ public interface IBucketStorageAdapter : IEventStream<BucketStorageEvent>
/// Invokes the `powersync_control` function for the sync client.
/// </summary>
Task<string> Control(string op, object? payload);
}
}
2 changes: 1 addition & 1 deletion PowerSync/PowerSync.Common/Client/Sync/Bucket/OpType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ public string ToJSON()
{
return JsonConvert.SerializeObject(Value).Trim('"'); // Ensures it's a string without extra quotes
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ public string ToJSON()

return JsonConvert.SerializeObject(jsonObject, Formatting.None);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public class SqliteBucketStorage : EventStream<BucketStorageEvent>, IBucketStora
private static readonly int COMPACT_OPERATION_INTERVAL = 1000;
private int compactCounter = COMPACT_OPERATION_INTERVAL;

private ILogger logger;
private readonly ILogger logger;

private CancellationTokenSource updateCts;
private readonly CancellationTokenSource updateCts;

private record ExistingTableRowsResult(string name);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ namespace PowerSync.Common.Client.Sync.Bucket;
public class SyncDataBatch(SyncDataBucket[] buckets)
{
public SyncDataBucket[] Buckets { get; private set; } = buckets;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace PowerSync.Common.Client.Sync.Bucket;

using System.Collections.Generic;
using System.Linq;

using Newtonsoft.Json;

public class SyncDataBucketJSON
Expand Down Expand Up @@ -71,4 +72,4 @@ public string ToJSON()

return JsonConvert.SerializeObject(jsonObject);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace PowerSync.Common.Client.Sync.Stream;

Expand Down Expand Up @@ -126,4 +126,4 @@ public class FetchCredentials : Instruction

public class CloseSyncStream : Instruction { }
public class FlushFileSystem : Instruction { }
public class DidCompleteSync : Instruction { }
public class DidCompleteSync : Instruction { }
2 changes: 1 addition & 1 deletion PowerSync/PowerSync.Common/Client/Sync/Stream/Remote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ namespace PowerSync.Common.Client.Sync.Stream;
using System.Net.Http;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ namespace PowerSync.Common.Client.Sync.Stream;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;

Expand Down Expand Up @@ -1154,4 +1155,4 @@ public async Task<T> ObtainLock<T>(LockOptions<T> lockOptions)
return await lockOptions.Callback();
});
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
namespace PowerSync.Common.Client.Sync.Stream;

using Newtonsoft.Json;

using PowerSync.Common.Client.Sync.Bucket;
using PowerSync.Common.DB.Crud;
using Newtonsoft.Json;

public class ContinueCheckpointRequest
{
Expand Down
2 changes: 1 addition & 1 deletion PowerSync/PowerSync.Common/DB/Crud/CrudBatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public async Task Complete(string? checkpoint = null)
{
await CompleteCallback(checkpoint);
}
}
}
3 changes: 2 additions & 1 deletion PowerSync/PowerSync.Common/DB/Crud/CrudEntry.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace PowerSync.Common.DB.Crud;

using System.Collections.Generic;

using Newtonsoft.Json;

public enum UpdateType
Expand Down Expand Up @@ -97,4 +98,4 @@ public override int GetHashCode()
{
return JsonConvert.SerializeObject(this).GetHashCode();
}
}
}
2 changes: 1 addition & 1 deletion PowerSync/PowerSync.Common/DB/Crud/CrudTransaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ namespace PowerSync.Common.DB.Crud;
public class CrudTransaction(CrudEntry[] crud, Func<string?, Task> complete, long? transactionId = null) : CrudBatch(crud, false, complete)
{
public long? TransactionId { get; private set; } = transactionId;
}
}
2 changes: 1 addition & 1 deletion PowerSync/PowerSync.Common/DB/Crud/SyncProgress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ public class ProgressWithOperations
/// When this number reaches 1.0, all changes have been received from the sync service.
/// </summary>
public double DownloadedFraction { get; set; }
}
}
8 changes: 5 additions & 3 deletions PowerSync/PowerSync.Common/DB/Crud/SyncStatus.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
namespace PowerSync.Common.DB.Crud;

using PowerSync.Common.Client.Sync.Stream;
using Newtonsoft.Json;
using Microsoft.Extensions.Options;

using Newtonsoft.Json;

using PowerSync.Common.Client.Sync.Stream;

public class SyncDataFlowStatus
{
[JsonProperty("downloading")] public bool Downloading { get; set; } = false;
Expand Down Expand Up @@ -173,4 +175,4 @@ public string ToJSON()
{
return SerializeObject();
}
}
}
2 changes: 1 addition & 1 deletion PowerSync/PowerSync.Common/DB/Crud/UploadQueueStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ public override string ToString()
return $"UploadQueueStats<count: {Count} size: {Size / 1024.0}kB>";
}
}
}
}
2 changes: 1 addition & 1 deletion PowerSync/PowerSync.Common/DB/Schema/Index.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public string ToJSON(Table table)
columns = Columns.Select(column => column.ToJSON(table)).ToList()
});
}
}
}
2 changes: 1 addition & 1 deletion PowerSync/PowerSync.Common/DB/Schema/IndexedColumn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ public object ToJSON(Table table)
}
);
}
}
}
1 change: 1 addition & 0 deletions PowerSync/PowerSync.Common/DB/Schema/Table.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace PowerSync.Common.DB.Schema;

using System.Text.RegularExpressions;

using Newtonsoft.Json;

public class TableOptions(
Expand Down
4 changes: 2 additions & 2 deletions PowerSync/PowerSync.Common/MDSQLite/MDSQLiteConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class MDSQLiteConnection : EventStream<DBAdapterEvent>, ILockContext
{

public SqliteConnection Db;
private List<UpdateNotification> updateBuffer;
private readonly List<UpdateNotification> updateBuffer;
public MDSQLiteConnection(MDSQLiteConnectionOptions options)
{
Db = options.Database;
Expand Down Expand Up @@ -215,4 +215,4 @@ public async Task RefreshSchema()
{
await Get<object>("PRAGMA table_info('sqlite_master')");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ public IDBAdapter OpenDatabase()
SqliteOptions = options.SqliteOptions
});
}
}
}
2 changes: 1 addition & 1 deletion PowerSync/PowerSync.Common/MDSQLite/MDSQLiteOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,4 @@ public class RequiredMDSQLiteOptions : MDSQLiteOptions

public new int CacheSizeKb { get; set; }
public new SqliteExtension[] Extensions { get; set; } = null!;
}
}
2 changes: 1 addition & 1 deletion PowerSync/PowerSync.Common/Utils/EventStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,4 @@ private void RemoveSubscriber(Channel<T> channel)
{
subscribers.TryRemove(channel, out _);
}
}
}
2 changes: 1 addition & 1 deletion PowerSync/PowerSync.Common/Utils/PowerSyncPathResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ private static string GetFileNameForPlatform()
throw new PlatformNotSupportedException("Unsupported platform.");
}
}
}
}
3 changes: 2 additions & 1 deletion PowerSync/PowerSync.Maui/SQLite/MAUISQLiteAdapter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace PowerSync.Maui.SQLite;

using Microsoft.Data.Sqlite;

using PowerSync.Common.MDSQLite;

// iOS specific imports
Expand Down Expand Up @@ -46,4 +47,4 @@ private void LoadExtensionIOS(SqliteConnection db)
loadExtension.ExecuteNonQuery();
#endif
}
}
}
2 changes: 1 addition & 1 deletion PowerSync/PowerSync.Maui/SQLite/MAUISQLiteDBOpenFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ public IDBAdapter OpenDatabase()
SqliteOptions = options.SqliteOptions
});
}
}
}
2 changes: 1 addition & 1 deletion PowerSync/PowerSync.Maui/build/ApiDefinition.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace PowerSync.Maui.build
{
// Empty API definition - allows xcframework to be included without managed bindings
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
namespace PowerSync.Common.IntegrationTests;

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using System.Collections.Generic;

using PowerSync.Common.DB.Crud;

public class NodeClient
Expand Down Expand Up @@ -107,4 +108,4 @@ public void Dispose()
{
_httpClient?.Dispose();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using System.IO;

using PowerSync.Common.Client;
using PowerSync.Common.Client.Connection;
using PowerSync.Common.DB.Crud;
Expand Down Expand Up @@ -110,4 +111,4 @@ public async Task UploadData(IPowerSyncDatabase database)
throw;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using Newtonsoft.Json;
using PowerSync.Common.Client;
using System.Data.Common;
using System.Diagnostics;
using System.Threading.Tasks;

using Microsoft.Extensions.Logging;

using Newtonsoft.Json;

using PowerSync.Common.Client;
using PowerSync.Common.Client.Sync.Stream;


Expand All @@ -14,7 +17,7 @@ public class SyncIntegrationTests : IAsyncLifetime
{
private record ListResult(string id, string name, string owner_id, string created_at);

private string userId = Uuid();
private readonly string userId = Uuid();

private NodeClient nodeClient = default!;

Expand Down Expand Up @@ -251,4 +254,4 @@ public IntegrationFactAttribute()
Timeout = 5000; // 5 seconds default for all integration tests
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ public class TestSchema
{ "todos", Todos },
{ "lists", Lists }
});
}
}
Loading