@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.
- package/README.md +12 -3
- package/dist/{PaginationEngine-CPmZv7Ds.mjs → PaginationEngine-B93fLCcO.mjs} +3 -3
- package/dist/actions/index.d.mts +1 -1
- package/dist/actions/index.mjs +1 -1
- package/dist/ai/index.d.mts +1 -1
- package/dist/{error-Lw9GEAro.mjs → error-CzYwrfUP.mjs} +25 -3
- package/dist/{index-C-qZUqv8.d.mts → index-C7WmYP6F.d.mts} +14 -6
- package/dist/index.d.mts +263 -77
- package/dist/index.mjs +6 -6
- package/dist/{mongooseToJsonSchema-DUwXPStK.mjs → mongooseToJsonSchema-D1sdCOmj.mjs} +21 -103
- package/dist/{mongooseToJsonSchema-Du-UopRK.d.mts → mongooseToJsonSchema-t-MoVleF.d.mts} +20 -19
- package/dist/pagination/PaginationEngine.d.mts +1 -1
- package/dist/pagination/PaginationEngine.mjs +1 -1
- package/dist/plugins/index.d.mts +1 -1
- package/dist/plugins/index.mjs +1 -1
- package/dist/{types-BgdeBXI1.d.mts → types-BUS0Zj8y.d.mts} +70 -133
- package/dist/{update-BDsQ3cdy.mjs → update-CWXfFC6O.mjs} +52 -13
- package/dist/utils/index.d.mts +3 -3
- package/dist/utils/index.mjs +3 -3
- package/dist/{validation-chain.plugin-CEyJssZl.mjs → validation-chain.plugin-Ccu6irtx.mjs} +1081 -381
- package/dist/{validation-chain.plugin-Be9rG04B.d.mts → validation-chain.plugin-JkipjuOR.d.mts} +4 -36
- package/package.json +5 -3
- /package/dist/{cursor-DZ9JSoMM.mjs → cursor-J84rR6wG.mjs} +0 -0
- /package/dist/{sort-ffe-9JBg.mjs → sort-CrZjTK25.mjs} +0 -0
package/dist/{validation-chain.plugin-Be9rG04B.d.mts → validation-chain.plugin-JkipjuOR.d.mts}
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
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.
|
|
4
|
-
"description": "Production-grade MongoDB repositories
|
|
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
|
|
File without changes
|