Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


web / app/api/import/preview-schema/helpers

app/api/import/preview-schema/helpers

Shared helpers for preview-schema endpoints (upload and URL).

Contains file parsing, field detection, URL validation, and metadata persistence logic used by both the upload and URL preview routes.

Variables

ALLOWED_MIME_TYPES

const ALLOWED_MIME_TYPES: string[]


MAX_FILE_SIZE

const MAX_FILE_SIZE: number


SAMPLE_ROW_COUNT

const SAMPLE_ROW_COUNT: 5 = 5


FILE_EXTENSION_REGEX

const FILE_EXTENSION_REGEX: RegExp


SUPPORTED_EXTENSIONS

const SUPPORTED_EXTENSIONS: string[]

Functions

detectSuggestedMappings()

detectSuggestedMappings(headers, sampleData): SuggestedMappings

Detect suggested field mappings for a sheet

Parameters

headers

string[]

sampleData

Record<string, unknown>[]

Returns

SuggestedMappings


getPreviewDir()

getPreviewDir(): string

Returns

string


parseCSVPreview()

parseCSVPreview(filePath): SheetInfo[]

Parameters

filePath

string

Returns

SheetInfo[]


parseExcelPreview()

parseExcelPreview(filePath): SheetInfo[]

Parameters

filePath

string

Returns

SheetInfo[]


parseFileSheets()

parseFileSheets(filePath, fileExtension): SheetInfo[]

Parse file sheets based on file extension.

Parameters

filePath

string

fileExtension

string

Returns

SheetInfo[]


savePreviewMetadata()

savePreviewMetadata(opts): void

Save preview metadata to disk. Intentionally omits authConfig to avoid persisting secrets to disk.

Parameters

opts
previewId

string

userId

number

originalName

string

filePath

string

mimeType

string

fileSize

number

sourceUrl?

string

Returns

void

References

AuthConfig

Re-exports AuthConfig


SheetInfo

Re-exports SheetInfo


SuggestedMappings

Re-exports SuggestedMappings


validateUrl

Renames and re-exports validateExternalHttpUrl

Last updated on