You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-3Lines changed: 35 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -189,7 +189,7 @@ The package root exports only the public package contract. Deep imports into his
189
189
190
190
The Model layer is optional. Use it when you want schema validation, hooks, relations, populate, custom methods, timestamps, soft delete, or optimistic locking.
191
191
192
-
`schema-dsl` is installed automatically as a runtime dependency of monSQLize. You only need to declare `schema-dsl` in your own app if your application imports it directly.
192
+
`schema-dsl` is installed automatically as a runtime dependency of monSQLize. monSQLize creates an isolated `schema-dsl/runtime` instance for each `MonSQLize` runtime, then compiles Model schema callbacks when a Model is bound to that runtime.
193
193
194
194
### Manual Model Registration
195
195
@@ -251,6 +251,34 @@ const user = await User.insertOne({
251
251
});
252
252
```
253
253
254
+
When a service needs runtime-local custom types, messages, locale, or an already-owned schema-dsl runtime, configure `schemaDsl` on the MonSQLize instance:
For monSQLize-only Model validation, no direct application import from `schema-dsl` is required. Direct application imports should use `schema-dsl/runtime` when they need to share the same isolated runtime state with monSQLize.
281
+
254
282
### Automatic Model Loading
255
283
256
284
```js
@@ -573,7 +601,7 @@ Key release-readiness points:
573
601
- Package exports are consolidated under `dist/cjs`, `dist/esm`, and `dist/types`.
574
602
- 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`.
575
603
- v1 smooth-upgrade compatibility has been validated against the target workspace consumers.
576
-
-`schema-dsl` follows the npm `latest` TypeScript line `schema-dsl@2.0.11`; deprecated `2.3.x` mistake releases are intentionally excluded.
604
+
-`schema-dsl` follows the npm `latest` TypeScript line `schema-dsl@2.1.1`; deprecated `2.3.x` mistake releases are intentionally excluded.
577
605
- 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.
- Validation ledgers now match the current 56 runnable TypeScript documentation examples.
594
622
- Model v1 methods factory warnings now route through the runtime logger instead of direct console output.
595
623
624
+
### v2.0.8
625
+
626
+
- Model schema validation now uses an isolated `schema-dsl/runtime` instance per MonSQLize runtime, with `schemaDsl` configuration for runtime options, extension registration, runtime injection, and validation disablement.
627
+
596
628
### v2.0.6
597
629
598
-
- Dependency alignment to `schema-dsl@2.0.11`, carrying the shared ESM/CJS custom type registry fix to downstream vext applications.
630
+
- Dependency alignment carried the shared schema-dsl ESM/CJS custom type registry fix to downstream vext applications.
599
631
- NodeNext declaration compatibility for ESM consumers through generated `*.d.mts` mirrors and import-side `types` conditions.
600
632
- Restored v1-compatible root option type exports.
Copy file name to clipboardExpand all lines: changelogs/unreleased.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@
15
15
## Fixed / changed
16
16
17
17
- Fixed aggregate direct `.toArray()` to honor cache/meta execution paths, extended `find()` ObjectId auto-conversion to comparison operators, forwarded CountQueue abort signals into MongoDB count options, and added a warning when sync idempotency falls back to in-memory storage.
18
+
- Upgraded `schema-dsl` to `2.1.1` and moved Model schema compilation/validation onto a MonSQLize runtime-scoped `schema-dsl/runtime` engine. `schemaDsl` now supports runtime options, extension registration, external runtime injection, and validation disablement.
18
19
- Added a short-lived read-cache dirty barrier around writes and transaction commits. Cached reads now bypass and avoid refilling query cache while a namespace is being invalidated, reducing stale-cache windows when a process exits between a database write and post-write invalidation.
19
20
- Added optional Change Stream sync idempotency gates (`sync.idempotency`) with per-target keys and duplicate stats, so supervised restarts can skip targets already marked as applied before saving the shared resume token.
20
21
- Added `writePathPolicy` with default `allow-both` behavior and optional `model-only` namespace enforcement across collection, db, legacy, raw, management, batch, and aggregate `$out` / `$merge` write paths.
Copy file name to clipboardExpand all lines: docs/en/file-dependency-governance.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,10 @@ The current root package adopts the **precise version dependency strategy**:
4
4
5
5
| Dependencies | Strategy | Reasons |
6
6
|------|------|------|
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.11` declares the same transitive dependency version |
8
-
|`schema-dsl`| Exact version `2.0.11`| 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.11 for type-check and Model schema 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.1.1` declares the same transitive dependency version |
8
+
|`schema-dsl`| Exact version `2.1.1`| The release chain targets the current non-deprecated TypeScript line; monSQLize relies on schema-dsl runtime isolation for Model schema parsing, validation, custom types, and messages, and uses 2.1.1 for type-check and Model schema verification |
9
9
10
-
> `schema-dsl@2.0.11` 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.
10
+
> `schema-dsl@2.1.1` 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.
11
11
12
12
## Current Risk
13
13
@@ -20,8 +20,8 @@ The current root package adopts the **precise version dependency strategy**:
20
20
21
21
## Development status
22
22
23
-
- The root direct `cache-hub` dependency is fixed to `2.2.4`; `schema-dsl@2.0.11` also declares `cache-hub@2.2.4`, so no additional override is needed.
24
-
-`schema-dsl` is fixed to `2.0.11`.
23
+
- The root direct `cache-hub` dependency is fixed to `2.2.4`; `schema-dsl@2.1.1` also declares `cache-hub@2.2.4`, so no additional override is needed.
24
+
-`schema-dsl` is fixed to `2.1.1`.
25
25
- Local sibling `../schema-dsl` is only used for debugging the upstream library itself and is no longer a prerequisite for monSQLize root package installation.
26
26
27
27
@@ -36,21 +36,21 @@ npm run release:preflight
36
36
37
37
## schema-dsl 2.x upgrade verification
38
38
39
-
The dependency governance baseline has upgraded and fixed `schema-dsl` from the historical `^1.2.5` to `2.0.11`. 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.1.1`. The verification standard is as follows:
40
40
41
-
1. The upstream released the **non-deprecated** 2.x latest version on npm: `2.0.11`.
42
-
2.`npm install schema-dsl@2.0.11 --save-exact` followed by `npm run type-check`.
41
+
1. The upstream released the **non-deprecated** 2.x latest version on npm: `2.1.1`.
42
+
2.`npm install schema-dsl@2.1.1 --save-exact` followed by `npm run type-check`.
43
43
3. All model-related unit tests/integration tests passed (covered with `npm run test:unit` and `npm run test:integration`).
44
44
4.`npm run test:examples` all passed.
45
45
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.11`.
46
+
6. This file, Profile, CHANGELOG, and lockfile must be synchronized to `2.1.1`.
47
47
48
48
## cache-hub 2.2.4 upgrade verification
49
49
50
50
The dependency governance baseline has upgraded and fixed `cache-hub` from `1.0.0` to `2.2.4`. The verification standard is as follows:
51
51
52
52
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.11` also declares `cache-hub@2.2.4`.
53
+
2. The root direct dependency resolves to `2.2.4`; `schema-dsl@2.1.1` also declares `cache-hub@2.2.4`.
54
54
3.`npm run type-check`, targeted cache / function-cache tests, website build, and memory probe must pass.
55
55
4. This file, Profile, CHANGELOG, package manifest, and lockfile must be synchronized with the root direct dependency `2.2.4` baseline.
Copy file name to clipboardExpand all lines: docs/en/model.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,50 @@ if (user.checkPassword('secret123')) {
56
56
57
57
---
58
58
59
+
## schema-dsl runtime
60
+
61
+
Model schema callbacks receive the `s` namespace from the MonSQLize instance's isolated `schema-dsl/runtime`. `Model.define()` stores the definition only; schema compilation and validation happen when `msq.model(name)` creates a runtime-bound Model instance.
62
+
63
+
For the default path, no application import from `schema-dsl` is required:
64
+
65
+
```javascript
66
+
Model.define('users', {
67
+
schema: (dsl) =>dsl({
68
+
email:'email!',
69
+
name:dsl.string().min(1).max(64).require()
70
+
})
71
+
});
72
+
73
+
constmsq=newMonSQLize({
74
+
type:'mongodb',
75
+
databaseName:'app',
76
+
config: { uri:'mongodb://127.0.0.1:27017' }
77
+
});
78
+
```
79
+
80
+
When the application needs custom runtime-local types, messages, locale, or shared schema-dsl state, create or inject a `schema-dsl/runtime` instance through `schemaDsl`:
`schemaDsl` also accepts `{ options, extensions }` when monSQLize should own the runtime, and `schemaDsl: false` when Model schema-dsl validation must be disabled for a migration or test boundary.
`schema-dsl` is installed by default with `monsqlize`. Only when the application code directly imports `schema-dsl`, it needs to be declared in the application's own dependencies.
148
+
`schema-dsl` is installed by default with `monsqlize`. Model schema callbacks use the MonSQLize instance's isolated `schema-dsl/runtime`; if application code also needs the same custom types or messages, create a `schema-dsl/runtime` instance and pass it through `schemaDsl`.
0 commit comments