@baijimu/cmodel 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Strict TypeScript types and parser for Baijimu CModel Error Contract `1.0.0`.
4
4
 
5
5
  ```bash
6
- npm install @baijimu/cmodel@1.1.1
6
+ npm install @baijimu/cmodel@1.1.2
7
7
  ```
8
8
 
9
9
  ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EAEpB,MAAM,YAAY,CAAC;AAIpB,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK1C;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC,CAAC;AAEhE,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,GACvB,cAAc,CAAC,CAAC,CAAC,CAsCnB"}
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EAEpB,MAAM,YAAY,CAAC;AAIpB,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK1C;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC,CAAC;AAEhE,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,GACvB,cAAc,CAAC,CAAC,CAAC,CAwCnB"}
package/dist/parser.js CHANGED
@@ -10,8 +10,10 @@ export class CModelContractError extends Error {
10
10
  }
11
11
  export function parseCModelResponse(httpStatus, input, parseData) {
12
12
  const envelope = envelopeAt(input, "$");
13
- requiredKeys(envelope, "$", ["contractVersion", "errorCode", "data"]);
14
- const contractVersion = stringAt(envelope.contractVersion, "$.contractVersion", 1, 64);
13
+ requiredKeys(envelope, "$", ["errorCode", "data"]);
14
+ const contractVersion = envelope.contractVersion === undefined
15
+ ? CONTRACT_VERSION
16
+ : stringAt(envelope.contractVersion, "$.contractVersion", 1, 64);
15
17
  if (contractVersion !== CONTRACT_VERSION) {
16
18
  fail("$.contractVersion", `unsupported contract version ${contractVersion}`);
17
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baijimu/cmodel",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Strict TypeScript parser and types for the Baijimu CModel Error Contract",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",