Skip to content

Commit 2be2ea1

Browse files
committed
feat: release monsqlize 2.0.5
1 parent e8ba886 commit 2be2ea1

13 files changed

Lines changed: 115 additions & 131 deletions

CHANGELOG.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# CHANGELOG
22

3-
> Summary index — current release details are packaged in [changelogs/v2.0.4.md](./changelogs/v2.0.4.md); historical details live in the repository changelog archive.
4-
> **Last updated**: 2026-06-12
3+
> Summary index — current release details are packaged in [changelogs/v2.0.5.md](./changelogs/v2.0.5.md); historical details live in the repository changelog archive.
4+
> **Last updated**: 2026-06-13
55
66
---
77

88
## Version Overview
99

1010
| Version | Date | Summary | Details |
1111
|---------|------|---------|---------|
12+
| [v2.0.5](./changelogs/v2.0.5.md) | 2026-06-13 | Patch: Model schema adapter delegates DSL type authority to `schema-dsl@2.0.10`, removing the duplicated monSQLize allowlist while preserving legacy aliases and business literals | [View](./changelogs/v2.0.5.md) |
1213
| [v2.0.4](./changelogs/v2.0.4.md) | 2026-06-12 | Patch: production-safe Model index rollout controls, `schema-dsl@2.0.9`, capability-index wording cleanup, and documentation home refinements | [View](./changelogs/v2.0.4.md) |
1314
| [v2.0.3](./changelogs/v2.0.3.md) | 2026-06-11 | Patch: v1 compatibility fixes, public stats APIs, standalone docs-site link safety, bilingual docs consistency, and release preflight alignment | [View](./changelogs/v2.0.3.md) |
1415
| [v2.0.2](./changelogs/v2.0.2.md) | 2026-06-09 | Patch: direct runtime, optional and development dependencies pinned to exact versions for deterministic consumer installs | [View](./changelogs/v2.0.2.md) |
@@ -447,7 +448,8 @@ const result = await msq.collection('orders').insertOne(dataFromMongoose);
447448
changelogs/
448449
├── README.md # 变更文档说明
449450
├── TEMPLATE.md # 变更文档模板
450-
├── v2.0.4.md # 当前发布详细变更
451+
├── v2.0.5.md # 当前发布详细变更
452+
├── v2.0.4.md # v2.0.4 详细变更
451453
├── v2.0.3.md # v2.0.3 详细变更
452454
├── v2.0.2.md # v2.0.2 详细变更
453455
├── v2.0.1.md # v2.0.1 详细变更
@@ -502,7 +504,8 @@ changelogs/
502504

503505
## 相关文档
504506

505-
- [changelogs/v2.0.4.md](./changelogs/v2.0.4.md) - 当前发布详细变更文档
507+
- [changelogs/v2.0.5.md](./changelogs/v2.0.5.md) - 当前发布详细变更文档
508+
- [changelogs/v2.0.4.md](./changelogs/v2.0.4.md) - v2.0.4 详细变更文档
506509
- [changelogs/v2.0.3.md](./changelogs/v2.0.3.md) - v2.0.3 详细变更文档
507510
- [changelogs/v2.0.2.md](./changelogs/v2.0.2.md) - v2.0.2 详细变更文档
508511
- [changelogs/v2.0.1.md](./changelogs/v2.0.1.md) - v2.0.1 详细变更文档
@@ -511,5 +514,5 @@ changelogs/
511514

512515
---
513516

514-
**最后更新**: 2026-06-12
517+
**最后更新**: 2026-06-13
515518

changelogs/unreleased.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
11
# Unreleased
22

3-
## Fixed
4-
5-
- No unreleased fixes yet.
6-
7-
## Changed
8-
9-
- No unreleased changes yet.
10-
11-
## Documentation
12-
133
- No unreleased documentation changes yet.

changelogs/v2.0.5.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# v2.0.5 — 2026-06-13
2+
3+
## Overview
4+
5+
v2.0.5 is a compatibility patch for Model schema validation. It removes the duplicated schema-dsl base-type allowlist from monSQLize and delegates DSL type decisions to schema-dsl, keeping schema-dsl as the single validation DSL authority.
6+
7+
---
8+
9+
## Runtime Fixes
10+
11+
- Removed the monSQLize-side schema-dsl base-type allowlist from the Model schema adapter.
12+
- Delegated schema compilation and unknown-type handling to schema-dsl diagnostics instead of maintaining a second type table.
13+
- Preserved compatibility for schema-dsl-owned aliases such as `int`, `mixed`, `buffer` and `objectid`.
14+
- Preserved existing literal business DSL strings such as `datetime` and `admin_login!` through schema-dsl fallback semantics.
15+
16+
## Dependencies
17+
18+
- Targets `schema-dsl@2.0.10`, which contains the shared legacy DSL aliases and structured diagnostics used by this patch.
19+
- Keeps the root `cache-hub@2.2.4` dependency unchanged.
20+
21+
## Compatibility
22+
23+
- SemVer: patch release.
24+
- Breaking changes: none.
25+
- Existing v2 Model schema declarations continue to validate through the same public Model API.
26+
- Consumer projects do not need to change source code for the checked schema alias and business-literal paths.
27+
28+
## Validation
29+
30+
- `npm run type-check`
31+
- targeted Model schema validation tests
32+
- targeted pure-function and branch coverage tests
33+
- local schema-dsl@2.0.10 compatibility smoke

docs/en/file-dependency-governance.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ The current root package adopts the **precise version dependency strategy**:
44

55
| Dependencies | Strategy | Reasons |
66
|------|------|------|
7-
| `cache-hub` | Exact version `2.2.4` | The npm latest release has passed compatibility verification; the root direct dependency is fixed to 2.2.4, and `schema-dsl@2.0.9` declares the same transitive dependency version |
8-
| `schema-dsl` | Exact version `2.0.9` | npm `latest` points to 2.0.9, and this version is the current official TypeScript line; monSQLize only relies on `dsl` / `validate` capabilities, and uses 2.0.9 for type-check, model test, integration, and examples verification |
7+
| `cache-hub` | Exact version `2.2.4` | The npm latest release has passed compatibility verification; the root direct dependency is fixed to 2.2.4, and `schema-dsl@2.0.10` declares the same transitive dependency version |
8+
| `schema-dsl` | Exact version `2.0.10` | The release chain targets the current non-deprecated TypeScript line; monSQLize relies on schema-dsl for DSL parsing, validation and alias diagnostics, and uses 2.0.10 for type-check and Model schema verification |
99

10-
> `schema-dsl@2.0.9` is the current npm `latest`; the historical `2.3.x` line exists on npm but has been marked as misreleased/deprecated and must not be followed by upgrades.
10+
> `schema-dsl@2.0.10` is the intended latest for this release chain; the historical `2.3.x` line exists on npm but has been marked as misreleased/deprecated and must not be followed by upgrades.
1111
1212
## Current Risk
1313

@@ -20,8 +20,8 @@ The current root package adopts the **precise version dependency strategy**:
2020

2121
## Development status
2222

23-
- The root direct `cache-hub` dependency is fixed to `2.2.4`; `schema-dsl@2.0.9` also declares `cache-hub@2.2.4`, so no additional override is needed.
24-
- `schema-dsl` is fixed to `2.0.9`.
23+
- The root direct `cache-hub` dependency is fixed to `2.2.4`; `schema-dsl@2.0.10` also declares `cache-hub@2.2.4`, so no additional override is needed.
24+
- `schema-dsl` is fixed to `2.0.10`.
2525
- Local sibling `../schema-dsl` is only used for debugging the upstream library itself and is no longer a prerequisite for monSQLize root package installation.
2626

2727

@@ -36,21 +36,21 @@ npm run release:preflight
3636

3737
## schema-dsl 2.x upgrade verification
3838

39-
The dependency governance baseline has upgraded and fixed `schema-dsl` from the historical `^1.2.5` to `2.0.9`. The verification standard is as follows:
39+
The dependency governance baseline has upgraded and fixed `schema-dsl` from the historical `^1.2.5` to `2.0.10`. The verification standard is as follows:
4040

41-
1. The upstream released the **non-deprecated** 2.x latest version on npm: `2.0.9`.
42-
2. `npm install schema-dsl@2.0.9 --save-exact` followed by `npm run type-check`.
41+
1. The upstream released the **non-deprecated** 2.x latest version on npm: `2.0.10`.
42+
2. `npm install schema-dsl@2.0.10 --save-exact` followed by `npm run type-check`.
4343
3. All model-related unit tests/integration tests passed (covered with `npm run test:unit` and `npm run test:integration`).
4444
4. `npm run test:examples` all passed.
4545
5. `npm run release:preflight` still needs to be used as the final access control before release.
46-
6. This file, Profile, CHANGELOG, and lockfile must be synchronized to `2.0.9`.
46+
6. This file, Profile, CHANGELOG, and lockfile must be synchronized to `2.0.10`.
4747

4848
## cache-hub 2.2.4 upgrade verification
4949

5050
The dependency governance baseline has upgraded and fixed `cache-hub` from `1.0.0` to `2.2.4`. The verification standard is as follows:
5151

5252
1. The upstream npm `latest` is `2.2.4`, and the Node.js engine requirement remains `>=18`, matching the current monSQLize baseline.
53-
2. The root direct dependency resolves to `2.2.4`; `schema-dsl@2.0.9` also declares `cache-hub@2.2.4`.
53+
2. The root direct dependency resolves to `2.2.4`; `schema-dsl@2.0.10` also declares `cache-hub@2.2.4`.
5454
3. `npm run type-check`, targeted cache / function-cache tests, website build, and memory probe must pass.
5555
4. This file, Profile, CHANGELOG, package manifest, and lockfile must be synchronized with the root direct dependency `2.2.4` baseline.
5656

docs/en/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pageType: home
33

44
hero:
5-
badge: v2.0.4 TypeScript release
5+
badge: v2.0.5 TypeScript release
66
name: monSQLize
77
text: TypeScript MongoDB Engine
88
tagline: MongoDB-native APIs with cache-hub L1/L2 caching, multi-pool routing, Saga workflows, and schema-ready models.

docs/zh/file-dependency-governance.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
| 依赖 | 策略 | 原因 |
66
|------|------|------|
7-
| `cache-hub` | 精确版本 `2.2.4` | 上游 npm latest 已发布稳定版本并通过兼容验证;根包 direct dependency 固定到 2.2.4,`schema-dsl@2.0.9` 声明的传递依赖同为 2.2.4 |
8-
| `schema-dsl` | 精确版本 `2.0.9` | npm `latest` 指向 2.0.9,且该版本是当前 TypeScript 正式线;monSQLize 仅依赖 `dsl` / `validate` 能力,并以 2.0.9 执行 type-check、model 测试、integration 与 examples 验证 |
7+
| `cache-hub` | 精确版本 `2.2.4` | 上游 npm latest 已发布稳定版本并通过兼容验证;根包 direct dependency 固定到 2.2.4,`schema-dsl@2.0.10` 声明的传递依赖同为 2.2.4 |
8+
| `schema-dsl` | 精确版本 `2.0.10` | 本次发布链路目标为当前非 deprecated 的 TypeScript 正式线;monSQLize 依赖 schema-dsl 统一负责 DSL 解析、验证与 alias diagnostics,并以 2.0.10 执行 type-check 与 Model schema 验证 |
99

10-
> `schema-dsl@2.0.9` 是当前 npm `latest`;npm 上历史 `2.3.x` 已标记为误发布 / deprecated,不得跟随升级。
10+
> `schema-dsl@2.0.10` 是本次发布链路的预期 latest;npm 上历史 `2.3.x` 已标记为误发布 / deprecated,不得跟随升级。
1111
1212
## 当前风险
1313

@@ -19,8 +19,8 @@
1919

2020
### 开发态
2121

22-
- 根包 direct `cache-hub` 固定为 `2.2.4``schema-dsl@2.0.9` 声明的 `cache-hub` 版本同为 `2.2.4`,不需要额外 override。
23-
- `schema-dsl` 固定为 `2.0.9`
22+
- 根包 direct `cache-hub` 固定为 `2.2.4``schema-dsl@2.0.10` 声明的 `cache-hub` 版本同为 `2.2.4`,不需要额外 override。
23+
- `schema-dsl` 固定为 `2.0.10`
2424
- 本地 sibling `../schema-dsl` 仅用于上游库自身调试,不再作为 monSQLize 根包安装前提。
2525

2626
### 发布态
@@ -34,21 +34,21 @@ npm run release:preflight
3434

3535
## schema-dsl 2.x 升级验证
3636

37-
依赖治理基线已将 `schema-dsl` 从历史 `^1.2.5` 升级并固定到 `2.0.9`,验证标准如下:
37+
依赖治理基线已将 `schema-dsl` 从历史 `^1.2.5` 升级并固定到 `2.0.10`,验证标准如下:
3838

39-
1. 上游在 npm 发布了**非 deprecated** 的 2.x latest 版本:`2.0.9`
40-
2. `npm install schema-dsl@2.0.9 --save-exact` 后通过 `npm run type-check`
39+
1. 上游在 npm 发布了**非 deprecated** 的 2.x latest 版本:`2.0.10`
40+
2. `npm install schema-dsl@2.0.10 --save-exact` 后通过 `npm run type-check`
4141
3. model 相关单测 / 集成测试全通过(随 `npm run test:unit``npm run test:integration` 覆盖)。
4242
4. `npm run test:examples` 全通过。
4343
5. 发布前仍需以 `npm run release:preflight` 作为最终门禁。
44-
6. 本文件、Profile、CHANGELOG 与 lockfile 必须同步到 `2.0.9`
44+
6. 本文件、Profile、CHANGELOG 与 lockfile 必须同步到 `2.0.10`
4545

4646
## cache-hub 2.2.4 升级验证
4747

4848
依赖治理基线已将 `cache-hub``1.0.0` 升级并固定到 `2.2.4`,验证标准如下:
4949

5050
1. 上游 npm `latest``2.2.4`,Node.js 引擎要求仍为 `>=18`,与 monSQLize 当前基线一致。
51-
2. 根包 direct dependency 解析到 `2.2.4``schema-dsl@2.0.9` 也声明 `cache-hub@2.2.4`
51+
2. 根包 direct dependency 解析到 `2.2.4``schema-dsl@2.0.10` 也声明 `cache-hub@2.2.4`
5252
3. `npm run type-check`、缓存 / function-cache 定向测试、文档站构建与内存探针必须通过。
5353
4. 本文件、Profile、CHANGELOG、package manifest 与 lockfile 必须同步 root direct dependency 的 `2.2.4` 口径。
5454

docs/zh/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pageType: home
33

44
hero:
5-
badge: v2.0.4 TypeScript 正式版
5+
badge: v2.0.5 TypeScript 正式版
66
name: monSQLize
77
text: TypeScript MongoDB 增强引擎
88
tagline: 保留 MongoDB 原生体验,整合 cache-hub 两级缓存、多连接池路由、Saga 编排与可选 Model 层。

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "monsqlize",
3-
"version": "2.0.4",
3+
"version": "2.0.5",
44
"description": "TypeScript-native MongoDB ODM with multi-level caching (cache-hub), distributed locks, Saga orchestration, unified expression system (122 operators), connection pool management, ChangeStream sync, slow-query logging, and full v1 API compatibility",
55
"type": "commonjs",
66
"main": "./dist/cjs/index.cjs",
@@ -18,6 +18,7 @@
1818
"dist/**/*.cjs",
1919
"dist/**/*.mjs",
2020
"dist/**/*.d.ts",
21+
"changelogs/v2.0.5.md",
2122
"changelogs/v2.0.4.md",
2223
"changelogs/v2.0.3.md",
2324
"changelogs/v2.0.2.md",
@@ -116,7 +117,7 @@
116117
"cache-hub": "2.2.4",
117118
"ioredis": "5.8.2",
118119
"mongodb": "6.21.0",
119-
"schema-dsl": "2.0.9",
120+
"schema-dsl": "2.0.10",
120121
"ssh2": "1.17.0"
121122
}
122123
}

src/capabilities/model/schema-dsl.ts

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* - This file attempts require('schema-dsl') at module load time; if successful, dsl and validate are enabled;
1010
* otherwise it silently degrades.
1111
* - Exposes two variables (_schemaDslFn / _schemaValidateFn) and one wrapper factory (_makeValidatingDslFn).
12+
* - _makeValidatingDslFn intentionally delegates DSL semantics to schema-dsl instead of maintaining
13+
* a shadow type allowlist in monsqlize.
1214
*/
1315

1416
// ── schema-dsl type declarations ────────────────────────────────────────────
@@ -32,55 +34,16 @@ try {
3234
// schema-dsl not available – schema validation will be skipped
3335
}
3436

35-
// ── Known valid base types (consistent with v1) ──────────────────────────────
36-
const KNOWN_SCHEMA_BASE_TYPES = new Set([
37-
'string', 'number', 'boolean', 'integer', 'float', 'int', 'double', 'decimal',
38-
'date', 'objectid', 'uuid', 'email', 'url', 'buffer', 'binary',
39-
'object', 'array', 'any', 'mixed', 'null',
40-
]);
41-
4237
/**
43-
* Extract the base type name from a schema-dsl type string (strips modifiers like ! ? [] :range).
44-
*
45-
* Examples:
46-
* "string!" → "string"
47-
* "objectid!" → "objectid"
48-
* "invalid!" → "invalid"
49-
*/
50-
function _extractBaseType(typeStr: string): string {
51-
const m = typeStr.match(/^[a-zA-Z_]+/);
52-
return m ? m[0].toLowerCase() : '';
53-
}
54-
55-
/**
56-
* Wrap the schema-dsl dsl() function to eagerly validate field type strings during Model.define().
38+
* Wrap the schema-dsl dsl() function while keeping schema-dsl as the single DSL authority.
5739
*
5840
* Behavior:
59-
* - If a field type string contains an unknown base type, a TypeError is thrown immediately
60-
* (rather than silently failing at validation time).
61-
* - Enum DSL strings (e.g. "admin|user") are skipped — pipe-separated values are literal unions, not base types.
62-
*
63-
* This enables fast-fail at Model.define() time instead of silent degradation at runtime.
41+
* - monsqlize no longer keeps a duplicate schema-dsl type allowlist.
42+
* - Unknown types, custom types, aliases, and fallback behavior are delegated to schema-dsl.
43+
* - A future schema-dsl diagnostics API can be consumed here without parsing DSL strings in monsqlize.
6444
*/
6545
export function _makeValidatingDslFn(realDsl: SchemaDslFn): SchemaDslFn {
6646
const validating = function validatingDsl(fields: unknown): unknown {
67-
if (fields && typeof fields === 'object') {
68-
for (const [field, spec] of Object.entries(fields as Record<string, unknown>)) {
69-
if (typeof spec === 'string') {
70-
// v1 compat: enum DSL like "admin|user" is a literal-union, not a base type.
71-
if (spec.includes('|')) {
72-
continue;
73-
}
74-
const base = _extractBaseType(spec);
75-
if (base && !KNOWN_SCHEMA_BASE_TYPES.has(base)) {
76-
throw new TypeError(
77-
`[schema] Invalid type "${base}" in field "${field}". ` +
78-
`Known types: ${[...KNOWN_SCHEMA_BASE_TYPES].join(', ')}.`
79-
);
80-
}
81-
}
82-
}
83-
}
8447
return (realDsl as unknown as (f: unknown) => unknown)(fields);
8548
};
8649
return validating as unknown as SchemaDslFn;

0 commit comments

Comments
 (0)