Releases: BitGo/api-ts
Releases · BitGo/api-ts
@api-ts/[email protected]
@api-ts/[email protected]
@api-ts/typed-express-router 2.0.0 (2025-08-01)
Features
- opentelemetry: create otel instrumentation for typed-express-router (296a92e)
BREAKING CHANGES
- opentelemetry: To enforce stricter checks for http response sending types, there is now a check that the response is in a JSON format. This will make it more difficult to send a response or accidentally send a malformed response.
wrapRouter
modified to create decode and encode spans if@opentelemetry/api
is installed- if
@opentelemetry/api
is not installed, spans are not created
- if
onDecodeError
option removed. Please usedecodeErrorFormatter
andgetDecodeErrorStatusCode
decodeErrorFormatter
takes in an array ofValidationError
s and aWrappedRequest
, returning aJson
object.getDecodeErrorStatusCode
takes in an array ofValidationError
s and aWrappedRequest
, returning a number.
onEncodeError
option removed. Please useencodeErrorFormatter
andgetEncodeErrorStatusCode
encodeErrorFormatter
takes in an error and aWrappedRequest
, returning aJson
object.getEncodeErrorStatusCode
takes in an error and aWrappedRequest
, returning a number.
typed-express-router
now handles the sending of the http response when there is a decode or encode error
Consequently, to use createRouter
or wrapRouter
, instead of using onDecodeError
and onEncodeError
:
const router = createRouter(spec, {
onDecodeError: (errs, req, res) => {
const validationErrorMessage = /* use errs to craft an error message */;
res.status(400).json({ error: validationErrorMessage }).end();
},
onEncodeError: (err, req, res) => {
const encodeErrorMessage = /* use err to craft an error message */;
res.status(500).json({ error: encodeErrorMessage }).end();
},
});
We now use decodeErrorFormatter
, getDecodeErrorStatusCode
, encodeErrorFormatter
, and getEncodeErrorStatusCode
:
const router = createRouter(spec, {
decodeErrorFormatter: (errs, req) => {
const validationErrorMessage = /* use errs to craft an error message */;
return ({error: validationErrorMessage});
},
getDecodeErrorStatusCode: (errs, req) => {
return 400;
},
encodeErrorFormatter: (err, req) => {
const encodeErrorMessage = /* use err to craft an error message */;
return ({error: encodeErrorMessage});
},
getEncodeErrorStatusCode: (err, req) => {
return 500;
},
});
@api-ts/[email protected]
@api-ts/express-wrapper 2.0.0 (2025-08-01)
Features
- opentelemetry: create otel instrumentation for typed-express-router (296a92e)
BREAKING CHANGES
- opentelemetry:
onDecodeError
andonEncodeError
have been removed. Please usedecodeErrorFormatter
,getDecodeErrorStatusCode
,encodeErrorFormatter
, andgetEncodeErrorStatusCode
Dependencies
- @api-ts/typed-express-router: upgraded to 2.0.0
@api-ts/[email protected]
@api-ts/[email protected]
@api-ts/[email protected]
@api-ts/[email protected]
@api-ts/[email protected]
@api-ts/typed-express-router 1.1.14 (2025-07-18)
Dependencies
- @api-ts/superagent-wrapper: upgraded to 1.3.4
@api-ts/[email protected]
@api-ts/[email protected]
@api-ts/express-wrapper 1.0.34 (2025-07-18)
Dependencies
- @api-ts/typed-express-router: upgraded to 1.1.14
- @api-ts/superagent-wrapper: upgraded to 1.3.4