File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed
packages/powersync_core/lib/src Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -125,13 +125,15 @@ extension type ResolvedSyncOptions(SyncOptions source) {
125125 syncImplementation: other.syncImplementation,
126126 includeDefaultStreams:
127127 other.includeDefaultStreams ?? includeDefaultStreams,
128+ appMetadata: other.appMetadata ?? appMetadata,
128129 );
129130
130131 final didChange = ! _mapEquality.equals (newOptions.params, params) ||
131132 newOptions.crudThrottleTime != crudThrottleTime ||
132133 newOptions.retryDelay != retryDelay ||
133134 newOptions.syncImplementation != source.syncImplementation ||
134- newOptions.includeDefaultStreams != includeDefaultStreams;
135+ newOptions.includeDefaultStreams != includeDefaultStreams ||
136+ ! _mapEquality.equals (newOptions.appMetadata, appMetadata);
135137 return (ResolvedSyncOptions (newOptions), didChange);
136138 }
137139
Original file line number Diff line number Diff line change @@ -94,6 +94,11 @@ class _ConnectedClient {
9494 null => SyncClientImplementation .defaultClient,
9595 final name => SyncClientImplementation .values.byName (name),
9696 },
97+ appMetadata: switch (request.appMetadataEncoded) {
98+ null => null ,
99+ final encodedAppMetadata => Map <String , String >.from (
100+ jsonDecode (encodedAppMetadata) as Map <String , dynamic >),
101+ },
97102 );
98103
99104 _runner = _worker.referenceSyncTask (
Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ extension type StartSynchronization._(JSObject _) implements JSObject {
8080 required String schemaJson,
8181 String ? syncParamsEncoded,
8282 UpdateSubscriptions ? subscriptions,
83+ String ? appMetadataEncoded,
8384 });
8485
8586 external String get databaseName;
@@ -90,6 +91,7 @@ extension type StartSynchronization._(JSObject _) implements JSObject {
9091 external String get schemaJson;
9192 external String ? get syncParamsEncoded;
9293 external UpdateSubscriptions ? get subscriptions;
94+ external String ? get appMetadataEncoded;
9395}
9496
9597@anonymous
@@ -483,6 +485,10 @@ final class WorkerCommunicationChannel {
483485 final params => jsonEncode (params),
484486 },
485487 subscriptions: UpdateSubscriptions (- 1 , streams),
488+ appMetadataEncoded: switch (options.source.appMetadata) {
489+ null => null ,
490+ final appMetadata => jsonEncode (appMetadata),
491+ },
486492 ),
487493 ));
488494 await completion;
You can’t perform that action at this time.
0 commit comments