@baijimu/cmodel
v9.0.0
Published
Strict TypeScript parser and types for the Baijimu CModel Error Contract
Downloads
6,080
Readme
@baijimu/cmodel
Strict TypeScript types and parser for Baijimu CModel Error Contract 1.0.0.
npm install @baijimu/[email protected]import { parseCModelResponse } from "@baijimu/cmodel";
const response = parseCModelResponse(httpStatus, body, (value) => value);CModel producers return HTTP 200 for both success and business failure. Consumers determine the
business outcome only from errorCode; non-zero values are failures. The parser temporarily accepts
legacy non-200 failure envelopes so services can roll forward without an atomic fleet deployment.
An absent contractVersion is interpreted as CModel Error Contract 1.0.0. Explicit versions are validated strictly and unsupported versions are rejected.
Failure data may remain null or contain the standard public detail { message, retryable }.
message is safe for user display, while retryable controls retry policy; consumers must still
classify failures only by errorCode.
The public package contains only the protocol types and validation logic. It does not include Baijimu's internal service catalog or internal data models. See https://docs.baijimu.com/integration/cmodel-error-model/.
