All versions since [0.3.0]
[0.3.0]
Added
-
paginatepipeline config key. Declarative route configs accept apaginatekey that wires ergo’spaginate()middleware into Stage 1 (Negotiation), after URL parsing. Automatically includes URL parsing when active (regardless of HTTP method). When enabled,send()receivespaginate: truefor automatic Link header andX-Total-Countgeneration. Supports offset-based (paginate: true) and cursor-based (paginate: {strategy: 'cursor'}) pagination strategies via ergo’s pagination primitives. (#71) -
presets.jsonApiconvenience export. A deeply frozenRouterOptionsobject that enables transport-level request ID and security headers, and restricts content negotiation toapplication/json. Consumers spread it intocreateRouter()for one-liner JSON API configuration. Excludes deployment-specific concerns (auth, CORS origin, rate limiting). Available viaimport {presets} from '@centralping/ergo-router'. (#70) -
Typed
RouteConfigwith generic accumulator. Hand-written TypeScript declaration overrides (types-override/) provide precise type information for declarative route configuration. Each middleware key is typed with its specific ergo option interface (e.g.,AcceptsOptions,BodyOptions) instead of genericobject | boolean. Theexecutecallback’s domain accumulator accepts a generic type parameterRouteConfig<A>(defaults toRecord<string, unknown>), enabling consumers to annotate their accumulator shape for type-safe property access.RouterOptions,TransportOptions,GracefulOptions, and theRouterinstance are also fully typed. Adopts thetypes-overridepattern established in@centralping/ergo. (#68)
Changed
- Config value type validation at registration time. Declarative route config values,
createRouter()options, andoptions.defaultsare now validated for correct types at registration time. Invalid values (e.g.,timeout: 'five seconds',rateLimit: 42,validate: [1,2,3]) throw immediately with descriptive error messages instead of causing cryptic runtime errors at request time. Pipeline middleware keys acceptboolean | object; route option keys enforce their specific types (send: object,noSend: boolean,catchHandler: function); router option keys enforce per-key types. Value type errors always throw regardless ofstrictsetting. (#69) - Bumped
@centralping/ergopeer dependency range to>=0.3.0 <0.4.0(was>=0.2.0 <0.3.0). Floor bumped to 0.3.0 forpaginatemiddleware factory import. (#71)
[0.4.0]
Changed
- BREAKING: Pipeline builder uses config objects instead of tuples. (#83)
Aligned with
@centralping/ergo@0.4.0compose-with API change. Domain-producing middleware now uses{fn, setPath}config objects. Response-only middleware (rateLimit, precondition, securityHeaders, cacheControl, validate, jsonApiQuery) are plain functions.RouteConfig.useacceptsArray<function|{fn: function, setPath: string}>. Requires@centralping/ergo >= 0.4.0 < 0.5.0.
Fixed
- Transport
Referrer-Policydefault aligned with shared primitive. ChangedTRANSPORT_DEFAULTS.referrerPolicyfrom'strict-origin-when-cross-origin'to'no-referrer', matching@centralping/ergo’slib/security-headers.jsdefault, the pipeline middleware, and all website documentation. Added contract test forReferrer-Policyheader. (#80) - Generic propagation to route methods. Router route methods (
get,post,put,patch,delete) now propagate theRouteConfig<A>generic type parameter, allowing TypeScript consumers to pass typed route configs with fulldomainAccinference inexecutecallbacks. Previously, route methods accepted onlyRouteConfig(defaulting toRecord<string, unknown>), which caused type errors understrictFunctionTypeswhen passingRouteConfig<SpecificType>. The defaultA = Record<string, unknown>preserves backward compatibility. (#79)
[0.4.1]
Added
-
Accumulator type inference via
defineGet/definePost/defineRoutehelpers. (#91) New exported functions that infer the domain accumulator type from enabled middleware config keys, providing fully typedaccin execute callbacks without manual generic annotation.defineGetauto-includes{url: UrlResult}for GET/DELETE;definePostauto-includes{body: BodyResult}for POST/PUT/PATCH;defineRouteis method-agnostic. Keys set tofalsecorrectly suppress their accumulator type.paginatetransitively includes URL types.import {defineGet} from '@centralping/ergo-router';router.get('/users/:id', defineGet({authorization: true, url: true},(req, res, acc) => {acc.auth; // AuthorizationResultacc.url.query; // Record<string, string | string[]>acc.route.params; // Record<string, string>}));Known limitation: Middleware enabled via
createRouter({defaults: {...}})is not visible to type inference. Add the key explicitly to the route config for typed access. -
New type exports:
RouteConfigBase,InferAccumulator<C>,AutoGetAccumulator<C>,AutoPostAccumulator<C>— available for advanced use cases and custom inference helpers. -
timingoption oncreateRouter()forX-Response-Timeheader. (#93) Passtiming: truefor defaults ortiming: {header?, precision?}for custom configuration. Measures pipeline execution time via ares.writeHeadinterception using the sharedapplyResponseTimingprimitive from@centralping/ergo/lib/response-time. Zero overhead when disabled (default). Short-circuit responses (404, 405, 415, 429) are intentionally excluded — timing measures pipeline execution, not transport/routing overhead.
Changed
- Bumped
@centralping/ergopeer dependency floor to>=0.4.1 <0.5.0(was>=0.4.0 <0.5.0). Floor bumped to 0.4.1 forapplyResponseTimingimport fromlib/response-time. (#93)
[Unreleased] Latest
Documentation
- Route Config table now includes all valid config keys. Added
noSend,send, andcatchHandler(Route Option Keys) andidempotency(Pipeline Key) to the README Route Config table. Previously only Pipeline Keys and Annotation Keys were listed. (#98) router.use()documented in Route Methods section. Added signature, behavior description (prepended to every declarative/array pipeline), and the array-pipelines-only caveat. (#98)