@cosmicdrift/kumiko-types 0.306.0 → 0.307.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/event-store-types.ts +15 -0
- package/src/handlers.ts +15 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.307.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/event-store-types.ts
CHANGED
|
@@ -45,8 +45,23 @@ export type EventMetadata = {
|
|
|
45
45
|
// every new row carries both, falling back to UNATTRIBUTED_ORIGIN.
|
|
46
46
|
readonly feature?: string;
|
|
47
47
|
readonly handler?: string;
|
|
48
|
+
// Only set under an anonymous root without public-intake, so event-triggered
|
|
49
|
+
// jobs keep the personal-data gate.
|
|
50
|
+
readonly writeOrigin?: WriteOrigin;
|
|
48
51
|
};
|
|
49
52
|
|
|
53
|
+
export type WriteOrigin = {
|
|
54
|
+
readonly rootHandler: string;
|
|
55
|
+
readonly anonymousRoot: boolean;
|
|
56
|
+
// Only a write-handler root can declare public-intake; a query/stream root never does.
|
|
57
|
+
readonly publicIntake: boolean;
|
|
58
|
+
readonly viaJob?: string;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export function isPersonalDataGated(origin: WriteOrigin): boolean {
|
|
62
|
+
return origin.anonymousRoot && !origin.publicIntake;
|
|
63
|
+
}
|
|
64
|
+
|
|
50
65
|
// Stamped when an append runs outside any attributed scope (seed scripts,
|
|
51
66
|
// tests, direct event-store use). A distinct value, not an omission —
|
|
52
67
|
// omitted would be indistinguishable from a pre-#3043 row.
|
package/src/handlers.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { ConfigAccessor, ConfigAccessorFactory, ConfigResolver } from "./co
|
|
|
4
4
|
import type { DbConnection } from "./db-connection";
|
|
5
5
|
import type { DerivativesContext } from "./derivatives-types";
|
|
6
6
|
import type { EntityCache } from "./entity-cache";
|
|
7
|
+
import type { WriteOrigin } from "./event-store-types";
|
|
7
8
|
import type { KumikoEventTypeMap } from "./event-type-map";
|
|
8
9
|
import type { FileContext } from "./file-handle-types";
|
|
9
10
|
import type { FileProviderResolver } from "./file-provider-resolver-types";
|
|
@@ -260,8 +261,20 @@ export type JobRunnerRef = {
|
|
|
260
261
|
// singleton, not bound to one caller's identity. Only write+queryAs — no
|
|
261
262
|
// .query/.stream/.command/.batch/.resolveAuthClaims, that stays Dispatcher-only.
|
|
262
263
|
export type DispatchWriteRef = {
|
|
263
|
-
|
|
264
|
-
|
|
264
|
+
// A job under a gated anonymous origin passes it, else the target would
|
|
265
|
+
// reset to the job's own non-anonymous root.
|
|
266
|
+
readonly write: (
|
|
267
|
+
user: SessionUser,
|
|
268
|
+
qn: string,
|
|
269
|
+
payload: unknown,
|
|
270
|
+
inheritedOrigin?: WriteOrigin,
|
|
271
|
+
) => Promise<WriteResult>;
|
|
272
|
+
readonly queryAs: (
|
|
273
|
+
user: SessionUser,
|
|
274
|
+
qn: string,
|
|
275
|
+
payload: unknown,
|
|
276
|
+
inheritedOrigin?: WriteOrigin,
|
|
277
|
+
) => Promise<unknown>;
|
|
265
278
|
// Builds a tenant-scoped MemberReader — one per JobContext.queryAsMember
|
|
266
279
|
// caller (job-runner.ts lazily creates one per job run).
|
|
267
280
|
readonly createMemberReader: (tenantId: TenantId) => MemberReader;
|