auth/cell_grant_audit_metadata.ts

Audit-log metadata schemas for the cell_grant ACL events.

IDs only — no display-name snapshots. By convention audit logs store references, not denormalized strings; viewer tooling resolves actor_id → actor.name, scope_id → scope name, etc. at read time.

Apps register these via extra_events: on create_audit_log_config alongside the other cell metadata schemas.

view source

Declarations
#

3 declarations

CellGrantCreateAuditMetadata
#

auth/cell_grant_audit_metadata.ts view source

value + type

{ cell_id: Branded<string, "Uuid">; level: "viewer" | "editor"; principal: ({ actor_id: Branded<string, "Uuid">; } & Record<string, unknown>) | ({ role: string; scope_id: Branded<...> | null; } & Record<...>); grant_id: Branded<...>; } & Record<...>

type { cell_id: Branded<string, "Uuid">; level: "viewer" | "editor"; principal: ({ actor_id: Branded<string, "Uuid">; } & Record<string, unknown>) | ({ role: string; scope_id: Branded<string, "Uuid"> | null; } & Record<string, unknown>); grant_id: Branded<string, "Uuid">; } & Record<string, unknown>

import {CellGrantCreateAuditMetadata} from '@fuzdev/fuz_app/auth/cell_grant_audit_metadata.js';

Metadata envelope for cell_grant_create.

Emitted on every successful create OR re-share update path (UPSERT-on-unique-index). The audit reader correlates create-vs-update via grant_id if needed; the design doesn't require distinguishing the two at the metadata level.

cell_id

type Branded

level

type "viewer" | "editor"

principal

type CellGrantPrincipalAuditMetadata

grant_id

type Branded

[key: string]

type unknown

CellGrantPrincipalAuditMetadata
#

auth/cell_grant_audit_metadata.ts view source

value + type

({ actor_id: Branded<string, "Uuid">; } & Record<string, unknown>) | ({ role: string; scope_id: Branded<string, "Uuid"> | null; } & Record<string, unknown>)

type ({ actor_id: Branded<string, "Uuid">; } & Record<string, unknown>) | ({ role: string; scope_id: Branded<string, "Uuid"> | null; } & Record<string, unknown>)

import {CellGrantPrincipalAuditMetadata} from '@fuzdev/fuz_app/auth/cell_grant_audit_metadata.js';

Principal columns as stored on cell_grant. Discriminated by which keys are present: {actor_id} for an actor-shaped grant, {role, scope_id} for a role-shaped grant. Actor-shaped grants carry only the id; names are never persisted in the audit envelope.

CellGrantRevokeAuditMetadata
#

auth/cell_grant_audit_metadata.ts view source

value + type

{ cell_id: Branded<string, "Uuid">; level: "viewer" | "editor"; principal: ({ actor_id: Branded<string, "Uuid">; } & Record<string, unknown>) | ({ role: string; scope_id: Branded<...> | null; } & Record<...>); grant_id: Branded<...>; self?: true | undefined; steward?: true | undefined; } & Record<...>

type { cell_id: Branded<string, "Uuid">; level: "viewer" | "editor"; principal: ({ actor_id: Branded<string, "Uuid">; } & Record<string, unknown>) | ({ role: string; scope_id: Branded<string, "Uuid"> | null; } & Record<string, unknown>); grant_id: Branded<string, "Uuid">; self?: true | undefined; steward?: true | undefined; } & Record<string, unknown>

import {CellGrantRevokeAuditMetadata} from '@fuzdev/fuz_app/auth/cell_grant_audit_metadata.js';

Metadata envelope for cell_grant_revoke.

self: true distinguishes the recipient-side "leave shared cell" path (actor-shaped grant where the principal actor === caller actor) from a delegator-side revoke, and steward: true a scope steward's revoke of a scoped role-shaped grant, admitted by the consumer's CellGrantRevokeAuthorize. Single event type for all three — the boolean is enough for forensic review and avoids surface-doubling with parallel events.

cell_id

type Branded

level

type "viewer" | "editor"

principal

type CellGrantPrincipalAuditMetadata

grant_id

type Branded

self?

type true

steward?

type true

[key: string]

type unknown

Depends on
#

Imported by
#