Router (Deprecated)
The @walkeros/transformer-router package has been removed. Conditional routing is now built directly into the next and before config properties using the same Route[] syntax.
Migration
Replace the router transformer with Route[] on the source's next property (or any step's next/before).
Before (transformer-router)
{
"sources": {
"express": { "package": "@walkeros/server-source-express", "next": "router" }
},
"transformers": {
"router": {
"package": "@walkeros/transformer-router",
"config": {
"settings": {
"routes": [
{ "match": { "key": "path", "operator": "prefix", "value": "/gtag" }, "next": "gtag-parser" },
{ "match": "*", "next": "default-parser" }
]
}
}
},
"gtag-parser": { "package": "..." },
"default-parser": { "package": "..." }
}
}
After (native routing)
{
"sources": {
"express": {
"package": "@walkeros/server-source-express",
"next": [
{ "match": { "key": "ingest.path", "operator": "prefix", "value": "/gtag" }, "next": "gtag-parser" },
{ "match": "*", "next": "default-parser" }
]
}
},
"transformers": {
"gtag-parser": { "package": "..." },
"default-parser": { "package": "..." }
}
}
The next property now accepts three forms:
| Form | Example | Description |
|---|---|---|
string | "enricher" | Single transformer, walks transformer.next links |
string[] | ["a", "b", "c"] | Explicit chain, executed in order |
Route[] | [{ match, next }] | Conditional routing based on ingest data |
Route syntax
Each route has a match expression and a next target:
interface Route {
match: MatchExpression | '*'; // Condition or wildcard
next: string | string[] | Route[]; // Chain target (supports nesting)
}
Routes are evaluated in order. The first match wins. Use '*' as a catch-all wildcard at the end.
Match operators, logical combinators (and/or), and negation (not: true) work exactly as before. See the match expression reference for details.
Where routing works
Conditional Route[] routing works on:
source.next: route events before the collector based on ingest data (path, method, headers)transformer.next: route after a transformer based on ingest datadestination.before: route before a destination based on ingest data
Nested routes
Routes can nest to any depth:
{
"next": [
{
"match": { "key": "ingest.path", "operator": "prefix", "value": "/api" },
"next": [
{ "match": { "key": "ingest.method", "operator": "eq", "value": "POST" }, "next": "api-writer" },
{ "match": "*", "next": "api-reader" }
]
},
{ "match": "*", "next": "default" }
]
}
Performance
Routes are compiled to closures at init time. Regular expressions are compiled once. Runtime evaluation uses short-circuit logic for and/or combinators.