@classytic/repo-core 0.12.0 → 0.13.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/CHANGELOG.md +666 -666
- package/dist/repository/types.d.mts +8 -4
- package/package.json +1 -1
|
@@ -344,7 +344,7 @@ interface ClaimTransition {
|
|
|
344
344
|
}
|
|
345
345
|
/**
|
|
346
346
|
* Structural contract for the state machine consumed by
|
|
347
|
-
* `StandardRepo.
|
|
347
|
+
* `StandardRepo.applyTransition()` — the CANONICAL shape; mongokit's
|
|
348
348
|
* `TransitionMachine` and primitives' `StateMachine` (from
|
|
349
349
|
* `@classytic/primitives/state-machine`, whose `defineStateMachine()`
|
|
350
350
|
* satisfies it as-is) are structurally identical by design. Neither
|
|
@@ -361,7 +361,7 @@ interface TransitionMachine {
|
|
|
361
361
|
assertTransition(entityId: string, from: string, to: string): void;
|
|
362
362
|
}
|
|
363
363
|
/**
|
|
364
|
-
* Args for `StandardRepo.
|
|
364
|
+
* Args for `StandardRepo.applyTransition()` — the state-machine-backed CAS
|
|
365
365
|
* with status history. See the method JSDoc for semantics.
|
|
366
366
|
*/
|
|
367
367
|
interface TransitionArgs {
|
|
@@ -373,6 +373,10 @@ interface TransitionArgs {
|
|
|
373
373
|
set?: Record<string, unknown>;
|
|
374
374
|
/** Kit-specific extra append entries merged beside the history append. */
|
|
375
375
|
push?: Record<string, unknown>;
|
|
376
|
+
/** Counter increments applied alongside the state write. */
|
|
377
|
+
inc?: Record<string, number>;
|
|
378
|
+
/** Field paths cleared alongside the state write. */
|
|
379
|
+
unset?: Record<string, unknown>;
|
|
376
380
|
/** Additional CAS guards, AND-merged into the match (same as `ClaimTransition.where`). */
|
|
377
381
|
where?: Record<string, unknown>;
|
|
378
382
|
by?: string;
|
|
@@ -1452,7 +1456,7 @@ interface StandardRepo<TDoc> extends MinimalRepo<TDoc> {
|
|
|
1452
1456
|
claimVersion(id: string, transition: ClaimVersionTransition, update: Record<string, unknown>, options?: WriteOptions): Promise<TDoc | null>;
|
|
1453
1457
|
/**
|
|
1454
1458
|
* State-machine-backed CAS transition with status history — the
|
|
1455
|
-
* canonical domain-verb shape (mongokit 3.22 `Repository.
|
|
1459
|
+
* canonical domain-verb shape (mongokit 3.22 `Repository.applyTransition`).
|
|
1456
1460
|
* One call: machine legality pre-flight (the machine throws the
|
|
1457
1461
|
* DOMAIN's typed error), CAS via `claim`, appended history entry
|
|
1458
1462
|
* (`{ status: to, occurredAt, by?, note? }` onto `args.history` /
|
|
@@ -1470,7 +1474,7 @@ interface StandardRepo<TDoc> extends MinimalRepo<TDoc> {
|
|
|
1470
1474
|
* required once sqlitekit implements it (SQL kits compile the
|
|
1471
1475
|
* history append to their JSON-array/audit-table strategy).
|
|
1472
1476
|
*/
|
|
1473
|
-
|
|
1477
|
+
applyTransition?(id: string, machine: TransitionMachine, args: TransitionArgs, options?: WriteOptions): Promise<TDoc>;
|
|
1474
1478
|
/**
|
|
1475
1479
|
* Classify an error from a write as a unique-constraint violation.
|
|
1476
1480
|
* Arc's idempotency + outbox adapters need this to distinguish
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classytic/repo-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Driver-agnostic repository primitives: hooks, Filter IR, operations, pagination, cache contract. Foundation for mongokit, sqlitekit, pgkit, and prismakit. Lean by design — no plugins ship here; each kit owns its own.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|