actiontextrequiredWhat was done, named `subject.verb`; each module adds its own
Becomes the column action of audit_event.
Written at commons/data/models/identity/concepts.ts:451
Something that was done, or tried, kept in a chain of hashes so that it cannot be changed without showing
Model identity. Written in commons/data/models/identity/concepts.ts:438. Identified by auditEventId.
actiontextrequiredWhat was done, named `subject.verb`; each module adds its own
Becomes the column action of audit_event.
Written at commons/data/models/identity/concepts.ts:451
actorKindcode of actorKindrequiredWhat did it: a person, a machine, a device, an agent, the platform or someone acting as another
Becomes the column actor_kind of audit_event.
Written at commons/data/models/identity/concepts.ts:444
auditEventIdidentifierrequiredWhat identifies the event, made by the application
Becomes the column audit_event_id of audit_event.
Written at commons/data/models/identity/concepts.ts:441
chainstructuredoptionalThe principals between the person accountable and the actor, root first
Becomes the column chain of audit_event.
Written at commons/data/models/identity/concepts.ts:449
decisioncode of decisionoptionalWhat the decision was, for an event that records one
Becomes the column decision of audit_event.
Written at commons/data/models/identity/concepts.ts:445
delegationKeytextoptionalThe delegation it was done under; not a reference, so that the trail outlives it
Becomes the column delegation_key of audit_event.
Written at commons/data/models/identity/concepts.ts:446
detailstructuredoptionalWhat else matters, with no secret in it
Becomes the column detail of audit_event.
Written at commons/data/models/identity/concepts.ts:460
eventHashtextrequiredThe hash of this event and the one before
Becomes the column event_hash of audit_event.
Written at commons/data/models/identity/concepts.ts:462
iptextoptionalpersonal dataWhere it came from
Becomes the column ip of audit_event.
Annotations: privacy.personal={"category":"IPAddress","purposes":["investigate what happened"]}
Written at commons/data/models/identity/concepts.ts:457
occurredAtinstantrequiredWhen it happened
Becomes the column occurred_at of audit_event.
Written at commons/data/models/identity/concepts.ts:443
outcomecode of auditOutcomerequiredHow it ended
Becomes the column outcome of audit_event.
Written at commons/data/models/identity/concepts.ts:452
policyRefsstructuredoptionalThe roles, policies and grants that decided
Becomes the column policy_refs of audit_event.
Written at commons/data/models/identity/concepts.ts:450
previousHashtextrequiredThe hash of the event before it in the chain
Becomes the column previous_hash of audit_event.
Written at commons/data/models/identity/concepts.ts:461
reasontextoptionalWhy, where a reason was given
Becomes the column reason of audit_event.
Written at commons/data/models/identity/concepts.ts:459
requestIdtextoptionalThe request it was part of
Becomes the column request_id of audit_event.
Written at commons/data/models/identity/concepts.ts:456
runKeytextoptionalThe run of an agent it was done in; not a reference, so that the trail outlives it
Becomes the column run_key of audit_event.
Written at commons/data/models/identity/concepts.ts:447
sequenceintegerrequiredWhich event of the trail it is, counted from one: each follows the one before it, so that none is left out and none is put between
Becomes the column sequence of audit_event.
Written at commons/data/models/identity/concepts.ts:442
sessionKeytextoptionalThe session it was done in; not a reference, because sessions are purged
Becomes the column session_key of audit_event.
Written at commons/data/models/identity/concepts.ts:455
targetConcepttextoptionalThe kind of thing it was done to
Becomes the column target_concept of audit_event.
Written at commons/data/models/identity/concepts.ts:453
targetKeytextoptionalThe thing it was done to; a loose reference, so that the trail outlives what it names
Becomes the column target_key of audit_event.
Written at commons/data/models/identity/concepts.ts:454
traceIdtextoptionalThe trace it is part of
Becomes the column trace_id of audit_event.
Written at commons/data/models/identity/concepts.ts:448
userAgenttextoptionalpersonal dataWhat the client says it is
Becomes the column user_agent of audit_event.
Annotations: privacy.personal={"category":"UserAgent","purposes":["investigate what happened"]}
Written at commons/data/models/identity/concepts.ts:458
actoroptionalWho did it, where a principal did To principal. Written at commons/data/models/identity/concepts.ts:467
onBehalfOfoptionalThe person or group accountable at the root of the chain the actor acted in To principal. Written at commons/data/models/identity/concepts.ts:468
tenantoptionalThe tenant it was in To tenant. Written at commons/data/models/identity/concepts.ts:466
Projects to the table audit_event with the primary key audit_event_id.
| Column | Type | Null | Role | From |
|---|---|---|---|---|
action | text | false | attribute | auditEvent.action |
actor_kind | text | false | attribute | auditEvent.actorKind |
actor_principal_id | text | true | reference | auditEvent.actor |
audit_event_id | text | false | attribute | auditEvent.auditEventId |
chain | json | true | attribute | auditEvent.chain |
decision | text | true | attribute | auditEvent.decision |
delegation_key | text | true | attribute | auditEvent.delegationKey |
detail | json | true | attribute | auditEvent.detail |
event_hash | text | false | attribute | auditEvent.eventHash |
ip | text | true | attribute | auditEvent.ip |
occurred_at | timestamp | false | attribute | auditEvent.occurredAt |
on_behalf_of_principal_id | text | true | reference | auditEvent.onBehalfOf |
outcome | text | false | attribute | auditEvent.outcome |
policy_refs | json | true | attribute | auditEvent.policyRefs |
previous_hash | text | false | attribute | auditEvent.previousHash |
reason | text | true | attribute | auditEvent.reason |
request_id | text | true | attribute | auditEvent.requestId |
run_key | text | true | attribute | auditEvent.runKey |
sequence | integer | false | attribute | auditEvent.sequence |
session_key | text | true | attribute | auditEvent.sessionKey |
target_concept | text | true | attribute | auditEvent.targetConcept |
target_key | text | true | attribute | auditEvent.targetKey |
tenant_id | text | true | reference | auditEvent.tenant |
trace_id | text | true | attribute | auditEvent.traceId |
user_agent | text | true | attribute | auditEvent.userAgent |
CREATE TABLE IF NOT EXISTS "audit_event" (
"audit_event_id" VARCHAR NOT NULL PRIMARY KEY,
"sequence" INTEGER NOT NULL,
"occurred_at" TIMESTAMPTZ NOT NULL,
"actor_kind" VARCHAR NOT NULL,
"decision" VARCHAR,
"delegation_key" VARCHAR,
"run_key" VARCHAR,
"trace_id" VARCHAR,
"chain" JSON,
"policy_refs" JSON,
"action" VARCHAR NOT NULL,
"outcome" VARCHAR NOT NULL,
"target_concept" VARCHAR,
"target_key" VARCHAR,
"session_key" VARCHAR,
"request_id" VARCHAR,
"ip" VARCHAR,
"user_agent" VARCHAR,
"reason" VARCHAR,
"detail" JSON,
"previous_hash" VARCHAR NOT NULL,
"event_hash" VARCHAR NOT NULL,
"tenant_id" VARCHAR,
"actor_principal_id" VARCHAR,
"on_behalf_of_principal_id" VARCHAR,
CONSTRAINT "audit_event_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id"),
CONSTRAINT "audit_event_actor_principal_id_fk" FOREIGN KEY ("actor_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "audit_event_on_behalf_of_principal_id_fk" FOREIGN KEY ("on_behalf_of_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "audit_event_event_hash_uq" UNIQUE ("event_hash"),
CONSTRAINT "audit_event_sequence_uq" UNIQUE ("sequence"),
CONSTRAINT "audit_event_actor_kind_ck" CHECK ("actor_kind" IN ('user', 'machine', 'device', 'agent', 'system', 'impersonator')),
CONSTRAINT "audit_event_decision_ck" CHECK ("decision" IN ('allow', 'deny')),
CONSTRAINT "audit_event_outcome_ck" CHECK ("outcome" IN ('success', 'failure', 'denied'))
);CREATE TABLE IF NOT EXISTS "audit_event" (
"audit_event_id" TEXT NOT NULL PRIMARY KEY,
"sequence" INTEGER NOT NULL,
"occurred_at" TIMESTAMPTZ NOT NULL,
"actor_kind" TEXT NOT NULL,
"decision" TEXT,
"delegation_key" TEXT,
"run_key" TEXT,
"trace_id" TEXT,
"chain" JSONB,
"policy_refs" JSONB,
"action" TEXT NOT NULL,
"outcome" TEXT NOT NULL,
"target_concept" TEXT,
"target_key" TEXT,
"session_key" TEXT,
"request_id" TEXT,
"ip" TEXT,
"user_agent" TEXT,
"reason" TEXT,
"detail" JSONB,
"previous_hash" TEXT NOT NULL,
"event_hash" TEXT NOT NULL,
"tenant_id" TEXT,
"actor_principal_id" TEXT,
"on_behalf_of_principal_id" TEXT,
CONSTRAINT "audit_event_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id"),
CONSTRAINT "audit_event_actor_principal_id_fk" FOREIGN KEY ("actor_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "audit_event_on_behalf_of_principal_id_fk" FOREIGN KEY ("on_behalf_of_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "audit_event_event_hash_uq" UNIQUE ("event_hash"),
CONSTRAINT "audit_event_sequence_uq" UNIQUE ("sequence"),
CONSTRAINT "audit_event_actor_kind_ck" CHECK ("actor_kind" IN ('user', 'machine', 'device', 'agent', 'system', 'impersonator')),
CONSTRAINT "audit_event_decision_ck" CHECK ("decision" IN ('allow', 'deny')),
CONSTRAINT "audit_event_outcome_ck" CHECK ("outcome" IN ('success', 'failure', 'denied'))
);CREATE TABLE IF NOT EXISTS "audit_event" (
"audit_event_id" TEXT NOT NULL PRIMARY KEY,
"sequence" INTEGER NOT NULL,
"occurred_at" TEXT NOT NULL,
"actor_kind" TEXT NOT NULL,
"decision" TEXT,
"delegation_key" TEXT,
"run_key" TEXT,
"trace_id" TEXT,
"chain" TEXT,
"policy_refs" TEXT,
"action" TEXT NOT NULL,
"outcome" TEXT NOT NULL,
"target_concept" TEXT,
"target_key" TEXT,
"session_key" TEXT,
"request_id" TEXT,
"ip" TEXT,
"user_agent" TEXT,
"reason" TEXT,
"detail" TEXT,
"previous_hash" TEXT NOT NULL,
"event_hash" TEXT NOT NULL,
"tenant_id" TEXT,
"actor_principal_id" TEXT,
"on_behalf_of_principal_id" TEXT,
CONSTRAINT "audit_event_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id"),
CONSTRAINT "audit_event_actor_principal_id_fk" FOREIGN KEY ("actor_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "audit_event_on_behalf_of_principal_id_fk" FOREIGN KEY ("on_behalf_of_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "audit_event_event_hash_uq" UNIQUE ("event_hash"),
CONSTRAINT "audit_event_sequence_uq" UNIQUE ("sequence"),
CONSTRAINT "audit_event_actor_kind_ck" CHECK ("actor_kind" IN ('user', 'machine', 'device', 'agent', 'system', 'impersonator')),
CONSTRAINT "audit_event_decision_ck" CHECK ("decision" IN ('allow', 'deny')),
CONSTRAINT "audit_event_outcome_ck" CHECK ("outcome" IN ('success', 'failure', 'denied'))
);Read and written from TypeScript with the types the model gives: import { auditEvent } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/identity.auto.ts: do not edit.
import { from } from "@intellectual-frontiers/data/sql/typed";
import { auditEvent } from "@intellectual-frontiers/data/sql/typed/models";
const rows = await from(auditEvent).select((s) => ({ auditEventId: s.auditEvent.auditEventId, sequence: s.auditEvent.sequence })).run(runner);