@classytic/mongokit 3.39.0 → 3.40.1
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 +71 -0
- package/dist/{PaginationEngine-D-P19Y9m.d.mts → PaginationEngine-CRHyuUtw.d.mts} +17 -3
- package/dist/{PaginationEngine-DQ7beTCR.mjs → PaginationEngine-CfT2Cxkj.mjs} +320 -145
- package/dist/{Repository-D7fDpyFx.mjs → Repository-CYhSC9ut.mjs} +844 -794
- package/dist/{Repository-IxI983_m.d.mts → Repository-pnLw1rG5.d.mts} +113 -47
- package/dist/actions/index.d.mts +1 -1
- package/dist/actions/index.mjs +1 -1
- package/dist/adapter/index.mjs +1 -1
- package/dist/{adapter-BrVfPFSW.mjs → adapter-CkMoMF83.mjs} +1 -1
- package/dist/ai/index.d.mts +1 -1
- package/dist/better-auth/index.mjs +2 -2
- package/dist/{create-repository-CRXjDa3N.d.mts → create-repository-BUx9vfG9.d.mts} +5 -5
- package/dist/{create-repository-DOe9E_5F.mjs → create-repository-BYyWzLbt.mjs} +2 -2
- package/dist/idempotency/index.d.mts +23 -0
- package/dist/idempotency/index.mjs +134 -0
- package/dist/{index-CmjNyulu.d.mts → index-SYF8N28D.d.mts} +37 -19
- package/dist/index.d.mts +105 -39
- package/dist/index.mjs +332 -676
- package/dist/indexes/verify-indexes.d.mts +14 -1
- package/dist/indexes/verify-indexes.mjs +54 -7
- package/dist/join-scope-DSAznE8E.mjs +168 -0
- package/dist/{mongooseToJsonSchema-waUVQwK4.mjs → mongooseToJsonSchema-C3k4ide0.mjs} +5 -1
- package/dist/{multi-tenant.plugin-B-tzNeYL.d.mts → multi-tenant.plugin-a3UhQARj.d.mts} +19 -3
- package/dist/{operations-CrRIoc8Z.d.mts → operations-XiFgG5US.d.mts} +36 -13
- package/dist/outbox/index.d.mts +1 -1
- package/dist/outbox/index.mjs +6 -4
- package/dist/pagination/PaginationEngine.d.mts +2 -2
- package/dist/pagination/PaginationEngine.mjs +1 -1
- package/dist/pagination/utils/limits.d.mts +1 -1
- package/dist/{pagination-BpIv2bdS.d.mts → pagination-D6psses0.d.mts} +116 -13
- package/dist/{plugin-options-BuvtOSZf.d.mts → plugin-options-CRhIvSzx.d.mts} +16 -2
- package/dist/plugins/index.d.mts +8 -3
- package/dist/plugins/index.mjs +98 -25
- package/dist/query-defaults-BxUcSOoF.mjs +208 -0
- package/dist/read-model/index.d.mts +66 -0
- package/dist/read-model/index.mjs +193 -0
- package/dist/{repository-ZbLtL7Nk.d.mts → repository-DNHfjAZX.d.mts} +36 -4
- package/dist/sync/index.d.mts +53 -0
- package/dist/sync/index.mjs +371 -0
- package/dist/tenant/index.mjs +2 -0
- package/dist/testkit/index.d.mts +40 -3
- package/dist/testkit/index.mjs +113 -2
- package/dist/{timestamp.plugin-B5eiaItQ.mjs → timestamp.plugin-zfdLYZiO.mjs} +135 -32
- package/dist/{to-plain-B8ufk3Qz.d.mts → to-plain-CjgEInWV.d.mts} +2 -2
- package/dist/transaction-BrRYtH_b.mjs +655 -0
- package/dist/{update-c_01A0if.mjs → update-WgeAUJ_I.mjs} +212 -33
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.mjs +1 -1
- package/dist/{validation-chain.plugin-Bju1D1Sn.mjs → validation-chain.plugin-CHUHWMtk.mjs} +204 -279
- package/dist/{validation-chain.plugin-DvrLJIbJ.d.mts → validation-chain.plugin-CTcNJCmV.d.mts} +27 -5
- package/package.json +18 -4
package/dist/{validation-chain.plugin-DvrLJIbJ.d.mts → validation-chain.plugin-CTcNJCmV.d.mts}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { h as RepositoryInstance, l as Plugin, p as RepositoryContext } from "./repository-
|
|
3
|
-
import { c as ValidationChainOptions, i as Logger, l as ValidatorDefinition, o as SoftDeleteOptions, r as FieldPreset, t as CascadeOptions } from "./plugin-options-
|
|
1
|
+
import { A as ObjectId, F as SortSpec, N as SelectSpec, j as PopulateSpec } from "./pagination-D6psses0.mjs";
|
|
2
|
+
import { h as RepositoryInstance, l as Plugin, p as RepositoryContext } from "./repository-DNHfjAZX.mjs";
|
|
3
|
+
import { c as ValidationChainOptions, i as Logger, l as ValidatorDefinition, o as SoftDeleteOptions, r as FieldPreset, t as CascadeOptions } from "./plugin-options-CRhIvSzx.mjs";
|
|
4
4
|
import { BulkWriteResult } from "@classytic/repo-core/repository";
|
|
5
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
5
|
import { OffsetPaginationResult } from "@classytic/repo-core/pagination";
|
|
6
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
7
|
//#region src/plugins/aggregate-helpers.plugin.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* Aggregate helpers plugin
|
|
@@ -113,6 +113,19 @@ declare function appendOnlyPlugin(options?: AppendOnlyPluginOptions): Plugin;
|
|
|
113
113
|
declare function auditLogPlugin(logger: Logger): Plugin;
|
|
114
114
|
//#endregion
|
|
115
115
|
//#region src/plugins/batch-operations.plugin.d.ts
|
|
116
|
+
/** Options accepted by `repo.bulkWrite`. Plugin context may ride alongside. */
|
|
117
|
+
interface BulkWriteOptions {
|
|
118
|
+
/** Stop at the first failure. Default `true`, matching the driver. */
|
|
119
|
+
ordered?: boolean;
|
|
120
|
+
session?: unknown;
|
|
121
|
+
writeConcern?: Record<string, unknown>;
|
|
122
|
+
bypassDocumentValidation?: boolean;
|
|
123
|
+
comment?: unknown;
|
|
124
|
+
let?: Record<string, unknown>;
|
|
125
|
+
ignoreUndefined?: boolean;
|
|
126
|
+
/** Plugin context (tenant id, actor, ...) - spread into the op context. */
|
|
127
|
+
[key: string]: unknown;
|
|
128
|
+
}
|
|
116
129
|
declare function batchOperationsPlugin(): Plugin;
|
|
117
130
|
interface BatchOperationsMethods {
|
|
118
131
|
/**
|
|
@@ -303,6 +316,12 @@ interface IdempotencyStoreMethods<TProgress = Record<string, unknown>, TResult =
|
|
|
303
316
|
error?: string;
|
|
304
317
|
}): Promise<boolean>;
|
|
305
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* @deprecated Use `runIdempotent` from `@classytic/repo-core/idempotency` over
|
|
321
|
+
* `createIdempotencyStore` from `@classytic/mongokit/idempotency` — one claim contract for every
|
|
322
|
+
* layer (body fingerprint, transaction participation, recovery points, `maxAttempts`, ambiguous
|
|
323
|
+
* failures, lapsed-claim sweeps). Removed in mongokit 4.
|
|
324
|
+
*/
|
|
306
325
|
declare function idempotencyStorePlugin(options?: IdempotencyStorePluginOptions): Plugin;
|
|
307
326
|
//#endregion
|
|
308
327
|
//#region src/plugins/immutable-states.plugin.d.ts
|
|
@@ -770,6 +789,9 @@ interface SoftDeleteMethods<TDoc> {
|
|
|
770
789
|
*/
|
|
771
790
|
restore(id: string | ObjectId, options?: {
|
|
772
791
|
session?: unknown;
|
|
792
|
+
organizationId?: unknown;
|
|
793
|
+
bypassTenant?: boolean;
|
|
794
|
+
[key: string]: unknown;
|
|
773
795
|
}): Promise<TDoc>;
|
|
774
796
|
/**
|
|
775
797
|
* Get paginated list of soft-deleted documents
|
|
@@ -942,4 +964,4 @@ declare function immutableField(field: string): ValidatorDefinition;
|
|
|
942
964
|
*/
|
|
943
965
|
declare function uniqueField(field: string, errorMessage?: string): ValidatorDefinition;
|
|
944
966
|
//#endregion
|
|
945
|
-
export { IdempotencyStoreMethods as A,
|
|
967
|
+
export { IdempotencyStoreMethods as A, batchOperationsPlugin as B, LeaseMethods as C, ImmutableStatesPluginOptions as D, ImmutableClaimView as E, elasticSearchPlugin as F, aggregateHelpersPlugin as G, AppendOnlyPluginOptions as H, cascadePlugin as I, BatchOperationsMethods as L, idempotencyStorePlugin as M, fieldFilterPlugin as N, immutableStatesPlugin as O, ElasticSearchOptions as P, BulkWriteOptions as R, methodRegistryPlugin as S, leasePlugin as T, appendOnlyPlugin as U, auditLogPlugin as V, AggregateHelpersMethods as W, OperationMetric as _, requireField as a, mongoOperationsPlugin as b, timestampPlugin as c, createTenantContext as d, SubdocumentMethods as f, ObservabilityOptions as g, softDeletePlugin as h, immutableField as i, IdempotencyStorePluginOptions as j, IdempotencyClaim as k, TenantContext as l, SoftDeleteMethods as m, autoInject as n, uniqueField as o, subdocumentPlugin as p, blockIf as r, validationChainPlugin as s, OperationType as t, TenantStore as u, observabilityPlugin as v, LeasePluginOptions as w, MethodRegistryRepository as x, MongoOperationsMethods as y, BulkWriteResult as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classytic/mongokit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.40.1",
|
|
4
4
|
"description": "Production-grade MongoDB repositories - smart pagination, events, and plugins. Built on @classytic/repo-core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -48,6 +48,14 @@
|
|
|
48
48
|
"types": "./dist/outbox/index.d.mts",
|
|
49
49
|
"default": "./dist/outbox/index.mjs"
|
|
50
50
|
},
|
|
51
|
+
"./idempotency": {
|
|
52
|
+
"types": "./dist/idempotency/index.d.mts",
|
|
53
|
+
"default": "./dist/idempotency/index.mjs"
|
|
54
|
+
},
|
|
55
|
+
"./sync": {
|
|
56
|
+
"types": "./dist/sync/index.d.mts",
|
|
57
|
+
"default": "./dist/sync/index.mjs"
|
|
58
|
+
},
|
|
51
59
|
"./lock": {
|
|
52
60
|
"types": "./dist/lock/index.d.mts",
|
|
53
61
|
"default": "./dist/lock/index.mjs"
|
|
@@ -80,6 +88,10 @@
|
|
|
80
88
|
"types": "./dist/testkit/index.d.mts",
|
|
81
89
|
"default": "./dist/testkit/index.mjs"
|
|
82
90
|
},
|
|
91
|
+
"./read-model": {
|
|
92
|
+
"types": "./dist/read-model/index.d.mts",
|
|
93
|
+
"default": "./dist/read-model/index.mjs"
|
|
94
|
+
},
|
|
83
95
|
"./kernel-conformance": {
|
|
84
96
|
"types": "./dist/kernel-conformance/index.d.mts",
|
|
85
97
|
"default": "./dist/kernel-conformance/index.mjs"
|
|
@@ -134,7 +146,7 @@
|
|
|
134
146
|
},
|
|
135
147
|
"homepage": "https://github.com/classytic/mongokit#readme",
|
|
136
148
|
"peerDependencies": {
|
|
137
|
-
"@classytic/repo-core": ">=0.
|
|
149
|
+
"@classytic/repo-core": ">=0.31.0",
|
|
138
150
|
"mongodb-memory-server": ">=10.4.3",
|
|
139
151
|
"mongoose": ">=9.4.1"
|
|
140
152
|
},
|
|
@@ -168,7 +180,8 @@
|
|
|
168
180
|
"format": "biome format src/ --write",
|
|
169
181
|
"check": "biome ci src/ --diagnostic-level=error",
|
|
170
182
|
"check:dead-code": "knip",
|
|
171
|
-
"
|
|
183
|
+
"check:peer-skew": "node scripts/check-peer-skew.mjs",
|
|
184
|
+
"ci": "npm run check:peer-skew && npm run check && npm run typecheck && npm run typecheck:tests && npm run build && npm run lint:package && npm run check:dead-code && npm run check:forgotten-exports && npm test",
|
|
172
185
|
"push": "classytic-push",
|
|
173
186
|
"prepublishOnly": "npm run ci",
|
|
174
187
|
"publish:dry": "npm publish --dry-run --access public",
|
|
@@ -186,13 +199,14 @@
|
|
|
186
199
|
"@better-auth/mongo-adapter": "^1.6.29",
|
|
187
200
|
"@biomejs/biome": "^2.5.8",
|
|
188
201
|
"@classytic/dev-tools": "^0.2.0",
|
|
189
|
-
"@classytic/repo-core": "^0.
|
|
202
|
+
"@classytic/repo-core": "^0.31.0",
|
|
190
203
|
"@types/node": "^26.2.0",
|
|
191
204
|
"@vitest/coverage-v8": "^4.1.10",
|
|
192
205
|
"ajv": "^8.20.0",
|
|
193
206
|
"ajv-formats": "^3.0.1",
|
|
194
207
|
"better-auth": "^1.6.29",
|
|
195
208
|
"dotenv": "^17.4.2",
|
|
209
|
+
"fast-check": "^4.7.0",
|
|
196
210
|
"knip": "^6.32.2",
|
|
197
211
|
"mongodb": "^7.5.0",
|
|
198
212
|
"mongodb-memory-server": "^11.2.0",
|