@cosmicdrift/kumiko-types 0.200.0 → 0.201.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 +4 -1
- package/src/tenant-db-types.ts +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.201.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
|
@@ -364,7 +364,10 @@ export type HandlerContext<TMap extends object = KumikoEventTypeMap> = SharedCon
|
|
|
364
364
|
// Same tenant scoping as `db`, but never bound to the handler's tx: writes
|
|
365
365
|
// through it survive a rollback, for side effects that already happened
|
|
366
366
|
// outside the DB. `undefined` when the pipeline has no outside-tx source
|
|
367
|
-
// for this dispatch (see dispatch-shared.ts) — callers must check before
|
|
367
|
+
// for this dispatch (see dispatch-shared.ts) — callers must check before
|
|
368
|
+
// use. For r.systemScope() handlers this is fail-closed instead, same as
|
|
369
|
+
// `db` above — a truthy Proxy that throws on first property read, so a
|
|
370
|
+
// system handler must reach for `systemDb.outsideTransaction` below.
|
|
368
371
|
readonly dbOutsideTransaction: TenantDb | undefined;
|
|
369
372
|
// Only present for r.systemScope() handlers. Non-system handlers never
|
|
370
373
|
// receive this — reach for `db` instead, which is fail-closed for them.
|
package/src/tenant-db-types.ts
CHANGED
|
@@ -68,4 +68,14 @@ export type UncheckedSystemDb = {
|
|
|
68
68
|
assertTenantMatch(tenantId: TenantId): TenantDb;
|
|
69
69
|
assertRowsTenant<T>(rows: readonly T[], tenantField: keyof T): readonly T[];
|
|
70
70
|
acknowledgeCrossTenant(reason: string): TenantDb;
|
|
71
|
+
// Same self-check pair as above, but hands back the caller's
|
|
72
|
+
// ctx.dbOutsideTransaction TenantDb instead of the in-tx one — for
|
|
73
|
+
// durability writes that must survive a rollback of the handler's own
|
|
74
|
+
// transaction. Throws if the dispatch has no outside-transaction source
|
|
75
|
+
// configured (e.g. a hand-built UncheckedSystemDb that only ever passed
|
|
76
|
+
// the in-tx db to createUncheckedSystemDb).
|
|
77
|
+
readonly outsideTransaction: {
|
|
78
|
+
assertTenantMatch(tenantId: TenantId): TenantDb;
|
|
79
|
+
acknowledgeCrossTenant(reason: string): TenantDb;
|
|
80
|
+
};
|
|
71
81
|
};
|