Skip to content

Commit eb1ca40

Browse files
wip
1 parent b4b393b commit eb1ca40

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

demos/react-supabase-todolist/src/components/providers/SystemProvider.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ export const SystemProvider = ({ children }: { children: React.ReactNode }) => {
6868
const l = connector.registerListener({
6969
initialized: () => {},
7070
sessionStarted: () => {
71-
powerSync.connect(connector);
71+
powerSync.connect(connector, {
72+
appMetadata: {
73+
app_version: '1.0.0'
74+
}
75+
});
7276
}
7377
});
7478

packages/common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
import { CrudEntry } from '../bucket/CrudEntry.js';
1717
import { SyncDataBucket } from '../bucket/SyncDataBucket.js';
1818
import { AbstractRemote, FetchStrategy, SyncStreamOptions } from './AbstractRemote.js';
19-
import { coreStatusToJs, EstablishSyncStream, Instruction, SyncPriorityStatus } from './core-instruction.js';
19+
import { EstablishSyncStream, Instruction, coreStatusToJs } from './core-instruction.js';
2020
import {
2121
BucketRequest,
2222
CrudUploadNotification,
@@ -129,6 +129,11 @@ export interface InternalConnectionOptions extends BaseConnectionOptions, Additi
129129

130130
/** @internal */
131131
export interface BaseConnectionOptions {
132+
/**
133+
* A set of metadata to be included in service logs.
134+
*/
135+
appMetadata?: Record<string, string>;
136+
132137
/**
133138
* Whether to use a JavaScript implementation to handle received sync lines from the sync
134139
* service, or whether this work should be offloaded to the PowerSync core extension.
@@ -223,6 +228,7 @@ export const DEFAULT_STREAMING_SYNC_OPTIONS = {
223228
export type RequiredPowerSyncConnectionOptions = Required<BaseConnectionOptions>;
224229

225230
export const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptions = {
231+
appMetadata: {},
226232
connectionMethod: SyncStreamConnectionMethod.WEB_SOCKET,
227233
clientImplementation: DEFAULT_SYNC_CLIENT_IMPLEMENTATION,
228234
fetchStrategy: FetchStrategy.Buffered,
@@ -699,6 +705,7 @@ The next upload iteration will be delayed.`);
699705
include_checksum: true,
700706
raw_data: true,
701707
parameters: resolvedOptions.params,
708+
app_metadata: resolvedOptions.appMetadata,
702709
client_id: clientId
703710
}
704711
};
@@ -1088,6 +1095,7 @@ The next upload iteration will be delayed.`);
10881095
try {
10891096
const options: any = {
10901097
parameters: resolvedOptions.params,
1098+
app_metadata: resolvedOptions.appMetadata,
10911099
active_streams: this.activeStreams,
10921100
include_defaults: resolvedOptions.includeDefaultStreams
10931101
};

packages/common/src/client/sync/stream/streaming-sync-types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ export interface StreamingSyncRequest {
9090
*/
9191
parameters?: Record<string, StreamingSyncRequestParameterType>;
9292

93+
/**
94+
* Application metadata to be included in service logs.
95+
*/
96+
app_metadata?: Record<string, string>;
97+
9398
client_id?: string;
9499
}
95100

0 commit comments

Comments
 (0)