@@ -15,6 +15,10 @@ import { dirname, join } from "path";
1515
1616const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
1717
18+ function logSchemaRegistryInfo ( message : string ) : void {
19+ process . stderr . write ( `${ message } \n` ) ;
20+ }
21+
1822export interface ConverterDefinition {
1923 from : "number" | "string" | "boolean" | "array" | "object" ;
2024 to : "string" | "number" | "date" | "boolean" | "array" | "object" ;
@@ -398,7 +402,7 @@ export class SchemaRegistryService {
398402 for ( const field of options . fields_to_add || [ ] ) {
399403 // Skip if field already exists
400404 if ( mergedFields [ field . field_name ] ) {
401- console . log (
405+ logSchemaRegistryInfo (
402406 `[SCHEMA_REGISTRY] Field ${ field . field_name } already exists in schema, skipping` ,
403407 ) ;
404408 continue ;
@@ -447,13 +451,13 @@ export class SchemaRegistryService {
447451 await this . activate ( options . entity_type , newVersion ) ;
448452 }
449453
450- console . log (
454+ logSchemaRegistryInfo (
451455 `[SCHEMA_REGISTRY] Incrementally updated schema for ${ options . entity_type } to version ${ newVersion } ` ,
452456 ) ;
453457
454458 // 7. Migrate raw_fragments if requested (historical data backfill only)
455459 if ( options . migrate_existing ) {
456- console . log (
460+ logSchemaRegistryInfo (
457461 `[SCHEMA_REGISTRY] Migrating existing raw_fragments for ${ options . entity_type } ` ,
458462 ) ;
459463 const fieldNamesToMigrate = [
@@ -485,7 +489,7 @@ export class SchemaRegistryService {
485489 const BATCH_SIZE = 100 ; // Smaller batch size for safety
486490 let totalMigrated = 0 ;
487491
488- console . log (
492+ logSchemaRegistryInfo (
489493 `[SCHEMA_REGISTRY] Starting migration for fields: ${ options . field_names . join ( ", " ) } ` ,
490494 ) ;
491495
@@ -525,7 +529,7 @@ export class SchemaRegistryService {
525529 continue ; // No more fragments to migrate
526530 }
527531
528- console . log (
532+ logSchemaRegistryInfo (
529533 `[SCHEMA_REGISTRY] Processing batch of ${ fragments . length } fragments for field ${ fieldName } ` ,
530534 ) ;
531535
@@ -638,7 +642,7 @@ export class SchemaRegistryService {
638642 }
639643 } else {
640644 totalMigrated += Object . keys ( promotedFields ) . length ;
641- console . log (
645+ logSchemaRegistryInfo (
642646 `[SCHEMA_REGISTRY] Migrated ${ Object . keys ( promotedFields ) . length } fields for entity ${ entityId } ` ,
643647 ) ;
644648
@@ -706,7 +710,7 @@ export class SchemaRegistryService {
706710 }
707711 }
708712
709- console . log (
713+ logSchemaRegistryInfo (
710714 `[SCHEMA_REGISTRY] Migration complete. Total fragments processed: ${ totalMigrated } ` ,
711715 ) ;
712716
0 commit comments