diff --git a/.changeset/fuzzy-buses-own.md b/.changeset/fuzzy-buses-own.md
new file mode 100644
index 000000000..a89344e9d
--- /dev/null
+++ b/.changeset/fuzzy-buses-own.md
@@ -0,0 +1,5 @@
+---
+'@powersync/common': minor
+---
+
+Add `clientImplementation` field to `SyncStatus`.
diff --git a/.changeset/large-toes-drive.md b/.changeset/large-toes-drive.md
new file mode 100644
index 000000000..a13eb4992
--- /dev/null
+++ b/.changeset/large-toes-drive.md
@@ -0,0 +1,5 @@
+---
+'@powersync/diagnostics-app': patch
+---
+
+Support Rust client.
diff --git a/packages/common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts b/packages/common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts
index 113148b42..ef282030b 100644
--- a/packages/common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts
+++ b/packages/common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts
@@ -632,8 +632,10 @@ The next upload iteration will be delayed.`);
...DEFAULT_STREAM_CONNECTION_OPTIONS,
...(options ?? {})
};
+ const clientImplementation = resolvedOptions.clientImplementation;
+ this.updateSyncStatus({ clientImplementation });
- if (resolvedOptions.clientImplementation == SyncClientImplementation.JAVASCRIPT) {
+ if (clientImplementation == SyncClientImplementation.JAVASCRIPT) {
await this.legacyStreamingSyncIteration(signal, resolvedOptions);
} else {
await this.requireKeyFormat(true);
@@ -1168,7 +1170,8 @@ The next upload iteration will be delayed.`);
...this.syncStatus.dataFlowStatus,
...options.dataFlow
},
- priorityStatusEntries: options.priorityStatusEntries ?? this.syncStatus.priorityStatusEntries
+ priorityStatusEntries: options.priorityStatusEntries ?? this.syncStatus.priorityStatusEntries,
+ clientImplementation: options.clientImplementation ?? this.syncStatus.clientImplementation
});
if (!this.syncStatus.isEqual(updatedStatus)) {
diff --git a/packages/common/src/db/crud/SyncStatus.ts b/packages/common/src/db/crud/SyncStatus.ts
index 775c9fa36..4c687e18d 100644
--- a/packages/common/src/db/crud/SyncStatus.ts
+++ b/packages/common/src/db/crud/SyncStatus.ts
@@ -1,3 +1,4 @@
+import { SyncClientImplementation } from '../../client/sync/stream/AbstractStreamingSyncImplementation.js';
import { InternalProgressInformation, SyncProgress } from './SyncProgress.js';
export type SyncDataFlowStatus = Partial<{
@@ -35,11 +36,22 @@ export type SyncStatusOptions = {
lastSyncedAt?: Date;
hasSynced?: boolean;
priorityStatusEntries?: SyncPriorityStatus[];
+ clientImplementation?: SyncClientImplementation;
};
export class SyncStatus {
constructor(protected options: SyncStatusOptions) {}
+ /**
+ * Returns the used sync client implementation (either the one implemented in JavaScript or the newer Rust-based
+ * implementation).
+ *
+ * This information is only available after a connection has been requested.
+ */
+ get clientImplementation() {
+ return this.options.clientImplementation;
+ }
+
/**
* Indicates if the client is currently connected to the PowerSync service.
*
diff --git a/tools/diagnostics-app/src/app/views/layout.tsx b/tools/diagnostics-app/src/app/views/layout.tsx
index f018cffdd..51e0526cf 100644
--- a/tools/diagnostics-app/src/app/views/layout.tsx
+++ b/tools/diagnostics-app/src/app/views/layout.tsx
@@ -155,6 +155,7 @@ export default function ViewsLayout({ children }: { children: React.ReactNode })
{title}
+ {syncStatus?.clientImplementation && Client: {syncStatus?.clientImplementation}}
= (props) =>
- initialValues={{ token: '', endpoint: '' }}
+ initialValues={{ token: '', endpoint: '', clientImplementation: SyncClientImplementation.RUST }}
validateOnChange={false}
validateOnBlur={false}
validate={(values) => {
@@ -44,7 +57,8 @@ export const LoginDetailsWidget: React.FC = (props) =>
}
await props.onSubmit({
token: values.token,
- endpoint
+ endpoint,
+ clientImplementation: values.clientImplementation
});
} catch (ex: any) {
console.error(ex);
@@ -52,7 +66,7 @@ export const LoginDetailsWidget: React.FC = (props) =>
setFieldError('endpoint', ex.message);
}
}}>
- {({ values, errors, handleChange, handleBlur, isSubmitting, handleSubmit }) => (
+ {({ values, errors, handleChange, handleBlur, isSubmitting, handleSubmit, setFieldValue }) => (