@cosmicdrift/kumiko-types 0.299.0 → 0.305.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-types",
3
- "version": "0.299.0",
3
+ "version": "0.305.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/config.ts CHANGED
@@ -358,6 +358,14 @@ export type JobTrigger =
358
358
  | { readonly cron: string }
359
359
  | { readonly manual: true };
360
360
 
361
+ export type JobBackoffStrategy = "fixed" | "exponential";
362
+ // String form uses the framework's default base delay; the object form's
363
+ // `delayMs` is the base BullMQ multiplies: "fixed" keeps it constant,
364
+ // "exponential" scales it delayMs * 2^(attemptsMade-1) per retry.
365
+ export type JobBackoff =
366
+ | JobBackoffStrategy
367
+ | { readonly type: JobBackoffStrategy; readonly delayMs?: number | undefined };
368
+
361
369
  export type JobDefinition = {
362
370
  readonly name: string;
363
371
  readonly handler: JobHandlerFn;
@@ -366,7 +374,7 @@ export type JobDefinition = {
366
374
  readonly maxPerTenant?: number | undefined;
367
375
  readonly debounceMs?: number | undefined;
368
376
  readonly retries?: number | undefined;
369
- readonly backoff?: "fixed" | "exponential" | undefined;
377
+ readonly backoff?: JobBackoff | undefined;
370
378
  readonly timeout?: number | undefined;
371
379
  readonly schema?: ZodType | undefined;
372
380
  // Enqueue this job once when a runner for its lane starts. Fire-and-forget:
package/src/handlers.ts CHANGED
@@ -28,11 +28,19 @@ export type OpenToAllAccessRule = {
28
28
  readonly openToAll: OpenToAllDeclaration;
29
29
  };
30
30
 
31
+ // "public-intake": anonymous callers may write personal data; the required rateLimit is the only protection.
32
+ export type RoleAccessPersonalData = "public-intake";
33
+
34
+ export type RoleAccessRule = {
35
+ readonly roles: readonly string[];
36
+ readonly personalData?: RoleAccessPersonalData;
37
+ };
38
+
31
39
  // AccessRule is DEFAULT-DENY: a handler without an access rule is not reachable.
32
40
  // To grant access, set one of:
33
41
  // - { roles: ["Admin", ...] } — role-based allowlist (empty array denies everyone)
34
42
  // - { openToAll: { reason: "..." } } — any authenticated user may call (still requires a valid JWT)
35
- export type AccessRule = { readonly roles: readonly string[] } | OpenToAllAccessRule;
43
+ export type AccessRule = RoleAccessRule | OpenToAllAccessRule;
36
44
 
37
45
  export type EscapeHatchDeclaration = { readonly reason: string };
38
46
 
package/src/http-route.ts CHANGED
@@ -61,11 +61,11 @@ export type HttpRouteDefinition = {
61
61
  readonly method: HttpRouteMethod;
62
62
  /** URL-Pfad (Hono-Pattern, z.B. "/feed.xml" oder "/og/:tenantId.png"). */
63
63
  readonly path: string;
64
- /** Wenn true, bypasses die /api/*-Auth-Middleware. Default false —
65
- * Routes liegen außerhalb /api/* und sehen die Auth-Middleware
66
- * ohnehin nicht; das Flag ist semantisch (= "diese Route ist
67
- * bewusst öffentlich") für Boot-Validator + Doku. */
68
- readonly anonymous?: boolean;
64
+ /** true = public, no session required. false = mounted behind the
65
+ * session auth chain (no anonymous fallthrough, PAT rate limit,
66
+ * origin + CSRF guards) — a request without a session gets 401. The
67
+ * handler reads the caller via getUser(c). */
68
+ readonly anonymous: boolean;
69
69
  /** Hono-Handler. Bekommt Hono-Context + Framework-Deps; returnt
70
70
  * Response (sync oder async). */
71
71
  readonly handler: HttpRouteHandler;