@classytic/mongokit 3.19.0 → 3.20.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.
Files changed (48) hide show
  1. package/dist/{PaginationEngine-BcvaXBQ-.mjs → PaginationEngine-BT1ywu9k.mjs} +327 -6
  2. package/dist/{PaginationEngine-4SjzfBQE.d.mts → PaginationEngine-DYpOD2wY.d.mts} +1 -2
  3. package/dist/{Repository-B01VW_fU.mjs → Repository-dbbgOGjK.mjs} +85 -11
  4. package/dist/actions/index.d.mts +1 -1
  5. package/dist/actions/index.mjs +2 -2
  6. package/dist/adapter/index.d.mts +10 -2
  7. package/dist/adapter/index.mjs +1 -1
  8. package/dist/{adapter-BSxhT0Ip.mjs → adapter-CW1EL0fF.mjs} +10 -1
  9. package/dist/ai/index.d.mts +1 -2
  10. package/dist/ai/index.mjs +3 -2
  11. package/dist/better-auth/index.d.mts +0 -1
  12. package/dist/better-auth/index.mjs +2 -2
  13. package/dist/{create-repository-K0yft2ht.d.mts → create-repository-0TkQhcv-.d.mts} +107 -13
  14. package/dist/{create-repository-D5YX0wGs.mjs → create-repository-CJATiAKX.mjs} +2 -2
  15. package/dist/{id-resolution-CnN0YA8t.mjs → id-resolution-P2OzcyRl.mjs} +10 -5
  16. package/dist/{index-BgSBwlWu.d.mts → index-Cg3SWugF.d.mts} +1 -3
  17. package/dist/index.d.mts +9 -10
  18. package/dist/index.mjs +51 -13
  19. package/dist/lock/index.d.mts +0 -1
  20. package/dist/{mongooseToJsonSchema-Bz47aMfH.d.mts → mongooseToJsonSchema-D2CyAMIC.d.mts} +9 -5
  21. package/dist/{mongooseToJsonSchema-ChtXSrLT.mjs → mongooseToJsonSchema-khdzVo8x.mjs} +1 -1
  22. package/dist/{multi-tenant.plugin-D6lw3BsI.d.mts → multi-tenant.plugin-CTsWz0XK.d.mts} +1 -2
  23. package/dist/pagination/PaginationEngine.d.mts +1 -1
  24. package/dist/pagination/PaginationEngine.mjs +1 -1
  25. package/dist/plugins/index.d.mts +3 -4
  26. package/dist/plugins/index.mjs +2 -2
  27. package/dist/query/primitives/coercion.d.mts +1 -1
  28. package/dist/query/primitives/coercion.mjs +1 -1
  29. package/dist/query/primitives/geo.d.mts +1 -1
  30. package/dist/query/primitives/indexes.d.mts +1 -1
  31. package/dist/testkit/index.d.mts +1 -2
  32. package/dist/testkit/index.mjs +1 -1
  33. package/dist/{timestamp.plugin-B1A9U-P7.mjs → timestamp.plugin-nG9Z1JEk.mjs} +4 -4
  34. package/dist/{types-BA8oXjFe.d.mts → types-DNFMofHy.d.mts} +51 -22
  35. package/dist/{update-CvCMv5Cl.mjs → update-1Lq9OMD2.mjs} +5 -5
  36. package/dist/utils/index.d.mts +1 -1
  37. package/dist/utils/index.mjs +5 -5
  38. package/dist/{validation-chain.plugin-DHZbpb4t.mjs → validation-chain.plugin-Dn_wZYLA.mjs} +6 -6
  39. package/dist/{validation-chain.plugin-CYOPfFGF.d.mts → validation-chain.plugin-buy3uvyk.d.mts} +1 -2
  40. package/package.json +8 -7
  41. package/dist/cursor-_SbWVAn-.mjs +0 -254
  42. package/dist/sort-Ca1BPfvE.mjs +0 -72
  43. /package/dist/{coercion-BxxHyLjP.d.mts → coercion-BjdPX3YF.d.mts} +0 -0
  44. /package/dist/{error-BTeepSNL.mjs → error-BuByZwKU.mjs} +0 -0
  45. /package/dist/{field-selection-d1qdRiMr.mjs → field-selection-FSQFLpsU.mjs} +0 -0
  46. /package/dist/{indexes-3eHBWNZ2.d.mts → indexes-DIjMpYES.d.mts} +0 -0
  47. /package/dist/{logger-B8wf-Mtb.mjs → logger-K7dPmu2U.mjs} +0 -0
  48. /package/dist/{chunk-CfYAbeIz.mjs → rolldown-runtime-D7D4PA-g.mjs} +0 -0
@@ -1,13 +1,12 @@
1
- import { B as ObjectId, Dt as LookupOptions, Et as LookupBuilder, H as OperationOptions, J as PopulateSpec, M as LookupPopulateOptions, N as LookupPopulateResult, P as Middleware, Q as RepositoryContext, U as PaginationConfig, X as ReadOptions, Y as PrioritizedHook, Z as ReadPreferenceType, _ as DeleteManyResult, at as SessionOptions, c as CacheableOptions, d as CollationOptions, ft as UpdateManyResult, it as SelectSpec, j as Logger, n as AggregatePaginationOptions, nt as RepositoryOptions, p as CreateOptions, pt as UpdateOptions, q as PluginType, st as SoftDeleteOptions, t as AggregateOptions, ut as SortSpec$1, v as DeleteResult, w as FindOneAndUpdateOptions, xt as WithTransactionOptions } from "./types-BA8oXjFe.mjs";
2
- import { _ as RepositoryCachePluginOptions, i as CustomIdOptions, t as MultiTenantOptions, w as AuditTrailOptions } from "./multi-tenant.plugin-D6lw3BsI.mjs";
3
- import { t as PaginationEngine } from "./PaginationEngine-4SjzfBQE.mjs";
4
- import { AggPaginationRequest, AggRequest, AggResult, ChangeEvent, FilterInput, KeysetAggPaginationResult, QueryOptions, RepoCapabilities, RepositoryBase, TenantPurgeOptions, TenantPurgeResult, TenantPurgeStrategy, WatchOptions } from "@classytic/repo-core/repository";
5
- import * as _$mongoose from "mongoose";
6
- import { Expression, Model, PipelineStage, PopulateOptions } from "mongoose";
1
+ import { B as ObjectId, Dt as LookupOptions, Et as LookupBuilder, H as OperationOptions, J as PopulateSpec, M as LookupPopulateOptions, N as LookupPopulateResult, P as Middleware, Q as RepositoryContext, U as PaginationConfig, X as ReadOptions, Y as PrioritizedHook, Z as ReadPreferenceType, _ as DeleteManyResult, at as SessionOptions, c as CacheableOptions, d as CollationOptions, ft as UpdateManyResult, it as SelectSpec, j as Logger, n as AggregatePaginationOptions, nt as RepositoryOptions, p as CreateOptions, pt as UpdateOptions, q as PluginType, st as SoftDeleteOptions, t as AggregateOptions, ut as SortSpec$1, v as DeleteResult, w as FindOneAndUpdateOptions, xt as WithTransactionOptions } from "./types-DNFMofHy.mjs";
2
+ import { _ as RepositoryCachePluginOptions, i as CustomIdOptions, t as MultiTenantOptions, w as AuditTrailOptions } from "./multi-tenant.plugin-CTsWz0XK.mjs";
3
+ import { t as PaginationEngine } from "./PaginationEngine-DYpOD2wY.mjs";
4
+ import { AggPaginationRequest, AggRequest, AggResult, ArchiveOptions, ArchiveResult, ArchiveSink, ChangeEvent, FilterInput, KeysetAggPaginationResult, QueryOptions, RepoCapabilities, RepositoryBase, TenantPurgeOptions, TenantPurgeResult, TenantPurgeStrategy, WatchOptions } from "@classytic/repo-core/repository";
5
+ import { ClientSession, Expression, Model, PipelineStage, PopulateOptions } from "mongoose";
6
+ import { Filter } from "@classytic/repo-core/filter";
7
7
  import { UpdateInput } from "@classytic/repo-core/update";
8
8
  import { AggregatePaginationResult, KeysetPaginationResult, OffsetPaginationResult, OffsetPaginationResultCore } from "@classytic/repo-core/pagination";
9
9
  import { HttpError } from "@classytic/repo-core/errors";
10
-
11
10
  //#region src/query/AggregationBuilder.d.ts
12
11
  /** Options for $vectorSearch stage (Atlas only) */
13
12
  interface VectorSearchOptions {
@@ -68,7 +67,7 @@ declare class AggregationBuilder {
68
67
  * .exec(MyModel);
69
68
  * ```
70
69
  */
71
- exec<T = unknown>(model: Model<any>, session?: _$mongoose.ClientSession): Promise<T[]>;
70
+ exec<T = unknown>(model: Model<any>, session?: import('mongoose').ClientSession): Promise<T[]>;
72
71
  /**
73
72
  * Reset the pipeline
74
73
  */
@@ -428,6 +427,52 @@ declare class AggregationBuilder {
428
427
  */
429
428
  static startWith(query: Record<string, unknown>): AggregationBuilder;
430
429
  }
430
+ /**
431
+ * Optimized Aggregation Patterns for Scale
432
+ *
433
+ * 1. **Early Filtering** - Always place $match as early as possible:
434
+ * ```typescript
435
+ * new AggregationBuilder()
436
+ * .match({ status: 'active' }) // ✅ Filter first
437
+ * .lookup(...) // Then join
438
+ * .sort(...)
439
+ * ```
440
+ *
441
+ * 2. **Index Usage** - Ensure indexes on:
442
+ * - Fields in $match
443
+ * - Fields in $sort (especially with $limit)
444
+ * - Fields in $lookup (both local and foreign)
445
+ *
446
+ * 3. **Projection** - Remove unnecessary fields early:
447
+ * ```typescript
448
+ * .project({ password: 0, internalNotes: 0 }) // Remove before joins
449
+ * .lookup(...)
450
+ * ```
451
+ *
452
+ * 4. **Faceted Pagination** - Get count and data in one query:
453
+ * ```typescript
454
+ * .facet({
455
+ * metadata: [{ $count: 'total' }],
456
+ * data: [{ $skip: skip }, { $limit: limit }]
457
+ * })
458
+ * ```
459
+ *
460
+ * 5. **allowDiskUse** - For large datasets:
461
+ * ```typescript
462
+ * new AggregationBuilder()
463
+ * .match({ status: 'active' })
464
+ * .allowDiskUse()
465
+ * .exec(Model)
466
+ * ```
467
+ *
468
+ * 6. **Vector Search** - Semantic similarity (Atlas only):
469
+ * ```typescript
470
+ * new AggregationBuilder()
471
+ * .vectorSearch({ index: 'vec_idx', path: 'embedding', queryVector: vec, limit: 10 })
472
+ * .withVectorScore()
473
+ * .exec(Model)
474
+ * ```
475
+ */
431
476
  //#endregion
432
477
  //#region src/Repository.d.ts
433
478
  /**
@@ -649,6 +694,36 @@ declare class Repository<TDoc = unknown> extends RepositoryBase {
649
694
  * Get document by ID
650
695
  */
651
696
  getById(id: string | ObjectId, options?: CacheableOptions): Promise<TDoc | null>;
697
+ /**
698
+ * Batch point-read — the `$in` counterpart to {@link getById}. Fetches every
699
+ * doc whose id (the repo's `idField`, default `_id`) is in `ids` in ONE query,
700
+ * routed through `findAll` so tenant + soft-delete scoping and hooks apply
701
+ * exactly as a single read would. Returns a Map keyed by the stringified id;
702
+ * ids are de-duplicated and ids with no matching doc are simply absent (no
703
+ * throw — mirrors `getById(..., { throwOnNotFound: false })`). Structurally
704
+ * INVALID ids (wrong ObjectId shape, non-numeric for a Number id field, ...)
705
+ * are dropped the same way — an id that cannot exist in the collection is
706
+ * unambiguously a miss, and one malformed id must never poison the rest of
707
+ * the batch. Lean by default (findAll semantics) — pass `{ lean: false }`
708
+ * for hydrated docs.
709
+ *
710
+ * The N+1 killer for hosts that resolve many ids in one tick (order-line
711
+ * snapshotting, availability matrices, dashboard row enrichment):
712
+ *
713
+ * @example
714
+ * const byId = await repo.getByIds(offerIds, ctx);
715
+ * const doc = byId.get(offerId); // O(1); undefined if not found
716
+ *
717
+ * Sizing: there is no library-imposed cap — the bounds are MongoDB's (the
718
+ * `$in` array must fit the 16 MB query document; `$in` on an indexed field
719
+ * is n point-lookups). Keep batches ≤ ~10k ids per call and chunk beyond
720
+ * that. Don't exclude the id field via `select` — result keys derive from
721
+ * it.
722
+ */
723
+ getByIds(ids: ReadonlyArray<string | ObjectId>, options?: OperationOptions & {
724
+ sort?: SortSpec$1 | string;
725
+ limit?: number;
726
+ }): Promise<Map<string, TDoc>>;
652
727
  /**
653
728
  * Get single document by query
654
729
  */
@@ -793,10 +868,14 @@ declare class Repository<TDoc = unknown> extends RepositoryBase {
793
868
  hint?: string | Record<string, 1 | -1>;
794
869
  maxTimeMS?: number;
795
870
  countStrategy?: 'exact' | 'estimated' | 'none';
796
- readPreference?: ReadPreferenceType; /** Advanced populate options (from QueryParser or Arc's BaseController) */
797
- populateOptions?: PopulateOptions[]; /** Collation for locale-aware string comparison */
798
- collation?: CollationOptions; /** Lookup configurations for $lookup joins (from QueryParser or manual) */
799
- lookups?: LookupOptions[]; /** Skip pagination entirely — returns raw TDoc[] (same as findAll) */
871
+ readPreference?: ReadPreferenceType;
872
+ /** Advanced populate options (from QueryParser or Arc's BaseController) */
873
+ populateOptions?: PopulateOptions[];
874
+ /** Collation for locale-aware string comparison */
875
+ collation?: CollationOptions;
876
+ /** Lookup configurations for $lookup joins (from QueryParser or manual) */
877
+ lookups?: LookupOptions[];
878
+ /** Skip pagination entirely — returns raw TDoc[] (same as findAll) */
800
879
  noPagination?: boolean;
801
880
  }, options?: CacheableOptions): Promise<OffsetPaginationResult<TDoc> | KeysetPaginationResult<TDoc> | TDoc[]>;
802
881
  /**
@@ -1233,7 +1312,8 @@ declare class Repository<TDoc = unknown> extends RepositoryBase {
1233
1312
  */
1234
1313
  delete(id: string | ObjectId, options?: SessionOptions & {
1235
1314
  idField?: string;
1236
- mode?: 'hard' | 'soft'; /** Legacy opt-in: throw a 404 error on miss instead of returning `null`. */
1315
+ mode?: 'hard' | 'soft';
1316
+ /** Legacy opt-in: throw a 404 error on miss instead of returning `null`. */
1237
1317
  throwOnNotFound?: boolean;
1238
1318
  }): Promise<DeleteResult | null>;
1239
1319
  /**
@@ -1287,6 +1367,20 @@ declare class Repository<TDoc = unknown> extends RepositoryBase {
1287
1367
  * the port implementation.
1288
1368
  */
1289
1369
  purgeByField(field: string, value: unknown, strategy: TenantPurgeStrategy, options?: TenantPurgeOptions): Promise<TenantPurgeResult>;
1370
+ /**
1371
+ * Chunked cold-storage extraction — see `StandardRepo.archiveByFilter`
1372
+ * for the cross-kit contract (write-before-delete, at-least-once,
1373
+ * duplicate-tolerant sinks). Mongokit composes the kit-agnostic
1374
+ * `runChunkedArchive` orchestrator with `createMongoArchivePort`
1375
+ * (`_id`-ordered lean reads + plugin-routed deleteMany removal). See
1376
+ * [actions/archive.ts](./actions/archive.ts) for the port.
1377
+ *
1378
+ * Accepts Filter IR or a Mongo-shaped filter record — compiled once via
1379
+ * `compileFilterToMongo`, same dual-dialect rule as every other verb.
1380
+ */
1381
+ archiveByFilter(filter: Record<string, unknown> | Filter, sink: ArchiveSink<TDoc>, options?: ArchiveOptions & {
1382
+ session?: ClientSession;
1383
+ }): Promise<ArchiveResult>;
1290
1384
  /**
1291
1385
  * Kit-native aggregation pipeline — takes a MongoDB stage array and
1292
1386
  * returns the raw pipeline output. Use this for `$lookup`, `$unwind`,
@@ -1,5 +1,5 @@
1
- import { n as Repository } from "./Repository-B01VW_fU.mjs";
2
- import { a as methodRegistryPlugin, d as cachePlugin, f as batchOperationsPlugin, h as auditLogPlugin, i as multiTenantPlugin, m as auditTrailPlugin, n as softDeletePlugin, o as customIdPlugin, t as timestampPlugin } from "./timestamp.plugin-B1A9U-P7.mjs";
1
+ import { n as Repository } from "./Repository-dbbgOGjK.mjs";
2
+ import { a as methodRegistryPlugin, d as cachePlugin, f as batchOperationsPlugin, h as auditLogPlugin, i as multiTenantPlugin, m as auditTrailPlugin, n as softDeletePlugin, o as customIdPlugin, t as timestampPlugin } from "./timestamp.plugin-nG9Z1JEk.mjs";
3
3
  //#region src/create-repository.ts
4
4
  function isLoggerAudit(value) {
5
5
  const v = value;
@@ -25,9 +25,10 @@ function isObjectIdInstance(instance) {
25
25
  }
26
26
  const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
27
27
  /**
28
- * Detect the _id path type from a Mongoose schema.
28
+ * Detect an id path's type from a Mongoose schema. Defaults to the `_id`
29
+ * path; pass `field` to resolve a custom id field (Repository's `idField`).
29
30
  *
30
- * Returns 'objectid' as the safe default when:
31
+ * For `_id`, returns 'objectid' as the safe default when:
31
32
  * - No schema is provided (mock models, test harnesses)
32
33
  * - The schema has no `paths._id` (auto-generated ObjectId)
33
34
  * - The instance string is unrecognized
@@ -35,10 +36,14 @@ const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/
35
36
  * This safe-default means existing callers that don't set _id explicitly
36
37
  * get the same ObjectId validation they always had — the behavioral change
37
38
  * is strictly opt-in via schema declaration.
39
+ *
40
+ * For a custom `field` with no resolvable path, returns 'unknown' instead —
41
+ * custom id fields carry no ObjectId convention, so validation stays
42
+ * permissive and the DB remains the authority.
38
43
  */
39
- function getSchemaIdType(schema) {
40
- const instance = schema?.paths?._id?.instance;
41
- if (!instance) return "objectid";
44
+ function getSchemaIdType(schema, field = "_id") {
45
+ const instance = schema?.paths?.[field]?.instance;
46
+ if (!instance) return field === "_id" ? "objectid" : "unknown";
42
47
  if (isObjectIdInstance(instance)) return "objectid";
43
48
  switch (instance) {
44
49
  case "String": return "string";
@@ -1,7 +1,5 @@
1
- import { B as ObjectId, Dt as LookupOptions, H as OperationOptions, I as MinMaxResult, J as PopulateSpec, T as GroupResult, Z as ReadPreferenceType, ft as UpdateManyResult, ht as UpdateWithValidationResult, i as AnyDocument, it as SelectSpec, p as CreateOptions, pt as UpdateOptions, ut as SortSpec, v as DeleteResult, w as FindOneAndUpdateOptions } from "./types-BA8oXjFe.mjs";
1
+ import { B as ObjectId, Dt as LookupOptions, H as OperationOptions, I as MinMaxResult, J as PopulateSpec, T as GroupResult, Z as ReadPreferenceType, ft as UpdateManyResult, ht as UpdateWithValidationResult, i as AnyDocument, it as SelectSpec, p as CreateOptions, pt as UpdateOptions, ut as SortSpec, v as DeleteResult, w as FindOneAndUpdateOptions } from "./types-DNFMofHy.mjs";
2
2
  import { Model, PipelineStage } from "mongoose";
3
-
4
- //#region src/actions/aggregate.d.ts
5
3
  declare namespace aggregate_d_exports {
6
4
  export { aggregate, aggregatePaginate, average, countBy, distinct, facet, groupBy, lookup, minMax, sum, unwind };
7
5
  }
package/dist/index.d.mts CHANGED
@@ -1,15 +1,14 @@
1
- import { $ as RepositoryEvent, A as KeysetPaginationOptions, B as ObjectId, C as FieldPreset, Ct as IControllerResponse, D as InferDocument, Dt as LookupOptions, E as HookMode, Et as LookupBuilder, F as MiddlewareContext, G as Plugin, H as OperationOptions, I as MinMaxResult, J as PopulateSpec, K as PluginFunction, L as MinimalRepoView, M as LookupPopulateOptions, N as LookupPopulateResult, O as InferRawDoc, P as Middleware, Q as RepositoryContext, R as MongoOperatorUpdate, S as EventPhase, St as IController, T as GroupResult, Tt as IResponseFormatter, U as PaginationConfig, V as OffsetPaginationOptions, W as PartialBy, X as ReadOptions, Y as PrioritizedHook, Z as ReadPreferenceType, _t as ValidationChainOptions, a as AnyModel, at as SessionOptions, b as EventHandlers, bt as WithPlugins, c as CacheableOptions, ct as SoftDeleteRepository, d as CollationOptions, dt as Strict, et as RepositoryInstance, f as CreateInput, ft as UpdateManyResult, g as DeepPartial, gt as UserContext, h as DecodedCursor, ht as UpdateWithValidationResult, i as AnyDocument, it as SelectSpec, j as Logger, k as KeysOfType, l as CascadeOptions, lt as SortDirection, m as CursorPayload, mt as UpdatePatch, n as AggregatePaginationOptions, nt as RepositoryOptions, o as BasePaginationOptions, ot as SoftDeleteFilterMode, p as CreateOptions, pt as UpdateOptions, q as PluginType, r as AllPluginMethods, rt as RequiredBy, s as CacheOperationOptions, st as SoftDeleteOptions, t as AggregateOptions, tt as RepositoryOperation, u as CascadeRelation, ut as SortSpec, v as DeleteResult, vt as ValidatorDefinition, w as FindOneAndUpdateOptions, wt as IRequestContext, x as EventPayload, xt as WithTransactionOptions, y as DocField, yt as ValueType, z as NonNullableFields } from "./types-BA8oXjFe.mjs";
2
- import { t as index_d_exports } from "./index-BgSBwlWu.mjs";
3
- import { C as AuditTrailMethods, E as auditTrailPlugin, S as AuditQueryResult, T as AuditTrailQuery, _ as RepositoryCachePluginOptions, a as DateSequentialIdOptions, b as AuditOperation, c as SequentialIdOptions, d as getNextSequence, f as prefixedId, g as RepositoryCacheHandle, h as CacheOptions, i as CustomIdOptions, l as customIdPlugin, m as CacheAdapter, n as adminBypass, o as IdGenerator, p as sequentialId, r as multiTenantPlugin, s as PrefixedIdOptions, t as MultiTenantOptions, u as dateSequentialId, v as cachePlugin, w as AuditTrailOptions, x as AuditQueryOptions, y as AuditEntry } from "./multi-tenant.plugin-D6lw3BsI.mjs";
4
- import { t as PaginationEngine } from "./PaginationEngine-4SjzfBQE.mjs";
5
- import { a as Repository, i as HOOK_PRIORITY, n as CreateRepositoryConfig, o as AggregationBuilder, r as createRepository, t as AuditConfig } from "./create-repository-K0yft2ht.mjs";
6
- import { A as BulkWriteResult, C as LeasePluginOptions, D as elasticSearchPlugin, E as ElasticSearchOptions, M as auditLogPlugin, N as AggregateHelpersMethods, O as cascadePlugin, P as aggregateHelpersPlugin, S as LeaseMethods, T as fieldFilterPlugin, _ as observabilityPlugin, a as uniqueField, c as TenantContext, d as SubdocumentMethods, f as subdocumentPlugin, g as OperationMetric, h as ObservabilityOptions, i as requireField, j as batchOperationsPlugin, k as BatchOperationsMethods, l as TenantStore, m as softDeletePlugin, n as blockIf, o as validationChainPlugin, p as SoftDeleteMethods, r as immutableField, s as timestampPlugin, t as autoInject, u as createTenantContext, v as MongoOperationsMethods, w as leasePlugin, x as methodRegistryPlugin, y as mongoOperationsPlugin } from "./validation-chain.plugin-CYOPfFGF.mjs";
7
- import { n as SchemaPathsLike, t as FieldType$1 } from "./coercion-BxxHyLjP.mjs";
8
- import { n as SchemaIndexes } from "./indexes-3eHBWNZ2.mjs";
9
- import { d as filterResponseData, f as getFieldsForUser, g as parseDuplicateKeyError, h as isDuplicateKeyError, i as configureLogger, m as createError, n as buildCrudSchemasFromMongooseSchema, p as getMongooseProjection, r as createMemoryCache, s as idVariants, t as buildCrudSchemasFromModel, u as createFieldPreset } from "./mongooseToJsonSchema-Bz47aMfH.mjs";
1
+ import { $ as RepositoryEvent, A as KeysetPaginationOptions, B as ObjectId, C as FieldPreset, Ct as IControllerResponse, D as InferDocument, Dt as LookupOptions, E as HookMode, Et as LookupBuilder, F as MiddlewareContext, G as Plugin, H as OperationOptions, I as MinMaxResult, J as PopulateSpec, K as PluginFunction, L as MinimalRepoView, M as LookupPopulateOptions, N as LookupPopulateResult, O as InferRawDoc, P as Middleware, Q as RepositoryContext, R as MongoOperatorUpdate, S as EventPhase, St as IController, T as GroupResult, Tt as IResponseFormatter, U as PaginationConfig, V as OffsetPaginationOptions, W as PartialBy, X as ReadOptions, Y as PrioritizedHook, Z as ReadPreferenceType, _t as ValidationChainOptions, a as AnyModel, at as SessionOptions, b as EventHandlers, bt as WithPlugins, c as CacheableOptions, ct as SoftDeleteRepository, d as CollationOptions, dt as Strict, et as RepositoryInstance, f as CreateInput, ft as UpdateManyResult, g as DeepPartial, gt as UserContext, h as DecodedCursor, ht as UpdateWithValidationResult, i as AnyDocument, it as SelectSpec, j as Logger, k as KeysOfType, l as CascadeOptions, lt as SortDirection, m as CursorPayload, mt as UpdatePatch, n as AggregatePaginationOptions, nt as RepositoryOptions, o as BasePaginationOptions, ot as SoftDeleteFilterMode, p as CreateOptions, pt as UpdateOptions, q as PluginType, r as AllPluginMethods, rt as RequiredBy, s as CacheOperationOptions, st as SoftDeleteOptions, t as AggregateOptions, tt as RepositoryOperation, u as CascadeRelation, ut as SortSpec, v as DeleteResult, vt as ValidatorDefinition, w as FindOneAndUpdateOptions, wt as IRequestContext, x as EventPayload, xt as WithTransactionOptions, y as DocField, yt as ValueType, z as NonNullableFields } from "./types-DNFMofHy.mjs";
2
+ import { t as index_d_exports } from "./index-Cg3SWugF.mjs";
3
+ import { C as AuditTrailMethods, E as auditTrailPlugin, S as AuditQueryResult, T as AuditTrailQuery, _ as RepositoryCachePluginOptions, a as DateSequentialIdOptions, b as AuditOperation, c as SequentialIdOptions, d as getNextSequence, f as prefixedId, g as RepositoryCacheHandle, h as CacheOptions, i as CustomIdOptions, l as customIdPlugin, m as CacheAdapter, n as adminBypass, o as IdGenerator, p as sequentialId, r as multiTenantPlugin, s as PrefixedIdOptions, t as MultiTenantOptions, u as dateSequentialId, v as cachePlugin, w as AuditTrailOptions, x as AuditQueryOptions, y as AuditEntry } from "./multi-tenant.plugin-CTsWz0XK.mjs";
4
+ import { t as PaginationEngine } from "./PaginationEngine-DYpOD2wY.mjs";
5
+ import { a as Repository, i as HOOK_PRIORITY, n as CreateRepositoryConfig, o as AggregationBuilder, r as createRepository, t as AuditConfig } from "./create-repository-0TkQhcv-.mjs";
6
+ import { A as BulkWriteResult, C as LeasePluginOptions, D as elasticSearchPlugin, E as ElasticSearchOptions, M as auditLogPlugin, N as AggregateHelpersMethods, O as cascadePlugin, P as aggregateHelpersPlugin, S as LeaseMethods, T as fieldFilterPlugin, _ as observabilityPlugin, a as uniqueField, c as TenantContext, d as SubdocumentMethods, f as subdocumentPlugin, g as OperationMetric, h as ObservabilityOptions, i as requireField, j as batchOperationsPlugin, k as BatchOperationsMethods, l as TenantStore, m as softDeletePlugin, n as blockIf, o as validationChainPlugin, p as SoftDeleteMethods, r as immutableField, s as timestampPlugin, t as autoInject, u as createTenantContext, v as MongoOperationsMethods, w as leasePlugin, x as methodRegistryPlugin, y as mongoOperationsPlugin } from "./validation-chain.plugin-buy3uvyk.mjs";
7
+ import { n as SchemaPathsLike, t as FieldType$1 } from "./coercion-BjdPX3YF.mjs";
8
+ import { n as SchemaIndexes } from "./indexes-DIjMpYES.mjs";
9
+ import { d as filterResponseData, f as getFieldsForUser, g as parseDuplicateKeyError, h as isDuplicateKeyError, i as configureLogger, m as createError, n as buildCrudSchemasFromMongooseSchema, p as getMongooseProjection, r as createMemoryCache, s as idVariants, t as buildCrudSchemasFromModel, u as createFieldPreset } from "./mongooseToJsonSchema-D2CyAMIC.mjs";
10
10
  import { RepoCapabilities } from "@classytic/repo-core/repository";
11
11
  import { ClientSession, PipelineStage } from "mongoose";
12
-
13
12
  //#region src/actions/cascade-references.d.ts
14
13
  type PurgeMode = 'hard' | 'soft' | 'anonymize';
15
14
  /** Raw collection surface — a native MongoDB `Collection` or a Mongoose `Model`. */
package/dist/index.mjs CHANGED
@@ -1,18 +1,18 @@
1
- import { n as idVariants } from "./id-resolution-CnN0YA8t.mjs";
2
- import { a as withTransaction, c as MUTATING_OPERATIONS, d as operationsByPolicyKey, f as MONGOKIT_CAPABILITIES, i as isTransactionUnsupported, l as OP_REGISTRY, n as Repository, o as AggregationBuilder, p as createMongoPurgePort, r as batchTransaction, s as ALL_OPERATIONS, t as HOOK_PRIORITY, u as READ_OPERATIONS } from "./Repository-B01VW_fU.mjs";
3
- import { b as LookupBuilder, x as compileFilterToMongo } from "./update-CvCMv5Cl.mjs";
4
- import { n as warn, t as configureLogger } from "./logger-B8wf-Mtb.mjs";
5
- import { n as isDuplicateKeyError, r as parseDuplicateKeyError, t as createError } from "./error-BTeepSNL.mjs";
1
+ import { n as idVariants } from "./id-resolution-P2OzcyRl.mjs";
2
+ import { a as withTransaction, c as MUTATING_OPERATIONS, d as operationsByPolicyKey, f as MONGOKIT_CAPABILITIES, i as isTransactionUnsupported, l as OP_REGISTRY, n as Repository, o as AggregationBuilder, p as createMongoPurgePort, r as batchTransaction, s as ALL_OPERATIONS, t as HOOK_PRIORITY, u as READ_OPERATIONS } from "./Repository-dbbgOGjK.mjs";
3
+ import { b as LookupBuilder, x as compileFilterToMongo } from "./update-1Lq9OMD2.mjs";
4
+ import { n as warn, t as configureLogger } from "./logger-K7dPmu2U.mjs";
5
+ import { n as isDuplicateKeyError, r as parseDuplicateKeyError, t as createError } from "./error-BuByZwKU.mjs";
6
6
  import { t as actions_exports } from "./actions/index.mjs";
7
- import { a as methodRegistryPlugin, c as getNextSequence, d as cachePlugin, f as batchOperationsPlugin, h as auditLogPlugin, i as multiTenantPlugin, l as prefixedId, m as auditTrailPlugin, n as softDeletePlugin, o as customIdPlugin, p as AuditTrailQuery, r as adminBypass, s as dateSequentialId, t as timestampPlugin, u as sequentialId } from "./timestamp.plugin-B1A9U-P7.mjs";
8
- import { t as PaginationEngine } from "./PaginationEngine-BcvaXBQ-.mjs";
7
+ import { a as methodRegistryPlugin, c as getNextSequence, d as cachePlugin, f as batchOperationsPlugin, h as auditLogPlugin, i as multiTenantPlugin, l as prefixedId, m as auditTrailPlugin, n as softDeletePlugin, o as customIdPlugin, p as AuditTrailQuery, r as adminBypass, s as dateSequentialId, t as timestampPlugin, u as sequentialId } from "./timestamp.plugin-nG9Z1JEk.mjs";
8
+ import { t as PaginationEngine } from "./PaginationEngine-BT1ywu9k.mjs";
9
9
  import { isGeoOperator, parseGeoFilter } from "./query/primitives/geo.mjs";
10
- import { t as createRepository } from "./create-repository-D5YX0wGs.mjs";
11
- import { a as uniqueField, c as subdocumentPlugin, d as leasePlugin, f as fieldFilterPlugin, h as aggregateHelpersPlugin, i as requireField, l as observabilityPlugin, m as cascadePlugin, n as blockIf, o as validationChainPlugin, p as elasticSearchPlugin, r as immutableField, s as createTenantContext, t as autoInject, u as mongoOperationsPlugin } from "./validation-chain.plugin-DHZbpb4t.mjs";
12
- import { i as getMongooseProjection, n as filterResponseData, r as getFieldsForUser, t as createFieldPreset } from "./field-selection-d1qdRiMr.mjs";
10
+ import { t as createRepository } from "./create-repository-CJATiAKX.mjs";
11
+ import { a as uniqueField, c as subdocumentPlugin, d as leasePlugin, f as fieldFilterPlugin, h as aggregateHelpersPlugin, i as requireField, l as observabilityPlugin, m as cascadePlugin, n as blockIf, o as validationChainPlugin, p as elasticSearchPlugin, r as immutableField, s as createTenantContext, t as autoInject, u as mongoOperationsPlugin } from "./validation-chain.plugin-Dn_wZYLA.mjs";
12
+ import { i as getMongooseProjection, n as filterResponseData, r as getFieldsForUser, t as createFieldPreset } from "./field-selection-FSQFLpsU.mjs";
13
13
  import { buildFieldTypeMap, coerceFieldValue, coerceHeuristic } from "./query/primitives/coercion.mjs";
14
14
  import { extractSchemaIndexes } from "./query/primitives/indexes.mjs";
15
- import { n as buildCrudSchemasFromMongooseSchema, r as createMemoryCache, t as buildCrudSchemasFromModel } from "./mongooseToJsonSchema-ChtXSrLT.mjs";
15
+ import { n as buildCrudSchemasFromMongooseSchema, r as createMemoryCache, t as buildCrudSchemasFromModel } from "./mongooseToJsonSchema-khdzVo8x.mjs";
16
16
  import { runChunkedPurge } from "@classytic/repo-core/repository";
17
17
  import { isControlParam } from "@classytic/repo-core/query-parser";
18
18
  //#region src/actions/cascade-references.ts
@@ -226,7 +226,7 @@ async function cascadePurgeReferences(options) {
226
226
  * without this guard. Kept as a Set for O(1) lookup; values mirror the
227
227
  * reserved-key list at the top of `_parseFilters`.
228
228
  */
229
- const RESERVED_PAGINATION_KEYS = new Set([
229
+ const RESERVED_PAGINATION_KEYS = /* @__PURE__ */ new Set([
230
230
  "page",
231
231
  "limit",
232
232
  "sort",
@@ -1043,7 +1043,7 @@ var QueryParser = class {
1043
1043
  return {};
1044
1044
  }
1045
1045
  const sanitized = {};
1046
- const logicalArrayOps = new Set([
1046
+ const logicalArrayOps = /* @__PURE__ */ new Set([
1047
1047
  "$or",
1048
1048
  "$and",
1049
1049
  "$nor"
@@ -1421,6 +1421,44 @@ function systemContext(extra) {
1421
1421
  }
1422
1422
  //#endregion
1423
1423
  //#region src/index.ts
1424
+ /**
1425
+ * MongoKit - Event-driven repository pattern for MongoDB
1426
+ *
1427
+ * Production-grade MongoDB repositories with zero dependencies -
1428
+ * smart pagination, events, and plugins.
1429
+ *
1430
+ * @module @classytic/mongokit
1431
+ * @author Classytic (https://github.com/classytic)
1432
+ * @license MIT
1433
+ *
1434
+ * @example
1435
+ * ```typescript
1436
+ * import { createRepository } from '@classytic/mongokit';
1437
+ *
1438
+ * // Create repository with declarative config (plugins composed in the
1439
+ * // canonical safe order automatically)
1440
+ * const userRepo = createRepository(UserModel, {
1441
+ * timestamps: true,
1442
+ * softDelete: true,
1443
+ * });
1444
+ *
1445
+ * // Create
1446
+ * const user = await userRepo.create({ name: 'John', email: 'john@example.com' });
1447
+ *
1448
+ * // Read with pagination (auto-detects offset vs keyset)
1449
+ * const users = await userRepo.getAll({ page: 1, limit: 20 });
1450
+ *
1451
+ * // Keyset pagination for infinite scroll
1452
+ * const stream = await userRepo.getAll({ sort: { createdAt: -1 }, limit: 50 });
1453
+ * const nextStream = await userRepo.getAll({ after: stream.next, sort: { createdAt: -1 } });
1454
+ *
1455
+ * // Update
1456
+ * await userRepo.update(user._id, { name: 'John Doe' });
1457
+ *
1458
+ * // Delete
1459
+ * await userRepo.delete(user._id);
1460
+ * ```
1461
+ */
1424
1462
  var src_default = Repository;
1425
1463
  //#endregion
1426
1464
  export { ALL_OPERATIONS, AggregationBuilder, AuditTrailQuery, HOOK_PRIORITY, LookupBuilder, MONGOKIT_CAPABILITIES, MUTATING_OPERATIONS, OP_REGISTRY, PaginationEngine, QueryParser, READ_OPERATIONS, Repository, actions_exports as actions, adminBypass, aggregateHelpersPlugin, auditLogPlugin, auditTrailPlugin, autoInject, batchOperationsPlugin, batchTransaction, blockIf, buildCrudSchemasFromModel, buildCrudSchemasFromMongooseSchema, cachePlugin, cascadePlugin, cascadePurgeReferences, compileFilterToMongo, configureLogger, createError, createFieldPreset, createMemoryCache, createOptionsExtractor, createRepository, createTenantContext, customIdPlugin, dateSequentialId, src_default as default, elasticSearchPlugin, fieldFilterPlugin, filterResponseData, getFieldsForUser, getMongooseProjection, getNextSequence, idVariants, immutableField, isDuplicateKeyError, isTransactionUnsupported, leasePlugin, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, operationsByPolicyKey, parseDuplicateKeyError, prefixedId, repoOptionsFromCtx, requireField, sequentialId, softDeletePlugin, subdocumentPlugin, systemContext, timestampPlugin, uniqueField, validationChainPlugin, withTransaction };
@@ -1,6 +1,5 @@
1
1
  import { Connection } from "mongoose";
2
2
  import { BaseLockAdapterOptions, LockAdapter } from "@classytic/repo-core/lock";
3
-
4
3
  //#region src/lock/index.d.ts
5
4
  /** Adapter-construction options. */
6
5
  interface MongoLockAdapterOptions extends BaseLockAdapterOptions {
@@ -1,9 +1,8 @@
1
- import { C as FieldPreset, gt as UserContext } from "./types-BA8oXjFe.mjs";
1
+ import { C as FieldPreset, gt as UserContext } from "./types-DNFMofHy.mjs";
2
2
  import mongoose, { Schema } from "mongoose";
3
3
  import { CacheAdapter } from "@classytic/repo-core/cache";
4
4
  import { CrudSchemas, SchemaBuilderOptions } from "@classytic/repo-core/schema";
5
5
  import { HttpError } from "@classytic/repo-core/errors";
6
-
7
6
  //#region src/utils/error.d.ts
8
7
  /** Optional structured fields for createError. */
9
8
  interface CreateErrorOptions {
@@ -170,9 +169,10 @@ interface SchemaLike {
170
169
  }>;
171
170
  }
172
171
  /**
173
- * Detect the _id path type from a Mongoose schema.
172
+ * Detect an id path's type from a Mongoose schema. Defaults to the `_id`
173
+ * path; pass `field` to resolve a custom id field (Repository's `idField`).
174
174
  *
175
- * Returns 'objectid' as the safe default when:
175
+ * For `_id`, returns 'objectid' as the safe default when:
176
176
  * - No schema is provided (mock models, test harnesses)
177
177
  * - The schema has no `paths._id` (auto-generated ObjectId)
178
178
  * - The instance string is unrecognized
@@ -180,8 +180,12 @@ interface SchemaLike {
180
180
  * This safe-default means existing callers that don't set _id explicitly
181
181
  * get the same ObjectId validation they always had — the behavioral change
182
182
  * is strictly opt-in via schema declaration.
183
+ *
184
+ * For a custom `field` with no resolvable path, returns 'unknown' instead —
185
+ * custom id fields carry no ObjectId convention, so validation stays
186
+ * permissive and the DB remains the authority.
183
187
  */
184
- declare function getSchemaIdType(schema?: SchemaLike | null): IdType;
188
+ declare function getSchemaIdType(schema?: SchemaLike | null, field?: string): IdType;
185
189
  /**
186
190
  * Validate an id value against a known _id type — WITHOUT hitting the DB.
187
191
  *
@@ -1,4 +1,4 @@
1
- import { r as isObjectIdInstance } from "./id-resolution-CnN0YA8t.mjs";
1
+ import { r as isObjectIdInstance } from "./id-resolution-P2OzcyRl.mjs";
2
2
  import mongoose from "mongoose";
3
3
  import { applyFieldRules, collectFieldsToOmit } from "@classytic/repo-core/schema";
4
4
  //#region src/utils/memory-cache.ts
@@ -1,8 +1,7 @@
1
- import { B as ObjectId, G as Plugin, Q as RepositoryContext } from "./types-BA8oXjFe.mjs";
1
+ import { B as ObjectId, G as Plugin, Q as RepositoryContext } from "./types-DNFMofHy.mjs";
2
2
  import mongoose from "mongoose";
3
3
  import { CacheAdapter as CacheAdapter$1, CacheOptions, RepositoryCacheHandle, RepositoryCachePluginOptions, cachePlugin } from "@classytic/repo-core/cache";
4
4
  import { TenantConfig } from "@classytic/repo-core/tenant";
5
-
6
5
  //#region src/plugins/audit-trail.plugin.d.ts
7
6
  interface AuditTrailOptions {
8
7
  /** Operations to track (default: ['create', 'update', 'delete']) */
@@ -1,2 +1,2 @@
1
- import { t as PaginationEngine } from "../PaginationEngine-4SjzfBQE.mjs";
1
+ import { t as PaginationEngine } from "../PaginationEngine-DYpOD2wY.mjs";
2
2
  export { PaginationEngine };
@@ -1,2 +1,2 @@
1
- import { t as PaginationEngine } from "../PaginationEngine-BcvaXBQ-.mjs";
1
+ import { t as PaginationEngine } from "../PaginationEngine-BT1ywu9k.mjs";
2
2
  export { PaginationEngine };
@@ -1,8 +1,7 @@
1
- import { G as Plugin } from "../types-BA8oXjFe.mjs";
2
- import { C as AuditTrailMethods, E as auditTrailPlugin, S as AuditQueryResult, T as AuditTrailQuery, _ as RepositoryCachePluginOptions, a as DateSequentialIdOptions, b as AuditOperation, c as SequentialIdOptions, d as getNextSequence, f as prefixedId, g as RepositoryCacheHandle, h as CacheOptions, i as CustomIdOptions, l as customIdPlugin, m as CacheAdapter, o as IdGenerator, p as sequentialId, r as multiTenantPlugin, s as PrefixedIdOptions, t as MultiTenantOptions, u as dateSequentialId, v as cachePlugin, w as AuditTrailOptions, x as AuditQueryOptions, y as AuditEntry } from "../multi-tenant.plugin-D6lw3BsI.mjs";
3
- import { C as LeasePluginOptions, D as elasticSearchPlugin, E as ElasticSearchOptions, M as auditLogPlugin, N as AggregateHelpersMethods, O as cascadePlugin, P as aggregateHelpersPlugin, S as LeaseMethods, T as fieldFilterPlugin, _ as observabilityPlugin, a as uniqueField, b as MethodRegistryRepository, c as TenantContext, d as SubdocumentMethods, f as subdocumentPlugin, g as OperationMetric, h as ObservabilityOptions, i as requireField, j as batchOperationsPlugin, k as BatchOperationsMethods, l as TenantStore, m as softDeletePlugin, n as blockIf, o as validationChainPlugin, p as SoftDeleteMethods, r as immutableField, s as timestampPlugin, t as autoInject, u as createTenantContext, v as MongoOperationsMethods, w as leasePlugin, x as methodRegistryPlugin, y as mongoOperationsPlugin } from "../validation-chain.plugin-CYOPfFGF.mjs";
1
+ import { G as Plugin } from "../types-DNFMofHy.mjs";
2
+ import { C as AuditTrailMethods, E as auditTrailPlugin, S as AuditQueryResult, T as AuditTrailQuery, _ as RepositoryCachePluginOptions, a as DateSequentialIdOptions, b as AuditOperation, c as SequentialIdOptions, d as getNextSequence, f as prefixedId, g as RepositoryCacheHandle, h as CacheOptions, i as CustomIdOptions, l as customIdPlugin, m as CacheAdapter, o as IdGenerator, p as sequentialId, r as multiTenantPlugin, s as PrefixedIdOptions, t as MultiTenantOptions, u as dateSequentialId, v as cachePlugin, w as AuditTrailOptions, x as AuditQueryOptions, y as AuditEntry } from "../multi-tenant.plugin-CTsWz0XK.mjs";
3
+ import { C as LeasePluginOptions, D as elasticSearchPlugin, E as ElasticSearchOptions, M as auditLogPlugin, N as AggregateHelpersMethods, O as cascadePlugin, P as aggregateHelpersPlugin, S as LeaseMethods, T as fieldFilterPlugin, _ as observabilityPlugin, a as uniqueField, b as MethodRegistryRepository, c as TenantContext, d as SubdocumentMethods, f as subdocumentPlugin, g as OperationMetric, h as ObservabilityOptions, i as requireField, j as batchOperationsPlugin, k as BatchOperationsMethods, l as TenantStore, m as softDeletePlugin, n as blockIf, o as validationChainPlugin, p as SoftDeleteMethods, r as immutableField, s as timestampPlugin, t as autoInject, u as createTenantContext, v as MongoOperationsMethods, w as leasePlugin, x as methodRegistryPlugin, y as mongoOperationsPlugin } from "../validation-chain.plugin-buy3uvyk.mjs";
4
4
  import { ChangeLogStore } from "@classytic/repo-core/sync";
5
-
6
5
  //#region src/plugins/change-log.plugin.d.ts
7
6
  interface ChangeLogPluginOptions {
8
7
  /** Durable feed implementing the repo-core/sync contract. */
@@ -1,5 +1,5 @@
1
- import { a as methodRegistryPlugin, c as getNextSequence, d as cachePlugin, f as batchOperationsPlugin, h as auditLogPlugin, i as multiTenantPlugin, l as prefixedId, m as auditTrailPlugin, n as softDeletePlugin, o as customIdPlugin, p as AuditTrailQuery, s as dateSequentialId, t as timestampPlugin, u as sequentialId } from "../timestamp.plugin-B1A9U-P7.mjs";
2
- import { a as uniqueField, c as subdocumentPlugin, d as leasePlugin, f as fieldFilterPlugin, h as aggregateHelpersPlugin, i as requireField, l as observabilityPlugin, m as cascadePlugin, n as blockIf, o as validationChainPlugin, p as elasticSearchPlugin, r as immutableField, s as createTenantContext, t as autoInject, u as mongoOperationsPlugin } from "../validation-chain.plugin-DHZbpb4t.mjs";
1
+ import { a as methodRegistryPlugin, c as getNextSequence, d as cachePlugin, f as batchOperationsPlugin, h as auditLogPlugin, i as multiTenantPlugin, l as prefixedId, m as auditTrailPlugin, n as softDeletePlugin, o as customIdPlugin, p as AuditTrailQuery, s as dateSequentialId, t as timestampPlugin, u as sequentialId } from "../timestamp.plugin-nG9Z1JEk.mjs";
2
+ import { a as uniqueField, c as subdocumentPlugin, d as leasePlugin, f as fieldFilterPlugin, h as aggregateHelpersPlugin, i as requireField, l as observabilityPlugin, m as cascadePlugin, n as blockIf, o as validationChainPlugin, p as elasticSearchPlugin, r as immutableField, s as createTenantContext, t as autoInject, u as mongoOperationsPlugin } from "../validation-chain.plugin-Dn_wZYLA.mjs";
3
3
  //#region src/plugins/change-log.plugin.ts
4
4
  const PLUGIN_NAME = "changeLog";
5
5
  function isSkipped(context) {
@@ -1,2 +1,2 @@
1
- import { a as coerceHeuristic, i as coerceFieldValue, n as SchemaPathsLike, o as coerceToType, r as buildFieldTypeMap, s as normalizeMongooseType, t as FieldType } from "../../coercion-BxxHyLjP.mjs";
1
+ import { a as coerceHeuristic, i as coerceFieldValue, n as SchemaPathsLike, o as coerceToType, r as buildFieldTypeMap, s as normalizeMongooseType, t as FieldType } from "../../coercion-BjdPX3YF.mjs";
2
2
  export { FieldType, SchemaPathsLike, buildFieldTypeMap, coerceFieldValue, coerceHeuristic, coerceToType, normalizeMongooseType };
@@ -1,4 +1,4 @@
1
- import { r as isObjectIdInstance } from "../../id-resolution-CnN0YA8t.mjs";
1
+ import { r as isObjectIdInstance } from "../../id-resolution-P2OzcyRl.mjs";
2
2
  import mongoose from "mongoose";
3
3
  //#region src/query/primitives/coercion.ts
4
4
  /**
@@ -14,7 +14,7 @@
14
14
  * `[nearSphere]`, or `[geoWithin]` operator on a field.
15
15
  */
16
16
  /** Geo operators recognized by the parser */
17
- declare const GEO_OPERATORS: readonly ["near", "nearSphere", "geoWithin", "withinRadius"];
17
+ declare const GEO_OPERATORS: readonly ['near', 'nearSphere', 'geoWithin', 'withinRadius'];
18
18
  type GeoOperator = (typeof GEO_OPERATORS)[number];
19
19
  /**
20
20
  * True iff `operator` is one of the geo operators we handle.
@@ -1,2 +1,2 @@
1
- import { n as SchemaIndexes, r as extractSchemaIndexes, t as IndexableSchema } from "../../indexes-3eHBWNZ2.mjs";
1
+ import { n as SchemaIndexes, r as extractSchemaIndexes, t as IndexableSchema } from "../../indexes-DIjMpYES.mjs";
2
2
  export { IndexableSchema, SchemaIndexes, extractSchemaIndexes };
@@ -1,7 +1,6 @@
1
- import { a as Repository, n as CreateRepositoryConfig } from "../create-repository-K0yft2ht.mjs";
1
+ import { a as Repository, n as CreateRepositoryConfig } from "../create-repository-0TkQhcv-.mjs";
2
2
  import { Connection, Model, Schema } from "mongoose";
3
3
  import { MongoMemoryReplSet, MongoMemoryServer } from "mongodb-memory-server";
4
-
5
4
  //#region src/testkit/index.d.ts
6
5
  interface MongoMemoryOptions {
7
6
  /**
@@ -1,4 +1,4 @@
1
- import { t as createRepository } from "../create-repository-D5YX0wGs.mjs";
1
+ import { t as createRepository } from "../create-repository-CJATiAKX.mjs";
2
2
  import { createConnection } from "mongoose";
3
3
  //#region src/testkit/index.ts
4
4
  function idempotentStop(server) {
@@ -1,6 +1,6 @@
1
- import { l as OP_REGISTRY, s as ALL_OPERATIONS, t as HOOK_PRIORITY } from "./Repository-B01VW_fU.mjs";
2
- import { n as warn } from "./logger-B8wf-Mtb.mjs";
3
- import { t as createError } from "./error-BTeepSNL.mjs";
1
+ import { l as OP_REGISTRY, s as ALL_OPERATIONS, t as HOOK_PRIORITY } from "./Repository-dbbgOGjK.mjs";
2
+ import { n as warn } from "./logger-K7dPmu2U.mjs";
3
+ import { t as createError } from "./error-BuByZwKU.mjs";
4
4
  import { throwIfAborted, withRetry } from "@classytic/repo-core/repository";
5
5
  import mongoose from "mongoose";
6
6
  import { cachePlugin } from "@classytic/repo-core/cache";
@@ -1233,7 +1233,7 @@ function softDeletePlugin(options = {}) {
1233
1233
  };
1234
1234
  }
1235
1235
  };
1236
- const SOFT_DELETE_SPECIAL = new Set([
1236
+ const SOFT_DELETE_SPECIAL = /* @__PURE__ */ new Set([
1237
1237
  "updateMany",
1238
1238
  "deleteMany",
1239
1239
  "bulkWrite"