Skip to content

Commit 369f3c8

Browse files
committed
release: prepare v3.3.0
1 parent 8c9e05b commit 369f3c8

38 files changed

Lines changed: 427 additions & 83 deletions

.github/workflows/publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7777
run: |
7878
if [ -z "${NODE_AUTH_TOKEN:-}" ]; then
79-
echo "::error::NPM_TOKEN is not configured or is not available to this repository. Grant the same npm publish secret used by schema-dsl to vextjs/monSQLize, or configure npm trusted publishing and adjust this workflow."
79+
echo "::error::NPM_TOKEN is not configured or is not available to devcodex-labs/monSQLize. Grant this repository an npm publish secret, or configure npm trusted publishing and adjust this workflow."
8080
exit 2
8181
fi
8282
npm whoami --registry=https://registry.npmjs.org/
@@ -135,9 +135,9 @@ jobs:
135135
cd "${CONSUMER_DIR}"
136136
npm init -y
137137
npm install "monsqlize@${VERSION}" "typescript@5.9.3" "@types/node@25.6.2" --ignore-scripts --no-audit --no-fund --registry=https://registry.npmjs.org/
138-
node -e "const p=require('monsqlize/package.json'); const M=require('monsqlize'); if(!M || p.version!==process.argv[1] || typeof M.dataTasks?.preview!=='function') process.exit(1)" "${VERSION}"
139-
node --input-type=module -e "import M,{dataTasks} from 'monsqlize'; if(!M || typeof dataTasks?.apply!=='function') process.exit(1)"
140-
node -e "require('node:fs').writeFileSync('consumer.ts', \"import MonSQLize, { dataTasks } from 'monsqlize';\\nvoid MonSQLize; void dataTasks.preview;\\n\")"
138+
node -e "const p=require('monsqlize/package.json'); const M=require('monsqlize'); if(!M || p.version!==process.argv[1] || typeof M.defineModel!=='function' || typeof M.dataTasks?.preview!=='function') process.exit(1)" "${VERSION}"
139+
node --input-type=module -e "import M,{dataTasks,defineModel} from 'monsqlize'; if(!M || typeof M.defineModel!=='function' || typeof defineModel!=='function' || typeof dataTasks?.apply!=='function') process.exit(1)"
140+
node -e "require('node:fs').writeFileSync('consumer.ts', \"import MonSQLize, { dataTasks, defineModel, Model, type InferModelDocument } from 'monsqlize';\\nconst User = defineModel('registry_users', { schema: { email: 'email!', age: 'number?' } });\\ntype IsAny<T> = 0 extends (1 & T) ? true : false;\\ntype AssertFalse<T extends false> = T;\\ntype DescriptorDocumentIsNotAny = AssertFalse<IsAny<InferModelDocument<typeof User>>>;\\nModel.define(User);\\nconst users = new MonSQLize({ type: 'mongodb', databaseName: 'consumer' }).model(User);\\nvoid (null as DescriptorDocumentIsNotAny | null); void users; void dataTasks.preview;\\n\")"
141141
./node_modules/.bin/tsc --noEmit --module NodeNext --moduleResolution NodeNext --target ES2021 consumer.ts
142142
./node_modules/.bin/monsqlize --version | grep -Fx "${VERSION}"
143143

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
# CHANGELOG
22

3-
> Summary index — the latest stable release details are in [changelogs/v3.2.0.md](./changelogs/v3.2.0.md); the earlier RC note remains an unpublished rehearsal archive.
4-
> **Last updated**: 2026-08-07
3+
> Summary index — the newest versioned release details are in [changelogs/v3.3.0.md](./changelogs/v3.3.0.md); the earlier RC note remains an unpublished rehearsal archive.
4+
> **Last updated**: 2026-08-11
55
66
---
77

8+
## Unreleased
9+
10+
No changes are currently recorded after v3.3.0.
11+
812
## Version Overview
913

1014
| Version | Date | Summary | Details |
1115
|---------|------|---------|---------|
16+
| [v3.3.0](./changelogs/v3.3.0.md) | 2026-08-11 | Minor: static Model schema type inference, schema-dsl 3.0.4, and silent-by-default Pool logging | [View](./changelogs/v3.3.0.md) |
1217
| [v3.2.0](./changelogs/v3.2.0.md) | 2026-08-07 | Minor: Vector Search APIs, relation-safe Model deletion, and relation projection improvements | [View](./changelogs/v3.2.0.md) |
1318
| [v3.1.0](./changelogs/v3.1.0.md) | 2026-07-15 | Minor: schema-dsl v3 GA consumption, canonical validation errors, and normalized full-document persistence | [View](./changelogs/v3.1.0.md) |
1419
| [v3.0.0](./changelogs/v3.0.0.md) | 2026-07-14 | Major: two-instance preview/apply/restore data tasks, write-path policy, runtime-scoped schema DSL, stricter OCC/sync/query contracts, and release recovery controls | [View](./changelogs/v3.0.0.md) |

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Upgrade and security: [Migration Guide](./MIGRATION.md) · [Private Vulnerabilit
1414

1515
The npm `latest` dist-tag and GitHub Pages are the stable channel; `main` may contain the next release. Pages deployment accepts only a versioned Git tag whose package version is already present on npm, so unpublished APIs are not promoted as stable documentation.
1616

17-
This source tree contains the stable `3.1.0` release candidate, pinned to verified registry `schema-dsl@3.0.0`. The v3 package remains subject to the full release gate before its immutable tag and npm publication.
17+
This development source is pinned to verified registry `schema-dsl@3.0.4`. The v3 package remains subject to the full release gate before an immutable tag and npm publication.
1818

1919
```bash
2020
npm install monsqlize
@@ -234,6 +234,30 @@ const user = await User.insertOne({
234234
});
235235
```
236236

237+
### TypeScript Schema Inference
238+
239+
For a static object-literal schema, `defineModel()` carries the schema-derived document type from definition through registration to runtime access. Registration remains explicit, so it does not change the process-wide Model registry behavior.
240+
241+
```ts
242+
import { defineModel, Model } from 'monsqlize';
243+
244+
const User = defineModel('users', {
245+
schema: {
246+
email: 'email!',
247+
age: 'number?'
248+
}
249+
});
250+
251+
Model.define(User);
252+
253+
const users = msq.model(User);
254+
const user = await users.findOne({ email: 'ada@example.com' });
255+
// user?.email: string
256+
// user?.age: number | undefined
257+
```
258+
259+
Call `Model.define(User)` before `model(User)`, `use(...).model(User)`, or `pool(...).model(User)`. Callback-based or dynamically composed schemas continue to use the existing explicit generic API, such as `msq.model<UserDocument>('users')`; managed fields added by timestamps, soft delete, versioning, relations, or virtuals are not synthesized into this schema-derived type.
260+
237261
When a service needs runtime-local custom types, messages, locale, or an already-owned schema-dsl runtime, configure `schemaDsl` on the MonSQLize instance:
238262

239263
```js

changelogs/unreleased.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Unreleased
22

3-
## Changes after v3.2.0
3+
## Changes after v3.3.0
44

5-
- Fixed Pool logger propagation so PoolSelector and HealthChecker use the manager logger; omitted loggers are now silent instead of writing to `console`.
5+
No changes are currently recorded after v3.3.0.

changelogs/v3.3.0.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# monSQLize v3.3.0
2+
3+
> Release date: 2026-08-11
4+
5+
## Highlights
6+
7+
- Added schema-derived TypeScript document inference for static Model definitions.
8+
- Made Pool logging silent by default while preserving explicit logger delivery.
9+
10+
## Added
11+
12+
- Added `defineModel()` and `ModelDescriptor` so object-literal `schema` definitions carry their inferred document type through `Model.define()`, `model()`, `scopedModel()`, `use().model()`, and `pool().model()`.
13+
- Added CJS, ESM, public-type, compatibility, pack-consumer, and registry-consumer verification for the descriptor API.
14+
15+
## Changed
16+
17+
- Updated the exact production dependency from `schema-dsl@3.0.0` to `schema-dsl@3.0.4`.
18+
- Extended current-version validation so README and bilingual dependency-governance documents must match the exact `schema-dsl` version in `package.json`.
19+
20+
## Fixed
21+
22+
- Forwarded the configured `ConnectionPoolManager` logger to `PoolSelector`, `HealthChecker`, and `PoolStatsManager`.
23+
- Removed implicit `console` fallback logging from Pool helpers when no logger is configured.
24+
25+
## Compatibility boundaries
26+
27+
- This is a backward-compatible minor release. Existing string-based Model registration/access, manual TypeScript generics, Pool APIs, and explicit process-wide Model registry lifecycle remain unchanged.
28+
- `defineModel()` creates a static descriptor; it does not register the Model. Call `Model.define(descriptor)` before binding it through a runtime accessor.
29+
- Callback or dynamically composed schemas continue to use explicit document generics. Schema-derived types do not synthesize timestamp, soft-delete, version, relation, or virtual fields.

docs/en/file-dependency-governance.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ The current root package adopts the **precise version dependency strategy**:
55
| Dependencies | Strategy | Reasons |
66
|------|------|------|
77
| `cache-hub` | Exact version `2.2.4` | The root direct dependency and schema-dsl integration share the verified cache runtime baseline |
8-
| `schema-dsl` | Exact stable version `3.0.0` | Node 18-compatible v3 runtime with a side-effect-free root entry and the isolated `schema-dsl/runtime` entry |
8+
| `schema-dsl` | Exact stable version `3.0.4` | Node 18-compatible v3 runtime with a side-effect-free root entry and the isolated `schema-dsl/runtime` entry |
99
| `ioredis` | Exact version `5.11.1` | Runtime Redis dependency; enabled only when Redis-backed features are configured |
1010
| `mongodb-memory-server` | Dev exact version `10.4.3` | Test tooling remains compatible with Node `>=16.20.1`, preserving the package's Node 18 CI contract |
1111

12-
> monSQLize `3.1.0` is pinned to verified registry `schema-dsl@3.0.0`. Local `file:` or workspace resolutions are prohibited from the release lockfile. Historical npm `schema-dsl@2.3.x` artifacts are not accepted as substitutes.
12+
> The current monSQLize line is pinned to verified registry `schema-dsl@3.0.4`. Local `file:` or workspace resolutions are prohibited from the release lockfile. Historical npm `schema-dsl@2.3.x` artifacts are not accepted as substitutes.
1313
1414
## Current Risk
1515

@@ -23,7 +23,7 @@ The current root package adopts the **precise version dependency strategy**:
2323
## Development status
2424

2525
- The root direct `cache-hub` dependency is fixed to `2.2.4`; no workspace override is required.
26-
- `schema-dsl` is fixed to registry `3.0.0`, `ioredis` to `5.11.1`, and test tooling `mongodb-memory-server` to `10.4.3`.
26+
- `schema-dsl` is fixed to registry `3.0.4`, `ioredis` to `5.11.1`, and test tooling `mongodb-memory-server` to `10.4.3`.
2727
- Local sibling `../schema-dsl` is only used for debugging the upstream library itself and is no longer a prerequisite for monSQLize root package installation.
2828

2929

@@ -44,7 +44,7 @@ The v3 consumer migration used an identity-bound local tarball for rehearsal and
4444
2. Install the exact GA and run `npm run type-check`, Model unit/integration tests, root String prototype probes, examples, and packed-consumer verification.
4545
3. All model-related unit tests/integration tests passed (covered with `npm run test:unit` and `npm run test:integration`).
4646
4. `npm run test:examples` all passed.
47-
5. `npm run release:preflight` remains the final gate; it must reject local `file:` resolution and require registry `schema-dsl@3.0.0` for GA.
47+
5. `npm run release:preflight` remains the final gate; it must reject local `file:` resolution and require registry `schema-dsl@3.0.4` for GA.
4848
6. This file, Profile, CHANGELOG, package manifest, and lockfile must share the same candidate or GA identity.
4949

5050
## cache-hub 2.2.4 upgrade verification

docs/en/model.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,32 @@ When validation succeeds, those six write paths continue with schema-dsl's norma
637637

638638
Patch-style writes such as `updateOne()`, `updateMany()`, `findOneAndUpdate()`, `upsertOne()`, `incrementOne()`, and `updateBatch()` receive MongoDB update operators or aggregation pipelines rather than the final document. monSQLize does not run full-document schema validation for those patch writes; use hooks, `Model.validate()`, or application-side validation when a patch must be checked against a complete domain object.
639639

640+
## TypeScript static schema inference
641+
642+
Available since monSQLize 3.3.0.
643+
644+
For a static object-literal schema, `defineModel()` carries the schema-derived document type through registration to `model()`, `scopedModel()`, `use().model()`, and `pool().model()`. The descriptor does not register itself, so the existing process-wide registry lifecycle stays explicit.
645+
646+
```typescript
647+
import { defineModel, Model } from 'monsqlize';
648+
649+
const User = defineModel('users', {
650+
schema: {
651+
email: 'email!',
652+
age: 'number?',
653+
},
654+
});
655+
656+
Model.define(User);
657+
658+
const users = msq.model(User);
659+
const user = await users.findOne({ email: 'ada@example.com' });
660+
// user?.email: string
661+
// user?.age: number | undefined
662+
```
663+
664+
Call `Model.define(User)` before binding the descriptor through a runtime accessor. Callback-based or dynamically composed schemas continue to use the existing explicit generic form, such as `msq.model<UserDocument>('users')`. The inferred type contains schema fields only; timestamp, soft-delete, version, relation, and virtual fields remain application-defined types.
665+
640666

641667
## Basic usage
642668

docs/zh/file-dependency-governance.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
| 依赖 | 策略 | 原因 |
66
|------|------|------|
77
| `cache-hub` | 精确版本 `2.2.4` | 根包 direct dependency 与 schema-dsl 接入共享已验证的缓存运行时基线 |
8-
| `schema-dsl` | 稳定精确版本 `3.0.0` | Node 18 兼容的 v3 runtime,root 无副作用并保留隔离的 `schema-dsl/runtime` 入口 |
8+
| `schema-dsl` | 稳定精确版本 `3.0.4` | Node 18 兼容的 v3 runtime,root 无副作用并保留隔离的 `schema-dsl/runtime` 入口 |
99
| `ioredis` | 精确版本 `5.11.1` | Redis 运行时依赖;仅在配置 Redis-backed 能力时启用 |
1010
| `mongodb-memory-server` | 开发精确版本 `10.4.3` | 测试工具支持 Node `>=16.20.1`,保持包的 Node 18 CI 契约 |
1111

12-
> monSQLize `3.1.0` 已精确锁定经验证的 registry `schema-dsl@3.0.0`。发布 lockfile 禁止出现本地 `file:` 或 workspace 解析。历史 npm `schema-dsl@2.3.x` 不能作为替代物料。
12+
> monSQLize 当前版本线已精确锁定经验证的 registry `schema-dsl@3.0.4`。发布 lockfile 禁止出现本地 `file:` 或 workspace 解析。历史 npm `schema-dsl@2.3.x` 不能作为替代物料。
1313
1414
## 当前风险
1515

@@ -22,7 +22,7 @@
2222
### 开发态
2323

2424
- 根包 direct `cache-hub` 固定为 `2.2.4`,不需要 workspace override。
25-
- `schema-dsl` 固定为 registry `3.0.0``ioredis` 固定为 `5.11.1`,测试工具 `mongodb-memory-server` 固定为 `10.4.3`
25+
- `schema-dsl` 固定为 registry `3.0.4``ioredis` 固定为 `5.11.1`,测试工具 `mongodb-memory-server` 固定为 `10.4.3`
2626
- 本地 sibling `../schema-dsl` 仅用于上游库自身调试,不再作为 monSQLize 根包安装前提。
2727

2828
### 发布态
@@ -42,7 +42,7 @@ v3 消费迁移在演练阶段使用 identity-bound 本地 tarball,发布阶
4242
2. 精确安装 GA 后执行 `npm run type-check`、Model 单元/集成测试、root String prototype 探针、examples 与 packed consumer 验证。
4343
3. model 相关单测 / 集成测试全通过(随 `npm run test:unit``npm run test:integration` 覆盖)。
4444
4. `npm run test:examples` 全通过。
45-
5. 发布前仍需以 `npm run release:preflight` 作为最终门禁;正式发布必须拒绝本地 `file:` 解析并要求 registry `schema-dsl@3.0.0`
45+
5. 发布前仍需以 `npm run release:preflight` 作为最终门禁;正式发布必须拒绝本地 `file:` 解析并要求 registry `schema-dsl@3.0.4`
4646
6. 本文件、Profile、CHANGELOG、package manifest 与 lockfile 必须保持同一候选或 GA identity。
4747

4848
## cache-hub 2.2.4 升级验证

docs/zh/model.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,32 @@ monSQLize 使用 `schema-dsl` 作为 Model 文档的 schema 校验引擎。每
610610

611611
`updateOne()``updateMany()``findOneAndUpdate()``upsertOne()``incrementOne()``updateBatch()` 这类 patch 写入接收的是 MongoDB update operators 或 aggregation pipeline,而不是最终完整文档。monSQLize 不会对这些 patch 写入执行完整文档 schema 验证;如果业务要求 patch 也符合完整领域对象,请在 hooks、`Model.validate()` 或应用层校验中处理。
612612

613+
### TypeScript 静态 schema 类型推断
614+
615+
自 monSQLize 3.3.0 起提供。
616+
617+
对于静态对象字面量 schema,`defineModel()` 会把 schema 推断出的文档类型带到 `model()``scopedModel()``use().model()``pool().model()`。描述符本身不会注册 Model,因此原有的进程级 registry 生命周期仍保持显式。
618+
619+
```typescript
620+
import { defineModel, Model } from 'monsqlize';
621+
622+
const User = defineModel('users', {
623+
schema: {
624+
email: 'email!',
625+
age: 'number?',
626+
},
627+
});
628+
629+
Model.define(User);
630+
631+
const users = msq.model(User);
632+
const user = await users.findOne({ email: 'ada@example.com' });
633+
// user?.email: string
634+
// user?.age: number | undefined
635+
```
636+
637+
必须先调用 `Model.define(User)`,再通过 runtime accessor 绑定描述符。回调式或动态组合 schema 仍使用既有的显式泛型形式,例如 `msq.model<UserDocument>('users')`。推断类型只包含 schema 字段;timestamps、soft delete、version、relations 和 virtuals 增加的字段仍应由应用自行声明。
638+
613639
### 基本使用
614640

615641
```javascript

licenses/production-dependencies.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{ "name": "cache-hub", "version": "2.2.4", "license": "Apache-2.0", "source": "package-metadata" },
66
{ "name": "ioredis", "version": "5.11.1", "license": "MIT", "source": "package-metadata" },
77
{ "name": "mongodb", "version": "6.21.0", "license": "Apache-2.0", "source": "package-metadata" },
8-
{ "name": "schema-dsl", "version": "3.0.0", "license": "Apache-2.0", "source": "package-metadata" },
8+
{ "name": "schema-dsl", "version": "3.0.4", "license": "Apache-2.0", "source": "package-metadata" },
99
{ "name": "ssh2", "version": "1.17.0", "license": "MIT", "source": "LICENSE:d06b5d27bbbbe22c36b1fd88406b1208876e2d37d795f5b8eaed951a459a3111" }
1010
]
1111
}

0 commit comments

Comments
 (0)