Skip to content

Commit 4384c09

Browse files
committed
chore: prepare v2.0.4 release
1 parent d8c56ee commit 4384c09

34 files changed

Lines changed: 1079 additions & 221 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.3.md](./changelogs/v2.0.3.md); historical details live in the repository changelog archive.
4-
> **Last updated**: 2026-06-11
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
55
66
---
77

88
## Version Overview
99

1010
| Version | Date | Summary | Details |
1111
|---------|------|---------|---------|
12+
| [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) |
1213
| [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) |
1314
| [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) |
1415
| [v2.0.1](./changelogs/v2.0.1.md) | 2026-06-03 | Patch: model collection/pool compatibility, automatic-index task dedupe, runtime cache/pool v1 smooth-upgrade fixes, and current docs/types alignment | [View](./changelogs/v2.0.1.md) |
@@ -446,7 +447,8 @@ const result = await msq.collection('orders').insertOne(dataFromMongoose);
446447
changelogs/
447448
├── README.md # 变更文档说明
448449
├── TEMPLATE.md # 变更文档模板
449-
├── v2.0.3.md # 当前发布详细变更
450+
├── v2.0.4.md # 当前发布详细变更
451+
├── v2.0.3.md # v2.0.3 详细变更
450452
├── v2.0.2.md # v2.0.2 详细变更
451453
├── v2.0.1.md # v2.0.1 详细变更
452454
├── v2.0.0.md # v2 TypeScript 重写发布详细变更
@@ -500,13 +502,14 @@ changelogs/
500502

501503
## 相关文档
502504

503-
- [changelogs/v2.0.3.md](./changelogs/v2.0.3.md) - 当前发布详细变更文档
505+
- [changelogs/v2.0.4.md](./changelogs/v2.0.4.md) - 当前发布详细变更文档
506+
- [changelogs/v2.0.3.md](./changelogs/v2.0.3.md) - v2.0.3 详细变更文档
504507
- [changelogs/v2.0.2.md](./changelogs/v2.0.2.md) - v2.0.2 详细变更文档
505508
- [changelogs/v2.0.1.md](./changelogs/v2.0.1.md) - v2.0.1 详细变更文档
506509
- [README.md](./README.md) - 项目说明
507510
- [docs/](https://github.com/vextjs/monSQLize/blob/main/docs/index.md) - API 文档
508511

509512
---
510513

511-
**最后更新**: 2026-06-11
514+
**最后更新**: 2026-06-12
512515

README.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ monSQLize keeps the MongoDB driver mental model while adding the production feat
3939

4040
- Drop-in collection helpers that preserve MongoDB-style CRUD, aggregation, indexes, transactions, and Change Streams.
4141
- Smart caching through `cache-hub`, including local memory caching, optional Redis-backed L2 caching, automatic invalidation, and function-level caching.
42-
- A lightweight Model layer with `schema-dsl` validation, hooks, relations, populate, custom methods, timestamps, soft delete, and optimistic locking.
42+
- A lightweight Model layer with `schema-dsl` validation, hooks, relations, populate, custom methods, timestamps, soft delete, optimistic locking, and production-safe index preflight.
4343
- Multi-connection-pool support, pool health checks, pool-scoped collections/models, and fallback strategies.
4444
- Business locks and distributed locks for multi-instance deployments.
4545
- Saga orchestration for multi-step business workflows.
@@ -253,6 +253,27 @@ module.exports = {
253253

254254
Relative model paths are resolved from `process.cwd()`. In production services, prefer absolute paths such as `path.join(__dirname, 'models')`.
255255

256+
### Production Model Index Rollout
257+
258+
Model-declared indexes are still created automatically by default for backward compatibility. Production services can turn off automatic indexing and run an explicit preflight before creating missing indexes:
259+
260+
```js
261+
const db = new MonSQLize({
262+
type: 'mongodb',
263+
databaseName: 'mydb',
264+
config: { uri: 'mongodb://localhost:27017' },
265+
autoIndex: false
266+
});
267+
268+
const plan = await db.ensureModelIndexes({ models: ['users'], dryRun: true });
269+
270+
if (plan.totals.conflicts === 0) {
271+
await db.ensureModelIndexes({ models: ['users'], throwOnError: true });
272+
}
273+
```
274+
275+
`ensureModelIndexes()` creates only missing indexes. It does not drop, rename, or rebuild conflicting indexes.
276+
256277
### Populate
257278

258279
```js
@@ -497,19 +518,25 @@ npm run test:real-env:private
497518

498519
## Release Status
499520

500-
The current published release is `v2.0.3`.
521+
The current published release is `v2.0.4`.
501522

502523
Key release-readiness points:
503524

504525
- TypeScript rewrite completed for the current runtime and test entry points.
505526
- Package exports are consolidated under `dist/cjs`, `dist/esm`, and `dist/types`.
506527
- npm packages include the runtime bundles and declaration files only; source maps are disabled by default and can be generated locally with `MONSQLIZE_BUILD_SOURCEMAPS=1 npm run build`.
507528
- v1 smooth-upgrade compatibility has been validated against the target workspace consumers.
508-
- `schema-dsl` follows the npm `latest` TypeScript line `schema-dsl@2.0.8`; deprecated `2.3.x` mistake releases are intentionally excluded.
529+
- `schema-dsl` follows the npm `latest` TypeScript line `schema-dsl@2.0.9`; deprecated `2.3.x` mistake releases are intentionally excluded.
509530
- GitHub Actions publishes to npm from `v*` tags after running `npm run release:preflight`; the publish step skips duplicate lifecycle scripts because the gate already ran in the same job.
510531

511532
## Roadmap
512533

534+
### v2.0.4
535+
536+
- Production-safe Model index rollout controls with `autoIndex`, dry-run preflight, conflict reporting, and explicit `ensureIndexes()` / `ensureModelIndexes()` APIs.
537+
- `schema-dsl` updated to `2.0.9`, with transitive `cache-hub` aligned to `2.2.4`.
538+
- User-facing capability and verification documentation wording cleaned up, plus documentation home experience refinements.
539+
513540
### v2.0.3
514541

515542
- v1 compatibility patch for documented `findPage({ cache })` behavior.

changelogs/unreleased.md

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

55
- No unreleased fixes yet.
66

7+
## Changed
8+
9+
- No unreleased changes yet.
10+
711
## Documentation
812

9-
- Added the complete English and Simplified Chinese documentation entry near the top of the README.
10-
- Refined the documentation home hero alignment and replaced the sparse hero mark with a lightweight animated data-flow scene.
11-
- Expanded the documentation home footer into a bilingual VextJS-style resource section with the VextJS organization link and project navigation.
12-
- Aligned the documentation home feature grid with the hero content width and centered the hero visual weight.
13-
- Fine-tuned the documentation home hero illustration vertical offset for a more balanced first fold.
13+
- No unreleased documentation changes yet.

changelogs/v2.0.4.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# v2.0.4 — 2026-06-12
2+
3+
## Overview
4+
5+
v2.0.4 is a production-safety and documentation-quality patch. It keeps the public API backward compatible while adding explicit Model index rollout controls, updating the schema validation dependency, and refining user-facing documentation language.
6+
7+
---
8+
9+
## Runtime Fixes
10+
11+
- Added production-safe Model index controls:
12+
- runtime-level and model-level `autoIndex` options.
13+
- explicit `ModelInstance.ensureIndexes()` and `MonSQLize.ensureModelIndexes()` APIs.
14+
- dry-run index preflight with `existing`, `missing`, `conflicts`, and `failed` classification.
15+
- missing-index creation without dropping, renaming, or rebuilding conflicting indexes.
16+
- `model-index-error` events for observable automatic-index creation failures.
17+
- Kept automatic Model indexing enabled by default for backward compatibility.
18+
- Moved runtime Model index aggregation into the Model runtime helper layer so the strict source-size gate remains clean.
19+
20+
## Dependencies
21+
22+
- Updated `schema-dsl` from `2.0.8` to npm `latest` `2.0.9`.
23+
- Confirmed `schema-dsl@2.0.9` keeps the required `dsl()` and `validate()` runtime paths compatible with monSQLize.
24+
- Confirmed the `schema-dsl` transitive `cache-hub` dependency now resolves to `2.2.4`, matching the root direct dependency.
25+
26+
## Documentation
27+
28+
- Documented the recommended production index rollout flow:
29+
- set `autoIndex: false` in production services.
30+
- run `ensureIndexes({ dryRun: true })` / `ensureModelIndexes({ dryRun: true })`.
31+
- create only missing indexes during a low-traffic maintenance window.
32+
- monitor TTL and index-build behavior.
33+
- Corrected create-index documentation to distinguish local `INVALID_ARGUMENT` validation from raw MongoDB driver/server index conflicts.
34+
- Reworded capability-index and verification-entry documentation to use user-facing availability and verification language instead of internal migration status terms.
35+
- Refined the documentation home experience with the VextJS-style footer, aligned hero/feature layout, and updated hero data-flow visual.
36+
37+
---
38+
39+
## Compatibility
40+
41+
- SemVer: patch release.
42+
- Breaking changes: none.
43+
- Existing v2 imports remain under `dist/cjs`, `dist/esm`, and `dist/types`.
44+
- Existing default automatic Model indexing behavior remains enabled unless users opt into the new production-safe controls.
45+
46+
---
47+
48+
## Validation
49+
50+
- `npm run lint`
51+
- `npm run check:docs-examples`
52+
- `npm run type-check`
53+
- targeted Model/index unit and integration tests
54+
- `npm run test:examples`
55+
- `npm --prefix website run build`
56+
- `npm run verify:fast`
57+
- `npm run test:server-matrix`
58+
- `npm run test:audit`
59+
- `git diff --check`
60+
61+
Full release validation is handled by `npm run release:preflight`, `npm pack --dry-run`, `npm publish --dry-run`, and pack install smoke before publishing.

docs/en/cache-and-function-cache.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ The current official example is `examples/cache/with-cache.ts`. During verificat
8989

9090
## 5. Redis and Distributed Capabilities
9191

92-
The current repository has restored:
92+
Available entries:
9393

9494
- `createRedisCacheAdapter`
9595
- `DistributedCacheInvalidator`
9696

9797
The first example batch does **not** depend on Redis because:
9898

99-
1. Its goal is to establish a minimal runnable example loop.
99+
1. Its goal is to provide a minimal runnable example path.
100100
2. Redis-related capabilities require explicit runtime configuration. `ioredis` is already installed with monsqlize.
101101
3. The first formal documentation entry should not be coupled to distributed cache environment setup.
102102

docs/en/capability-index.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
# Advanced Capability Index
22

3-
This page is the formal entry index for capabilities restored in the current TypeScript version of `monSQLize`.
3+
This page lists the stable capability entry points in the current TypeScript version of `monSQLize`.
44

55
Principles:
66

7-
- First state what the current repository formally owns.
8-
- Then point to the corresponding documentation and runnable examples in this repository.
7+
- Start with the API entry points users can call.
8+
- Then point to the corresponding documentation and runnable examples.
99

1010
## Current Capability Overview
1111

12-
| Capability | Current formal entry | Current status | Notes |
13-
|------------|----------------------|----------------|-------|
14-
| Model | `msq.model()` / `MonSQLize.Model` | ✅ Restored | Minimal registry / features loop is in place |
15-
| transaction / lock | `startSession()` / `withTransaction()` / `withLock()` / `acquireLock()` / `tryAcquireLock()` | ✅ Restored | Current runtime / types / unit / integration coverage is closed |
16-
| pool | `pool()` / `ConnectionPoolManager` | ✅ Restored | Minimal multi-pool loop is in place |
17-
| sync | `startSync()` / `stopSync()` / `getSyncStats()` | ✅ Restored | Minimal lifecycle / manager loop is in place |
18-
| slow-query-log | `recordSlowQuery()` / `getSlowQueryLogs()` | ✅ Restored | Manager / queue / runtime façade are in place |
19-
| saga | `defineSaga()` / `executeSaga()` / `getSagaStats()` | ✅ Restored | Orchestrator / runtime façade are in place |
12+
| Capability | Recommended entry | Notes |
13+
|------------|----------------------|-------|
14+
| Model | `msq.model()` / `MonSQLize.Model` | Supports model registration, relations, virtuals, populate, and common query entries |
15+
| transaction / lock | `startSession()` / `withTransaction()` / `withLock()` / `acquireLock()` / `tryAcquireLock()` | Supports transaction wrappers, local business locks, and distributed lock entries |
16+
| pool | `pool()` / `ConnectionPoolManager` | Supports multi-pool configuration, selection strategies, fallback, and status inspection |
17+
| sync | `startSync()` / `stopSync()` / `getSyncStats()` | Supports Change Stream sync start, stop, and status inspection |
18+
| slow-query-log | `recordSlowQuery()` / `getSlowQueryLogs()` | Supports slow-query recording, querying, and runtime management |
19+
| saga | `defineSaga()` / `executeSaga()` / `getSagaStats()` | Supports Saga definition, execution, compensation, and stats queries |
2020

2121
## 1. Model
2222

23-
The current repository formally restores:
23+
Available entries:
2424

2525
- `Model.define/get/list/undefine/redefine`
2626
- `msq.model()`
2727
- relations / virtuals / populate
2828
- `findOneById()` / `findByIds()` / `findAndCount()`
2929

30-
Current Model entries:
30+
Model documentation and examples:
3131

3232
- Docs: `docs/model.md`, `docs/populate.md`, `docs/relations.md`
3333
- Example: `examples/docs/model.ts`
3434

3535
## 2. transaction / lock
3636

37-
The current repository formally restores:
37+
Available entries:
3838

3939
- `startSession()`
4040
- `withTransaction()`
@@ -51,7 +51,7 @@ More advanced distributed lock strategies will continue to be documented in this
5151

5252
## 3. pool
5353

54-
The current repository formally restores:
54+
Available entries:
5555

5656
- `pool()`
5757
- `ConnectionPoolManager`
@@ -64,19 +64,19 @@ This is the current entry point for:
6464

6565
## 4. sync / slow-query-log / saga
6666

67-
The current repository formally restores the minimal public surface for:
67+
Available entries:
6868

6969
- sync: contract / manager / lifecycle
7070
- slow-query-log: manager / queue / runtime façade
7171
- saga: orchestrator / runtime façade
7272

73-
The repository already provides topic pages and runnable examples:
73+
These capabilities include topic pages and runnable examples:
7474

7575
- sync: `docs/sync-backup.md`, examples `examples/docs/sync.ts` and `examples/docs/sync-target-failure.ts`
7676
- slow-query-log: `docs/slow-query-log.md`, example `examples/docs/slow-query-log.ts`
7777
- saga: `docs/saga-transaction.md`, `docs/saga-advanced.md`, example `examples/docs/saga.ts`
7878

79-
The next expansion focus is runtime fault injection, real deployment topology, and performance boundaries rather than filling in basic entry points.
79+
Future documentation will continue to cover runtime fault injection, real deployment topology, and performance boundaries.
8080

8181
## 5. Recommended Entries in This Repository
8282

0 commit comments

Comments
 (0)