|
1 | 1 | # Unreleased |
2 | 2 |
|
3 | | -## Changes after v3.1.0 |
| 3 | +## Changes after v3.1.8 |
4 | 4 |
|
5 | | -- Made the npm publish workflow recoverable after a successful publish followed by a registry-smoke failure: an existing version is accepted only when its registry `gitHead` matches the immutable tag commit, publish is then skipped, and acceptance resumes. The TypeScript registry consumer now installs the Node type declarations required by MongoDB's public declarations. |
6 | | - |
7 | | -## v3.0.0 development inventory (released 2026-07-15) |
8 | | - |
9 | | -## Compatibility-impacting changes |
10 | | - |
11 | | -- Versioned Model single-document writes now enforce true optimistic concurrency control: stale writes throw `WRITE_CONFLICT`, and writes without `expectedVersion`, `version`, or a direct `_id` automatic lookup path may throw `INVALID_ARGUMENT`. |
12 | | -- `find()` now defaults to `findLimit: 500`; explicit positive `limit` and `skip` values are bounded by `findMaxLimit` and `findMaxSkip`. `limit(0)` intentionally keeps MongoDB's unlimited cursor semantics. |
13 | | -- Change Stream resume token persistence is strict by default: token save/load failures stop synchronization unless `strictSave: false` / `strictLoad: false` is configured for legacy best-effort behavior. |
14 | | -- `updateBatch({ upsert: true })` is rejected because `updateBatch` walks existing matching `_id` values and cannot express MongoDB's single-document `updateMany(..., { upsert: true })` insert semantics. Use `upsertOne()` or native `updateMany(..., { upsert: true })` instead. |
15 | | -- `dropDatabase()` treats `NODE_ENV=production`, `prod`, and `live` as production-like environments that require `allowProduction: true`. |
16 | | -- Soft-delete filtering now covers the standard Model read surface including `findPage`, ID reads, `distinct`, `aggregate`, `stream`, and `explain`. |
17 | | -- Populate `skip` / `limit` for has-many relations is applied per parent document, and nested populate is capped by `maxDepth` (default `5`). |
18 | | -- `ConnectionPoolManager.addPool()` now applies the same strict pool config validation as the public validator before opening a client. |
19 | | -- Change Stream `collections: ['*']` now means all collections rather than a literal collection named `*`. |
20 | | - |
21 | | -## Fixed / changed |
22 | | - |
23 | | -- Fixed Model `autoIndex=true` scheduling to preflight declared indexes with `listIndexes()`, skip matching existing indexes, create only missing indexes, and report conflicts through warning logs / `model-index-error` without destructive index changes. |
24 | | -- Fixed Batch 1 validation findings: `getDefaults()` now returns isolated deep-frozen snapshots, aggregate `$merge` / `$out` cache tests assert explicit target invalidation instead of implicit broad invalidation, cache invalidation docs list descriptor shapes, and legacy Redis lock wording no longer implies a running Redis service is bundled. |
25 | | -- 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. |
26 | | -- Upgraded `schema-dsl` to `2.1.6` 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, explicit validation disablement, and fail-closed dependency resolution diagnostics. |
27 | | -- Fixed `schemaDsl: { runtime, extensions }` lifecycle handling so injected runtimes register extensions once during `connect()` instead of registering the same factory during construction and reconnect setup. |
28 | | -- Made injected `schema-dsl/runtime` extension registration idempotent across failed connect retries, close/reconnect cycles, shared external runtime instances, incremental/reordered extension sets, partial extension-registration failures, external runtime resets, and source-stable function-valued definitions. Function fingerprinting now distinguishes closure-sensitive definitions from stable local scopes, including destructuring, nested helpers, templates, class/object methods, private/member access, regex literals, reserved syntax tokens, semicolonless local declarations with and without initializers, and break/continue labels; conflicting closure definitions still surface through schema-dsl. |
29 | | -- Hardened `schema-dsl/runtime` loading across CJS, ESM, and TypeScript-generated CJS test entry points; extended function fingerprinting for numeric literals and Unicode identifiers; and aligned full-document Model validation, docs, examples, and public type examples with the recommended `schema: (s) => s(...)` DSL callback style. |
30 | | -- Cleaned Model schema validation documentation so the primary path consistently describes runtime-scoped `schema-dsl/runtime`, and added schema-dsl runtime resolution to the `INVALID_CONFIG` troubleshooting surface. |
31 | | -- Raised the default `mongodb-memory-server` launch timeout to 30 seconds for test, validation, examples, and `useMemoryServer` paths while keeping `MONSQLIZE_MEMORY_MONGO_LAUNCH_TIMEOUT_MS` as the override. |
32 | | -- 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. |
33 | | -- 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. |
34 | | -- 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. |
35 | | -- Hardened `writePathPolicy` guard coverage for native client access, legacy `dropDatabase`, management-operation target namespaces, and instance-scoped database-level rules. |
36 | | -- Fixed `writePathPolicy` mixed `onViolation` precedence so db/client global raw guards prefer throwing namespace rules over a warning default. |
37 | | -- Fixed `writePathPolicy` config validation to reject the reserved `namespaces.default` key and namespace keys with leading or trailing whitespace, avoiding divergent collection/db/client guard behavior. |
38 | | -- Added strict optimistic-locking support to Model `updateBatch(..., { versionMode: 'strict' })`; default `counter` behavior remains unchanged. |
39 | | -- Clarified the runtime consistency contract across cache, transactions, Change Stream sync, and CountQueue; `transaction.distributedLock` now warns as a v1 compatibility placeholder because v2 transaction cache locks remain process-local. |
40 | | -- Added an event-level barrier for Change Stream sync target failures, passed a cooperative `AbortSignal` through `CountQueue.execute()` timeouts, and unified ObjectId auto-conversion field matching across query/write paths including nested array path segments. |
41 | | -- Clarified `updateMany(..., { upsert: true })` documentation: MongoDB inserts only one derived document when no documents match, so it is not a per-input bulk upsert replacement for `updateBatch`. |
42 | | -- Fixed Change Stream sync wildcard collection filters, made `updateBatch` / `deleteBatch` stream matching `_id` values while forwarding read options such as `session` / `collation` / `hint`, hardened pool config validation and health-check timeout cleanup, and aligned release/profile metadata. |
43 | | -- Added automatic optimistic locking for versioned Model single-document writes, including automatic direct-`_id` version lookup, explicit `expectedVersion` overrides, versioned `save()` replacement guards, and configurable `updateMany` version modes. |
44 | | -- Forwarded transaction/read options such as `session` into automatic model OCC version pre-reads, hardened file-backed Change Stream resume tokens with atomic replacement plus strict load validation, and made unexpected Change Stream closes visible through `isRunning: false` / `lastError`. |
45 | | -- Awaited async query-cache reads/writes so Redis/MultiLevel cache backends no longer make first cached reads resolve to `undefined`, and made Change Stream resume-token saves strict by default with retry knobs plus explicit `strictSave: false` legacy mode. |
46 | | -- Fixed `findPage` cursor anchors for nested dot-path sort fields, accepted `project` as a query projection alias across read helpers, and documented process-level Model registration plus ObjectId `maxDepth` conversion boundaries. |
47 | | -- Fixed `incrementOne` driver-option forwarding, closed runtime-owned Redis cache adapters on `runtime.close()`, made SSH tunnels fail fast for multi-host/SRV MongoDB URIs and post-ready disconnects, enforced slow-query batch `maxBufferSize` during in-flight flushes, wired prewarmed `findPage` bookmarks into page-jump reads, and reduced redundant rebuilds in the memory-server validation matrix. |
48 | | -- Fixed model mutable defaults cloning, preserved model aggregation-pipeline updates when timestamps/versioning are enabled, restored aggregate/distinct read-through cache plus targeted invalidation, and prevented sync resume tokens from advancing when any eligible target fails. |
49 | | -- Clarified hooks return-value compatibility and sync transform/delete-event boundaries in bilingual documentation, with regression coverage for the documented behavior. |
50 | | -- Prepared v2.0.7 release-readiness metadata, aligned package metadata with the legacy lock/Saga positioning, routed Model v1 methods factory warnings through the runtime logger, and aligned the unit runner plus validation ledgers with the current maintained suites. |
51 | | -- Fixed expression compiler precedence for mixed arithmetic/comparison expressions, preserved `$$` variables in FILTER/MAP/REDUCE, made ObjectId conversion handle shared object references consistently, routed `updateOne` update documents through `autoConvertObjectId` defaults, switched Redis lock scans to SCAN when available, and verified cursor signatures with timing-safe comparison. |
52 | | -- Added ObjectId conversion escape hatches (`excludeFields`, `{ field: false }`, `maxDepth`) while preserving value-based conversion by default; added `cursorTypes`, `cursorValueNormalizer`, and `requireCursorSecret` for findPage cursor safety and type restoration. |
53 | | -- Repositioned business lock and Saga APIs as legacy compatibility surfaces: public APIs remain available, but primary README, API index, capability index, examples index, recipes, and website navigation no longer promote them as recommended monSQLize capabilities. |
54 | | -- Added regression tests for expression variable references and precedence, ObjectId shared-reference conversion, `updateOne` conversion disabling, Redis lock SCAN usage, and cursor signature length mismatch. |
55 | | -- Clarified business lock, Saga, and cursor pagination documentation around process-local lock boundaries, Saga execution-state durability, unsigned cursor tokens, and ObjectId/Date cursor value normalization. |
56 | | -- Corrected ObjectId auto-conversion documentation to match the current value-based runtime behavior, including the instance-level `autoConvertObjectId` switch and the lack of stable field include/exclude or conversion-log controls. |
57 | | -- Clarified the `db()` / `collection()` / `use()` documentation path: quick-start and import examples now name the runtime `msq`, cross-database business examples prefer `use(name).collection(name)`, and `db(null)` validation docs now match the current runtime behavior. |
58 | | -- Repositioned README, package metadata, and bilingual documentation as a database-native production data runtime layer, with MongoDB stable today and MySQL/PostgreSQL adapters clearly marked as planned. |
59 | | -- Enhanced the documentation home hero illustration with CSS-driven SVG line flow, moving data packets, staggered node pulses, subtle scene breathing, and reduced-motion-safe visible cues. |
60 | | -- Fixed documentation-site footer localization so the English and Chinese home pages no longer show both language footer navigation blocks at the same time. |
61 | | -- Hid hand-written Markdown table-of-contents blocks in the Rspress documentation site so they no longer duplicate the generated right-side page outline. |
62 | | -- Corrected the multi-pool documentation path: the page now presents `new MonSQLize({ pools: [...] })` as the recommended setup, removes stale pinned install versions, and aligns adjacent connection, pool-chain, API index, capability index, function-cache, and Saga installation docs with the current package. |
63 | | -- Repositioned `withCache()` / `FunctionCache` as hidden legacy compatibility surfaces, removed them from current cache/navigation/API recommendation paths, aligned cache examples with database query caching, and corrected stable docs drift for pool health status, Node.js runtime version, and the 104/104 docs-example matrix. |
64 | | -- Fixed the independent coverage runner to preserve the 90% gate while counting source-level gap coverage through sourcemaps, and refreshed the verification docs/profile facts to the current 104/104 docs matrix and 57 runnable examples. |
| 5 | +No changes are currently recorded after v3.1.8. |
0 commit comments