@classytic/repo-core 0.31.1 → 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 +20 -0
- package/dist/_virtual/_rolldown/runtime.mjs +1 -2
- package/dist/adapter/index.mjs +1 -2
- package/dist/adapter/types.d.mts +0 -2
- package/dist/adapter/widen.d.mts +0 -2
- package/dist/adapter/widen.mjs +1 -2
- package/dist/aggregate/keyset.d.mts +0 -2
- package/dist/aggregate/keyset.mjs +1 -2
- package/dist/aggregate/normalize.d.mts +0 -2
- package/dist/aggregate/normalize.mjs +1 -2
- package/dist/better-auth/index.d.mts +0 -2
- package/dist/better-auth/index.mjs +1 -2
- package/dist/cache/engine.d.mts +0 -2
- package/dist/cache/engine.mjs +1 -2
- package/dist/cache/envelope.mjs +1 -2
- package/dist/cache/keys.mjs +1 -2
- package/dist/cache/memo.d.mts +0 -2
- package/dist/cache/memo.mjs +1 -2
- package/dist/cache/memory-adapter.d.mts +0 -2
- package/dist/cache/memory-adapter.mjs +1 -2
- package/dist/cache/options.d.mts +0 -2
- package/dist/cache/options.mjs +1 -2
- package/dist/cache/plugin/context.d.mts +0 -2
- package/dist/cache/plugin/context.mjs +1 -2
- package/dist/cache/plugin/index.d.mts +0 -2
- package/dist/cache/plugin/index.mjs +1 -2
- package/dist/cache/plugin/invalidation-hooks.mjs +1 -2
- package/dist/cache/plugin/read-hooks.mjs +1 -2
- package/dist/cache/plugin/swr.mjs +1 -2
- package/dist/cache/runtime.d.mts +0 -2
- package/dist/cache/runtime.mjs +0 -1
- package/dist/cache/stable-stringify.d.mts +0 -2
- package/dist/cache/stable-stringify.mjs +1 -2
- package/dist/cache/tag-index.mjs +1 -2
- package/dist/cache/timeout-adapter.d.mts +0 -2
- package/dist/cache/timeout-adapter.mjs +1 -2
- package/dist/cache/types.d.mts +0 -2
- package/dist/cache/version-store.mjs +1 -2
- package/dist/cleanup/define-purge-step.d.mts +3 -4
- package/dist/cleanup/define-purge-step.mjs +4 -5
- package/dist/cleanup/index.mjs +1 -2
- package/dist/cleanup/types.d.mts +0 -2
- package/dist/context/types.d.mts +0 -2
- package/dist/errors/codes.d.mts +0 -2
- package/dist/errors/codes.mjs +1 -2
- package/dist/errors/conflict.d.mts +0 -2
- package/dist/errors/conflict.mjs +1 -2
- package/dist/errors/contract.d.mts +0 -2
- package/dist/errors/contract.mjs +1 -2
- package/dist/errors/create-error.d.mts +0 -2
- package/dist/errors/create-error.mjs +1 -2
- package/dist/errors/duplicate-key.d.mts +0 -2
- package/dist/errors/duplicate-key.mjs +1 -2
- package/dist/errors/schema.d.mts +0 -2
- package/dist/errors/schema.mjs +1 -2
- package/dist/errors/types.d.mts +0 -2
- package/dist/events/emit.d.mts +0 -2
- package/dist/events/emit.mjs +1 -2
- package/dist/events/index.mjs +1 -2
- package/dist/events/types.d.mts +0 -2
- package/dist/filter/builders.d.mts +0 -2
- package/dist/filter/builders.mjs +1 -2
- package/dist/filter/coerce-dates.d.mts +0 -2
- package/dist/filter/coerce-dates.mjs +1 -2
- package/dist/filter/from-record.d.mts +0 -2
- package/dist/filter/from-record.mjs +1 -2
- package/dist/filter/guard.d.mts +0 -2
- package/dist/filter/guard.mjs +1 -2
- package/dist/filter/match-record.d.mts +0 -2
- package/dist/filter/match-record.mjs +1 -2
- package/dist/filter/match.d.mts +0 -2
- package/dist/filter/match.mjs +1 -2
- package/dist/filter/scope.d.mts +0 -2
- package/dist/filter/scope.mjs +1 -2
- package/dist/filter/types.d.mts +0 -2
- package/dist/filter/walk.d.mts +0 -2
- package/dist/filter/walk.mjs +1 -2
- package/dist/hash/index.d.mts +0 -2
- package/dist/hash/index.mjs +1 -2
- package/dist/hooks/engine.d.mts +0 -2
- package/dist/hooks/engine.mjs +1 -2
- package/dist/hooks/events.d.mts +0 -2
- package/dist/hooks/events.mjs +1 -2
- package/dist/hooks/priority.d.mts +0 -2
- package/dist/hooks/priority.mjs +1 -2
- package/dist/hooks/types.d.mts +0 -2
- package/dist/idempotency/index.d.mts +0 -2
- package/dist/idempotency/index.mjs +1 -2
- package/dist/loader/batch-loader.d.mts +0 -2
- package/dist/loader/batch-loader.mjs +1 -2
- package/dist/loader/index.mjs +1 -2
- package/dist/lock/index.d.mts +0 -2
- package/dist/lock/index.mjs +1 -2
- package/dist/lookup/types.d.mts +0 -2
- package/dist/operations/index.mjs +1 -2
- package/dist/operations/registry.d.mts +0 -2
- package/dist/operations/registry.mjs +1 -2
- package/dist/operations/types.d.mts +0 -2
- package/dist/pagination/canonical.d.mts +0 -2
- package/dist/pagination/canonical.mjs +1 -2
- package/dist/pagination/cursor.d.mts +0 -2
- package/dist/pagination/cursor.mjs +1 -2
- package/dist/pagination/keyset.d.mts +0 -2
- package/dist/pagination/keyset.mjs +1 -2
- package/dist/pagination/merge-keyset.d.mts +0 -2
- package/dist/pagination/merge-keyset.mjs +1 -2
- package/dist/pagination/offset.d.mts +0 -2
- package/dist/pagination/offset.mjs +1 -2
- package/dist/pagination/types.d.mts +0 -2
- package/dist/plugins/index.mjs +1 -2
- package/dist/plugins/tenant-helpers.d.mts +0 -2
- package/dist/plugins/tenant-helpers.mjs +1 -2
- package/dist/query-parser/coerce.d.mts +0 -2
- package/dist/query-parser/coerce.mjs +1 -2
- package/dist/query-parser/errors.d.mts +0 -2
- package/dist/query-parser/errors.mjs +1 -2
- package/dist/query-parser/format-query.d.mts +30 -0
- package/dist/query-parser/format-query.mjs +90 -0
- package/dist/query-parser/grammar.d.mts +0 -2
- package/dist/query-parser/grammar.mjs +1 -2
- package/dist/query-parser/index.d.mts +2 -1
- package/dist/query-parser/index.mjs +2 -1
- package/dist/query-parser/parse-url.d.mts +0 -2
- package/dist/query-parser/parse-url.mjs +1 -2
- package/dist/query-parser/regex-safety.d.mts +0 -2
- package/dist/query-parser/regex-safety.mjs +1 -2
- package/dist/query-parser/reserved.d.mts +0 -2
- package/dist/query-parser/reserved.mjs +1 -2
- package/dist/query-parser/types.d.mts +0 -2
- package/dist/repository/agg-output.d.mts +0 -2
- package/dist/repository/agg-output.mjs +1 -2
- package/dist/repository/archive.d.mts +0 -2
- package/dist/repository/archive.mjs +1 -2
- package/dist/repository/base.d.mts +0 -2
- package/dist/repository/base.mjs +1 -2
- package/dist/repository/bulk-upsert.d.mts +0 -2
- package/dist/repository/bulk-upsert.mjs +1 -2
- package/dist/repository/capabilities.d.mts +0 -2
- package/dist/repository/distribution.d.mts +0 -2
- package/dist/repository/distribution.mjs +1 -2
- package/dist/repository/options.d.mts +0 -2
- package/dist/repository/options.mjs +1 -2
- package/dist/repository/plugin-types.d.mts +0 -2
- package/dist/repository/plugin-types.mjs +1 -2
- package/dist/repository/purge.d.mts +0 -2
- package/dist/repository/purge.mjs +1 -2
- package/dist/repository/read-only.d.mts +0 -2
- package/dist/repository/read-only.mjs +1 -2
- package/dist/repository/resilience.d.mts +0 -2
- package/dist/repository/resilience.mjs +1 -2
- package/dist/repository/retrying-transaction.d.mts +0 -2
- package/dist/repository/retrying-transaction.mjs +1 -2
- package/dist/repository/types.d.mts +0 -2
- package/dist/schema/field-rules.d.mts +0 -2
- package/dist/schema/field-rules.mjs +1 -2
- package/dist/schema/generator.d.mts +0 -2
- package/dist/schema/generator.mjs +1 -2
- package/dist/schema/standard-schema.d.mts +0 -2
- package/dist/schema/standard-schema.mjs +1 -2
- package/dist/schema/types.d.mts +0 -2
- package/dist/sync/index.d.mts +0 -2
- package/dist/sync/index.mjs +0 -0
- package/dist/tenant/index.mjs +1 -2
- package/dist/tenant/resolve.d.mts +0 -2
- package/dist/tenant/resolve.mjs +1 -2
- package/dist/tenant/types.d.mts +0 -2
- package/dist/testing/change-log-conformance.d.mts +0 -2
- package/dist/testing/change-log-conformance.mjs +1 -2
- package/dist/testing/command-stream-conformance.d.mts +0 -2
- package/dist/testing/command-stream-conformance.mjs +1 -2
- package/dist/testing/conformance.d.mts +0 -2
- package/dist/testing/conformance.mjs +1 -2
- package/dist/testing/data-access-conformance.d.mts +0 -2
- package/dist/testing/data-access-conformance.mjs +1 -2
- package/dist/testing/idempotency-conformance.d.mts +0 -2
- package/dist/testing/idempotency-conformance.mjs +1 -2
- package/dist/testing/lock-conformance.d.mts +0 -2
- package/dist/testing/lock-conformance.mjs +1 -2
- package/dist/testing/merge-keyset-conformance.d.mts +0 -2
- package/dist/testing/merge-keyset-conformance.mjs +1 -2
- package/dist/testing/pagination-property-conformance.d.mts +0 -2
- package/dist/testing/pagination-property-conformance.mjs +1 -2
- package/dist/testing/purge-conformance.d.mts +0 -2
- package/dist/testing/purge-conformance.mjs +1 -2
- package/dist/testing/query-grammar-conformance.d.mts +0 -2
- package/dist/testing/query-grammar-conformance.mjs +1 -2
- package/dist/testing/read-model-property-conformance.d.mts +0 -2
- package/dist/testing/read-model-property-conformance.mjs +1 -2
- package/dist/testing/types.d.mts +0 -2
- package/dist/testing/usage-conformance.d.mts +0 -2
- package/dist/testing/usage-conformance.mjs +1 -2
- package/dist/update/builders.d.mts +0 -2
- package/dist/update/builders.mjs +1 -2
- package/dist/update/compile.d.mts +0 -2
- package/dist/update/compile.mjs +1 -2
- package/dist/update/guard.d.mts +0 -2
- package/dist/update/guard.mjs +1 -2
- package/dist/update/types.d.mts +0 -2
- package/dist/usage/index.d.mts +0 -2
- package/dist/usage/index.mjs +1 -2
- package/llms.txt +29 -0
- package/package.json +7 -4
- package/skills/repo-core/SKILL.md +108 -0
- package/skills/repo-core/references/contracts.md +69 -0
- package/skills/repo-core/references/kit-authoring.md +75 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,26 @@ 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
|
+
|
|
13
|
+
## [0.32.0] - 2026-10-23
|
|
14
|
+
|
|
15
|
+
### Added - `formatQuery` / `stringifyQuery` (`./query-parser`)
|
|
16
|
+
|
|
17
|
+
The inverse of `parseUrl`: typed filter terms `{ field, op?, value, flags? }` plus `sort`, `page`, `limit`, `search` become the flat bracket params the parser accepts. Operators come from `URL_OPERATORS`; `between` is sent as `gte` + `lte`; `in`/`nin` take arrays; Dates go as ISO; empty values are no filter; a value the grammar cannot carry (comma in a list value, the text `null`, a repeated field and operator) throws `QueryGrammarError`. Round-trip tests cover every operator. Types: `FilterTerm`, `FilterOperator`, `FormatQueryInput`, `QueryParams`.
|
|
18
|
+
|
|
19
|
+
### Added - agent skill and `llms.txt`
|
|
20
|
+
|
|
21
|
+
`skills/repo-core` and `llms.txt` ship in the package, and `npm run check:skills` (part of `prepublishOnly`) verifies that every import, subpath and API name they mention exists in the built package.
|
|
22
|
+
|
|
23
|
+
### Changed - peer floor to the latest published
|
|
24
|
+
|
|
25
|
+
`fast-check` `^4.10.2` (optional peer of `./testing`).
|
|
26
|
+
|
|
7
27
|
## [0.31.1] - 2026-10-13
|
|
8
28
|
|
|
9
29
|
### Fixed — `fast-check` is an optional peer of `./testing`
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
2
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
3
3
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
4
4
|
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
5
5
|
});
|
|
6
|
-
//#endregion
|
|
7
6
|
export { __require };
|
package/dist/adapter/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { asRepositoryLike, isRepository };
|
|
1
|
+
export { asRepositoryLike, isRepository } from "./widen.mjs";
|
package/dist/adapter/types.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DeleteResult, MinimalRepo, StandardRepo } from "../repository/types.mjs";
|
|
2
2
|
import { SchemaBuilderOptions } from "../schema/types.mjs";
|
|
3
|
-
//#region src/adapter/types.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Cross-kit repository contract.
|
|
6
5
|
*
|
|
@@ -235,5 +234,4 @@ interface DataAdapter<TDoc = unknown> {
|
|
|
235
234
|
* options (e.g. `{ model, schemaGenerator, ... }`).
|
|
236
235
|
*/
|
|
237
236
|
type AdapterFactory<TDoc = unknown> = (config: unknown) => DataAdapter<TDoc>;
|
|
238
|
-
//#endregion
|
|
239
237
|
export { AdapterFactory, AdapterRepositoryInput, AdapterSchemaContext, AdapterValidationResult, DataAdapter, FieldMetadata, OpenApiSchemas, RelationMetadata, RepositoryLike, SchemaMetadata };
|
package/dist/adapter/widen.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AdapterRepositoryInput, RepositoryLike } from "./types.mjs";
|
|
2
|
-
//#region src/adapter/widen.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Widen a permissive `AdapterRepositoryInput<TDoc>` to the strict
|
|
5
4
|
* `RepositoryLike<TDoc>` view used by host internals.
|
|
@@ -17,5 +16,4 @@ declare function asRepositoryLike<TDoc = unknown>(input: AdapterRepositoryInput<
|
|
|
17
16
|
* factories to validate input before wrapping.
|
|
18
17
|
*/
|
|
19
18
|
declare function isRepository<TDoc = unknown>(value: unknown): value is RepositoryLike<TDoc>;
|
|
20
|
-
//#endregion
|
|
21
19
|
export { asRepositoryLike, isRepository };
|
package/dist/adapter/widen.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/adapter/widen.ts
|
|
2
2
|
/**
|
|
3
3
|
* Widen a permissive `AdapterRepositoryInput<TDoc>` to the strict
|
|
4
4
|
* `RepositoryLike<TDoc>` view used by host internals.
|
|
@@ -22,5 +22,4 @@ function isRepository(value) {
|
|
|
22
22
|
const v = value;
|
|
23
23
|
return typeof v["getAll"] === "function" && typeof v["getById"] === "function" && typeof v["create"] === "function" && typeof v["update"] === "function" && typeof v["delete"] === "function";
|
|
24
24
|
}
|
|
25
|
-
//#endregion
|
|
26
25
|
export { asRepositoryLike, isRepository };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/aggregate/keyset.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Keyset (cursor) pagination helpers — the portable, kit-neutral half.
|
|
4
3
|
*
|
|
@@ -53,5 +52,4 @@ declare function isKeysetMode(req: {
|
|
|
53
52
|
pagination?: string;
|
|
54
53
|
after?: string;
|
|
55
54
|
}): boolean;
|
|
56
|
-
//#endregion
|
|
57
55
|
export { DecodedCursor, decodeAggCursor, encodeAggCursor, isKeysetMode };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/aggregate/keyset.ts
|
|
2
2
|
/**
|
|
3
3
|
* Encode a cursor from the last row of a page given the sort spec.
|
|
4
4
|
*
|
|
@@ -41,5 +41,4 @@ function isKeysetMode(req) {
|
|
|
41
41
|
if (typeof req.after === "string" && req.after.length > 0) return true;
|
|
42
42
|
return false;
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
export { decodeAggCursor, encodeAggCursor, isKeysetMode };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AggRequest } from "../repository/types.mjs";
|
|
2
|
-
//#region src/aggregate/normalize.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Normalize `AggRequest['groupBy']` into a readonly string array.
|
|
5
4
|
* Returns `[]` for scalar aggregation (no groupBy). Downstream
|
|
@@ -19,5 +18,4 @@ declare function normalizeGroupBy(groupBy: AggRequest['groupBy']): readonly stri
|
|
|
19
18
|
* to walk the trace.
|
|
20
19
|
*/
|
|
21
20
|
declare function validateMeasures(measures: AggRequest['measures'], kitName: string): void;
|
|
22
|
-
//#endregion
|
|
23
21
|
export { normalizeGroupBy, validateMeasures };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/aggregate/normalize.ts
|
|
2
2
|
/**
|
|
3
3
|
* Normalize `AggRequest['groupBy']` into a readonly string array.
|
|
4
4
|
* Returns `[]` for scalar aggregation (no groupBy). Downstream
|
|
@@ -24,5 +24,4 @@ function normalizeGroupBy(groupBy) {
|
|
|
24
24
|
function validateMeasures(measures, kitName) {
|
|
25
25
|
if (!measures || Object.keys(measures).length === 0) throw new Error(`${kitName}/aggregate: AggRequest requires at least one measure — empty measures bag is a wiring bug`);
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { normalizeGroupBy, validateMeasures };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/better-auth/index.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Better Auth — kit-agnostic registry of which collections each plugin owns.
|
|
4
3
|
*
|
|
@@ -118,5 +117,4 @@ interface ResolveBetterAuthCollectionsOptions {
|
|
|
118
117
|
* collection names. `core` is always included.
|
|
119
118
|
*/
|
|
120
119
|
declare function resolveBetterAuthCollections(options?: ResolveBetterAuthCollectionsOptions): string[];
|
|
121
|
-
//#endregion
|
|
122
120
|
export { BA_COLLECTIONS_BY_PLUGIN, BetterAuthPluginKey, ResolveBetterAuthCollectionsOptions, pluralizeBetterAuthCollection, resolveBetterAuthCollections };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/better-auth/index.ts
|
|
2
2
|
/**
|
|
3
3
|
* Canonical collection lists per plugin. `core` is always implied by
|
|
4
4
|
* `resolveBetterAuthCollections` — callers don't need to pass it.
|
|
@@ -74,5 +74,4 @@ function resolveBetterAuthCollections(options = {}) {
|
|
|
74
74
|
}
|
|
75
75
|
return unique;
|
|
76
76
|
}
|
|
77
|
-
//#endregion
|
|
78
77
|
export { BA_COLLECTIONS_BY_PLUGIN, pluralizeBetterAuthCollection, resolveBetterAuthCollections };
|
package/dist/cache/engine.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CacheReadResult, ResolvedCacheOptions } from "./options.mjs";
|
|
2
2
|
import { CacheAdapter } from "./types.mjs";
|
|
3
|
-
//#region src/cache/engine.d.ts
|
|
4
3
|
interface CacheEngineOptions {
|
|
5
4
|
/** Cache key namespace prefix. Default: `'rc'`. */
|
|
6
5
|
prefix?: string;
|
|
@@ -152,5 +151,4 @@ declare class CacheEngine {
|
|
|
152
151
|
*/
|
|
153
152
|
prefetch<TData>(key: string, opts: ResolvedCacheOptions, fetcher: () => Promise<TData>): Promise<TData>;
|
|
154
153
|
}
|
|
155
|
-
//#endregion
|
|
156
154
|
export { CacheAdapterResolver, CacheAdapterSource, CacheEngine, CacheEngineOptions, SingleFlightClaim };
|
package/dist/cache/engine.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { buildEnvelope, inspectEnvelope } from "./envelope.mjs";
|
|
2
2
|
import { appendKeyToTags, invalidateByTags } from "./tag-index.mjs";
|
|
3
3
|
import { bumpModelVersion, getModelVersion } from "./version-store.mjs";
|
|
4
|
-
|
|
4
|
+
// src/cache/engine.ts
|
|
5
5
|
/**
|
|
6
6
|
* `CacheEngine` — the SWR + TTL + tag-invalidation behavior on top of
|
|
7
7
|
* a `CacheAdapter`. ONE implementation of the cache-flow primitives,
|
|
@@ -274,5 +274,4 @@ function resolveJitter(jitter) {
|
|
|
274
274
|
return Math.max(1, Math.round(jittered));
|
|
275
275
|
};
|
|
276
276
|
}
|
|
277
|
-
//#endregion
|
|
278
277
|
export { CacheEngine };
|
package/dist/cache/envelope.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/cache/envelope.ts
|
|
2
2
|
/** Build an envelope from raw data + freshness windows (seconds). */
|
|
3
3
|
function buildEnvelope(data, staleTimeSeconds, gcTimeSeconds, tags, now = Date.now()) {
|
|
4
4
|
const staleAfter = now + Math.max(0, staleTimeSeconds) * 1e3;
|
|
@@ -28,5 +28,4 @@ function inspectEnvelope(envelope, now = Date.now()) {
|
|
|
28
28
|
envelope
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
//#endregion
|
|
32
31
|
export { buildEnvelope, inspectEnvelope };
|
package/dist/cache/keys.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { stableStringify } from "./stable-stringify.mjs";
|
|
2
|
-
|
|
2
|
+
// src/cache/keys.ts
|
|
3
3
|
/**
|
|
4
4
|
* Cache key derivation. Builds stable keys from operation context so
|
|
5
5
|
* any kit + arc + Express/Nest hosts compute the same key for the
|
|
@@ -127,5 +127,4 @@ function fnv1a64(str) {
|
|
|
127
127
|
}
|
|
128
128
|
return hash.toString(36);
|
|
129
129
|
}
|
|
130
|
-
//#endregion
|
|
131
130
|
export { buildCacheKey, extractScopeTags, mergeTags, scopeKeyFromTags, tagIndexKey, versionKey };
|
package/dist/cache/memo.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/cache/memo.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* `createTtlMemo` — memoise a keyed async load for `ttlMs`, single-flight.
|
|
4
3
|
*
|
|
@@ -30,5 +29,4 @@ interface TtlMemo<K, V> {
|
|
|
30
29
|
invalidate(key?: K): Promise<void>;
|
|
31
30
|
}
|
|
32
31
|
declare function createTtlMemo<K, V>(load: (key: K) => Promise<V>, options: TtlMemoOptions<K>): TtlMemo<K, V>;
|
|
33
|
-
//#endregion
|
|
34
32
|
export { TtlMemo, TtlMemoOptions, createTtlMemo };
|
package/dist/cache/memo.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CacheEngine } from "./engine.mjs";
|
|
2
2
|
import { createMemoryCacheAdapter } from "./memory-adapter.mjs";
|
|
3
|
-
|
|
3
|
+
// src/cache/memo.ts
|
|
4
4
|
/**
|
|
5
5
|
* `createTtlMemo` — memoise a keyed async load for `ttlMs`, single-flight.
|
|
6
6
|
*
|
|
@@ -56,5 +56,4 @@ function createTtlMemo(load, options) {
|
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
//#endregion
|
|
60
59
|
export { createTtlMemo };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CacheAdapter } from "./types.mjs";
|
|
2
|
-
//#region src/cache/memory-adapter.d.ts
|
|
3
2
|
interface MemoryCacheAdapterOptions {
|
|
4
3
|
/**
|
|
5
4
|
* Hard entry ceiling; the least-recently-used entry is evicted past it.
|
|
@@ -20,5 +19,4 @@ interface MemoryCacheAdapterOptions {
|
|
|
20
19
|
/** Minimal in-memory `Map`-backed adapter with per-key TTL, LRU eviction and
|
|
21
20
|
* prefix invalidation. */
|
|
22
21
|
declare function createMemoryCacheAdapter(options?: MemoryCacheAdapterOptions): CacheAdapter;
|
|
23
|
-
//#endregion
|
|
24
22
|
export { MemoryCacheAdapterOptions, createMemoryCacheAdapter };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/cache/memory-adapter.ts
|
|
2
2
|
/** Minimal in-memory `Map`-backed adapter with per-key TTL, LRU eviction and
|
|
3
3
|
* prefix invalidation. */
|
|
4
4
|
function createMemoryCacheAdapter(options = {}) {
|
|
@@ -100,5 +100,4 @@ function createMemoryCacheAdapter(options = {}) {
|
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
-
//#endregion
|
|
104
103
|
export { createMemoryCacheAdapter };
|
package/dist/cache/options.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/cache/options.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Canonical per-call cache options. TanStack Query-shaped — the same
|
|
4
3
|
* `staleTime` / `gcTime` mental model browser developers already know,
|
|
@@ -108,5 +107,4 @@ interface ResolvedCacheOptions {
|
|
|
108
107
|
enabled: boolean;
|
|
109
108
|
key?: string;
|
|
110
109
|
}
|
|
111
|
-
//#endregion
|
|
112
110
|
export { CacheOptions, CacheReadResult, ResolvedCacheOptions };
|
package/dist/cache/options.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/cache/options.ts
|
|
2
2
|
/**
|
|
3
3
|
* Merge precedence (highest wins): per-call > per-op-default > plugin-default > built-in.
|
|
4
4
|
*
|
|
@@ -21,5 +21,4 @@ function resolveCacheOptions(callOpts, perOpDefaults, pluginDefaults) {
|
|
|
21
21
|
...merged.key !== void 0 ? { key: merged.key } : {}
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
//#endregion
|
|
25
24
|
export { resolveCacheOptions };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/cache/plugin/context.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Default per-op allowlist of context fields that affect result shape
|
|
4
3
|
* (and therefore must participate in the cache key). Hosts can extend
|
|
@@ -14,5 +13,4 @@
|
|
|
14
13
|
* option (e.g. mongoose's `lean`, prisma's `select` shape, etc.).
|
|
15
14
|
*/
|
|
16
15
|
declare const DEFAULT_SHAPE_KEYS_BY_OP: Readonly<Record<string, readonly string[]>>;
|
|
17
|
-
//#endregion
|
|
18
16
|
export { DEFAULT_SHAPE_KEYS_BY_OP };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/cache/plugin/context.ts
|
|
2
2
|
/**
|
|
3
3
|
* Cast a raw hook context into the typed slots view. One call per
|
|
4
4
|
* hook entry; subsequent slot reads/writes use plain dotted access.
|
|
@@ -119,5 +119,4 @@ function extractCallCacheOptions(context, op) {
|
|
|
119
119
|
const inOptions = context["options"]?.["cache"];
|
|
120
120
|
if (inOptions && typeof inOptions === "object") return inOptions;
|
|
121
121
|
}
|
|
122
|
-
//#endregion
|
|
123
122
|
export { AGGREGATE_OPS, DEFAULT_SHAPE_KEYS_BY_OP, ctx, extractCallCacheOptions, extractShapeFields };
|
|
@@ -2,7 +2,6 @@ import { Plugin } from "../../repository/plugin-types.mjs";
|
|
|
2
2
|
import { CacheOptions, CacheReadResult } from "../options.mjs";
|
|
3
3
|
import { CacheAdapterSource, CacheEngine } from "../engine.mjs";
|
|
4
4
|
import { DEFAULT_SHAPE_KEYS_BY_OP } from "./context.mjs";
|
|
5
|
-
//#region src/cache/plugin/index.d.ts
|
|
6
5
|
/** Default read ops the plugin caches. Kits may override per resource. */
|
|
7
6
|
declare const DEFAULT_CACHEABLE_OPS: readonly ['getById', 'getAll', 'getOne', 'getByQuery', 'count', 'exists', 'distinct', 'aggregate', 'aggregatePaginate'];
|
|
8
7
|
/** Default mutating ops that bump version + invalidate tags on success. */
|
|
@@ -99,5 +98,4 @@ interface RepositoryCacheHandle {
|
|
|
99
98
|
* and `softDelete` so policy filters land in the cache key.
|
|
100
99
|
*/
|
|
101
100
|
declare function cachePlugin(options: RepositoryCachePluginOptions): Plugin;
|
|
102
|
-
//#endregion
|
|
103
101
|
export { DEFAULT_CACHEABLE_OPS, DEFAULT_INVALIDATING_OPS, DEFAULT_SHAPE_KEYS_BY_OP, LogCallbacks, RepositoryCacheHandle, RepositoryCachePluginOptions, cachePlugin };
|
|
@@ -2,7 +2,7 @@ import { CacheEngine } from "../engine.mjs";
|
|
|
2
2
|
import { DEFAULT_SHAPE_KEYS_BY_OP } from "./context.mjs";
|
|
3
3
|
import { registerInvalidationHooks } from "./invalidation-hooks.mjs";
|
|
4
4
|
import { registerReadHooks } from "./read-hooks.mjs";
|
|
5
|
-
|
|
5
|
+
// src/cache/plugin/index.ts
|
|
6
6
|
/** Default read ops the plugin caches. Kits may override per resource. */
|
|
7
7
|
const DEFAULT_CACHEABLE_OPS = [
|
|
8
8
|
"getById",
|
|
@@ -74,5 +74,4 @@ function cachePlugin(options) {
|
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
//#endregion
|
|
78
77
|
export { DEFAULT_CACHEABLE_OPS, DEFAULT_INVALIDATING_OPS, DEFAULT_SHAPE_KEYS_BY_OP, cachePlugin };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HOOK_PRIORITY } from "../../hooks/priority.mjs";
|
|
2
2
|
import { extractScopeTags, mergeTags, scopeKeyFromTags } from "../keys.mjs";
|
|
3
3
|
import { ctx } from "./context.mjs";
|
|
4
|
-
|
|
4
|
+
// src/cache/plugin/invalidation-hooks.ts
|
|
5
5
|
/**
|
|
6
6
|
* Write-side hook registration: `after:<op>` for every mutating op
|
|
7
7
|
* bumps the model's version (per-scope when possible) and invalidates
|
|
@@ -31,5 +31,4 @@ function registerInvalidationHooks(repo, op, engine, hookCtx) {
|
|
|
31
31
|
hookCtx.log.onInvalidate?.(model, version, count);
|
|
32
32
|
}, { priority: HOOK_PRIORITY.CACHE });
|
|
33
33
|
}
|
|
34
|
-
//#endregion
|
|
35
34
|
export { registerInvalidationHooks };
|
|
@@ -3,7 +3,7 @@ import { buildCacheKey, extractScopeTags, mergeTags, scopeKeyFromTags } from "..
|
|
|
3
3
|
import { ctx, extractCallCacheOptions, extractShapeFields } from "./context.mjs";
|
|
4
4
|
import { resolveCacheOptions } from "../options.mjs";
|
|
5
5
|
import { scheduleSwrRefresh } from "./swr.mjs";
|
|
6
|
-
|
|
6
|
+
// src/cache/plugin/read-hooks.ts
|
|
7
7
|
/**
|
|
8
8
|
* Read-side hook registration: `before:<op>` (cache check + single-
|
|
9
9
|
* flight claim), `after:<op>` (cache write + resolve waiters), and
|
|
@@ -93,5 +93,4 @@ async function deriveKey(engine, op, context, scopeTags, hookCtx) {
|
|
|
93
93
|
scopeTags
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
-
//#endregion
|
|
97
96
|
export { registerReadHooks };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AGGREGATE_OPS } from "./context.mjs";
|
|
2
2
|
import { scheduleBackground } from "../runtime.mjs";
|
|
3
|
-
|
|
3
|
+
// src/cache/plugin/swr.ts
|
|
4
4
|
function scheduleSwrRefresh(op, repo, context) {
|
|
5
5
|
if (!AGGREGATE_OPS.has(op)) return;
|
|
6
6
|
const aggReq = context["aggRequest"];
|
|
@@ -16,5 +16,4 @@ function scheduleSwrRefresh(op, repo, context) {
|
|
|
16
16
|
repo[op]?.(refreshReq).catch(() => {});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
//#endregion
|
|
20
19
|
export { scheduleSwrRefresh };
|
package/dist/cache/runtime.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/cache/runtime.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Cross-runtime scheduling primitives.
|
|
4
3
|
*
|
|
@@ -39,5 +38,4 @@
|
|
|
39
38
|
* error handling — this helper does NOT add a default `.catch`.
|
|
40
39
|
*/
|
|
41
40
|
declare const scheduleBackground: (fn: () => void) => void;
|
|
42
|
-
//#endregion
|
|
43
41
|
export { scheduleBackground };
|
package/dist/cache/runtime.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/cache/stable-stringify.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Deterministic JSON stringify — equivalent values produce identical output, different values
|
|
4
3
|
* never do. Every cache key and `contentHash` is built on it.
|
|
@@ -10,5 +9,4 @@
|
|
|
10
9
|
* locale: a key that moves with the server's ICU data changes every digest. Arrays keep order.
|
|
11
10
|
*/
|
|
12
11
|
declare function stableStringify(value: unknown): string;
|
|
13
|
-
//#endregion
|
|
14
12
|
export { stableStringify };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/cache/stable-stringify.ts
|
|
2
2
|
/**
|
|
3
3
|
* Deterministic JSON stringify — equivalent values produce identical output, different values
|
|
4
4
|
* never do. Every cache key and `contentHash` is built on it.
|
|
@@ -18,5 +18,4 @@ function stableStringify(value) {
|
|
|
18
18
|
const record = value;
|
|
19
19
|
return `{${Object.keys(record).filter((k) => record[k] !== void 0).sort((a, b) => a < b ? -1 : a > b ? 1 : 0).map((k) => `${JSON.stringify(k)}:${stableStringify(record[k])}`).join(",")}}`;
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { stableStringify };
|
package/dist/cache/tag-index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { tagIndexKey } from "./keys.mjs";
|
|
2
|
-
|
|
2
|
+
// src/cache/tag-index.ts
|
|
3
3
|
/**
|
|
4
4
|
* Tag side-index — non-pattern-dependent tag invalidation.
|
|
5
5
|
*
|
|
@@ -79,5 +79,4 @@ async function invalidateByTags(adapter, prefix, tags) {
|
|
|
79
79
|
await Promise.all(deletions);
|
|
80
80
|
return cacheKeys.size;
|
|
81
81
|
}
|
|
82
|
-
//#endregion
|
|
83
82
|
export { appendKeyToTags, invalidateByTags };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CacheAdapter } from "./types.mjs";
|
|
2
|
-
//#region src/cache/timeout-adapter.d.ts
|
|
3
2
|
declare class CacheTimeoutError extends Error {
|
|
4
3
|
readonly op: string;
|
|
5
4
|
readonly key?: string;
|
|
@@ -25,5 +24,4 @@ interface TimeoutAdapterOptions {
|
|
|
25
24
|
* complete before the deadline pass through unchanged.
|
|
26
25
|
*/
|
|
27
26
|
declare function withTimeout(adapter: CacheAdapter, options?: TimeoutAdapterOptions): CacheAdapter;
|
|
28
|
-
//#endregion
|
|
29
27
|
export { CacheTimeoutError, TimeoutAdapterOptions, withTimeout };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/cache/timeout-adapter.ts
|
|
2
2
|
var CacheTimeoutError = class extends Error {
|
|
3
3
|
op;
|
|
4
4
|
key;
|
|
@@ -54,5 +54,4 @@ function withTimeout(adapter, options = {}) {
|
|
|
54
54
|
} } : {}
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
//#endregion
|
|
58
57
|
export { CacheTimeoutError, withTimeout };
|
package/dist/cache/types.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/cache/types.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Portable cache adapter contract.
|
|
4
3
|
*
|
|
@@ -101,5 +100,4 @@ interface CacheAdapter {
|
|
|
101
100
|
*/
|
|
102
101
|
increment?(key: string, by?: number, ttlSeconds?: number): Promise<number> | number;
|
|
103
102
|
}
|
|
104
|
-
//#endregion
|
|
105
103
|
export { CacheAdapter };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { versionKey } from "./keys.mjs";
|
|
2
|
-
|
|
2
|
+
// src/cache/version-store.ts
|
|
3
3
|
/**
|
|
4
4
|
* Collection-version store — O(1) bulk invalidation by bumping a
|
|
5
5
|
* counter that's embedded in every cache key.
|
|
@@ -53,5 +53,4 @@ async function bumpModelVersion(adapter, prefix, model, scopeKey) {
|
|
|
53
53
|
await adapter.set(key, next, VERSION_TTL_SECONDS);
|
|
54
54
|
return next;
|
|
55
55
|
}
|
|
56
|
-
//#endregion
|
|
57
56
|
export { bumpModelVersion, getModelVersion };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TenantPurgeOptions, TenantPurgeStrategy } from "../repository/types.mjs";
|
|
2
2
|
import { CleanupStep, CleanupStepContext } from "./types.mjs";
|
|
3
|
-
//#region src/cleanup/define-purge-step.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* The repository surface a purge step needs — a structural subset of
|
|
6
|
-
* `StandardRepo
|
|
5
|
+
* `StandardRepo` (`purgeByField` + `count`, the same names every kit
|
|
6
|
+
* implements), so any kit repository satisfies it without an adapter.
|
|
7
7
|
* Both members are optional so an engine that never wired the repository
|
|
8
8
|
* yields a BLOCKER rather than a crash.
|
|
9
9
|
*/
|
|
@@ -15,7 +15,7 @@ interface PurgeStepRepository {
|
|
|
15
15
|
message: string;
|
|
16
16
|
};
|
|
17
17
|
}>;
|
|
18
|
-
|
|
18
|
+
count?(filter: Record<string, unknown>): Promise<number>;
|
|
19
19
|
}
|
|
20
20
|
interface PurgeStepSpec {
|
|
21
21
|
/** Stable machine id, unique within a recipe. */
|
|
@@ -72,5 +72,4 @@ declare const REPOSITORY_UNAVAILABLE = "CLEANUP_REPOSITORY_UNAVAILABLE";
|
|
|
72
72
|
* processed count alone is never proof (§9).
|
|
73
73
|
*/
|
|
74
74
|
declare function definePurgeStep(repository: PurgeStepRepository | undefined, spec: PurgeStepSpec): CleanupStep;
|
|
75
|
-
//#endregion
|
|
76
75
|
export { PurgeStepRepository, PurgeStepSpec, REPOSITORY_UNAVAILABLE, SCOPE_REQUIRED, definePurgeStep };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/cleanup/define-purge-step.ts
|
|
2
2
|
/** Prefix for the blocker raised when the run carries no scope value. */
|
|
3
3
|
const SCOPE_REQUIRED = "CLEANUP_SCOPE_REQUIRED";
|
|
4
4
|
/** Prefix for the blocker raised when the repository cannot be reached. */
|
|
@@ -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,
|
|
@@ -103,5 +103,4 @@ function definePurgeStep(repository, spec) {
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
//#endregion
|
|
107
106
|
export { REPOSITORY_UNAVAILABLE, SCOPE_REQUIRED, definePurgeStep };
|
package/dist/cleanup/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { REPOSITORY_UNAVAILABLE, SCOPE_REQUIRED, definePurgeStep };
|
|
1
|
+
export { REPOSITORY_UNAVAILABLE, SCOPE_REQUIRED, definePurgeStep } from "./define-purge-step.mjs";
|
package/dist/cleanup/types.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/cleanup/types.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* `@classytic/repo-core/cleanup` — the framework-free **cleanup provider step**
|
|
4
3
|
* contract (data-cleanup / retention design §6.3, §6.6).
|
|
@@ -196,5 +195,4 @@ interface CleanupStep {
|
|
|
196
195
|
*/
|
|
197
196
|
verify?(ctx: CleanupStepContext): Promise<readonly CleanupStepCheck[]>;
|
|
198
197
|
}
|
|
199
|
-
//#endregion
|
|
200
198
|
export { CleanupStep, CleanupStepCheck, CleanupStepContext, CleanupStepDisposition, CleanupStepEstimate, CleanupStepExecuteContext, CleanupStepLogger, CleanupStepOutcome, CleanupStepProgress };
|
package/dist/context/types.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Filter } from "../filter/types.mjs";
|
|
2
|
-
//#region src/context/types.d.ts
|
|
3
2
|
/** The canonical lifecycle-hook context. */
|
|
4
3
|
interface RepositoryContext {
|
|
5
4
|
/** Operation name (`'create'`, `'getAll'`, `'update'`, ...). */
|
|
@@ -19,5 +18,4 @@ interface RepositoryContext {
|
|
|
19
18
|
/** Arbitrary plugin-owned fields (cache markers, soft-delete flags, ...). */
|
|
20
19
|
[key: string]: unknown;
|
|
21
20
|
}
|
|
22
|
-
//#endregion
|
|
23
21
|
export { RepositoryContext };
|
package/dist/errors/codes.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/errors/codes.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* The error-code vocabulary of the wire — every value a client may see in
|
|
4
3
|
* `ErrorContract.code`, in one place.
|
|
@@ -122,5 +121,4 @@ declare const CURSOR_ERROR_CODES: {
|
|
|
122
121
|
};
|
|
123
122
|
type CursorErrorCode = (typeof CURSOR_ERROR_CODES)[keyof typeof CURSOR_ERROR_CODES];
|
|
124
123
|
declare const DUPLICATE_KEY_DETAIL_CODE = "duplicate_key";
|
|
125
|
-
//#endregion
|
|
126
124
|
export { ARC_ERROR_CODES, ARC_REASON_CODES, ArcErrorCode, ArcReasonCode, CURSOR_ERROR_CODES, CursorErrorCode, DUPLICATE_KEY_DETAIL_CODE, ERROR_CODES, ErrorCode };
|
package/dist/errors/codes.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/errors/codes.ts
|
|
2
2
|
/**
|
|
3
3
|
* The error-code vocabulary of the wire — every value a client may see in
|
|
4
4
|
* `ErrorContract.code`, in one place.
|
|
@@ -118,5 +118,4 @@ const CURSOR_ERROR_CODES = {
|
|
|
118
118
|
SCOPE_MISMATCH: "repo.cursor.scope_mismatch"
|
|
119
119
|
};
|
|
120
120
|
const DUPLICATE_KEY_DETAIL_CODE = "duplicate_key";
|
|
121
|
-
//#endregion
|
|
122
121
|
export { ARC_ERROR_CODES, ARC_REASON_CODES, CURSOR_ERROR_CODES, DUPLICATE_KEY_DETAIL_CODE, ERROR_CODES };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/errors/conflict.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Concurrency-conflict taxonomy — driver-agnostic contract.
|
|
4
3
|
*
|
|
@@ -80,5 +79,4 @@ declare class VersionConflictError extends Error {
|
|
|
80
79
|
* graph, where `instanceof` silently fails across the boundary.
|
|
81
80
|
*/
|
|
82
81
|
declare function isVersionConflictError(err: unknown): err is VersionConflictError;
|
|
83
|
-
//#endregion
|
|
84
82
|
export { IsTransientConflictFn, VersionConflictError, conservativeMongoIsTransientConflict, isVersionConflictError, neverTransient };
|
package/dist/errors/conflict.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/errors/conflict.ts
|
|
2
2
|
/**
|
|
3
3
|
* Safe default: nothing is transient until the kit says so. The opposite
|
|
4
4
|
* default (retry everything) turns a deterministic failure into N delayed
|
|
@@ -59,5 +59,4 @@ var VersionConflictError = class extends Error {
|
|
|
59
59
|
function isVersionConflictError(err) {
|
|
60
60
|
return err instanceof VersionConflictError || typeof err === "object" && err !== null && err.name === "VersionConflictError" && err.code === "version_conflict";
|
|
61
61
|
}
|
|
62
|
-
//#endregion
|
|
63
62
|
export { VersionConflictError, conservativeMongoIsTransientConflict, isVersionConflictError, neverTransient };
|