@classytic/mongokit 3.7.0 → 3.10.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.
@@ -1,5 +1,6 @@
1
- import { I as Logger, J as Plugin, St as ValidatorDefinition, T as FieldPreset, U as OffsetPaginationResult, V as ObjectId, Z as PopulateSpec, bt as ValidationChainOptions, et as RepositoryContext, f as CascadeOptions, l as CacheOptions, nt as RepositoryInstance, pt as SortSpec, st as SelectSpec, u as CacheStats, ut as SoftDeleteOptions } from "./types-BgdeBXI1.mjs";
1
+ import { $ as RepositoryContext, K as Plugin, P as Logger, V as OffsetPaginationResult, Y as PopulateSpec, at as SelectSpec, ct as SoftDeleteOptions, dt as SortSpec, f as CascadeOptions, l as CacheOptions, tt as RepositoryInstance, u as CacheStats, vt as ValidationChainOptions, w as FieldPreset, yt as ValidatorDefinition, z as ObjectId } from "./types-BUS0Zj8y.mjs";
2
2
  import mongoose, { ClientSession } from "mongoose";
3
+ import { BulkWriteResult } from "@classytic/repo-core/repository";
3
4
  import { AsyncLocalStorage } from "node:async_hooks";
4
5
 
5
6
  //#region src/plugins/aggregate-helpers.plugin.d.ts
@@ -119,7 +120,7 @@ interface AuditTrailOptions {
119
120
  */
120
121
  excludeFields?: string[];
121
122
  }
122
- type AuditOperation = 'create' | 'update' | 'delete';
123
+ type AuditOperation = 'create' | 'update' | 'delete' | 'findOneAndUpdate';
123
124
  interface AuditEntry {
124
125
  model: string;
125
126
  operation: AuditOperation;
@@ -256,39 +257,6 @@ interface AuditTrailMethods {
256
257
  * await repo.deleteMany({ status: 'deleted' });
257
258
  */
258
259
  declare function batchOperationsPlugin(): Plugin;
259
- /**
260
- * Type interface for repositories using batchOperationsPlugin
261
- *
262
- * @example
263
- * ```typescript
264
- * import { Repository, methodRegistryPlugin, batchOperationsPlugin } from '@classytic/mongokit';
265
- * import type { BatchOperationsMethods } from '@classytic/mongokit';
266
- *
267
- * class ProductRepo extends Repository<IProduct> {}
268
- *
269
- * type ProductRepoWithBatch = ProductRepo & BatchOperationsMethods;
270
- *
271
- * const repo = new ProductRepo(ProductModel, [
272
- * methodRegistryPlugin(),
273
- * batchOperationsPlugin(),
274
- * ]) as ProductRepoWithBatch;
275
- *
276
- * // TypeScript autocomplete works!
277
- * await repo.updateMany({ status: 'pending' }, { status: 'active' });
278
- * await repo.deleteMany({ status: 'archived' });
279
- * ```
280
- */
281
- /** Bulk write result */
282
- interface BulkWriteResult {
283
- ok: number;
284
- insertedCount: number;
285
- upsertedCount: number;
286
- matchedCount: number;
287
- modifiedCount: number;
288
- deletedCount: number;
289
- insertedIds: Record<number, unknown>;
290
- upsertedIds: Record<number, unknown>;
291
- }
292
260
  interface BatchOperationsMethods {
293
261
  /**
294
262
  * Update multiple documents matching the query
@@ -1095,7 +1063,7 @@ declare function createTenantContext(): TenantContext;
1095
1063
  declare function timestampPlugin(): Plugin;
1096
1064
  //#endregion
1097
1065
  //#region src/plugins/validation-chain.plugin.d.ts
1098
- type OperationType = 'create' | 'createMany' | 'update' | 'delete';
1066
+ type OperationType = 'create' | 'createMany' | 'update' | 'findOneAndUpdate' | 'delete';
1099
1067
  /**
1100
1068
  * Validation chain plugin
1101
1069
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@classytic/mongokit",
3
- "version": "3.7.0",
4
- "description": "Production-grade MongoDB repositories with zero dependencies - smart pagination, events, and plugins",
3
+ "version": "3.10.0",
4
+ "description": "Production-grade MongoDB repositories - smart pagination, events, and plugins. Built on @classytic/repo-core.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/index.mjs",
@@ -93,7 +93,8 @@
93
93
  },
94
94
  "homepage": "https://github.com/classytic/mongokit#readme",
95
95
  "peerDependencies": {
96
- "mongoose": ">=9.4.1"
96
+ "mongoose": ">=9.4.1",
97
+ "@classytic/repo-core": ">=0.1.0"
97
98
  },
98
99
  "engines": {
99
100
  "node": ">=22"
@@ -124,6 +125,7 @@
124
125
  "devDependencies": {
125
126
  "@arethetypeswrong/cli": "^0.18.2",
126
127
  "@biomejs/biome": "^2.4.10",
128
+ "@classytic/repo-core": ">=0.1.0",
127
129
  "@types/node": "^22.0.0",
128
130
  "@vitest/coverage-v8": "^3.2.4",
129
131
  "ajv": "^8.18.0",
File without changes