mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-09 16:49:08 +00:00
UPDATE: type CDC input calls against the protospack gRPC contracts
Review (maestro #510): drop every 'as any' on the Input write client (AddCdcTable/RemoveCdcTable/UnmarkTableDeleted take the generated request types), type IPipelineV2.config, and build the CdcTable payload in one mapper so 'name' mirrors table_name in a single place. isCdc via helper, no '!!'. Co-Authored-By: WOZCODE <contact@withwoz.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import {
|
||||
CdcColumn,
|
||||
CdcTable,
|
||||
} from '@dadosfera/protospack-v2/dist/lib/Input/interfaces/entities';
|
||||
|
||||
/** What a caller knows about a CDC table before it is stored. */
|
||||
export interface CdcTableInput {
|
||||
// Optional on the create DTO (CdcTableReq); the platform validates it.
|
||||
table_schema?: string;
|
||||
table_name: string;
|
||||
primary_keys?: string[];
|
||||
iceberg_table_name?: string;
|
||||
iceberg_qualify_table_name?: string;
|
||||
columns?: CdcColumn[];
|
||||
column_exclude_list?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* The only place maestro builds a protospack `CdcTable`.
|
||||
*
|
||||
* `name` is the identity key shared with batch `NewTable` (in-factory keys
|
||||
* update/soft-delete on it) and the proto keeps it required, so it mirrors
|
||||
* `table_name` here and nowhere else. Follow-up (protospack): make `name`
|
||||
* optional and let in-factory be its sole writer (it already backfills
|
||||
* `name ?? table_name`).
|
||||
*/
|
||||
export function toCdcTable(table: CdcTableInput): CdcTable {
|
||||
return {
|
||||
table_schema: table.table_schema,
|
||||
table_name: table.table_name,
|
||||
name: table.table_name,
|
||||
primary_keys: table.primary_keys ?? [],
|
||||
iceberg_table_name: table.iceberg_table_name,
|
||||
iceberg_qualify_table_name: table.iceberg_qualify_table_name,
|
||||
columns: table.columns ?? [],
|
||||
column_exclude_list: table.column_exclude_list ?? [],
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user