Skip to content

@centralping/ergo-router

Version [0.4.0]

Changed

  • BREAKING: Pipeline builder uses config objects instead of tuples. (#83) Aligned with @centralping/ergo@0.4.0 compose-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.use accepts Array<function|{fn: function, setPath: string}>. Requires @centralping/ergo >= 0.4.0 < 0.5.0.

Fixed

  • Transport Referrer-Policy default aligned with shared primitive. Changed TRANSPORT_DEFAULTS.referrerPolicy from 'strict-origin-when-cross-origin' to 'no-referrer', matching @centralping/ergo’s lib/security-headers.js default, the pipeline middleware, and all website documentation. Added contract test for Referrer-Policy header. (#80)
  • Generic propagation to route methods. Router route methods (get, post, put, patch, delete) now propagate the RouteConfig<A> generic type parameter, allowing TypeScript consumers to pass typed route configs with full domainAcc inference in execute callbacks. Previously, route methods accepted only RouteConfig (defaulting to Record<string, unknown>), which caused type errors under strictFunctionTypes when passing RouteConfig<SpecificType>. The default A = Record<string, unknown> preserves backward compatibility. (#79)