@marinoscar/platform-contract 0.1.0-next.19 → 0.1.0-next.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +4 -0
- package/dist/cjs/alerts/constants.d.ts +195 -0
- package/dist/cjs/alerts/constants.d.ts.map +1 -0
- package/dist/cjs/alerts/constants.js +165 -0
- package/dist/cjs/alerts/constants.js.map +1 -0
- package/dist/cjs/alerts/enum.d.ts +5 -0
- package/dist/cjs/alerts/enum.d.ts.map +1 -0
- package/dist/cjs/alerts/enum.js +9 -0
- package/dist/cjs/alerts/enum.js.map +1 -0
- package/dist/cjs/alerts/index.d.ts +5 -0
- package/dist/cjs/alerts/index.d.ts.map +1 -0
- package/dist/cjs/alerts/index.js +68 -0
- package/dist/cjs/alerts/index.js.map +1 -0
- package/dist/cjs/alerts/schemas.d.ts +351 -0
- package/dist/cjs/alerts/schemas.d.ts.map +1 -0
- package/dist/cjs/alerts/schemas.js +432 -0
- package/dist/cjs/alerts/schemas.js.map +1 -0
- package/dist/cjs/nodes/admin-schemas.d.ts +85 -1
- package/dist/cjs/nodes/admin-schemas.d.ts.map +1 -1
- package/dist/cjs/nodes/admin-schemas.js +55 -1
- package/dist/cjs/nodes/admin-schemas.js.map +1 -1
- package/dist/cjs/nodes/constants.d.ts +12 -0
- package/dist/cjs/nodes/constants.d.ts.map +1 -1
- package/dist/cjs/nodes/constants.js +13 -1
- package/dist/cjs/nodes/constants.js.map +1 -1
- package/dist/cjs/nodes/index.d.ts +5 -5
- package/dist/cjs/nodes/index.d.ts.map +1 -1
- package/dist/cjs/nodes/index.js +14 -1
- package/dist/cjs/nodes/index.js.map +1 -1
- package/dist/cjs/nodes/schemas.d.ts +178 -0
- package/dist/cjs/nodes/schemas.d.ts.map +1 -1
- package/dist/cjs/nodes/schemas.js +149 -1
- package/dist/cjs/nodes/schemas.js.map +1 -1
- package/dist/cjs/telemetry/constants.d.ts.map +1 -1
- package/dist/cjs/telemetry/constants.js +6 -0
- package/dist/cjs/telemetry/constants.js.map +1 -1
- package/dist/cjs/telemetry/dashboard.d.ts +5 -5
- package/dist/cjs/telemetry/presentation.d.ts +5 -5
- package/dist/cjs/telemetry/stack.d.ts +2 -2
- package/dist/cjs/webhooks/constants.d.ts +154 -0
- package/dist/cjs/webhooks/constants.d.ts.map +1 -0
- package/dist/cjs/webhooks/constants.js +136 -0
- package/dist/cjs/webhooks/constants.js.map +1 -0
- package/dist/cjs/webhooks/enum.d.ts +5 -0
- package/dist/cjs/webhooks/enum.d.ts.map +1 -0
- package/dist/cjs/webhooks/enum.js +9 -0
- package/dist/cjs/webhooks/enum.js.map +1 -0
- package/dist/cjs/webhooks/index.d.ts +7 -0
- package/dist/cjs/webhooks/index.d.ts.map +1 -0
- package/dist/cjs/webhooks/index.js +48 -0
- package/dist/cjs/webhooks/index.js.map +1 -0
- package/dist/cjs/webhooks/schemas.d.ts +288 -0
- package/dist/cjs/webhooks/schemas.d.ts.map +1 -0
- package/dist/cjs/webhooks/schemas.js +295 -0
- package/dist/cjs/webhooks/schemas.js.map +1 -0
- package/dist/cjs/webhooks/signature.d.ts +54 -0
- package/dist/cjs/webhooks/signature.d.ts.map +1 -0
- package/dist/cjs/webhooks/signature.js +97 -0
- package/dist/cjs/webhooks/signature.js.map +1 -0
- package/dist/esm/alerts/constants.d.ts +195 -0
- package/dist/esm/alerts/constants.d.ts.map +1 -0
- package/dist/esm/alerts/constants.js +162 -0
- package/dist/esm/alerts/constants.js.map +1 -0
- package/dist/esm/alerts/enum.d.ts +5 -0
- package/dist/esm/alerts/enum.d.ts.map +1 -0
- package/dist/esm/alerts/enum.js +6 -0
- package/dist/esm/alerts/enum.js.map +1 -0
- package/dist/esm/alerts/index.d.ts +5 -0
- package/dist/esm/alerts/index.d.ts.map +1 -0
- package/dist/esm/alerts/index.js +8 -0
- package/dist/esm/alerts/index.js.map +1 -0
- package/dist/esm/alerts/schemas.d.ts +351 -0
- package/dist/esm/alerts/schemas.d.ts.map +1 -0
- package/dist/esm/alerts/schemas.js +429 -0
- package/dist/esm/alerts/schemas.js.map +1 -0
- package/dist/esm/nodes/admin-schemas.d.ts +85 -1
- package/dist/esm/nodes/admin-schemas.d.ts.map +1 -1
- package/dist/esm/nodes/admin-schemas.js +55 -1
- package/dist/esm/nodes/admin-schemas.js.map +1 -1
- package/dist/esm/nodes/constants.d.ts +12 -0
- package/dist/esm/nodes/constants.d.ts.map +1 -1
- package/dist/esm/nodes/constants.js +12 -0
- package/dist/esm/nodes/constants.js.map +1 -1
- package/dist/esm/nodes/index.d.ts +5 -5
- package/dist/esm/nodes/index.d.ts.map +1 -1
- package/dist/esm/nodes/index.js +3 -3
- package/dist/esm/nodes/index.js.map +1 -1
- package/dist/esm/nodes/schemas.d.ts +178 -0
- package/dist/esm/nodes/schemas.d.ts.map +1 -1
- package/dist/esm/nodes/schemas.js +149 -1
- package/dist/esm/nodes/schemas.js.map +1 -1
- package/dist/esm/telemetry/constants.d.ts.map +1 -1
- package/dist/esm/telemetry/constants.js +6 -0
- package/dist/esm/telemetry/constants.js.map +1 -1
- package/dist/esm/telemetry/dashboard.d.ts +5 -5
- package/dist/esm/telemetry/presentation.d.ts +5 -5
- package/dist/esm/telemetry/stack.d.ts +2 -2
- package/dist/esm/webhooks/constants.d.ts +154 -0
- package/dist/esm/webhooks/constants.d.ts.map +1 -0
- package/dist/esm/webhooks/constants.js +133 -0
- package/dist/esm/webhooks/constants.js.map +1 -0
- package/dist/esm/webhooks/enum.d.ts +5 -0
- package/dist/esm/webhooks/enum.d.ts.map +1 -0
- package/dist/esm/webhooks/enum.js +6 -0
- package/dist/esm/webhooks/enum.js.map +1 -0
- package/dist/esm/webhooks/index.d.ts +7 -0
- package/dist/esm/webhooks/index.d.ts.map +1 -0
- package/dist/esm/webhooks/index.js +8 -0
- package/dist/esm/webhooks/index.js.map +1 -0
- package/dist/esm/webhooks/schemas.d.ts +288 -0
- package/dist/esm/webhooks/schemas.d.ts.map +1 -0
- package/dist/esm/webhooks/schemas.js +292 -0
- package/dist/esm/webhooks/schemas.js.map +1 -0
- package/dist/esm/webhooks/signature.d.ts +54 -0
- package/dist/esm/webhooks/signature.d.ts.map +1 -0
- package/dist/esm/webhooks/signature.js +93 -0
- package/dist/esm/webhooks/signature.js.map +1 -0
- package/package.json +21 -1
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// The alerts slice's wire shapes (issue #1047)
|
|
4
|
+
// =============================================================================
|
|
5
|
+
//
|
|
6
|
+
// Rules, the per-kind configs of the built-in kinds, incidents, the dry-run
|
|
7
|
+
// response, the kind catalog, the dashboard summary and the webhook payload.
|
|
8
|
+
// Dates are ISO 8601 strings. A rule's `config` is validated by its KIND's own
|
|
9
|
+
// schema in the API (the kind id is an open string); the schemas here are the
|
|
10
|
+
// built-in kinds' and what the generic routes accept.
|
|
11
|
+
// =============================================================================
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.alertWebhookDataSchema = exports.alertSummarySchema = exports.alertKindListSchema = exports.alertKindSchema = exports.alertRuleTestResponseSchema = exports.alertObservationSchema = exports.alertIncidentListSchema = exports.alertIncidentListQuerySchema = exports.alertIncidentSchema = exports.alertRuleListSchema = exports.alertRuleListQuerySchema = exports.alertRuleKeySchema = exports.updateAlertRuleSchema = exports.createAlertRuleSchema = exports.alertRuleSchema = exports.emptyAlertConfigSchema = exports.verdictConfigSchema = exports.nodeEventConfigSchema = exports.alertEventAttrsSchema = exports.metricThresholdConfigSchema = exports.alertMetricFilterSchema = exports.alertKindIdSchema = exports.alertAggregationSchema = exports.alertComparatorSchema = exports.alertIncidentStateSchema = exports.alertSeveritySchema = void 0;
|
|
14
|
+
const zod_1 = require("zod");
|
|
15
|
+
const enum_js_1 = require("./enum.js");
|
|
16
|
+
const constants_js_1 = require("./constants.js");
|
|
17
|
+
const isoDate = zod_1.z.string();
|
|
18
|
+
/** One of `info`, `warning`, `critical`. @stability experimental */
|
|
19
|
+
exports.alertSeveritySchema = (0, enum_js_1.wireEnum)(constants_js_1.ALERT_SEVERITIES);
|
|
20
|
+
/** One of `pending`, `firing`, `resolved`. @stability experimental */
|
|
21
|
+
exports.alertIncidentStateSchema = (0, enum_js_1.wireEnum)(constants_js_1.ALERT_INCIDENT_STATES);
|
|
22
|
+
/** One comparator. @stability experimental */
|
|
23
|
+
exports.alertComparatorSchema = (0, enum_js_1.wireEnum)(constants_js_1.ALERT_COMPARATORS);
|
|
24
|
+
/** One aggregation. @stability experimental */
|
|
25
|
+
exports.alertAggregationSchema = (0, enum_js_1.wireEnum)(constants_js_1.ALERT_AGGREGATIONS);
|
|
26
|
+
/** A rule kind id: an open vocabulary, lower snake case. @stability experimental */
|
|
27
|
+
exports.alertKindIdSchema = zod_1.z.string().max(constants_js_1.ALERT_KIND_MAX).regex(constants_js_1.ALERT_KIND_PATTERN);
|
|
28
|
+
// ---- per-kind configs -----------------------------------------------------
|
|
29
|
+
/**
|
|
30
|
+
* One attribute filter of a `metric_threshold` rule.
|
|
31
|
+
*
|
|
32
|
+
* @stability experimental
|
|
33
|
+
*/
|
|
34
|
+
exports.alertMetricFilterSchema = zod_1.z
|
|
35
|
+
.object({
|
|
36
|
+
/** The attribute (column) to match. */
|
|
37
|
+
attr: zod_1.z.string().regex(constants_js_1.ALERT_ATTRIBUTE_PATTERN),
|
|
38
|
+
/** `eq` or `neq`. */
|
|
39
|
+
op: (0, enum_js_1.wireEnum)(constants_js_1.ALERT_FILTER_OPS),
|
|
40
|
+
/** The value (the observed number, or the filter value). */
|
|
41
|
+
value: zod_1.z.string().max(200),
|
|
42
|
+
})
|
|
43
|
+
.strict();
|
|
44
|
+
/**
|
|
45
|
+
* `metric_threshold`: an aggregate of one metric over a window compared to a
|
|
46
|
+
* threshold, per group. `metric` is the dotted metric name (`app.nodes.host.cpu.utilization`)
|
|
47
|
+
* or its table name; the API resolves it against the store's schema.
|
|
48
|
+
*
|
|
49
|
+
* @stability experimental
|
|
50
|
+
*/
|
|
51
|
+
exports.metricThresholdConfigSchema = zod_1.z
|
|
52
|
+
.object({
|
|
53
|
+
/** The dotted metric name or its table name. */
|
|
54
|
+
metric: zod_1.z.string().regex(constants_js_1.ALERT_METRIC_NAME_PATTERN),
|
|
55
|
+
/** How the points in the window are reduced to one number. */
|
|
56
|
+
aggregation: exports.alertAggregationSchema,
|
|
57
|
+
/** The window, in seconds. */
|
|
58
|
+
windowSeconds: zod_1.z.number().int().min(constants_js_1.ALERT_WINDOW_SECONDS_MIN).max(constants_js_1.ALERT_WINDOW_SECONDS_MAX),
|
|
59
|
+
/** How the value is compared to the threshold. */
|
|
60
|
+
comparator: exports.alertComparatorSchema,
|
|
61
|
+
/** The threshold the value is compared with. */
|
|
62
|
+
threshold: zod_1.z.number().finite(),
|
|
63
|
+
/** Attribute columns to group by; one incident per group. */
|
|
64
|
+
groupBy: zod_1.z.array(zod_1.z.string().regex(constants_js_1.ALERT_ATTRIBUTE_PATTERN)).max(constants_js_1.ALERT_GROUP_BY_MAX).optional(),
|
|
65
|
+
/** Attribute filters applied before aggregating. */
|
|
66
|
+
filters: zod_1.z.array(exports.alertMetricFilterSchema).max(constants_js_1.ALERT_FILTERS_MAX).optional(),
|
|
67
|
+
})
|
|
68
|
+
.strict();
|
|
69
|
+
/**
|
|
70
|
+
* An attribute match of a `node_event` rule: every entry must equal the
|
|
71
|
+
* event's attribute (compared as text).
|
|
72
|
+
*
|
|
73
|
+
* @stability experimental
|
|
74
|
+
*/
|
|
75
|
+
exports.alertEventAttrsSchema = zod_1.z
|
|
76
|
+
.record(zod_1.z.string().regex(constants_js_1.ALERT_ATTRIBUTE_PATTERN), zod_1.z.union([zod_1.z.string().max(200), zod_1.z.number(), zod_1.z.boolean()]))
|
|
77
|
+
.refine((attrs) => Object.keys(attrs).length <= 5, 'At most 5 attributes');
|
|
78
|
+
/**
|
|
79
|
+
* `node_event`: a worker node reported a matching event. `eventTypes` are node
|
|
80
|
+
* event types or a prefix such as `power.*`. The incident resolves when a
|
|
81
|
+
* `recovery` event arrives for the same node, or after `resolveAfterSeconds`.
|
|
82
|
+
*
|
|
83
|
+
* @stability experimental
|
|
84
|
+
*/
|
|
85
|
+
exports.nodeEventConfigSchema = zod_1.z
|
|
86
|
+
.object({
|
|
87
|
+
/** Node event types or prefixes such as `power.*`. */
|
|
88
|
+
eventTypes: zod_1.z.array(zod_1.z.string().min(1).max(64)).min(1).max(20),
|
|
89
|
+
/** The lowest event severity that counts. */
|
|
90
|
+
minSeverity: exports.alertSeveritySchema.optional(),
|
|
91
|
+
/** Only these nodes. */
|
|
92
|
+
nodeIds: zod_1.z.array(zod_1.z.string().max(64)).max(100).optional(),
|
|
93
|
+
/** Attributes the event must carry, compared as text. */
|
|
94
|
+
attrs: exports.alertEventAttrsSchema.optional(),
|
|
95
|
+
/** The events that clear the incident. */
|
|
96
|
+
recovery: zod_1.z
|
|
97
|
+
.object({
|
|
98
|
+
/** Node event types or prefixes such as `power.*`. */
|
|
99
|
+
eventTypes: zod_1.z.array(zod_1.z.string().min(1).max(64)).min(1).max(20),
|
|
100
|
+
/** Attributes the event must carry, compared as text. */
|
|
101
|
+
attrs: exports.alertEventAttrsSchema.optional(),
|
|
102
|
+
})
|
|
103
|
+
.strict()
|
|
104
|
+
.optional(),
|
|
105
|
+
/** Seconds after which the incident clears without a recovery event. */
|
|
106
|
+
resolveAfterSeconds: zod_1.z.number().int().min(60).max(604_800).default(constants_js_1.ALERT_NODE_EVENT_RESOLVE_AFTER_DEFAULT),
|
|
107
|
+
})
|
|
108
|
+
.strict();
|
|
109
|
+
/**
|
|
110
|
+
* `verdict`: the telemetry dashboard verdict is at or past `minLevel`.
|
|
111
|
+
*
|
|
112
|
+
* @stability experimental
|
|
113
|
+
*/
|
|
114
|
+
exports.verdictConfigSchema = zod_1.z
|
|
115
|
+
.object({
|
|
116
|
+
/** The verdict level at or past which the rule breaches. */
|
|
117
|
+
minLevel: (0, enum_js_1.wireEnum)(['degraded', 'critical']),
|
|
118
|
+
})
|
|
119
|
+
.strict();
|
|
120
|
+
/**
|
|
121
|
+
* `node_offline` and `telemetry_unavailable` take no configuration.
|
|
122
|
+
*
|
|
123
|
+
* @stability experimental
|
|
124
|
+
*/
|
|
125
|
+
exports.emptyAlertConfigSchema = zod_1.z.object({}).strict();
|
|
126
|
+
// ---- rules ------------------------------------------------------------------
|
|
127
|
+
const notifyChannelsSchema = zod_1.z
|
|
128
|
+
.array(zod_1.z.string().min(1).max(32))
|
|
129
|
+
.max(constants_js_1.ALERT_NOTIFY_CHANNELS_MAX)
|
|
130
|
+
.refine((ids) => new Set(ids).size === ids.length, 'Channels must be unique');
|
|
131
|
+
/**
|
|
132
|
+
* An alert rule as the API returns it.
|
|
133
|
+
*
|
|
134
|
+
* @stability experimental
|
|
135
|
+
*/
|
|
136
|
+
exports.alertRuleSchema = zod_1.z.object({
|
|
137
|
+
/** The id. */
|
|
138
|
+
id: zod_1.z.string(),
|
|
139
|
+
/** The stable key of a seeded starter rule, else `null`. */
|
|
140
|
+
key: zod_1.z.string().nullable(),
|
|
141
|
+
/** `true` for a seeded starter rule (it may be edited and disabled, not deleted). */
|
|
142
|
+
starter: zod_1.z.boolean(),
|
|
143
|
+
/** The display name. */
|
|
144
|
+
name: zod_1.z.string(),
|
|
145
|
+
/** Free text, or `null`. */
|
|
146
|
+
description: zod_1.z.string().nullable(),
|
|
147
|
+
/** Whether the evaluator runs the rule. */
|
|
148
|
+
enabled: zod_1.z.boolean(),
|
|
149
|
+
/** The rule kind id. */
|
|
150
|
+
kind: zod_1.z.string(),
|
|
151
|
+
/** How serious the incidents are. */
|
|
152
|
+
severity: exports.alertSeveritySchema,
|
|
153
|
+
/** The kind-specific configuration. */
|
|
154
|
+
config: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
155
|
+
/** Seconds the condition must hold before the rule fires. */
|
|
156
|
+
forSeconds: zod_1.z.number().int().min(0),
|
|
157
|
+
/** Seconds after a resolve in which a re-fire is not notified. */
|
|
158
|
+
cooldownSeconds: zod_1.z.number().int().min(0),
|
|
159
|
+
/** Notification channel ids the alert is sent over; empty means every channel the recipient has on. */
|
|
160
|
+
notifyChannels: zod_1.z.array(zod_1.z.string()),
|
|
161
|
+
/** Also emit the `alerts.alert.*` webhook events. */
|
|
162
|
+
webhook: zod_1.z.boolean(),
|
|
163
|
+
/** The administrator who created the rule, or `null`. */
|
|
164
|
+
createdById: zod_1.z.string().nullable(),
|
|
165
|
+
/** When it was created. */
|
|
166
|
+
createdAt: isoDate,
|
|
167
|
+
/** When it was last updated. */
|
|
168
|
+
updatedAt: isoDate,
|
|
169
|
+
/** When the rule was last evaluated, or `null`. */
|
|
170
|
+
lastEvaluatedAt: isoDate.nullable(),
|
|
171
|
+
/** The last evaluation error (kept until the next clean evaluation), else `null`. */
|
|
172
|
+
lastError: zod_1.z.string().nullable(),
|
|
173
|
+
/** Incidents currently `pending` or `firing`. */
|
|
174
|
+
openIncidents: zod_1.z.number().int().min(0),
|
|
175
|
+
});
|
|
176
|
+
/**
|
|
177
|
+
* `POST /api/admin/alerts/rules` body. `config` is validated against the
|
|
178
|
+
* kind's schema; a rule is created disabled unless `enabled` says otherwise.
|
|
179
|
+
*
|
|
180
|
+
* @stability experimental
|
|
181
|
+
*/
|
|
182
|
+
exports.createAlertRuleSchema = zod_1.z.object({
|
|
183
|
+
/** The display name. */
|
|
184
|
+
name: zod_1.z.string().trim().min(1).max(constants_js_1.ALERT_NAME_MAX),
|
|
185
|
+
/** Free text, or `null`. */
|
|
186
|
+
description: zod_1.z.string().trim().max(constants_js_1.ALERT_DESCRIPTION_MAX).nullable().optional(),
|
|
187
|
+
/** Whether the evaluator runs the rule. */
|
|
188
|
+
enabled: zod_1.z.boolean().default(false),
|
|
189
|
+
/** The rule kind id. */
|
|
190
|
+
kind: exports.alertKindIdSchema,
|
|
191
|
+
/** How serious the incidents are. */
|
|
192
|
+
severity: exports.alertSeveritySchema,
|
|
193
|
+
/** The kind-specific configuration. */
|
|
194
|
+
config: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).default({}),
|
|
195
|
+
/** Seconds the condition must hold before the rule fires. */
|
|
196
|
+
forSeconds: zod_1.z.number().int().min(0).max(constants_js_1.ALERT_FOR_SECONDS_MAX).default(0),
|
|
197
|
+
/** Seconds after a resolve in which a re-fire is not notified. */
|
|
198
|
+
cooldownSeconds: zod_1.z.number().int().min(0).max(constants_js_1.ALERT_COOLDOWN_SECONDS_MAX).default(constants_js_1.ALERT_COOLDOWN_SECONDS_DEFAULT),
|
|
199
|
+
/** Notification channel ids; empty means no restriction. */
|
|
200
|
+
notifyChannels: notifyChannelsSchema.default([]),
|
|
201
|
+
/** Also emit the `alerts.alert.*` webhook events. */
|
|
202
|
+
webhook: zod_1.z.boolean().default(true),
|
|
203
|
+
});
|
|
204
|
+
/**
|
|
205
|
+
* `PATCH /api/admin/alerts/rules/:id` body. The kind cannot change; a new
|
|
206
|
+
* `config` is validated against the rule's kind.
|
|
207
|
+
*
|
|
208
|
+
* @stability experimental
|
|
209
|
+
*/
|
|
210
|
+
exports.updateAlertRuleSchema = zod_1.z
|
|
211
|
+
.object({
|
|
212
|
+
/** The display name. */
|
|
213
|
+
name: zod_1.z.string().trim().min(1).max(constants_js_1.ALERT_NAME_MAX),
|
|
214
|
+
/** Free text, or `null`. */
|
|
215
|
+
description: zod_1.z.string().trim().max(constants_js_1.ALERT_DESCRIPTION_MAX).nullable(),
|
|
216
|
+
/** Whether the evaluator runs the rule. */
|
|
217
|
+
enabled: zod_1.z.boolean(),
|
|
218
|
+
/** How serious the incidents are. */
|
|
219
|
+
severity: exports.alertSeveritySchema,
|
|
220
|
+
/** The kind-specific configuration. */
|
|
221
|
+
config: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
222
|
+
/** Seconds the condition must hold before the rule fires. */
|
|
223
|
+
forSeconds: zod_1.z.number().int().min(0).max(constants_js_1.ALERT_FOR_SECONDS_MAX),
|
|
224
|
+
/** Seconds after a resolve in which a re-fire is not notified. */
|
|
225
|
+
cooldownSeconds: zod_1.z.number().int().min(0).max(constants_js_1.ALERT_COOLDOWN_SECONDS_MAX),
|
|
226
|
+
/** Notification channel ids; empty means no restriction. */
|
|
227
|
+
notifyChannels: notifyChannelsSchema,
|
|
228
|
+
/** Also emit the `alerts.alert.*` webhook events. */
|
|
229
|
+
webhook: zod_1.z.boolean(),
|
|
230
|
+
})
|
|
231
|
+
.partial()
|
|
232
|
+
.strict()
|
|
233
|
+
.refine((body) => Object.keys(body).length > 0, 'Send at least one field');
|
|
234
|
+
/** A rule key, for a seeded starter rule. @stability experimental */
|
|
235
|
+
exports.alertRuleKeySchema = zod_1.z.string().max(constants_js_1.ALERT_KEY_MAX).regex(constants_js_1.ALERT_KEY_PATTERN);
|
|
236
|
+
/**
|
|
237
|
+
* `GET /api/admin/alerts/rules` query.
|
|
238
|
+
*
|
|
239
|
+
* @stability experimental
|
|
240
|
+
*/
|
|
241
|
+
exports.alertRuleListQuerySchema = zod_1.z.object({
|
|
242
|
+
/** The rule kind id. */
|
|
243
|
+
kind: exports.alertKindIdSchema.optional(),
|
|
244
|
+
/** How serious the incidents are. */
|
|
245
|
+
severity: exports.alertSeveritySchema.optional(),
|
|
246
|
+
/** Whether the evaluator runs the rule. */
|
|
247
|
+
enabled: (0, enum_js_1.wireEnum)(['true', 'false'])
|
|
248
|
+
.transform((value) => value === 'true')
|
|
249
|
+
.optional(),
|
|
250
|
+
});
|
|
251
|
+
/** `GET /api/admin/alerts/rules` response data. @stability experimental */
|
|
252
|
+
exports.alertRuleListSchema = zod_1.z.array(exports.alertRuleSchema);
|
|
253
|
+
// ---- incidents ----------------------------------------------------------------
|
|
254
|
+
/**
|
|
255
|
+
* One incident: one rule breached for one label set.
|
|
256
|
+
*
|
|
257
|
+
* @stability experimental
|
|
258
|
+
*/
|
|
259
|
+
exports.alertIncidentSchema = zod_1.z.object({
|
|
260
|
+
/** The id. */
|
|
261
|
+
id: zod_1.z.string(),
|
|
262
|
+
/** The rule. */
|
|
263
|
+
ruleId: zod_1.z.string(),
|
|
264
|
+
/** The rule name. */
|
|
265
|
+
ruleName: zod_1.z.string(),
|
|
266
|
+
/** The rule kind. */
|
|
267
|
+
ruleKind: zod_1.z.string(),
|
|
268
|
+
/** The label set that identifies the incident within its rule. */
|
|
269
|
+
labels: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
|
|
270
|
+
/** `pending`, `firing` or `resolved`. */
|
|
271
|
+
state: exports.alertIncidentStateSchema,
|
|
272
|
+
/** How serious the incidents are. */
|
|
273
|
+
severity: exports.alertSeveritySchema,
|
|
274
|
+
/** When the condition first held, or `null`. */
|
|
275
|
+
pendingSince: isoDate.nullable(),
|
|
276
|
+
/** When it fired, or `null`. */
|
|
277
|
+
firedAt: isoDate.nullable(),
|
|
278
|
+
/** When it resolved, or `null`. */
|
|
279
|
+
resolvedAt: isoDate.nullable(),
|
|
280
|
+
/** The last observed value, or `null`. */
|
|
281
|
+
lastValue: zod_1.z.number().nullable(),
|
|
282
|
+
/** The last evaluation that saw it breached. */
|
|
283
|
+
lastSeenAt: isoDate,
|
|
284
|
+
/** One human sentence. */
|
|
285
|
+
summary: zod_1.z.string().max(constants_js_1.ALERT_SUMMARY_MAX),
|
|
286
|
+
/** When an administrator acknowledged it, or `null`. */
|
|
287
|
+
acknowledgedAt: isoDate.nullable(),
|
|
288
|
+
/** Who acknowledged it, or `null`. */
|
|
289
|
+
acknowledgedById: zod_1.z.string().nullable(),
|
|
290
|
+
/** When it was created. */
|
|
291
|
+
createdAt: isoDate,
|
|
292
|
+
});
|
|
293
|
+
/**
|
|
294
|
+
* `GET /api/admin/alerts/incidents` query.
|
|
295
|
+
*
|
|
296
|
+
* @stability experimental
|
|
297
|
+
*/
|
|
298
|
+
exports.alertIncidentListQuerySchema = zod_1.z.object({
|
|
299
|
+
/** `pending`, `firing` or `resolved`. */
|
|
300
|
+
state: exports.alertIncidentStateSchema.optional(),
|
|
301
|
+
/** How serious the incidents are. */
|
|
302
|
+
severity: exports.alertSeveritySchema.optional(),
|
|
303
|
+
/** The rule. */
|
|
304
|
+
ruleId: zod_1.z.uuid().optional(),
|
|
305
|
+
/** The 1-based page. */
|
|
306
|
+
page: zod_1.z.coerce.number().int().min(1).default(1),
|
|
307
|
+
/** Rows per page. */
|
|
308
|
+
pageSize: zod_1.z.coerce.number().int().min(1).max(constants_js_1.ALERT_PAGE_SIZE_MAX).default(constants_js_1.ALERT_PAGE_SIZE_DEFAULT),
|
|
309
|
+
});
|
|
310
|
+
/** `GET /api/admin/alerts/incidents` response data. @stability experimental */
|
|
311
|
+
exports.alertIncidentListSchema = zod_1.z.object({
|
|
312
|
+
/** The rows of this page. */
|
|
313
|
+
items: zod_1.z.array(exports.alertIncidentSchema),
|
|
314
|
+
/** Rows across all pages. */
|
|
315
|
+
total: zod_1.z.number().int().min(0),
|
|
316
|
+
/** The 1-based page. */
|
|
317
|
+
page: zod_1.z.number().int().min(1),
|
|
318
|
+
/** Rows per page. */
|
|
319
|
+
pageSize: zod_1.z.number().int().min(1),
|
|
320
|
+
/** Pages across all rows. */
|
|
321
|
+
totalPages: zod_1.z.number().int().min(0),
|
|
322
|
+
});
|
|
323
|
+
// ---- dry run, kinds, summary ----------------------------------------------------
|
|
324
|
+
/**
|
|
325
|
+
* One observation a kind produced: a label set, its value and whether it
|
|
326
|
+
* breaches the rule.
|
|
327
|
+
*
|
|
328
|
+
* @stability experimental
|
|
329
|
+
*/
|
|
330
|
+
exports.alertObservationSchema = zod_1.z.object({
|
|
331
|
+
/** The label set that identifies the incident within its rule. */
|
|
332
|
+
labels: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
|
|
333
|
+
/** The value (the observed number, or the filter value). */
|
|
334
|
+
value: zod_1.z.number().nullable(),
|
|
335
|
+
/** Whether the observation breaches the rule. */
|
|
336
|
+
breached: zod_1.z.boolean(),
|
|
337
|
+
/** One human sentence. */
|
|
338
|
+
summary: zod_1.z.string().max(constants_js_1.ALERT_SUMMARY_MAX),
|
|
339
|
+
});
|
|
340
|
+
/**
|
|
341
|
+
* `POST /api/admin/alerts/rules/:id/test` response: the rule evaluated now.
|
|
342
|
+
* Nothing is stored and nothing is dispatched.
|
|
343
|
+
*
|
|
344
|
+
* @stability experimental
|
|
345
|
+
*/
|
|
346
|
+
exports.alertRuleTestResponseSchema = zod_1.z.object({
|
|
347
|
+
/** The rule. */
|
|
348
|
+
ruleId: zod_1.z.string(),
|
|
349
|
+
/** The rule kind id. */
|
|
350
|
+
kind: zod_1.z.string(),
|
|
351
|
+
/** When the evaluation ran. */
|
|
352
|
+
evaluatedAt: isoDate,
|
|
353
|
+
/** How long it took, in milliseconds. */
|
|
354
|
+
durationMs: zod_1.z.number().int().min(0),
|
|
355
|
+
/** What the kind observed, per label set. */
|
|
356
|
+
observations: zod_1.z.array(exports.alertObservationSchema),
|
|
357
|
+
/** Why the evaluation failed (for instance the store is unreachable), else `null`. */
|
|
358
|
+
error: zod_1.z.string().nullable(),
|
|
359
|
+
});
|
|
360
|
+
/**
|
|
361
|
+
* One registered rule kind and the JSON Schema of its config.
|
|
362
|
+
*
|
|
363
|
+
* @stability experimental
|
|
364
|
+
*/
|
|
365
|
+
exports.alertKindSchema = zod_1.z.object({
|
|
366
|
+
/** The id. */
|
|
367
|
+
id: zod_1.z.string(),
|
|
368
|
+
/** Short display label. */
|
|
369
|
+
label: zod_1.z.string(),
|
|
370
|
+
/** Free text, or `null`. */
|
|
371
|
+
description: zod_1.z.string(),
|
|
372
|
+
/** The kind reacts to events (it is also evaluated when one arrives). */
|
|
373
|
+
eventDriven: zod_1.z.boolean(),
|
|
374
|
+
/** One of the kinds the slice ships. */
|
|
375
|
+
builtin: zod_1.z.boolean(),
|
|
376
|
+
/** JSON Schema (draft 2020-12) of the kind's `config`. */
|
|
377
|
+
configSchema: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
378
|
+
});
|
|
379
|
+
/** `GET /api/admin/alerts/kinds` response data. @stability experimental */
|
|
380
|
+
exports.alertKindListSchema = zod_1.z.array(exports.alertKindSchema);
|
|
381
|
+
/**
|
|
382
|
+
* `GET /api/admin/alerts/summary` response: what the dashboard banner shows.
|
|
383
|
+
*
|
|
384
|
+
* @stability experimental
|
|
385
|
+
*/
|
|
386
|
+
exports.alertSummarySchema = zod_1.z.object({
|
|
387
|
+
/** Incidents firing now, by severity. */
|
|
388
|
+
firing: zod_1.z.object({
|
|
389
|
+
/** Critical incidents. */
|
|
390
|
+
critical: zod_1.z.number().int().min(0),
|
|
391
|
+
/** Warning incidents. */
|
|
392
|
+
warning: zod_1.z.number().int().min(0),
|
|
393
|
+
/** Info incidents. */
|
|
394
|
+
info: zod_1.z.number().int().min(0),
|
|
395
|
+
}),
|
|
396
|
+
/** Newest `lastEvaluatedAt` among the enabled rules, else `null`. */
|
|
397
|
+
lastEvaluatedAt: isoDate.nullable(),
|
|
398
|
+
});
|
|
399
|
+
/**
|
|
400
|
+
* The `data` of the `alerts.alert.fired` and `alerts.alert.resolved` webhook
|
|
401
|
+
* events.
|
|
402
|
+
*
|
|
403
|
+
* @stability experimental
|
|
404
|
+
*/
|
|
405
|
+
exports.alertWebhookDataSchema = zod_1.z.object({
|
|
406
|
+
/** The incident. */
|
|
407
|
+
incidentId: zod_1.z.string(),
|
|
408
|
+
/** The rule that produced it. */
|
|
409
|
+
rule: zod_1.z.object({
|
|
410
|
+
/** The id. */
|
|
411
|
+
id: zod_1.z.string(),
|
|
412
|
+
/** The stable key of a seeded starter rule, else `null`. */
|
|
413
|
+
key: zod_1.z.string().nullable(),
|
|
414
|
+
/** The display name. */
|
|
415
|
+
name: zod_1.z.string(),
|
|
416
|
+
/** The rule kind id. */
|
|
417
|
+
kind: zod_1.z.string(),
|
|
418
|
+
/** How serious the incidents are. */
|
|
419
|
+
severity: exports.alertSeveritySchema,
|
|
420
|
+
}),
|
|
421
|
+
/** The label set that identifies the incident within its rule. */
|
|
422
|
+
labels: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
|
|
423
|
+
/** The value (the observed number, or the filter value). */
|
|
424
|
+
value: zod_1.z.number().nullable(),
|
|
425
|
+
/** One human sentence. */
|
|
426
|
+
summary: zod_1.z.string(),
|
|
427
|
+
/** When it fired, or `null`. */
|
|
428
|
+
firedAt: isoDate.nullable(),
|
|
429
|
+
/** When it resolved, or `null`. */
|
|
430
|
+
resolvedAt: isoDate.nullable(),
|
|
431
|
+
});
|
|
432
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/alerts/schemas.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,gFAAgF;AAChF,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,sDAAsD;AACtD,gFAAgF;;;AAEhF,6BAAwB;AAExB,uCAAqC;AACrC,iDA0BwB;AAExB,MAAM,OAAO,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC;AAE3B,oEAAoE;AACvD,QAAA,mBAAmB,GAAG,IAAA,kBAAQ,EAAC,+BAAgB,CAAC,CAAC;AAE9D,sEAAsE;AACzD,QAAA,wBAAwB,GAAG,IAAA,kBAAQ,EAAC,oCAAqB,CAAC,CAAC;AAExE,8CAA8C;AACjC,QAAA,qBAAqB,GAAG,IAAA,kBAAQ,EAAC,gCAAiB,CAAC,CAAC;AAEjE,+CAA+C;AAClC,QAAA,sBAAsB,GAAG,IAAA,kBAAQ,EAAC,iCAAkB,CAAC,CAAC;AAEnE,oFAAoF;AACvE,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,6BAAc,CAAC,CAAC,KAAK,CAAC,iCAAkB,CAAC,CAAC;AAE1F,8EAA8E;AAE9E;;;;GAIG;AACU,QAAA,uBAAuB,GAAG,OAAC;KACrC,MAAM,CAAC;IACN,uCAAuC;IACvC,IAA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AAE,2BAAmB;KAC9B,CAAC;IACF,kEAAkE;IAClE,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC;IACxC,4DAA4D;IAC5D,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,0BAA0B;IAC1B,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,gCAAgC;IAChC,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE;IAC3B,mCAAmC;IACnC,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC"}
|
|
@@ -88,6 +88,26 @@ export declare const adminNodeSchema: z.ZodObject<{
|
|
|
88
88
|
nodeVersion: z.ZodOptional<z.ZodString>;
|
|
89
89
|
pgDumpVersion: z.ZodOptional<z.ZodString>;
|
|
90
90
|
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
91
|
+
host: z.ZodOptional<z.ZodObject<{
|
|
92
|
+
cpuPercent: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
cpuCount: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
loadAvg1: z.ZodOptional<z.ZodNumber>;
|
|
95
|
+
loadAvg5: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
loadAvg15: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
memTotalBytes: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
memFreeBytes: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
memAvailableBytes: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
osRelease: z.ZodOptional<z.ZodString>;
|
|
101
|
+
arch: z.ZodOptional<z.ZodString>;
|
|
102
|
+
uptimeSeconds: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
}, z.core.$strict>>;
|
|
104
|
+
power: z.ZodOptional<z.ZodObject<{
|
|
105
|
+
source: z.ZodEnum<import("./schemas.js").NodePowerSourceEnum>;
|
|
106
|
+
batteryPercent: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
charging: z.ZodOptional<z.ZodBoolean>;
|
|
108
|
+
timeRemainingSeconds: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
lowPowerMode: z.ZodOptional<z.ZodBoolean>;
|
|
110
|
+
}, z.core.$strict>>;
|
|
91
111
|
}, z.core.$strict>>;
|
|
92
112
|
lastVitalsAt: z.ZodNullable<z.ZodString>;
|
|
93
113
|
owner: z.ZodObject<{
|
|
@@ -103,6 +123,52 @@ export declare const adminNodeSchema: z.ZodObject<{
|
|
|
103
123
|
total: z.ZodNumber;
|
|
104
124
|
}, z.core.$strip>;
|
|
105
125
|
}, z.core.$strip>;
|
|
126
|
+
/**
|
|
127
|
+
* One stored node event as `GET /api/nodes/:id/events` returns it.
|
|
128
|
+
*
|
|
129
|
+
* @stability experimental
|
|
130
|
+
*/
|
|
131
|
+
export declare const adminNodeEventSchema: z.ZodObject<{
|
|
132
|
+
id: z.ZodString;
|
|
133
|
+
nodeId: z.ZodString;
|
|
134
|
+
type: z.ZodString;
|
|
135
|
+
severity: z.ZodEnum<import("./schemas.js").NodeEventSeverityEnum>;
|
|
136
|
+
attrs: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
137
|
+
occurredAt: z.ZodString;
|
|
138
|
+
receivedAt: z.ZodString;
|
|
139
|
+
}, z.core.$strip>;
|
|
140
|
+
/**
|
|
141
|
+
* The query of `GET /api/nodes/:id/events` (and the admin twin): newest first,
|
|
142
|
+
* `type` and `severity` matched for equality.
|
|
143
|
+
*
|
|
144
|
+
* @stability experimental
|
|
145
|
+
*/
|
|
146
|
+
export declare const nodeEventListQuerySchema: z.ZodObject<{
|
|
147
|
+
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
148
|
+
pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
149
|
+
type: z.ZodOptional<z.ZodString>;
|
|
150
|
+
severity: z.ZodOptional<z.ZodEnum<import("./schemas.js").NodeEventSeverityEnum>>;
|
|
151
|
+
}, z.core.$strip>;
|
|
152
|
+
/**
|
|
153
|
+
* A page of node events (`page`, `pageSize`, `items`, `total`, `totalPages`).
|
|
154
|
+
*
|
|
155
|
+
* @stability experimental
|
|
156
|
+
*/
|
|
157
|
+
export declare const adminNodeEventListSchema: z.ZodObject<{
|
|
158
|
+
items: z.ZodArray<z.ZodObject<{
|
|
159
|
+
id: z.ZodString;
|
|
160
|
+
nodeId: z.ZodString;
|
|
161
|
+
type: z.ZodString;
|
|
162
|
+
severity: z.ZodEnum<import("./schemas.js").NodeEventSeverityEnum>;
|
|
163
|
+
attrs: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
164
|
+
occurredAt: z.ZodString;
|
|
165
|
+
receivedAt: z.ZodString;
|
|
166
|
+
}, z.core.$strip>>;
|
|
167
|
+
total: z.ZodNumber;
|
|
168
|
+
page: z.ZodNumber;
|
|
169
|
+
pageSize: z.ZodNumber;
|
|
170
|
+
totalPages: z.ZodNumber;
|
|
171
|
+
}, z.core.$strip>;
|
|
106
172
|
/**
|
|
107
173
|
* One credential as `GET /api/admin/nodes/credentials` returns it
|
|
108
174
|
* (`AdminNodeCredentialDto`). No `token`, no hash; revoked credentials are
|
|
@@ -133,8 +199,8 @@ export declare const adminNodeCredentialSchema: z.ZodObject<{
|
|
|
133
199
|
export declare const nodeCredentialListItemSchema: z.ZodObject<{
|
|
134
200
|
id: z.ZodString;
|
|
135
201
|
createdAt: z.ZodString;
|
|
136
|
-
expiresAt: z.ZodNullable<z.ZodString>;
|
|
137
202
|
name: z.ZodString;
|
|
203
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
138
204
|
tokenPrefix: z.ZodString;
|
|
139
205
|
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
140
206
|
revokedAt: z.ZodNullable<z.ZodString>;
|
|
@@ -153,6 +219,24 @@ export declare const nodeCredentialCreatedSchema: z.ZodObject<{
|
|
|
153
219
|
expiresAt: z.ZodNullable<z.ZodString>;
|
|
154
220
|
createdAt: z.ZodString;
|
|
155
221
|
}, z.core.$strip>;
|
|
222
|
+
/**
|
|
223
|
+
* One stored node event.
|
|
224
|
+
*
|
|
225
|
+
* @stability experimental
|
|
226
|
+
*/
|
|
227
|
+
export type AdminNodeEvent = z.output<typeof adminNodeEventSchema>;
|
|
228
|
+
/**
|
|
229
|
+
* The parsed events-list query.
|
|
230
|
+
*
|
|
231
|
+
* @stability experimental
|
|
232
|
+
*/
|
|
233
|
+
export type NodeEventListQuery = z.output<typeof nodeEventListQuerySchema>;
|
|
234
|
+
/**
|
|
235
|
+
* A page of node events.
|
|
236
|
+
*
|
|
237
|
+
* @stability experimental
|
|
238
|
+
*/
|
|
239
|
+
export type AdminNodeEventList = z.output<typeof adminNodeEventListSchema>;
|
|
156
240
|
/**
|
|
157
241
|
* One admin node.
|
|
158
242
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-schemas.d.ts","sourceRoot":"","sources":["../../../src/nodes/admin-schemas.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG7D;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;KAAG,CAAC,IAAI,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;CAAE,CAAC;AAE1E;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;KAAG,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;CAAE,CAAC;AAEzE;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;iBAO1B,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,mBA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
// declare it at all rather than declaring it nullable.
|
|
21
21
|
// =============================================================================
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.nodeCredentialCreatedSchema = exports.nodeCredentialListItemSchema = exports.adminNodeCredentialSchema = exports.adminNodeSchema = exports.nodeJobCountsSchema = exports.nodeOwnerSchema = void 0;
|
|
23
|
+
exports.nodeCredentialCreatedSchema = exports.nodeCredentialListItemSchema = exports.adminNodeCredentialSchema = exports.adminNodeEventListSchema = exports.nodeEventListQuerySchema = exports.adminNodeEventSchema = exports.adminNodeSchema = exports.nodeJobCountsSchema = exports.nodeOwnerSchema = void 0;
|
|
24
24
|
const zod_1 = require("zod");
|
|
25
25
|
const constants_js_1 = require("./constants.js");
|
|
26
26
|
const schemas_js_1 = require("./schemas.js");
|
|
@@ -98,6 +98,60 @@ exports.adminNodeSchema = zod_1.z.object({
|
|
|
98
98
|
/** The jobs it holds, per state. */
|
|
99
99
|
jobCounts: exports.nodeJobCountsSchema,
|
|
100
100
|
});
|
|
101
|
+
/**
|
|
102
|
+
* One stored node event as `GET /api/nodes/:id/events` returns it.
|
|
103
|
+
*
|
|
104
|
+
* @stability experimental
|
|
105
|
+
*/
|
|
106
|
+
exports.adminNodeEventSchema = zod_1.z.object({
|
|
107
|
+
/** The event id (UUID). */
|
|
108
|
+
id: zod_1.z.string(),
|
|
109
|
+
/** The node it belongs to. */
|
|
110
|
+
nodeId: zod_1.z.string(),
|
|
111
|
+
/** Dotted type, e.g. `power.battery_low`. */
|
|
112
|
+
type: schemas_js_1.nodeEventSchema.shape.type,
|
|
113
|
+
/** How loud it is. */
|
|
114
|
+
severity: schemas_js_1.nodeEventSchema.shape.severity,
|
|
115
|
+
/** The node's scalar attributes, `{}` when none. */
|
|
116
|
+
attrs: zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.string(), zod_1.z.number(), zod_1.z.boolean()])),
|
|
117
|
+
/** When it happened on the node's clock (ISO 8601). */
|
|
118
|
+
occurredAt: zod_1.z.string(),
|
|
119
|
+
/** When the server received it (ISO 8601). */
|
|
120
|
+
receivedAt: zod_1.z.string(),
|
|
121
|
+
});
|
|
122
|
+
/**
|
|
123
|
+
* The query of `GET /api/nodes/:id/events` (and the admin twin): newest first,
|
|
124
|
+
* `type` and `severity` matched for equality.
|
|
125
|
+
*
|
|
126
|
+
* @stability experimental
|
|
127
|
+
*/
|
|
128
|
+
exports.nodeEventListQuerySchema = zod_1.z.object({
|
|
129
|
+
/** Page, from 1. */
|
|
130
|
+
page: zod_1.z.coerce.number().int().min(1).default(1),
|
|
131
|
+
/** Page size, at most 100. */
|
|
132
|
+
pageSize: zod_1.z.coerce.number().int().min(1).max(100).default(20),
|
|
133
|
+
/** Exactly one dotted event type. */
|
|
134
|
+
type: zod_1.z.string().max(64).optional(),
|
|
135
|
+
/** Exactly one severity. */
|
|
136
|
+
severity: schemas_js_1.nodeEventSchema.shape.severity.optional(),
|
|
137
|
+
});
|
|
138
|
+
/**
|
|
139
|
+
* A page of node events (`page`, `pageSize`, `items`, `total`, `totalPages`).
|
|
140
|
+
*
|
|
141
|
+
* @stability experimental
|
|
142
|
+
*/
|
|
143
|
+
exports.adminNodeEventListSchema = zod_1.z.object({
|
|
144
|
+
/** The page's events, newest first. */
|
|
145
|
+
items: zod_1.z.array(exports.adminNodeEventSchema),
|
|
146
|
+
/** Events matching the filters, across all pages. */
|
|
147
|
+
total: zod_1.z.number().int(),
|
|
148
|
+
/** The current page, from 1. */
|
|
149
|
+
page: zod_1.z.number().int(),
|
|
150
|
+
/** The page size. */
|
|
151
|
+
pageSize: zod_1.z.number().int(),
|
|
152
|
+
/** The page count, at least 1. */
|
|
153
|
+
totalPages: zod_1.z.number().int(),
|
|
154
|
+
});
|
|
101
155
|
/**
|
|
102
156
|
* One credential as `GET /api/admin/nodes/credentials` returns it
|
|
103
157
|
* (`AdminNodeCredentialDto`). No `token`, no hash; revoked credentials are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-schemas.js","sourceRoot":"","sources":["../../../src/nodes/admin-schemas.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,wDAAwD;AACxD,gFAAgF;AAChF,EAAE;AACF,0EAA0E;AAC1E,sFAAsF;AACtF,2EAA2E;AAC3E,+EAA+E;AAC/E,iDAAiD;AACjD,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,8EAA8E;AAC9E,kEAAkE;AAClE,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,0EAA0E;AAC1E,uDAAuD;AACvD,gFAAgF;;;AAEhF,6BAAwB;AAExB,iDAA6D;AAC7D,
|
|
1
|
+
{"version":3,"file":"admin-schemas.js","sourceRoot":"","sources":["../../../src/nodes/admin-schemas.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,wDAAwD;AACxD,gFAAgF;AAChF,EAAE;AACF,0EAA0E;AAC1E,sFAAsF;AACtF,2EAA2E;AAC3E,+EAA+E;AAC/E,iDAAiD;AACjD,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,8EAA8E;AAC9E,kEAAkE;AAClE,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,0EAA0E;AAC1E,uDAAuD;AACvD,gFAAgF;;;AAEhF,6BAAwB;AAExB,iDAA6D;AAC7D,6CAAiE;AAgBjE;;;;GAIG;AACU,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IACtC,4BAA4B;IAC5B,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,gCAAgC;IAChC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,mDAAmD;IACnD,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAEH;;;;;GAKG;AACU,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,iCAAiC;IACjC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,sDAAsD;IACt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