@bearei/nest 2.0.0-dev.1 → 2.0.0-dev.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/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ 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.0.0-dev.2 — 2026-10-27
8
+
9
+ Development snapshot published under the `next` dist-tag to verify the npm trusted publishing
10
+ pipeline. Its contents match the 2.0.0 scope documented below; it does not replace the final
11
+ 2.0.0 release notes.
12
+
13
+ Install it with `yarn add @bearei/nest@next` or pin `@bearei/nest@2.0.0-dev.2`.
14
+
7
15
  ## 2.0.0-dev.1 — 2026-10-26
8
16
 
9
17
  Development snapshot published under the `next` dist-tag for early integration.
@@ -20,57 +28,57 @@ baseline; because the npm identity is new, the Breaking list below is also the m
20
28
 
21
29
  ### Breaking
22
30
 
23
- - Renamed the package to `@bearei/nest` (previously `@bearei/service-common`, originally `@bearei/server-common`). Update imports; the old names will not be published again.
24
- - Raised the runtime baseline to Node.js >= 20, NestJS 11, TypeORM 1.x and `@nestjs/axios` 4. NestJS, TypeORM, validation, Axios, RxJS and `reflect-metadata` are peer dependencies, so the application owns exactly one copy of each.
25
- - Removed `CommonEntity.entityStatus`, `EntityStatus` and `ENTITY_STATUS`. Soft deletion is expressed only by `deletedAt`; recovery clears `deletedAt`. The `@BeforeSoftRemove` / `@BeforeRecover` hooks are gone.
26
- - Renamed `CommonEntity.primaryId` to `internalId` (column `internal_id`). `createdAt` / `updatedAt` / `deletedAt` are typed `Date | string` (`deletedAt` also `null`) so imported JSON values are preserved.
27
- - `CommonEntity.beforeInsert` now keeps a caller-provided `id` and `createdAt` instead of overwriting them, which makes imports idempotent.
28
- - Split `BaseService` options into `BaseServiceCreateOptions`, `BaseServiceDeleteOptions`, `BaseServiceUpdateOptions`, `BaseServiceFindOptions`, `BaseServiceCountOptions`, `BaseServiceFindOneOptions` and `BaseServiceUpdateAssociationOptions`. `BaseServiceOptions<T>` is no longer generic. The old `CreateOptions` / `DelOptions` / `UpdateOptions` / `FindOptions` / `CountOptions` / `FindOneOptions` / `UpdateAssociationOptions` types are removed.
29
- - Renamed `BaseService.del` to `delete` and `BaseService.checkProhibited` to `assertNotProhibited`. `BaseService.throwError` now takes `{httpExceptionKind, ...}`.
30
- - `BaseService.createSuccessActionLog` now takes the affected entity (or entities) plus `ActionLogOptions`. `ActionLogService.success` / `.failure` take the payload as the first argument.
31
- - Renamed `ActionLogOptions.enabledLog` to `isLogEnabled`. `headers` is optional, and logging requires both `isLogEnabled` and `headers`.
32
- - Replaced `throwHTTPException(options)(exception)` with `createHttpException(kind, options)` and `throwHttpException(kind, options)`. `HTTPException` / `HTTPExceptionCode` are renamed to `HttpExceptionKind` / `HttpExceptionCode`, and `ThrowHTTPExceptionOptions` to `ThrowHttpExceptionOptions`.
33
- - `HTTP_EXCEPTION.GENERIC` now returns `{code, message, statusCode}` instead of `{code, message, status}`; every exception kind uses the same `statusCode` field.
34
- - `VALIDATION_METHOD` values are now `AND` / `OR` instead of `and` / `or`. Update persisted or hard-coded values.
35
- - Renamed the DTOs: `IndexDTO` → `ListQueryDto` (`size` → `pageSize`, `count` → `withTotal`, `order` → `sortOrder`, `createdAtRanges` → `createdAtRange`), `ByIdDTO` → `ByIdDto`, `ByEmailDTO` → `ByEmailDto`, `NotIdDTO` → `ExcludeIdDto` (`notId` → `excludeId`).
36
- - Replaced the pagination result `FindResult` (string `limit` / `offset` / `total`) with `PaginatedResult` (`page`, `pageSize`, optional numeric `total`, `results`).
37
- - Renamed the decorators: `PublicAccesses` → `AllowAccess`, `AuthenticationPermissions` → `RequirePermissions`, `AuthenticationSubscriptionFeatures` → `RequireSubscriptionFeatures`, `IsNanoid` → `IsNanoId`, `OmitEntityKey` → `OmitEntityKeys`. Their metadata keys changed as well.
38
- - Removed `AccessGuard`, `AccessInterceptor`, `AuthenticationService`, `AuthenticationModule` and the `AppModule` / controller / service / `main.ts` bootstrap. This package is a library and no longer ships a runnable Nest application.
39
- - Removed the `buildMobileNumber`, `generateRandomNumber` and `createSanitizeResponseEntity` utilities; the replacements are listed under Added.
40
- - Changed permission values from `DOMAIN_DOMAIN_ACTION` to `resource:action` (for example `USER_USER_VIEW` → `user:read`). Persisted permission rows must be migrated.
41
- - Reduced `SUBSCRIPTION_FEATURE` to `BEAREI_BOOKMARK_CLOUD_SYNC`; the previous bookmark/carton/tag flags are removed.
42
- - Renamed JWT types `JWTPayloadOptions` → `JwtSignPayloadOptions` and `JWTPayload` → `JwtPayload`. `jti` and `nbf` are optional in the payload. Tokens are signed with RS256 from the JWK in `jwt.privateKey`.
43
- - Renamed `RedisSetOptions.expireTime` to `ttlMilliseconds`.
44
- - Renamed `ExternalService.authenticationUserPermissions` / `authenticationUserSubscriptionFeatures` to `findUserPermissions` / `findUserSubscriptionFeatures`.
31
+ - Renamed the package to `@bearei/nest` (previously `@bearei/service-common`, originally `@bearei/server-common`). Update imports; the old names will not be published again.
32
+ - Raised the runtime baseline to Node.js >= 20, NestJS 11, TypeORM 1.x and `@nestjs/axios` 4. NestJS, TypeORM, validation, Axios, RxJS and `reflect-metadata` are peer dependencies, so the application owns exactly one copy of each.
33
+ - Removed `CommonEntity.entityStatus`, `EntityStatus` and `ENTITY_STATUS`. Soft deletion is expressed only by `deletedAt`; recovery clears `deletedAt`. The `@BeforeSoftRemove` / `@BeforeRecover` hooks are gone.
34
+ - Renamed `CommonEntity.primaryId` to `internalId` (column `internal_id`). `createdAt` / `updatedAt` / `deletedAt` are typed `Date | string` (`deletedAt` also `null`) so imported JSON values are preserved.
35
+ - `CommonEntity.beforeInsert` now keeps a caller-provided `id` and `createdAt` instead of overwriting them, which makes imports idempotent.
36
+ - Split `BaseService` options into `BaseServiceCreateOptions`, `BaseServiceDeleteOptions`, `BaseServiceUpdateOptions`, `BaseServiceFindOptions`, `BaseServiceCountOptions`, `BaseServiceFindOneOptions` and `BaseServiceUpdateAssociationOptions`. `BaseServiceOptions<T>` is no longer generic. The old `CreateOptions` / `DelOptions` / `UpdateOptions` / `FindOptions` / `CountOptions` / `FindOneOptions` / `UpdateAssociationOptions` types are removed.
37
+ - Renamed `BaseService.del` to `delete` and `BaseService.checkProhibited` to `assertNotProhibited`. `BaseService.throwError` now takes `{httpExceptionKind, ...}`.
38
+ - `BaseService.createSuccessActionLog` now takes the affected entity (or entities) plus `ActionLogOptions`. `ActionLogService.success` / `.failure` take the payload as the first argument.
39
+ - Renamed `ActionLogOptions.enabledLog` to `isLogEnabled`. `headers` is optional, and logging requires both `isLogEnabled` and `headers`.
40
+ - Replaced `throwHTTPException(options)(exception)` with `createHttpException(kind, options)` and `throwHttpException(kind, options)`. `HTTPException` / `HTTPExceptionCode` are renamed to `HttpExceptionKind` / `HttpExceptionCode`, and `ThrowHTTPExceptionOptions` to `ThrowHttpExceptionOptions`.
41
+ - `HTTP_EXCEPTION.GENERIC` now returns `{code, message, statusCode}` instead of `{code, message, status}`; every exception kind uses the same `statusCode` field.
42
+ - `VALIDATION_METHOD` values are now `AND` / `OR` instead of `and` / `or`. Update persisted or hard-coded values.
43
+ - Renamed the DTOs: `IndexDTO` → `ListQueryDto` (`size` → `pageSize`, `count` → `withTotal`, `order` → `sortOrder`, `createdAtRanges` → `createdAtRange`), `ByIdDTO` → `ByIdDto`, `ByEmailDTO` → `ByEmailDto`, `NotIdDTO` → `ExcludeIdDto` (`notId` → `excludeId`).
44
+ - Replaced the pagination result `FindResult` (string `limit` / `offset` / `total`) with `PaginatedResult` (`page`, `pageSize`, optional numeric `total`, `results`).
45
+ - Renamed the decorators: `PublicAccesses` → `AllowAccess`, `AuthenticationPermissions` → `RequirePermissions`, `AuthenticationSubscriptionFeatures` → `RequireSubscriptionFeatures`, `IsNanoid` → `IsNanoId`, `OmitEntityKey` → `OmitEntityKeys`. Their metadata keys changed as well.
46
+ - Removed `AccessGuard`, `AccessInterceptor`, `AuthenticationService`, `AuthenticationModule` and the `AppModule` / controller / service / `main.ts` bootstrap. This package is a library and no longer ships a runnable Nest application.
47
+ - Removed the `buildMobileNumber`, `generateRandomNumber` and `createSanitizeResponseEntity` utilities; the replacements are listed under Added.
48
+ - Changed permission values from `DOMAIN_DOMAIN_ACTION` to `resource:action` (for example `USER_USER_VIEW` → `user:read`). Persisted permission rows must be migrated.
49
+ - Reduced `SUBSCRIPTION_FEATURE` to `BEAREI_BOOKMARK_CLOUD_SYNC`; the previous bookmark/carton/tag flags are removed.
50
+ - Renamed JWT types `JWTPayloadOptions` → `JwtSignPayloadOptions` and `JWTPayload` → `JwtPayload`. `jti` and `nbf` are optional in the payload. Tokens are signed with RS256 from the JWK in `jwt.privateKey`.
51
+ - Renamed `RedisSetOptions.expireTime` to `ttlMilliseconds`.
52
+ - Renamed `ExternalService.authenticationUserPermissions` / `authenticationUserSubscriptionFeatures` to `findUserPermissions` / `findUserSubscriptionFeatures`.
45
53
 
46
54
  ### Added
47
55
 
48
- - `AuthenticationGuard`: verifies bearer tokens, resolves the request identity and accepts internal HMAC-signed calls.
49
- - `AuthenticationContextInterceptor`: rejects client-supplied `x-bearei-*` identity headers, forwards trusted identity headers and sanitizes response bodies.
50
- - `AuthorizationModule` / `AuthorizationService`: permission resolution behind `@RequirePermissions`.
51
- - `BaseService.createMany`: batch insert that applies the same server-managed-key rules as `create`.
52
- - Query options on `BaseServiceFindOptions`: `innerJoin`, `queryBuilderWhere`, `totalFindOptions` and `sortBy` for joined, filtered and counted lists.
53
- - `CommonEntity`: nanoid public `id`, internal numeric id, optimistic-locking `version`, UTC timestamps and idempotent inserts.
54
- - `ListQueryDto`, `ByIdDto`, `ByEmailDto`, `ExcludeIdDto`, plus `PaginatedResult`, `ReservedRequestHeaders`, `AuthenticatedRequest` and string-literal union types for the shared enums.
55
- - `ApiErrorBody` and `ReservedRequestHeaderName`, re-exported from `@bearei/contracts`.
56
- - `createResponseSanitizer` (replaces `createSanitizeResponseEntity`), `formatMobileNumber` (replaces `buildMobileNumber`) and `generateRandomNumberString` (replaces `generateRandomNumber`).
57
- - `runWithDatabaseRetry` for transient database connection failures.
58
- - `AllowAccess`, `RequirePermissions` and `RequireSubscriptionFeatures` decorators, alongside the existing validators.
59
- - Unit tests for every module, root-export smoke test, `test/setup.ts`, and CI workflows for verification and tag-driven releases.
56
+ - `AuthenticationGuard`: verifies bearer tokens, resolves the request identity and accepts internal HMAC-signed calls.
57
+ - `AuthenticationContextInterceptor`: rejects client-supplied `x-bearei-*` identity headers, forwards trusted identity headers and sanitizes response bodies.
58
+ - `AuthorizationModule` / `AuthorizationService`: permission resolution behind `@RequirePermissions`.
59
+ - `BaseService.createMany`: batch insert that applies the same server-managed-key rules as `create`.
60
+ - Query options on `BaseServiceFindOptions`: `innerJoin`, `queryBuilderWhere`, `totalFindOptions` and `sortBy` for joined, filtered and counted lists.
61
+ - `CommonEntity`: nanoid public `id`, internal numeric id, optimistic-locking `version`, UTC timestamps and idempotent inserts.
62
+ - `ListQueryDto`, `ByIdDto`, `ByEmailDto`, `ExcludeIdDto`, plus `PaginatedResult`, `ReservedRequestHeaders`, `AuthenticatedRequest` and string-literal union types for the shared enums.
63
+ - `ApiErrorBody` and `ReservedRequestHeaderName`, re-exported from `@bearei/contracts`.
64
+ - `createResponseSanitizer` (replaces `createSanitizeResponseEntity`), `formatMobileNumber` (replaces `buildMobileNumber`) and `generateRandomNumberString` (replaces `generateRandomNumber`).
65
+ - `runWithDatabaseRetry` for transient database connection failures.
66
+ - `AllowAccess`, `RequirePermissions` and `RequireSubscriptionFeatures` decorators, alongside the existing validators.
67
+ - Unit tests for every module, root-export smoke test, `test/setup.ts`, and CI workflows for verification and tag-driven releases.
60
68
 
61
69
  ### Changed
62
70
 
63
- - `ActionLogService` is best-effort: unless logging is explicitly enabled and headers are forwarded, it skips the write and never fails the business operation.
64
- - `JwtService.verifyAsync` normalizes verification failures to `UNAUTHORIZED` and logs the underlying reason.
65
- - `extractBearerToken` now matches the `Bearer` scheme case-insensitively, accepts a configurable header name and returns `undefined` for malformed or non-string headers.
66
- - `ExternalService.createActionLog` takes the request headers plus `{action, serviceName, data, ...}` instead of a single options object.
67
- - `ListQueryDto` transforms accept empty query values, numeric strings and date arrays without producing `NaN` or invalid dates.
68
- - `@bearei/contracts` now owns `HTTP_EXCEPTION_CODE`, `LANGUAGE`, `ORDER`, `ApiErrorBody`, `ReservedRequestHeaderName` and `PaginatedResult`. `@bearei/nest` re-exports the same names, and `PaginatedResult<T>` is no longer constrained to `CommonEntity`.
71
+ - `ActionLogService` is best-effort: unless logging is explicitly enabled and headers are forwarded, it skips the write and never fails the business operation.
72
+ - `JwtService.verifyAsync` normalizes verification failures to `UNAUTHORIZED` and logs the underlying reason.
73
+ - `extractBearerToken` now matches the `Bearer` scheme case-insensitively, accepts a configurable header name and returns `undefined` for malformed or non-string headers.
74
+ - `ExternalService.createActionLog` takes the request headers plus `{action, serviceName, data, ...}` instead of a single options object.
75
+ - `ListQueryDto` transforms accept empty query values, numeric strings and date arrays without producing `NaN` or invalid dates.
76
+ - `@bearei/contracts` now owns `HTTP_EXCEPTION_CODE`, `LANGUAGE`, `ORDER`, `ApiErrorBody`, `ReservedRequestHeaderName` and `PaginatedResult`. `@bearei/nest` re-exports the same names, and `PaginatedResult<T>` is no longer constrained to `CommonEntity`.
69
77
 
70
78
  ### Removed
71
79
 
72
- - Application scaffold: `AppModule`, `AppController`, `AppService`, `main.ts` and the e2e test harness.
73
- - Fastify and Helmet platform dependencies; the library no longer chooses an HTTP adapter.
74
- - The `crypto` runtime dependency; signing uses Node's built-in `crypto`.
75
- - `ENTITY_STATUS`, `EntityStatus`, `entityStatus`, `beforeSoftRemove` and `beforeRecover`.
76
- - The old `access/`, `app.*` and `authentication.service` modules.
80
+ - Application scaffold: `AppModule`, `AppController`, `AppService`, `main.ts` and the e2e test harness.
81
+ - Fastify and Helmet platform dependencies; the library no longer chooses an HTTP adapter.
82
+ - The `crypto` runtime dependency; signing uses Node's built-in `crypto`.
83
+ - `ENTITY_STATUS`, `EntityStatus`, `entityStatus`, `beforeSoftRemove` and `beforeRecover`.
84
+ - The old `access/`, `app.*` and `authentication.service` modules.
package/README.md CHANGED
@@ -8,9 +8,9 @@ This package was previously published as `@bearei/service-common` (last release
8
8
 
9
9
  ## Requirements
10
10
 
11
- - Node.js >= 20
12
- - NestJS 11
13
- - TypeORM 1.x
11
+ - Node.js >= 20
12
+ - NestJS 11
13
+ - TypeORM 1.x
14
14
 
15
15
  ## Installation
16
16
 
package/README.zh-CN.md CHANGED
@@ -8,9 +8,9 @@ Bearei NestJS 服务的共享基础模块:通用 CRUD 基础服务、认证与
8
8
 
9
9
  ## 环境要求
10
10
 
11
- - Node.js >= 20
12
- - NestJS 11
13
- - TypeORM 1.x
11
+ - Node.js >= 20
12
+ - NestJS 11
13
+ - TypeORM 1.x
14
14
 
15
15
  ## 安装
16
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bearei/nest",
3
- "version": "2.0.0-dev.1",
3
+ "version": "2.0.0-dev.2",
4
4
  "description": "Shared NestJS and TypeORM building blocks for Bearei services",
5
5
  "keywords": [
6
6
  "bearei",
@@ -29,8 +29,7 @@
29
29
  "./package.json": "./package.json"
30
30
  },
31
31
  "files": [
32
- "dist",
33
- "CHANGELOG.md"
32
+ "dist"
34
33
  ],
35
34
  "engines": {
36
35
  "node": ">=20"
@@ -116,10 +115,8 @@
116
115
  "clean": "shx rm -rf dist",
117
116
  "format": "prettier --write .",
118
117
  "lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
119
- "lint:fix": "eslint \"src/**/*.ts\" \"test/**/*.ts\" --fix",
120
118
  "pack": "yarn pack -o /tmp/bearei-nest.tgz && bash .github/scripts/verify-tarball.sh /tmp/bearei-nest.tgz",
121
119
  "prepack": "yarn build",
122
- "release": "yarn npm publish --access public",
123
120
  "test": "jest",
124
121
  "test:coverage": "jest --coverage",
125
122
  "test:cov": "jest --coverage",