@@ -422,7 +422,7 @@ export function table<Row extends RowObj, const Opts extends TableOpts<Row>>(
422422 // the name and accessor name of an index across all SDKs.
423423 indexes . push ( {
424424 sourceName : undefined ,
425- accessorName : indexOpts . name ,
425+ accessorName : indexOpts . accessor ,
426426 algorithm,
427427 } ) ;
428428 }
@@ -439,15 +439,6 @@ export function table<Row extends RowObj, const Opts extends TableOpts<Row>>(
439439 }
440440 }
441441
442- for ( const index of indexes ) {
443- const cols =
444- index . algorithm . tag === 'Direct'
445- ? [ index . algorithm . value ]
446- : index . algorithm . value ;
447- const colS = cols . map ( i => colNameList [ i ] ) . join ( '_' ) ;
448- index . sourceName = `${ name } _${ colS } _idx_${ index . algorithm . tag . toLowerCase ( ) } ` ;
449- }
450-
451442 const productType = row . algebraicType . value as RowBuilder <
452443 CoerceRow < Row >
453444 > [ 'algebraicType' ] [ 'value' ] ;
@@ -466,8 +457,20 @@ export function table<Row extends RowObj, const Opts extends TableOpts<Row>>(
466457 if ( row . typeName === undefined ) {
467458 row . typeName = toPascalCase ( tableName ) ;
468459 }
460+
461+ // Build index source names using accName
462+ for ( const index of indexes ) {
463+ const cols =
464+ index . algorithm . tag === 'Direct'
465+ ? [ index . algorithm . value ]
466+ : index . algorithm . value ;
467+
468+ const colS = cols . map ( i => colNameList [ i ] ) . join ( '_' ) ;
469+ index . sourceName = `${ accName } _${ colS } _idx_${ index . algorithm . tag . toLowerCase ( ) } ` ;
470+ }
471+
469472 return {
470- sourceName : tableName ,
473+ sourceName : accName ,
471474 productTypeRef : ctx . registerTypesRecursively ( row ) . ref ,
472475 primaryKey : pk ,
473476 indexes,
0 commit comments