tina4-nodejs 3.13.104 → 3.13.108

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.
@@ -17,6 +17,8 @@ interface MatchResult {
17
17
  secure?: boolean;
18
18
  cached?: boolean;
19
19
  noAuth?: boolean;
20
+ requiredRoles?: string[][];
21
+ requiredPerms?: string[][];
20
22
  }
21
23
  interface CompiledRoute {
22
24
  pattern: string;
@@ -36,6 +38,9 @@ interface CompiledRoute {
36
38
  }>;
37
39
  cacheTtl?: number;
38
40
  template?: string;
41
+ /** RBAC guard groups (Feature 138): OR within a group, AND across groups. */
42
+ requiredRoles?: string[][];
43
+ requiredPerms?: string[][];
39
44
  }
40
45
  /**
41
46
  * Thin reference to a registered WebSocket route, enabling chained modifiers
@@ -63,6 +68,17 @@ export declare class RouteRef {
63
68
  secure(): this;
64
69
  /** Opt out of secure-by-default auth (for public write routes). */
65
70
  noAuth(): this;
71
+ /**
72
+ * RBAC: require ONE of the named roles (OR). Reads the verified JWT `roles`
73
+ * claim. Chain .role()/.can() for AND. Implies auth. Feature 138 / ADR-0058.
74
+ */
75
+ role(...names: string[]): this;
76
+ /**
77
+ * RBAC: require ONE of the named permissions (OR). Reads the verified JWT
78
+ * `permissions` claim; granted-side wildcards (`posts.*`, `*`) satisfy a
79
+ * concrete requirement. Chain for AND. Implies auth. Feature 138.
80
+ */
81
+ can(...permissions: string[]): this;
66
82
  /** Mark this route's response as cacheable. */
67
83
  cache(): this;
68
84
  /**
@@ -146,6 +146,10 @@ export interface RouteDefinition {
146
146
  cached?: boolean;
147
147
  /** Opt out of secure-by-default auth on write routes */
148
148
  noAuth?: boolean;
149
+ /** RBAC role guard groups (Feature 138): OR within a group, AND across groups */
150
+ requiredRoles?: string[][];
151
+ /** RBAC permission guard groups (Feature 138) */
152
+ requiredPerms?: string[][];
149
153
  }
150
154
  export interface RouteMeta {
151
155
  summary?: string;
@@ -339,11 +339,16 @@ export declare class BaseModel {
339
339
  /**
340
340
  * Invalidate every cached query that touches this model's table.
341
341
  *
342
- * Tag-scoped, NOT a wholesale flush: a cached JOIN on another model that reads
343
- * this table is busted too (it carries this table's tag), while a query that
344
- * never touches this table is left intact. Called after every ORM write
345
- * (save/delete/forceDelete/restore) so a read-after-write never serves a
346
- * stale/deleted row (CACHE-DEC-01).
342
+ * Tag-scoped in the ORM layer (a cached JOIN on another model that reads
343
+ * this table is busted too because it carries this table's tag; a query
344
+ * that never touches this table is left intact), then cascaded to the
345
+ * DB layer on this model's bound connection so an out-of-band write /
346
+ * deliberate refresh / race-with-another-process cannot leave stale rows
347
+ * in db.fetch()'s persistent cache. Called after every ORM write
348
+ * (save/delete/forceDelete/restore) so a read-after-write never serves
349
+ * a stale/deleted row (CACHE-DEC-01). PY-06-22 (3.13.105) added the
350
+ * DB-layer cascade -- previously the two cache layers disagreed under
351
+ * TINA4_AUTO_CACHING=true + TINA4_DB_CACHE=true.
347
352
  */
348
353
  static clearCache(): void;
349
354
  /**