monsqlize 3.3.3 → 3.3.4
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 +4 -3
- package/README.md +1 -1
- package/changelogs/v3.3.4.md +21 -0
- package/dist/cjs/cli/data-task.cjs +5 -4
- package/dist/cjs/index.cjs +35 -25
- package/dist/esm/index.mjs +35 -25
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
-
> Summary index — the 3.3.
|
|
4
|
-
> **Last updated**: 2026-10-
|
|
3
|
+
> Summary index — the 3.3.4 versioned details are in [changelogs/v3.3.4.md](./changelogs/v3.3.4.md). A versioned note does not establish npm publication; check the registry and immutable tag before deployment.
|
|
4
|
+
> **Last updated**: 2026-10-26
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
-
The
|
|
10
|
+
The weekly-scan cache-key, health-check and lockfile security fixes are assigned to **3.3.4** ([versioned notes](./changelogs/v3.3.4.md)); the schema-dsl 3.0.5 upgrade is in [3.3.3](./changelogs/v3.3.3.md); the audited 3.3.2 repairs are in its [versioned notes](./changelogs/v3.3.2.md) and the [next-change staging log](https://github.com/devcodex-labs/monSQLize/blob/main/changelogs/unreleased.md). Untagged checkouts remain release candidates.
|
|
11
11
|
|
|
12
12
|
## Version Overview
|
|
13
13
|
|
|
14
14
|
| Version | Date | Summary | Details |
|
|
15
15
|
|---------|------|---------|---------|
|
|
16
|
+
| [v3.3.4](./changelogs/v3.3.4.md) | 2026-10-26 | Patch: cached-read keys under autoConvertObjectId, hung health-check pings, lockfile security patches | [View](./changelogs/v3.3.4.md) |
|
|
16
17
|
| [v3.3.3](./changelogs/v3.3.3.md) | 2026-10-23 | Patch: pin schema-dsl 3.0.5 (dependency bug fixes only) | [View](./changelogs/v3.3.3.md) |
|
|
17
18
|
| [v3.3.2](./changelogs/v3.3.2.md) | 2026-10-22 | Patch: BSON/cache identity, Model invalidation, pagination, transaction/sync lifecycle and upgrade safeguards; availability requires registry/tag verification | [View](./changelogs/v3.3.2.md) |
|
|
18
19
|
| [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) |
|
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. The Google site ownership verification file is copied separately from the workflow commit, with its source commit and content hash recorded in the deployment summary.
|
|
16
16
|
|
|
17
|
-
This source tree targets **3.3.
|
|
17
|
+
This source tree targets **3.3.4**, a patch fixing cached-read keys under `autoConvertObjectId`, hung health-check pings and lockfile security advisories (see the [3.3.4 notes](./changelogs/v3.3.4.md)); 3.3.3 pinned `schema-dsl@3.0.5`. The 3.3.2 cache, Model, pagination and sync fixes, including cold-cache upgrades and checkpoint rollback limits, are described in the [3.3.2 notes](./changelogs/v3.3.2.md) and [migration guide](./MIGRATION.md). Read the upgrade guide in [English](https://github.com/devcodex-labs/monSQLize/blob/main/docs/en/upgrade-3.3.2.md) or [简体中文](https://github.com/devcodex-labs/monSQLize/blob/main/docs/zh/upgrade-3.3.2.md). Untagged checkouts remain release candidates; verify the immutable tag and requested registry version before deployment. Candidate preparation does not publish npm or update stable Pages.
|
|
18
18
|
|
|
19
19
|
This development source is pinned to verified registry `schema-dsl@3.0.5`. The v3 package remains subject to the full release gate before an immutable tag and npm publication.
|
|
20
20
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# monSQLize v3.3.4
|
|
2
|
+
|
|
3
|
+
> Release date: 2026-10-26
|
|
4
|
+
> Publication authority: the immutable tag and npm registry. An untagged checkout is a release candidate; the date above does not establish registry availability.
|
|
5
|
+
|
|
6
|
+
## Highlights
|
|
7
|
+
|
|
8
|
+
Bug-fix and security patch. Public entry points, signatures, Node.js `>=18`, build formats and package budgets remain unchanged from 3.3.3.
|
|
9
|
+
|
|
10
|
+
## Fixed
|
|
11
|
+
|
|
12
|
+
- Key cached `find`, `findOne`, `count` and `distinct` reads by the exact filter sent to MongoDB. With `autoConvertObjectId`, a filter whose `toBSON()` yields a 24-hex string `_id` no longer shares a cache entry with the equivalent `ObjectId` query; plain string filters still convert and share keys as before. Uncached results, invalidation descriptors and public signatures are unchanged.
|
|
13
|
+
- Let a health check whose ping hangs past `timeout` keep counting failures: later checks wait on the same pending ping instead of skipping, so the pool reaches `down` after `retries` timeouts. Still only one ping per pool is in flight, and a late ping result cannot overwrite newer status.
|
|
14
|
+
|
|
15
|
+
## Security
|
|
16
|
+
|
|
17
|
+
- Refresh lockfile-only security patches: `fast-uri` 3.1.9 (production, via schema-dsl/ajv; clears 4 GHSA advisories that failed `test:audit`), dev-only `follow-redirects` 1.16.2 and overridden `brace-expansion` 1.1.21/5.0.12. No direct dependency version changes.
|
|
18
|
+
|
|
19
|
+
## Upgrade and rollback
|
|
20
|
+
|
|
21
|
+
No migration is required. Cached reads whose filter uses `toBSON()` with `autoConvertObjectId` get a new key and are read once from MongoDB after upgrade; all other cache keys are unchanged. Rollback to 3.3.3 restores the previous behavior and lockfile.
|
|
@@ -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.3.
|
|
34
|
+
version: "3.3.4",
|
|
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",
|
|
@@ -53,6 +53,7 @@ var package_default = {
|
|
|
53
53
|
},
|
|
54
54
|
files: [
|
|
55
55
|
"changelogs/v3.3.3.md",
|
|
56
|
+
"changelogs/v3.3.4.md",
|
|
56
57
|
"changelogs/v3.3.2.md",
|
|
57
58
|
"changelogs/v3.3.1.md",
|
|
58
59
|
"changelogs/v3.3.0.md",
|
|
@@ -199,12 +200,12 @@ var package_default = {
|
|
|
199
200
|
ssh2: "1.17.0"
|
|
200
201
|
},
|
|
201
202
|
overrides: {
|
|
202
|
-
"fast-uri": "^3.1.
|
|
203
|
+
"fast-uri": "^3.1.9",
|
|
203
204
|
"minimatch@3.1.5": {
|
|
204
|
-
"brace-expansion": "1.1.
|
|
205
|
+
"brace-expansion": "1.1.21"
|
|
205
206
|
},
|
|
206
207
|
"minimatch@10.2.5": {
|
|
207
|
-
"brace-expansion": "5.0.
|
|
208
|
+
"brace-expansion": "5.0.12"
|
|
208
209
|
}
|
|
209
210
|
}
|
|
210
211
|
};
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -8265,18 +8265,26 @@ var HealthChecker = class {
|
|
|
8265
8265
|
const status = this._healthStatus.get(poolName);
|
|
8266
8266
|
if (!status) return;
|
|
8267
8267
|
const client = this._clients.get(poolName) ?? this._poolManager?._getPool(poolName);
|
|
8268
|
-
|
|
8268
|
+
const pending = this._inProgress.get(poolName);
|
|
8269
|
+
if (pending && pending.client === client && pending.awaited) return;
|
|
8269
8270
|
const epoch = this._epochs.get(poolName);
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
}
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8271
|
+
let operation;
|
|
8272
|
+
if (pending && pending.client === client) {
|
|
8273
|
+
operation = pending;
|
|
8274
|
+
} else {
|
|
8275
|
+
const promise2 = Promise.resolve().then(() => {
|
|
8276
|
+
if (this._epochs.get(poolName) !== epoch || this._healthStatus.get(poolName) !== status) return;
|
|
8277
|
+
return this._pingOverride ? this._pingOverride(poolName) : this._pingPool(poolName);
|
|
8278
|
+
});
|
|
8279
|
+
operation = { client, promise: promise2, awaited: true };
|
|
8280
|
+
this._inProgress.set(poolName, operation);
|
|
8281
|
+
const clearPending = () => {
|
|
8282
|
+
if (this._inProgress.get(poolName) === operation) this._inProgress.delete(poolName);
|
|
8283
|
+
};
|
|
8284
|
+
void promise2.then(clearPending, clearPending);
|
|
8285
|
+
}
|
|
8286
|
+
operation.awaited = true;
|
|
8287
|
+
const promise = operation.promise;
|
|
8280
8288
|
let timer;
|
|
8281
8289
|
let lastError = null;
|
|
8282
8290
|
try {
|
|
@@ -8288,6 +8296,7 @@ var HealthChecker = class {
|
|
|
8288
8296
|
lastError = error instanceof Error ? error : new Error(String(error));
|
|
8289
8297
|
} finally {
|
|
8290
8298
|
if (timer) clearTimeout(timer);
|
|
8299
|
+
operation.awaited = false;
|
|
8291
8300
|
}
|
|
8292
8301
|
if (this._epochs.get(poolName) !== epoch || this._healthStatus.get(poolName) !== status) return;
|
|
8293
8302
|
status.lastCheck = /* @__PURE__ */ new Date();
|
|
@@ -10745,27 +10754,28 @@ function normalizeFindPageLimit(limit, defaults2) {
|
|
|
10745
10754
|
}
|
|
10746
10755
|
return rawLimit;
|
|
10747
10756
|
}
|
|
10748
|
-
function documentReadKey(operation, collection, defaults2, query, options, field) {
|
|
10749
|
-
const
|
|
10757
|
+
function documentReadKey(operation, collection, defaults2, query, options, field, queryPrepared = false) {
|
|
10758
|
+
const keyQuery = queryPrepared ? query ?? {} : normalizeQueryForCache(query, defaults2);
|
|
10759
|
+
const captured = snapshotReadInputs(keyQuery, options, collection.bsonOptions);
|
|
10750
10760
|
const keyOptions = buildResultCacheKeyOptions(captured.options, collection.bsonOptions);
|
|
10751
10761
|
if (operation === "count") delete keyOptions.fieldsAsRaw;
|
|
10752
10762
|
const body = field === void 0 ? stableCacheKeyString(captured.query, "document") : stableCacheKeyString({ key: field, query: captured.query });
|
|
10753
10763
|
return `${operation}:${buildCollectionCacheNamespace(collection, defaults2)}:${body}:${stableCacheKeyString(keyOptions)}`;
|
|
10754
10764
|
}
|
|
10755
|
-
function buildFindCacheKey(collection, defaults2 = {}, query, options) {
|
|
10765
|
+
function buildFindCacheKey(collection, defaults2 = {}, query, options, queryPrepared = false) {
|
|
10756
10766
|
return documentReadKey("find", collection, defaults2, query, normalizeFindProjectionOptions({
|
|
10757
10767
|
limit: defaults2.findLimit,
|
|
10758
10768
|
...options ?? {}
|
|
10759
|
-
}));
|
|
10769
|
+
}), void 0, queryPrepared);
|
|
10760
10770
|
}
|
|
10761
|
-
function buildFindOneCacheKey(collection, defaults2 = {}, query, options) {
|
|
10762
|
-
return documentReadKey("findOne", collection, defaults2, query, normalizeFindProjectionOptions(options));
|
|
10771
|
+
function buildFindOneCacheKey(collection, defaults2 = {}, query, options, queryPrepared = false) {
|
|
10772
|
+
return documentReadKey("findOne", collection, defaults2, query, normalizeFindProjectionOptions(options), void 0, queryPrepared);
|
|
10763
10773
|
}
|
|
10764
|
-
function buildCountCacheKey(collection, defaults2 = {}, query, options) {
|
|
10765
|
-
return documentReadKey("count", collection, defaults2, query, options);
|
|
10774
|
+
function buildCountCacheKey(collection, defaults2 = {}, query, options, queryPrepared = false) {
|
|
10775
|
+
return documentReadKey("count", collection, defaults2, query, options, void 0, queryPrepared);
|
|
10766
10776
|
}
|
|
10767
|
-
function buildDistinctCacheKey(collection, defaults2 = {}, field, query, options) {
|
|
10768
|
-
return documentReadKey("distinct", collection, defaults2, query, options, field);
|
|
10777
|
+
function buildDistinctCacheKey(collection, defaults2 = {}, field, query, options, queryPrepared = false) {
|
|
10778
|
+
return documentReadKey("distinct", collection, defaults2, query, options, field, queryPrepared);
|
|
10769
10779
|
}
|
|
10770
10780
|
function buildPreparedAggregateCacheKey(collection, defaults2 = {}, pipeline = [], options) {
|
|
10771
10781
|
const namespace = buildCollectionCacheNamespace(collection, defaults2);
|
|
@@ -11777,7 +11787,7 @@ var FindChain = class {
|
|
|
11777
11787
|
const cacheTTL = typeof this.options.cache === "number" ? this.options.cache : 0;
|
|
11778
11788
|
const executeOptions = prepared.options;
|
|
11779
11789
|
if (cacheTTL > 0 && this.queryCache && canCacheBsonResult(executeOptions) && !hasSessionOption(executeOptions) && !await isCollectionCacheBarrierActive(this.queryCache, this.collection, this.defaults)) {
|
|
11780
|
-
const cacheKey = buildFindCacheKey(this.collection, this.defaults, prepared.query, executeOptions);
|
|
11790
|
+
const cacheKey = buildFindCacheKey(this.collection, this.defaults, prepared.query, executeOptions, true);
|
|
11781
11791
|
const result = await readThroughCache(this.queryCache, cacheKey, cacheTTL, () => this.runToArray(prepared));
|
|
11782
11792
|
return this.wrapResult("find", startTs, result);
|
|
11783
11793
|
}
|
|
@@ -13619,7 +13629,7 @@ var MongoCollectionAccessor = class {
|
|
|
13619
13629
|
const { query: normalizedQuery, options: driverOptions } = snapshotReadInputs(this._cvFilter(query), normalizeFindProjectionOptions(rawOptions), this.collectionRef.bsonOptions);
|
|
13620
13630
|
const cacheTTL = rawOptions.explain ? 0 : typeof rawOptions.cache === "number" ? rawOptions.cache : 0;
|
|
13621
13631
|
if (cacheTTL > 0 && this.management.queryCache && canCacheBsonResult(driverOptions) && !hasSessionOption(driverOptions) && !await isCollectionCacheBarrierActive(this.management.queryCache, this.collectionRef, this.management.defaults)) {
|
|
13622
|
-
const cacheKey = buildFindOneCacheKey(this.collectionRef, this.management.defaults, normalizedQuery, driverOptions);
|
|
13632
|
+
const cacheKey = buildFindOneCacheKey(this.collectionRef, this.management.defaults, normalizedQuery, driverOptions, true);
|
|
13623
13633
|
const result2 = await readThroughCache(this.management.queryCache, cacheKey, cacheTTL, () => findOneDocument(this.collectionRef, normalizedQuery, driverOptions));
|
|
13624
13634
|
return wrapQueryResultWithMeta(this.collectionRef, this.management.defaults, "findOne", rawOptions, startTs, result2);
|
|
13625
13635
|
}
|
|
@@ -13676,7 +13686,7 @@ var MongoCollectionAccessor = class {
|
|
|
13676
13686
|
);
|
|
13677
13687
|
const countQueue = this.management.defaults?.countQueue;
|
|
13678
13688
|
if (cacheTTL > 0 && this.management.queryCache && canCacheBsonCount(keyOptions) && !hasSessionOption(keyOptions) && !await isCollectionCacheBarrierActive(this.management.queryCache, this.collectionRef, this.management.defaults)) {
|
|
13679
|
-
const cacheKey = buildCountCacheKey(this.collectionRef, this.management.defaults, normalizedQuery, keyOptions);
|
|
13689
|
+
const cacheKey = buildCountCacheKey(this.collectionRef, this.management.defaults, normalizedQuery, keyOptions, true);
|
|
13680
13690
|
const result = await readThroughCache(
|
|
13681
13691
|
this.management.queryCache,
|
|
13682
13692
|
cacheKey,
|
|
@@ -13769,7 +13779,7 @@ var MongoCollectionAccessor = class {
|
|
|
13769
13779
|
driverOptions
|
|
13770
13780
|
);
|
|
13771
13781
|
if (cacheTTL > 0 && this.management.queryCache && canCacheBsonResult(driverOptions) && !hasSessionOption(driverOptions) && !await isCollectionCacheBarrierActive(this.management.queryCache, this.collectionRef, this.management.defaults)) {
|
|
13772
|
-
const cacheKey = buildDistinctCacheKey(this.collectionRef, this.management.defaults, key, normalizedQuery, driverOptions);
|
|
13782
|
+
const cacheKey = buildDistinctCacheKey(this.collectionRef, this.management.defaults, key, normalizedQuery, driverOptions, true);
|
|
13773
13783
|
const result2 = await readThroughCache(this.management.queryCache, cacheKey, cacheTTL, executeDistinct);
|
|
13774
13784
|
return wrapQueryResultWithMeta(this.collectionRef, this.management.defaults, "distinct", rawOptions, startTs, result2);
|
|
13775
13785
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -8248,18 +8248,26 @@ var HealthChecker = class {
|
|
|
8248
8248
|
const status = this._healthStatus.get(poolName);
|
|
8249
8249
|
if (!status) return;
|
|
8250
8250
|
const client = this._clients.get(poolName) ?? this._poolManager?._getPool(poolName);
|
|
8251
|
-
|
|
8251
|
+
const pending = this._inProgress.get(poolName);
|
|
8252
|
+
if (pending && pending.client === client && pending.awaited) return;
|
|
8252
8253
|
const epoch = this._epochs.get(poolName);
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
}
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8254
|
+
let operation;
|
|
8255
|
+
if (pending && pending.client === client) {
|
|
8256
|
+
operation = pending;
|
|
8257
|
+
} else {
|
|
8258
|
+
const promise2 = Promise.resolve().then(() => {
|
|
8259
|
+
if (this._epochs.get(poolName) !== epoch || this._healthStatus.get(poolName) !== status) return;
|
|
8260
|
+
return this._pingOverride ? this._pingOverride(poolName) : this._pingPool(poolName);
|
|
8261
|
+
});
|
|
8262
|
+
operation = { client, promise: promise2, awaited: true };
|
|
8263
|
+
this._inProgress.set(poolName, operation);
|
|
8264
|
+
const clearPending = () => {
|
|
8265
|
+
if (this._inProgress.get(poolName) === operation) this._inProgress.delete(poolName);
|
|
8266
|
+
};
|
|
8267
|
+
void promise2.then(clearPending, clearPending);
|
|
8268
|
+
}
|
|
8269
|
+
operation.awaited = true;
|
|
8270
|
+
const promise = operation.promise;
|
|
8263
8271
|
let timer;
|
|
8264
8272
|
let lastError = null;
|
|
8265
8273
|
try {
|
|
@@ -8271,6 +8279,7 @@ var HealthChecker = class {
|
|
|
8271
8279
|
lastError = error instanceof Error ? error : new Error(String(error));
|
|
8272
8280
|
} finally {
|
|
8273
8281
|
if (timer) clearTimeout(timer);
|
|
8282
|
+
operation.awaited = false;
|
|
8274
8283
|
}
|
|
8275
8284
|
if (this._epochs.get(poolName) !== epoch || this._healthStatus.get(poolName) !== status) return;
|
|
8276
8285
|
status.lastCheck = /* @__PURE__ */ new Date();
|
|
@@ -10728,27 +10737,28 @@ function normalizeFindPageLimit(limit, defaults2) {
|
|
|
10728
10737
|
}
|
|
10729
10738
|
return rawLimit;
|
|
10730
10739
|
}
|
|
10731
|
-
function documentReadKey(operation, collection, defaults2, query, options, field) {
|
|
10732
|
-
const
|
|
10740
|
+
function documentReadKey(operation, collection, defaults2, query, options, field, queryPrepared = false) {
|
|
10741
|
+
const keyQuery = queryPrepared ? query ?? {} : normalizeQueryForCache(query, defaults2);
|
|
10742
|
+
const captured = snapshotReadInputs(keyQuery, options, collection.bsonOptions);
|
|
10733
10743
|
const keyOptions = buildResultCacheKeyOptions(captured.options, collection.bsonOptions);
|
|
10734
10744
|
if (operation === "count") delete keyOptions.fieldsAsRaw;
|
|
10735
10745
|
const body = field === void 0 ? stableCacheKeyString(captured.query, "document") : stableCacheKeyString({ key: field, query: captured.query });
|
|
10736
10746
|
return `${operation}:${buildCollectionCacheNamespace(collection, defaults2)}:${body}:${stableCacheKeyString(keyOptions)}`;
|
|
10737
10747
|
}
|
|
10738
|
-
function buildFindCacheKey(collection, defaults2 = {}, query, options) {
|
|
10748
|
+
function buildFindCacheKey(collection, defaults2 = {}, query, options, queryPrepared = false) {
|
|
10739
10749
|
return documentReadKey("find", collection, defaults2, query, normalizeFindProjectionOptions({
|
|
10740
10750
|
limit: defaults2.findLimit,
|
|
10741
10751
|
...options ?? {}
|
|
10742
|
-
}));
|
|
10752
|
+
}), void 0, queryPrepared);
|
|
10743
10753
|
}
|
|
10744
|
-
function buildFindOneCacheKey(collection, defaults2 = {}, query, options) {
|
|
10745
|
-
return documentReadKey("findOne", collection, defaults2, query, normalizeFindProjectionOptions(options));
|
|
10754
|
+
function buildFindOneCacheKey(collection, defaults2 = {}, query, options, queryPrepared = false) {
|
|
10755
|
+
return documentReadKey("findOne", collection, defaults2, query, normalizeFindProjectionOptions(options), void 0, queryPrepared);
|
|
10746
10756
|
}
|
|
10747
|
-
function buildCountCacheKey(collection, defaults2 = {}, query, options) {
|
|
10748
|
-
return documentReadKey("count", collection, defaults2, query, options);
|
|
10757
|
+
function buildCountCacheKey(collection, defaults2 = {}, query, options, queryPrepared = false) {
|
|
10758
|
+
return documentReadKey("count", collection, defaults2, query, options, void 0, queryPrepared);
|
|
10749
10759
|
}
|
|
10750
|
-
function buildDistinctCacheKey(collection, defaults2 = {}, field, query, options) {
|
|
10751
|
-
return documentReadKey("distinct", collection, defaults2, query, options, field);
|
|
10760
|
+
function buildDistinctCacheKey(collection, defaults2 = {}, field, query, options, queryPrepared = false) {
|
|
10761
|
+
return documentReadKey("distinct", collection, defaults2, query, options, field, queryPrepared);
|
|
10752
10762
|
}
|
|
10753
10763
|
function buildPreparedAggregateCacheKey(collection, defaults2 = {}, pipeline = [], options) {
|
|
10754
10764
|
const namespace = buildCollectionCacheNamespace(collection, defaults2);
|
|
@@ -11760,7 +11770,7 @@ var FindChain = class {
|
|
|
11760
11770
|
const cacheTTL = typeof this.options.cache === "number" ? this.options.cache : 0;
|
|
11761
11771
|
const executeOptions = prepared.options;
|
|
11762
11772
|
if (cacheTTL > 0 && this.queryCache && canCacheBsonResult(executeOptions) && !hasSessionOption(executeOptions) && !await isCollectionCacheBarrierActive(this.queryCache, this.collection, this.defaults)) {
|
|
11763
|
-
const cacheKey = buildFindCacheKey(this.collection, this.defaults, prepared.query, executeOptions);
|
|
11773
|
+
const cacheKey = buildFindCacheKey(this.collection, this.defaults, prepared.query, executeOptions, true);
|
|
11764
11774
|
const result = await readThroughCache(this.queryCache, cacheKey, cacheTTL, () => this.runToArray(prepared));
|
|
11765
11775
|
return this.wrapResult("find", startTs, result);
|
|
11766
11776
|
}
|
|
@@ -13602,7 +13612,7 @@ var MongoCollectionAccessor = class {
|
|
|
13602
13612
|
const { query: normalizedQuery, options: driverOptions } = snapshotReadInputs(this._cvFilter(query), normalizeFindProjectionOptions(rawOptions), this.collectionRef.bsonOptions);
|
|
13603
13613
|
const cacheTTL = rawOptions.explain ? 0 : typeof rawOptions.cache === "number" ? rawOptions.cache : 0;
|
|
13604
13614
|
if (cacheTTL > 0 && this.management.queryCache && canCacheBsonResult(driverOptions) && !hasSessionOption(driverOptions) && !await isCollectionCacheBarrierActive(this.management.queryCache, this.collectionRef, this.management.defaults)) {
|
|
13605
|
-
const cacheKey = buildFindOneCacheKey(this.collectionRef, this.management.defaults, normalizedQuery, driverOptions);
|
|
13615
|
+
const cacheKey = buildFindOneCacheKey(this.collectionRef, this.management.defaults, normalizedQuery, driverOptions, true);
|
|
13606
13616
|
const result2 = await readThroughCache(this.management.queryCache, cacheKey, cacheTTL, () => findOneDocument(this.collectionRef, normalizedQuery, driverOptions));
|
|
13607
13617
|
return wrapQueryResultWithMeta(this.collectionRef, this.management.defaults, "findOne", rawOptions, startTs, result2);
|
|
13608
13618
|
}
|
|
@@ -13659,7 +13669,7 @@ var MongoCollectionAccessor = class {
|
|
|
13659
13669
|
);
|
|
13660
13670
|
const countQueue = this.management.defaults?.countQueue;
|
|
13661
13671
|
if (cacheTTL > 0 && this.management.queryCache && canCacheBsonCount(keyOptions) && !hasSessionOption(keyOptions) && !await isCollectionCacheBarrierActive(this.management.queryCache, this.collectionRef, this.management.defaults)) {
|
|
13662
|
-
const cacheKey = buildCountCacheKey(this.collectionRef, this.management.defaults, normalizedQuery, keyOptions);
|
|
13672
|
+
const cacheKey = buildCountCacheKey(this.collectionRef, this.management.defaults, normalizedQuery, keyOptions, true);
|
|
13663
13673
|
const result = await readThroughCache(
|
|
13664
13674
|
this.management.queryCache,
|
|
13665
13675
|
cacheKey,
|
|
@@ -13752,7 +13762,7 @@ var MongoCollectionAccessor = class {
|
|
|
13752
13762
|
driverOptions
|
|
13753
13763
|
);
|
|
13754
13764
|
if (cacheTTL > 0 && this.management.queryCache && canCacheBsonResult(driverOptions) && !hasSessionOption(driverOptions) && !await isCollectionCacheBarrierActive(this.management.queryCache, this.collectionRef, this.management.defaults)) {
|
|
13755
|
-
const cacheKey = buildDistinctCacheKey(this.collectionRef, this.management.defaults, key, normalizedQuery, driverOptions);
|
|
13765
|
+
const cacheKey = buildDistinctCacheKey(this.collectionRef, this.management.defaults, key, normalizedQuery, driverOptions, true);
|
|
13756
13766
|
const result2 = await readThroughCache(this.management.queryCache, cacheKey, cacheTTL, executeDistinct);
|
|
13757
13767
|
return wrapQueryResultWithMeta(this.collectionRef, this.management.defaults, "distinct", rawOptions, startTs, result2);
|
|
13758
13768
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monsqlize",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.4",
|
|
4
4
|
"description": "TypeScript production data runtime layer for MongoDB today, with cache, transactions, pools, models, sync, and observability",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./dist/cjs/index.cjs",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"changelogs/v3.3.3.md",
|
|
25
|
+
"changelogs/v3.3.4.md",
|
|
25
26
|
"changelogs/v3.3.2.md",
|
|
26
27
|
"changelogs/v3.3.1.md",
|
|
27
28
|
"changelogs/v3.3.0.md",
|
|
@@ -168,12 +169,12 @@
|
|
|
168
169
|
"ssh2": "1.17.0"
|
|
169
170
|
},
|
|
170
171
|
"overrides": {
|
|
171
|
-
"fast-uri": "^3.1.
|
|
172
|
+
"fast-uri": "^3.1.9",
|
|
172
173
|
"minimatch@3.1.5": {
|
|
173
|
-
"brace-expansion": "1.1.
|
|
174
|
+
"brace-expansion": "1.1.21"
|
|
174
175
|
},
|
|
175
176
|
"minimatch@10.2.5": {
|
|
176
|
-
"brace-expansion": "5.0.
|
|
177
|
+
"brace-expansion": "5.0.12"
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
}
|