@@ -123,7 +123,9 @@ export interface StreamingSyncImplementationListener extends BaseListener {
123123 * Configurable options to be used when connecting to the PowerSync
124124 * backend instance.
125125 */
126- export interface PowerSyncConnectionOptions extends BaseConnectionOptions , AdditionalConnectionOptions { }
126+ export type PowerSyncConnectionOptions = Omit < InternalConnectionOptions , 'serializedSchema' > ;
127+
128+ export interface InternalConnectionOptions extends BaseConnectionOptions , AdditionalConnectionOptions { }
127129
128130/** @internal */
129131export interface BaseConnectionOptions {
@@ -152,6 +154,11 @@ export interface BaseConnectionOptions {
152154 * These parameters are passed to the sync rules, and will be available under the`user_parameters` object.
153155 */
154156 params ?: Record < string , StreamingSyncRequestParameterType > ;
157+
158+ /**
159+ * The serialized schema - mainly used to forward information about raw tables to the sync client.
160+ */
161+ serializedSchema ?: any ;
155162}
156163
157164/** @internal */
@@ -178,7 +185,7 @@ export interface StreamingSyncImplementation
178185 /**
179186 * Connects to the sync service
180187 */
181- connect ( options ?: PowerSyncConnectionOptions ) : Promise < void > ;
188+ connect ( options ?: InternalConnectionOptions ) : Promise < void > ;
182189 /**
183190 * Disconnects from the sync services.
184191 * @throws if not connected or if abort is not controlled internally
@@ -210,7 +217,8 @@ export const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptio
210217 connectionMethod : SyncStreamConnectionMethod . WEB_SOCKET ,
211218 clientImplementation : DEFAULT_SYNC_CLIENT_IMPLEMENTATION ,
212219 fetchStrategy : FetchStrategy . Buffered ,
213- params : { }
220+ params : { } ,
221+ serializedSchema : undefined
214222} ;
215223
216224// The priority we assume when we receive checkpoint lines where no priority is set.
@@ -1037,12 +1045,12 @@ The next upload iteration will be delayed.`);
10371045 }
10381046
10391047 try {
1040- await control (
1041- PowerSyncControlCommand . START ,
1042- JSON . stringify ( {
1043- parameters : resolvedOptions . params
1044- } )
1045- ) ;
1048+ const options : any = { parameters : resolvedOptions . params } ;
1049+ if ( resolvedOptions . serializedSchema ) {
1050+ options . schema = resolvedOptions . serializedSchema ;
1051+ }
1052+
1053+ await control ( PowerSyncControlCommand . START , JSON . stringify ( options ) ) ;
10461054
10471055 this . notifyCompletedUploads = ( ) => {
10481056 controlInvocations ?. enqueueData ( { command : PowerSyncControlCommand . NOTIFY_CRUD_UPLOAD_COMPLETED } ) ;
0 commit comments