mirror of
https://github.com/aliasvault/aliasvault.git
synced 2026-02-01 18:02:31 -05:00
Retrieve SyncableTables info from Rust Core (#1404)
This commit is contained in:
@@ -131,22 +131,22 @@ public class RustCoreService : IAsyncDisposable
|
||||
/// Get the list of table names that need to be synced.
|
||||
/// </summary>
|
||||
/// <returns>Array of table names.</returns>
|
||||
/// <exception cref="InvalidOperationException">Thrown if WASM module is unavailable.</exception>
|
||||
public async Task<string[]> GetSyncableTableNamesAsync()
|
||||
{
|
||||
if (!await IsAvailableAsync())
|
||||
// Wait for WASM to be available with retries, as it may still be loading.
|
||||
if (!await WaitForAvailabilityAsync())
|
||||
{
|
||||
return SyncableTables.Names;
|
||||
throw new InvalidOperationException("Rust WASM module is not available.");
|
||||
}
|
||||
|
||||
try
|
||||
var result = await jsRuntime.InvokeAsync<string[]>("rustCoreGetSyncableTableNames");
|
||||
if (result == null || result.Length == 0)
|
||||
{
|
||||
var result = await jsRuntime.InvokeAsync<string[]>("rustCoreGetSyncableTableNames");
|
||||
return result ?? SyncableTables.Names;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return SyncableTables.Names;
|
||||
throw new InvalidOperationException("Failed to get syncable table names from Rust WASM.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="SyncableTables.cs" company="aliasvault">
|
||||
// Copyright (c) aliasvault. All rights reserved.
|
||||
// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.
|
||||
// </copyright>
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
namespace AliasVault.Client.Services.JsInterop.RustCore;
|
||||
|
||||
/// <summary>
|
||||
/// List of syncable table names that need to be read for merge operations.
|
||||
/// </summary>
|
||||
public static class SyncableTables
|
||||
{
|
||||
/// <summary>
|
||||
/// Table names that need LWW merge.
|
||||
/// </summary>
|
||||
public static readonly string[] Names =
|
||||
[
|
||||
"Items",
|
||||
"FieldValues",
|
||||
"Folders",
|
||||
"Tags",
|
||||
"ItemTags",
|
||||
"Attachments",
|
||||
"TotpCodes",
|
||||
"Passkeys",
|
||||
"FieldDefinitions",
|
||||
"FieldHistories",
|
||||
"Logos",
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user