monsqlize 3.2.0 → 3.3.1
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 +8 -2
- package/README.md +56 -6
- package/changelogs/v3.3.0.md +29 -0
- package/changelogs/v3.3.1.md +28 -0
- package/dist/cjs/cli/data-task.cjs +5 -3
- package/dist/cjs/index.cjs +1037 -630
- package/dist/cjs/transaction/Transaction.cjs +33 -5
- package/dist/cjs/transaction/TransactionManager.cjs +38 -16
- package/dist/esm/index.mjs +1042 -634
- package/dist/types/collection.d.mts +6 -6
- package/dist/types/collection.d.ts +6 -6
- package/dist/types/data-tasks.d.mts +1 -0
- package/dist/types/data-tasks.d.ts +1 -0
- package/dist/types/model.d.mts +42 -0
- package/dist/types/model.d.ts +42 -0
- package/dist/types/monsqlize.d.mts +32 -9
- package/dist/types/monsqlize.d.ts +32 -9
- package/dist/types/runtime.d.mts +3 -1
- package/dist/types/runtime.d.ts +3 -1
- package/licenses/production-dependencies.json +1 -1
- package/package.json +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
-
> Summary index — the
|
|
4
|
-
> **Last updated**: 2026-
|
|
3
|
+
> Summary index — the newest versioned release details are in [changelogs/v3.3.1.md](./changelogs/v3.3.1.md); the earlier RC note remains an unpublished rehearsal archive.
|
|
4
|
+
> **Last updated**: 2026-09-23
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## Unreleased
|
|
9
|
+
|
|
10
|
+
No changes are currently recorded after v3.3.1.
|
|
11
|
+
|
|
8
12
|
## Version Overview
|
|
9
13
|
|
|
10
14
|
| Version | Date | Summary | Details |
|
|
11
15
|
|---------|------|---------|---------|
|
|
16
|
+
| [v3.3.1](./changelogs/v3.3.1.md) | 2026-09-23 | Patch: audited Model, count, transaction, cache, sync, pool, Data Task and SSH corrections | [View](./changelogs/v3.3.1.md) |
|
|
17
|
+
| [v3.3.0](./changelogs/v3.3.0.md) | 2026-08-11 | Minor: static Model schema type inference, schema-dsl 3.0.4, and silent-by-default Pool logging | [View](./changelogs/v3.3.0.md) |
|
|
12
18
|
| [v3.2.0](./changelogs/v3.2.0.md) | 2026-08-07 | Minor: Vector Search APIs, relation-safe Model deletion, and relation projection improvements | [View](./changelogs/v3.2.0.md) |
|
|
13
19
|
| [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) |
|
|
14
20
|
| [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) |
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ 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
|
|
17
|
+
This development source is pinned to verified registry `schema-dsl@3.0.4`. The v3 package remains subject to the full release gate before an immutable tag and npm publication.
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
20
|
npm install monsqlize
|
|
@@ -234,6 +234,30 @@ const user = await User.insertOne({
|
|
|
234
234
|
});
|
|
235
235
|
```
|
|
236
236
|
|
|
237
|
+
### TypeScript Schema Inference
|
|
238
|
+
|
|
239
|
+
For a static object-literal schema, `defineModel()` carries the schema-derived document type from definition through registration to runtime access. Registration remains explicit, so it does not change the process-wide Model registry behavior.
|
|
240
|
+
|
|
241
|
+
```ts
|
|
242
|
+
import { defineModel, Model } from 'monsqlize';
|
|
243
|
+
|
|
244
|
+
const User = defineModel('users', {
|
|
245
|
+
schema: {
|
|
246
|
+
email: 'email!',
|
|
247
|
+
age: 'number?'
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
Model.define(User);
|
|
252
|
+
|
|
253
|
+
const users = msq.model(User);
|
|
254
|
+
const user = await users.findOne({ email: 'ada@example.com' });
|
|
255
|
+
// user?.email: string
|
|
256
|
+
// user?.age: number | undefined
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Call `Model.define(User)` before `model(User)`, `use(...).model(User)`, or `pool(...).model(User)`. Callback-based or dynamically composed schemas continue to use the existing explicit generic API, such as `msq.model<UserDocument>('users')`; managed fields added by timestamps, soft delete, versioning, relations, or virtuals are not synthesized into this schema-derived type.
|
|
260
|
+
|
|
237
261
|
When a service needs runtime-local custom types, messages, locale, or an already-owned schema-dsl runtime, configure `schemaDsl` on the MonSQLize instance:
|
|
238
262
|
|
|
239
263
|
```js
|
|
@@ -308,6 +332,14 @@ Relative model paths are resolved from `process.cwd()`. In production services,
|
|
|
308
332
|
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:
|
|
309
333
|
|
|
310
334
|
```js
|
|
335
|
+
const MonSQLize = require('monsqlize');
|
|
336
|
+
|
|
337
|
+
async function main() {
|
|
338
|
+
MonSQLize.Model.define('users', {
|
|
339
|
+
schema: { email: 'email!' },
|
|
340
|
+
indexes: [{ key: { email: 1 }, unique: true }]
|
|
341
|
+
});
|
|
342
|
+
|
|
311
343
|
const msq = new MonSQLize({
|
|
312
344
|
type: 'mongodb',
|
|
313
345
|
databaseName: 'mydb',
|
|
@@ -315,11 +347,18 @@ const msq = new MonSQLize({
|
|
|
315
347
|
autoIndex: false
|
|
316
348
|
});
|
|
317
349
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
350
|
+
try {
|
|
351
|
+
await msq.connect();
|
|
352
|
+
const plan = await msq.ensureModelIndexes({ models: ['users'], dryRun: true });
|
|
353
|
+
if (plan.totals.conflicts === 0) {
|
|
354
|
+
await msq.ensureModelIndexes({ models: ['users'], throwOnError: true });
|
|
355
|
+
}
|
|
356
|
+
} finally {
|
|
357
|
+
await msq.close();
|
|
322
358
|
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
main().catch((error) => { console.error(error); process.exitCode = 1; });
|
|
323
362
|
```
|
|
324
363
|
|
|
325
364
|
`ensureModelIndexes()` creates only missing indexes. It does not drop, rename, or rebuild conflicting indexes.
|
|
@@ -425,6 +464,8 @@ Transaction cache invalidations are recorded during the transaction and flushed
|
|
|
425
464
|
### Connection Pools
|
|
426
465
|
|
|
427
466
|
```js
|
|
467
|
+
const MonSQLize = require('monsqlize');
|
|
468
|
+
async function main() {
|
|
428
469
|
const msq = new MonSQLize({
|
|
429
470
|
type: 'mongodb',
|
|
430
471
|
databaseName: 'main',
|
|
@@ -434,7 +475,16 @@ const msq = new MonSQLize({
|
|
|
434
475
|
]
|
|
435
476
|
});
|
|
436
477
|
|
|
437
|
-
|
|
478
|
+
try {
|
|
479
|
+
await msq.connect();
|
|
480
|
+
const reports = msq.pool('analytics').collection('reports');
|
|
481
|
+
console.log(await reports.countDocuments({}));
|
|
482
|
+
} finally {
|
|
483
|
+
await msq.close();
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
main().catch((error) => { console.error(error); process.exitCode = 1; });
|
|
438
488
|
```
|
|
439
489
|
|
|
440
490
|
### Change Streams
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# monSQLize v3.3.0
|
|
2
|
+
|
|
3
|
+
> Release date: 2026-08-11
|
|
4
|
+
|
|
5
|
+
## Highlights
|
|
6
|
+
|
|
7
|
+
- Added schema-derived TypeScript document inference for static Model definitions.
|
|
8
|
+
- Made Pool logging silent by default while preserving explicit logger delivery.
|
|
9
|
+
|
|
10
|
+
## Added
|
|
11
|
+
|
|
12
|
+
- Added `defineModel()` and `ModelDescriptor` so object-literal `schema` definitions carry their inferred document type through `Model.define()`, `model()`, `scopedModel()`, `use().model()`, and `pool().model()`.
|
|
13
|
+
- Added CJS, ESM, public-type, compatibility, pack-consumer, and registry-consumer verification for the descriptor API.
|
|
14
|
+
|
|
15
|
+
## Changed
|
|
16
|
+
|
|
17
|
+
- Updated the exact production dependency from `schema-dsl@3.0.0` to `schema-dsl@3.0.4`.
|
|
18
|
+
- Extended current-version validation so README and bilingual dependency-governance documents must match the exact `schema-dsl` version in `package.json`.
|
|
19
|
+
|
|
20
|
+
## Fixed
|
|
21
|
+
|
|
22
|
+
- Forwarded the configured `ConnectionPoolManager` logger to `PoolSelector`, `HealthChecker`, and `PoolStatsManager`.
|
|
23
|
+
- Removed implicit `console` fallback logging from Pool helpers when no logger is configured.
|
|
24
|
+
|
|
25
|
+
## Compatibility boundaries
|
|
26
|
+
|
|
27
|
+
- This is a backward-compatible minor release. Existing string-based Model registration/access, manual TypeScript generics, Pool APIs, and explicit process-wide Model registry lifecycle remain unchanged.
|
|
28
|
+
- `defineModel()` creates a static descriptor; it does not register the Model. Call `Model.define(descriptor)` before binding it through a runtime accessor.
|
|
29
|
+
- Callback or dynamically composed schemas continue to use explicit document generics. Schema-derived types do not synthesize timestamp, soft-delete, version, relation, or virtual fields.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# monSQLize v3.3.1
|
|
2
|
+
|
|
3
|
+
> Release date: 2026-09-23
|
|
4
|
+
|
|
5
|
+
## Highlights
|
|
6
|
+
|
|
7
|
+
This backward-compatible patch closes the post-3.3.0 runtime audit findings. It corrects Model validation, soft-delete, relation and strict-version behavior; count cancellation; transaction, cache, pool and sync lifecycle edges; and backup/restore data fidelity.
|
|
8
|
+
|
|
9
|
+
## Fixed
|
|
10
|
+
|
|
11
|
+
- Model writes now surface a schema factory error only when full-document validation is required. Disabling validation or using `skipValidation` no longer blocks unrelated writes and management methods.
|
|
12
|
+
- Boolean soft delete consistently treats only `true` as deleted across reads, batch deletion and relation-usage checks. Hydrated `remove()` follows Model hooks and soft-delete rules.
|
|
13
|
+
- Strict `updateMany` and `updateBatch` preserve the original business filter during each atomic write. A candidate that no longer matches that filter is reported as skipped; a still-matching candidate with a changed version is a conflict. Candidate enumeration is no longer limited by the public find default.
|
|
14
|
+
- Populate pagination applies `skip` and `limit` per parent. Model batch writes, query cache keys, expression evaluation and write-path checks retain their original filters and BSON semantics.
|
|
15
|
+
- Public count operations forward the caller's abort signal to CountQueue, including queued and running work. Running slots remain occupied until the underlying operation settles.
|
|
16
|
+
- Managed transaction aborts reject later wrapped writes. Redis invalidation does not rebroadcast received events, pool close/capacity races are handled, and Change Stream sync preserves resume tokens and failure barriers.
|
|
17
|
+
- Data Task backup/restore preserves canonical BSON values. Optional SSH host verification and local failure cleanup are available without changing the default connection path.
|
|
18
|
+
|
|
19
|
+
## Compatibility and verification
|
|
20
|
+
|
|
21
|
+
- No breaking public method signature, package entry point, runtime Node requirement or direct production dependency change. MongoDB remains the only complete adapter; Node.js `>=18` remains the runtime contract.
|
|
22
|
+
- The transitive `fast-uri` override now permits patched v3 releases and resolves to 3.1.8; the development-only `js-yaml` lockfile entry is refreshed to 4.3.2. Both clear high-severity advisories found during release review without changing the supported major versions.
|
|
23
|
+
- Release automation uses npm trusted publishing through GitHub Actions OIDC. The pre-tag check verifies runner readiness; npm verifies the configured publisher during the actual publish.
|
|
24
|
+
- Validation-disabled writes and strict batch-result classification may behave differently from the faulty post-3.3.0 main branch; applications relying on the documented contracts receive the corrected behavior.
|
|
25
|
+
- The root CJS/ESM byte budget moves from 720,000 to 740,000 to cover the audited runtime fixes while retaining a tight size guard. The CLI budget remains 50,000 bytes.
|
|
26
|
+
- The release gate covers full tests and coverage, Node 18/20/22 CI, Node 20/22 × MongoDB Driver 6/7 × MongoDB Server 7.0.37/8.0.26, package installation, and bilingual website verification.
|
|
27
|
+
|
|
28
|
+
Private SSH and Atlas deployments remain operator-managed integration checks; local and public CI coverage does not claim to replace them.
|
|
@@ -31,7 +31,7 @@ var import_node_url = require("node:url");
|
|
|
31
31
|
// package.json
|
|
32
32
|
var package_default = {
|
|
33
33
|
name: "monsqlize",
|
|
34
|
-
version: "3.
|
|
34
|
+
version: "3.3.1",
|
|
35
35
|
description: "TypeScript production data runtime layer for MongoDB today, with cache, transactions, pools, models, sync, and observability",
|
|
36
36
|
type: "commonjs",
|
|
37
37
|
main: "./dist/cjs/index.cjs",
|
|
@@ -52,6 +52,8 @@ var package_default = {
|
|
|
52
52
|
"./package.json": "./package.json"
|
|
53
53
|
},
|
|
54
54
|
files: [
|
|
55
|
+
"changelogs/v3.3.1.md",
|
|
56
|
+
"changelogs/v3.3.0.md",
|
|
55
57
|
"changelogs/v3.2.0.md",
|
|
56
58
|
"changelogs/v3.1.14.md",
|
|
57
59
|
"changelogs/v3.1.13.md",
|
|
@@ -191,11 +193,11 @@ var package_default = {
|
|
|
191
193
|
"cache-hub": "2.2.4",
|
|
192
194
|
ioredis: "5.11.1",
|
|
193
195
|
mongodb: "6.21.0",
|
|
194
|
-
"schema-dsl": "3.0.
|
|
196
|
+
"schema-dsl": "3.0.4",
|
|
195
197
|
ssh2: "1.17.0"
|
|
196
198
|
},
|
|
197
199
|
overrides: {
|
|
198
|
-
"fast-uri": "3.1.
|
|
200
|
+
"fast-uri": "^3.1.8",
|
|
199
201
|
"minimatch@3.1.5": {
|
|
200
202
|
"brace-expansion": "1.1.18"
|
|
201
203
|
},
|