@classytic/mongokit 3.43.1 → 3.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -3
- package/dist/{PaginationEngine-DZnkbSrr.mjs → PaginationEngine-BRlLTQQz.mjs} +13 -27
- package/dist/{PaginationEngine-CRHyuUtw.d.mts → PaginationEngine-BWb-c47a.d.mts} +1 -3
- package/dist/{Repository-DnL4xk5w.d.mts → Repository-DJuRmBNx.d.mts} +44 -13
- package/dist/{Repository-Dj6xqPxJ.mjs → Repository-DheA7oW-.mjs} +330 -112
- package/dist/actions/index.d.mts +1 -1
- package/dist/actions/index.mjs +2 -2
- package/dist/{actions-ChYfkPYP.mjs → actions-DKQx9ToJ.mjs} +3 -4
- package/dist/adapter/index.d.mts +6 -10
- package/dist/adapter/index.mjs +1 -1
- package/dist/{adapter-CkMoMF83.mjs → adapter-Qzgc3ZD_.mjs} +4 -6
- package/dist/ai/index.d.mts +21 -8
- package/dist/ai/index.mjs +15 -9
- package/dist/better-auth/index.d.mts +21 -20
- package/dist/better-auth/index.mjs +12 -23
- package/dist/{coercion-BjdPX3YF.d.mts → coercion-COp9DRNw.d.mts} +0 -2
- package/dist/{create-repository-UjwPWR1z.mjs → create-repository-C9DHHcl7.mjs} +4 -5
- package/dist/{create-repository-CJtVdwig.d.mts → create-repository-DG-gwOf0.d.mts} +5 -7
- package/dist/{derive-DRBiegRH.mjs → derive-Dxsc31fV.mjs} +3 -6
- package/dist/{error-BuByZwKU.mjs → error-DjdmPLWO.mjs} +1 -2
- package/dist/{field-selection-FSQFLpsU.mjs → field-selection-DPFaFw9Y.mjs} +1 -2
- package/dist/{id-chunks-BmAwsqNk.mjs → id-chunks-DH-RAZWG.mjs} +13 -8
- package/dist/{id-resolution-BqDrk0S2.mjs → id-resolution-Cqh49d9J.mjs} +1 -2
- package/dist/idempotency/index.d.mts +4 -7
- package/dist/idempotency/index.mjs +1 -2
- package/dist/{index-SYF8N28D.d.mts → index-5mhQ63_B.d.mts} +3 -4
- package/dist/{index-C0AjVqX3.d.mts → index-ehGZLbrd.d.mts} +2 -8
- package/dist/index.d.mts +70 -102
- package/dist/index.mjs +36 -52
- package/dist/indexes/verify-indexes.d.mts +8 -11
- package/dist/indexes/verify-indexes.mjs +1 -2
- package/dist/{indexes-DIjMpYES.d.mts → indexes-FfyOuhDK.d.mts} +0 -2
- package/dist/{join-scope-DSAznE8E.mjs → join-scope-C1gOtZ59.mjs} +2 -3
- package/dist/kernel-conformance/index.d.mts +39 -13
- package/dist/kernel-conformance/index.mjs +4 -7
- package/dist/lock/index.d.mts +134 -7
- package/dist/lock/index.mjs +349 -14
- package/dist/{logger-K7dPmu2U.mjs → logger-hbWOlj_X.mjs} +1 -2
- package/dist/{method-registry.plugin-C63pGn1d.mjs → method-registry.plugin-BeJfQBJV.mjs} +5 -7
- package/dist/{model-registry-ClKtWiHa.mjs → model-registry-DrVfJ3Nt.mjs} +1 -2
- package/dist/{mongooseToJsonSchema-C3k4ide0.mjs → mongooseToJsonSchema-DMDotz4_.mjs} +2 -3
- package/dist/{multi-tenant.plugin-B_q9NUHc.d.mts → multi-tenant.plugin-BTPtCLNK.d.mts} +143 -11
- package/dist/{operations-XiFgG5US.d.mts → operations-D6XsHx4e.d.mts} +19 -11
- package/dist/outbox/index.d.mts +24 -9
- package/dist/outbox/index.mjs +17 -6
- package/dist/pagination/PaginationEngine.d.mts +1 -1
- package/dist/pagination/PaginationEngine.mjs +1 -1
- package/dist/pagination/utils/limits.d.mts +6 -9
- package/dist/pagination/utils/limits.mjs +2 -3
- package/dist/{pagination-D6psses0.d.mts → pagination-BAM9cA4N.d.mts} +6 -16
- package/dist/{plugin-options-Cirmb4Kp.d.mts → plugin-options-DrNGWV5b.d.mts} +2 -4
- package/dist/plugins/index.d.mts +6 -7
- package/dist/plugins/index.mjs +6 -7
- package/dist/query/primitives/coercion.d.mts +1 -1
- package/dist/query/primitives/coercion.mjs +2 -3
- package/dist/query/primitives/geo.d.mts +11 -14
- package/dist/query/primitives/geo.mjs +1 -2
- package/dist/query/primitives/indexes.d.mts +1 -1
- package/dist/query/primitives/indexes.mjs +1 -2
- package/dist/{query-defaults-BxUcSOoF.mjs → query-defaults-DwvWUjZU.mjs} +18 -54
- package/dist/read-model/index.d.mts +18 -21
- package/dist/read-model/index.mjs +3 -4
- package/dist/{repository-MqAP409e.d.mts → repository-B0aFVgP2.d.mts} +25 -29
- package/dist/retention-purge-CCd_VXUf.d.mts +38 -0
- package/dist/{rolldown-runtime-D7D4PA-g.mjs → rolldown-runtime-D8jQpDG7.mjs} +1 -2
- package/dist/search/index.d.mts +1 -1
- package/dist/search/index.mjs +1 -1
- package/dist/sync/index.d.mts +113 -17
- package/dist/sync/index.mjs +421 -65
- package/dist/tenant/index.d.mts +8 -11
- package/dist/tenant/index.mjs +1 -2
- package/dist/testkit/index.d.mts +179 -23
- package/dist/testkit/index.mjs +421 -23
- package/dist/{timestamp.plugin-DpOWavVI.mjs → timestamp.plugin-B-IJrlYb.mjs} +192 -49
- package/dist/{to-plain-vksRrLtc.mjs → to-plain-CEKv_ylg.mjs} +2 -4
- package/dist/{to-plain-o5tUY2nV.d.mts → to-plain-Do-8jTKC.d.mts} +2 -16
- package/dist/{transaction-DmiB4k2P.mjs → transaction-C6Oj941P.mjs} +18 -19
- package/dist/{type-utils-CLzRFtIA.d.mts → type-utils-CKvuewAL.d.mts} +0 -2
- package/dist/{update-WgeAUJ_I.mjs → update-CYaJMu6j.mjs} +13 -23
- package/dist/usage/index.d.mts +2 -5
- package/dist/usage/index.mjs +8 -6
- package/dist/utils/index.d.mts +8 -10
- package/dist/utils/index.mjs +7 -7
- package/dist/{validation-chain.plugin-BAeC5eVT.d.mts → validation-chain.plugin-COYrUdd8.d.mts} +150 -48
- package/dist/{validation-chain.plugin-DRApTmkN.mjs → validation-chain.plugin-DJplVJ12.mjs} +210 -55
- package/llms.txt +33 -0
- package/package.json +29 -25
- package/skills/mongokit/SKILL.md +112 -0
- package/skills/mongokit/references/pagination-search.md +87 -0
- package/skills/mongokit/references/plugins-tenancy.md +103 -0
- package/skills/mongokit/references/repository-api.md +83 -0
- package/skills/mongokit/references/transactions-outbox.md +103 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { A as ObjectId } from "./pagination-
|
|
2
|
-
import { l as Plugin, p as RepositoryContext } from "./repository-
|
|
1
|
+
import { A as ObjectId } from "./pagination-BAM9cA4N.mjs";
|
|
2
|
+
import { l as Plugin, p as RepositoryContext } from "./repository-B0aFVgP2.mjs";
|
|
3
3
|
import mongoose, { Connection } from "mongoose";
|
|
4
4
|
import { CacheAdapter as CacheAdapter$1, CacheOptions, RepositoryCacheHandle as RepositoryCacheHandle$1, RepositoryCachePluginOptions, cachePlugin } from "@classytic/repo-core/cache";
|
|
5
5
|
import { TenantConfig } from "@classytic/repo-core/tenant";
|
|
6
|
-
//#region src/plugins/audit-trail.plugin.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* Audit write delivery mode.
|
|
9
8
|
*
|
|
@@ -262,8 +261,6 @@ interface AuditTrailMethods {
|
|
|
262
261
|
operation?: AuditOperation;
|
|
263
262
|
}): Promise<AuditQueryResult>;
|
|
264
263
|
}
|
|
265
|
-
//#endregion
|
|
266
|
-
//#region src/plugins/custom-id.plugin.d.ts
|
|
267
264
|
/**
|
|
268
265
|
* Generator function that produces a unique ID.
|
|
269
266
|
* Receives the full repository context for conditional logic.
|
|
@@ -277,6 +274,45 @@ interface CustomIdOptions {
|
|
|
277
274
|
/** Only generate if the field is missing/empty (default: true) */
|
|
278
275
|
generateOnlyIfEmpty?: boolean;
|
|
279
276
|
}
|
|
277
|
+
/** Options for {@link createSequenceCounter}. */
|
|
278
|
+
interface SequenceCounterOptions {
|
|
279
|
+
/** Mongoose connection. @default the default `mongoose.connection` */
|
|
280
|
+
connection?: mongoose.Connection;
|
|
281
|
+
/**
|
|
282
|
+
* Collection holding the counters, for hosts with a collection-naming
|
|
283
|
+
* rule (e.g. an app prefix). @default `'_mongokit_counters'`
|
|
284
|
+
*/
|
|
285
|
+
collection?: string;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* The atomic counter API bound to one connection + collection. Same
|
|
289
|
+
* semantics as {@link getNextSequence} / {@link readSequence} /
|
|
290
|
+
* {@link ensureSequenceAtLeast}, with an optional session on every call.
|
|
291
|
+
*/
|
|
292
|
+
interface SequenceCounter {
|
|
293
|
+
/** Atomic `$inc` + upsert; returns the value after the increment. */
|
|
294
|
+
next(counterKey: string, increment?: number, session?: mongoose.ClientSession): Promise<number>;
|
|
295
|
+
/** Current value, or `null` when the counter was never created. */
|
|
296
|
+
read(counterKey: string, session?: mongoose.ClientSession): Promise<number | null>;
|
|
297
|
+
/** Raise to at least `floor` (`$max` + upsert); never lowers. Returns the value after. */
|
|
298
|
+
ensureAtLeast(counterKey: string, floor: number, session?: mongoose.ClientSession): Promise<number>;
|
|
299
|
+
/**
|
|
300
|
+
* Next value of the counter `'<baseKey><sep><civil period>'`, which resets
|
|
301
|
+
* every civil year / month / day in `timeZone`. See {@link getNextPeriodSequence}.
|
|
302
|
+
*/
|
|
303
|
+
nextInPeriod(baseKey: string, options: PeriodSequenceOptions): Promise<PeriodSequenceResult>;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Bind the atomic counter API to a connection and, optionally, a
|
|
307
|
+
* collection other than `_mongokit_counters`.
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* const counters = createSequenceCounter({ connection, collection: 'app_counters' });
|
|
311
|
+
* await withTransaction(connection, async (session) => {
|
|
312
|
+
* const seq = await counters.next('alert.stream', 1, session);
|
|
313
|
+
* });
|
|
314
|
+
*/
|
|
315
|
+
declare function createSequenceCounter(options?: SequenceCounterOptions): SequenceCounter;
|
|
280
316
|
/**
|
|
281
317
|
* Atomically increment and return the next sequence value for a given key.
|
|
282
318
|
* Uses `findOneAndUpdate` with `upsert` + `$inc` — fully atomic even under
|
|
@@ -311,7 +347,7 @@ declare function getNextSequence(counterKey: string, increment?: number, connect
|
|
|
311
347
|
* Current value of a counter, or `null` when it has never been created.
|
|
312
348
|
* `null` and `0` differ: only a missing counter needs seeding.
|
|
313
349
|
*/
|
|
314
|
-
declare function readSequence(counterKey: string, connection?: mongoose.Connection): Promise<number | null>;
|
|
350
|
+
declare function readSequence(counterKey: string, connection?: mongoose.Connection, session?: mongoose.ClientSession): Promise<number | null>;
|
|
315
351
|
/**
|
|
316
352
|
* Raise a counter to at least `floor` — never lowers it. Atomic (`$max` +
|
|
317
353
|
* upsert), so concurrent seeders converge on the highest floor.
|
|
@@ -322,7 +358,77 @@ declare function readSequence(counterKey: string, connection?: mongoose.Connecti
|
|
|
322
358
|
*
|
|
323
359
|
* @returns The counter's value after the raise.
|
|
324
360
|
*/
|
|
325
|
-
declare function ensureSequenceAtLeast(counterKey: string, floor: number, connection?: mongoose.Connection): Promise<number>;
|
|
361
|
+
declare function ensureSequenceAtLeast(counterKey: string, floor: number, connection?: mongoose.Connection, session?: mongoose.ClientSession): Promise<number>;
|
|
362
|
+
/** The civil period a period-scoped counter resets on. */
|
|
363
|
+
type SequencePeriod = 'year' | 'month' | 'day';
|
|
364
|
+
/**
|
|
365
|
+
* The civil period of an instant in an IANA time zone: `'2026'` (year),
|
|
366
|
+
* `'2026-03'` (month) or `'2026-03-14'` (day). The period suffix every
|
|
367
|
+
* period-scoped counter key ends with.
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
* civilPeriodKey(new Date('2026-12-31T21:00:00Z'), 'year', 'Asia/Riyadh'); // '2027'
|
|
371
|
+
* civilPeriodKey(new Date('2026-12-31T21:00:00Z'), 'year', 'UTC'); // '2026'
|
|
372
|
+
*/
|
|
373
|
+
declare function civilPeriodKey(at: Date, period: SequencePeriod, timeZone: string): string;
|
|
374
|
+
/** Options for {@link periodCounterKey}, {@link getNextPeriodSequence} and `SequenceCounter.nextInPeriod`. */
|
|
375
|
+
interface PeriodSequenceKeyOptions {
|
|
376
|
+
/** Civil period the counter resets on. */
|
|
377
|
+
period: SequencePeriod;
|
|
378
|
+
/** IANA time zone whose civil calendar decides the period (e.g. `'Asia/Riyadh'`, `'UTC'`). */
|
|
379
|
+
timeZone: string;
|
|
380
|
+
/**
|
|
381
|
+
* The instant whose civil date picks the period (e.g. the record's
|
|
382
|
+
* `reportedAt`, so a backdated record numbers in its own year).
|
|
383
|
+
* @default now
|
|
384
|
+
*/
|
|
385
|
+
at?: Date;
|
|
386
|
+
/**
|
|
387
|
+
* Joins the base key and the period: `'<base><sep><period>'`.
|
|
388
|
+
* Pass `'.'` to keep counters an app already created as `occ.occurrence.2026`.
|
|
389
|
+
* @default ':'
|
|
390
|
+
*/
|
|
391
|
+
keySeparator?: string;
|
|
392
|
+
}
|
|
393
|
+
/** Options for {@link getNextPeriodSequence} / `SequenceCounter.nextInPeriod`. */
|
|
394
|
+
interface PeriodSequenceOptions extends PeriodSequenceKeyOptions {
|
|
395
|
+
/** @default 1 */
|
|
396
|
+
increment?: number;
|
|
397
|
+
/** Client session: the bump joins the caller's transaction. */
|
|
398
|
+
session?: mongoose.ClientSession;
|
|
399
|
+
}
|
|
400
|
+
/** A period-scoped counter value plus the period it was issued in. */
|
|
401
|
+
interface PeriodSequenceResult {
|
|
402
|
+
/** Value after the increment; `1` for the first value of a new period. */
|
|
403
|
+
seq: number;
|
|
404
|
+
/** The civil period (`'2026'`, `'2026-03'`, `'2026-03-14'`), for formatting the id. */
|
|
405
|
+
period: string;
|
|
406
|
+
/** The counter document's key (`'<base><sep><period>'`), for `read` / `ensureAtLeast`. */
|
|
407
|
+
counterKey: string;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* The counter key and civil period for a base key at an instant. Use it to
|
|
411
|
+
* `read` / `ensureAtLeast` the same counter `getNextPeriodSequence` bumps.
|
|
412
|
+
*/
|
|
413
|
+
declare function periodCounterKey(baseKey: string, options: PeriodSequenceKeyOptions): {
|
|
414
|
+
counterKey: string;
|
|
415
|
+
period: string;
|
|
416
|
+
};
|
|
417
|
+
/**
|
|
418
|
+
* Atomically issue the next value of a counter that resets every civil
|
|
419
|
+
* year / month / day in an IANA time zone. The period is derived from `at`
|
|
420
|
+
* (default now) in `timeZone`, so every replica agrees on it whatever its
|
|
421
|
+
* `TZ`, and DST never moves a boundary.
|
|
422
|
+
*
|
|
423
|
+
* @example Yearly reference `OC-2026-000123` in Riyadh
|
|
424
|
+
* const { seq, period } = await getNextPeriodSequence('occ.occurrence', {
|
|
425
|
+
* period: 'year', timeZone: 'Asia/Riyadh', at: reportedAt, connection, session,
|
|
426
|
+
* });
|
|
427
|
+
* const ref = `OC-${period}-${String(seq).padStart(6, '0')}`;
|
|
428
|
+
*/
|
|
429
|
+
declare function getNextPeriodSequence(baseKey: string, options: PeriodSequenceOptions & {
|
|
430
|
+
connection?: mongoose.Connection;
|
|
431
|
+
}): Promise<PeriodSequenceResult>;
|
|
326
432
|
interface SequentialIdOptions {
|
|
327
433
|
/** Prefix string (e.g., 'INV', 'ORD') */
|
|
328
434
|
prefix: string;
|
|
@@ -337,6 +443,11 @@ interface SequentialIdOptions {
|
|
|
337
443
|
separator?: string;
|
|
338
444
|
/** Custom counter key override (default: model.modelName) */
|
|
339
445
|
counterKey?: string;
|
|
446
|
+
/**
|
|
447
|
+
* Counter collection, same as `createSequenceCounter({ collection })`
|
|
448
|
+
* (for hosts with a collection-naming rule). @default `'_mongokit_counters'`
|
|
449
|
+
*/
|
|
450
|
+
counterCollection?: string;
|
|
340
451
|
}
|
|
341
452
|
/**
|
|
342
453
|
* Generator: Simple sequential counter.
|
|
@@ -413,6 +524,30 @@ interface DateSequentialIdOptions {
|
|
|
413
524
|
* stays invisible until one host is configured otherwise.
|
|
414
525
|
*/
|
|
415
526
|
timezone?: 'local' | 'utc';
|
|
527
|
+
/**
|
|
528
|
+
* IANA time zone whose civil calendar decides the period (e.g.
|
|
529
|
+
* `'Asia/Riyadh'`). Wins over `timezone`. Read through Intl, so every
|
|
530
|
+
* replica agrees on the boundary whatever its `TZ`, and DST never moves it.
|
|
531
|
+
* Invalid zones throw when the generator is built.
|
|
532
|
+
*/
|
|
533
|
+
timeZone?: string;
|
|
534
|
+
/**
|
|
535
|
+
* The instant whose civil date picks the period, e.g.
|
|
536
|
+
* `(ctx) => ctx.data?.reportedAt` so a backdated record numbers in its own
|
|
537
|
+
* period. `undefined` / `null` falls back to now; any other non-Date throws.
|
|
538
|
+
* @default now
|
|
539
|
+
*/
|
|
540
|
+
at?: (context: RepositoryContext) => Date | undefined | null;
|
|
541
|
+
/**
|
|
542
|
+
* Base counter key (the tenant id, under `scope: 'tenant'`, and the period
|
|
543
|
+
* are appended). @default `model.modelName`
|
|
544
|
+
*/
|
|
545
|
+
counterKey?: string;
|
|
546
|
+
/**
|
|
547
|
+
* Counter collection, same as `createSequenceCounter({ collection })`
|
|
548
|
+
* (for hosts with a collection-naming rule). @default `'_mongokit_counters'`
|
|
549
|
+
*/
|
|
550
|
+
counterCollection?: string;
|
|
416
551
|
}
|
|
417
552
|
/**
|
|
418
553
|
* Generator: Date-partitioned sequential counter.
|
|
@@ -493,8 +628,6 @@ declare function prefixedId(options: PrefixedIdOptions): IdGenerator;
|
|
|
493
628
|
* ```
|
|
494
629
|
*/
|
|
495
630
|
declare function customIdPlugin(options: CustomIdOptions): Plugin;
|
|
496
|
-
//#endregion
|
|
497
|
-
//#region src/plugins/multi-tenant.plugin.d.ts
|
|
498
631
|
/**
|
|
499
632
|
* Static tenant fields are picked from `@classytic/repo-core/tenant` so the
|
|
500
633
|
* vocabulary (`tenantField`, `contextKey`, `required`, `fieldType`) stays
|
|
@@ -653,5 +786,4 @@ declare function adminBypass(options: {
|
|
|
653
786
|
roleField?: string;
|
|
654
787
|
adminRoles: readonly string[];
|
|
655
788
|
}): (context: RepositoryContext, operation: string) => boolean;
|
|
656
|
-
|
|
657
|
-
export { EnsureAuditTrailReadyOptions as A, AuditQueryOptions as C, AuditTrailOptions as D, AuditTrailMode as E, ensureAuditTrailReady as M, AuditTrailQuery as O, AuditOperation as S, AuditTrailMethods as T, CacheOptions as _, DateSequentialIdOptions as a, cachePlugin as b, SequentialIdOptions as c, ensureSequenceAtLeast as d, getNextSequence as f, CacheAdapter$1 as g, sequentialId as h, CustomIdOptions as i, auditTrailPlugin as j, AuditTrailQueryOptions as k, customIdPlugin as l, readSequence as m, adminBypass as n, IdGenerator as o, prefixedId as p, multiTenantPlugin as r, PrefixedIdOptions as s, MultiTenantOptions as t, dateSequentialId as u, RepositoryCacheHandle$1 as v, AuditQueryResult as w, AuditEntry as x, RepositoryCachePluginOptions as y };
|
|
789
|
+
export { cachePlugin as A, EnsureAuditTrailReadyOptions as B, prefixedId as C, CacheOptions as D, CacheAdapter$1 as E, AuditTrailMethods as F, ensureAuditTrailReady as H, AuditTrailMode as I, AuditTrailOptions as L, AuditOperation as M, AuditQueryOptions as N, RepositoryCacheHandle$1 as O, AuditQueryResult as P, AuditTrailQuery as R, periodCounterKey as S, sequentialId as T, auditTrailPlugin as V, customIdPlugin as _, DateSequentialIdOptions as a, getNextPeriodSequence as b, PeriodSequenceOptions as c, SequenceCounter as d, SequenceCounterOptions as f, createSequenceCounter as g, civilPeriodKey as h, CustomIdOptions as i, AuditEntry as j, RepositoryCachePluginOptions as k, PeriodSequenceResult as l, SequentialIdOptions as m, adminBypass as n, IdGenerator as o, SequencePeriod as p, multiTenantPlugin as r, PeriodSequenceKeyOptions as s, MultiTenantOptions as t, PrefixedIdOptions as u, dateSequentialId as v, readSequence as w, getNextSequence as x, ensureSequenceAtLeast as y, AuditTrailQueryOptions as z };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { A as ObjectId, F as SortSpec, M as ReadPreferenceType, N as SelectSpec, b as WriteConcernSpec, i as CountStrategy, j as PopulateSpec, r as CollationOptions, v as ReadConcernLevel } from "./pagination-
|
|
1
|
+
import { A as ObjectId, F as SortSpec, M as ReadPreferenceType, N as SelectSpec, b as WriteConcernSpec, i as CountStrategy, j as PopulateSpec, r as CollationOptions, v as ReadConcernLevel } from "./pagination-BAM9cA4N.mjs";
|
|
2
2
|
import { DeleteManyResult, DeleteResult, LookupPopulateResult, UpdateManyResult } from "@classytic/repo-core/repository";
|
|
3
3
|
import { PipelineStage, PopulateOptions } from "mongoose";
|
|
4
4
|
import { Filter } from "@classytic/repo-core/filter";
|
|
5
|
-
//#region src/query/LookupBuilder.d.ts
|
|
6
5
|
interface LookupOptions {
|
|
7
6
|
/** Collection to join with */
|
|
8
7
|
from: string;
|
|
@@ -238,8 +237,6 @@ declare class LookupBuilder {
|
|
|
238
237
|
* - For read-heavy workloads: Consider caching or materialized views
|
|
239
238
|
* - For real-time dashboards: Consider separate aggregation collections
|
|
240
239
|
*/
|
|
241
|
-
//#endregion
|
|
242
|
-
//#region src/types/operations.d.ts
|
|
243
240
|
/** Session-only options — shared base for lightweight operations */
|
|
244
241
|
interface SessionOptions {
|
|
245
242
|
/** MongoDB session for transactions */
|
|
@@ -312,6 +309,19 @@ interface SessionOptions {
|
|
|
312
309
|
* substitute for access control — gate it at the host layer.
|
|
313
310
|
*/
|
|
314
311
|
bypassAppendOnly?: boolean;
|
|
312
|
+
/**
|
|
313
|
+
* Audited retention purge, the one public path past the integrity fences:
|
|
314
|
+
* on `delete` / `deleteMany` with `mode: 'hard'`, `appendOnlyPlugin` and
|
|
315
|
+
* `immutableStatesPlugin` built with `allowPurge: true` let this call
|
|
316
|
+
* through and emit `after:append-only-purge` /
|
|
317
|
+
* `after:immutable-states-purge`. `reason` is required. Ignored by every
|
|
318
|
+
* other op (rows never become editable through it). `purgeByFilter` /
|
|
319
|
+
* `purgeByField` take the same option and forward it to each chunk.
|
|
320
|
+
*/
|
|
321
|
+
retentionPurge?: {
|
|
322
|
+
reason: string;
|
|
323
|
+
actor?: string | undefined;
|
|
324
|
+
};
|
|
315
325
|
/** Write concern for this call; beats `queryDefaults.writeConcern`. Ignored by reads. */
|
|
316
326
|
writeConcern?: WriteConcernSpec;
|
|
317
327
|
/** Extensible — plugins can read custom fields from options */
|
|
@@ -368,12 +378,11 @@ interface CacheOperationOptions {
|
|
|
368
378
|
cache?: import('@classytic/repo-core/cache').CacheOptions;
|
|
369
379
|
}
|
|
370
380
|
/**
|
|
371
|
-
* `
|
|
372
|
-
*
|
|
373
|
-
* NOT
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
* from `maxCommitTimeMS`, which only bounds a single `commitTransaction` server call.
|
|
381
|
+
* `TransactionOptions` (readConcern, writeConcern, readPreference, maxCommitTimeMS) PLUS
|
|
382
|
+
* `timeoutMS`: the budget for the WHOLE transaction, including its retry loop (default 120 s).
|
|
383
|
+
* It is enforced by mongokit, NOT the driver (the driver's `timeoutMS` is a no-op since 7.8):
|
|
384
|
+
* every mongokit operation inside is sent with `maxTimeMS` = what remains, and the commit with
|
|
385
|
+
* `maxCommitTimeMS` = what remained when the attempt started.
|
|
377
386
|
*/
|
|
378
387
|
type ConvenientTransactionOptions = import('mongoose').mongo.TransactionOptions & {
|
|
379
388
|
timeoutMS?: number;
|
|
@@ -555,5 +564,4 @@ interface GetByIdsOptions extends OperationOptions {
|
|
|
555
564
|
/** Return `Array<TDoc | undefined>` aligned with the input ids instead of a Map. */
|
|
556
565
|
preserveOrder?: boolean;
|
|
557
566
|
}
|
|
558
|
-
//#endregion
|
|
559
567
|
export { LookupOptions as S, SessionOptions as _, ConvenientTransactionOptions as a, WithTransactionOptions as b, DeleteResult as c, GroupResult as d, LookupPopulateOptions as f, ReadOptions as g, OperationOptions as h, CacheableOptions as i, FindOneAndUpdateOptions as l, MinMaxResult as m, AggregateOptions as n, CreateOptions as o, LookupPopulateResult as p, CacheOperationOptions as r, DeleteManyResult as s, AggregateCallOptions as t, GetByIdsOptions as u, UpdateManyResult as v, LookupBuilder as x, UpdateOptions as y };
|
package/dist/outbox/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { r as Repository } from "../Repository-
|
|
1
|
+
import { r as Repository } from "../Repository-DJuRmBNx.mjs";
|
|
2
|
+
import { u as PaginationConfig } from "../pagination-BAM9cA4N.mjs";
|
|
2
3
|
import { Connection, Model } from "mongoose";
|
|
3
|
-
//#region src/outbox/index.d.ts
|
|
4
4
|
/** Delivery states. `dead_letter` is terminal and operator-visible. */
|
|
5
|
-
declare const OUTBOX_STATUSES: readonly [
|
|
6
|
-
interface OutboxModelOptions {
|
|
5
|
+
export declare const OUTBOX_STATUSES: readonly ['pending', 'delivered', 'dead_letter'];
|
|
6
|
+
export interface OutboxModelOptions {
|
|
7
7
|
/** Collection name. Default `event_outbox`. */
|
|
8
8
|
collection?: string;
|
|
9
9
|
/** Mongoose model name. Default `EventOutbox`. Must be unique per connection. */
|
|
@@ -31,7 +31,7 @@ interface OutboxModelOptions {
|
|
|
31
31
|
* Idempotent per connection: calling twice returns the same model rather than throwing
|
|
32
32
|
* `OverwriteModelError`, so a host may build it lazily from several call sites.
|
|
33
33
|
*/
|
|
34
|
-
declare function createOutboxModel(connection: Connection, options?: OutboxModelOptions): Model<Record<string, unknown>>;
|
|
34
|
+
export declare function createOutboxModel(connection: Connection, options?: OutboxModelOptions): Model<Record<string, unknown>>;
|
|
35
35
|
/**
|
|
36
36
|
* The repository `repositoryAsOutboxStore` needs, with the plugin set it actually calls.
|
|
37
37
|
*
|
|
@@ -55,9 +55,24 @@ declare function createOutboxModel(connection: Connection, options?: OutboxModel
|
|
|
55
55
|
*
|
|
56
56
|
* `plugins` appends to the required set rather than replacing it — for an observability or
|
|
57
57
|
* cache plugin a deployment wants on this table too.
|
|
58
|
+
*
|
|
59
|
+
* **The caller's `limit` is the bound.** The adapter reads its claim window with
|
|
60
|
+
* `getAll({ limit: batchSize })`. A repository built with the generic pagination default
|
|
61
|
+
* (`maxLimit: 100`) clamps that read silently, so a relay configured for 500 claims 100, sees
|
|
62
|
+
* "fewer than batchSize" and stops its multi-pass drain after one pass. This table is never
|
|
63
|
+
* listed to an HTTP client, and every read the adapter makes names its own limit (the relay's
|
|
64
|
+
* `batchSize`, an admin route's already-bounded `limit`), so the repository defaults to
|
|
65
|
+
* `maxLimit: 0` (no cap). A read with no limit still gets `defaultLimit`. Pass `pagination` to
|
|
66
|
+
* set a ceiling anyway.
|
|
58
67
|
*/
|
|
59
|
-
declare function createOutboxRepository(connection: Connection, options?:
|
|
68
|
+
export declare function createOutboxRepository(connection: Connection, options?: OutboxRepositoryOptions): Repository<Record<string, unknown>>;
|
|
69
|
+
export interface OutboxRepositoryOptions extends OutboxModelOptions {
|
|
70
|
+
/** Appended to the required plugin set (`methodRegistryPlugin`, `batchOperationsPlugin`). */
|
|
60
71
|
plugins?: readonly unknown[];
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Pagination config for the repository. Default `{ maxLimit: 0 }`: a read returns as many
|
|
74
|
+
* rows as its `limit` asks for. Set `maxLimit` to cap every read; the relay's `batchSize`
|
|
75
|
+
* must then stay at or below it, or each pass is clamped to the cap.
|
|
76
|
+
*/
|
|
77
|
+
pagination?: PaginationConfig;
|
|
78
|
+
}
|
package/dist/outbox/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { n as
|
|
1
|
+
import { n as batchOperationsPlugin, t as methodRegistryPlugin } from "../method-registry.plugin-BeJfQBJV.mjs";
|
|
2
|
+
import { n as Repository } from "../Repository-DheA7oW-.mjs";
|
|
3
3
|
import { Schema } from "mongoose";
|
|
4
|
-
|
|
4
|
+
// src/outbox/index.ts
|
|
5
5
|
/**
|
|
6
6
|
* The mongo-backed OUTBOX table — schema, indexes and repository.
|
|
7
7
|
*
|
|
@@ -228,14 +228,25 @@ function createOutboxModel(connection, options = {}) {
|
|
|
228
228
|
*
|
|
229
229
|
* `plugins` appends to the required set rather than replacing it — for an observability or
|
|
230
230
|
* cache plugin a deployment wants on this table too.
|
|
231
|
+
*
|
|
232
|
+
* **The caller's `limit` is the bound.** The adapter reads its claim window with
|
|
233
|
+
* `getAll({ limit: batchSize })`. A repository built with the generic pagination default
|
|
234
|
+
* (`maxLimit: 100`) clamps that read silently, so a relay configured for 500 claims 100, sees
|
|
235
|
+
* "fewer than batchSize" and stops its multi-pass drain after one pass. This table is never
|
|
236
|
+
* listed to an HTTP client, and every read the adapter makes names its own limit (the relay's
|
|
237
|
+
* `batchSize`, an admin route's already-bounded `limit`), so the repository defaults to
|
|
238
|
+
* `maxLimit: 0` (no cap). A read with no limit still gets `defaultLimit`. Pass `pagination` to
|
|
239
|
+
* set a ceiling anyway.
|
|
231
240
|
*/
|
|
232
241
|
function createOutboxRepository(connection, options = {}) {
|
|
233
|
-
const { plugins = [], ...modelOptions } = options;
|
|
242
|
+
const { plugins = [], pagination, ...modelOptions } = options;
|
|
234
243
|
return new Repository(createOutboxModel(connection, modelOptions), [
|
|
235
244
|
methodRegistryPlugin(),
|
|
236
245
|
batchOperationsPlugin(),
|
|
237
246
|
...plugins
|
|
238
|
-
]
|
|
247
|
+
], {
|
|
248
|
+
maxLimit: 0,
|
|
249
|
+
...pagination
|
|
250
|
+
});
|
|
239
251
|
}
|
|
240
|
-
//#endregion
|
|
241
252
|
export { OUTBOX_STATUSES, createOutboxModel, createOutboxRepository };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as PaginationEngine, t as CountMemoKey } from "../PaginationEngine-
|
|
1
|
+
import { n as PaginationEngine, t as CountMemoKey } from "../PaginationEngine-BWb-c47a.mjs";
|
|
2
2
|
export { CountMemoKey, PaginationEngine };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as PaginationEngine } from "../PaginationEngine-
|
|
1
|
+
export { t as PaginationEngine } from "../PaginationEngine-BRlLTQQz.mjs";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { u as PaginationConfig } from "../../pagination-
|
|
2
|
-
//#region src/pagination/utils/limits.d.ts
|
|
1
|
+
import { u as PaginationConfig } from "../../pagination-BAM9cA4N.mjs";
|
|
3
2
|
/**
|
|
4
3
|
* Validates and sanitizes limit value
|
|
5
4
|
* Parses strings to numbers and prevents NaN bugs
|
|
@@ -8,7 +7,7 @@ import { u as PaginationConfig } from "../../pagination-D6psses0.mjs";
|
|
|
8
7
|
* @param config - Pagination configuration
|
|
9
8
|
* @returns Sanitized limit between 1 and maxLimit
|
|
10
9
|
*/
|
|
11
|
-
declare function validateLimit(limit: number | string, config: PaginationConfig): number;
|
|
10
|
+
export declare function validateLimit(limit: number | string, config: PaginationConfig): number;
|
|
12
11
|
/**
|
|
13
12
|
* Validates and sanitizes page number
|
|
14
13
|
* Parses strings to numbers and prevents NaN bugs
|
|
@@ -18,7 +17,7 @@ declare function validateLimit(limit: number | string, config: PaginationConfig)
|
|
|
18
17
|
* @returns Sanitized page number >= 1
|
|
19
18
|
* @throws Error if page exceeds maxPage
|
|
20
19
|
*/
|
|
21
|
-
declare function validatePage(page: number | string, config: PaginationConfig): number;
|
|
20
|
+
export declare function validatePage(page: number | string, config: PaginationConfig): number;
|
|
22
21
|
/**
|
|
23
22
|
* Checks if page number should trigger deep pagination warning
|
|
24
23
|
*
|
|
@@ -26,7 +25,7 @@ declare function validatePage(page: number | string, config: PaginationConfig):
|
|
|
26
25
|
* @param threshold - Warning threshold
|
|
27
26
|
* @returns True if warning should be shown
|
|
28
27
|
*/
|
|
29
|
-
declare function shouldWarnDeepPagination(page: number, threshold: number): boolean;
|
|
28
|
+
export declare function shouldWarnDeepPagination(page: number, threshold: number): boolean;
|
|
30
29
|
/**
|
|
31
30
|
* Calculates number of documents to skip for offset pagination
|
|
32
31
|
*
|
|
@@ -34,7 +33,7 @@ declare function shouldWarnDeepPagination(page: number, threshold: number): bool
|
|
|
34
33
|
* @param limit - Documents per page
|
|
35
34
|
* @returns Number of documents to skip
|
|
36
35
|
*/
|
|
37
|
-
declare function calculateSkip(page: number, limit: number): number;
|
|
36
|
+
export declare function calculateSkip(page: number, limit: number): number;
|
|
38
37
|
/**
|
|
39
38
|
* Calculates total number of pages
|
|
40
39
|
*
|
|
@@ -42,6 +41,4 @@ declare function calculateSkip(page: number, limit: number): number;
|
|
|
42
41
|
* @param limit - Documents per page
|
|
43
42
|
* @returns Total number of pages
|
|
44
43
|
*/
|
|
45
|
-
declare function calculateTotalPages(total: number, limit: number): number;
|
|
46
|
-
//#endregion
|
|
47
|
-
export { calculateSkip, calculateTotalPages, shouldWarnDeepPagination, validateLimit, validatePage };
|
|
44
|
+
export declare function calculateTotalPages(total: number, limit: number): number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createError } from "../../error-
|
|
2
|
-
|
|
1
|
+
import { t as createError } from "../../error-DjdmPLWO.mjs";
|
|
2
|
+
// src/pagination/utils/limits.ts
|
|
3
3
|
/**
|
|
4
4
|
* Validates and sanitizes limit value
|
|
5
5
|
* Parses strings to numbers and prevents NaN bugs
|
|
@@ -81,5 +81,4 @@ function calculateSkip(page, limit) {
|
|
|
81
81
|
function calculateTotalPages(total, limit) {
|
|
82
82
|
return Math.ceil(total / limit);
|
|
83
83
|
}
|
|
84
|
-
//#endregion
|
|
85
84
|
export { calculateSkip, calculateTotalPages, shouldWarnDeepPagination, validateLimit, validatePage };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/types/core.d.ts
|
|
1
|
+
import { Document, Model, PipelineStage, PopulateOptions, Types } from "mongoose";
|
|
3
2
|
/**
|
|
4
3
|
* Core query/document primitives shared across every mongokit module —
|
|
5
4
|
* sort/select/populate/filter specs and the mongoose-facing aliases.
|
|
@@ -46,8 +45,6 @@ type PopulateSpec = string | string[] | PopulateOptions | PopulateOptions[];
|
|
|
46
45
|
type SelectSpec = string | readonly string[] | Record<string, 0 | 1>;
|
|
47
46
|
/** Filter query type for MongoDB queries (compatible with Mongoose 8 & 9) */
|
|
48
47
|
type FilterQuery<_T = unknown> = Record<string, unknown>;
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region src/repository/query-defaults.d.ts
|
|
51
48
|
type ReadConcernLevel = 'local' | 'available' | 'majority' | 'linearizable' | 'snapshot';
|
|
52
49
|
interface WriteConcernSpec {
|
|
53
50
|
w?: number | 'majority';
|
|
@@ -102,25 +99,21 @@ declare function getQueryDefaults(): {
|
|
|
102
99
|
/** Back to no deployment defaults. For tests. */
|
|
103
100
|
declare function resetQueryDefaults(): void;
|
|
104
101
|
/**
|
|
105
|
-
* Boot check (M7): throws unless the deployment sets a query `maxTimeMS
|
|
106
|
-
* is
|
|
102
|
+
* Boot check (M7): throws unless the deployment sets a query `maxTimeMS`. Returns what it verified.
|
|
103
|
+
* A client `timeoutMS` is not checked: the driver (7.8+) drops it from the client options and only
|
|
104
|
+
* logs a process warning, so there is nothing to read; it bounds nothing either way.
|
|
107
105
|
*/
|
|
108
|
-
declare function assertQueryDefaultsConfigured(
|
|
106
|
+
declare function assertQueryDefaultsConfigured(): {
|
|
109
107
|
maxTimeMS: number;
|
|
110
|
-
timeoutMS?: number;
|
|
111
108
|
};
|
|
112
109
|
declare const QUERY_DEFAULTS_ERROR_CODES: {
|
|
113
|
-
readonly NOT_CONFIGURED:
|
|
114
|
-
/** A per-call bound inside a transaction that carries its own CSOT budget (the driver forbids both). */
|
|
115
|
-
readonly TIMEOUT_IN_TRANSACTION: "mongokit.query_defaults.timeout_in_transaction";
|
|
110
|
+
readonly NOT_CONFIGURED: 'mongokit.query_defaults.not_configured';
|
|
116
111
|
};
|
|
117
112
|
/** Resolve the options one command runs with. `repo` is the repository's own defaults. */
|
|
118
113
|
declare function resolveQueryOptions(kind: CommandKind, perCall: PerCallQueryOptions, repo?: {
|
|
119
114
|
query?: QueryDefaults;
|
|
120
115
|
aggregate?: AggregateDefaults;
|
|
121
116
|
}): ResolvedQueryOptions;
|
|
122
|
-
//#endregion
|
|
123
|
-
//#region src/pagination/utils/cursor-signing.d.ts
|
|
124
117
|
/**
|
|
125
118
|
* HMAC signing for pagination cursors.
|
|
126
119
|
*
|
|
@@ -156,8 +149,6 @@ declare function resolveQueryOptions(kind: CommandKind, perCall: PerCallQueryOpt
|
|
|
156
149
|
*/
|
|
157
150
|
/** One key, or several during a rotation (the FIRST signs; all verify). */
|
|
158
151
|
type CursorSecret = string | readonly string[];
|
|
159
|
-
//#endregion
|
|
160
|
-
//#region src/types/pagination.d.ts
|
|
161
152
|
/**
|
|
162
153
|
* How an offset page learns how many rows sit behind it.
|
|
163
154
|
*
|
|
@@ -463,5 +454,4 @@ interface DecodedCursor {
|
|
|
463
454
|
/** Scope fingerprint the cursor was minted under. */
|
|
464
455
|
scope: string;
|
|
465
456
|
}
|
|
466
|
-
//#endregion
|
|
467
457
|
export { ObjectId as A, configureQueryDefaults as C, AnyDocument as D, resolveQueryOptions as E, SortSpec as F, ReadPreferenceType as M, SelectSpec as N, AnyModel as O, SortDirection as P, configureAggregateDefaults as S, resetQueryDefaults as T, QueryDefaults as _, CursorPayload as a, WriteConcernSpec as b, MongokitPageExtras as c, ValueType as d, CursorSecret as f, QUERY_DEFAULTS_ERROR_CODES as g, PerCallQueryOptions as h, CountStrategy as i, PopulateSpec as j, FilterQuery as k, OffsetPaginationOptions as l, CommandKind as m, BasePaginationOptions as n, DecodedCursor as o, AggregateDefaults as p, CollationOptions as r, KeysetPaginationOptions as s, AggregatePaginationOptions as t, PaginationConfig as u, ReadConcernLevel as v, getQueryDefaults as w, assertQueryDefaultsConfigured as x, ResolvedQueryOptions as y };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { A as ObjectId, F as SortSpec, N as SelectSpec, j as PopulateSpec } from "./pagination-
|
|
2
|
-
import { h as RepositoryInstance, p as RepositoryContext } from "./repository-
|
|
1
|
+
import { A as ObjectId, F as SortSpec, N as SelectSpec, j as PopulateSpec } from "./pagination-BAM9cA4N.mjs";
|
|
2
|
+
import { h as RepositoryInstance, p as RepositoryContext } from "./repository-B0aFVgP2.mjs";
|
|
3
3
|
import { OffsetPaginationResult } from "@classytic/repo-core/pagination";
|
|
4
|
-
//#region src/types/plugin-options.d.ts
|
|
5
4
|
/** Field preset configuration (field-filter plugin) */
|
|
6
5
|
interface FieldPreset {
|
|
7
6
|
/** Fields visible to everyone */
|
|
@@ -165,5 +164,4 @@ interface CascadeOptions {
|
|
|
165
164
|
/** Logger for cascade operations */
|
|
166
165
|
logger?: Logger;
|
|
167
166
|
}
|
|
168
|
-
//#endregion
|
|
169
167
|
export { SoftDeleteFilterMode as a, ValidationChainOptions as c, Logger as i, ValidatorDefinition as l, CascadeRelation as n, SoftDeleteOptions as o, FieldPreset as r, SoftDeleteRepository as s, CascadeOptions as t };
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import { A as EnsureAuditTrailReadyOptions, C as
|
|
3
|
-
import {
|
|
1
|
+
import { A as ImmutablePurgeEvent, B as elasticSearchPlugin, C as MethodRegistryRepository, D as LeasePluginOptions, E as LeasePendingFilter, F as IdempotencyStoreMethods, G as batchOperationsPlugin, H as BatchOperationsMethods, I as IdempotencyStorePluginOptions, J as AppendOnlyPurgeEvent, K as auditLogPlugin, L as idempotencyStorePlugin, M as ImmutableStatesPluginOptions, N as immutableStatesPlugin, O as leasePlugin, P as IdempotencyClaim, R as fieldFilterPlugin, S as mongoOperationsPlugin, T as LeaseMethods, V as cascadePlugin, X as AggregateHelpersMethods, Y as appendOnlyPlugin, Z as aggregateHelpersPlugin, _ as searchKeysPlugin, a as requireField, b as observabilityPlugin, c as timestampPlugin, d as createTenantContext, f as SubdocumentMethods, g as SearchKeysPluginOptions, h as softDeletePlugin, i as immutableField, j as ImmutablePurgeRequest, k as ImmutableClaimView, l as TenantContext, m as SoftDeleteMethods, n as autoInject, o as uniqueField, p as subdocumentPlugin, q as AppendOnlyPluginOptions, r as blockIf, s as validationChainPlugin, t as OperationType, u as TenantStore, v as ObservabilityOptions, w as methodRegistryPlugin, x as MongoOperationsMethods, y as OperationMetric, z as ElasticSearchOptions } from "../validation-chain.plugin-COYrUdd8.mjs";
|
|
2
|
+
import { A as cachePlugin, B as EnsureAuditTrailReadyOptions, C as prefixedId, D as CacheOptions, E as CacheAdapter, F as AuditTrailMethods, H as ensureAuditTrailReady, I as AuditTrailMode, L as AuditTrailOptions, M as AuditOperation, N as AuditQueryOptions, O as RepositoryCacheHandle, P as AuditQueryResult, R as AuditTrailQuery, T as sequentialId, V as auditTrailPlugin, _ as customIdPlugin, a as DateSequentialIdOptions, b as getNextPeriodSequence, i as CustomIdOptions, j as AuditEntry, k as RepositoryCachePluginOptions, m as SequentialIdOptions, o as IdGenerator, r as multiTenantPlugin, t as MultiTenantOptions, u as PrefixedIdOptions, v as dateSequentialId, x as getNextSequence, z as AuditTrailQueryOptions } from "../multi-tenant.plugin-BTPtCLNK.mjs";
|
|
3
|
+
import { C as RepositoryPluginName, S as MongoKitPluginName, l as Plugin, x as MONGOKIT_PLUGIN_NAMES } from "../repository-B0aFVgP2.mjs";
|
|
4
|
+
import { n as RetentionPurgeEvent, r as RetentionPurgeRequest, t as RETENTION_PURGE_ERROR_CODES } from "../retention-purge-CCd_VXUf.mjs";
|
|
4
5
|
import { ChangeLogStore } from "@classytic/repo-core/sync";
|
|
5
|
-
//#region src/plugins/change-log.plugin.d.ts
|
|
6
6
|
interface ChangeLogPluginOptions {
|
|
7
7
|
/** Durable feed implementing the repo-core/sync contract. */
|
|
8
8
|
store: ChangeLogStore;
|
|
@@ -18,6 +18,5 @@ interface ChangeLogPluginOptions {
|
|
|
18
18
|
*/
|
|
19
19
|
project?: (doc: Record<string, unknown>) => Record<string, unknown>;
|
|
20
20
|
}
|
|
21
|
-
declare function changeLogPlugin(options: ChangeLogPluginOptions): Plugin;
|
|
22
|
-
|
|
23
|
-
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 OperationType, type PrefixedIdOptions, type RepositoryCacheHandle, type RepositoryCachePluginOptions, type RepositoryPluginName, type SearchKeysPluginOptions, 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, searchKeysPlugin, sequentialId, softDeletePlugin, subdocumentPlugin, timestampPlugin, uniqueField, validationChainPlugin };
|
|
21
|
+
export declare function changeLogPlugin(options: ChangeLogPluginOptions): Plugin;
|
|
22
|
+
export { type AggregateHelpersMethods, type AppendOnlyPluginOptions, type AppendOnlyPurgeEvent, 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 ImmutablePurgeEvent, type ImmutablePurgeRequest, type ImmutableStatesPluginOptions, type LeaseMethods, type LeasePendingFilter, type LeasePluginOptions, MONGOKIT_PLUGIN_NAMES, type MethodRegistryRepository, type MongoKitPluginName, type MongoOperationsMethods, type MultiTenantOptions, type ObservabilityOptions, type OperationMetric, type OperationType, type PrefixedIdOptions, RETENTION_PURGE_ERROR_CODES, type RepositoryCacheHandle, type RepositoryCachePluginOptions, type RepositoryPluginName, type RetentionPurgeEvent, type RetentionPurgeRequest, type SearchKeysPluginOptions, type SequentialIdOptions, type SoftDeleteMethods, type SubdocumentMethods, type TenantContext, type TenantStore, aggregateHelpersPlugin, appendOnlyPlugin, auditLogPlugin, auditTrailPlugin, autoInject, batchOperationsPlugin, blockIf, cachePlugin, cascadePlugin, createTenantContext, customIdPlugin, dateSequentialId, elasticSearchPlugin, ensureAuditTrailReady, fieldFilterPlugin, getNextPeriodSequence, getNextSequence, idempotencyStorePlugin, immutableField, immutableStatesPlugin, leasePlugin, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, prefixedId, requireField, searchKeysPlugin, sequentialId, softDeletePlugin, subdocumentPlugin, timestampPlugin, uniqueField, validationChainPlugin };
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import { _ as
|
|
3
|
-
import { n as batchOperationsPlugin, t as methodRegistryPlugin } from "../method-registry.plugin-
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
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-DJplVJ12.mjs";
|
|
2
|
+
import { C as ensureAuditTrailReady, S as auditTrailPlugin, _ as prefixedId, b as cachePlugin, d as customIdPlugin, f as dateSequentialId, h as getNextSequence, i as multiTenantPlugin, m as getNextPeriodSequence, n as softDeletePlugin, t as timestampPlugin, w as auditLogPlugin, x as AuditTrailQuery, y as sequentialId } from "../timestamp.plugin-B-IJrlYb.mjs";
|
|
3
|
+
import { n as batchOperationsPlugin, t as methodRegistryPlugin } from "../method-registry.plugin-BeJfQBJV.mjs";
|
|
4
|
+
import { d as RETENTION_PURGE_ERROR_CODES, i as searchKeysPlugin } from "../Repository-DheA7oW-.mjs";
|
|
5
|
+
// src/plugins/change-log.plugin.ts
|
|
6
6
|
const PLUGIN_NAME = "changeLog";
|
|
7
7
|
/** Marks a repository already captured: the store and scope it writes to. */
|
|
8
8
|
const CAPTURED = Symbol.for("mongokit.changeLog.capture");
|
|
@@ -175,5 +175,4 @@ function changeLogPlugin(options) {
|
|
|
175
175
|
}
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
|
-
|
|
179
|
-
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, searchKeysPlugin, sequentialId, softDeletePlugin, subdocumentPlugin, timestampPlugin, uniqueField, validationChainPlugin };
|
|
178
|
+
export { AuditTrailQuery, MONGOKIT_PLUGIN_NAMES, RETENTION_PURGE_ERROR_CODES, aggregateHelpersPlugin, appendOnlyPlugin, auditLogPlugin, auditTrailPlugin, autoInject, batchOperationsPlugin, blockIf, cachePlugin, cascadePlugin, changeLogPlugin, createTenantContext, customIdPlugin, dateSequentialId, elasticSearchPlugin, ensureAuditTrailReady, fieldFilterPlugin, getNextPeriodSequence, getNextSequence, idempotencyStorePlugin, immutableField, immutableStatesPlugin, leasePlugin, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, prefixedId, requireField, searchKeysPlugin, sequentialId, softDeletePlugin, subdocumentPlugin, timestampPlugin, uniqueField, validationChainPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as coerceHeuristic, i as coerceFieldValue, n as SchemaPathsLike, o as coerceToType, r as buildFieldTypeMap, s as normalizeMongooseType, t as FieldType } from "../../coercion-
|
|
1
|
+
import { a as coerceHeuristic, i as coerceFieldValue, n as SchemaPathsLike, o as coerceToType, r as buildFieldTypeMap, s as normalizeMongooseType, t as FieldType } from "../../coercion-COp9DRNw.mjs";
|
|
2
2
|
export { FieldType, SchemaPathsLike, buildFieldTypeMap, coerceFieldValue, coerceHeuristic, coerceToType, normalizeMongooseType };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as isObjectIdInstance } from "../../id-resolution-
|
|
1
|
+
import { r as isObjectIdInstance } from "../../id-resolution-Cqh49d9J.mjs";
|
|
2
2
|
import mongoose from "mongoose";
|
|
3
|
-
|
|
3
|
+
// src/query/primitives/coercion.ts
|
|
4
4
|
/**
|
|
5
5
|
* Value coercion primitives
|
|
6
6
|
*
|
|
@@ -144,5 +144,4 @@ function coerceFieldValue(field, value, types) {
|
|
|
144
144
|
if (!type) return coerceHeuristic(value);
|
|
145
145
|
return coerceToType(value, type);
|
|
146
146
|
}
|
|
147
|
-
//#endregion
|
|
148
147
|
export { buildFieldTypeMap, coerceFieldValue, coerceHeuristic, coerceToType, normalizeMongooseType };
|