Source mapping
A Source mapping translates one Source's records into the Startup's Nouns, field by field.
| Property | Value |
|---|---|
| Path | mappings/ |
| Holds | Source |
| Kind | file |
| Leaders | db-first, git-first |
| Team | Engineering Team |
| Written by | Change.merge |
| Compiled by | SoftwareBuilder |
Example
mappings/ in a Startup repository.
import { mapping } from 'startup-builder'
export default mapping({
from: 'csv',
to: 'Transaction',
fields: {
occurredAt: 'Date',
description: 'Description',
amount: (row) => ({ amount: Number(row['Amount']), currency: 'USD' }),
},
})Exports
| Export | Kind | Type |
|---|---|---|
default | default | Mapping |
Signature
mapping(definition: { from: string; to: string; fields: Record<string, string | ((row: Row) => unknown)> }): MappingGenerates
SoftwareBuilder compiles it into these records, Verbs and routes.