Skip to content

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.

ExportTypeHolds
defaultmapping({ from, to, fields })The Mapping
fromstringThe Source or Integration
toNoun nameThe Noun its records become
fieldsmapTarget property to source field, or to a function of the row

Examples

Minimal

mappings/rent-roll.ts
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.

mappings/rent-roll.ts
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 Mapping from 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.