Reference
Adapters
Every source, destination, enricher, transformer, and processor in Routecraft. Each card opens its own reference page with the full signature, options, and examples.
Core
08simple()SourceStatic or dynamic data source from a value or function.
log()DestinationConsole logging for debugging and inspection.
debug()DestinationVerbose dump of the full exchange for development.
timer()SourceRecurring source on a fixed interval.
cron()SourceCron-scheduled source with timezone support.
event()SourceInternal event bus source for cross-route signalling.
direct()SourceEnricherSynchronous route-to-route plumbing with type safety.
http()SourceEnricherHTTP client for outbound requests and an HTTP server (via defineConfig({ http })) for exposing routes.
Test
03File
07file()SourceDestinationEnricherRead or write a single text file (per-line chunked reads).
directory()SourceEnricherScan a directory for files, with metadata to filter on; list or per-file.
json()SourceDestinationEnricherTransformerParse, write, or transform JSON files.
csv()SourceDestinationEnricherTransformerStream rows from a CSV file or write rows out.
jsonl()SourceDestinationEnricherTransformerStream JSON Lines records or write a JSONL file.
html()SourceDestinationEnricherTransformerParse or write HTML, with DOM-style selection helpers.
xml()SourceDestinationEnricherTransformerParse, write, or transform XML as a plain object.
Messaging
01Contacts
01Browser
01AI
04Clustering
02Parse error handling
Source adapters that convert raw bytes into a structured body (json, html, csv, jsonl, xml, mail) accept a uniform onParseError option that controls what happens when parsing fails (malformed JSON, structurally-invalid CSV row, broken MIME, etc.). The default is 'fail'.
All three modes are observable on the events bus, parse failures are never silent.
// Default: route per-line parse errors through .error(), keep streaming.
craft()
.from(jsonl({ path: './events.jsonl', chunked: true }))
.error((err, exchange) => {
log.warn({ err, line: exchange.headers['routecraft.jsonl.line'] }, 'bad line')
return null
})
.filter((e) => e.body != null)
.to(db())
// Stop the stream on the first malformed row (atomic-import semantics).
craft().from(csv({ path: './daily.csv', chunked: true, onParseError: 'abort' })).to(load())
// Drop unparseable mail with structured event observability.
craft().from(mail('INBOX', { onParseError: 'drop' })).to(process())
// Subscribe to parse drops across all routes:
ctx.on('route:exchange:dropped', ({ details }) => {
if (details.reason === 'parse-failed') metrics.increment('source.parse.dropped')
})
Internally, all three modes defer parsing to a synthetic first pipeline step injected by the runtime, so exchange:started fires before parsing runs. The synthetic step decides per-mode whether to throw ('fail'/'abort') or emit exchange:dropped ('drop').
Related
Operations
Verbs that act on the exchange between source and destination.
Configuration
Project-level options and craft.config.ts.
Errors
Error codes, lifecycle, and recovery via .error().