Skip to content

AfterEvent

type AfterEvent =
| {
at: string;
environmentKey: string;
flag: Flag;
projectKey: string;
type: "flag.upserted" | "flag.archived" | "flag.restored";
}
| {
at: string;
environmentKey: string;
flagKey: string;
projectKey: string;
type: "flag.deleted";
}
| {
at: string;
environmentKey: string;
projectKey: string;
segment: Segment;
type: "segment.upserted";
}
| {
at: string;
environmentKey: string;
projectKey: string;
segmentKey: string;
type: "segment.deleted";
}
| {
actor: Actor | null;
at: string;
environmentKey: string;
message?: string;
projectKey: string;
snapshot: Snapshot;
type: "published";
}
| {
actor: Actor | null;
at: string;
environmentKey: string;
fromVersion?: string;
message?: string;
projectKey: string;
type: "rolledback";
version: string;
}
| {
actor: Actor | null;
at: string;
environmentKey: string;
projectKey: string;
pruned: boolean;
snapshot: Snapshot;
type: "snapshot.deleted";
version: string;
}
| {
at: string;
entries: AuditEntry[];
environmentKey: string;
projectKey: string;
type: "audit.pruned";
};

Defined in: hooks/contract.ts:87

Event delivered to FlagsHooks.after — the committed mutation. Carries the resulting state (e.g. the stamped flag, the published snapshot).

{
at: string;
environmentKey: string;
flag: Flag;
projectKey: string;
type: "flag.upserted" | "flag.archived" | "flag.restored";
}

{
at: string;
environmentKey: string;
flagKey: string;
projectKey: string;
type: "flag.deleted";
}

{
at: string;
environmentKey: string;
projectKey: string;
segment: Segment;
type: "segment.upserted";
}

{
at: string;
environmentKey: string;
projectKey: string;
segmentKey: string;
type: "segment.deleted";
}

{
actor: Actor | null;
at: string;
environmentKey: string;
message?: string;
projectKey: string;
snapshot: Snapshot;
type: "published";
}

{
actor: Actor | null;
at: string;
environmentKey: string;
fromVersion?: string;
message?: string;
projectKey: string;
type: "rolledback";
version: string;
}

{
actor: Actor | null;
at: string;
environmentKey: string;
projectKey: string;
pruned: boolean;
snapshot: Snapshot;
type: "snapshot.deleted";
version: string;
}
Name Type Description Defined in
actor Actor | null - hooks/contract.ts:148
at string - hooks/contract.ts:149
environmentKey string - hooks/contract.ts:143
projectKey string - hooks/contract.ts:142
pruned boolean True when removed by retention policy rather than an explicit delete. hooks/contract.ts:147
snapshot Snapshot - hooks/contract.ts:145
type "snapshot.deleted" A snapshot’s payload was removed (manual delete or retention pruning). Carries the full snapshot — this event is the last chance to offload it (S3, warehouse, SIEM) before it is gone from storage. hooks/contract.ts:141
version string - hooks/contract.ts:144

{
at: string;
entries: AuditEntry[];
environmentKey: string;
projectKey: string;
type: "audit.pruned";
}
Name Type Description Defined in
at string - hooks/contract.ts:160
entries AuditEntry[] - hooks/contract.ts:159
environmentKey string - hooks/contract.ts:158
projectKey string - hooks/contract.ts:157
type "audit.pruned" Audit entries were removed by retention policy. Carries the removed entries (oldest-first) — the last chance to offload them. hooks/contract.ts:156