Skip to content

Commit c99a841

Browse files
committed
refactor(tables): keep TTL CSV parsing in import switch
1 parent 6d1a40b commit c99a841

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

apps/sim/lib/table/column-types/ttl.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ export const ttlColumnType: ColumnTypeDefinition = {
8383
return seconds === null ? { ok: false } : { ok: true, value: seconds }
8484
},
8585

86-
coerceImport(value, options) {
87-
return parseTtlEpochSeconds(value, options) ?? String(value)
88-
},
89-
9086
valueForConversion(value, target: ColumnDefinition) {
9187
if (target.type !== 'date') return value
9288
return epochSecondsToIso(value) ?? value

apps/sim/lib/table/import.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import type { Options as CsvParseOptions } from 'csv-parse'
1515
import { OrchestrationError } from '@/lib/core/orchestration/types'
1616
import { getColumnId } from '@/lib/table/column-keys'
1717
import type { ColumnType } from '@/lib/table/column-types'
18+
import { parseTtlEpochSeconds } from '@/lib/table/column-types/ttl'
1819
import { parseCurrencyInput } from '@/lib/table/currency'
1920
import { type NormalizeDateCellOptions, normalizeDateCellValue } from '@/lib/table/dates'
2021
import type { ColumnDefinition, RowData, TableSchema } from '@/lib/table/types'
@@ -502,6 +503,9 @@ export function coerceValue(
502503
case 'date': {
503504
return normalizeDateCellValue(String(value), options) ?? String(value)
504505
}
506+
case 'ttl': {
507+
return parseTtlEpochSeconds(value, options) ?? String(value)
508+
}
505509
case 'json': {
506510
if (typeof value === 'object') return value as Record<string, unknown> | unknown[]
507511
try {

0 commit comments

Comments
 (0)