@bearei/contracts 3.1.0 → 3.3.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 CHANGED
@@ -4,6 +4,32 @@ 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
+ ## 3.3.0 — 2026-11-05
8
+
9
+ ### Added
10
+
11
+ - `ApiValidationErrorBody` and `ApiErrorResponseBody`: validation failures now have their own
12
+ contract (`{code, message: string[], statusCode}`), and the union lets clients type every error
13
+ body a 2.0 service returns. `ApiErrorBody` itself is unchanged.
14
+ - `ALL_PERMISSION_KEY` (`all:all`): the response sentinel `bearei-permission` returns for users
15
+ holding an `administrator` role. It is not part of `PERMISSION` and cannot be granted.
16
+
17
+ ### Changed
18
+
19
+ - `HTTP_EXCEPTION_CODE.APPLE_IAP_TRANSACTION_NOT_COMPLETED` (`403004`),
20
+ `APPLE_IAP_TRANSACTION_UNAUTHORIZED` (`401008`) and `MISSING_SUBSCRIPTION_USER_ENTITY` (`400010`)
21
+ are documented as reserved: no 2.0 service produces them. Values are unchanged; the comments stop
22
+ future releases from renumbering or reusing them.
23
+
24
+ ## 3.2.0 — 2026-10-30
25
+
26
+ ### Added
27
+
28
+ - `PAYMENT_CHANNEL`, `PaymentChannel`, `PAYMENT_ENVIRONMENT`, `PaymentEnvironment`,
29
+ `PAYMENT_EVENT_TYPE` and `PaymentEventType`: the channel, environment and event vocabulary of the
30
+ frozen payment event contract between `bearei-pay` and `bearei-subscription`. Values match the
31
+ existing service enums; the release is additive and no existing export changed.
32
+
7
33
  ## 3.1.0 — 2026-10-30
8
34
 
9
35
  ### Added
package/README.md CHANGED
@@ -5,18 +5,19 @@ runtime dependencies and ships both ESM and CommonJS builds.
5
5
 
6
6
  English | [中文](./README.zh-CN.md)
7
7
 
8
- | Export | Kind | Purpose |
9
- | ------------------------------------------------------ | ----- | --------------------------------------------------- |
10
- | `HTTP_EXCEPTION_CODE`, `HttpExceptionCode` | value | Numeric error codes shared by services and clients |
11
- | `ApiErrorBody` | type | Business 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
- | `EMAIL_TEMPLATE`, `EmailTemplate` | value | Email template values used by services and clients |
17
- | `ORDER`, `Order` | value | Sort order values |
18
- | `PERMISSION`, `Permission` | value | Permission values used by services and clients |
19
- | `SUBSCRIPTION_FEATURE`, `SubscriptionFeature` | value | Subscription feature values scoped like permissions |
8
+ | Export | Kind | Purpose |
9
+ | ---------------------------------------------------------------- | ----- | --------------------------------------------------- |
10
+ | `HTTP_EXCEPTION_CODE`, `HttpExceptionCode` | value | Numeric error codes shared by services and clients |
11
+ | `ApiErrorBody`, `ApiValidationErrorBody`, `ApiErrorResponseBody` | type | Business and validation error bodies |
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
+ | `EMAIL_TEMPLATE`, `EmailTemplate` | value | Email template values used by services and clients |
17
+ | `ORDER`, `Order` | value | Sort order values |
18
+ | `PAYMENT_CHANNEL`, `PAYMENT_ENVIRONMENT`, `PAYMENT_EVENT_TYPE` | value | Payment contract vocabulary shared by services |
19
+ | `PERMISSION`, `Permission`, `ALL_PERMISSION_KEY` | value | Permission values and the administrator sentinel |
20
+ | `SUBSCRIPTION_FEATURE`, `SubscriptionFeature` | value | Subscription feature values scoped like permissions |
20
21
 
21
22
  ## Install
22
23
 
@@ -53,8 +54,9 @@ const page: PaginatedResult<{id: string}> = {
53
54
  ```
54
55
 
55
56
  `ApiErrorBody` describes business errors raised by guards, services and shared exceptions. Request
56
- validation errors keep the NestJS default body (`statusCode`, `message`, `error`) and are not
57
- assignable to this type.
57
+ validation errors use `ApiValidationErrorBody`, which keeps the field-message array, and
58
+ `ApiErrorResponseBody` is the union of both. `ALL_PERMISSION_KEY` (`all:all`) is the response
59
+ sentinel `bearei-permission` returns for administrators; it is not a grantable permission key.
58
60
 
59
61
  ### Module formats
60
62
 
@@ -68,7 +70,8 @@ Only values and types that both ends of a wire boundary must agree on belong her
68
70
  - numeric error codes and error response bodies
69
71
  - query and response shapes shared by API clients and services
70
72
  - reserved request header names
71
- - cross-project enums such as language, sort order, permissions and subscription features
73
+ - cross-project enums such as language, sort order, permissions, subscription features and payment
74
+ contract values
72
75
 
73
76
  Framework-specific code does not belong here: NestJS decorators, guards and interceptors,
74
77
  TypeORM entities, HTTP clients, persistence, and service-only DTOs stay in their own libraries.
package/README.zh-CN.md CHANGED
@@ -5,18 +5,19 @@ ESM 与 CommonJS 两种产物。
5
5
 
6
6
  [English](./README.md) | 中文
7
7
 
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
- | `EMAIL_TEMPLATE`、`EmailTemplate` | 值 | 服务与客户端共用的邮件模板值 |
17
- | `ORDER`、`Order` | 值 | 排序值 |
18
- | `PERMISSION`、`Permission` | 值 | 服务与客户端共用的权限值 |
19
- | `SUBSCRIPTION_FEATURE`、`SubscriptionFeature` | 值 | 订阅特性值,与权限使用相同的区域写法 |
8
+ | 导出 | 类型 | 用途 |
9
+ | ---------------------------------------------------------------- | ---- | -------------------------------------- |
10
+ | `HTTP_EXCEPTION_CODE`、`HttpExceptionCode` | 值 | 服务与客户端共享的数字错误码 |
11
+ | `ApiErrorBody`、`ApiValidationErrorBody`、`ApiErrorResponseBody` | 类型 | 业务错误体与校验错误体 |
12
+ | `DEFAULT_PAGE_SIZE`、`MAX_PAGE_SIZE` | 值 | 所有列表接口使用的分页上限 |
13
+ | `PaginationQuery`、`PaginatedResult<T>` | 类型 | 分页请求字段与分页响应信封 |
14
+ | `RESERVED_REQUEST_HEADER`、`ReservedRequestHeaderName` | 值 | 由网关或认证层写入的保留请求头 |
15
+ | `LANGUAGE`、`Language` | 值 | 语言值 |
16
+ | `EMAIL_TEMPLATE`、`EmailTemplate` | 值 | 服务与客户端共用的邮件模板值 |
17
+ | `ORDER`、`Order` | 值 | 排序值 |
18
+ | `PAYMENT_CHANNEL`、`PAYMENT_ENVIRONMENT`、`PAYMENT_EVENT_TYPE` | 值 | 支付服务与订阅服务共用的支付契约词表 |
19
+ | `PERMISSION`、`Permission`、`ALL_PERMISSION_KEY` | 值 | 服务与客户端共用的权限值与管理员哨兵值 |
20
+ | `SUBSCRIPTION_FEATURE`、`SubscriptionFeature` | 值 | 订阅特性值,与权限使用相同的区域写法 |
20
21
 
21
22
  ## 安装
22
23
 
@@ -51,8 +52,10 @@ const page: PaginatedResult<{id: string}> = {
51
52
  }
52
53
  ```
53
54
 
54
- `ApiErrorBody` 对应守卫、服务与共享异常抛出的业务错误。请求参数校验错误仍使用 NestJS 标准体
55
- (`statusCode`、`message`、`error`),不能赋值给该类型。
55
+ `ApiErrorBody` 对应守卫、服务与共享异常抛出的业务错误。请求参数校验错误使用
56
+ `ApiValidationErrorBody`,保留字段错误数组;`ApiErrorResponseBody` 是两者的联合类型。
57
+ `ALL_PERMISSION_KEY`(`all:all`)是 `bearei-permission` 对管理员返回的响应哨兵值,不是可授予的
58
+ 权限键。
56
59
 
57
60
  ### 模块格式
58
61
 
@@ -66,7 +69,7 @@ const page: PaginatedResult<{id: string}> = {
66
69
  - 数字错误码与错误响应体
67
70
  - API 客户端与服务共享的查询、响应结构
68
71
  - 保留请求头名称
69
- - 语言、排序、权限、订阅特性等跨项目枚举
72
+ - 语言、排序、权限、订阅特性、支付契约值等跨项目枚举
70
73
 
71
74
  框架相关代码不放进这里:NestJS 装饰器、守卫、拦截器,TypeORM 实体,HTTP 客户端,持久化,
72
75
  以及仅服务端使用的 DTO 都留在各自的库中。
package/dist/index.d.mts CHANGED
@@ -10,7 +10,9 @@ type EmailTemplate = (typeof EMAIL_TEMPLATE)[keyof typeof EMAIL_TEMPLATE];
10
10
  */
11
11
  declare const HTTP_EXCEPTION_CODE: {
12
12
  readonly ACCESS_DENIED_FOR_GUEST: 401003;
13
+ /** Reserved: no 2.0 service produces it; never reuse or renumber. */
13
14
  readonly APPLE_IAP_TRANSACTION_NOT_COMPLETED: 403004;
15
+ /** Reserved: no 2.0 service produces it; never reuse or renumber. */
14
16
  readonly APPLE_IAP_TRANSACTION_UNAUTHORIZED: 401008;
15
17
  readonly APPLE_IAP_TRANSACTION_VERIFICATION_FAILED: 403005;
16
18
  readonly BAD_GATEWAY: 502000;
@@ -27,6 +29,7 @@ declare const HTTP_EXCEPTION_CODE: {
27
29
  readonly INTERNAL_SERVER_SIGNATURE_VERIFICATION_FAILED: 401002;
28
30
  readonly INVALID_PAYMENT_CHANNEL: 400008;
29
31
  readonly MISSING_SIGN_IN_ENTITY: 400009;
32
+ /** Reserved: no 2.0 service produces it; never reuse or renumber. */
30
33
  readonly MISSING_SUBSCRIPTION_USER_ENTITY: 400010;
31
34
  readonly NOT_FOUND: 404000;
32
35
  readonly NOT_SUBSCRIBED: 403002;
@@ -46,15 +49,24 @@ declare const HTTP_EXCEPTION_CODE: {
46
49
  type HttpExceptionCode = (typeof HTTP_EXCEPTION_CODE)[keyof typeof HTTP_EXCEPTION_CODE];
47
50
 
48
51
  /**
49
- * Business error body returned by Bearei HTTP APIs. Validation errors keep the NestJS default
50
- * body (`statusCode`, `message`, `error`) and are not represented by this type.
51
- * Services may return codes outside `HTTP_EXCEPTION_CODE`, so `code` stays numeric.
52
+ * Business error body returned by Bearei HTTP APIs. Services may return codes outside
53
+ * `HTTP_EXCEPTION_CODE`, so `code` stays numeric.
52
54
  */
53
55
  interface ApiErrorBody {
54
56
  code: number;
55
57
  message: string;
56
58
  statusCode: number;
57
59
  }
60
+ /**
61
+ * Body for global validation failures: same envelope as `ApiErrorBody`, but the message
62
+ * keeps the NestJS field-error array.
63
+ */
64
+ interface ApiValidationErrorBody {
65
+ code: number;
66
+ message: string[];
67
+ statusCode: number;
68
+ }
69
+ type ApiErrorResponseBody = ApiErrorBody | ApiValidationErrorBody;
58
70
 
59
71
  declare const RESERVED_REQUEST_HEADER: {
60
72
  readonly CLIENT: "x-bearei-client";
@@ -93,6 +105,27 @@ interface PaginatedResult<T> {
93
105
  total?: number;
94
106
  }
95
107
 
108
+ declare const PAYMENT_CHANNEL: {
109
+ readonly APPLE_IAP: "APPLE_IAP";
110
+ };
111
+ type PaymentChannel = (typeof PAYMENT_CHANNEL)[keyof typeof PAYMENT_CHANNEL];
112
+ declare const PAYMENT_ENVIRONMENT: {
113
+ readonly PRODUCTION: "PRODUCTION";
114
+ readonly SANDBOX: "SANDBOX";
115
+ };
116
+ type PaymentEnvironment = (typeof PAYMENT_ENVIRONMENT)[keyof typeof PAYMENT_ENVIRONMENT];
117
+ declare const PAYMENT_EVENT_TYPE: {
118
+ readonly ENTERED_GRACE_PERIOD: "ENTERED_GRACE_PERIOD";
119
+ readonly EXPIRED: "EXPIRED";
120
+ readonly PLAN_CHANGED: "PLAN_CHANGED";
121
+ readonly REFUNDED: "REFUNDED";
122
+ readonly REINSTATED: "REINSTATED";
123
+ readonly RENEWED: "RENEWED";
124
+ readonly REVOKED: "REVOKED";
125
+ readonly SUBSCRIBED: "SUBSCRIBED";
126
+ };
127
+ type PaymentEventType = (typeof PAYMENT_EVENT_TYPE)[keyof typeof PAYMENT_EVENT_TYPE];
128
+
96
129
  declare const PERMISSION: {
97
130
  readonly ACTION_LOG_CREATE: "action-log:create";
98
131
  readonly ACTION_LOG_DELETE: "action-log:delete";
@@ -163,6 +196,8 @@ declare const PERMISSION: {
163
196
  readonly VERSION_LOG_READ: "version-log:read";
164
197
  readonly VERSION_LOG_UPDATE: "version-log:update";
165
198
  };
199
+ /** Response sentinel for administrators; it is not a grantable permission key. */
200
+ declare const ALL_PERMISSION_KEY = "all:all";
166
201
  type Permission = (typeof PERMISSION)[keyof typeof PERMISSION];
167
202
 
168
203
  declare const SUBSCRIPTION_FEATURE: {
@@ -172,5 +207,5 @@ declare const SUBSCRIPTION_FEATURE: {
172
207
  };
173
208
  type SubscriptionFeature = (typeof SUBSCRIPTION_FEATURE)[keyof typeof SUBSCRIPTION_FEATURE];
174
209
 
175
- export { DEFAULT_PAGE_SIZE, EMAIL_TEMPLATE, HTTP_EXCEPTION_CODE, LANGUAGE, MAX_PAGE_SIZE, ORDER, PERMISSION, RESERVED_REQUEST_HEADER, SUBSCRIPTION_FEATURE };
176
- export type { ApiErrorBody, EmailTemplate, HttpExceptionCode, Language, Order, PaginatedResult, PaginationQuery, Permission, ReservedRequestHeaderName, SubscriptionFeature };
210
+ export { ALL_PERMISSION_KEY, DEFAULT_PAGE_SIZE, EMAIL_TEMPLATE, HTTP_EXCEPTION_CODE, LANGUAGE, MAX_PAGE_SIZE, ORDER, PAYMENT_CHANNEL, PAYMENT_ENVIRONMENT, PAYMENT_EVENT_TYPE, PERMISSION, RESERVED_REQUEST_HEADER, SUBSCRIPTION_FEATURE };
211
+ export type { ApiErrorBody, ApiErrorResponseBody, ApiValidationErrorBody, EmailTemplate, HttpExceptionCode, Language, Order, PaginatedResult, PaginationQuery, PaymentChannel, PaymentEnvironment, PaymentEventType, Permission, ReservedRequestHeaderName, SubscriptionFeature };
package/dist/index.d.ts CHANGED
@@ -10,7 +10,9 @@ type EmailTemplate = (typeof EMAIL_TEMPLATE)[keyof typeof EMAIL_TEMPLATE];
10
10
  */
11
11
  declare const HTTP_EXCEPTION_CODE: {
12
12
  readonly ACCESS_DENIED_FOR_GUEST: 401003;
13
+ /** Reserved: no 2.0 service produces it; never reuse or renumber. */
13
14
  readonly APPLE_IAP_TRANSACTION_NOT_COMPLETED: 403004;
15
+ /** Reserved: no 2.0 service produces it; never reuse or renumber. */
14
16
  readonly APPLE_IAP_TRANSACTION_UNAUTHORIZED: 401008;
15
17
  readonly APPLE_IAP_TRANSACTION_VERIFICATION_FAILED: 403005;
16
18
  readonly BAD_GATEWAY: 502000;
@@ -27,6 +29,7 @@ declare const HTTP_EXCEPTION_CODE: {
27
29
  readonly INTERNAL_SERVER_SIGNATURE_VERIFICATION_FAILED: 401002;
28
30
  readonly INVALID_PAYMENT_CHANNEL: 400008;
29
31
  readonly MISSING_SIGN_IN_ENTITY: 400009;
32
+ /** Reserved: no 2.0 service produces it; never reuse or renumber. */
30
33
  readonly MISSING_SUBSCRIPTION_USER_ENTITY: 400010;
31
34
  readonly NOT_FOUND: 404000;
32
35
  readonly NOT_SUBSCRIBED: 403002;
@@ -46,15 +49,24 @@ declare const HTTP_EXCEPTION_CODE: {
46
49
  type HttpExceptionCode = (typeof HTTP_EXCEPTION_CODE)[keyof typeof HTTP_EXCEPTION_CODE];
47
50
 
48
51
  /**
49
- * Business error body returned by Bearei HTTP APIs. Validation errors keep the NestJS default
50
- * body (`statusCode`, `message`, `error`) and are not represented by this type.
51
- * Services may return codes outside `HTTP_EXCEPTION_CODE`, so `code` stays numeric.
52
+ * Business error body returned by Bearei HTTP APIs. Services may return codes outside
53
+ * `HTTP_EXCEPTION_CODE`, so `code` stays numeric.
52
54
  */
53
55
  interface ApiErrorBody {
54
56
  code: number;
55
57
  message: string;
56
58
  statusCode: number;
57
59
  }
60
+ /**
61
+ * Body for global validation failures: same envelope as `ApiErrorBody`, but the message
62
+ * keeps the NestJS field-error array.
63
+ */
64
+ interface ApiValidationErrorBody {
65
+ code: number;
66
+ message: string[];
67
+ statusCode: number;
68
+ }
69
+ type ApiErrorResponseBody = ApiErrorBody | ApiValidationErrorBody;
58
70
 
59
71
  declare const RESERVED_REQUEST_HEADER: {
60
72
  readonly CLIENT: "x-bearei-client";
@@ -93,6 +105,27 @@ interface PaginatedResult<T> {
93
105
  total?: number;
94
106
  }
95
107
 
108
+ declare const PAYMENT_CHANNEL: {
109
+ readonly APPLE_IAP: "APPLE_IAP";
110
+ };
111
+ type PaymentChannel = (typeof PAYMENT_CHANNEL)[keyof typeof PAYMENT_CHANNEL];
112
+ declare const PAYMENT_ENVIRONMENT: {
113
+ readonly PRODUCTION: "PRODUCTION";
114
+ readonly SANDBOX: "SANDBOX";
115
+ };
116
+ type PaymentEnvironment = (typeof PAYMENT_ENVIRONMENT)[keyof typeof PAYMENT_ENVIRONMENT];
117
+ declare const PAYMENT_EVENT_TYPE: {
118
+ readonly ENTERED_GRACE_PERIOD: "ENTERED_GRACE_PERIOD";
119
+ readonly EXPIRED: "EXPIRED";
120
+ readonly PLAN_CHANGED: "PLAN_CHANGED";
121
+ readonly REFUNDED: "REFUNDED";
122
+ readonly REINSTATED: "REINSTATED";
123
+ readonly RENEWED: "RENEWED";
124
+ readonly REVOKED: "REVOKED";
125
+ readonly SUBSCRIBED: "SUBSCRIBED";
126
+ };
127
+ type PaymentEventType = (typeof PAYMENT_EVENT_TYPE)[keyof typeof PAYMENT_EVENT_TYPE];
128
+
96
129
  declare const PERMISSION: {
97
130
  readonly ACTION_LOG_CREATE: "action-log:create";
98
131
  readonly ACTION_LOG_DELETE: "action-log:delete";
@@ -163,6 +196,8 @@ declare const PERMISSION: {
163
196
  readonly VERSION_LOG_READ: "version-log:read";
164
197
  readonly VERSION_LOG_UPDATE: "version-log:update";
165
198
  };
199
+ /** Response sentinel for administrators; it is not a grantable permission key. */
200
+ declare const ALL_PERMISSION_KEY = "all:all";
166
201
  type Permission = (typeof PERMISSION)[keyof typeof PERMISSION];
167
202
 
168
203
  declare const SUBSCRIPTION_FEATURE: {
@@ -172,5 +207,5 @@ declare const SUBSCRIPTION_FEATURE: {
172
207
  };
173
208
  type SubscriptionFeature = (typeof SUBSCRIPTION_FEATURE)[keyof typeof SUBSCRIPTION_FEATURE];
174
209
 
175
- export { DEFAULT_PAGE_SIZE, EMAIL_TEMPLATE, HTTP_EXCEPTION_CODE, LANGUAGE, MAX_PAGE_SIZE, ORDER, PERMISSION, RESERVED_REQUEST_HEADER, SUBSCRIPTION_FEATURE };
176
- export type { ApiErrorBody, EmailTemplate, HttpExceptionCode, Language, Order, PaginatedResult, PaginationQuery, Permission, ReservedRequestHeaderName, SubscriptionFeature };
210
+ export { ALL_PERMISSION_KEY, DEFAULT_PAGE_SIZE, EMAIL_TEMPLATE, HTTP_EXCEPTION_CODE, LANGUAGE, MAX_PAGE_SIZE, ORDER, PAYMENT_CHANNEL, PAYMENT_ENVIRONMENT, PAYMENT_EVENT_TYPE, PERMISSION, RESERVED_REQUEST_HEADER, SUBSCRIPTION_FEATURE };
211
+ export type { ApiErrorBody, ApiErrorResponseBody, ApiValidationErrorBody, EmailTemplate, HttpExceptionCode, Language, Order, PaginatedResult, PaginationQuery, PaymentChannel, PaymentEnvironment, PaymentEventType, Permission, ReservedRequestHeaderName, SubscriptionFeature };
package/dist/index.js CHANGED
@@ -20,12 +20,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ ALL_PERMISSION_KEY: () => ALL_PERMISSION_KEY,
23
24
  DEFAULT_PAGE_SIZE: () => DEFAULT_PAGE_SIZE,
24
25
  EMAIL_TEMPLATE: () => EMAIL_TEMPLATE,
25
26
  HTTP_EXCEPTION_CODE: () => HTTP_EXCEPTION_CODE,
26
27
  LANGUAGE: () => LANGUAGE,
27
28
  MAX_PAGE_SIZE: () => MAX_PAGE_SIZE,
28
29
  ORDER: () => ORDER,
30
+ PAYMENT_CHANNEL: () => PAYMENT_CHANNEL,
31
+ PAYMENT_ENVIRONMENT: () => PAYMENT_ENVIRONMENT,
32
+ PAYMENT_EVENT_TYPE: () => PAYMENT_EVENT_TYPE,
29
33
  PERMISSION: () => PERMISSION,
30
34
  RESERVED_REQUEST_HEADER: () => RESERVED_REQUEST_HEADER,
31
35
  SUBSCRIPTION_FEATURE: () => SUBSCRIPTION_FEATURE
@@ -41,7 +45,9 @@ var EMAIL_TEMPLATE = {
41
45
  // src/error-code.enum.ts
42
46
  var HTTP_EXCEPTION_CODE = {
43
47
  ACCESS_DENIED_FOR_GUEST: 401003,
48
+ /** Reserved: no 2.0 service produces it; never reuse or renumber. */
44
49
  APPLE_IAP_TRANSACTION_NOT_COMPLETED: 403004,
50
+ /** Reserved: no 2.0 service produces it; never reuse or renumber. */
45
51
  APPLE_IAP_TRANSACTION_UNAUTHORIZED: 401008,
46
52
  APPLE_IAP_TRANSACTION_VERIFICATION_FAILED: 403005,
47
53
  BAD_GATEWAY: 502e3,
@@ -58,6 +64,7 @@ var HTTP_EXCEPTION_CODE = {
58
64
  INTERNAL_SERVER_SIGNATURE_VERIFICATION_FAILED: 401002,
59
65
  INVALID_PAYMENT_CHANNEL: 400008,
60
66
  MISSING_SIGN_IN_ENTITY: 400009,
67
+ /** Reserved: no 2.0 service produces it; never reuse or renumber. */
61
68
  MISSING_SUBSCRIPTION_USER_ENTITY: 400010,
62
69
  NOT_FOUND: 404e3,
63
70
  NOT_SUBSCRIBED: 403002,
@@ -101,6 +108,25 @@ var ORDER = {
101
108
  var DEFAULT_PAGE_SIZE = 10;
102
109
  var MAX_PAGE_SIZE = 1024;
103
110
 
111
+ // src/payment.enum.ts
112
+ var PAYMENT_CHANNEL = {
113
+ APPLE_IAP: "APPLE_IAP"
114
+ };
115
+ var PAYMENT_ENVIRONMENT = {
116
+ PRODUCTION: "PRODUCTION",
117
+ SANDBOX: "SANDBOX"
118
+ };
119
+ var PAYMENT_EVENT_TYPE = {
120
+ ENTERED_GRACE_PERIOD: "ENTERED_GRACE_PERIOD",
121
+ EXPIRED: "EXPIRED",
122
+ PLAN_CHANGED: "PLAN_CHANGED",
123
+ REFUNDED: "REFUNDED",
124
+ REINSTATED: "REINSTATED",
125
+ RENEWED: "RENEWED",
126
+ REVOKED: "REVOKED",
127
+ SUBSCRIBED: "SUBSCRIBED"
128
+ };
129
+
104
130
  // src/permission.enum.ts
105
131
  var PERMISSION = {
106
132
  ACTION_LOG_CREATE: "action-log:create",
@@ -172,6 +198,7 @@ var PERMISSION = {
172
198
  VERSION_LOG_READ: "version-log:read",
173
199
  VERSION_LOG_UPDATE: "version-log:update"
174
200
  };
201
+ var ALL_PERMISSION_KEY = "all:all";
175
202
 
176
203
  // src/subscription-feature.enum.ts
177
204
  var SUBSCRIPTION_FEATURE = {
@@ -181,12 +208,16 @@ var SUBSCRIPTION_FEATURE = {
181
208
  };
182
209
  // Annotate the CommonJS export names for ESM import in node:
183
210
  0 && (module.exports = {
211
+ ALL_PERMISSION_KEY,
184
212
  DEFAULT_PAGE_SIZE,
185
213
  EMAIL_TEMPLATE,
186
214
  HTTP_EXCEPTION_CODE,
187
215
  LANGUAGE,
188
216
  MAX_PAGE_SIZE,
189
217
  ORDER,
218
+ PAYMENT_CHANNEL,
219
+ PAYMENT_ENVIRONMENT,
220
+ PAYMENT_EVENT_TYPE,
190
221
  PERMISSION,
191
222
  RESERVED_REQUEST_HEADER,
192
223
  SUBSCRIPTION_FEATURE
package/dist/index.mjs CHANGED
@@ -7,7 +7,9 @@ var EMAIL_TEMPLATE = {
7
7
  // src/error-code.enum.ts
8
8
  var HTTP_EXCEPTION_CODE = {
9
9
  ACCESS_DENIED_FOR_GUEST: 401003,
10
+ /** Reserved: no 2.0 service produces it; never reuse or renumber. */
10
11
  APPLE_IAP_TRANSACTION_NOT_COMPLETED: 403004,
12
+ /** Reserved: no 2.0 service produces it; never reuse or renumber. */
11
13
  APPLE_IAP_TRANSACTION_UNAUTHORIZED: 401008,
12
14
  APPLE_IAP_TRANSACTION_VERIFICATION_FAILED: 403005,
13
15
  BAD_GATEWAY: 502e3,
@@ -24,6 +26,7 @@ var HTTP_EXCEPTION_CODE = {
24
26
  INTERNAL_SERVER_SIGNATURE_VERIFICATION_FAILED: 401002,
25
27
  INVALID_PAYMENT_CHANNEL: 400008,
26
28
  MISSING_SIGN_IN_ENTITY: 400009,
29
+ /** Reserved: no 2.0 service produces it; never reuse or renumber. */
27
30
  MISSING_SUBSCRIPTION_USER_ENTITY: 400010,
28
31
  NOT_FOUND: 404e3,
29
32
  NOT_SUBSCRIBED: 403002,
@@ -67,6 +70,25 @@ var ORDER = {
67
70
  var DEFAULT_PAGE_SIZE = 10;
68
71
  var MAX_PAGE_SIZE = 1024;
69
72
 
73
+ // src/payment.enum.ts
74
+ var PAYMENT_CHANNEL = {
75
+ APPLE_IAP: "APPLE_IAP"
76
+ };
77
+ var PAYMENT_ENVIRONMENT = {
78
+ PRODUCTION: "PRODUCTION",
79
+ SANDBOX: "SANDBOX"
80
+ };
81
+ var PAYMENT_EVENT_TYPE = {
82
+ ENTERED_GRACE_PERIOD: "ENTERED_GRACE_PERIOD",
83
+ EXPIRED: "EXPIRED",
84
+ PLAN_CHANGED: "PLAN_CHANGED",
85
+ REFUNDED: "REFUNDED",
86
+ REINSTATED: "REINSTATED",
87
+ RENEWED: "RENEWED",
88
+ REVOKED: "REVOKED",
89
+ SUBSCRIBED: "SUBSCRIBED"
90
+ };
91
+
70
92
  // src/permission.enum.ts
71
93
  var PERMISSION = {
72
94
  ACTION_LOG_CREATE: "action-log:create",
@@ -138,6 +160,7 @@ var PERMISSION = {
138
160
  VERSION_LOG_READ: "version-log:read",
139
161
  VERSION_LOG_UPDATE: "version-log:update"
140
162
  };
163
+ var ALL_PERMISSION_KEY = "all:all";
141
164
 
142
165
  // src/subscription-feature.enum.ts
143
166
  var SUBSCRIPTION_FEATURE = {
@@ -146,12 +169,16 @@ var SUBSCRIPTION_FEATURE = {
146
169
  TAG_CLOUD_SYNC: "bookmark:tag_cloud_sync"
147
170
  };
148
171
  export {
172
+ ALL_PERMISSION_KEY,
149
173
  DEFAULT_PAGE_SIZE,
150
174
  EMAIL_TEMPLATE,
151
175
  HTTP_EXCEPTION_CODE,
152
176
  LANGUAGE,
153
177
  MAX_PAGE_SIZE,
154
178
  ORDER,
179
+ PAYMENT_CHANNEL,
180
+ PAYMENT_ENVIRONMENT,
181
+ PAYMENT_EVENT_TYPE,
155
182
  PERMISSION,
156
183
  RESERVED_REQUEST_HEADER,
157
184
  SUBSCRIPTION_FEATURE
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bearei/contracts",
3
- "version": "3.1.0",
3
+ "version": "3.3.0",
4
4
  "description": "Framework-agnostic wire contracts shared by Bearei services, clients and apps",
5
5
  "keywords": [
6
6
  "bearei",