monsqlize 2.0.2 → 2.0.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.
@@ -8,7 +8,7 @@ export interface SSHConfig {
8
8
  /** SSH server hostname or IP. */
9
9
  host: string;
10
10
  /** SSH server port (default: 22). */
11
- scopedCollection<TSchema = unknown>(name: string, options?: { database?: string; pool?: string; }): Collection<TSchema>;
11
+ port?: number;
12
12
  /** SSH login username. */
13
13
  username: string;
14
14
  /** SSH password (mutually exclusive with privateKey). */
@@ -33,7 +33,7 @@ export interface SSHConfig {
33
33
 
34
34
  import type { Collection, DbAccessor, HealthView } from './collection';
35
35
  import type { Lock, LockOptions, LockStats } from './lock';
36
- import type { ModelInstance } from './model';
36
+ import type { ModelAutoIndexOptions, ModelEnsureAllIndexesOptions, ModelIndexEnsureSummary, ModelInstance } from './model';
37
37
  import type { MongoConnectConfig } from './mongodb';
38
38
  import type { ConnectionPoolManagerOptions, PoolConfig, PoolHealthStatus, PoolStats, PoolStrategy } from './pool';
39
39
  import type {
@@ -41,6 +41,7 @@ import type {
41
41
  CacheLike,
42
42
  CacheLockManager,
43
43
  DistributedCacheInvalidator,
44
+ DistributedCacheInvalidatorStats,
44
45
  FunctionCache,
45
46
  Logger,
46
47
  MemoryCache,
@@ -65,7 +66,7 @@ import type {
65
66
  import type { SagaDefinition, SagaOrchestrator, SagaResult, SagaStats } from './saga';
66
67
  import type { SlowQueryLogConfigInput, SlowQueryLogEntry, SlowQueryLogFilter, SlowQueryLogManager, SlowQueryLogQueryOptions, SlowQueryLogRecord } from './slow-query-log';
67
68
  import type { ChangeStreamSyncManager, SyncConfig, SyncStats } from './sync';
68
- import type { Transaction, TransactionOptions } from './transaction';
69
+ import type { Transaction, TransactionOptions, TransactionStats } from './transaction';
69
70
 
70
71
  export interface MonSQLizeOptions {
71
72
  type?: 'mongodb';
@@ -107,7 +108,7 @@ export interface MonSQLizeOptions {
107
108
  /**
108
109
  * Distributed cache invalidation via Redis Pub/Sub.
109
110
  * When configured, broadcasts `delPattern` events to all other connected instances.
110
- * Requires `ioredis` to be installed separately.
111
+ * `ioredis` is installed with monSQLize; this block only enables and configures Redis usage.
111
112
  * @since v2.0.0
112
113
  */
113
114
  distributed?: {
@@ -131,6 +132,24 @@ export interface MonSQLizeOptions {
131
132
  maxPoolsCount?: number;
132
133
  sync?: SyncConfig;
133
134
  slowQueryLog?: SlowQueryLogConfigInput;
135
+ /** Global transaction defaults and transaction statistics settings. @since v1.4.0 */
136
+ transaction?: {
137
+ enableRetry?: boolean;
138
+ maxRetries?: number;
139
+ retryDelay?: number;
140
+ retryBackoff?: number;
141
+ /** Default transaction timeout in milliseconds. Alias: `maxDuration`. */
142
+ defaultTimeout?: number;
143
+ /** Default transaction timeout in milliseconds. Alias: `defaultTimeout`. */
144
+ maxDuration?: number;
145
+ defaultReadConcern?: TransactionOptions['readConcern'];
146
+ defaultWriteConcern?: TransactionOptions['writeConcern'];
147
+ defaultReadPreference?: TransactionOptions['readPreference'];
148
+ lockMaxDuration?: number;
149
+ lockCleanupInterval?: number;
150
+ maxStatsSamples?: number;
151
+ distributedLock?: Record<string, unknown>;
152
+ };
134
153
  /** Global query timeout in milliseconds applied to all find/aggregate operations. Default: 2000. @since v1.3.0 */
135
154
  maxTimeMS?: number;
136
155
  /** Default limit for find() when caller does not specify one. Default: 10. @since v1.3.0 */
@@ -157,6 +176,8 @@ export interface MonSQLizeOptions {
157
176
  countQueue?: boolean | { enabled?: boolean; concurrency?: number; maxQueueSize?: number; timeout?: number; };
158
177
  /** Model definitions to auto-register on connect. Accepts a file path (string) or an object with { path, pattern?, recursive? }. @since v1.3.0 */
159
178
  models?: string | { path: string; pattern?: string; recursive?: boolean; };
179
+ /** Global automatic model index creation control. Defaults to true for backward compatibility. */
180
+ autoIndex?: ModelAutoIndexOptions;
160
181
  /** Auto-invalidate cache on write operations. @since v1.3.0 */
161
182
  cacheAutoInvalidate?: boolean;
162
183
  }
@@ -237,6 +258,11 @@ export interface MonSQLizeInstance {
237
258
  */
238
259
  model<TDocument = any>(name: string): ModelInstance<TDocument>;
239
260
  model(name: string): ModelInstance<any>;
261
+ /**
262
+ * Ensures declared indexes for registered models.
263
+ * Use `dryRun: true` for production preflight; execution only creates missing indexes.
264
+ */
265
+ ensureModelIndexes(options?: ModelEnsureAllIndexesOptions): Promise<ModelIndexEnsureSummary>;
240
266
  /**
241
267
  * Start a MongoDB transaction session.
242
268
  * @param options Optional transaction options.
@@ -292,8 +318,12 @@ export interface MonSQLizeInstance {
292
318
  executeSaga(name: string, data: unknown): Promise<SagaResult>;
293
319
  /** List all registered Saga names. */
294
320
  listSagas(): string[];
321
+ /** Return aggregate transaction statistics; `null` before transaction capability initialization. */
322
+ getTransactionStats(): TransactionStats | null;
295
323
  /** Return Saga execution statistics (success / failure / compensation counts, etc.). */
296
324
  getSagaStats(): SagaStats;
325
+ /** Return distributed cache invalidator statistics; `null` when distributed invalidation is not enabled. */
326
+ getDistributedCacheInvalidatorStats(): DistributedCacheInvalidatorStats | null;
297
327
  /** Start ChangeStream data synchronisation. */
298
328
  startSync(): Promise<void>;
299
329
  /** Stop ChangeStream data synchronisation. */
@@ -419,6 +449,7 @@ export default class MonSQLize implements MonSQLizeInstance {
419
449
  scopedModel(name: string, options?: { database?: string; pool?: string; }): ModelInstance<any>;
420
450
  model<TDocument = any>(name: string): ModelInstance<TDocument>;
421
451
  model(name: string): ModelInstance<any>;
452
+ ensureModelIndexes(options?: ModelEnsureAllIndexesOptions): Promise<ModelIndexEnsureSummary>;
422
453
  startSession(options?: TransactionOptions): Promise<Transaction>;
423
454
  withTransaction<T>(callback: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
424
455
  withLock<T>(key: string, callback: () => Promise<T>, options?: LockOptions): Promise<T>;
@@ -431,7 +462,9 @@ export default class MonSQLize implements MonSQLizeInstance {
431
462
  defineSaga(definition: SagaDefinition): Promise<SagaDefinition>;
432
463
  executeSaga(name: string, data: unknown): Promise<SagaResult>;
433
464
  listSagas(): string[];
465
+ getTransactionStats(): TransactionStats | null;
434
466
  getSagaStats(): SagaStats;
467
+ getDistributedCacheInvalidatorStats(): DistributedCacheInvalidatorStats | null;
435
468
  startSync(): Promise<void>;
436
469
  stopSync(): Promise<void>;
437
470
  getSyncStats(): SyncStats | null;
@@ -68,7 +68,7 @@ export declare class ConnectionPoolManager {
68
68
  removePool(name: string): Promise<void>;
69
69
  getPool(name: string): unknown | null;
70
70
  getPoolNames(): string[];
71
- selectPool(operation: string, options?: { pool?: string; tags?: string[]; databaseName?: string; }): {
71
+ selectPool(operation: string, options?: { pool?: string; tags?: string[]; databaseName?: string; poolPreference?: { role?: string; tags?: string[]; }; }): {
72
72
  name: string;
73
73
  client: unknown;
74
74
  db: (name?: string) => unknown;
@@ -1,6 +1,6 @@
1
1
  import type { BookmarkClearResult, BookmarkListResult, BookmarkPrewarmResult, DeleteBatchResult, DeleteResult, IncrementOneResult, IndexCreateResult, InsertBatchResult, InsertManyResult, UpdateBatchResult, UpdateResult } from './collection';
2
2
  import type { LoggerLike, ExpressionFunction, ExpressionObject } from './base';
3
- import type { ModelDefinition, ModelInstance as ModelInstanceContract, RegisteredModel, RelationConfig } from './model';
3
+ import type { ModelDefinition, ModelEnsureIndexesOptions, ModelIndexEnsureResult, ModelInstance as ModelInstanceContract, RegisteredModel, RelationConfig } from './model';
4
4
  import type { LockOptions, LockStats } from './lock';
5
5
  import type { ConnectionPoolManagerOptions, FallbackStrategy, PoolConfig, PoolHealthStatus, PoolRole, PoolStats, PoolStrategy } from './pool';
6
6
  import type { SagaDefinition, SagaOrchestratorOptions, SagaResult, SagaStats, SagaStep } from './saga';
@@ -9,11 +9,16 @@ import type { ResumeTokenConfig, SyncChangeEvent, SyncConfig, SyncStats, SyncTar
9
9
  import type { MongoSession, TransactionOptions, TransactionStats } from './transaction';
10
10
  import type {
11
11
  CacheLike as HubCacheLike,
12
+ CacheRemainingTtl as HubCacheRemainingTtl,
13
+ CacheSetOptions as HubCacheSetOptions,
12
14
  CacheStats as HubCacheStats,
13
15
  LockManager as HubCacheLockLike,
14
16
  MemoryCacheOptions as HubMemoryCacheOptions,
15
17
  } from 'cache-hub';
16
- import type { RedisCacheAdapter as HubRedisCacheAdapter } from 'cache-hub/redis';
18
+ import type {
19
+ RedisCacheAdapter as HubRedisCacheAdapter,
20
+ RedisCacheAdapterOptions as HubRedisCacheAdapterOptions,
21
+ } from 'cache-hub/redis';
17
22
  import type {
18
23
  DistributedInvalidatorOptions as HubDistributedInvalidatorOptions,
19
24
  InvalidatorStats as HubInvalidatorStats,
@@ -44,6 +49,8 @@ export declare class Logger {
44
49
 
45
50
  export type CacheLockLike = HubCacheLockLike;
46
51
  export type CacheLike = HubCacheLike;
52
+ export type CacheRemainingTtl = HubCacheRemainingTtl;
53
+ export type CacheSetOptions = HubCacheSetOptions;
47
54
  export type MemoryCacheOptions = HubMemoryCacheOptions;
48
55
 
49
56
  /**
@@ -80,15 +87,27 @@ export interface MultiLevelCacheOptions {
80
87
  local?: MemoryCacheOptions;
81
88
  remote?: CacheLike | (MemoryCacheOptions & { timeoutMs?: number });
82
89
  policy?: MultiLevelCachePolicy;
83
- publish?: (msg: unknown) => void;
90
+ publish?: MultiLevelPublish;
84
91
  }
85
92
 
93
+ export type MultiLevelInvalidationMessage = {
94
+ type: 'delPattern';
95
+ pattern: string;
96
+ ts: number;
97
+ } | {
98
+ type: 'invalidateTag';
99
+ tag: string;
100
+ ts: number;
101
+ };
102
+
103
+ export type MultiLevelPublish = (msg: MultiLevelInvalidationMessage) => void;
104
+
86
105
  export declare class MemoryCache {
87
106
  constructor(options?: MemoryCacheOptions);
88
107
  setLockManager(lockManager: CacheLockLike): void;
89
108
  getLockManager(): CacheLockLike | null;
90
109
  get<T = unknown>(key: string): T | undefined;
91
- set(key: string, value: unknown, ttl?: number): void;
110
+ set(key: string, value: unknown, ttl?: number, options?: CacheSetOptions): void;
92
111
  del(key: string): boolean;
93
112
  exists(key: string): boolean;
94
113
  has(key: string): boolean;
@@ -98,6 +117,8 @@ export declare class MemoryCache {
98
117
  clear(): void;
99
118
  keys(pattern?: string): string[];
100
119
  delPattern(pattern: string): number;
120
+ getRemainingTtl(key: string): CacheRemainingTtl | undefined;
121
+ getRemainingTtlMany(keys: string[]): Record<string, CacheRemainingTtl>;
101
122
  getStats(): CacheStats;
102
123
  resetStats(): void;
103
124
  invalidateByTag(tag: string): void;
@@ -111,10 +132,11 @@ export declare class MultiLevelCache {
111
132
  writePolicy?: 'both' | 'local-first-async-remote';
112
133
  backfillOnRemoteHit?: boolean;
113
134
  remoteTimeoutMs?: number;
114
- publish?: (msg: { type: string; pattern: string; ts: number }) => void;
135
+ publish?: MultiLevelPublish;
136
+ remoteInvalidationErrors?: 'ignore' | 'throw';
115
137
  });
116
138
  get<T = unknown>(key: string): Promise<T | undefined>;
117
- set(key: string, value: unknown, ttl?: number): Promise<void>;
139
+ set(key: string, value: unknown, ttl?: number, options?: CacheSetOptions): Promise<void>;
118
140
  del(key: string): Promise<boolean>;
119
141
  exists(key: string): Promise<boolean>;
120
142
  has(key: string): Promise<boolean>;
@@ -125,14 +147,14 @@ export declare class MultiLevelCache {
125
147
  delPattern(pattern: string): Promise<number>;
126
148
  keys(pattern?: string): Promise<string[]>;
127
149
  invalidateByTag(tag: string): void | Promise<void>;
128
- setPublish(publish: (msg: { type: string; pattern: string; ts: number }) => void): void;
150
+ setPublish(publish: MultiLevelPublish): void;
129
151
  setLockManager(lockManager: CacheLockLike): void;
130
152
  getStats(): CacheStats;
131
153
  resetStats(): void;
132
154
  destroy(): void;
133
155
  }
134
156
 
135
- export type RedisCacheAdapterOptions = never;
157
+ export type RedisCacheAdapterOptions = HubRedisCacheAdapterOptions;
136
158
  export type RedisLike = object;
137
159
 
138
160
  /**
@@ -156,11 +178,13 @@ export type RedisCacheAdapter = HubRedisCacheAdapter;
156
178
 
157
179
  export declare function createRedisCacheAdapter(
158
180
  redisUrlOrInstance: string | object | undefined,
181
+ options?: RedisCacheAdapterOptions,
159
182
  ): HubRedisCacheAdapter;
160
183
 
161
184
  export type { LockOptions, LockStats, MongoSession, TransactionOptions, TransactionStats };
162
185
 
163
186
  export type DistributedCacheInvalidatorOptions = HubDistributedInvalidatorOptions;
187
+ export type DistributedCacheInvalidatorStats = HubInvalidatorStats;
164
188
 
165
189
  export declare class DistributedCacheInvalidator {
166
190
  constructor(options: DistributedCacheInvalidatorOptions);
@@ -311,6 +335,7 @@ export declare class ModelInstance<TDocument = any> implements ModelInstanceCont
311
335
  createIndex(keys: unknown, options?: unknown): Promise<IndexCreateResult>;
312
336
  createIndexes(specs: Array<{ key: unknown; } & Record<string, unknown>>): Promise<string[]>;
313
337
  listIndexes(): Promise<Record<string, unknown>[]>;
338
+ ensureIndexes(options?: ModelEnsureIndexesOptions): Promise<ModelIndexEnsureResult>;
314
339
  dropIndex(name: string): Promise<unknown>;
315
340
  dropIndexes(): Promise<unknown>;
316
341
  prewarmBookmarks(keyDims?: unknown, pages?: number[]): Promise<BookmarkPrewarmResult>;
@@ -46,8 +46,15 @@ export interface TransactionStats {
46
46
  totalTransactions: number;
47
47
  successfulTransactions: number;
48
48
  failedTransactions: number;
49
+ readOnlyTransactions: number;
50
+ writeTransactions: number;
49
51
  activeTransactions: number;
50
52
  averageDuration: number;
53
+ p95Duration: number;
54
+ p99Duration: number;
55
+ successRate: string;
56
+ readOnlyRatio: string;
57
+ sampleCount: number;
51
58
  }
52
59
 
53
60
  /**
@@ -80,6 +87,7 @@ export declare class Transaction {
80
87
  logger?: LoggerLike | null;
81
88
  lockManager?: CacheLockManager | null;
82
89
  timeout?: number;
90
+ transactionOptions?: Record<string, unknown>;
83
91
  });
84
92
  /** Begin the transaction (starts the MongoDB session transaction). */
85
93
  start(): Promise<void>;
@@ -118,6 +126,10 @@ export declare class TransactionManager {
118
126
  maxRetries?: number;
119
127
  retryDelay?: number;
120
128
  retryBackoff?: number;
129
+ defaultReadConcern?: TransactionOptions['readConcern'];
130
+ defaultWriteConcern?: TransactionOptions['writeConcern'];
131
+ defaultReadPreference?: TransactionOptions['readPreference'];
132
+ maxStatsSamples?: number;
121
133
  });
122
134
  /** Open a new transaction session. */
123
135
  startSession(options?: TransactionOptions): Promise<Transaction>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monsqlize",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "TypeScript-native MongoDB ODM with multi-level caching (cache-hub), distributed locks, Saga orchestration, unified expression system (122 operators), connection pool management, ChangeStream sync, slow-query logging, and full v1 API compatibility",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/cjs/index.cjs",
@@ -18,6 +18,8 @@
18
18
  "dist/**/*.cjs",
19
19
  "dist/**/*.mjs",
20
20
  "dist/**/*.d.ts",
21
+ "changelogs/v2.0.4.md",
22
+ "changelogs/v2.0.3.md",
21
23
  "changelogs/v2.0.2.md",
22
24
  "changelogs/v2.0.1.md",
23
25
  "changelogs/v2.0.0.md",
@@ -53,6 +55,13 @@
53
55
  "access": "public",
54
56
  "registry": "https://registry.npmjs.org/"
55
57
  },
58
+ "config": {
59
+ "mongodbMemoryServer": {
60
+ "downloadDir": ".cache/mongodb-memory-server/binaries",
61
+ "preferGlobalPath": "false",
62
+ "version": "7.0.14"
63
+ }
64
+ },
56
65
  "engines": {
57
66
  "node": ">=18.0.0"
58
67
  },
@@ -61,43 +70,33 @@
61
70
  "check:sizes:strict": "node scripts/check-file-sizes.cjs --strict",
62
71
  "build": "node scripts/build-p1.cjs",
63
72
  "build:tests": "node scripts/compile-tests.cjs",
64
- "lint": "eslint . --ignore-pattern .generated/** --ignore-pattern dist/**",
65
- "lint:fix": "eslint . --fix --ignore-pattern .generated/** --ignore-pattern dist/**",
73
+ "lint": "eslint . --ignore-pattern .generated/** --ignore-pattern dist/** --ignore-pattern .devcodex/**",
74
+ "lint:fix": "eslint . --fix --ignore-pattern .generated/** --ignore-pattern dist/** --ignore-pattern .devcodex/**",
66
75
  "test:runtime": "npm run build && npm run build:tests && node --test .generated/test-dist/test/smoke/root-cjs.test.js .generated/test-dist/test/smoke/root-esm.test.js .generated/test-dist/test/smoke/pack-artifacts.test.js",
67
76
  "test:compatibility": "npm run build && npm run build:tests && node --test .generated/test-dist/test/compatibility/exports/exports.test.js .generated/test-dist/test/compatibility/matrix.test.js",
68
77
  "probe:server-matrix": "node scripts/validation/probe-memory-server-matrix.cjs",
69
78
  "test:server-matrix": "node scripts/validation/run-memory-server-matrix.cjs",
70
79
  "test:real-env:private": "node scripts/validation/run-private-real-env-checks.cjs",
71
- "test:examples": "npm run build && tsc -p tsconfig.examples.json && node .generated/examples-dist/examples/quick-start/basic-connect.js && node .generated/examples-dist/examples/cache/with-cache.js && node .generated/examples-dist/examples/docs/insert.js && node .generated/examples-dist/examples/docs/insert-many.js && node .generated/examples-dist/examples/docs/update.js && node .generated/examples-dist/examples/docs/update-one.js && node .generated/examples-dist/examples/docs/delete.js && node .generated/examples-dist/examples/docs/delete-many.js && node .generated/examples-dist/examples/docs/upsert.js && node .generated/examples-dist/examples/docs/upsert-one.js && node .generated/examples-dist/examples/docs/find.js && node .generated/examples-dist/examples/docs/find-one.js && node .generated/examples-dist/examples/docs/find-one-by-id.js && node .generated/examples-dist/examples/docs/find-by-ids.js && node .generated/examples-dist/examples/docs/find-page.js && node .generated/examples-dist/examples/docs/find-and-count.js && node .generated/examples-dist/examples/docs/count.js && node .generated/examples-dist/examples/docs/distinct.js && node .generated/examples-dist/examples/docs/explain.js && node .generated/examples-dist/examples/docs/aggregate.js && node .generated/examples-dist/examples/docs/chaining-api.js && node .generated/examples-dist/examples/docs/expression-functions.js && node .generated/examples-dist/examples/docs/model.js && node .generated/examples-dist/examples/docs/collection-management.js && node .generated/examples-dist/examples/docs/bookmarks.js && node .generated/examples-dist/examples/docs/transaction.js && node .generated/examples-dist/examples/docs/transaction-rollback.js && node .generated/examples-dist/examples/docs/slow-query-log.js && node .generated/examples-dist/examples/docs/watch.js && node .generated/examples-dist/examples/docs/aggregate-advanced.js && node .generated/examples-dist/examples/docs/batch-operations.js && node .generated/examples-dist/examples/docs/soft-delete.js && node .generated/examples-dist/examples/docs/increment-one.js && node .generated/examples-dist/examples/docs/populate-relations.js && node .generated/examples-dist/examples/docs/saga.js && node .generated/examples-dist/examples/docs/lock.js && node .generated/examples-dist/examples/docs/lock-timeout.js && node .generated/examples-dist/examples/docs/cache-multilevel.js && node .generated/examples-dist/examples/docs/objectid.js && node .generated/examples-dist/examples/docs/pool.js && node .generated/examples-dist/examples/docs/pool-fallback.js && node .generated/examples-dist/examples/docs/sync.js && node .generated/examples-dist/examples/docs/sync-target-failure.js",
80
+ "test:examples": "npm run build && tsc -p tsconfig.examples.json && node scripts/run-examples.cjs",
72
81
  "test:performance": "npm run build && npm run build:tests && node .generated/test-dist/test/performance/baselines/function-cache.benchmark.js",
73
82
  "test:unit": "npm run build && npm run build:tests && node --test .generated/test-dist/test/unit/expression/expression.test.js .generated/test-dist/test/unit/expression/operators.test.js .generated/test-dist/test/unit/errors/errors.test.js .generated/test-dist/test/unit/management/management.test.js .generated/test-dist/test/unit/writes/batch.test.js .generated/test-dist/test/unit/cache/cache.test.js .generated/test-dist/test/unit/cache/cache-refactor-guard.test.js .generated/test-dist/test/unit/coverage/core-helpers.test.js .generated/test-dist/test/unit/function-cache/function-cache.test.js .generated/test-dist/test/unit/model/model-registry.test.js .generated/test-dist/test/unit/lock/lock.test.js .generated/test-dist/test/unit/transaction/transaction.test.js .generated/test-dist/test/unit/pool/pool.test.js .generated/test-dist/test/unit/runtime/runtime-compat.test.js .generated/test-dist/test/unit/sync/sync.test.js .generated/test-dist/test/unit/slow-query-log/slow-query-log.test.js .generated/test-dist/test/unit/slow-query-log/slow-query-log-behavior.test.js .generated/test-dist/test/unit/saga/saga.test.js .generated/test-dist/test/unit/count-queue/count-queue.test.js .generated/test-dist/test/unit/model/model-softdelete-versioning.test.js .generated/test-dist/test/unit/function-cache/function-cache-behavior.test.js .generated/test-dist/test/unit/saga/saga-behavior.test.js .generated/test-dist/test/unit/lock/lock-distributed.test.js .generated/test-dist/test/unit/coverage/capability-wiring.test.js .generated/test-dist/test/unit/pool/pool-stats.test.js .generated/test-dist/test/unit/coverage/pure-functions.test.js",
74
83
  "test:integration": "npm run build && npm run build:tests && node --test --test-concurrency=1 .generated/test-dist/test/integration/cache/cache.test.js .generated/test-dist/test/integration/cache/cache-behavior.test.js .generated/test-dist/test/integration/mongodb/connect.test.js .generated/test-dist/test/integration/mongodb/queries.test.js .generated/test-dist/test/integration/mongodb/management.test.js .generated/test-dist/test/integration/mongodb/writes-batch.test.js .generated/test-dist/test/integration/mongodb/find.test.js .generated/test-dist/test/integration/mongodb/find-one.test.js .generated/test-dist/test/integration/mongodb/find-page.test.js .generated/test-dist/test/integration/mongodb/aggregate.test.js .generated/test-dist/test/integration/mongodb/chaining.test.js .generated/test-dist/test/integration/mongodb/insert.test.js .generated/test-dist/test/integration/mongodb/update.test.js .generated/test-dist/test/integration/mongodb/delete.test.js .generated/test-dist/test/integration/mongodb/update-pipeline.test.js .generated/test-dist/test/integration/model/model-features.test.js .generated/test-dist/test/integration/transaction/transaction.test.js .generated/test-dist/test/integration/pool/pool.test.js .generated/test-dist/test/integration/pool/pool-behavior.test.js .generated/test-dist/test/integration/watch/watch-native.test.js .generated/test-dist/test/integration/runtime/runtime-core-regression.test.js .generated/test-dist/test/integration/sync/sync.test.js .generated/test-dist/test/integration/slow-query-log/slow-query-log.test.js .generated/test-dist/test/integration/model/model-crud-extended.test.js .generated/test-dist/test/integration/mongodb/management-complete.test.js .generated/test-dist/test/integration/runtime/runtime-methods-extended.test.js .generated/test-dist/test/integration/mongodb/find-page-advanced.test.js",
75
84
  "test:refactor-guard": "npm run build && npm run build:tests && node --test --test-concurrency=1 .generated/test-dist/test/compatibility/exports/exports.test.js .generated/test-dist/test/integration/model/model-features.test.js .generated/test-dist/test/integration/runtime/runtime-core-regression.test.js .generated/test-dist/test/integration/sync/sync.test.js",
76
85
  "test:refactor-guard:cache": "npm run build && npm run build:tests && node --test .generated/test-dist/test/unit/cache/cache-refactor-guard.test.js",
77
- "test:coverage": "npm run build && npm run build:tests && c8 --reporter=text --reporter=lcov --reporter=json-summary --check-coverage --lines 95 --statements 95 --functions 95 --branches 95 node test/run-tests.cjs",
86
+ "test:coverage": "npm run build && npm run build:tests && c8 --reporter=text --reporter=lcov --reporter=json-summary --include \".generated/test-dist/dist/cjs/**/*.cjs\" --check-coverage --lines 90 --statements 90 --functions 90 --branches 90 node test/run-tests.cjs",
87
+ "test:audit": "npm audit --omit=dev --registry=https://registry.npmjs.org/",
78
88
  "test": "npm run build && npm run build:tests && node test/run-tests.cjs",
79
89
  "type-check": "npm run build && tsc -p tsconfig.json --noEmit && tsd --files test/types/root-import.test-d.ts --files test/types/cache-usage.test-d.ts --files test/types/model-usage.test-d.ts --files test/types/pool-usage.test-d.ts --files test/types/sync-usage.test-d.ts --files test/types/slow-query-log-usage.test-d.ts --files test/types/saga-usage.test-d.ts",
80
90
  "check:test-language": "node scripts/check-test-language.cjs",
81
- "verify:fast": "npm run lint && npm run type-check && npm run check:sizes:strict && npm run test:runtime && npm run test:compatibility && npm run test:refactor-guard && npm run test:refactor-guard:cache",
82
- "verify:full": "npm run lint && npm run type-check && npm run check:sizes:strict && npm run test:coverage && npm run test:examples && npm run test:server-matrix",
91
+ "check:docs-examples": "node scripts/validation/check-doc-example-matrix.cjs",
92
+ "verify:fast": "npm run lint && npm run check:docs-examples && npm run type-check && npm run check:sizes:strict && npm run test:runtime && npm run test:compatibility && npm run test:refactor-guard && npm run test:refactor-guard:cache",
93
+ "verify:full": "npm run lint && npm run check:docs-examples && npm run type-check && npm run check:sizes:strict && npm run test:examples && npm run test:server-matrix",
83
94
  "verify:release": "npm run verify:full && npm run test:real-env:private",
84
95
  "verify": "npm run verify:full",
85
96
  "release:preflight": "node scripts/release-preflight.cjs",
86
97
  "prepublishOnly": "npm run release:preflight",
87
98
  "release:publish": "npm run release:preflight && npm publish --ignore-scripts",
88
- "postpublish": "echo ' 发布成功!请创建 GitHub Release: https://github.com/vextjs/monSQLize/releases/new?tag=v'$npm_package_version"
89
- },
90
- "peerDependenciesMeta": {
91
- "ioredis": {
92
- "optional": true
93
- },
94
- "ssh2": {
95
- "optional": true
96
- }
97
- },
98
- "optionalDependencies": {
99
- "ioredis": "5.8.2",
100
- "ssh2": "1.17.0"
99
+ "postpublish": "echo 'Publish succeeded. Create GitHub Release: https://github.com/vextjs/monSQLize/releases/new?tag=v'$npm_package_version"
101
100
  },
102
101
  "devDependencies": {
103
102
  "@eslint/js": "9.39.4",
@@ -114,8 +113,10 @@
114
113
  },
115
114
  "dependencies": {
116
115
  "async-lock": "1.4.1",
117
- "cache-hub": "1.0.0",
116
+ "cache-hub": "2.2.4",
117
+ "ioredis": "5.8.2",
118
118
  "mongodb": "6.21.0",
119
- "schema-dsl": "2.0.3"
119
+ "schema-dsl": "2.0.9",
120
+ "ssh2": "1.17.0"
120
121
  }
121
122
  }