Mappings
A file in mappings/ maps one Source's shape into the Startup's Nouns and Verbs.
A file in mappings/ maps one Source's shape into the Startup's Nouns: an Integration's records, or a Dataset's input.
mappings/rent-roll.tsa property manager's rent roll, into Lease
Reference
TypeScript with one default export.
| Export | Type | Holds |
|---|---|---|
default | mapping({ from, | The Mapping |
from | string | The Source or Integration |
to | Noun name | The Noun its records become |
fields | map | Target property to source field, or to a function of the row |
Examples
Minimal
import { mapping } from 'startup-builder'
export default mapping({ from: 'csv', to: 'Lease', fields: { unit: 'Unit' } })Leaseline
Leaseline declares a Lease Noun and imports each customer's rent roll.
import { mapping } from 'startup-builder'
export default mapping({
from: 'csv',
to: 'Lease',
fields: {
unit: 'Unit',
endsOn: (row) => new Date(row['Lease End']).toISOString().slice(0, 10),
rent: (row) => ({ amount: Number(row['Monthly Rent']), currency: 'USD' }),
},
})What it builds
The SoftwareBuilder compiles the file into one Mapping.
- a
Mappingfrom the Source's fields to the Noun's properties - each imported row resolves with
Thing.resolve, so a re-import updates and never duplicates - an Integration's actions arrive as Verbs through it
Good to know
- A row that fails a type is set aside with its reason, never dropped.
- Integrations lists what each System connects to.