web / lib/types/flow-mapping
lib/types/flow-mapping
Flow-specific types for the visual field mapping editor.
These types define the node and edge structures used by the xyflow-based visual editor. They reference the shared TransformConfig types for transform nodes to ensure consistency with the traditional form-based UI.
Interfaces
SourceColumnNodeData
Data for a source column node (left side of flow) Represents a column from the uploaded file
Extends
Record<string,unknown>
Indexable
[key: string]: unknown
Properties
columnName
columnName:
string
Column name from the file header
sheetIndex
sheetIndex:
number
Sheet index for multi-sheet files
sheetName
sheetName:
string
Sheet name for display
sampleValues
sampleValues:
unknown[]
Sample values from the first few rows
inferredType
inferredType:
"string"|"number"|"boolean"|"date"|"mixed"
Inferred data type based on content
confidence
confidence:
number
Confidence level from auto-detection (0-1)
isConnected
isConnected:
boolean
Whether this column is currently connected
TargetFieldNodeData
Data for a target field node (right side of flow) Represents a destination field in the event schema
Extends
Record<string,unknown>
Indexable
[key: string]: unknown
Properties
fieldKey
fieldKey:
"titleField"|"descriptionField"|"locationNameField"|"dateField"|"idField"|"locationField"|"latitudeField"|"longitudeField"
Key matching FieldMapping interface
label
label:
string
Display label for the field
icon
icon:
string
Icon name (from lucide-react)
required
required:
boolean
Whether this field is required for import
description
description:
string
Description of what this field is used for
isConnected
isConnected:
boolean
Whether this field is currently connected
connectedColumn
connectedColumn:
string|null
The source column name if connected
TransformNodeData
Data for a transform node (middle of flow) Uses the shared ImportTransform for configuration
Extends
Record<string,unknown>
Indexable
[key: string]: unknown
Properties
transform
transform:
ImportTransform
The transform configuration
isEditing
isEditing:
boolean
Whether this node is currently selected for editing
FlowMappingEdgeData
Data attached to edges for validation status
Extends
Record<string,unknown>
Indexable
[key: string]: unknown
Properties
isValid
isValid:
boolean
Whether this edge represents a valid mapping
validationError?
optionalvalidationError:string
Validation error message if invalid
sampleValue?
optionalsampleValue:unknown
Sample value being passed through
confidence?
optionalconfidence:number
Confidence level if auto-detected (0-1)
Type Aliases
FlowMappingNodeType
FlowMappingNodeType =
"source-column"|"target-field"|"transform"
Custom node types for the flow editor
FlowMappingNodeData
FlowMappingNodeData =
SourceColumnNodeData|TargetFieldNodeData|TransformNodeData
Union of all flow mapping node data types
SourceColumnNode
SourceColumnNode =
Node<SourceColumnNodeData,"source-column">
Typed node for source columns
TargetFieldNode
TargetFieldNode =
Node<TargetFieldNodeData,"target-field">
Typed node for target fields
TransformNode
TransformNode =
Node<TransformNodeData,"transform">
Typed node for transforms
FlowMappingNode
FlowMappingNode =
SourceColumnNode|TargetFieldNode|TransformNode
Union of all flow mapping nodes
FlowMappingEdge
FlowMappingEdge =
Edge<FlowMappingEdgeData>
Typed edge for flow mappings
Variables
TARGET_FIELD_DEFINITIONS
constTARGET_FIELD_DEFINITIONS:object[]
Target field definitions with metadata
Type Declaration
fieldKey
fieldKey:
TargetFieldNodeData["fieldKey"]
label
label:
string
icon
icon:
string
required
required:
boolean
description
description:
string
Functions
createSourceNodes()
createSourceNodes(
headers,sampleData,sheetIndex,sheetName):SourceColumnNode[]
Helper to create initial nodes from sheet data
Parameters
headers
string[]
sampleData
Record<string, unknown>[]
sheetIndex
number
sheetName
string
Returns
createTargetNodes()
createTargetNodes(
startY?):TargetFieldNode[]
Helper to create target field nodes
Parameters
startY?
number = 50