@classytic/mongokit 3.25.0 → 3.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Classytic (Sadman Chowdhury)
3
+ Copyright (c) 2024 Classytic LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/@classytic%2Fmongokit.svg)](https://www.npmjs.com/package/@classytic/mongokit)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Sponsor](https://img.shields.io/github/sponsors/classytic?style=flat-square&label=Sponsor&logo=GitHub&color=EA4AAA)](https://github.com/sponsors/classytic)
5
6
 
6
7
  Production-ready repository layer for Mongoose apps: tenant-safe CRUD, soft delete, pagination, hooks, retries, transactions, change streams, and plugins.
7
8
 
@@ -17,7 +18,10 @@ Requirements:
17
18
 
18
19
  - Node.js `>=22`
19
20
  - Mongoose `>=9.4.1`
20
- - `@classytic/repo-core >=0.7.0`
21
+ - `@classytic/repo-core >=0.19.0`
22
+ - `mongodb-memory-server >=10.4.3` — **optional**, needed only by the
23
+ `@classytic/mongokit/testkit` subpath (declared as an optional peer, so it is
24
+ never installed for consumers that don't use it)
21
25
 
22
26
  ## Quick Start
23
27
 
@@ -429,3 +433,10 @@ All accept `{ replset?, dbName?, uri? }`.
429
433
  ## License
430
434
 
431
435
  MIT
436
+
437
+
438
+ ## Trademark
439
+
440
+ The code is MIT-licensed. **"Classytic", "arc", and the logos are trademarks of
441
+ Classytic LLC** and are **not** licensed under MIT — see [TRADEMARK.md](TRADEMARK.md).
442
+ Forks must be renamed; the license covers the code, not the brand.
package/TRADEMARK.md ADDED
@@ -0,0 +1,22 @@
1
+ # Trademark Notice
2
+
3
+ The **source code** in this package is licensed under the MIT License (see
4
+ [LICENSE](LICENSE)). Trademarks are **not** part of that license.
5
+
6
+ **"Classytic", "arc", the Classytic and arc logos**, and related names and marks
7
+ are trademarks of **Classytic LLC** (Wyoming, USA). The MIT License covers the
8
+ code only — it grants **no right** to use Classytic LLC's names, logos, or brand.
9
+
10
+ ## You may
11
+ - use, fork, modify, and redistribute the **code** under the MIT License;
12
+ - state truthfully that your product "uses" or "is built on" arc / Classytic
13
+ software, without implying endorsement.
14
+
15
+ ## You may not (without written permission from Classytic LLC)
16
+ - use "Classytic", "arc", or confusingly similar names as the name of your own
17
+ product, package, company, or service;
18
+ - use the Classytic / arc logos or brand styling;
19
+ - imply sponsorship, affiliation, or endorsement by Classytic LLC.
20
+
21
+ Forks or redistributions must be **renamed** so they are not confused with the
22
+ official project. Permission / questions: **trademark@classytic.com**.
@@ -1,5 +1,5 @@
1
1
  import { i as isValidIdForType, t as getSchemaIdType } from "./id-resolution-BqDrk0S2.mjs";
2
- import { a as count, b as LookupBuilder, c as getByQuery, d as deleteById, f as deleteByQuery, h as createMany, l as getOrCreate, m as create, n as update, o as exists, r as updateByQuery, s as getById, t as findOneAndUpdate, x as compileFilterToMongo, y as distinct } from "./update-1Lq9OMD2.mjs";
2
+ import { a as count, b as LookupBuilder, c as getByQuery, d as deleteById, f as deleteByQuery, h as createMany, l as getOrCreate, m as create, n as update, o as exists, r as updateByQuery, s as getById, t as findOneAndUpdate, x as compileFilterToMongo, y as distinct } from "./update-CI2NdAW6.mjs";
3
3
  import { n as warn } from "./logger-K7dPmu2U.mjs";
4
4
  import { n as isDuplicateKeyError, r as parseDuplicateKeyError, t as createError } from "./error-BuByZwKU.mjs";
5
5
  import { t as PaginationEngine } from "./PaginationEngine-CczbvCAq.mjs";
@@ -16,20 +16,56 @@ import { decodeAggCursor, encodeAggCursor, isKeysetMode, normalizeGroupBy, valid
16
16
  * predicate the purge targets.
17
17
  */
18
18
  function createMongoPurgePort(repo, field, value, session) {
19
- const filter = { [field]: value };
19
+ return createKeysetPurgePort(repo, { [field]: value }, session);
20
+ }
21
+ /**
22
+ * Build a `PurgePort` bound to a repository + a pre-compiled Mongo filter
23
+ * (the repository compiles Filter IR via `compileFilterToMongo` before
24
+ * calling this) — the range/filter-scoped sibling of
25
+ * {@link createMongoPurgePort}.
26
+ *
27
+ * The per-strategy chunk logic is IDENTICAL to the equality-bound port; the
28
+ * only difference is the base predicate — an arbitrary compiled filter (a
29
+ * `civilDate` window, a retention cutoff, a compound cohort) instead of
30
+ * `{ [field]: value }`. The narrowed write is re-asserted on
31
+ * `{ _id: { $in: ids }, ...filter }`, the same defense the equality port
32
+ * uses, so a row that leaves the matching set between the id select and the
33
+ * write is never touched.
34
+ *
35
+ * Mirrors `createMongoArchivePort`, which likewise binds a pre-compiled
36
+ * filter rather than a `field/value` pair.
37
+ */
38
+ function createMongoPurgePortFromFilter(repo, filter, session) {
39
+ return createKeysetPurgePort(repo, filter, session);
40
+ }
41
+ /**
42
+ * Shared keyset-progressed port both public factories delegate to. The
43
+ * closure's `cursor` is the port's single-run progression state.
44
+ */
45
+ function createKeysetPurgePort(repo, baseFilter, session) {
20
46
  const baseOpts = {
21
47
  session,
22
48
  bypassTenant: true
23
49
  };
50
+ let cursor = null;
51
+ const selectFilter = () => cursor == null ? baseFilter : {
52
+ ...baseFilter,
53
+ _id: { $gt: cursor }
54
+ };
24
55
  return { async purgeChunk(strategy, limit) {
25
56
  if (strategy.type === "anonymize") {
26
- if (Object.values(strategy.fields).some((v) => typeof v === "function")) return purgeAnonymizeFunctional(repo, filter, strategy.fields, limit, session);
57
+ if (Object.values(strategy.fields).some((v) => typeof v === "function")) {
58
+ const { processed, lastId } = await purgeAnonymizeFunctional(repo, selectFilter(), strategy.fields, limit, session);
59
+ if (lastId != null) cursor = lastId;
60
+ return processed;
61
+ }
27
62
  }
28
- const idDocs = await repo.Model.find(filter, { _id: 1 }).limit(limit).session(session ?? null).lean().exec();
63
+ const idDocs = await repo.Model.find(selectFilter(), { _id: 1 }).sort({ _id: 1 }).limit(limit).session(session ?? null).lean().exec();
29
64
  if (idDocs.length === 0) return 0;
65
+ const ids = idDocs.map((d) => d._id);
30
66
  const chunkFilter = {
31
- _id: { $in: idDocs.map((d) => d._id) },
32
- [field]: value
67
+ ...baseFilter,
68
+ _id: { $in: ids }
33
69
  };
34
70
  switch (strategy.type) {
35
71
  case "hard":
@@ -37,17 +73,19 @@ function createMongoPurgePort(repo, field, value, session) {
37
73
  ...baseOpts,
38
74
  mode: "hard"
39
75
  });
40
- return idDocs.length;
76
+ break;
41
77
  case "soft":
42
78
  await repo.updateMany(chunkFilter, { $set: {
43
79
  [strategy.deletedField ?? "deleted"]: true,
44
80
  [strategy.deletedAtField ?? "deletedAt"]: /* @__PURE__ */ new Date()
45
81
  } }, baseOpts);
46
- return idDocs.length;
82
+ break;
47
83
  case "anonymize":
48
84
  await repo.updateMany(chunkFilter, { $set: strategy.fields }, baseOpts);
49
- return idDocs.length;
85
+ break;
50
86
  }
87
+ cursor = ids[ids.length - 1];
88
+ return idDocs.length;
51
89
  } };
52
90
  }
53
91
  /**
@@ -56,13 +94,20 @@ function createMongoPurgePort(repo, field, value, session) {
56
94
  * heterogeneous `updateOne` ops. Two round-trips per chunk regardless
57
95
  * of N — vs the N+1 of per-doc `update()` fan-out.
58
96
  *
97
+ * Selection is `_id`-ascending against the caller's keyset-narrowed
98
+ * filter; returns the chunk's last `_id` so the port can advance its
99
+ * cursor after the write commits.
100
+ *
59
101
  * Mongo's `bulkWrite` is ordered: false → independent failures don't
60
102
  * abort the batch. For idempotent anonymize (same row anonymized twice
61
103
  * is the same write), this matches the at-least-once contract.
62
104
  */
63
- async function purgeAnonymizeFunctional(repo, filter, fields, limit, session) {
64
- const docs = await repo.Model.find(filter).limit(limit).session(session ?? null).lean().exec();
65
- if (docs.length === 0) return 0;
105
+ async function purgeAnonymizeFunctional(repo, selectFilter, fields, limit, session) {
106
+ const docs = await repo.Model.find(selectFilter).sort({ _id: 1 }).limit(limit).session(session ?? null).lean().exec();
107
+ if (docs.length === 0) return {
108
+ processed: 0,
109
+ lastId: null
110
+ };
66
111
  const operations = docs.map((doc) => {
67
112
  const set = {};
68
113
  for (const [k, v] of Object.entries(fields)) set[k] = typeof v === "function" ? v(doc) : v;
@@ -75,7 +120,10 @@ async function purgeAnonymizeFunctional(repo, filter, fields, limit, session) {
75
120
  ordered: false,
76
121
  session: session ?? void 0
77
122
  });
78
- return docs.length;
123
+ return {
124
+ processed: docs.length,
125
+ lastId: docs[docs.length - 1]?._id ?? null
126
+ };
79
127
  }
80
128
  //#endregion
81
129
  //#region src/capabilities.ts
@@ -97,6 +145,7 @@ const MONGOKIT_CAPABILITIES = {
97
145
  getOrCreate: true,
98
146
  countAndExists: true,
99
147
  purgeByField: true,
148
+ purgeByFilter: true,
100
149
  archiveByFilter: true,
101
150
  arrayOperators: true,
102
151
  regexFilter: true,
@@ -268,6 +317,122 @@ function applyExecutionHints(aggregation, hints) {
268
317
  if (hints.indexHint !== void 0) aggregation.option({ hint: hints.indexHint });
269
318
  }
270
319
  //#endregion
320
+ //#region src/filter/cast-schema.ts
321
+ /** Operators whose operand is a single scalar to cast. */
322
+ const SCALAR_OPS = /* @__PURE__ */ new Set([
323
+ "$eq",
324
+ "$ne",
325
+ "$gt",
326
+ "$gte",
327
+ "$lt",
328
+ "$lte"
329
+ ]);
330
+ /** Operators whose operand is an array of scalars to cast element-wise. */
331
+ const ARRAY_OPS = /* @__PURE__ */ new Set(["$in", "$nin"]);
332
+ /** Logical operators whose operand is an ARRAY of sub-filters. */
333
+ const LOGICAL_ARRAY_OPS = /* @__PURE__ */ new Set([
334
+ "$and",
335
+ "$or",
336
+ "$nor"
337
+ ]);
338
+ /** Logical operators whose operand is a SINGLE nested sub-filter. */
339
+ const LOGICAL_OBJECT_OPS = /* @__PURE__ */ new Set(["$not"]);
340
+ function isPlainObject(value) {
341
+ return value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date);
342
+ }
343
+ /**
344
+ * Cast one value through a schema path. Returns the original value when the
345
+ * path is unknown, the value is nullish, or the cast throws — never raises.
346
+ */
347
+ function castValue(schema, field, value) {
348
+ if (value === null || value === void 0) return value;
349
+ if (typeof value === "object" && !(value instanceof Date)) return value;
350
+ let schemaType;
351
+ try {
352
+ schemaType = schema.path(field);
353
+ } catch {
354
+ return value;
355
+ }
356
+ if (!schemaType || typeof schemaType.cast !== "function") return value;
357
+ try {
358
+ return schemaType.cast(value);
359
+ } catch {
360
+ return value;
361
+ }
362
+ }
363
+ /**
364
+ * Cast the operand(s) of a field-level operator object, leaving operators we
365
+ * don't understand (`$regex`, `$exists`, `$size`, `$elemMatch`, …) alone.
366
+ */
367
+ function castOperatorObject(schema, field, ops) {
368
+ let changed = false;
369
+ const out = {};
370
+ for (const [op, operand] of Object.entries(ops)) if (SCALAR_OPS.has(op)) {
371
+ const next = castValue(schema, field, operand);
372
+ out[op] = next;
373
+ if (next !== operand) changed = true;
374
+ } else if (ARRAY_OPS.has(op) && Array.isArray(operand)) {
375
+ const arr = operand.map((entry) => castValue(schema, field, entry));
376
+ out[op] = arr;
377
+ if (arr.some((v, i) => v !== operand[i])) changed = true;
378
+ } else out[op] = operand;
379
+ return changed ? out : ops;
380
+ }
381
+ /**
382
+ * Cast a record-shape Mongo filter against a Mongoose schema so it is safe to
383
+ * hand to a `$match` stage. Recurses `$and` / `$or` / `$nor` / `$not`, since a
384
+ * policy/tenant scope conjoined with a caller filter nests one level down.
385
+ *
386
+ * Filter IR nodes and non-objects pass through untouched — IR values are built
387
+ * in code (already correctly typed) and carry no schema paths to resolve.
388
+ *
389
+ * @example
390
+ * ```ts
391
+ * // organizationId is an ObjectId column; arc supplies the scope id as a string
392
+ * castFilterToSchema({ organizationId: '6a6a…' }, Order.schema)
393
+ * // → { organizationId: ObjectId('6a6a…') }
394
+ * ```
395
+ */
396
+ function castFilterToSchema(filter, schema) {
397
+ if (!isPlainObject(filter)) return filter;
398
+ if (typeof filter.op === "string") return filter;
399
+ let changed = false;
400
+ const out = {};
401
+ for (const [key, value] of Object.entries(filter)) {
402
+ if (LOGICAL_ARRAY_OPS.has(key) && Array.isArray(value)) {
403
+ const arr = value.map((entry) => castFilterToSchema(entry, schema));
404
+ out[key] = arr;
405
+ if (arr.some((v, i) => v !== value[i])) changed = true;
406
+ continue;
407
+ }
408
+ if (LOGICAL_OBJECT_OPS.has(key) && isPlainObject(value)) {
409
+ const nested = castFilterToSchema(value, schema);
410
+ out[key] = nested;
411
+ if (nested !== value) changed = true;
412
+ continue;
413
+ }
414
+ if (key.startsWith("$")) {
415
+ out[key] = value;
416
+ continue;
417
+ }
418
+ if (isPlainObject(value)) {
419
+ const keys = Object.keys(value);
420
+ if (keys.length > 0 && keys.every((k) => k.startsWith("$"))) {
421
+ const nextOps = castOperatorObject(schema, key, value);
422
+ out[key] = nextOps;
423
+ if (nextOps !== value) changed = true;
424
+ continue;
425
+ }
426
+ out[key] = value;
427
+ continue;
428
+ }
429
+ const next = castValue(schema, key, value);
430
+ out[key] = next;
431
+ if (next !== value) changed = true;
432
+ }
433
+ return changed ? out : filter;
434
+ }
435
+ //#endregion
271
436
  //#region src/actions/aggregate-ir/normalize.ts
272
437
  /**
273
438
  * AggRequest → input normalization (mongokit binding).
@@ -531,14 +696,14 @@ function compileMeasure(measure) {
531
696
  }
532
697
  //#endregion
533
698
  //#region src/actions/aggregate-ir/pipeline.ts
534
- function buildAggPipeline(req) {
699
+ function buildAggPipeline(req, schema) {
535
700
  validateMeasures$1(req.measures);
536
701
  const groupCols = normalizeGroupBy(req.groupBy);
537
702
  const bucketAliases = req.dateBuckets ? Object.keys(req.dateBuckets) : [];
538
703
  validateBucketAliases(bucketAliases, groupCols, req.measures);
539
704
  const stages = [];
540
705
  const aliasSet = new Set((req.lookups ?? []).map((l) => l.as ?? l.from));
541
- const { base: baseFilter, joined: joinedFilter } = splitFilterByAlias(req.filter, aliasSet);
706
+ const { base: baseFilter, joined: joinedFilter } = splitFilterByAlias(schema !== void 0 && req.filter !== void 0 ? castFilterToSchema(req.filter, schema) : req.filter, aliasSet);
542
707
  if (baseFilter !== void 0) {
543
708
  const match = compileFilterToMongo(baseFilter);
544
709
  if (Object.keys(match).length > 0) stages.push({ $match: match });
@@ -820,7 +985,7 @@ async function countAggGroups(Model, req, options = {}) {
820
985
  const hasDottedGroupBy = groupCols.some((f) => f.includes("."));
821
986
  const hasDateBuckets = !!req.dateBuckets && Object.keys(req.dateBuckets).length > 0;
822
987
  if (req.having !== void 0 || req.lookups !== void 0 && req.lookups.length > 0 || hasDottedGroupBy || hasDateBuckets) {
823
- const { pipeline, prePaginationIndex } = buildAggPipeline(req);
988
+ const { pipeline, prePaginationIndex } = buildAggPipeline(req, Model.schema);
824
989
  const finalPipeline = [...pipeline.slice(0, prePaginationIndex), { $count: "n" }];
825
990
  const aggregation = Model.aggregate(finalPipeline);
826
991
  if (session) aggregation.session(session);
@@ -828,7 +993,7 @@ async function countAggGroups(Model, req, options = {}) {
828
993
  const [row] = await aggregation.exec();
829
994
  return row?.n ?? 0;
830
995
  }
831
- const match = req.filter ? compileFilterToMongo(req.filter) : {};
996
+ const match = req.filter ? compileFilterToMongo(castFilterToSchema(req.filter, Model.schema)) : {};
832
997
  if (groupCols.length === 0) {
833
998
  const pipeline = [];
834
999
  if (Object.keys(match).length > 0) pipeline.push({ $match: match });
@@ -857,7 +1022,7 @@ async function countAggGroups(Model, req, options = {}) {
857
1022
  //#region src/actions/aggregate-ir/execute.ts
858
1023
  async function executeAgg(Model, req, options = {}) {
859
1024
  const session = options.session;
860
- const { pipeline } = buildAggPipeline(req);
1025
+ const { pipeline } = buildAggPipeline(req, Model.schema);
861
1026
  const aggregation = Model.aggregate(pipeline);
862
1027
  if (session) aggregation.session(session);
863
1028
  applyExecutionHints(aggregation, req.executionHints);
@@ -1731,6 +1896,33 @@ function isTransactionUnsupported(error) {
1731
1896
  const message = (error.message || "").toLowerCase();
1732
1897
  return message.includes("transaction numbers are only allowed on a replica set member") || message.includes("transaction is not supported") || message.includes("does not support retryable writes");
1733
1898
  }
1899
+ /**
1900
+ * PROACTIVELY report whether a connection's deployment supports multi-document
1901
+ * transactions — the read-side companion to {@link isTransactionUnsupported}
1902
+ * (which classifies a FAILED attempt). Single source of truth for the topology
1903
+ * check so callers don't hand-roll `client.topology.description.type` probing.
1904
+ *
1905
+ * Returns `false` ONLY when the topology is positively a standalone (`'Single'`)
1906
+ * server; an unknown/undefined topology (not yet connected, non-standard
1907
+ * connection object) returns `true` — optimistic, because a genuine failure is
1908
+ * still caught reactively by `isTransactionUnsupported`. Lets a caller skip a
1909
+ * doomed transaction attempt on standalone dev Mongo rather than starting one
1910
+ * just to catch the error.
1911
+ *
1912
+ * Accepts a Mongoose `Connection` (or anything exposing `getClient()`/`client`
1913
+ * with a driver `topology`), so it stays decoupled from mongoose types.
1914
+ */
1915
+ function supportsTransactions(connection) {
1916
+ const probe = connection;
1917
+ if (!probe) return true;
1918
+ let client;
1919
+ try {
1920
+ client = probe.getClient?.() ?? probe.client ?? void 0;
1921
+ } catch {
1922
+ return true;
1923
+ }
1924
+ return client?.topology?.description?.type !== "Single";
1925
+ }
1734
1926
  //#endregion
1735
1927
  //#region src/Repository.ts
1736
1928
  /**
@@ -3441,6 +3633,24 @@ var Repository = class extends RepositoryBase {
3441
3633
  return runChunkedPurge(strategy, options, createMongoPurgePort(this, field, value, options.session));
3442
3634
  }
3443
3635
  /**
3636
+ * Range/filter-scoped purge — see `StandardRepo.purgeByFilter` for the
3637
+ * cross-kit contract. The compliance primitive for "purge/anonymize a
3638
+ * slice across a RANGE while retaining measures" (redact a PII dimension
3639
+ * across a `civilDate` window, hard-delete past a retention cutoff): the
3640
+ * base predicate is an arbitrary compiled filter, not `field = value`.
3641
+ *
3642
+ * Composes the kit-agnostic `runChunkedPurge` orchestrator (loop, signal,
3643
+ * progress, result envelope) with `createMongoPurgePortFromFilter` (the
3644
+ * filter-bound sibling of `createMongoPurgePort`). Accepts Filter IR or a
3645
+ * Mongo-shaped filter record — compiled once via `compileFilterToMongo`,
3646
+ * the same dual-dialect rule as `archiveByFilter` and every other verb.
3647
+ * See [actions/purge.ts](./actions/purge.ts) for the port.
3648
+ */
3649
+ async purgeByFilter(filter, strategy, options = {}) {
3650
+ const compiled = compileFilterToMongo(filter);
3651
+ return runChunkedPurge(strategy, options, createMongoPurgePortFromFilter(this, compiled, options.session));
3652
+ }
3653
+ /**
3444
3654
  * Chunked cold-storage extraction — see `StandardRepo.archiveByFilter`
3445
3655
  * for the cross-kit contract (write-before-delete, at-least-once,
3446
3656
  * duplicate-tolerant sinks). Mongokit composes the kit-agnostic
@@ -3652,7 +3862,7 @@ var Repository = class extends RepositoryBase {
3652
3862
  if (!finalReq.sort || Object.keys(finalReq.sort).length === 0) throw new Error("mongokit/aggregatePaginate: keyset pagination requires `sort` — the cursor anchors on the sort-key tuple");
3653
3863
  const cursor = finalReq.after ? decodeAggCursor$1(finalReq.after) : void 0;
3654
3864
  const keysetMatch = cursor ? buildKeysetPredicate(finalReq.sort, cursor) : void 0;
3655
- const { pipeline, prePaginationIndex } = buildAggPipeline(finalReq);
3865
+ const { pipeline, prePaginationIndex } = buildAggPipeline(finalReq, this.Model.schema);
3656
3866
  const headStages = pipeline.slice(0, prePaginationIndex);
3657
3867
  const tailStages = [];
3658
3868
  if (keysetMatch) tailStages.push(keysetMatch);
@@ -4209,4 +4419,4 @@ var Repository = class extends RepositoryBase {
4209
4419
  }
4210
4420
  };
4211
4421
  //#endregion
4212
- export { withTransaction as a, MUTATING_OPERATIONS as c, operationsByPolicyKey as d, MONGOKIT_CAPABILITIES as f, isTransactionUnsupported as i, OP_REGISTRY as l, Repository as n, AggregationBuilder as o, createMongoPurgePort as p, batchTransaction as r, ALL_OPERATIONS as s, HOOK_PRIORITY$1 as t, READ_OPERATIONS as u };
4422
+ export { supportsTransactions as a, ALL_OPERATIONS as c, READ_OPERATIONS as d, operationsByPolicyKey as f, isTransactionUnsupported as i, MUTATING_OPERATIONS as l, createMongoPurgePort as m, Repository as n, withTransaction as o, MONGOKIT_CAPABILITIES as p, batchTransaction as r, AggregationBuilder as s, HOOK_PRIORITY$1 as t, OP_REGISTRY as u };
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
- import { g as create_exports, i as update_exports, p as delete_exports, u as read_exports, v as aggregate_exports } from "../update-1Lq9OMD2.mjs";
2
+ import { g as create_exports, i as update_exports, p as delete_exports, u as read_exports, v as aggregate_exports } from "../update-CI2NdAW6.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 { n as Repository } from "../Repository-KKR8jxfD.mjs";
1
+ import { n as Repository } from "../Repository-DThvFCaV.mjs";
2
2
  import { n as createMongooseAdapter } from "../adapter-CLvUHiTW.mjs";
3
3
  import { pluralizeBetterAuthCollection, resolveBetterAuthCollections } from "@classytic/repo-core/better-auth";
4
4
  //#region src/better-auth/index.ts
@@ -1462,6 +1462,21 @@ declare class Repository<TDoc = unknown> extends RepositoryBase {
1462
1462
  * the port implementation.
1463
1463
  */
1464
1464
  purgeByField(field: string, value: unknown, strategy: TenantPurgeStrategy, options?: TenantPurgeOptions): Promise<TenantPurgeResult>;
1465
+ /**
1466
+ * Range/filter-scoped purge — see `StandardRepo.purgeByFilter` for the
1467
+ * cross-kit contract. The compliance primitive for "purge/anonymize a
1468
+ * slice across a RANGE while retaining measures" (redact a PII dimension
1469
+ * across a `civilDate` window, hard-delete past a retention cutoff): the
1470
+ * base predicate is an arbitrary compiled filter, not `field = value`.
1471
+ *
1472
+ * Composes the kit-agnostic `runChunkedPurge` orchestrator (loop, signal,
1473
+ * progress, result envelope) with `createMongoPurgePortFromFilter` (the
1474
+ * filter-bound sibling of `createMongoPurgePort`). Accepts Filter IR or a
1475
+ * Mongo-shaped filter record — compiled once via `compileFilterToMongo`,
1476
+ * the same dual-dialect rule as `archiveByFilter` and every other verb.
1477
+ * See [actions/purge.ts](./actions/purge.ts) for the port.
1478
+ */
1479
+ purgeByFilter(filter: Record<string, unknown> | Filter, strategy: TenantPurgeStrategy, options?: TenantPurgeOptions): Promise<TenantPurgeResult>;
1465
1480
  /**
1466
1481
  * Chunked cold-storage extraction — see `StandardRepo.archiveByFilter`
1467
1482
  * for the cross-kit contract (write-before-delete, at-least-once,
@@ -1,5 +1,5 @@
1
- import { n as Repository } from "./Repository-KKR8jxfD.mjs";
2
- import { a as methodRegistryPlugin, d as cachePlugin, f as batchOperationsPlugin, g as auditLogPlugin, i as multiTenantPlugin, m as auditTrailPlugin, n as softDeletePlugin, o as customIdPlugin, t as timestampPlugin } from "./timestamp.plugin-B8252GuQ.mjs";
1
+ import { n as Repository } from "./Repository-DThvFCaV.mjs";
2
+ import { a as methodRegistryPlugin, d as cachePlugin, f as batchOperationsPlugin, g as auditLogPlugin, i as multiTenantPlugin, m as auditTrailPlugin, n as softDeletePlugin, o as customIdPlugin, t as timestampPlugin } from "./timestamp.plugin-CFL6LlYZ.mjs";
3
3
  //#region src/create-repository.ts
4
4
  function isLoggerAudit(value) {
5
5
  const v = value;
package/dist/index.d.mts CHANGED
@@ -6,9 +6,9 @@ import { a as InferRawDoc, c as NonNullableFields, d as Strict, f as UpdatePatch
6
6
  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-DCHRWRXw.mjs";
7
7
  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-DVyVGREb.mjs";
8
8
  import { t as PaginationEngine } from "./PaginationEngine-CBS1XGzp.mjs";
9
- import { a as Repository, i as HOOK_PRIORITY, n as CreateRepositoryConfig, o as TransitionMachine, r as createRepository, s as AggregationBuilder, t as AuditConfig } from "./create-repository-HjMD9h9_.mjs";
9
+ import { a as Repository, i as HOOK_PRIORITY, n as CreateRepositoryConfig, o as TransitionMachine, r as createRepository, s as AggregationBuilder, t as AuditConfig } from "./create-repository-D4ZU94b3.mjs";
10
10
  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-vFufQZMZ.mjs";
11
- import { A as elasticSearchPlugin, C as LeasePluginOptions, D as immutableStatesPlugin, E as ImmutableStatesPluginOptions, F as auditLogPlugin, I as AppendOnlyPluginOptions, L as appendOnlyPlugin, M as BatchOperationsMethods, N as BulkWriteResult, O as fieldFilterPlugin, P as batchOperationsPlugin, R as AggregateHelpersMethods, S as LeaseMethods, T as ImmutableClaimView, _ 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 cascadePlugin, k as ElasticSearchOptions, 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, z as aggregateHelpersPlugin } from "./validation-chain.plugin-DxD15h-2.mjs";
11
+ import { A as IdempotencyStorePluginOptions, B as AppendOnlyPluginOptions, C as LeasePluginOptions, D as immutableStatesPlugin, E as ImmutableStatesPluginOptions, F as cascadePlugin, H as AggregateHelpersMethods, I as BatchOperationsMethods, L as BulkWriteResult, M as fieldFilterPlugin, N as ElasticSearchOptions, O as IdempotencyClaim, P as elasticSearchPlugin, R as batchOperationsPlugin, S as LeaseMethods, T as ImmutableClaimView, U as aggregateHelpersPlugin, V as appendOnlyPlugin, _ 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 idempotencyStorePlugin, k as IdempotencyStoreMethods, 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, z as auditLogPlugin } from "./validation-chain.plugin-BLecaKa0.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
14
  import { _ as isDuplicateKeyError, a as configureLogger, c as idVariants, f as createFieldPreset, g as createError, h as getMongooseProjection, i as createMemoryCache, m as getFieldsForUser, n as buildCrudSchemasFromModel, p as filterResponseData, r as buildCrudSchemasFromMongooseSchema, t as toPlain, v as parseDuplicateKeyError } from "./to-plain-DkF5px0R.mjs";
@@ -492,6 +492,23 @@ declare function batchTransaction<TRepos extends Record<string, object>, TResult
492
492
  * problem is the same, and the fallback semantics are correct either way.
493
493
  */
494
494
  declare function isTransactionUnsupported(error: Error): boolean;
495
+ /**
496
+ * PROACTIVELY report whether a connection's deployment supports multi-document
497
+ * transactions — the read-side companion to {@link isTransactionUnsupported}
498
+ * (which classifies a FAILED attempt). Single source of truth for the topology
499
+ * check so callers don't hand-roll `client.topology.description.type` probing.
500
+ *
501
+ * Returns `false` ONLY when the topology is positively a standalone (`'Single'`)
502
+ * server; an unknown/undefined topology (not yet connected, non-standard
503
+ * connection object) returns `true` — optimistic, because a genuine failure is
504
+ * still caught reactively by `isTransactionUnsupported`. Lets a caller skip a
505
+ * doomed transaction attempt on standalone dev Mongo rather than starting one
506
+ * just to catch the error.
507
+ *
508
+ * Accepts a Mongoose `Connection` (or anything exposing `getClient()`/`client`
509
+ * with a driver `topology`), so it stays decoupled from mongoose types.
510
+ */
511
+ declare function supportsTransactions(connection: unknown): boolean;
495
512
  //#endregion
496
513
  //#region src/utils/repo-options.d.ts
497
514
  /**
@@ -692,4 +709,4 @@ declare function createOptionsExtractor<TCtx extends Record<string, unknown>>(fi
692
709
  */
693
710
  declare function systemContext(extra?: SessionOptions): SessionOptions;
694
711
  //#endregion
695
- export { ALL_OPERATIONS, type AggregateHelpersMethods, type AggregateOptions, type AggregatePaginationOptions, AggregationBuilder, 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 CascadeOptions, type CascadePurgeReferencesOptions, type CascadeRelation, type CollationOptions, type CollectionRWLike, type CreateInput, type CreateOptions, type CreateRepositoryConfig, type CursorPayload, type CustomIdOptions, type DateSequentialIdOptions, type DecodedCursor, type DeepPartial, type DeleteResult, type DocField, type ElasticSearchOptions, type EnsureAuditTrailReadyOptions, type EventHandlers, type EventPayload, type EventPhase, type FieldPreset, type FieldType, type FilterQuery, type FindOneAndUpdateOptions, type GroupResult, HOOK_PRIORITY, type HookMode, type IdGenerator, type ImmutableClaimView, type ImmutableStatesPluginOptions, type InferDocument, type InferRawDoc, type KeysOfType, type KeysetPaginationOptions, type LeaseMethods, type LeasePluginOptions, type Logger, LookupBuilder, type LookupOptions, type LookupPopulateOptions, type LookupPopulateResult, MONGOKIT_CAPABILITIES, MONGOKIT_PLUGIN_NAMES, MUTATING_OPERATIONS, type Middleware, type MiddlewareContext, type MinMaxResult, type MinimalRepoView, type MongoKitPluginName, type MongoOperationsMethods, type MongoOperatorUpdate, type MultiTenantOptions, type NonNullableFields, OP_REGISTRY, type ObjectId, type ObservabilityOptions, type OffsetPaginationOptions, type OperationDescriptor, type OperationMetric, type OperationOptions, type PaginationConfig, PaginationEngine, type ParsedQuery, type PartialBy, type Plugin, type PluginFunction, type PluginType, type PolicyKey, type PopulateOption, type PopulateSpec, type PrefixedIdOptions, type PrioritizedHook, type PurgeMode, type PurgeableRepoLike, QueryParser, type QueryParserOptions, 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 SoftDeleteFilterMode, type SoftDeleteMethods, type SoftDeleteOptions, type SoftDeleteRepository, type SortDirection, type SortSpec, type Strict, type SubdocumentMethods, type TenantContext, type TenantStore, type TransitionMachine, type UpdateManyResult, type UpdateOptions, type UpdatePatch, type UpdateWithValidationResult, type UserContext, type ValidationChainOptions, type ValidatorDefinition, type ValueType, type WithPlugins, type WithTransactionOptions, index_d_exports as actions, adminBypass, aggregateHelpersPlugin, appendOnlyPlugin, auditLogPlugin, auditTrailPlugin, autoInject, batchOperationsPlugin, batchTransaction, blockIf, buildCrudSchemasFromModel, buildCrudSchemasFromMongooseSchema, cachePlugin, cascadePlugin, cascadePurgeReferences, compileFilterToMongo, configureLogger, createError, createFieldPreset, createMemoryCache, createOptionsExtractor, createRepository, createTenantContext, customIdPlugin, dateSequentialId, elasticSearchPlugin, ensureAuditTrailReady, fieldFilterPlugin, filterResponseData, getFieldsForUser, getMongooseProjection, getNextSequence, idVariants, immutableField, immutableStatesPlugin, isDuplicateKeyError, isTransactionUnsupported, leasePlugin, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, operationsByPolicyKey, parseDuplicateKeyError, prefixedId, repoOptionsFromCtx, requireField, sequentialId, softDeletePlugin, subdocumentPlugin, systemContext, timestampPlugin, toPlain, uniqueField, validationChainPlugin, withTransaction };
712
+ export { ALL_OPERATIONS, type AggregateHelpersMethods, type AggregateOptions, type AggregatePaginationOptions, AggregationBuilder, 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 CascadeOptions, type CascadePurgeReferencesOptions, type CascadeRelation, type CollationOptions, type CollectionRWLike, type CreateInput, type CreateOptions, type CreateRepositoryConfig, type CursorPayload, type CustomIdOptions, type DateSequentialIdOptions, type DecodedCursor, type DeepPartial, type DeleteResult, type DocField, type ElasticSearchOptions, type EnsureAuditTrailReadyOptions, type EventHandlers, type EventPayload, type EventPhase, type FieldPreset, type FieldType, type FilterQuery, type FindOneAndUpdateOptions, type GroupResult, 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, LookupBuilder, type LookupOptions, type LookupPopulateOptions, type LookupPopulateResult, MONGOKIT_CAPABILITIES, MONGOKIT_PLUGIN_NAMES, MUTATING_OPERATIONS, type Middleware, type MiddlewareContext, type MinMaxResult, type MinimalRepoView, type MongoKitPluginName, type MongoOperationsMethods, type MongoOperatorUpdate, type MultiTenantOptions, type NonNullableFields, OP_REGISTRY, type ObjectId, type ObservabilityOptions, type OffsetPaginationOptions, type OperationDescriptor, type OperationMetric, type OperationOptions, type PaginationConfig, PaginationEngine, type ParsedQuery, type PartialBy, type Plugin, type PluginFunction, type PluginType, type PolicyKey, type PopulateOption, type PopulateSpec, type PrefixedIdOptions, type PrioritizedHook, type PurgeMode, type PurgeableRepoLike, QueryParser, type QueryParserOptions, 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 SoftDeleteFilterMode, type SoftDeleteMethods, type SoftDeleteOptions, type SoftDeleteRepository, type SortDirection, type SortSpec, type Strict, type SubdocumentMethods, type TenantContext, type TenantStore, type TransitionMachine, type UpdateManyResult, type UpdateOptions, type UpdatePatch, type UpdateWithValidationResult, type UserContext, type ValidationChainOptions, type ValidatorDefinition, type ValueType, type WithPlugins, type WithTransactionOptions, index_d_exports as actions, adminBypass, aggregateHelpersPlugin, appendOnlyPlugin, auditLogPlugin, auditTrailPlugin, autoInject, batchOperationsPlugin, batchTransaction, blockIf, buildCrudSchemasFromModel, buildCrudSchemasFromMongooseSchema, cachePlugin, cascadePlugin, cascadePurgeReferences, compileFilterToMongo, configureLogger, createError, createFieldPreset, createMemoryCache, createOptionsExtractor, createRepository, createTenantContext, customIdPlugin, dateSequentialId, elasticSearchPlugin, ensureAuditTrailReady, fieldFilterPlugin, filterResponseData, getFieldsForUser, getMongooseProjection, getNextSequence, idVariants, idempotencyStorePlugin, immutableField, immutableStatesPlugin, isDuplicateKeyError, isTransactionUnsupported, leasePlugin, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, operationsByPolicyKey, parseDuplicateKeyError, prefixedId, repoOptionsFromCtx, requireField, sequentialId, softDeletePlugin, subdocumentPlugin, supportsTransactions, systemContext, timestampPlugin, toPlain, uniqueField, validationChainPlugin, withTransaction };
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import { n as idVariants } from "./id-resolution-BqDrk0S2.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-KKR8jxfD.mjs";
3
- import { b as LookupBuilder, x as compileFilterToMongo } from "./update-1Lq9OMD2.mjs";
2
+ import { a as supportsTransactions, c as ALL_OPERATIONS, d as READ_OPERATIONS, f as operationsByPolicyKey, i as isTransactionUnsupported, l as MUTATING_OPERATIONS, m as createMongoPurgePort, n as Repository, o as withTransaction, p as MONGOKIT_CAPABILITIES, r as batchTransaction, s as AggregationBuilder, t as HOOK_PRIORITY, u as OP_REGISTRY } from "./Repository-DThvFCaV.mjs";
3
+ import { b as LookupBuilder, x as compileFilterToMongo } from "./update-CI2NdAW6.mjs";
4
4
  import { n as warn, t as configureLogger } from "./logger-K7dPmu2U.mjs";
5
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, g as auditLogPlugin, h as ensureAuditTrailReady, 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-B8252GuQ.mjs";
7
+ import { a as methodRegistryPlugin, c as getNextSequence, d as cachePlugin, f as batchOperationsPlugin, g as auditLogPlugin, h as ensureAuditTrailReady, 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-CFL6LlYZ.mjs";
8
8
  import { t as PaginationEngine } from "./PaginationEngine-CczbvCAq.mjs";
9
9
  import { isGeoOperator, parseGeoFilter } from "./query/primitives/geo.mjs";
10
- import { t as createRepository } from "./create-repository-DA5VJh-3.mjs";
11
- import { _ as appendOnlyPlugin, a as uniqueField, c as subdocumentPlugin, d as mongoOperationsPlugin, f as leasePlugin, g as cascadePlugin, h as elasticSearchPlugin, i as requireField, l as observabilityPlugin, m as fieldFilterPlugin, n as blockIf, o as validationChainPlugin, p as immutableStatesPlugin, r as immutableField, s as createTenantContext, t as autoInject, u as MONGOKIT_PLUGIN_NAMES, v as aggregateHelpersPlugin } from "./validation-chain.plugin-C3Vwp-Rk.mjs";
10
+ import { t as createRepository } from "./create-repository-uhKt_oUT.mjs";
11
+ import { _ as cascadePlugin, a as uniqueField, c as subdocumentPlugin, d as mongoOperationsPlugin, f as leasePlugin, g as elasticSearchPlugin, h as fieldFilterPlugin, i as requireField, l as observabilityPlugin, m as idempotencyStorePlugin, n as blockIf, o as validationChainPlugin, p as immutableStatesPlugin, r as immutableField, s as createTenantContext, t as autoInject, u as MONGOKIT_PLUGIN_NAMES, v as appendOnlyPlugin, y as aggregateHelpersPlugin } from "./validation-chain.plugin-CwOcUJC1.mjs";
12
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";
@@ -1611,4 +1611,4 @@ function systemContext(extra) {
1611
1611
  */
1612
1612
  var src_default = Repository;
1613
1613
  //#endregion
1614
- export { ALL_OPERATIONS, AggregationBuilder, AuditTrailQuery, HOOK_PRIORITY, LookupBuilder, MONGOKIT_CAPABILITIES, MONGOKIT_PLUGIN_NAMES, MUTATING_OPERATIONS, OP_REGISTRY, PaginationEngine, QueryParser, READ_OPERATIONS, Repository, actions_exports as actions, adminBypass, aggregateHelpersPlugin, appendOnlyPlugin, 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, ensureAuditTrailReady, fieldFilterPlugin, filterResponseData, getFieldsForUser, getMongooseProjection, getNextSequence, idVariants, immutableField, immutableStatesPlugin, isDuplicateKeyError, isTransactionUnsupported, leasePlugin, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, operationsByPolicyKey, parseDuplicateKeyError, prefixedId, repoOptionsFromCtx, requireField, sequentialId, softDeletePlugin, subdocumentPlugin, systemContext, timestampPlugin, toPlain, uniqueField, validationChainPlugin, withTransaction };
1614
+ export { ALL_OPERATIONS, AggregationBuilder, AuditTrailQuery, HOOK_PRIORITY, LookupBuilder, MONGOKIT_CAPABILITIES, MONGOKIT_PLUGIN_NAMES, MUTATING_OPERATIONS, OP_REGISTRY, PaginationEngine, QueryParser, READ_OPERATIONS, Repository, actions_exports as actions, adminBypass, aggregateHelpersPlugin, appendOnlyPlugin, 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, ensureAuditTrailReady, fieldFilterPlugin, filterResponseData, getFieldsForUser, getMongooseProjection, getNextSequence, idVariants, idempotencyStorePlugin, immutableField, immutableStatesPlugin, isDuplicateKeyError, isTransactionUnsupported, leasePlugin, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, operationsByPolicyKey, parseDuplicateKeyError, prefixedId, repoOptionsFromCtx, requireField, sequentialId, softDeletePlugin, subdocumentPlugin, supportsTransactions, systemContext, timestampPlugin, toPlain, uniqueField, validationChainPlugin, withTransaction };
@@ -1,6 +1,6 @@
1
1
  import { S as RepositoryPluginName, b as MONGOKIT_PLUGIN_NAMES, l as Plugin, x as MongoKitPluginName } from "../repository-DCHRWRXw.mjs";
2
2
  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, 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-DVyVGREb.mjs";
3
- import { A as elasticSearchPlugin, C as LeasePluginOptions, D as immutableStatesPlugin, E as ImmutableStatesPluginOptions, F as auditLogPlugin, I as AppendOnlyPluginOptions, L as appendOnlyPlugin, M as BatchOperationsMethods, O as fieldFilterPlugin, P as batchOperationsPlugin, R as AggregateHelpersMethods, S as LeaseMethods, T as ImmutableClaimView, _ 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 cascadePlugin, k as ElasticSearchOptions, 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, z as aggregateHelpersPlugin } from "../validation-chain.plugin-DxD15h-2.mjs";
3
+ import { A as IdempotencyStorePluginOptions, B as AppendOnlyPluginOptions, C as LeasePluginOptions, D as immutableStatesPlugin, E as ImmutableStatesPluginOptions, F as cascadePlugin, H as AggregateHelpersMethods, I as BatchOperationsMethods, M as fieldFilterPlugin, N as ElasticSearchOptions, O as IdempotencyClaim, P as elasticSearchPlugin, R as batchOperationsPlugin, S as LeaseMethods, T as ImmutableClaimView, U as aggregateHelpersPlugin, V as appendOnlyPlugin, _ 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 idempotencyStorePlugin, k as IdempotencyStoreMethods, 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, z as auditLogPlugin } from "../validation-chain.plugin-BLecaKa0.mjs";
4
4
  import { ChangeLogStore } from "@classytic/repo-core/sync";
5
5
  //#region src/plugins/change-log.plugin.d.ts
6
6
  interface ChangeLogPluginOptions {
@@ -15,4 +15,4 @@ interface ChangeLogPluginOptions {
15
15
  }
16
16
  declare function changeLogPlugin(options: ChangeLogPluginOptions): Plugin;
17
17
  //#endregion
18
- export { type AggregateHelpersMethods, type AppendOnlyPluginOptions, type AuditEntry, type AuditOperation, type AuditQueryOptions, type AuditQueryResult, type AuditTrailMethods, type AuditTrailMode, type AuditTrailOptions, AuditTrailQuery, type AuditTrailQueryOptions, type BatchOperationsMethods, type CacheAdapter, type CacheOptions, type ChangeLogPluginOptions, type CustomIdOptions, type DateSequentialIdOptions, type ElasticSearchOptions, type EnsureAuditTrailReadyOptions, type IdGenerator, type ImmutableClaimView, type ImmutableStatesPluginOptions, type LeaseMethods, type LeasePluginOptions, MONGOKIT_PLUGIN_NAMES, type MethodRegistryRepository, type MongoKitPluginName, type MongoOperationsMethods, type MultiTenantOptions, type ObservabilityOptions, type OperationMetric, type PrefixedIdOptions, type RepositoryCacheHandle, type RepositoryCachePluginOptions, type RepositoryPluginName, type SequentialIdOptions, type SoftDeleteMethods, type SubdocumentMethods, type TenantContext, type TenantStore, aggregateHelpersPlugin, appendOnlyPlugin, auditLogPlugin, auditTrailPlugin, autoInject, batchOperationsPlugin, blockIf, cachePlugin, cascadePlugin, changeLogPlugin, createTenantContext, customIdPlugin, dateSequentialId, elasticSearchPlugin, ensureAuditTrailReady, fieldFilterPlugin, getNextSequence, immutableField, immutableStatesPlugin, leasePlugin, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, prefixedId, requireField, sequentialId, softDeletePlugin, subdocumentPlugin, timestampPlugin, uniqueField, validationChainPlugin };
18
+ export { type AggregateHelpersMethods, type AppendOnlyPluginOptions, type AuditEntry, type AuditOperation, type AuditQueryOptions, type AuditQueryResult, type AuditTrailMethods, type AuditTrailMode, type AuditTrailOptions, AuditTrailQuery, type AuditTrailQueryOptions, type BatchOperationsMethods, type CacheAdapter, type CacheOptions, type ChangeLogPluginOptions, type CustomIdOptions, type DateSequentialIdOptions, type ElasticSearchOptions, type EnsureAuditTrailReadyOptions, type IdGenerator, type IdempotencyClaim, type IdempotencyStoreMethods, type IdempotencyStorePluginOptions, type ImmutableClaimView, type ImmutableStatesPluginOptions, type LeaseMethods, type LeasePluginOptions, MONGOKIT_PLUGIN_NAMES, type MethodRegistryRepository, type MongoKitPluginName, type MongoOperationsMethods, type MultiTenantOptions, type ObservabilityOptions, type OperationMetric, type PrefixedIdOptions, type RepositoryCacheHandle, type RepositoryCachePluginOptions, type RepositoryPluginName, type SequentialIdOptions, type SoftDeleteMethods, type SubdocumentMethods, type TenantContext, type TenantStore, aggregateHelpersPlugin, appendOnlyPlugin, auditLogPlugin, auditTrailPlugin, autoInject, batchOperationsPlugin, blockIf, cachePlugin, cascadePlugin, changeLogPlugin, createTenantContext, customIdPlugin, dateSequentialId, elasticSearchPlugin, ensureAuditTrailReady, fieldFilterPlugin, getNextSequence, idempotencyStorePlugin, immutableField, immutableStatesPlugin, leasePlugin, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, prefixedId, requireField, sequentialId, softDeletePlugin, subdocumentPlugin, timestampPlugin, uniqueField, validationChainPlugin };
@@ -1,5 +1,5 @@
1
- import { a as methodRegistryPlugin, c as getNextSequence, d as cachePlugin, f as batchOperationsPlugin, g as auditLogPlugin, h as ensureAuditTrailReady, 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-B8252GuQ.mjs";
2
- import { _ as appendOnlyPlugin, a as uniqueField, c as subdocumentPlugin, d as mongoOperationsPlugin, f as leasePlugin, g as cascadePlugin, h as elasticSearchPlugin, i as requireField, l as observabilityPlugin, m as fieldFilterPlugin, n as blockIf, o as validationChainPlugin, p as immutableStatesPlugin, r as immutableField, s as createTenantContext, t as autoInject, u as MONGOKIT_PLUGIN_NAMES, v as aggregateHelpersPlugin } from "../validation-chain.plugin-C3Vwp-Rk.mjs";
1
+ import { a as methodRegistryPlugin, c as getNextSequence, d as cachePlugin, f as batchOperationsPlugin, g as auditLogPlugin, h as ensureAuditTrailReady, 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-CFL6LlYZ.mjs";
2
+ import { _ as cascadePlugin, a as uniqueField, c as subdocumentPlugin, d as mongoOperationsPlugin, f as leasePlugin, g as elasticSearchPlugin, h as fieldFilterPlugin, i as requireField, l as observabilityPlugin, m as idempotencyStorePlugin, n as blockIf, o as validationChainPlugin, p as immutableStatesPlugin, r as immutableField, s as createTenantContext, t as autoInject, u as MONGOKIT_PLUGIN_NAMES, v as appendOnlyPlugin, y as aggregateHelpersPlugin } from "../validation-chain.plugin-CwOcUJC1.mjs";
3
3
  //#region src/plugins/change-log.plugin.ts
4
4
  const PLUGIN_NAME = "changeLog";
5
5
  function isSkipped(context) {
@@ -70,4 +70,4 @@ function changeLogPlugin(options) {
70
70
  };
71
71
  }
72
72
  //#endregion
73
- export { AuditTrailQuery, MONGOKIT_PLUGIN_NAMES, aggregateHelpersPlugin, appendOnlyPlugin, auditLogPlugin, auditTrailPlugin, autoInject, batchOperationsPlugin, blockIf, cachePlugin, cascadePlugin, changeLogPlugin, createTenantContext, customIdPlugin, dateSequentialId, elasticSearchPlugin, ensureAuditTrailReady, fieldFilterPlugin, getNextSequence, immutableField, immutableStatesPlugin, leasePlugin, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, prefixedId, requireField, sequentialId, softDeletePlugin, subdocumentPlugin, timestampPlugin, uniqueField, validationChainPlugin };
73
+ export { AuditTrailQuery, MONGOKIT_PLUGIN_NAMES, aggregateHelpersPlugin, appendOnlyPlugin, auditLogPlugin, auditTrailPlugin, autoInject, batchOperationsPlugin, blockIf, cachePlugin, cascadePlugin, changeLogPlugin, createTenantContext, customIdPlugin, dateSequentialId, elasticSearchPlugin, ensureAuditTrailReady, fieldFilterPlugin, getNextSequence, idempotencyStorePlugin, immutableField, immutableStatesPlugin, leasePlugin, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, prefixedId, requireField, sequentialId, softDeletePlugin, subdocumentPlugin, timestampPlugin, uniqueField, validationChainPlugin };
@@ -1,4 +1,4 @@
1
- import { a as Repository, n as CreateRepositoryConfig } from "../create-repository-HjMD9h9_.mjs";
1
+ import { a as Repository, n as CreateRepositoryConfig } from "../create-repository-D4ZU94b3.mjs";
2
2
  import { Connection, Model, Schema } from "mongoose";
3
3
  import { MongoMemoryReplSet, MongoMemoryServer } from "mongodb-memory-server";
4
4
  //#region src/testkit/index.d.ts