@@ -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 */
@@ -176,7 +183,7 @@ export interface StreamingSyncImplementation extends BaseObserver<StreamingSyncI
176183 /**
177184 * Connects to the sync service
178185 */
179- connect ( options ?: PowerSyncConnectionOptions ) : Promise < void > ;
186+ connect ( options ?: InternalConnectionOptions ) : Promise < void > ;
180187 /**
181188 * Disconnects from the sync services.
182189 * @throws if not connected or if abort is not controlled internally
@@ -208,7 +215,8 @@ export const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptio
208215 connectionMethod : SyncStreamConnectionMethod . WEB_SOCKET ,
209216 clientImplementation : DEFAULT_SYNC_CLIENT_IMPLEMENTATION ,
210217 fetchStrategy : FetchStrategy . Buffered ,
211- params : { }
218+ params : { } ,
219+ serializedSchema : undefined
212220} ;
213221
214222// The priority we assume when we receive checkpoint lines where no priority is set.
@@ -1019,12 +1027,12 @@ The next upload iteration will be delayed.`);
10191027 }
10201028
10211029 try {
1022- await control (
1023- PowerSyncControlCommand . START ,
1024- JSON . stringify ( {
1025- parameters : resolvedOptions . params
1026- } )
1027- ) ;
1030+ const options : any = { parameters : resolvedOptions . params } ;
1031+ if ( resolvedOptions . serializedSchema ) {
1032+ options . schema = resolvedOptions . serializedSchema ;
1033+ }
1034+
1035+ await control ( PowerSyncControlCommand . START , JSON . stringify ( options ) ) ;
10281036
10291037 this . notifyCompletedUploads = ( ) => {
10301038 controlInvocations ?. enqueueData ( { command : PowerSyncControlCommand . NOTIFY_CRUD_UPLOAD_COMPLETED } ) ;
0 commit comments