@cosmicdrift/kumiko-types 0.297.0 → 0.304.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.297.0",
3
+ "version": "0.304.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/feature.ts CHANGED
@@ -840,13 +840,13 @@ export type FeatureRegistrar<TFeature extends string = string> = {
840
840
  workspace(definition: WorkspaceDefinition): void;
841
841
 
842
842
  // Register an HTTP-route owned by this feature. The route is mounted
843
- // outside the dispatcher pipeline (= außerhalb /api/write|query|batch),
844
- // direkt an die app — Use-Case: RSS/Atom-Feeds, OG-Images, OpenAPI-Specs.
843
+ // outside the dispatcher pipeline (= outside /api/write|query|batch),
844
+ // directly on the app — use case: RSS/Atom feeds, OG images, OpenAPI specs.
845
845
  // Duplicate "method path"-Combinations are rejected per feature at setup
846
846
  // time; there is no cross-feature check.
847
- // Symmetric to queryHandler/writeHandler — Routes leben mit dem Feature,
848
- // nicht im Bootstrap. Escape-hatch für nicht-feature-bound Routes
849
- // bleibt runProdApp.extraRoutes.
847
+ // Symmetric to queryHandler/writeHandler — routes live with the feature,
848
+ // not in the bootstrap. Escape-hatch for non-feature-bound routes stays
849
+ // runProdApp.extraRoutes (declarative list with `entry` tier).
850
850
  httpRoute(definition: HttpRouteDefinition): void;
851
851
 
852
852
  // Declare an "unmanaged" framework-native table that bypasses the
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
@@ -1,15 +1,15 @@
1
- // HTTP-Route-Definition — feature-deklarierte HTTP-Endpoints außerhalb
2
- // der /api/write|query|batch-Pipeline. Use-Case: RSS/Atom-Feeds, OpenAPI-
3
- // Specs, OG-Image-Generators, Webhook-Receiver — alles wo der Feature-
4
- // Author das Wire-Format selbst kontrolliert.
1
+ // HTTP route definition — feature-declared HTTP endpoints outside
2
+ // the /api/write|query|batch pipeline. Use case: RSS/Atom feeds, OpenAPI
3
+ // specs, OG image generators, webhook receivers — anything where the
4
+ // feature author controls the wire format themselves.
5
5
  //
6
- // Pattern symmetrisch zu r.queryHandler / r.writeHandler: Definition als
7
- // Teil des Features (nicht des App-Bootstrapping). Phase-3 Multi-Tenant
8
- // wird trivial weil tenant-context via host-resolution greift.
6
+ // Pattern symmetric to r.queryHandler / r.writeHandler: definition as
7
+ // part of the feature (not the app bootstrapping). Phase-3 multi-tenant
8
+ // becomes trivial because tenant context is picked up via host resolution.
9
9
  //
10
- // Escape-hatch bleibt: runProdApp.extraRoutes für hand-rolled Routes die
11
- // nichts mit einem Feature zu tun haben (z.B. plattform-spezifische
12
- // Static-Serving-Logic).
10
+ // Escape-hatch stays: runProdApp.extraRoutes (declarative list with
11
+ // `entry` tier) for hand-rolled routes that have nothing to do with a
12
+ // feature (e.g. platform-specific static-serving logic).
13
13
 
14
14
  import type { Context } from "hono";
15
15
 
@@ -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;