monsqlize 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -2
- package/MIGRATION.md +22 -0
- package/README.md +11 -7
- package/changelogs/v3.0.0.md +4 -2
- package/changelogs/v3.1.0-rc.0.md +23 -0
- package/changelogs/v3.1.0.md +24 -0
- package/dist/cjs/cli/data-task.cjs +169 -17557
- package/dist/cjs/index.cjs +168 -65
- package/dist/esm/index.mjs +168 -65
- package/licenses/production-dependencies.json +11 -0
- package/package.json +21 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
-
> Summary index —
|
|
4
|
-
> **Last updated**: 2026-07-
|
|
3
|
+
> Summary index — the v3.1.0 stable release details are in [changelogs/v3.1.0.md](./changelogs/v3.1.0.md); the earlier RC note remains an unpublished rehearsal archive.
|
|
4
|
+
> **Last updated**: 2026-07-15
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
| Version | Date | Summary | Details |
|
|
11
11
|
|---------|------|---------|---------|
|
|
12
|
+
| [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) |
|
|
12
13
|
| [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) |
|
|
13
14
|
| [v2.0.7](./changelogs/v2.0.7.md) | Unpublished | Withdrawn patch candidate; never published and superseded by v3.0.0 | [Archive](./changelogs/v2.0.7.md) |
|
|
14
15
|
| [v2.0.6](./changelogs/v2.0.6.md) | 2026-06-15 | Patch: dependency alignment to `schema-dsl@2.0.11` so downstream frameworks inherit the ESM/CJS shared custom type registry fix | [View](./changelogs/v2.0.6.md) |
|
package/MIGRATION.md
CHANGED
|
@@ -4,6 +4,28 @@ This guide starts with the v2.0.6 to v3.0.0 upgrade path, then retains the
|
|
|
4
4
|
v1-to-v2 compatibility notes for older applications. Review every tightened
|
|
5
5
|
contract that intersects your application before changing the installed major.
|
|
6
6
|
|
|
7
|
+
## Upgrade from v3.0.0 to v3.1.0
|
|
8
|
+
|
|
9
|
+
monSQLize v3.1 consumes schema-dsl v3 without installing schema-dsl's legacy
|
|
10
|
+
String prototype extensions. Applications that need those extensions must opt
|
|
11
|
+
in through `schema-dsl/compat` or `schema-dsl/register-string`; monSQLize itself
|
|
12
|
+
continues to use the isolated `schema-dsl/runtime` entry and does not require
|
|
13
|
+
them.
|
|
14
|
+
|
|
15
|
+
Successful full-document Model validation now persists schema-dsl's normalized
|
|
16
|
+
`data` for `insertOne`, `insertMany`, `insertBatch`, `replaceOne`,
|
|
17
|
+
`findOneAndReplace`, and hydrated document `save()`. Coerced values and schema
|
|
18
|
+
defaults therefore reach MongoDB. The order is model defaults, before hook,
|
|
19
|
+
schema normalization, timestamps, version, then driver write. Replacement
|
|
20
|
+
writes do not apply model defaults, and `save()` has no new before-hook stage.
|
|
21
|
+
|
|
22
|
+
Validation failures still throw `VALIDATION_ERROR`, and public errors remain
|
|
23
|
+
`{ field, message }`; `field` is mapped from schema-dsl's canonical `path`.
|
|
24
|
+
Update operators and pipelines do not expose a complete final document and are
|
|
25
|
+
not included in normalized-data persistence. If an application relied on
|
|
26
|
+
schema-dsl coercion being discarded before v3.1, review stored value types in a
|
|
27
|
+
staging environment before upgrading.
|
|
28
|
+
|
|
7
29
|
## Upgrade from v2.0.6 to v3.0.0
|
|
8
30
|
|
|
9
31
|
### 1. Run the release checks before changing production
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Database-native production data runtime layer for TypeScript services. monSQLize
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/monsqlize)
|
|
6
6
|
[](https://www.apache.org/licenses/LICENSE-2.0)
|
|
7
|
-
[](https://www.mongodb.com/)
|
|
8
8
|
[](https://nodejs.org/)
|
|
9
9
|
|
|
10
10
|
Documentation: [English](https://vextjs.github.io/monSQLize/) · [简体中文](https://vextjs.github.io/monSQLize/zh/)
|
|
@@ -14,6 +14,8 @@ Upgrade and security: [Migration Guide](./MIGRATION.md) · [Private Vulnerabilit
|
|
|
14
14
|
|
|
15
15
|
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.
|
|
16
16
|
|
|
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.
|
|
18
|
+
|
|
17
19
|
```bash
|
|
18
20
|
npm install monsqlize
|
|
19
21
|
```
|
|
@@ -44,7 +46,7 @@ The shared runtime direction is cache consistency, connection lifecycle, transac
|
|
|
44
46
|
|
|
45
47
|
## Runtime Consistency Contract
|
|
46
48
|
|
|
47
|
-
monSQLize coordinates cache, transactions, sync, and queues inside the runtime, but it does not provide a global strict-consistency kernel. MongoDB transactions keep MongoDB session ACID semantics. Query caching is opt-in, and write-side cache invalidation is explicit: use `cache.invalidate` for precise entries or `autoInvalidate` / `cache.autoInvalidate` for broad invalidation. Cache invalidation runs after successful writes or transaction commit and is best-effort; Redis/L2 cache and Pub/Sub invalidation provide eventual cross-instance coherence rather than atomic cache/DB commits. Change Stream sync is at-least-once; custom targets should be idempotent by change event `_id`, and `sync.idempotency` can record per-target replay markers when a durable store is provided. Transaction cache locks are process-local in the
|
|
49
|
+
monSQLize coordinates cache, transactions, sync, and queues inside the runtime, but it does not provide a global strict-consistency kernel. MongoDB transactions keep MongoDB session ACID semantics. Query caching is opt-in, and write-side cache invalidation is explicit: use `cache.invalidate` for precise entries or `autoInvalidate` / `cache.autoInvalidate` for broad invalidation. Cache invalidation runs after successful writes or transaction commit and is best-effort; Redis/L2 cache and Pub/Sub invalidation provide eventual cross-instance coherence rather than atomic cache/DB commits. Change Stream sync is at-least-once; custom targets should be idempotent by change event `_id`, and `sync.idempotency` can record per-target replay markers when a durable store is provided. Transaction cache locks are process-local in the current v3 runtime; use explicit business coordination, idempotency/fencing, or cache bypassing for cross-instance strict flows.
|
|
48
50
|
|
|
49
51
|
## Write Path Policy
|
|
50
52
|
|
|
@@ -164,7 +166,7 @@ Published entry points:
|
|
|
164
166
|
| ESM | `dist/esm/index.mjs` |
|
|
165
167
|
| Types | `dist/types/index.d.ts` |
|
|
166
168
|
|
|
167
|
-
The package root exports only the public package contract. Deep imports into historical `lib/**` files are not part of the
|
|
169
|
+
The package root exports only the public package contract. Deep imports into historical `lib/**` files are not part of the v3 publishing surface.
|
|
168
170
|
|
|
169
171
|
## Model Layer
|
|
170
172
|
|
|
@@ -261,6 +263,8 @@ const msq = new MonSQLize({
|
|
|
261
263
|
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.
|
|
262
264
|
Use `schemaDsl: { extensions }` when monSQLize should own the runtime and register extension definitions. When the application owns the schema-dsl lifecycle, configure that runtime directly, including `runtime.registerExtensions([...])`, and inject it with `schemaDsl: { runtime }`. If the default `schema-dsl/runtime` entry cannot be resolved or does not expose the required runtime APIs, monSQLize throws `INVALID_CONFIG`; validation is disabled only when `schemaDsl: false` or `schemaDsl: { enabled: false }` is set explicitly.
|
|
263
265
|
|
|
266
|
+
For `insertOne`, `insertMany`, `insertBatch`, `replaceOne`, `findOneAndReplace`, and hydrated document `save()`, successful schema validation now forwards schema-dsl's normalized `data` into the actual write. Public errors remain `{ field, message }`, mapped from canonical upstream `path/message`. Update operators and pipelines are intentionally outside this complete-document normalization contract.
|
|
267
|
+
|
|
264
268
|
### Automatic Model Loading
|
|
265
269
|
|
|
266
270
|
```js
|
|
@@ -477,7 +481,7 @@ const user = await users.findOne({ email });
|
|
|
477
481
|
const list = await users.find({ status: 'active' }).toArray();
|
|
478
482
|
```
|
|
479
483
|
|
|
480
|
-
The
|
|
484
|
+
The v3 line has been validated against the workspace consumers `chat`, `payment`, `user`, `admin`, `search`, `vext`, and `permission-core` without requiring business-source changes in those projects.
|
|
481
485
|
|
|
482
486
|
## Compatibility
|
|
483
487
|
|
|
@@ -485,7 +489,7 @@ The v2 line has been validated against the workspace consumers `chat`, `payment`
|
|
|
485
489
|
|---|---|
|
|
486
490
|
| Node.js | `>=18.0.0`; CI covers Node 18 / 20 / 22. |
|
|
487
491
|
| MongoDB driver | `mongodb@6.21.0` runtime baseline; driver 7.5.0 has additional compatibility coverage. |
|
|
488
|
-
| MongoDB server | Memory-server based
|
|
492
|
+
| MongoDB server | Memory-server based 7.x / 8.x validation is covered by the strict project test matrix. |
|
|
489
493
|
| Module systems | CommonJS and ESM are both validated. |
|
|
490
494
|
| TypeScript | Public declarations are published from `dist/types/index.d.ts`. |
|
|
491
495
|
| Package license | Apache-2.0. |
|
|
@@ -501,7 +505,7 @@ See the current support and verification documents:
|
|
|
501
505
|
|
|
502
506
|
## Documentation
|
|
503
507
|
|
|
504
|
-
Current TypeScript documentation and examples are the source of truth for the
|
|
508
|
+
Current TypeScript documentation and examples are the source of truth for the v3 package:
|
|
505
509
|
|
|
506
510
|
- Complete docs: [English](https://vextjs.github.io/monSQLize/) · [简体中文](https://vextjs.github.io/monSQLize/zh/)
|
|
507
511
|
- Constructor configuration: [English](https://vextjs.github.io/monSQLize/configuration) · [简体中文](https://vextjs.github.io/monSQLize/zh/configuration)
|
|
@@ -514,7 +518,7 @@ Current TypeScript documentation and examples are the source of truth for the v2
|
|
|
514
518
|
- Compatibility checks: [test/compatibility](https://github.com/vextjs/monSQLize/tree/main/test/compatibility)
|
|
515
519
|
- Verification mapping: [test/validation](https://github.com/vextjs/monSQLize/tree/main/test/validation)
|
|
516
520
|
|
|
517
|
-
Historical v1 assets are useful for tracing old behavior, but they are not the current publishing surface for
|
|
521
|
+
Historical v1 and v2 assets are useful for tracing old behavior, but they are not the current publishing surface for v3.
|
|
518
522
|
|
|
519
523
|
## Development
|
|
520
524
|
|
package/changelogs/v3.0.0.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# monSQLize v3.0.0
|
|
2
2
|
|
|
3
|
-
> Release date: 2026-07-
|
|
3
|
+
> Release date: 2026-07-15
|
|
4
4
|
> Release status: Released
|
|
5
5
|
> Type: Major
|
|
6
6
|
> Stable predecessor: v2.0.6
|
|
@@ -14,7 +14,7 @@ v3.0.0 consolidates the unpublished v2.0.7 work into a major release. It adds bo
|
|
|
14
14
|
### Bounded production data tasks
|
|
15
15
|
|
|
16
16
|
- Added the named `dataTasks` facade with `preview()`, `apply()`, `previewRestore()`, and `restore()` for two independent source/target instances. CommonJS exposes the same root facade through destructuring; it is not an instance API.
|
|
17
|
-
- Added collection-level `indexes[]`, filtered `data`, explicit `fields` / `source-id` identity, deterministic
|
|
17
|
+
- Added collection-level `indexes[]`, filtered `data`, explicit `fields` / `source-id` identity, deterministic `rename` / `set` / `unset` field adjustments, approval drift fingerprints, affected-scope BSON backup packages, verification, and reversible restore-safety packages.
|
|
18
18
|
- Consolidated data tasks on one `DataTaskJob` contract and the named `dataTasks.preview/apply/previewRestore/restore` service; the unpublished instance runner and step configuration were removed.
|
|
19
19
|
- Consolidated the CLI on `preview`, `apply`, `preview-restore`, and `restore`, with task files directly exporting the same Job configuration.
|
|
20
20
|
- Production apply requires explicit `targetEnvironment`, a durable `backup.dir`, and a non-expired preview approval bound to the job, source, target, and target indexes.
|
|
@@ -95,3 +95,5 @@ The release is publishable only when all of the following pass on the release co
|
|
|
95
95
|
- npm registry, dist-tag, Git tag, GitHub Release, and Pages post-publish acceptance
|
|
96
96
|
|
|
97
97
|
See the bilingual release preflight guides and production rollout guides for commands and recovery procedures.
|
|
98
|
+
|
|
99
|
+
> Contract correction (2026-07-15): the original GitHub Release text used the inaccurate phrase “pipeline/handler transforms.” The shipped and documented v3 contract supports only `rename`, `set`, and `unset`. This repository correction is the source for the next patch; editing the already-published GitHub Release remains a separate authorized release-maintenance action.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# monSQLize v3.1.0-rc.0
|
|
2
|
+
|
|
3
|
+
> Release status: Local rehearsal candidate; not published, tagged, pushed, or committed.
|
|
4
|
+
> Candidate date: 2026-07-15
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
|
|
8
|
+
This candidate validates monSQLize against the identity-bound local `schema-dsl@3.0.0-rc.0` tarball. npm `latest` remains `monsqlize@3.0.0`; final `3.1.0` publication requires schema-dsl v3 GA plus the repository's normal release authority and external checks.
|
|
9
|
+
|
|
10
|
+
## Changes
|
|
11
|
+
|
|
12
|
+
- Pins the rehearsal dependency to `schema-dsl@3.0.0-rc.0` and continues to use only the isolated `schema-dsl/runtime` integration for Model compilation and validation.
|
|
13
|
+
- Narrows the upstream validation bridge to `valid`, `data`, and canonical `errors[].path/message/keyword`; monSQLize no longer consumes schema-dsl's deprecated `field/type/expected` aliases.
|
|
14
|
+
- Keeps `Model.validate()` public results stable as `{ valid, errors: [{ field, message }], data }`, mapping `field` from upstream `path`.
|
|
15
|
+
- Persists successful normalized `data` for `insertOne`, `insertMany`, `insertBatch`, `replaceOne`, `findOneAndReplace`, and hydrated document `save()`.
|
|
16
|
+
- Applies bulk defaults before before-hooks, performs schema normalization before timestamps/version fields, and validates replacements before optimistic-lock reads.
|
|
17
|
+
- Rejects valid results whose normalized `data` is null, primitive, or an array before any driver operation. Failed validation data snapshots are never written.
|
|
18
|
+
|
|
19
|
+
## Deliberate boundaries
|
|
20
|
+
|
|
21
|
+
- Update operators and pipelines do not represent a complete final document and are not included in normalized-data persistence.
|
|
22
|
+
- `isRequired()` / `isOptional()` are not required by monSQLize and are not added to schema-dsl for this migration.
|
|
23
|
+
- This candidate is evidence only. It is not a release authorization and must not be published.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# monSQLize v3.1.0
|
|
2
|
+
|
|
3
|
+
> Release date: 2026-07-15
|
|
4
|
+
|
|
5
|
+
## Highlights
|
|
6
|
+
|
|
7
|
+
- Pins the production dependency to registry `schema-dsl@3.0.0` and continues to compile Model schemas only through the isolated `schema-dsl/runtime` integration.
|
|
8
|
+
- Consumes the canonical schema-dsl validation result (`valid`, normalized `data`, and `errors[].path/message/keyword`) without relying on deprecated upstream `field/type/expected` aliases.
|
|
9
|
+
- Keeps `Model.validate()` compatible for monSQLize callers as `{ valid, errors: [{ field, message }], data }`, deriving `field` from the canonical upstream path.
|
|
10
|
+
- Persists successful normalized data across the six complete-document write paths: `insertOne`, `insertMany`, `insertBatch`, `replaceOne`, `findOneAndReplace`, and hydrated document `save()`.
|
|
11
|
+
- Applies bulk defaults before before-hooks, normalizes before timestamps/version fields, and validates replacement documents before optimistic-lock reads.
|
|
12
|
+
- Rejects null, primitive, or array normalized results before any driver operation; failed validation snapshots are never written.
|
|
13
|
+
- Preserves timestamps on hydrated `save()` when versioning is disabled, including documents normalized by schema-dsl.
|
|
14
|
+
- Includes the maintained Node 24 GitHub Actions runtime, release metadata checks, TypeScript lint coverage, shared memory-server policy, coverage/package/license budgets, derived-artifact dry-run cleanup, and the lightweight data-task CLI bundle introduced after v3.0.0.
|
|
15
|
+
|
|
16
|
+
## Compatibility boundaries
|
|
17
|
+
|
|
18
|
+
- Update operators and pipelines are partial mutations, so they are intentionally outside normalized complete-document persistence.
|
|
19
|
+
- `isRequired()` and `isOptional()` are not required by monSQLize; schema definitions already expose the required/optional state needed by this integration.
|
|
20
|
+
- The public monSQLize validation error shape remains stable even though its upstream adapter now consumes schema-dsl's canonical error fields.
|
|
21
|
+
|
|
22
|
+
## Verification
|
|
23
|
+
|
|
24
|
+
- The release candidate must pass `npm run release:preflight`, the Node 18/20/22 remote matrix, packed CJS/ESM/TypeScript/CLI consumers, the MongoDB 7/8 server matrix, production dependency audit, and the documentation browser gates.
|