Skip to content

Commit 6366bf0

Browse files
committed
docs: close public documentation surface
1 parent 950dfff commit 6366bf0

24 files changed

Lines changed: 97 additions & 164 deletions

‎README.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,6 @@ Cache capabilities include:
392392
- Automatic invalidation after writes.
393393
- Cache namespace, TTL, and distributed invalidation controls.
394394

395-
`withCache()` and `FunctionCache` remain exported for legacy compatibility, but non-database function caching is no longer promoted as a current monSQLize feature area.
396-
397395
## Advanced Capabilities
398396

399397
### Transactions
@@ -527,9 +525,9 @@ npm run verify:full
527525
npm run release:preflight
528526
```
529527

530-
Release preflight runs linting, type checks, size guards, runtime checks, compatibility checks, refactor guards, production dependency audit, the default test suite, and `npm pack --dry-run`.
528+
The package self-check command runs linting, type checks, size guards, runtime checks, compatibility checks, refactor guards, production dependency audit, the default test suite, and `npm pack --dry-run`.
531529

532-
`npm run release:publish` runs the preflight gate once and then calls `npm publish --ignore-scripts` so the final publish step does not repeat the full lifecycle gate. Raw `npm publish` is still guarded by `prepublishOnly`.
530+
`npm run release:publish` runs the package self-check once and then calls `npm publish --ignore-scripts` so the final publish step does not repeat the full lifecycle check. Raw `npm publish` is still guarded by `prepublishOnly`.
533531

534532
Optional commands:
535533

‎docs/en/api-index.md‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ This index documents the current stable MongoDB adapter APIs and shared runtime
3535
|----------|--------|-------------|
3636
| [Find documents](find.md) | `find()` | Query multiple documents |
3737
| [Find one document](findOne.md) | `findOne()` | Query one document |
38-
| [Find one by id helper](find-one-by-id.md) | `findOneById()` | Optional reference helper for `_id` lookup; regular `findOne({ _id })` also supports ObjectId auto conversion |
39-
| [Find by ids helper](find-by-ids.md) | `findByIds()` | Optional reference helper for multiple `_id` values; regular `find({ _id: { $in } })` also supports ObjectId auto conversion |
4038
| [Paginated find](findPage.md) | `findPage()` | Cursor pagination query |
4139
| [Count documents](count.md) | `count()` | Count documents |
4240
| [Distinct values](distinct.md) | `distinct()` | Distinct query |
@@ -185,7 +183,7 @@ This index documents the current stable MongoDB adapter APIs and shared runtime
185183
| [API reference index](api-index.md) | Current API reference index |
186184
| [Getting started](getting-started.md) | Getting started guide |
187185
| [Examples](examples.md) | Example index |
188-
| [Recipes](recipes.md) | Common recipes |
186+
| [Common scenarios](recipes.md) | Connection, cache, Redis, SSH, pool, and Model usage scenarios |
189187
| [Capability index](capability-index.md) | Capability index |
190188

191189
---
@@ -206,17 +204,13 @@ This index documents the current stable MongoDB adapter APIs and shared runtime
206204

207205
---
208206

209-
## Runtime, Deployment, and Governance
207+
## Runtime and Deployment
210208

211209
| Document | Description |
212210
|----------|-------------|
213-
| [Runtime architecture](runtime-architecture.md) | Runtime architecture |
211+
| [Runtime consistency and boundaries](runtime-architecture.md) | Runtime capability boundaries and consistency contracts |
214212
| [Support matrix](support-matrix.md) | Support matrix |
215213
| [Roadmap boundaries](roadmap-boundaries.md) | Roadmap boundaries |
216-
| [File dependency governance](file-dependency-governance.md) | File dependency governance |
217-
| [Capability traceability](capability-traceability.md) | Capability traceability |
218-
| [Release preflight](release-preflight.md) | Release preflight |
219-
| [Verification entry points](verification-entrypoints.md) | Verification entry points |
220214
| [Validation notes](validation.md) | Validation notes |
221215

222216
---
@@ -229,8 +223,7 @@ This index documents the current stable MongoDB adapter APIs and shared runtime
229223
| [ObjectId cross-version notes](objectid-cross-version.md) | ObjectId cross-version notes |
230224
| [ObjectId cross-version FAQ](objectid-cross-version-faq.md) | ObjectId cross-version FAQ |
231225
| [ObjectId logging optimization](objectid-logging-optimization.md) | ObjectId logging optimization |
232-
| [Cache API overview](cache-and-function-cache.md) | Current database-runtime cache entries and legacy function-cache boundary |
233-
| [`cache-hub` migration](cache-hub-migration.md) | `cache-hub` migration |
226+
| [Cache API](cache.md) | Database query cache, multi-layer cache access, invalidation, and statistics |
234227
| [Slow-query logging](slow-query-log.md) | Slow-query logging |
235228
| [Failure recovery examples](failure-recovery-examples.md) | Failure recovery examples |
236229
| [Multi-pool health checks](multi-pool-health-check.md) | Multi-pool health checks |

‎docs/en/cache.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
monSQLize provides database query caching for collection reads, optional local/remote cache composition, manual invalidation and statistics. Cache invalidation is designed to keep read caches fresh enough for common application workloads, but it is not an atomic commit step with MongoDB writes.
66

7-
> ⚠️ If you are migrating public cache compatibility exports, read the [`cache-hub` direct-call migration guide](./cache-hub-migration.md) first. This page covers monSQLize database query cache and multi-layer cache access; `withCache()` / `FunctionCache` are legacy compatibility exports and are outside the current non-database cache path.
7+
This page covers the current database-runtime cache path: query result cache, bookmark cache, Redis-backed remote cache, distributed invalidation, and cache statistics.
88

99
## Core Features
1010

‎docs/en/capability-index.md‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,20 @@ Principles:
2222
|------------|----------------------|-------|
2323
| Model | `msq.model()` / `MonSQLize.Model` | Supports model registration, relations, virtuals, populate, and common query entries |
2424
| write-path-policy | `writePathPolicy` | Optional runtime guard for Model-only write namespaces |
25+
| cache | Query `cache` options / `msq.cache` | Database query cache, multi-layer cache access, invalidation, and statistics |
2526
| transaction | `startSession()` / `withTransaction()` | Supports MongoDB transaction wrappers and transaction statistics |
2627
| pool | `pools` / `pool()` / `ConnectionPoolManager` | Declare `pools: PoolConfig[]` in the constructor, route with `pool()`, and use the low-level manager for advanced inspection or manual management |
2728
| sync | `startSync()` / `stopSync()` / `getSyncStats()` | Supports Change Stream sync start, stop, and status inspection |
2829
| slow-query-log | `recordSlowQuery()` / `getSlowQueryLogs()` | Supports slow-query recording, querying, and runtime management |
2930

30-
`withCache()` and `FunctionCache` remain exported for legacy compatibility, but they are not recommended as current monSQLize capability entry points for new non-database caching usage.
31-
3231
## 1. Model
3332

3433
Available entries:
3534

3635
- `Model.define/get/list/undefine/redefine`
3736
- `msq.model()`
3837
- relations / virtuals / populate
39-
- `findOneById()` / `findByIds()` / `findAndCount()`
38+
- common model queries such as `findOne()` and `findAndCount()`
4039

4140
Model documentation and examples:
4241

‎docs/en/examples.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ node .generated/examples-dist/examples/docs/find.js
3333
|----------|---------|
3434
| [`find.md`](./find.md) | [`examples/docs/find.ts`](https://github.com/vextjs/monSQLize/blob/main/examples/docs/find.ts) |
3535
| [`findOne.md`](./findOne.md) | [`examples/docs/find-one.ts`](https://github.com/vextjs/monSQLize/blob/main/examples/docs/find-one.ts) |
36-
| [`find-one-by-id.md`](./find-one-by-id.md) | [`examples/docs/find-one-by-id.ts`](https://github.com/vextjs/monSQLize/blob/main/examples/docs/find-one-by-id.ts) |
37-
| [`find-by-ids.md`](./find-by-ids.md) | [`examples/docs/find-by-ids.ts`](https://github.com/vextjs/monSQLize/blob/main/examples/docs/find-by-ids.ts) |
3836
| [`findPage.md`](./findPage.md) | [`examples/docs/find-page.ts`](https://github.com/vextjs/monSQLize/blob/main/examples/docs/find-page.ts) |
3937
| [`find-and-count.md`](./find-and-count.md) | [`examples/docs/find-and-count.ts`](https://github.com/vextjs/monSQLize/blob/main/examples/docs/find-and-count.ts) |
4038
| [`count.md`](./count.md) | [`examples/docs/count.ts`](https://github.com/vextjs/monSQLize/blob/main/examples/docs/count.ts) |

‎docs/en/index.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ features:
2727
- icon: ⚡
2828
title: Smart Two-Level Cache
2929
details: L1 memory LRU plus optional L2 Redis, powered by cache-hub with pattern invalidation and distributed sync.
30-
link: /cache-and-function-cache.html
30+
link: /cache.html
3131
- icon: 🔎
3232
title: MongoDB Adapter APIs
3333
details: findPage, findAndCount, stream, explain, ID helpers, and chain builders stay explicit to MongoDB semantics.

‎docs/en/mongodb-driver-compatibility.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ findOneAndDeleteDocument(collection, filter, options)
201201

202202
- The default installation path does not require user declaration `mongodb`.
203203
- Compatibility verification temporarily overwrites the driver version and restores `mongodb@6.21.0` after verification.
204-
- CI/pre-release checks should have `npm ls mongodb` and `npm run test:compatibility` as evidence.
204+
- CI compatibility checks should use `npm ls mongodb` and `npm run test:compatibility` as evidence.
205205

206206

207207
## Exception handling

‎docs/en/quick-upsert.md‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,3 @@ const doc = await collection("users").findOneAndUpdate(
297297
- **[Complete Guide to Upsert Operations](./upsert-guide.md)** - Contains all scenarios and best practices
298298
- **[findOneAndUpdate() documentation](./find-one-and-update.md)** - Detailed API description
299299
- **[updateOne() documentation](./update-one.md)** - Alternative for simple scenarios
300-
301-
---
302-
303-
**Date**: 2026-01-28
304-
**Version**: v1.1.2

‎docs/en/roadmap-boundaries.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The current stable adapter is MongoDB. MySQL and PostgreSQL are planned as futur
1919
The current MongoDB adapter includes:
2020

2121
- MongoDB query extension
22-
- Database cache, with legacy function-cache compatibility retained for existing consumers
22+
- Database query cache
2323
- Model
2424
- Transaction
2525
- Pool / Sync / Slow Query Log

‎docs/en/runtime-architecture.md‎

Lines changed: 24 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
# Core runtime structure description
1+
# Runtime consistency and boundaries
22

3-
> Goal: Give subsequent maintainers a structural diagram of "from entry to capability layer" to avoid continuing to pile logic back to `runtime-core.ts`.
3+
monSQLize is a database-native runtime layer. It coordinates MongoDB access, model validation, cache, transactions, pools, sync, and observability, but it does not turn those capabilities into one global strict-consistency system.
44

5-
## Module layering
5+
Use this page to decide which entry point to use and where application-level guarantees are still required.
6+
7+
## Runtime layers
68

79
```text
810
MonSQLizeRuntime (src/entry/runtime-core.ts)
911
├── entry helpers / compat accessors
1012
│ ├── runtime-helpers.ts
1113
│ └── runtime-compat-accessors.ts
1214
├── capabilities
13-
│ ├── cache / legacy function-cache compatibility
15+
│ ├── database query cache
1416
│ ├── model
1517
│ ├── pool
1618
│ ├── sync
@@ -24,8 +26,6 @@ MonSQLizeRuntime (src/entry/runtime-core.ts)
2426
└── errors / logger / utils
2527
```
2628

27-
## Maintain boundaries
28-
2929
## Runtime consistency contract
3030

3131
monSQLize provides runtime coordination helpers, not a global strict-consistency kernel. Current guarantees are:
@@ -40,50 +40,26 @@ monSQLize provides runtime coordination helpers, not a global strict-consistency
4040

4141
Use application/framework-level coordination, explicit `DistributedCacheLockManager` business locks, idempotency keys, fencing tokens, durable outbox/journals, or cache bypassing when a flow requires cross-instance strict consistency.
4242

43+
## Choosing the right entry point
4344

44-
## `runtime-core.ts`
45-
46-
Only responsible for:
47-
48-
- runtime main class public API
49-
- Ability assembly
50-
- Connect / close / collection / db / model and other entry delegates
51-
52-
The heap should not continue:
53-
54-
- Complex write orchestration
55-
- expression parsing details
56-
- sync records/stores details
57-
- compat-only type cleaning logic
58-
59-
60-
## `runtime-helpers.ts` / `runtime-compat-accessors.ts`
61-
62-
Responsible for:
63-
64-
- Assembly details of runtime and model/accessor
65-
- getter/cache/dbInstance bridge for v1 compatible paths
66-
67-
68-
## capability / adapter layer
69-
70-
Responsible for:
71-
72-
- True behavioral semantics
73-
- Corresponding module’s internal helpers, queues, storage, and orchestration
45+
| Need | Recommended entry |
46+
|------|-------------------|
47+
| Normal collection access | `const { collection } = await msq.connect()` |
48+
| Model schema validation and hooks | `msq.model()` or `MonSQLize.Model` |
49+
| Model-only writes for selected namespaces | `writePathPolicy` |
50+
| Query cache | Query `cache` options plus `msq.cache` invalidation/stat APIs |
51+
| Multi-pool routing | Constructor `pools: PoolConfig[]`, then `msq.pool()` |
52+
| Transactions | `startSession()` and `withTransaction()` |
53+
| Change Stream fanout | `startSync()`, `stopSync()`, and `getSyncStats()` |
54+
| Strict business locks | `DistributedCacheLockManager` with an application idempotency/fencing design |
7455

75-
## Current hot spot governance results
56+
## When to add application-level guarantees
7657

77-
| Hot Topics | Current Strategies |
78-
|------|----------|
79-
| `slow-query-log` | Split into config/queue/records/storage/manager |
80-
| `writes` | Split into utils/basic/batch |
81-
| `expression` | The compiler has been separated, and only the public API and traversal remain at the entrance |
82-
| `collection-accessor` | The writing path has been moved to the helper, and the main file has returned façade |
83-
| `ModelInstance` | mutation orchestration has moved out of the master file |
58+
Add explicit application guarantees when a workflow requires all of the following at the same time:
8459

85-
## Subsequent maintenance rules
60+
1. Database write success and cache visibility must be atomic.
61+
2. Sync targets cannot tolerate replay.
62+
3. A lock must protect multiple Node.js processes or multiple regions.
63+
4. A batch operation must behave exactly like a sequence of per-document business operations.
8664

87-
1. New capabilities are given priority to enter `capabilities/` or `adapters/`, do not change `runtime-core.ts` first.
88-
2. When compat-only logic is involved, `runtime-compat-accessors.ts` is entered first.
89-
3. After hotspot reconstruction, at least add `test:refactor-guard` + corresponding capability layer regression.
65+
For those paths, combine monSQLize with durable outbox records, idempotency keys, application-level retries, or cache bypassing for the critical read path.

0 commit comments

Comments
 (0)