@bearei/contracts 2.0.0 → 2.1.0
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/CHANGELOG.md +31 -7
- package/README.md +11 -11
- package/README.zh-CN.md +10 -10
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -4,14 +4,38 @@ All notable changes to this project are documented in this file. The format is b
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to
|
|
5
5
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## 2.1.0 — 2026-10-27
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `HTTP_EXCEPTION_CODE.CONFLICT` (`409000`) for writes that lose a race with a concurrent request
|
|
12
|
+
and collide with existing data. It is returned with HTTP status `409`; `SERVICE_FIELDS_ALREADY_EXISTS`
|
|
13
|
+
(`400003`) keeps its existing meaning for pre-validation rejections.
|
|
14
|
+
|
|
15
|
+
## 2.0.0-dev.3 — 2026-10-27
|
|
16
|
+
|
|
17
|
+
Development snapshot published under the `next` dist-tag to verify the unified release pipeline
|
|
18
|
+
across all Bearei repositories: the artifact is pulled back from the registry, re-verified and
|
|
19
|
+
attached to the GitHub release. It matches the 2.0.0 scope documented below and leaves the
|
|
20
|
+
`latest` dist-tag unchanged.
|
|
21
|
+
|
|
22
|
+
Install it with `yarn add @bearei/contracts@next` or pin `@bearei/contracts@2.0.0-dev.3`.
|
|
23
|
+
|
|
24
|
+
## 2.0.0-dev.2 — 2026-10-27
|
|
25
|
+
|
|
26
|
+
Development snapshot published under the `next` dist-tag to verify the npm trusted publishing
|
|
27
|
+
pipeline. It matches the 2.0.0 scope documented below and leaves the `latest` dist-tag unchanged.
|
|
28
|
+
|
|
29
|
+
Install it with `yarn add @bearei/contracts@next` or pin `@bearei/contracts@2.0.0-dev.2`.
|
|
30
|
+
|
|
7
31
|
## 2.0.0 — 2026-10-26
|
|
8
32
|
|
|
9
33
|
### Added
|
|
10
34
|
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
35
|
+
- `HTTP_EXCEPTION_CODE` and `HttpExceptionCode`, moved from `@bearei/nest` without changing any
|
|
36
|
+
numeric value.
|
|
37
|
+
- `ApiErrorBody` with the normalized `{code, message, statusCode}` shape.
|
|
38
|
+
- `DEFAULT_PAGE_SIZE`, `MAX_PAGE_SIZE`, `PaginationQuery` and `PaginatedResult<T>`.
|
|
39
|
+
- `RESERVED_REQUEST_HEADER` and `ReservedRequestHeaderName` for the six `x-bearei-*` headers.
|
|
40
|
+
- `LANGUAGE`, `Language`, `ORDER` and `Order`, moved from `@bearei/nest`.
|
|
41
|
+
- Dual ESM and CommonJS builds with matching declaration files.
|
package/README.md
CHANGED
|
@@ -5,15 +5,15 @@ runtime dependencies and ships both ESM and CommonJS builds.
|
|
|
5
5
|
|
|
6
6
|
English | [中文](./README.zh-CN.md)
|
|
7
7
|
|
|
8
|
-
| Export
|
|
9
|
-
|
|
|
10
|
-
| `HTTP_EXCEPTION_CODE`, `HttpExceptionCode`
|
|
11
|
-
| `ApiErrorBody`
|
|
12
|
-
| `DEFAULT_PAGE_SIZE`, `MAX_PAGE_SIZE`
|
|
13
|
-
| `PaginationQuery`, `PaginatedResult<T>`
|
|
14
|
-
| `RESERVED_REQUEST_HEADER`, `ReservedRequestHeaderName`
|
|
15
|
-
| `LANGUAGE`, `Language`
|
|
16
|
-
| `ORDER`, `Order`
|
|
8
|
+
| Export | Kind | Purpose |
|
|
9
|
+
| ------------------------------------------------------ | ----- | --------------------------------------------------- |
|
|
10
|
+
| `HTTP_EXCEPTION_CODE`, `HttpExceptionCode` | value | Numeric error codes shared by services and clients |
|
|
11
|
+
| `ApiErrorBody` | type | Normalized error body `{code, message, statusCode}` |
|
|
12
|
+
| `DEFAULT_PAGE_SIZE`, `MAX_PAGE_SIZE` | value | Paging limits used by every list endpoint |
|
|
13
|
+
| `PaginationQuery`, `PaginatedResult<T>` | type | Paging request fields and page envelope |
|
|
14
|
+
| `RESERVED_REQUEST_HEADER`, `ReservedRequestHeaderName` | value | Headers set by the gateway or authentication layer |
|
|
15
|
+
| `LANGUAGE`, `Language` | value | Locale values |
|
|
16
|
+
| `ORDER`, `Order` | value | Sort order values |
|
|
17
17
|
|
|
18
18
|
## Install
|
|
19
19
|
|
|
@@ -70,6 +70,6 @@ existing value; renaming a code is also a breaking change for consumers that imp
|
|
|
70
70
|
|
|
71
71
|
```bash
|
|
72
72
|
yarn install
|
|
73
|
-
yarn verify # lint + typecheck + coverage + build
|
|
74
|
-
yarn pack
|
|
73
|
+
yarn verify # format + lint + typecheck + coverage + build
|
|
74
|
+
yarn run pack # pack once and inspect the tarball
|
|
75
75
|
```
|
package/README.zh-CN.md
CHANGED
|
@@ -5,15 +5,15 @@ ESM 与 CommonJS 两种产物。
|
|
|
5
5
|
|
|
6
6
|
[English](./README.md) | 中文
|
|
7
7
|
|
|
8
|
-
| 导出
|
|
9
|
-
|
|
|
10
|
-
| `HTTP_EXCEPTION_CODE`、`HttpExceptionCode`
|
|
11
|
-
| `ApiErrorBody`
|
|
12
|
-
| `DEFAULT_PAGE_SIZE`、`MAX_PAGE_SIZE`
|
|
13
|
-
| `PaginationQuery`、`PaginatedResult<T>`
|
|
14
|
-
| `RESERVED_REQUEST_HEADER`、`ReservedRequestHeaderName`
|
|
15
|
-
| `LANGUAGE`、`Language`
|
|
16
|
-
| `ORDER`、`Order`
|
|
8
|
+
| 导出 | 类型 | 用途 |
|
|
9
|
+
| ------------------------------------------------------ | ---- | ---------------------------------------- |
|
|
10
|
+
| `HTTP_EXCEPTION_CODE`、`HttpExceptionCode` | 值 | 服务与客户端共享的数字错误码 |
|
|
11
|
+
| `ApiErrorBody` | 类型 | 统一错误体 `{code, message, statusCode}` |
|
|
12
|
+
| `DEFAULT_PAGE_SIZE`、`MAX_PAGE_SIZE` | 值 | 所有列表接口使用的分页上限 |
|
|
13
|
+
| `PaginationQuery`、`PaginatedResult<T>` | 类型 | 分页请求字段与分页响应信封 |
|
|
14
|
+
| `RESERVED_REQUEST_HEADER`、`ReservedRequestHeaderName` | 值 | 由网关或认证层写入的保留请求头 |
|
|
15
|
+
| `LANGUAGE`、`Language` | 值 | 语言值 |
|
|
16
|
+
| `ORDER`、`Order` | 值 | 排序值 |
|
|
17
17
|
|
|
18
18
|
## 安装
|
|
19
19
|
|
|
@@ -71,5 +71,5 @@ const page: PaginatedResult<{id: string}> = {
|
|
|
71
71
|
```bash
|
|
72
72
|
yarn install
|
|
73
73
|
yarn verify # lint + typecheck + 覆盖率 + 构建
|
|
74
|
-
yarn pack
|
|
74
|
+
yarn run pack # 打包一次并检查 tarball
|
|
75
75
|
```
|
package/dist/index.d.mts
CHANGED
|
@@ -9,6 +9,7 @@ declare const HTTP_EXCEPTION_CODE: {
|
|
|
9
9
|
readonly APPLE_IAP_TRANSACTION_VERIFICATION_FAILED: 403005;
|
|
10
10
|
readonly BAD_GATEWAY: 502000;
|
|
11
11
|
readonly BAD_REQUEST: 400000;
|
|
12
|
+
readonly CONFLICT: 409000;
|
|
12
13
|
readonly CONTAINS_INVALID_REQUEST_HEADERS: 400001;
|
|
13
14
|
readonly EMAIL_CODE_INVALID: 401004;
|
|
14
15
|
readonly EMAIL_SENDING_FAILED: 400005;
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ declare const HTTP_EXCEPTION_CODE: {
|
|
|
9
9
|
readonly APPLE_IAP_TRANSACTION_VERIFICATION_FAILED: 403005;
|
|
10
10
|
readonly BAD_GATEWAY: 502000;
|
|
11
11
|
readonly BAD_REQUEST: 400000;
|
|
12
|
+
readonly CONFLICT: 409000;
|
|
12
13
|
readonly CONTAINS_INVALID_REQUEST_HEADERS: 400001;
|
|
13
14
|
readonly EMAIL_CODE_INVALID: 401004;
|
|
14
15
|
readonly EMAIL_SENDING_FAILED: 400005;
|
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bearei/contracts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Framework-agnostic wire contracts shared by Bearei services, clients and apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bearei",
|
|
@@ -35,8 +35,7 @@
|
|
|
35
35
|
"./package.json": "./package.json"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
|
-
"dist"
|
|
39
|
-
"CHANGELOG.md"
|
|
38
|
+
"dist"
|
|
40
39
|
],
|
|
41
40
|
"sideEffects": false,
|
|
42
41
|
"engines": {
|
|
@@ -46,9 +45,9 @@
|
|
|
46
45
|
"access": "public"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
|
-
"@bearei/eslint-config": "^2.0.
|
|
50
|
-
"@bearei/jest-preset": "^2.0.
|
|
51
|
-
"@bearei/tsconfig": "^2.0.
|
|
48
|
+
"@bearei/eslint-config": "^2.1.0-dev.2",
|
|
49
|
+
"@bearei/jest-preset": "^2.1.0-dev.2",
|
|
50
|
+
"@bearei/tsconfig": "^2.1.0-dev.2",
|
|
52
51
|
"@types/jest": "^29.5.13",
|
|
53
52
|
"eslint": "^9.37.0",
|
|
54
53
|
"jest": "^29.7.0",
|
|
@@ -77,13 +76,14 @@
|
|
|
77
76
|
},
|
|
78
77
|
"scripts": {
|
|
79
78
|
"build": "tsup",
|
|
79
|
+
"format": "prettier --write .",
|
|
80
80
|
"lint": "eslint \"src/**/*.ts\"",
|
|
81
|
-
"pack
|
|
81
|
+
"pack": "yarn pack -o /tmp/bearei-contracts.tgz && bash .github/scripts/verify-tarball.sh /tmp/bearei-contracts.tgz",
|
|
82
82
|
"prepack": "yarn build",
|
|
83
83
|
"test": "jest",
|
|
84
84
|
"test:coverage": "jest --coverage",
|
|
85
85
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
86
|
-
"verify": "yarn lint && yarn typecheck && yarn test:coverage && yarn build"
|
|
86
|
+
"verify": "yarn prettier --check . && yarn lint && yarn typecheck && yarn test:coverage && yarn build"
|
|
87
87
|
},
|
|
88
|
-
"packageManager": "yarn@4.18.0"
|
|
88
|
+
"packageManager": "yarn@4.18.0+sha512.fcb8716fe7cd0eece141ffc18b92193a9df9204c1ba83189c288835223fc0bbe64af473bab0d5e9927a7daeb5caf2bb07eb2787cc9338ca040ea125f2a1f2f7e"
|
|
89
89
|
}
|