@classytic/mongokit 3.39.0 → 3.40.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 (35) hide show
  1. package/dist/{PaginationEngine-DQ7beTCR.mjs → PaginationEngine-Dvl8jcRY.mjs} +33 -17
  2. package/dist/{Repository-D7fDpyFx.mjs → Repository-BMgPSkqZ.mjs} +279 -625
  3. package/dist/{Repository-IxI983_m.d.mts → Repository-CR8Y9g2E.d.mts} +57 -32
  4. package/dist/actions/index.mjs +1 -1
  5. package/dist/ai/index.d.mts +1 -1
  6. package/dist/better-auth/index.mjs +1 -1
  7. package/dist/{create-repository-DOe9E_5F.mjs → create-repository-BzBUMvd1.mjs} +2 -2
  8. package/dist/{create-repository-CRXjDa3N.d.mts → create-repository-CAle1MSU.d.mts} +4 -4
  9. package/dist/idempotency/index.d.mts +23 -0
  10. package/dist/idempotency/index.mjs +134 -0
  11. package/dist/index.d.mts +58 -32
  12. package/dist/index.mjs +285 -675
  13. package/dist/indexes/verify-indexes.d.mts +14 -1
  14. package/dist/indexes/verify-indexes.mjs +54 -7
  15. package/dist/{multi-tenant.plugin-B-tzNeYL.d.mts → multi-tenant.plugin-CBgCo9im.d.mts} +18 -2
  16. package/dist/outbox/index.d.mts +1 -1
  17. package/dist/outbox/index.mjs +6 -4
  18. package/dist/pagination/PaginationEngine.mjs +1 -1
  19. package/dist/{plugin-options-BuvtOSZf.d.mts → plugin-options-Zk46lD6F.d.mts} +15 -1
  20. package/dist/plugins/index.d.mts +8 -3
  21. package/dist/plugins/index.mjs +98 -25
  22. package/dist/{repository-ZbLtL7Nk.d.mts → repository-odl03582.d.mts} +20 -2
  23. package/dist/sync/index.d.mts +40 -0
  24. package/dist/sync/index.mjs +334 -0
  25. package/dist/tenant/index.mjs +2 -0
  26. package/dist/testkit/index.d.mts +2 -2
  27. package/dist/testkit/index.mjs +1 -1
  28. package/dist/{timestamp.plugin-B5eiaItQ.mjs → timestamp.plugin-DF0gJB6p.mjs} +86 -2
  29. package/dist/{to-plain-B8ufk3Qz.d.mts → to-plain-k7SjNlSS.d.mts} +2 -2
  30. package/dist/transaction-B5L9glO0.mjs +533 -0
  31. package/dist/{update-c_01A0if.mjs → update-DG0fCwRJ.mjs} +168 -11
  32. package/dist/utils/index.d.mts +1 -1
  33. package/dist/{validation-chain.plugin-Bju1D1Sn.mjs → validation-chain.plugin-BLY2gLEk.mjs} +192 -279
  34. package/dist/{validation-chain.plugin-DvrLJIbJ.d.mts → validation-chain.plugin-DYp9E7K2.d.mts} +25 -3
  35. package/package.json +13 -4
@@ -1,6 +1,6 @@
1
1
  import { _ as UpdateOptions, a as CreateOptions, b as LookupOptions, c as FindOneAndUpdateOptions, d as LookupPopulateResult, g as UpdateManyResult, h as SessionOptions, m as ReadOptions, o as DeleteManyResult, p as OperationOptions, r as CacheableOptions, s as DeleteResult, t as AggregateOptions, u as LookupPopulateOptions, v as WithTransactionOptions, y as LookupBuilder } from "./operations-CrRIoc8Z.mjs";
2
2
  import { _ as PopulateSpec, g as ObjectId, i as CountStrategy, r as CollationOptions, t as AggregatePaginationOptions, u as PaginationConfig, v as ReadPreferenceType, x as SortSpec$1, y as SelectSpec } from "./pagination-BpIv2bdS.mjs";
3
- import { _ as RepositoryOptions, d as PluginType, f as PrioritizedHook, o as Middleware, p as RepositoryContext } from "./repository-ZbLtL7Nk.mjs";
3
+ import { _ as RepositoryOptions, d as PluginType, f as PrioritizedHook, o as Middleware, p as RepositoryContext } from "./repository-odl03582.mjs";
4
4
  import { t as PaginationEngine } from "./PaginationEngine-D-P19Y9m.mjs";
5
5
  import { AggPaginationRequest, AggRequest, AggResult, ArchiveOptions, ArchiveResult, ArchiveSink, ChangeEvent, FilterInput, KeysetAggPaginationResult, QueryOptions, RepoCapabilities, RepositoryBase, TenantPurgeOptions, TenantPurgeResult, TenantPurgeStrategy, WatchOptions } from "@classytic/repo-core/repository";
6
6
  import { ClientSession, Expression, Model, PipelineStage, PopulateOptions } from "mongoose";
@@ -519,6 +519,37 @@ interface TransitionMachine {
519
519
  readonly name: string;
520
520
  assertTransition(entityId: string, from: string, to: string): void;
521
521
  }
522
+ /** `Repository.getAll` parameters. */
523
+ type GetAllParams = {
524
+ filters?: Record<string, unknown>;
525
+ sort?: SortSpec$1 | string;
526
+ cursor?: string;
527
+ after?: string;
528
+ /** Cursor for the PREVIOUS page. Mutually exclusive with `after`/`cursor`. */
529
+ before?: string;
530
+ page?: number;
531
+ pagination?: {
532
+ page?: number;
533
+ limit?: number;
534
+ };
535
+ limit?: number;
536
+ search?: string;
537
+ mode?: 'offset' | 'keyset';
538
+ hint?: string | Record<string, 1 | -1>;
539
+ maxTimeMS?: number;
540
+ countStrategy?: CountStrategy;
541
+ /** Ceiling for `countStrategy: 'capped'`. */
542
+ countLimit?: number;
543
+ readPreference?: ReadPreferenceType;
544
+ /** Advanced populate options (from QueryParser or Arc's BaseController) */
545
+ populateOptions?: PopulateOptions[];
546
+ /** Collation for locale-aware string comparison */
547
+ collation?: CollationOptions;
548
+ /** Lookup configurations for $lookup joins (from QueryParser or manual) */
549
+ lookups?: LookupOptions[];
550
+ /** Skip pagination entirely — returns raw TDoc[] (same as findAll) */
551
+ noPagination?: boolean;
552
+ };
522
553
  declare class Repository<TDoc = unknown> extends RepositoryBase {
523
554
  /**
524
555
  * Cache handle ATTACHED BY the unified cache plugin at wiring time —
@@ -916,36 +947,19 @@ declare class Repository<TDoc = unknown> extends RepositoryBase {
916
947
  * // Skip cache for fresh data
917
948
  * await repo.getAll({ filters: { status: 'active' } }, { skipCache: true });
918
949
  */
919
- getAll(params?: {
920
- filters?: Record<string, unknown>;
921
- sort?: SortSpec$1 | string;
922
- cursor?: string;
923
- after?: string;
924
- /** Cursor for the PREVIOUS page. Mutually exclusive with `after`/`cursor`. */
925
- before?: string;
926
- page?: number;
927
- pagination?: {
928
- page?: number;
929
- limit?: number;
930
- };
931
- limit?: number;
932
- search?: string;
933
- mode?: 'offset' | 'keyset';
934
- hint?: string | Record<string, 1 | -1>;
935
- maxTimeMS?: number;
936
- countStrategy?: CountStrategy;
937
- /** Ceiling for `countStrategy: 'capped'`. */
938
- countLimit?: number;
939
- readPreference?: ReadPreferenceType;
940
- /** Advanced populate options (from QueryParser or Arc's BaseController) */
941
- populateOptions?: PopulateOptions[];
942
- /** Collation for locale-aware string comparison */
943
- collation?: CollationOptions;
944
- /** Lookup configurations for $lookup joins (from QueryParser or manual) */
945
- lookups?: LookupOptions[];
946
- /** Skip pagination entirely — returns raw TDoc[] (same as findAll) */
947
- noPagination?: boolean;
948
- }, options?: CacheableOptions): Promise<OffsetPaginationResult<TDoc> | KeysetPaginationResult<TDoc> | TDoc[]>;
950
+ /** An explicit `mode` (or `noPagination`) decides the envelope, so the result type follows it. */
951
+ getAll(params: GetAllParams & {
952
+ mode: 'offset';
953
+ noPagination?: false;
954
+ }, options?: CacheableOptions): Promise<OffsetPaginationResult<TDoc>>;
955
+ getAll(params: GetAllParams & {
956
+ mode: 'keyset';
957
+ noPagination?: false;
958
+ }, options?: CacheableOptions): Promise<KeysetPaginationResult<TDoc>>;
959
+ getAll(params: GetAllParams & {
960
+ noPagination: true;
961
+ }, options?: CacheableOptions): Promise<TDoc[]>;
962
+ getAll(params?: GetAllParams, options?: CacheableOptions): Promise<OffsetPaginationResult<TDoc> | KeysetPaginationResult<TDoc> | TDoc[]>;
949
963
  /**
950
964
  * Atomic "look up by filter, insert `data` if missing, return the doc."
951
965
  *
@@ -1268,6 +1282,11 @@ declare class Repository<TDoc = unknown> extends RepositoryBase {
1268
1282
  }, patch?: Record<string, unknown>, options?: SessionOptions & {
1269
1283
  idField?: string;
1270
1284
  upsert?: boolean;
1285
+ /**
1286
+ * The document as the caller just read it in this session. Hooks' `loadTarget()`
1287
+ * returns it instead of reading again. Pass only a read taken in the same session.
1288
+ */
1289
+ target?: Record<string, unknown>;
1271
1290
  }): Promise<TDoc | null>;
1272
1291
  /**
1273
1292
  * State-machine-backed CAS transition with status history — the
@@ -1801,6 +1820,12 @@ declare class Repository<TDoc = unknown> extends RepositoryBase {
1801
1820
  * 4. DEFAULT (500) — user-registered hooks
1802
1821
  */
1803
1822
  _buildContext(operation: string, options: Record<string, unknown> | object): Promise<RepositoryContext>;
1823
+ /**
1824
+ * `memo` and (for an id-addressed op) `loadTarget` — attached before the before-hooks
1825
+ * run so every hook of one operation shares one read. A caller that has just read the
1826
+ * document in the same session passes it as `target`, and nothing is read at all.
1827
+ */
1828
+ private _sharedReadSeams;
1804
1829
  /**
1805
1830
  * Feed the resolved filter of a guarded verb to the distribution guard.
1806
1831
  * The slot follows `OP_REGISTRY[op].policyKey` (`query` vs `filters`);
@@ -1916,4 +1941,4 @@ declare class Repository<TDoc = unknown> extends RepositoryBase {
1916
1941
  private _translateError;
1917
1942
  }
1918
1943
  //#endregion
1919
- export { AggregationPlan as a, SortOrder as c, AggregationBuilder as i, SortSpec as l, Repository as n, GroupSpec as o, TransitionMachine as r, ProjectionSpec as s, HOOK_PRIORITY as t, VectorSearchOptions as u };
1944
+ export { AggregationBuilder as a, ProjectionSpec as c, VectorSearchOptions as d, TransitionMachine as i, SortOrder as l, HOOK_PRIORITY as n, AggregationPlan as o, Repository as r, GroupSpec as s, GetAllParams as t, SortSpec as u };
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
- import { b as create_exports, i as update_exports, m as aggregate_exports, p as delete_exports, u as read_exports } from "../update-c_01A0if.mjs";
2
+ import { S as create_exports, i as update_exports, m as aggregate_exports, p as delete_exports, u as read_exports } from "../update-DG0fCwRJ.mjs";
3
3
  //#region src/actions/index.ts
4
4
  var actions_exports = /* @__PURE__ */ __exportAll({
5
5
  aggregate: () => aggregate_exports,
@@ -1,4 +1,4 @@
1
- import { l as Plugin } from "../repository-ZbLtL7Nk.mjs";
1
+ import { l as Plugin } from "../repository-odl03582.mjs";
2
2
  import { PipelineStage } from "mongoose";
3
3
  //#region src/ai/types.d.ts
4
4
  /** Supported similarity metrics for vector search */
@@ -1,4 +1,4 @@
1
- import { n as Repository } from "../Repository-D7fDpyFx.mjs";
1
+ import { n as Repository } from "../Repository-BMgPSkqZ.mjs";
2
2
  import { n as createMongooseAdapter } from "../adapter-BrVfPFSW.mjs";
3
3
  import { asReadOnlyRepo } from "@classytic/repo-core/repository";
4
4
  import { pluralizeBetterAuthCollection, resolveBetterAuthCollections } from "@classytic/repo-core/better-auth";
@@ -1,5 +1,5 @@
1
- import { n as Repository } from "./Repository-D7fDpyFx.mjs";
2
- import { a as customIdPlugin, f as auditTrailPlugin, i as multiTenantPlugin, m as auditLogPlugin, n as softDeletePlugin, t as timestampPlugin, u as cachePlugin } from "./timestamp.plugin-B5eiaItQ.mjs";
1
+ import { n as Repository } from "./Repository-BMgPSkqZ.mjs";
2
+ import { b as auditLogPlugin, g as cachePlugin, i as multiTenantPlugin, l as customIdPlugin, n as softDeletePlugin, t as timestampPlugin, v as auditTrailPlugin } from "./timestamp.plugin-DF0gJB6p.mjs";
3
3
  import { n as batchOperationsPlugin, t as methodRegistryPlugin } from "./method-registry.plugin-C63pGn1d.mjs";
4
4
  //#region src/create-repository.ts
5
5
  function isLoggerAudit(value) {
@@ -1,8 +1,8 @@
1
1
  import { u as PaginationConfig } from "./pagination-BpIv2bdS.mjs";
2
- import { _ as RepositoryOptions, d as PluginType } from "./repository-ZbLtL7Nk.mjs";
3
- import { T as AuditTrailOptions, _ as RepositoryCachePluginOptions, i as CustomIdOptions, t as MultiTenantOptions } from "./multi-tenant.plugin-B-tzNeYL.mjs";
4
- import { n as Repository } from "./Repository-IxI983_m.mjs";
5
- import { i as Logger, o as SoftDeleteOptions } from "./plugin-options-BuvtOSZf.mjs";
2
+ import { _ as RepositoryOptions, d as PluginType } from "./repository-odl03582.mjs";
3
+ import { D as AuditTrailOptions, i as CustomIdOptions, t as MultiTenantOptions, y as RepositoryCachePluginOptions } from "./multi-tenant.plugin-CBgCo9im.mjs";
4
+ import { r as Repository } from "./Repository-CR8Y9g2E.mjs";
5
+ import { i as Logger, o as SoftDeleteOptions } from "./plugin-options-Zk46lD6F.mjs";
6
6
  import { Model } from "mongoose";
7
7
  //#region src/create-repository.d.ts
8
8
  /**
@@ -0,0 +1,23 @@
1
+ import { Connection, Model } from "mongoose";
2
+ import { IdempotencyClaimStore } from "@classytic/repo-core/idempotency";
3
+ //#region src/idempotency/index.d.ts
4
+ interface IdempotencyModelOptions {
5
+ /** Collection name. Default `idempotency_claims`. */
6
+ collection?: string;
7
+ /** Mongoose model name. Default `IdempotencyClaim`. Must be unique per connection. */
8
+ modelName?: string;
9
+ }
10
+ interface IdempotencyStoreOptions {
11
+ /**
12
+ * How long a claim is kept after its last write before the TTL monitor removes it.
13
+ * Default 7 days. Size it to the longest a caller may retry — a retry after the claim
14
+ * is gone executes again. An offline till that syncs days later needs more.
15
+ */
16
+ retentionSeconds?: number;
17
+ }
18
+ /** Build (or return) the claims model on `connection`. Idempotent per connection. */
19
+ declare function createIdempotencyModel(connection: Connection, options?: IdempotencyModelOptions): Model<Record<string, unknown>>;
20
+ /** The store over a model from {@link createIdempotencyModel}. */
21
+ declare function createIdempotencyStore(model: Model<Record<string, unknown>>, options?: IdempotencyStoreOptions): IdempotencyClaimStore;
22
+ //#endregion
23
+ export { IdempotencyModelOptions, IdempotencyStoreOptions, createIdempotencyModel, createIdempotencyStore };
@@ -0,0 +1,134 @@
1
+ import { Schema } from "mongoose";
2
+ import { identityKey } from "@classytic/repo-core/idempotency";
3
+ //#region src/idempotency/index.ts
4
+ /**
5
+ * The mongo {@link IdempotencyClaimStore} — use this with `runIdempotent` from
6
+ * `@classytic/repo-core/idempotency`; never keep a per-module claims table.
7
+ *
8
+ * ```ts
9
+ * const store = createIdempotencyStore(createIdempotencyModel(connection));
10
+ * const run = await runIdempotent({ store, identity, requestFingerprint, execute });
11
+ * ```
12
+ *
13
+ * One document per identity, `_id` = `identityKey(identity)`, so "insert iff absent" is
14
+ * the `_id` index and every compare-and-set is a single-document filter. Proven by
15
+ * `runIdempotencyStoreConformance` (`@classytic/repo-core/testing`) in this package's tests.
16
+ */
17
+ const DEFAULT_RETENTION_SECONDS = 604800;
18
+ /** Build (or return) the claims model on `connection`. Idempotent per connection. */
19
+ function createIdempotencyModel(connection, options = {}) {
20
+ const { collection = "idempotency_claims", modelName = "IdempotencyClaim" } = options;
21
+ const existing = connection.models[modelName];
22
+ if (existing) return existing;
23
+ const schema = new Schema({
24
+ _id: {
25
+ type: String,
26
+ required: true
27
+ },
28
+ identity: {
29
+ type: Schema.Types.Mixed,
30
+ required: true
31
+ },
32
+ requestFingerprint: {
33
+ type: String,
34
+ required: true
35
+ },
36
+ state: {
37
+ type: String,
38
+ enum: [
39
+ "in_flight",
40
+ "succeeded",
41
+ "failed"
42
+ ],
43
+ required: true
44
+ },
45
+ leaseToken: {
46
+ type: String,
47
+ required: true
48
+ },
49
+ leaseExpiresAt: {
50
+ type: Date,
51
+ required: true
52
+ },
53
+ createdAt: {
54
+ type: Date,
55
+ required: true
56
+ },
57
+ completedAt: { type: Date },
58
+ result: { type: Schema.Types.Mixed },
59
+ attempts: {
60
+ type: Number,
61
+ required: true
62
+ },
63
+ progress: { type: Schema.Types.Mixed },
64
+ context: { type: Schema.Types.Mixed },
65
+ lastError: { type: String },
66
+ purgeAt: {
67
+ type: Date,
68
+ required: true
69
+ }
70
+ }, {
71
+ collection,
72
+ versionKey: false,
73
+ minimize: false
74
+ });
75
+ schema.index({ purgeAt: 1 }, {
76
+ expireAfterSeconds: 0,
77
+ name: "retention"
78
+ });
79
+ schema.index({
80
+ "identity.operation": 1,
81
+ state: 1,
82
+ leaseExpiresAt: 1
83
+ }, { name: "lapsed_sweep" });
84
+ return connection.model(modelName, schema);
85
+ }
86
+ /** The store over a model from {@link createIdempotencyModel}. */
87
+ function createIdempotencyStore(model, options = {}) {
88
+ const retentionMs = (options.retentionSeconds ?? DEFAULT_RETENTION_SECONDS) * 1e3;
89
+ const claims = () => model.collection;
90
+ const toDoc = (claim) => ({
91
+ ...claim,
92
+ _id: identityKey(claim.identity),
93
+ purgeAt: new Date(Date.now() + retentionMs)
94
+ });
95
+ /** The caller's transaction, so a claim commits or rolls back with the writes it describes. */
96
+ const withSession = (options) => options?.session ? { session: options.session } : {};
97
+ const ownedInFlight = (identity, leaseToken) => ({
98
+ _id: identityKey(identity),
99
+ state: "in_flight",
100
+ leaseToken
101
+ });
102
+ return {
103
+ async get(identity, options) {
104
+ const doc = await claims().findOne({ _id: identityKey(identity) }, withSession(options));
105
+ if (!doc) return null;
106
+ const { _id, purgeAt, ...claim } = doc;
107
+ return claim;
108
+ },
109
+ async insert(claim, options) {
110
+ try {
111
+ await claims().insertOne(toDoc(claim), withSession(options));
112
+ return true;
113
+ } catch (error) {
114
+ if (error.code === 11e3) return false;
115
+ throw error;
116
+ }
117
+ },
118
+ async swap(identity, expectedLeaseToken, next, options) {
119
+ return (await claims().replaceOne(ownedInFlight(identity, expectedLeaseToken), toDoc(next), withSession(options))).matchedCount === 1;
120
+ },
121
+ async release(identity, expectedLeaseToken, options) {
122
+ return (await claims().deleteOne(ownedInFlight(identity, expectedLeaseToken), withSession(options))).deletedCount === 1;
123
+ },
124
+ async listLapsed(operation, now, limit) {
125
+ return (await claims().find({
126
+ "identity.operation": operation,
127
+ state: "in_flight",
128
+ leaseExpiresAt: { $lte: now }
129
+ }).sort({ leaseExpiresAt: 1 }).limit(limit).toArray()).map(({ _id, purgeAt, ...claim }) => claim);
130
+ }
131
+ };
132
+ }
133
+ //#endregion
134
+ export { createIdempotencyModel, createIdempotencyStore };
package/dist/index.d.mts CHANGED
@@ -2,18 +2,19 @@ import { _ as UpdateOptions, a as CreateOptions, b as LookupOptions, c as FindOn
2
2
  import { _ as PopulateSpec, a as CursorPayload, b as SortDirection, c as MongokitPageExtras, d as ValueType, f as CursorSecret, g as ObjectId, i as CountStrategy, l as OffsetPaginationOptions, m as AnyModel, n as BasePaginationOptions, o as DecodedCursor, p as AnyDocument, r as CollationOptions, s as KeysetPaginationOptions, t as AggregatePaginationOptions, u as PaginationConfig, v as ReadPreferenceType, x as SortSpec$1, y as SelectSpec } from "./pagination-BpIv2bdS.mjs";
3
3
  import { a as CreateManyFailure, l as isCreateManyPartialError, o as CreateManyPartial, s as CreateManyPartialError, t as index_d_exports } from "./index-CmjNyulu.mjs";
4
4
  import { a as InferRawDoc, c as NonNullableFields, d as Strict, f as UpdatePatch, i as InferDocument, l as PartialBy, n as DeepPartial, o as KeysOfType, p as UpdateWithValidationResult, r as DocField, s as MongoOperatorUpdate, t as CreateInput, u as RequiredBy } from "./type-utils-CLzRFtIA.mjs";
5
- import { S as RepositoryPluginName, _ as RepositoryOptions, a as HookMode, b as MONGOKIT_PLUGIN_NAMES, c as MinimalRepoView, d as PluginType, f as PrioritizedHook, g as RepositoryOperation, h as RepositoryInstance, i as EventPhase, l as Plugin, m as RepositoryEvent, n as EventHandlers, o as Middleware, p as RepositoryContext, r as EventPayload, s as MiddlewareContext, t as AllPluginMethods, u as PluginFunction, v as UserContext, x as MongoKitPluginName, y as WithPlugins } from "./repository-ZbLtL7Nk.mjs";
6
- import { A as ensureAuditTrailReady, C as AuditTrailMethods, D as AuditTrailQueryOptions, E as AuditTrailQuery, O as EnsureAuditTrailReadyOptions, S as AuditQueryResult, T as AuditTrailOptions, _ 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, k as auditTrailPlugin, 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 AuditTrailMode, x as AuditQueryOptions, y as AuditEntry } from "./multi-tenant.plugin-B-tzNeYL.mjs";
5
+ import { S as RepositoryPluginName, _ as RepositoryOptions, a as HookMode, b as MONGOKIT_PLUGIN_NAMES, c as MinimalRepoView, d as PluginType, f as PrioritizedHook, g as RepositoryOperation, h as RepositoryInstance, i as EventPhase, l as Plugin, m as RepositoryEvent, n as EventHandlers, o as Middleware, p as RepositoryContext, r as EventPayload, s as MiddlewareContext, t as AllPluginMethods, u as PluginFunction, v as UserContext, x as MongoKitPluginName, y as WithPlugins } from "./repository-odl03582.mjs";
6
+ import { A as EnsureAuditTrailReadyOptions, C as AuditQueryOptions, D as AuditTrailOptions, E as AuditTrailMode, M as ensureAuditTrailReady, O as AuditTrailQuery, S as AuditOperation, T as AuditTrailMethods, _ as CacheOptions, a as DateSequentialIdOptions, b as cachePlugin, c as SequentialIdOptions, d as ensureSequenceAtLeast, f as getNextSequence, g as CacheAdapter, h as sequentialId, i as CustomIdOptions, j as auditTrailPlugin, k as AuditTrailQueryOptions, l as customIdPlugin, m as readSequence, n as adminBypass, o as IdGenerator, p as prefixedId, r as multiTenantPlugin, s as PrefixedIdOptions, t as MultiTenantOptions, u as dateSequentialId, v as RepositoryCacheHandle, w as AuditQueryResult, x as AuditEntry, y as RepositoryCachePluginOptions } from "./multi-tenant.plugin-CBgCo9im.mjs";
7
7
  import { t as PaginationEngine } from "./PaginationEngine-D-P19Y9m.mjs";
8
- import { a as AggregationPlan, c as SortOrder, i as AggregationBuilder, l as SortSpec, n as Repository, o as GroupSpec, r as TransitionMachine, s as ProjectionSpec, t as HOOK_PRIORITY, u as VectorSearchOptions } from "./Repository-IxI983_m.mjs";
9
- import { a as SoftDeleteFilterMode, c as ValidationChainOptions, i as Logger, l as ValidatorDefinition, n as CascadeRelation, o as SoftDeleteOptions, r as FieldPreset, s as SoftDeleteRepository, t as CascadeOptions } from "./plugin-options-BuvtOSZf.mjs";
10
- import { n as CreateRepositoryConfig, r as createRepository, t as AuditConfig } from "./create-repository-CRXjDa3N.mjs";
11
- import { A as IdempotencyStoreMethods, B as auditLogPlugin, C as LeaseMethods, D as ImmutableStatesPluginOptions, E as ImmutableClaimView, F as elasticSearchPlugin, H as appendOnlyPlugin, I as cascadePlugin, L as BatchOperationsMethods, M as idempotencyStorePlugin, N as fieldFilterPlugin, O as immutableStatesPlugin, P as ElasticSearchOptions, R as BulkWriteResult, S as methodRegistryPlugin, T as leasePlugin, U as AggregateHelpersMethods, V as AppendOnlyPluginOptions, W as aggregateHelpersPlugin, _ as OperationMetric, a as requireField, b as mongoOperationsPlugin, c as timestampPlugin, d as createTenantContext, f as SubdocumentMethods, g as ObservabilityOptions, h as softDeletePlugin, i as immutableField, j as IdempotencyStorePluginOptions, k as IdempotencyClaim, l as TenantContext, m as SoftDeleteMethods, n as autoInject, o as uniqueField, p as subdocumentPlugin, r as blockIf, s as validationChainPlugin, t as OperationType, u as TenantStore, v as observabilityPlugin, w as LeasePluginOptions, y as MongoOperationsMethods, z as batchOperationsPlugin } from "./validation-chain.plugin-DvrLJIbJ.mjs";
8
+ import { a as AggregationBuilder, c as ProjectionSpec, d as VectorSearchOptions, i as TransitionMachine, l as SortOrder, n as HOOK_PRIORITY, o as AggregationPlan, r as Repository, s as GroupSpec, t as GetAllParams, u as SortSpec } from "./Repository-CR8Y9g2E.mjs";
9
+ import { a as SoftDeleteFilterMode, c as ValidationChainOptions, i as Logger, l as ValidatorDefinition, n as CascadeRelation, o as SoftDeleteOptions, r as FieldPreset, s as SoftDeleteRepository, t as CascadeOptions } from "./plugin-options-Zk46lD6F.mjs";
10
+ import { n as CreateRepositoryConfig, r as createRepository, t as AuditConfig } from "./create-repository-CAle1MSU.mjs";
11
+ import { A as IdempotencyStoreMethods, B as batchOperationsPlugin, C as LeaseMethods, D as ImmutableStatesPluginOptions, E as ImmutableClaimView, F as elasticSearchPlugin, G as aggregateHelpersPlugin, H as AppendOnlyPluginOptions, I as cascadePlugin, L as BatchOperationsMethods, M as idempotencyStorePlugin, N as fieldFilterPlugin, O as immutableStatesPlugin, P as ElasticSearchOptions, R as BulkWriteOptions, S as methodRegistryPlugin, T as leasePlugin, U as appendOnlyPlugin, V as auditLogPlugin, W as AggregateHelpersMethods, _ as OperationMetric, a as requireField, b as mongoOperationsPlugin, c as timestampPlugin, d as createTenantContext, f as SubdocumentMethods, g as ObservabilityOptions, h as softDeletePlugin, i as immutableField, j as IdempotencyStorePluginOptions, k as IdempotencyClaim, l as TenantContext, m as SoftDeleteMethods, n as autoInject, o as uniqueField, p as subdocumentPlugin, r as blockIf, s as validationChainPlugin, t as OperationType, u as TenantStore, v as observabilityPlugin, w as LeasePluginOptions, y as MongoOperationsMethods, z as BulkWriteResult } from "./validation-chain.plugin-DYp9E7K2.mjs";
12
12
  import { n as SchemaPathsLike, t as FieldType$1 } from "./coercion-BjdPX3YF.mjs";
13
13
  import { n as SchemaIndexes } from "./indexes-DIjMpYES.mjs";
14
- import { S as parseDuplicateKeyError, _ as getMongooseProjection, a as createMemoryCache, b as createError, g as getFieldsForUser, h as filterResponseData, i as buildCrudSchemasFromMongooseSchema, m as createFieldPreset, n as CrudSchemasFramework, o as LoggerConfig, r as buildCrudSchemasFromModel, s as configureLogger, t as toPlain, u as idVariants, v as CreateErrorOptions, x as isDuplicateKeyError, y as ParseDuplicateKeyOptions } from "./to-plain-B8ufk3Qz.mjs";
14
+ import { S as parseDuplicateKeyError, _ as getMongooseProjection, a as createMemoryCache, b as createError, g as getFieldsForUser, h as filterResponseData, i as buildCrudSchemasFromMongooseSchema, m as createFieldPreset, n as CrudSchemasFramework, o as LoggerConfig, r as buildCrudSchemasFromModel, s as configureLogger, t as toPlain, u as idVariants, v as CreateErrorOptions, x as isDuplicateKeyError, y as ParseDuplicateKeyOptions } from "./to-plain-k7SjNlSS.mjs";
15
15
  import { RepoCapabilities } from "@classytic/repo-core/repository";
16
16
  import { ClientSession, Connection, Model, PipelineStage, Schema } from "mongoose";
17
+ import "@classytic/repo-core/query-parser";
17
18
  //#region src/actions/cascade-references.d.ts
18
19
  type PurgeMode = 'hard' | 'soft' | 'anonymize';
19
20
  /** Raw collection surface — a native MongoDB `Collection` or a Mongoose `Model`. */
@@ -837,6 +838,35 @@ declare function isTransactionUnsupported(error: Error): boolean;
837
838
  */
838
839
  declare function supportsTransactions(connection: unknown): boolean;
839
840
  //#endregion
841
+ //#region src/utils/scope.d.ts
842
+ /** The fields that decide whose rows an operation touches, and inside which transaction. */
843
+ interface RepoScope {
844
+ /** Platform-admin escape hatch. Present only when the source carried no tenant. */
845
+ bypassTenant?: true;
846
+ session?: ClientSession;
847
+ user?: unknown;
848
+ userId?: unknown;
849
+ requestId?: unknown;
850
+ /** Tenant values, keyed by each declared tenant context key (`organizationId`, …). */
851
+ [tenantKey: string]: unknown;
852
+ }
853
+ /**
854
+ * Record that `repo` resolves its tenant from `contextKey`. Called by
855
+ * `multiTenantPlugin` at bind, so forwarding knows a custom key (`branchId`)
856
+ * without the host restating it.
857
+ */
858
+ declare function declareTenantContextKey(repo: object, contextKey: string): void;
859
+ /** Every tenant context key relevant to a call spanning these repositories. */
860
+ declare function tenantContextKeysOf(...repos: ReadonlyArray<object | undefined>): string[];
861
+ /**
862
+ * The scope to hand a second repository call made on behalf of `source`
863
+ * (a hook's `RepositoryContext`, or a host's request context).
864
+ *
865
+ * Absent values are omitted, never written as `undefined`, so spreading the
866
+ * result into an options bag cannot erase a value set there.
867
+ */
868
+ declare function forwardScope(source: Record<string, unknown> | null | undefined, tenantKeys?: readonly string[]): RepoScope;
869
+ //#endregion
840
870
  //#region src/utils/repo-options.d.ts
841
871
  /**
842
872
  * Forward request-scoped context fields into a mongokit options bag.
@@ -883,23 +913,20 @@ declare function supportsTransactions(connection: unknown): boolean;
883
913
  * });
884
914
  * ```
885
915
  *
886
- * The fields read (all optional — extracted only when present and not
887
- * `undefined`):
888
- *
889
- * - `organizationId` — multi-tenant scope key. The
890
- * `multiTenantPlugin` casts to `ObjectId` automatically when
891
- * configured with `fieldType: 'objectId'`; do NOT pre-cast.
892
- * - `userId` / `user` — audit attribution (audit-log + audit-trail
893
- * plugins read these for the `who` column).
894
- * - `session` — mongoose `ClientSession` for transaction threading.
895
- * - `requestId` — observability correlation id.
896
- *
897
- * Fields beyond this set should be added inline at the call site —
898
- * `repoOptionsFromCtx` deliberately stays narrow so adding a new
899
- * convention to the canonical set is a deliberate API decision, not
900
- * a quiet drift.
916
+ * It is `forwardScope` (see `./scope.ts`), the same rule every internal
917
+ * hop uses, so a request context and a cascade forward identically:
918
+ *
919
+ * - the tenant (`organizationId`, `tenantId`) — `multiTenantPlugin` casts
920
+ * to `ObjectId` itself when configured with `fieldType: 'objectId'`;
921
+ * do NOT pre-cast;
922
+ * - `bypassTenant`, only when literally `true` AND no tenant is present
923
+ * (the tenant plugin honours a bypass before a tenant, so carrying both
924
+ * would widen a scoped call to every tenant);
925
+ * - `session`, and `user` / `userId` / `requestId` for attribution.
926
+ *
927
+ * Domain fields beyond this set belong to `createOptionsExtractor`.
901
928
  */
902
- declare function repoOptionsFromCtx<TCtx extends Record<string, unknown>>(ctx: TCtx | undefined | null): Record<string, unknown>;
929
+ declare function repoOptionsFromCtx<TCtx extends Record<string, unknown>>(ctx: TCtx | undefined | null): RepoScope;
903
930
  /**
904
931
  * Build a typed extractor for **consumer-defined** ctx → options
905
932
  * forwarding. Same conceptual shape as `repoOptionsFromCtx`, but the
@@ -920,12 +947,11 @@ declare function repoOptionsFromCtx<TCtx extends Record<string, unknown>>(ctx: T
920
947
  * output keys are inferred from the input field tuple — you can
921
948
  * destructure with full autocomplete.
922
949
  *
923
- * **Difference from `repoOptionsFromCtx`.** That helper hardcodes the
924
- * fields **mongokit's bundled plugins** read (`organizationId`,
925
- * `userId`, `user`, `session`, `requestId`). Use it when those are
926
- * sufficient. Reach for `createOptionsExtractor` when your domain has
927
- * its own canonical fields (`actorRef`, `actorKind`, `correlationId`,
928
- * `idempotencyKey`, `sagaRunId`, ...) that should also forward.
950
+ * **Scope is always included, and never from `fields`.** The extractor
951
+ * returns `forwardScope(ctx)` plus the declared DOMAIN fields. Listing a
952
+ * scope key (`organizationId`, `bypassTenant`, `session`, …) in `fields`
953
+ * changes nothing: those follow the one scope rule, so an extractor cannot
954
+ * forget the bypass, or carry a bypass beside a tenant.
929
955
  *
930
956
  * @example Per-package canonical extractor
931
957
  * ```ts
@@ -940,12 +966,12 @@ declare function repoOptionsFromCtx<TCtx extends Record<string, unknown>>(ctx: T
940
966
  * idempotencyKey?: string;
941
967
  * };
942
968
  *
969
+ * // Domain fields only: the scope (organizationId, session, bypass) is
970
+ * // always included by the one scope rule.
943
971
  * export const repoOptionsFromCtx = createOptionsExtractor<CommissionCtx>([
944
- * 'organizationId',
945
972
  * 'actorRef',
946
973
  * 'actorKind',
947
974
  * 'correlationId',
948
- * 'session',
949
975
  * 'idempotencyKey',
950
976
  * ]);
951
977
  *
@@ -1036,4 +1062,4 @@ declare function createOptionsExtractor<TCtx extends Record<string, unknown>>(fi
1036
1062
  */
1037
1063
  declare function systemContext(extra?: SessionOptions): SessionOptions;
1038
1064
  //#endregion
1039
- export { ALL_OPERATIONS, type AggregateHelpersMethods, type AggregateOptions, type AggregatePaginationOptions, AggregationBuilder, type AggregationPlan, type SortOrder as AggregationSortOrder, type SortSpec as AggregationSortSpec, type AllPluginMethods, type AnyDocument, type AnyModel, type AppendOnlyPluginOptions, type AuditConfig, type AuditEntry, type AuditOperation, type AuditQueryOptions, type AuditQueryResult, type AuditTrailMethods, type AuditTrailMode, type AuditTrailOptions, AuditTrailQuery, type AuditTrailQueryOptions, type BasePaginationOptions, type BatchOperationsMethods, type BulkWriteResult, type CacheAdapter, type CacheOperationOptions, type CacheOptions, type CacheableOptions, type CapabilityConnectionLike, type CapabilityProbeOptions, type CapabilityResolution, type CascadeOptions, type CascadePurgeReferencesOptions, type CascadeRelation, type CollationOptions, type CollectionRWLike, type ConvenientTransactionOptions, type CountStrategy, type CreateErrorOptions, type CreateInput, type CreateManyFailure, type CreateManyPartial, type CreateManyPartialError, type CreateOptions, type CreateRepositoryConfig, type CrudSchemasFramework, type CursorPayload, type CursorSecret, type CustomIdOptions, type DateSequentialIdOptions, type DecodedCursor, type DeepPartial, type DefineModelOptions, type DeleteResult, type DocField, type ElasticSearchOptions, type EnsureAuditTrailReadyOptions, type EventHandlers, type EventPayload, type EventPhase, type ExistingModelPolicy, type FieldPreset, type FieldType, type FilterQuery, type FindOneAndUpdateOptions, type GroupResult, type GroupSpec, HOOK_PRIORITY, type HookMode, type IdGenerator, type IdempotencyClaim, type IdempotencyStoreMethods, type IdempotencyStorePluginOptions, type ImmutableClaimView, type ImmutableStatesPluginOptions, type InferDocument, type InferRawDoc, type KeysOfType, type KeysetPaginationOptions, type LeaseMethods, type LeasePluginOptions, type Logger, type LoggerConfig, LookupBuilder, type LookupOptions, type LookupPopulateOptions, type LookupPopulateResult, MONGOKIT_CAPABILITIES, MONGOKIT_PLUGIN_NAMES, MUTATING_OPERATIONS, type Middleware, type MiddlewareContext, type MinMaxResult, type MinimalRepoView, type ModelBlueprint, ModelCollisionError, type ModelSpec, type MongoKitPluginName, type MongoOperationsMethods, type MongoOperatorUpdate, type MongoRepoCapabilities, type MongokitPageExtras, type MultiTenantOptions, type NonNullableFields, OP_REGISTRY, type ObjectId, type ObservabilityOptions, type OffsetPaginationOptions, type OperationDescriptor, type OperationMetric, type OperationOptions, type OperationType, type PaginationConfig, type PaginationDefaults, PaginationEngine, type ParseDuplicateKeyOptions, type ParsedQuery, type PartialBy, type Plugin, type PluginFunction, type PluginType, type PolicyKey, type PopulateOption, type PopulateSpec, type PrefixedIdOptions, type PrioritizedHook, type ProjectionSpec, type PurgeMode, type PurgeableRepoLike, QueryParser, type QueryParserOptions, type QuerySchema, READ_OPERATIONS, type ReadOptions, type ReadPreferenceType, type ReferencePurgeResult, type ReferenceRelation, Repository, Repository as default, type RepositoryCacheHandle, type RepositoryCachePluginOptions, type RepositoryContext, type RepositoryEvent, type RepositoryInstance, type RepositoryOperation, type RepositoryOptions, type RepositoryPluginName, type RequiredBy, type SchemaLike, type SearchMode, type SelectSpec, type SequentialIdOptions, type SessionOptions, type SessionStarter, type SoftDeleteFilterMode, type SoftDeleteMethods, type SoftDeleteOptions, type SoftDeleteRepository, type SortDirection, type SortSpec$1 as SortSpec, type Strict, type SubdocumentMethods, type TenantContext, type TenantStore, type TransactionSupport, type TransitionMachine, type UpdateManyResult, type UpdateOptions, type UpdatePatch, type UpdateWithValidationResult, type UserContext, type ValidationChainOptions, type ValidatorDefinition, type ValueType, type VectorSearchOptions, type WithPlugins, type WithTransactionOptions, index_d_exports as actions, adminBypass, aggregateHelpersPlugin, appendOnlyPlugin, auditLogPlugin, auditTrailPlugin, autoInject, batchOperationsPlugin, batchTransaction, blockIf, buildCrudSchemasFromModel, buildCrudSchemasFromMongooseSchema, cachePlugin, capabilitiesForSupport, cascadePlugin, cascadePurgeReferences, classifyHelloReply, compileFilterToMongo, configureLogger, configurePaginationDefaults, createError, createFieldPreset, createMemoryCache, createOptionsExtractor, createRepository, createTenantContext, customIdPlugin, dateSequentialId, defineModel, defineModels, elasticSearchPlugin, ensureAuditTrailReady, fieldFilterPlugin, filterResponseData, getFieldsForUser, getMongooseProjection, getNextSequence, getPaginationDefaults, idVariants, idempotencyStorePlugin, immutableField, immutableStatesPlugin, isCreateManyPartialError, isDuplicateKeyError, isModelRegistered, isTransactionUnsupported, leasePlugin, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, operationsByPolicyKey, parseDuplicateKeyError, prefixedId, probeMongoCapabilities, repoOptionsFromCtx, requireField, resetCapabilityProbeCache, resetPaginationDefaults, resolveMongoCapabilities, resolveTransactionSupport, sequentialId, softDeletePlugin, subdocumentPlugin, supportsTransactions, systemContext, timestampPlugin, toPlain, transactionResolutionOf, uniqueField, validationChainPlugin, withTransaction };
1065
+ export { ALL_OPERATIONS, type AggregateHelpersMethods, type AggregateOptions, type AggregatePaginationOptions, AggregationBuilder, type AggregationPlan, type SortOrder as AggregationSortOrder, type SortSpec as AggregationSortSpec, type AllPluginMethods, type AnyDocument, type AnyModel, type AppendOnlyPluginOptions, type AuditConfig, type AuditEntry, type AuditOperation, type AuditQueryOptions, type AuditQueryResult, type AuditTrailMethods, type AuditTrailMode, type AuditTrailOptions, AuditTrailQuery, type AuditTrailQueryOptions, type BasePaginationOptions, type BatchOperationsMethods, type BulkWriteOptions, type BulkWriteResult, type CacheAdapter, type CacheOperationOptions, type CacheOptions, type CacheableOptions, type CapabilityConnectionLike, type CapabilityProbeOptions, type CapabilityResolution, type CascadeOptions, type CascadePurgeReferencesOptions, type CascadeRelation, type CollationOptions, type CollectionRWLike, type ConvenientTransactionOptions, type CountStrategy, type CreateErrorOptions, type CreateInput, type CreateManyFailure, type CreateManyPartial, type CreateManyPartialError, type CreateOptions, type CreateRepositoryConfig, type CrudSchemasFramework, type CursorPayload, type CursorSecret, type CustomIdOptions, type DateSequentialIdOptions, type DecodedCursor, type DeepPartial, type DefineModelOptions, type DeleteResult, type DocField, type ElasticSearchOptions, type EnsureAuditTrailReadyOptions, type EventHandlers, type EventPayload, type EventPhase, type ExistingModelPolicy, type FieldPreset, type FieldType, type FilterQuery, type FindOneAndUpdateOptions, type GetAllParams, type GroupResult, type GroupSpec, HOOK_PRIORITY, type HookMode, type IdGenerator, type IdempotencyClaim, type IdempotencyStoreMethods, type IdempotencyStorePluginOptions, type ImmutableClaimView, type ImmutableStatesPluginOptions, type InferDocument, type InferRawDoc, type KeysOfType, type KeysetPaginationOptions, type LeaseMethods, type LeasePluginOptions, type Logger, type LoggerConfig, LookupBuilder, type LookupOptions, type LookupPopulateOptions, type LookupPopulateResult, MONGOKIT_CAPABILITIES, MONGOKIT_PLUGIN_NAMES, MUTATING_OPERATIONS, type Middleware, type MiddlewareContext, type MinMaxResult, type MinimalRepoView, type ModelBlueprint, ModelCollisionError, type ModelSpec, type MongoKitPluginName, type MongoOperationsMethods, type MongoOperatorUpdate, type MongoRepoCapabilities, type MongokitPageExtras, type MultiTenantOptions, type NonNullableFields, OP_REGISTRY, type ObjectId, type ObservabilityOptions, type OffsetPaginationOptions, type OperationDescriptor, type OperationMetric, type OperationOptions, type OperationType, type PaginationConfig, type PaginationDefaults, PaginationEngine, type ParseDuplicateKeyOptions, type ParsedQuery, type PartialBy, type Plugin, type PluginFunction, type PluginType, type PolicyKey, type PopulateOption, type PopulateSpec, type PrefixedIdOptions, type PrioritizedHook, type ProjectionSpec, type PurgeMode, type PurgeableRepoLike, QueryParser, type QueryParserOptions, type QuerySchema, READ_OPERATIONS, type ReadOptions, type ReadPreferenceType, type ReferencePurgeResult, type ReferenceRelation, type RepoScope, Repository, Repository as default, type RepositoryCacheHandle, type RepositoryCachePluginOptions, type RepositoryContext, type RepositoryEvent, type RepositoryInstance, type RepositoryOperation, type RepositoryOptions, type RepositoryPluginName, type RequiredBy, type SchemaLike, type SearchMode, type SelectSpec, type SequentialIdOptions, type SessionOptions, type SessionStarter, type SoftDeleteFilterMode, type SoftDeleteMethods, type SoftDeleteOptions, type SoftDeleteRepository, type SortDirection, type SortSpec$1 as SortSpec, type Strict, type SubdocumentMethods, type TenantContext, type TenantStore, type TransactionSupport, type TransitionMachine, type UpdateManyResult, type UpdateOptions, type UpdatePatch, type UpdateWithValidationResult, type UserContext, type ValidationChainOptions, type ValidatorDefinition, type ValueType, type VectorSearchOptions, type WithPlugins, type WithTransactionOptions, index_d_exports as actions, adminBypass, aggregateHelpersPlugin, appendOnlyPlugin, auditLogPlugin, auditTrailPlugin, autoInject, batchOperationsPlugin, batchTransaction, blockIf, buildCrudSchemasFromModel, buildCrudSchemasFromMongooseSchema, cachePlugin, capabilitiesForSupport, cascadePlugin, cascadePurgeReferences, classifyHelloReply, compileFilterToMongo, configureLogger, configurePaginationDefaults, createError, createFieldPreset, createMemoryCache, createOptionsExtractor, createRepository, createTenantContext, customIdPlugin, dateSequentialId, declareTenantContextKey, defineModel, defineModels, elasticSearchPlugin, ensureAuditTrailReady, ensureSequenceAtLeast, fieldFilterPlugin, filterResponseData, forwardScope, getFieldsForUser, getMongooseProjection, getNextSequence, getPaginationDefaults, idVariants, idempotencyStorePlugin, immutableField, immutableStatesPlugin, isCreateManyPartialError, isDuplicateKeyError, isModelRegistered, isTransactionUnsupported, leasePlugin, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, operationsByPolicyKey, parseDuplicateKeyError, prefixedId, probeMongoCapabilities, readSequence, repoOptionsFromCtx, requireField, resetCapabilityProbeCache, resetPaginationDefaults, resolveMongoCapabilities, resolveTransactionSupport, sequentialId, softDeletePlugin, subdocumentPlugin, supportsTransactions, systemContext, tenantContextKeysOf, timestampPlugin, toPlain, transactionResolutionOf, uniqueField, validationChainPlugin, withTransaction };