Skip to content

Commit e0d7fd2

Browse files
chore: Update platform types
1 parent 2bc4e43 commit e0d7fd2

2 files changed

Lines changed: 282 additions & 1 deletion

File tree

‎generated_types.json‎

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4558,6 +4558,9 @@
45584558
},
45594559
"required": ["event_type", "action"]
45604560
},
4561+
{
4562+
"$ref": "#/components/schemas/WindowedAutomationConfig"
4563+
},
45614564
{
45624565
"$ref": "#/components/schemas/TopicAutomationConfig"
45634566
},
@@ -7090,6 +7093,224 @@
70907093
}
70917094
],
70927095
"description": "Options for the view in the app"
7096+
},
7097+
"WindowedAutomationConfig": {
7098+
"type": "object",
7099+
"properties": {
7100+
"event_type": {
7101+
"type": "string",
7102+
"enum": ["windowed"],
7103+
"description": "The type of automation."
7104+
},
7105+
"status": {
7106+
"$ref": "#/components/schemas/AutomationStatus"
7107+
},
7108+
"threshold": {
7109+
"type": "object",
7110+
"properties": {
7111+
"calculation": {
7112+
"oneOf": [
7113+
{
7114+
"type": "object",
7115+
"properties": {
7116+
"type": {
7117+
"type": "string",
7118+
"enum": ["btql"]
7119+
},
7120+
"btql_query": {
7121+
"type": "string",
7122+
"minLength": 1,
7123+
"description": "A project-scoped BTQL or SQL query without runtime-owned evaluation time bounds"
7124+
},
7125+
"output": {
7126+
"type": "object",
7127+
"properties": {
7128+
"type": {
7129+
"type": "string",
7130+
"enum": ["scalar"]
7131+
},
7132+
"value_column": {
7133+
"type": "string",
7134+
"minLength": 1,
7135+
"description": "The numeric result column produced by the query"
7136+
}
7137+
},
7138+
"required": ["type", "value_column"]
7139+
}
7140+
},
7141+
"required": ["type", "btql_query", "output"]
7142+
}
7143+
],
7144+
"description": "The calculation evaluated for each window"
7145+
},
7146+
"policy": {
7147+
"type": "object",
7148+
"properties": {
7149+
"condition": {
7150+
"type": "object",
7151+
"properties": {
7152+
"type": {
7153+
"type": "string",
7154+
"enum": ["threshold"]
7155+
},
7156+
"operator": {
7157+
"type": "string",
7158+
"enum": ["lt", "lte", "gt", "gte", "eq", "neq"]
7159+
},
7160+
"threshold": {
7161+
"type": "number"
7162+
}
7163+
},
7164+
"required": ["type", "operator", "threshold"]
7165+
},
7166+
"pending_seconds": {
7167+
"type": "integer",
7168+
"minimum": 0,
7169+
"maximum": 2592000,
7170+
"description": "How long the condition must remain breached before firing"
7171+
},
7172+
"no_data_behavior": {
7173+
"type": "string",
7174+
"enum": ["keep_last", "resolve", "alert"],
7175+
"description": "How the lifecycle changes when the calculation returns no data"
7176+
},
7177+
"renotify_interval_seconds": {
7178+
"type": ["integer", "null"],
7179+
"minimum": 1,
7180+
"maximum": 2592000,
7181+
"description": "Optional reminder interval while the automation is firing"
7182+
},
7183+
"notify_on_recovery": {
7184+
"type": "boolean",
7185+
"default": true,
7186+
"description": "Whether to deliver actions when a firing automation recovers"
7187+
}
7188+
},
7189+
"required": [
7190+
"condition",
7191+
"pending_seconds",
7192+
"no_data_behavior"
7193+
],
7194+
"description": "The lifecycle policy applied to each calculation result"
7195+
}
7196+
},
7197+
"required": ["calculation", "policy"],
7198+
"description": "Optional calculation and lifecycle policy that gate scheduled delivery"
7199+
},
7200+
"window": {
7201+
"type": "object",
7202+
"properties": {
7203+
"window_seconds": {
7204+
"type": "integer",
7205+
"minimum": 1,
7206+
"maximum": 2592000,
7207+
"description": "How much recent data each scheduled run covers"
7208+
},
7209+
"schedule": {
7210+
"oneOf": [
7211+
{
7212+
"type": "object",
7213+
"properties": {
7214+
"type": {
7215+
"type": "string",
7216+
"enum": ["interval"]
7217+
},
7218+
"evaluation_interval_seconds": {
7219+
"type": "integer",
7220+
"minimum": 1,
7221+
"maximum": 2592000,
7222+
"description": "How often the automation runs"
7223+
}
7224+
},
7225+
"required": ["type", "evaluation_interval_seconds"]
7226+
},
7227+
{
7228+
"type": "object",
7229+
"properties": {
7230+
"type": {
7231+
"type": "string",
7232+
"enum": ["cron"]
7233+
},
7234+
"cron_expression": {
7235+
"type": "string",
7236+
"minLength": 1,
7237+
"description": "A standard five-field cron expression (minute hour day-of-month month day-of-week) controlling when the automation runs"
7238+
},
7239+
"timezone": {
7240+
"type": ["string", "null"],
7241+
"minLength": 1,
7242+
"description": "IANA timezone used to interpret the cron expression (defaults to UTC)"
7243+
}
7244+
},
7245+
"required": ["type", "cron_expression"]
7246+
}
7247+
],
7248+
"description": "How often the windowed automation runs: at a fixed interval or on a cron schedule"
7249+
},
7250+
"evaluation_delay_seconds": {
7251+
"type": "integer",
7252+
"minimum": 0,
7253+
"maximum": 2592000,
7254+
"description": "How far behind the present each evaluation window ends"
7255+
}
7256+
},
7257+
"required": [
7258+
"window_seconds",
7259+
"schedule",
7260+
"evaluation_delay_seconds"
7261+
]
7262+
},
7263+
"actions": {
7264+
"type": "array",
7265+
"items": {
7266+
"oneOf": [
7267+
{
7268+
"type": "object",
7269+
"properties": {
7270+
"type": {
7271+
"type": "string",
7272+
"enum": ["webhook"],
7273+
"description": "The type of action to take"
7274+
},
7275+
"url": {
7276+
"type": "string",
7277+
"description": "The webhook URL to send the request to"
7278+
}
7279+
},
7280+
"required": ["type", "url"]
7281+
},
7282+
{
7283+
"type": "object",
7284+
"properties": {
7285+
"type": {
7286+
"type": "string",
7287+
"enum": ["slack"],
7288+
"description": "The type of action to take"
7289+
},
7290+
"workspace_id": {
7291+
"type": "string",
7292+
"description": "The Slack workspace ID to post to"
7293+
},
7294+
"channel": {
7295+
"type": "string",
7296+
"description": "The Slack channel ID to post to"
7297+
},
7298+
"message_template": {
7299+
"type": "string",
7300+
"description": "Custom message template for the alert"
7301+
}
7302+
},
7303+
"required": ["type", "workspace_id", "channel"]
7304+
}
7305+
],
7306+
"description": "A delivery action available to an automation"
7307+
},
7308+
"minItems": 1,
7309+
"maxItems": 20,
7310+
"description": "The delivery actions to run on each schedule or threshold lifecycle transition"
7311+
}
7312+
},
7313+
"required": ["event_type", "window", "actions"]
70937314
}
70947315
},
70957316
"parameters": {}

‎js/src/generated_types.ts‎

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Auto-generated file (content hash ecb294cff7f76552) -- do not modify
1+
// Auto-generated file (content hash b5293fdfa9d04ebc) -- do not modify
22

33
import { z } from "zod/v3";
44

@@ -1630,6 +1630,65 @@ export const Project = z.object({
16301630
settings: ProjectSettings.optional(),
16311631
});
16321632
export type ProjectType = z.infer<typeof Project>;
1633+
export const WindowedAutomationConfig = z.object({
1634+
event_type: z.literal("windowed"),
1635+
status: AutomationStatus.optional(),
1636+
threshold: z
1637+
.object({
1638+
calculation: z.object({
1639+
type: z.literal("btql"),
1640+
btql_query: z.string().min(1),
1641+
output: z.object({
1642+
type: z.literal("scalar"),
1643+
value_column: z.string().min(1),
1644+
}),
1645+
}),
1646+
policy: z.object({
1647+
condition: z.object({
1648+
type: z.literal("threshold"),
1649+
operator: z.enum(["lt", "lte", "gt", "gte", "eq", "neq"]),
1650+
threshold: z.number(),
1651+
}),
1652+
pending_seconds: z.number().int().gte(0).lte(2592000),
1653+
no_data_behavior: z.enum(["keep_last", "resolve", "alert"]),
1654+
renotify_interval_seconds: z.union([z.number(), z.null()]).optional(),
1655+
notify_on_recovery: z.boolean().optional().default(true),
1656+
}),
1657+
})
1658+
.optional(),
1659+
window: z.object({
1660+
window_seconds: z.number().int().gte(1).lte(2592000),
1661+
schedule: z.union([
1662+
z.object({
1663+
type: z.literal("interval"),
1664+
evaluation_interval_seconds: z.number().int().gte(1).lte(2592000),
1665+
}),
1666+
z.object({
1667+
type: z.literal("cron"),
1668+
cron_expression: z.string().min(1),
1669+
timezone: z.union([z.string(), z.null()]).optional(),
1670+
}),
1671+
]),
1672+
evaluation_delay_seconds: z.number().int().gte(0).lte(2592000),
1673+
}),
1674+
actions: z
1675+
.array(
1676+
z.union([
1677+
z.object({ type: z.literal("webhook"), url: z.string() }),
1678+
z.object({
1679+
type: z.literal("slack"),
1680+
workspace_id: z.string(),
1681+
channel: z.string(),
1682+
message_template: z.string().optional(),
1683+
}),
1684+
]),
1685+
)
1686+
.min(1)
1687+
.max(20),
1688+
});
1689+
export type WindowedAutomationConfigType = z.infer<
1690+
typeof WindowedAutomationConfig
1691+
>;
16331692
export const TopicAutomationFacetModel = z.union([
16341693
z.enum(["brain-facet-latest", "brain-facet-1", "brain-facet-2"]),
16351694
z.null(),
@@ -1776,6 +1835,7 @@ export const ProjectAutomation = z.object({
17761835
}),
17771836
]),
17781837
}),
1838+
WindowedAutomationConfig,
17791839
TopicAutomationConfig,
17801840
TopicDigestAutomationConfig,
17811841
]),

0 commit comments

Comments
 (0)