@cosmicdrift/kumiko-types 0.199.2 → 0.200.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/package.json +1 -1
- package/src/handlers.ts +9 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.200.0",
|
|
4
4
|
"description": "Framework-Type-Definitions für Kumiko — FeatureDefinition, BootCheck-Types und die reinen Engine-Types. Erlaubt Downstream-Konsumenten, gegen die Type-Contracts zu bauen, ohne das ganze Framework-Package zu importieren. Enthaelt keine identitaets-sensitiven Runtime-Werte mehr (Error-Klassen leben seit #1629 in kumiko-framework, Brand-Symbole nutzen Symbol.for) und ist deshalb eine plain dependency, keine peerDependency.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
package/src/handlers.ts
CHANGED
|
@@ -311,6 +311,8 @@ type SharedContextFields = {
|
|
|
311
311
|
// AppContext, so the union keeps that assignment straightforward.
|
|
312
312
|
export type AppContext = SharedContextFields & {
|
|
313
313
|
readonly db?: DbConnection | TenantDb;
|
|
314
|
+
// Hooks receive the same HandlerContext as their AppContext, so `db` is fail-closed here too.
|
|
315
|
+
readonly systemDb?: UncheckedSystemDb;
|
|
314
316
|
readonly registry?: Registry;
|
|
315
317
|
readonly systemUser?: SessionUser;
|
|
316
318
|
readonly log?: Logger;
|
|
@@ -353,14 +355,19 @@ export type AppContext = SharedContextFields & {
|
|
|
353
355
|
// `declare module "@cosmicdrift/kumiko-framework/engine"`). Code that bypasses the
|
|
354
356
|
// type-map (runtime-pluggable events) uses `unsafeAppendEvent`.
|
|
355
357
|
export type HandlerContext<TMap extends object = KumikoEventTypeMap> = SharedContextFields & {
|
|
358
|
+
// Tenant-filtered for ordinary handlers. For r.systemScope() handlers this
|
|
359
|
+
// is fail-closed instead (dispatch-shared.ts hands back a guard that
|
|
360
|
+
// throws on first touch) — there's no type-level way to make `db` optional
|
|
361
|
+
// only for system handlers (isSystem is a runtime-only registry lookup),
|
|
362
|
+
// so a system handler must reach for `systemDb` below.
|
|
356
363
|
readonly db: TenantDb;
|
|
357
364
|
// Same tenant scoping as `db`, but never bound to the handler's tx: writes
|
|
358
365
|
// through it survive a rollback, for side effects that already happened
|
|
359
366
|
// outside the DB. `undefined` when the pipeline has no outside-tx source
|
|
360
367
|
// for this dispatch (see dispatch-shared.ts) — callers must check before use.
|
|
361
368
|
readonly dbOutsideTransaction: TenantDb | undefined;
|
|
362
|
-
// Only present for r.systemScope() handlers
|
|
363
|
-
//
|
|
369
|
+
// Only present for r.systemScope() handlers. Non-system handlers never
|
|
370
|
+
// receive this — reach for `db` instead, which is fail-closed for them.
|
|
364
371
|
readonly systemDb?: UncheckedSystemDb;
|
|
365
372
|
readonly registry: Registry;
|
|
366
373
|
/** Aktiver SessionUser des Handler-Aufrufs — Convenience-Alias zu
|