@stapel/alerts-react 0.1.1
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 +109 -0
- package/LICENSE +21 -0
- package/MODULE.md +140 -0
- package/README.md +147 -0
- package/dist/analytics/events.d.ts +29 -0
- package/dist/analytics/events.d.ts.map +1 -0
- package/dist/analytics/events.js +28 -0
- package/dist/analytics/events.js.map +1 -0
- package/dist/api/alertsApi.d.ts +84 -0
- package/dist/api/alertsApi.d.ts.map +1 -0
- package/dist/api/alertsApi.js +127 -0
- package/dist/api/alertsApi.js.map +1 -0
- package/dist/api/generated/schema.d.ts +453 -0
- package/dist/api/generated/schema.d.ts.map +1 -0
- package/dist/api/generated/schema.js +2 -0
- package/dist/api/generated/schema.js.map +1 -0
- package/dist/api/types.d.ts +78 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +44 -0
- package/dist/api/types.js.map +1 -0
- package/dist/default/FixIssueDialog.d.ts +15 -0
- package/dist/default/FixIssueDialog.d.ts.map +1 -0
- package/dist/default/FixIssueDialog.js +67 -0
- package/dist/default/FixIssueDialog.js.map +1 -0
- package/dist/default/IssueDetail.d.ts +10 -0
- package/dist/default/IssueDetail.d.ts.map +1 -0
- package/dist/default/IssueDetail.js +83 -0
- package/dist/default/IssueDetail.js.map +1 -0
- package/dist/default/IssueFilterBar.d.ts +21 -0
- package/dist/default/IssueFilterBar.d.ts.map +1 -0
- package/dist/default/IssueFilterBar.js +86 -0
- package/dist/default/IssueFilterBar.js.map +1 -0
- package/dist/default/IssuesFeed.d.ts +10 -0
- package/dist/default/IssuesFeed.d.ts.map +1 -0
- package/dist/default/IssuesFeed.js +137 -0
- package/dist/default/IssuesFeed.js.map +1 -0
- package/dist/default/MuteIssueDialog.d.ts +19 -0
- package/dist/default/MuteIssueDialog.d.ts.map +1 -0
- package/dist/default/MuteIssueDialog.js +72 -0
- package/dist/default/MuteIssueDialog.js.map +1 -0
- package/dist/default/index.d.ts +32 -0
- package/dist/default/index.d.ts.map +1 -0
- package/dist/default/index.js +26 -0
- package/dist/default/index.js.map +1 -0
- package/dist/default/labels.d.ts +40 -0
- package/dist/default/labels.d.ts.map +1 -0
- package/dist/default/labels.js +94 -0
- package/dist/default/labels.js.map +1 -0
- package/dist/default/layout.d.ts +32 -0
- package/dist/default/layout.d.ts.map +1 -0
- package/dist/default/layout.js +44 -0
- package/dist/default/layout.js.map +1 -0
- package/dist/default/types.d.ts +27 -0
- package/dist/default/types.d.ts.map +1 -0
- package/dist/default/types.js +2 -0
- package/dist/default/types.js.map +1 -0
- package/dist/flows/errors.d.ts +12 -0
- package/dist/flows/errors.d.ts.map +1 -0
- package/dist/flows/errors.js +13 -0
- package/dist/flows/errors.js.map +1 -0
- package/dist/flows/registry.d.ts +22 -0
- package/dist/flows/registry.d.ts.map +1 -0
- package/dist/flows/registry.js +20 -0
- package/dist/flows/registry.js.map +1 -0
- package/dist/headless/AlertsProvider.d.ts +19 -0
- package/dist/headless/AlertsProvider.d.ts.map +1 -0
- package/dist/headless/AlertsProvider.js +15 -0
- package/dist/headless/AlertsProvider.js.map +1 -0
- package/dist/i18n/errorsMap.d.ts +10 -0
- package/dist/i18n/errorsMap.d.ts.map +1 -0
- package/dist/i18n/errorsMap.js +20 -0
- package/dist/i18n/errorsMap.js.map +1 -0
- package/dist/i18n/es.d.ts +20 -0
- package/dist/i18n/es.d.ts.map +1 -0
- package/dist/i18n/es.js +152 -0
- package/dist/i18n/es.js.map +1 -0
- package/dist/i18n/generated/errors.es.gen.d.ts +9 -0
- package/dist/i18n/generated/errors.es.gen.d.ts.map +1 -0
- package/dist/i18n/generated/errors.es.gen.js +57 -0
- package/dist/i18n/generated/errors.es.gen.js.map +1 -0
- package/dist/i18n/generated/errors.gen.d.ts +323 -0
- package/dist/i18n/generated/errors.gen.d.ts.map +1 -0
- package/dist/i18n/generated/errors.gen.js +165 -0
- package/dist/i18n/generated/errors.gen.js.map +1 -0
- package/dist/i18n/generated/errors.ru.gen.d.ts +9 -0
- package/dist/i18n/generated/errors.ru.gen.d.ts.map +1 -0
- package/dist/i18n/generated/errors.ru.gen.js +57 -0
- package/dist/i18n/generated/errors.ru.gen.js.map +1 -0
- package/dist/i18n/keys.d.ts +164 -0
- package/dist/i18n/keys.d.ts.map +1 -0
- package/dist/i18n/keys.js +300 -0
- package/dist/i18n/keys.js.map +1 -0
- package/dist/i18n/ru.d.ts +27 -0
- package/dist/i18n/ru.d.ts.map +1 -0
- package/dist/i18n/ru.js +159 -0
- package/dist/i18n/ru.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/model/context.d.ts +11 -0
- package/dist/model/context.d.ts.map +1 -0
- package/dist/model/context.js +16 -0
- package/dist/model/context.js.map +1 -0
- package/dist/model/issues.d.ts +103 -0
- package/dist/model/issues.d.ts.map +1 -0
- package/dist/model/issues.js +230 -0
- package/dist/model/issues.js.map +1 -0
- package/dist/model/queryKeys.d.ts +11 -0
- package/dist/model/queryKeys.d.ts.map +1 -0
- package/dist/model/queryKeys.js +32 -0
- package/dist/model/queryKeys.js.map +1 -0
- package/dist/model/refusals.d.ts +25 -0
- package/dist/model/refusals.d.ts.map +1 -0
- package/dist/model/refusals.js +73 -0
- package/dist/model/refusals.js.map +1 -0
- package/dist/model/runtime.d.ts +51 -0
- package/dist/model/runtime.d.ts.map +1 -0
- package/dist/model/runtime.js +29 -0
- package/dist/model/runtime.js.map +1 -0
- package/dist/model/status.d.ts +60 -0
- package/dist/model/status.d.ts.map +1 -0
- package/dist/model/status.js +116 -0
- package/dist/model/status.js.map +1 -0
- package/dist/nav/manifest.d.ts +43 -0
- package/dist/nav/manifest.d.ts.map +1 -0
- package/dist/nav/manifest.js +36 -0
- package/dist/nav/manifest.js.map +1 -0
- package/llms.txt +84 -0
- package/manifest.json +694 -0
- package/nav-manifest.json +46 -0
- package/package.json +119 -0
- package/src/analytics/events.ts +29 -0
- package/src/analytics/generated/events.json +7 -0
- package/src/api/alertsApi.ts +259 -0
- package/src/api/generated/schema.ts +455 -0
- package/src/api/types.ts +113 -0
- package/src/default/FixIssueDialog.tsx +158 -0
- package/src/default/IssueDetail.tsx +431 -0
- package/src/default/IssueFilterBar.tsx +197 -0
- package/src/default/IssuesFeed.tsx +343 -0
- package/src/default/MuteIssueDialog.tsx +186 -0
- package/src/default/index.ts +37 -0
- package/src/default/labels.ts +113 -0
- package/src/default/layout.ts +52 -0
- package/src/default/types.ts +27 -0
- package/src/flows/errors.ts +16 -0
- package/src/flows/registry.ts +32 -0
- package/src/headless/AlertsProvider.tsx +20 -0
- package/src/i18n/errorsMap.ts +31 -0
- package/src/i18n/es.ts +181 -0
- package/src/i18n/generated/errors.es.gen.ts +63 -0
- package/src/i18n/generated/errors.gen.ts +196 -0
- package/src/i18n/generated/errors.json +370 -0
- package/src/i18n/generated/errors.ru.gen.ts +63 -0
- package/src/i18n/keys.ts +341 -0
- package/src/i18n/ru.ts +188 -0
- package/src/index.ts +152 -0
- package/src/model/context.tsx +28 -0
- package/src/model/issues.ts +311 -0
- package/src/model/queryKeys.ts +41 -0
- package/src/model/refusals.ts +82 -0
- package/src/model/runtime.ts +80 -0
- package/src/model/status.ts +179 -0
- package/src/nav/manifest.ts +76 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/gen-api.mjs — do not edit by hand.
|
|
2
|
+
// Source: the backend module's own docs/schema.json (§17-native per-module contract).
|
|
3
|
+
// Regenerate: pnpm gen:api · Drift gate: pnpm gen:api:check
|
|
4
|
+
export interface paths {
|
|
5
|
+
"/alerts/api/v1/issues": {
|
|
6
|
+
parameters: {
|
|
7
|
+
query?: never;
|
|
8
|
+
header?: never;
|
|
9
|
+
path?: never;
|
|
10
|
+
cookie?: never;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @description ``GET /alerts/api/v1/issues`` — the triage list, newest activity first.
|
|
14
|
+
*
|
|
15
|
+
* **Permissions:** `IsStaffUser`
|
|
16
|
+
*/
|
|
17
|
+
get: operations["alerts_api_v1_issues_list"];
|
|
18
|
+
put?: never;
|
|
19
|
+
post?: never;
|
|
20
|
+
delete?: never;
|
|
21
|
+
options?: never;
|
|
22
|
+
head?: never;
|
|
23
|
+
patch?: never;
|
|
24
|
+
trace?: never;
|
|
25
|
+
};
|
|
26
|
+
"/alerts/api/v1/issues/{issue_id}": {
|
|
27
|
+
parameters: {
|
|
28
|
+
query?: never;
|
|
29
|
+
header?: never;
|
|
30
|
+
path?: never;
|
|
31
|
+
cookie?: never;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* @description ``GET`` one issue with its last events; ``PATCH`` its status/note.
|
|
35
|
+
*
|
|
36
|
+
* **Permissions:** `IsStaffUser`
|
|
37
|
+
*/
|
|
38
|
+
get: operations["alerts_api_v1_issues_retrieve"];
|
|
39
|
+
put?: never;
|
|
40
|
+
post?: never;
|
|
41
|
+
delete?: never;
|
|
42
|
+
options?: never;
|
|
43
|
+
head?: never;
|
|
44
|
+
/**
|
|
45
|
+
* @description ``GET`` one issue with its last events; ``PATCH`` its status/note.
|
|
46
|
+
*
|
|
47
|
+
* **Permissions:** `IsStaffUser`
|
|
48
|
+
*/
|
|
49
|
+
patch: operations["alerts_api_v1_issues_partial_update"];
|
|
50
|
+
trace?: never;
|
|
51
|
+
};
|
|
52
|
+
"/alerts/api/v1/issues/{issue_id}/fix": {
|
|
53
|
+
parameters: {
|
|
54
|
+
query?: never;
|
|
55
|
+
header?: never;
|
|
56
|
+
path?: never;
|
|
57
|
+
cookie?: never;
|
|
58
|
+
};
|
|
59
|
+
get?: never;
|
|
60
|
+
put?: never;
|
|
61
|
+
/**
|
|
62
|
+
* @description ``POST /issues/{id}/fix`` — close an issue with the release that fixed it.
|
|
63
|
+
*
|
|
64
|
+
* The endpoint CI calls on a commit that references ``alerts:<issue-id>``,
|
|
65
|
+
* and the one an agent calls after a fix wave. Idempotent: fixing a fixed
|
|
66
|
+
* issue overwrites the version, which is what a re-deploy of a better fix
|
|
67
|
+
* should do.
|
|
68
|
+
*
|
|
69
|
+
* **Permissions:** `IsStaffUser`
|
|
70
|
+
*/
|
|
71
|
+
post: operations["alerts_api_v1_issues_fix_create"];
|
|
72
|
+
delete?: never;
|
|
73
|
+
options?: never;
|
|
74
|
+
head?: never;
|
|
75
|
+
patch?: never;
|
|
76
|
+
trace?: never;
|
|
77
|
+
};
|
|
78
|
+
"/alerts/api/v1/report": {
|
|
79
|
+
parameters: {
|
|
80
|
+
query?: never;
|
|
81
|
+
header?: never;
|
|
82
|
+
path?: never;
|
|
83
|
+
cookie?: never;
|
|
84
|
+
};
|
|
85
|
+
get?: never;
|
|
86
|
+
put?: never;
|
|
87
|
+
/**
|
|
88
|
+
* @description ``POST /alerts/api/v1/report`` — a batch of events from a reporter.
|
|
89
|
+
*
|
|
90
|
+
* ``AllowAny`` at the DRF layer and authenticated HERE, by service key,
|
|
91
|
+
* because a reporter has no session and no JWT: it is a process, not a
|
|
92
|
+
* person. The key is looked up by hash (``Service.authenticate``), so the
|
|
93
|
+
* plaintext never reaches a query log.
|
|
94
|
+
*
|
|
95
|
+
* A staff session is also accepted, which is what makes the endpoint
|
|
96
|
+
* testable and lets an operator replay an event by hand.
|
|
97
|
+
*
|
|
98
|
+
* **Permissions:** `AllowAny`
|
|
99
|
+
*/
|
|
100
|
+
post: operations["alerts_api_v1_report_create"];
|
|
101
|
+
delete?: never;
|
|
102
|
+
options?: never;
|
|
103
|
+
head?: never;
|
|
104
|
+
patch?: never;
|
|
105
|
+
trace?: never;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
export type webhooks = Record<string, never>;
|
|
109
|
+
export interface components {
|
|
110
|
+
schemas: {
|
|
111
|
+
ErrorEvent: {
|
|
112
|
+
/** Format: uuid */
|
|
113
|
+
readonly id: string;
|
|
114
|
+
/** Format: uuid */
|
|
115
|
+
readonly issue: string;
|
|
116
|
+
/** Format: date-time */
|
|
117
|
+
readonly received_at: string;
|
|
118
|
+
/** Format: date-time */
|
|
119
|
+
readonly occurred_at: string;
|
|
120
|
+
readonly service: string;
|
|
121
|
+
readonly environment: string;
|
|
122
|
+
readonly release: string;
|
|
123
|
+
readonly level: components["schemas"]["LevelEnum"];
|
|
124
|
+
readonly kind: components["schemas"]["KindEnum"];
|
|
125
|
+
readonly message: string;
|
|
126
|
+
readonly trace: string;
|
|
127
|
+
readonly context: unknown;
|
|
128
|
+
readonly request_path: string;
|
|
129
|
+
readonly trace_id: string;
|
|
130
|
+
/** Format: uuid */
|
|
131
|
+
readonly user_id: string | null;
|
|
132
|
+
readonly occurrences: number;
|
|
133
|
+
readonly sentry_event_id: string;
|
|
134
|
+
};
|
|
135
|
+
/** @description The tracker row. What an agent lists, reads and reconciles against. */
|
|
136
|
+
Issue: {
|
|
137
|
+
/** Format: uuid */
|
|
138
|
+
readonly id: string;
|
|
139
|
+
readonly fingerprint: string;
|
|
140
|
+
readonly service: string;
|
|
141
|
+
readonly environment: string;
|
|
142
|
+
readonly level: components["schemas"]["LevelEnum"];
|
|
143
|
+
readonly kind: components["schemas"]["KindEnum"];
|
|
144
|
+
readonly title: string;
|
|
145
|
+
readonly culprit: string;
|
|
146
|
+
readonly exception_class: string;
|
|
147
|
+
readonly status: components["schemas"]["Status295Enum"];
|
|
148
|
+
readonly note: string;
|
|
149
|
+
readonly count: number;
|
|
150
|
+
readonly count_since_fix: number;
|
|
151
|
+
/** Format: date-time */
|
|
152
|
+
readonly first_seen: string;
|
|
153
|
+
/** Format: date-time */
|
|
154
|
+
readonly last_seen: string;
|
|
155
|
+
readonly fixed_in_version: string;
|
|
156
|
+
readonly fixed_in_sha: string;
|
|
157
|
+
/** Format: date-time */
|
|
158
|
+
readonly fixed_at: string | null;
|
|
159
|
+
/** Format: date-time */
|
|
160
|
+
readonly regressed_at: string | null;
|
|
161
|
+
/** Format: date-time */
|
|
162
|
+
readonly muted_until: string | null;
|
|
163
|
+
readonly sentry_event_id: string;
|
|
164
|
+
};
|
|
165
|
+
/** @description The tracker row. What an agent lists, reads and reconciles against. */
|
|
166
|
+
IssueDetail: {
|
|
167
|
+
/** Format: uuid */
|
|
168
|
+
readonly id: string;
|
|
169
|
+
readonly fingerprint: string;
|
|
170
|
+
readonly service: string;
|
|
171
|
+
readonly environment: string;
|
|
172
|
+
readonly level: components["schemas"]["LevelEnum"];
|
|
173
|
+
readonly kind: components["schemas"]["KindEnum"];
|
|
174
|
+
readonly title: string;
|
|
175
|
+
readonly culprit: string;
|
|
176
|
+
readonly exception_class: string;
|
|
177
|
+
readonly status: components["schemas"]["Status295Enum"];
|
|
178
|
+
readonly note: string;
|
|
179
|
+
readonly count: number;
|
|
180
|
+
readonly count_since_fix: number;
|
|
181
|
+
/** Format: date-time */
|
|
182
|
+
readonly first_seen: string;
|
|
183
|
+
/** Format: date-time */
|
|
184
|
+
readonly last_seen: string;
|
|
185
|
+
readonly fixed_in_version: string;
|
|
186
|
+
readonly fixed_in_sha: string;
|
|
187
|
+
/** Format: date-time */
|
|
188
|
+
readonly fixed_at: string | null;
|
|
189
|
+
/** Format: date-time */
|
|
190
|
+
readonly regressed_at: string | null;
|
|
191
|
+
/** Format: date-time */
|
|
192
|
+
readonly muted_until: string | null;
|
|
193
|
+
readonly sentry_event_id: string;
|
|
194
|
+
readonly events: components["schemas"]["ErrorEvent"][];
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* @description ``POST /issues/{id}/fix`` — the release that claims the fix.
|
|
198
|
+
*
|
|
199
|
+
* Both fields are optional and both are recorded: a CI caller has a sha, a
|
|
200
|
+
* human closing an issue after a hotfix may only have a version, and an
|
|
201
|
+
* issue closed with neither is still closed — just less useful when it
|
|
202
|
+
* regresses and somebody asks which deploy was supposed to have fixed it.
|
|
203
|
+
*/
|
|
204
|
+
IssueFix: {
|
|
205
|
+
version?: string;
|
|
206
|
+
sha?: string;
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* @description The envelope ``GET /issues`` returns: ``{count, offset, limit, results}``.
|
|
210
|
+
*
|
|
211
|
+
* Both the wire and the contract. The list view renders its response THROUGH
|
|
212
|
+
* this serializer and declares it as the response, so the schema cannot say
|
|
213
|
+
* ``Issue[]`` while the body carries a page — which is what 0.2.0 did, with
|
|
214
|
+
* a hand-written ``responses=IssueSerializer(many=True)`` that the generator
|
|
215
|
+
* had no way to check against the method body.
|
|
216
|
+
*
|
|
217
|
+
* ``results`` is the row serializer the view resolved through its seam
|
|
218
|
+
* (``SerializerSeamMixin``), so a host that swaps the row shape gets the same
|
|
219
|
+
* envelope around its own rows.
|
|
220
|
+
*/
|
|
221
|
+
IssuePage: {
|
|
222
|
+
count: number;
|
|
223
|
+
offset: number;
|
|
224
|
+
limit: number;
|
|
225
|
+
results: components["schemas"]["Issue"][];
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* @description * `new` - new
|
|
229
|
+
* * `fixed` - fixed
|
|
230
|
+
* * `muted` - muted
|
|
231
|
+
* @enum {string}
|
|
232
|
+
*/
|
|
233
|
+
IssuePatchStatusEnum: "new" | "fixed" | "muted";
|
|
234
|
+
/**
|
|
235
|
+
* @description * `exception` - Exception
|
|
236
|
+
* * `log` - Log
|
|
237
|
+
* * `dlq` - DLQ park
|
|
238
|
+
* * `monitoring` - Monitoring
|
|
239
|
+
* * `manual` - Manual
|
|
240
|
+
* @enum {string}
|
|
241
|
+
*/
|
|
242
|
+
KindEnum: "exception" | "log" | "dlq" | "monitoring" | "manual";
|
|
243
|
+
/**
|
|
244
|
+
* @description * `debug` - Debug
|
|
245
|
+
* * `info` - Info
|
|
246
|
+
* * `warning` - Warning
|
|
247
|
+
* * `error` - Error
|
|
248
|
+
* * `fatal` - Fatal
|
|
249
|
+
* @enum {string}
|
|
250
|
+
*/
|
|
251
|
+
LevelEnum: "debug" | "info" | "warning" | "error" | "fatal";
|
|
252
|
+
/**
|
|
253
|
+
* @description ``PATCH /issues/{id}`` — status, note, and/or the mute deadline.
|
|
254
|
+
*
|
|
255
|
+
* ``muted_until`` on its own is a mute: the field has no meaning in any other
|
|
256
|
+
* status, so a patch that carries only the deadline sets ``status=muted``
|
|
257
|
+
* (``null`` for a mute with no deadline). With any status other than
|
|
258
|
+
* ``muted`` the deadline is ignored and cleared.
|
|
259
|
+
*/
|
|
260
|
+
PatchedIssuePatch: {
|
|
261
|
+
status?: components["schemas"]["IssuePatchStatusEnum"];
|
|
262
|
+
note?: string;
|
|
263
|
+
/** Format: date-time */
|
|
264
|
+
muted_until?: string | null;
|
|
265
|
+
};
|
|
266
|
+
Report: {
|
|
267
|
+
events: components["schemas"]["ReportEvent"][];
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* @description One event in a ``POST /report`` batch — the reporter wire shape.
|
|
271
|
+
*
|
|
272
|
+
* ``kind="monitoring"`` is the watchdog's entry: a report that the
|
|
273
|
+
* monitoring stack itself has a blind spot (a scrape gap, an exporter down,
|
|
274
|
+
* an alertmanager silence). It carries no traceback, so ``message`` is what
|
|
275
|
+
* groups it, and ``context`` carries the specifics
|
|
276
|
+
* (``{"check": "...", "target": "...", "last_scrape": "..."}``).
|
|
277
|
+
*/
|
|
278
|
+
ReportEvent: {
|
|
279
|
+
/** @default */
|
|
280
|
+
message: string;
|
|
281
|
+
/** @default */
|
|
282
|
+
trace: string;
|
|
283
|
+
service?: string;
|
|
284
|
+
/** @default error */
|
|
285
|
+
level: string;
|
|
286
|
+
/** @default manual */
|
|
287
|
+
kind: string;
|
|
288
|
+
/** @default production */
|
|
289
|
+
environment: string;
|
|
290
|
+
/** @default */
|
|
291
|
+
release: string;
|
|
292
|
+
context?: unknown;
|
|
293
|
+
/** @default */
|
|
294
|
+
request_path: string;
|
|
295
|
+
/** @default */
|
|
296
|
+
trace_id: string;
|
|
297
|
+
/** Format: uuid */
|
|
298
|
+
user_id?: string | null;
|
|
299
|
+
/** @default 1 */
|
|
300
|
+
occurrences: number;
|
|
301
|
+
/** Format: date-time */
|
|
302
|
+
occurred_at?: string | null;
|
|
303
|
+
/** @default */
|
|
304
|
+
exc_class: string;
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* @description * `new` - New
|
|
308
|
+
* * `fixed` - Fixed
|
|
309
|
+
* * `regressed` - Regressed
|
|
310
|
+
* * `muted` - Muted
|
|
311
|
+
* @enum {string}
|
|
312
|
+
*/
|
|
313
|
+
Status295Enum: "new" | "fixed" | "regressed" | "muted";
|
|
314
|
+
};
|
|
315
|
+
responses: never;
|
|
316
|
+
parameters: never;
|
|
317
|
+
requestBodies: never;
|
|
318
|
+
headers: never;
|
|
319
|
+
pathItems: never;
|
|
320
|
+
}
|
|
321
|
+
export type $defs = Record<string, never>;
|
|
322
|
+
export interface operations {
|
|
323
|
+
alerts_api_v1_issues_list: {
|
|
324
|
+
parameters: {
|
|
325
|
+
query?: {
|
|
326
|
+
/** @description debug|info|warning|error|fatal */
|
|
327
|
+
level?: string;
|
|
328
|
+
/** @description Page size, 1..200; default 50. Out-of-range values are clamped and the envelope echoes the limit that was applied. */
|
|
329
|
+
limit?: number;
|
|
330
|
+
/** @description Rows to skip; default 0 */
|
|
331
|
+
offset?: number;
|
|
332
|
+
/** @description Only new + regressed */
|
|
333
|
+
open?: boolean;
|
|
334
|
+
service?: string;
|
|
335
|
+
/** @description ISO-8601; last_seen >= since */
|
|
336
|
+
since?: string;
|
|
337
|
+
/** @description new|fixed|regressed|muted */
|
|
338
|
+
status?: string;
|
|
339
|
+
};
|
|
340
|
+
header?: never;
|
|
341
|
+
path?: never;
|
|
342
|
+
cookie?: never;
|
|
343
|
+
};
|
|
344
|
+
requestBody?: never;
|
|
345
|
+
responses: {
|
|
346
|
+
200: {
|
|
347
|
+
headers: {
|
|
348
|
+
[name: string]: unknown;
|
|
349
|
+
};
|
|
350
|
+
content: {
|
|
351
|
+
"application/json": components["schemas"]["IssuePage"];
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
alerts_api_v1_issues_retrieve: {
|
|
357
|
+
parameters: {
|
|
358
|
+
query?: never;
|
|
359
|
+
header?: never;
|
|
360
|
+
path: {
|
|
361
|
+
issue_id: string;
|
|
362
|
+
};
|
|
363
|
+
cookie?: never;
|
|
364
|
+
};
|
|
365
|
+
requestBody?: never;
|
|
366
|
+
responses: {
|
|
367
|
+
200: {
|
|
368
|
+
headers: {
|
|
369
|
+
[name: string]: unknown;
|
|
370
|
+
};
|
|
371
|
+
content: {
|
|
372
|
+
"application/json": components["schemas"]["IssueDetail"];
|
|
373
|
+
};
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
alerts_api_v1_issues_partial_update: {
|
|
378
|
+
parameters: {
|
|
379
|
+
query?: never;
|
|
380
|
+
header?: never;
|
|
381
|
+
path: {
|
|
382
|
+
issue_id: string;
|
|
383
|
+
};
|
|
384
|
+
cookie?: never;
|
|
385
|
+
};
|
|
386
|
+
requestBody?: {
|
|
387
|
+
content: {
|
|
388
|
+
"application/json": components["schemas"]["PatchedIssuePatch"];
|
|
389
|
+
"application/x-www-form-urlencoded": components["schemas"]["PatchedIssuePatch"];
|
|
390
|
+
"multipart/form-data": components["schemas"]["PatchedIssuePatch"];
|
|
391
|
+
};
|
|
392
|
+
};
|
|
393
|
+
responses: {
|
|
394
|
+
200: {
|
|
395
|
+
headers: {
|
|
396
|
+
[name: string]: unknown;
|
|
397
|
+
};
|
|
398
|
+
content: {
|
|
399
|
+
"application/json": components["schemas"]["Issue"];
|
|
400
|
+
};
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
};
|
|
404
|
+
alerts_api_v1_issues_fix_create: {
|
|
405
|
+
parameters: {
|
|
406
|
+
query?: never;
|
|
407
|
+
header?: never;
|
|
408
|
+
path: {
|
|
409
|
+
issue_id: string;
|
|
410
|
+
};
|
|
411
|
+
cookie?: never;
|
|
412
|
+
};
|
|
413
|
+
requestBody?: {
|
|
414
|
+
content: {
|
|
415
|
+
"application/json": components["schemas"]["IssueFix"];
|
|
416
|
+
"application/x-www-form-urlencoded": components["schemas"]["IssueFix"];
|
|
417
|
+
"multipart/form-data": components["schemas"]["IssueFix"];
|
|
418
|
+
};
|
|
419
|
+
};
|
|
420
|
+
responses: {
|
|
421
|
+
200: {
|
|
422
|
+
headers: {
|
|
423
|
+
[name: string]: unknown;
|
|
424
|
+
};
|
|
425
|
+
content: {
|
|
426
|
+
"application/json": components["schemas"]["Issue"];
|
|
427
|
+
};
|
|
428
|
+
};
|
|
429
|
+
};
|
|
430
|
+
};
|
|
431
|
+
alerts_api_v1_report_create: {
|
|
432
|
+
parameters: {
|
|
433
|
+
query?: never;
|
|
434
|
+
header?: never;
|
|
435
|
+
path?: never;
|
|
436
|
+
cookie?: never;
|
|
437
|
+
};
|
|
438
|
+
requestBody: {
|
|
439
|
+
content: {
|
|
440
|
+
"application/json": components["schemas"]["Report"];
|
|
441
|
+
"application/x-www-form-urlencoded": components["schemas"]["Report"];
|
|
442
|
+
"multipart/form-data": components["schemas"]["Report"];
|
|
443
|
+
};
|
|
444
|
+
};
|
|
445
|
+
responses: {
|
|
446
|
+
/** @description No response body */
|
|
447
|
+
202: {
|
|
448
|
+
headers: {
|
|
449
|
+
[name: string]: unknown;
|
|
450
|
+
};
|
|
451
|
+
content?: never;
|
|
452
|
+
};
|
|
453
|
+
};
|
|
454
|
+
};
|
|
455
|
+
}
|
package/src/api/types.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire types for the stapel-alerts HTTP contract — **derived from the generated
|
|
3
|
+
* OpenAPI surface** (frontend-standard §2/§3), never hand-maintained. The one
|
|
4
|
+
* source of truth is `components["schemas"]` in this pair's own package-LOCAL
|
|
5
|
+
* generated schema (`./generated/schema.js`, produced by `pnpm gen:api` from
|
|
6
|
+
* stapel-alerts's own committed `docs/schema.json`).
|
|
7
|
+
*
|
|
8
|
+
* ── The page envelope comes from the schema, and is still proven on the wire ─
|
|
9
|
+
*
|
|
10
|
+
* `GET /issues` answers {@link IssuePage} — `{count, offset, limit, results}`
|
|
11
|
+
* — and the schema says so: the view renders its response THROUGH the
|
|
12
|
+
* envelope serializer and declares it as the response, so the declaration
|
|
13
|
+
* and the body cannot drift apart. `test/pair.test.ts` still drives the real
|
|
14
|
+
* envelope through the real transport, because a generated type is a
|
|
15
|
+
* statement about the contract and the wire is what a screen reads.
|
|
16
|
+
*
|
|
17
|
+
* ── The three enums come from the schema and are not re-narrowed ──────────
|
|
18
|
+
*
|
|
19
|
+
* `level`, `kind` and `status` are real `enum`s in the contract, so the
|
|
20
|
+
* generated unions are the narrowing. What this module adds is the ORDERED
|
|
21
|
+
* tuples a screen iterates (a filter bar, a legend): declaration order in a
|
|
22
|
+
* generated file is alphabetical-ish and meaningless, while `debug → fatal` is
|
|
23
|
+
* a severity ramp somebody reads top to bottom.
|
|
24
|
+
*/
|
|
25
|
+
import type { components } from "./generated/schema.js";
|
|
26
|
+
|
|
27
|
+
/** The generated schema table — the one source of truth for wire shapes. */
|
|
28
|
+
export type Schemas = components["schemas"];
|
|
29
|
+
|
|
30
|
+
/** The tracker row: one bug, with the status a fix wave reconciles against. */
|
|
31
|
+
export type Issue = Schemas["Issue"];
|
|
32
|
+
|
|
33
|
+
/** One issue plus its last events (`views.DETAIL_EVENTS` = 20 of them). */
|
|
34
|
+
export type IssueDetail = Schemas["IssueDetail"];
|
|
35
|
+
|
|
36
|
+
/** One occurrence: the trace, the redacted context, the correlation id. */
|
|
37
|
+
export type ErrorEvent = Schemas["ErrorEvent"];
|
|
38
|
+
|
|
39
|
+
/** The body `PATCH /issues/{id}` takes. */
|
|
40
|
+
export type IssuePatch = Schemas["PatchedIssuePatch"];
|
|
41
|
+
|
|
42
|
+
/** The body `POST /issues/{id}/fix` takes — both fields optional, both kept. */
|
|
43
|
+
export type IssueFix = Schemas["IssueFix"];
|
|
44
|
+
|
|
45
|
+
/** Severity, as the backend's `Level` choices spell it. */
|
|
46
|
+
export type IssueLevel = Schemas["LevelEnum"];
|
|
47
|
+
|
|
48
|
+
/** Where an occurrence came from (`Kind` choices). */
|
|
49
|
+
export type IssueKind = Schemas["KindEnum"];
|
|
50
|
+
|
|
51
|
+
/** Where an issue is in its life — including the one nobody may assign. */
|
|
52
|
+
export type IssueStatus = Schemas["Status295Enum"];
|
|
53
|
+
|
|
54
|
+
/** The statuses a CALLER may assign (`serializers.SETTABLE_STATUSES`). */
|
|
55
|
+
export type SettableIssueStatus = Schemas["IssuePatchStatusEnum"];
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A page of the triage list — `{count, offset, limit, results}`.
|
|
59
|
+
*
|
|
60
|
+
* `limit` is the page size the server APPLIED, not the one asked for: `?limit=`
|
|
61
|
+
* is clamped to 1..200 (default 50) and echoed back, so a caller pages by the
|
|
62
|
+
* echoed value and never by its own request.
|
|
63
|
+
*/
|
|
64
|
+
export type IssuePage = Schemas["IssuePage"];
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Severity, weakest first. The order is the whole point: a filter bar built
|
|
68
|
+
* from `Object.keys` of a generated type puts `debug` next to `fatal` in
|
|
69
|
+
* whatever order the emitter felt like.
|
|
70
|
+
*/
|
|
71
|
+
export const ISSUE_LEVELS: readonly IssueLevel[] = [
|
|
72
|
+
"debug",
|
|
73
|
+
"info",
|
|
74
|
+
"warning",
|
|
75
|
+
"error",
|
|
76
|
+
"fatal",
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
/** The four statuses an issue can be in, in lifecycle order. */
|
|
80
|
+
export const ISSUE_STATUSES: readonly IssueStatus[] = [
|
|
81
|
+
"new",
|
|
82
|
+
"regressed",
|
|
83
|
+
"fixed",
|
|
84
|
+
"muted",
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The three a caller may ASSERT.
|
|
89
|
+
*
|
|
90
|
+
* `regressed` is absent, and not by omission: the store sets it when a fixed
|
|
91
|
+
* issue receives a new event (`services.record`), and a caller able to set it
|
|
92
|
+
* would be a caller able to decline to. `POST`ing it back answers
|
|
93
|
+
* `error.400.alerts_status_not_settable`, so a control offering it would exist
|
|
94
|
+
* only to be refused.
|
|
95
|
+
*/
|
|
96
|
+
export const SETTABLE_ISSUE_STATUSES: readonly SettableIssueStatus[] = [
|
|
97
|
+
"new",
|
|
98
|
+
"fixed",
|
|
99
|
+
"muted",
|
|
100
|
+
];
|
|
101
|
+
|
|
102
|
+
/** Statuses the backend counts as open (`models.OPEN_STATUSES`). */
|
|
103
|
+
export const OPEN_ISSUE_STATUSES: readonly IssueStatus[] = ["new", "regressed"];
|
|
104
|
+
|
|
105
|
+
/** Is this one of the statuses `PATCH /issues/{id}` accepts? */
|
|
106
|
+
export function isSettableStatus(value: string): value is SettableIssueStatus {
|
|
107
|
+
return (SETTABLE_ISSUE_STATUSES as readonly string[]).includes(value);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Is this issue one the store still considers unresolved? */
|
|
111
|
+
export function isOpenStatus(value: string): boolean {
|
|
112
|
+
return (OPEN_ISSUE_STATUSES as readonly string[]).includes(value);
|
|
113
|
+
}
|