1+ import { isRecordLike } from '@sim/utils/object'
12/**
23 * Finds workflow Table blocks whose saved configuration still names a column by
34 * its old name after a rename.
@@ -39,13 +40,9 @@ const TABLE_ID_SUB_BLOCKS = ['manualTableId', 'tableSelector', 'tableId'] as con
3940
4041const TABLE_BLOCK_TYPE = 'table_v2'
4142
42- function isRecord ( value : unknown ) : value is Record < string , unknown > {
43- return typeof value === 'object' && value !== null && ! Array . isArray ( value )
44- }
45-
4643function subBlockValue ( subBlocks : SubBlockValues , id : string ) : unknown {
4744 const entry = subBlocks [ id ]
48- return isRecord ( entry ) ? entry . value : undefined
45+ return isRecordLike ( entry ) ? entry . value : undefined
4946}
5047
5148/** The raw text of a sub-block, or `undefined` when it holds nothing. */
@@ -70,7 +67,7 @@ export function isTableBlockBoundTo(subBlocks: SubBlockValues, tableId: string):
7067
7168/** Every column a row payload names: the keys of the `{ column: value }` object. */
7269function collectDataFieldNames ( root : unknown ) : string [ ] {
73- return isRecord ( root ) ? Object . keys ( root ) : [ ]
70+ return isRecordLike ( root ) ? Object . keys ( root ) : [ ]
7471}
7572
7673const FIELD_COLLECTORS : Record < TableBlockColumnReferenceField , ( root : unknown ) => string [ ] > = {
@@ -147,7 +144,7 @@ export async function findUnmigratedTableBlockReferences(input: {
147144
148145 const unmigrated : UnmigratedTableBlockReference [ ] = [ ]
149146 for ( const row of rows ) {
150- if ( ! isRecord ( row . subBlocks ) ) continue
147+ if ( ! isRecordLike ( row . subBlocks ) ) continue
151148 const subBlocks = row . subBlocks as SubBlockValues
152149 if ( ! isTableBlockBoundTo ( subBlocks , input . tableId ) ) continue
153150 const fields = collectTableBlockColumnReferences ( subBlocks , input . columnName )
0 commit comments