BeforeEvent
type BeforeEvent = | { environmentKey: string; flag: Flag; projectKey: string; type: "flag.upsert";} | { environmentKey: string; flagKey: string; projectKey: string; type: "flag.delete";} | { environmentKey: string; flag: Flag; flagKey: string; projectKey: string; type: "flag.archive" | "flag.restore";} | { environmentKey: string; projectKey: string; segment: Segment; type: "segment.upsert";} | { environmentKey: string; projectKey: string; segmentKey: string; type: "segment.delete";} | { actor: Actor | null; draft: Draft; environmentKey: string; message?: string; projectKey: string; segments: Record<string, Segment>; type: "publish";} | { actor: Actor | null; environmentKey: string; fromVersion?: string; message?: string; projectKey: string; toVersion: string; type: "rollback";} | { actor: Actor | null; environmentKey: string; projectKey: string; type: "snapshot.delete"; version: string;};Defined in: hooks/contract.ts:40
Event delivered to FlagsHooks.before — the proposed mutation, before it commits. Throw from the handler to deny it.
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ environmentKey: string; flag: Flag; projectKey: string; type: "flag.upsert";}Type Literal
Section titled “Type Literal”{ environmentKey: string; flagKey: string; projectKey: string; type: "flag.delete";}Type Literal
Section titled “Type Literal”{ environmentKey: string; flag: Flag; flagKey: string; projectKey: string; type: "flag.archive" | "flag.restore";}Type Literal
Section titled “Type Literal”{ environmentKey: string; projectKey: string; segment: Segment; type: "segment.upsert";}Type Literal
Section titled “Type Literal”{ environmentKey: string; projectKey: string; segmentKey: string; type: "segment.delete";}Type Literal
Section titled “Type Literal”{ actor: Actor | null; draft: Draft; environmentKey: string; message?: string; projectKey: string; segments: Record<string, Segment>; type: "publish";}| Name | Type | Description | Defined in |
|---|---|---|---|
actor |
Actor | null |
- | hooks/contract.ts:60 |
draft |
Draft |
The working draft about to be compiled + published. | hooks/contract.ts:57 |
environmentKey |
string |
- | hooks/contract.ts:55 |
message? |
string |
- | hooks/contract.ts:61 |
projectKey |
string |
- | hooks/contract.ts:54 |
segments |
Record<string, Segment> |
The env’s reusable segments (raw, unresolved) — for gates that evaluate the draft. | hooks/contract.ts:59 |
type |
"publish" |
- | hooks/contract.ts:53 |
Type Literal
Section titled “Type Literal”{ actor: Actor | null; environmentKey: string; fromVersion?: string; message?: string; projectKey: string; toVersion: string; type: "rollback";}| Name | Type | Description | Defined in |
|---|---|---|---|
actor |
Actor | null |
- | hooks/contract.ts:71 |
environmentKey |
string |
- | hooks/contract.ts:66 |
fromVersion? |
string |
The currently-active version being replaced, if any. | hooks/contract.ts:70 |
message? |
string |
- | hooks/contract.ts:72 |
projectKey |
string |
- | hooks/contract.ts:65 |
toVersion |
string |
The version being rolled back to. | hooks/contract.ts:68 |
type |
"rollback" |
- | hooks/contract.ts:64 |
Type Literal
Section titled “Type Literal”{ actor: Actor | null; environmentKey: string; projectKey: string; type: "snapshot.delete"; version: string;}| Name | Type | Description | Defined in |
|---|---|---|---|
actor |
Actor | null |
- | hooks/contract.ts:80 |
environmentKey |
string |
- | hooks/contract.ts:78 |
projectKey |
string |
- | hooks/contract.ts:77 |
type |
"snapshot.delete" |
A manual snapshot deletion (retention pruning is not vetoable and skips before). |
hooks/contract.ts:76 |
version |
string |
- | hooks/contract.ts:79 |