@classytic/repo-core 0.32.0 → 0.33.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
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to `@classytic/repo-core` are documented here.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.33.0] - 2026-10-27
|
|
8
|
+
|
|
9
|
+
### Changed - BREAKING: `PurgeStepRepository.countDocuments` renamed to `count` (`./cleanup`)
|
|
10
|
+
|
|
11
|
+
`definePurgeStep` now counts through `count`, the `StandardRepo` name every kit implements; no kit has a `countDocuments` method. Before, a kit repository passed in (usually via an `as PurgeStepRepository` cast) previewed `estimated: 0` and failed every verify check with "could not verify". A test now checks that a `StandardRepo` is a `PurgeStepRepository` with no adapter. Migration: drop any `countDocuments: (f) => repo.count(f)` shim and pass the kit repository directly; in custom repositories and test stubs, rename `countDocuments` to `count`.
|
|
12
|
+
|
|
7
13
|
## [0.32.0] - 2026-10-23
|
|
8
14
|
|
|
9
15
|
### Added - `formatQuery` / `stringifyQuery` (`./query-parser`)
|
|
@@ -2,7 +2,8 @@ import { TenantPurgeOptions, TenantPurgeStrategy } from "../repository/types.mjs
|
|
|
2
2
|
import { CleanupStep, CleanupStepContext } from "./types.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* The repository surface a purge step needs — a structural subset of
|
|
5
|
-
* `StandardRepo
|
|
5
|
+
* `StandardRepo` (`purgeByField` + `count`, the same names every kit
|
|
6
|
+
* implements), so any kit repository satisfies it without an adapter.
|
|
6
7
|
* Both members are optional so an engine that never wired the repository
|
|
7
8
|
* yields a BLOCKER rather than a crash.
|
|
8
9
|
*/
|
|
@@ -14,7 +15,7 @@ interface PurgeStepRepository {
|
|
|
14
15
|
message: string;
|
|
15
16
|
};
|
|
16
17
|
}>;
|
|
17
|
-
|
|
18
|
+
count?(filter: Record<string, unknown>): Promise<number>;
|
|
18
19
|
}
|
|
19
20
|
interface PurgeStepSpec {
|
|
20
21
|
/** Stable machine id, unique within a recipe. */
|
|
@@ -42,7 +42,7 @@ function definePurgeStep(repository, spec) {
|
|
|
42
42
|
estimated: 0,
|
|
43
43
|
blockers: [`${REPOSITORY_UNAVAILABLE}:${spec.id}`]
|
|
44
44
|
};
|
|
45
|
-
const estimated = await repository.
|
|
45
|
+
const estimated = await repository.count?.({ [spec.field]: scope }) ?? 0;
|
|
46
46
|
const blockers = await spec.guard?.(scope, ctx) ?? [];
|
|
47
47
|
return {
|
|
48
48
|
resource: spec.resource,
|
|
@@ -89,12 +89,12 @@ function definePurgeStep(repository, spec) {
|
|
|
89
89
|
},
|
|
90
90
|
async verify(ctx) {
|
|
91
91
|
const scope = scopeOf(ctx, spec.parameter);
|
|
92
|
-
if (!scope || !repository?.
|
|
92
|
+
if (!scope || !repository?.count) return [{
|
|
93
93
|
name: verifyName,
|
|
94
94
|
ok: false,
|
|
95
95
|
detail: "could not verify — no scope or no count support"
|
|
96
96
|
}];
|
|
97
|
-
const remaining = await repository.
|
|
97
|
+
const remaining = await repository.count(filterFor(scope));
|
|
98
98
|
return [{
|
|
99
99
|
name: verifyName,
|
|
100
100
|
ok: remaining === 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classytic/repo-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.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,
|