@rawdash/connector-statuspage 0.0.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/README.md ADDED
@@ -0,0 +1,122 @@
1
+ <!-- This file is generated from connector metadata by scripts/generate-connector-docs.ts. Do not edit by hand. -->
2
+
3
+ # @rawdash/connector-statuspage
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@rawdash/connector-statuspage)](https://www.npmjs.com/package/@rawdash/connector-statuspage)
6
+ [![license](https://img.shields.io/npm/l/@rawdash/connector-statuspage)](https://github.com/rawdash/rawdash/blob/main/LICENSE)
7
+
8
+ Sync Atlassian Statuspage components, incidents, and incident updates - current component health, recent incident history, and per-update status transitions.
9
+
10
+ ## Install
11
+
12
+ ```sh
13
+ npm install @rawdash/connector-statuspage
14
+ ```
15
+
16
+ ## Authentication
17
+
18
+ A Statuspage REST API key is required. Keys are scoped to the issuing account and inherit that account read access; a read-only role is sufficient for the resources synced here.
19
+
20
+ 1. Open Statuspage -> Manage Account -> API Info.
21
+ 2. Copy the API Key (or generate one if none exists).
22
+ 3. Store the key as a secret and reference it from the connector config as `apiKey: secret("STATUSPAGE_API_KEY")`.
23
+ 4. Set `pageId` to your 12-character Page ID (shown on the same screen, e.g. `abc123def456`).
24
+
25
+ ## Configuration
26
+
27
+ | Field | Type | Required | Description |
28
+ | ---------------------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
29
+ | `apiKey` | secret | Yes | Statuspage REST API key. Create one at Manage Account -> API Info -> API Key. |
30
+ | `pageId` | string | Yes | Statuspage page id (the 12-character identifier shown next to your page name in Manage Account -> API Info, also visible in the admin URL). |
31
+ | `resources` | array | No | Which Statuspage resources to sync. Omit to sync all of them. 'incident_updates' rides the 'incidents' phase - enabling it without 'incidents' still fetches incidents but skips writing incident entities. |
32
+ | `incidentLookbackDays` | number | No | How many days back to fetch incidents (and their updates) on a full sync. Defaults to 90. Statuspage returns incidents newest-first; this caps the backfill window. |
33
+
34
+ ## Resources
35
+
36
+ - **`statuspage_component`** _(entity)_ - Statuspage components (the things on a status page that turn red), with current status, group membership, and whether they are hidden until degraded.
37
+ - Endpoint: `GET /v1/pages/{page_id}/components`
38
+ - `name`: Component display name.
39
+ - `status`: Current health: operational | under_maintenance | degraded_performance | partial_outage | major_outage.
40
+ - `groupId`: Parent component-group id, or null if the component is top-level.
41
+ - `group`: True if this row is itself a component group.
42
+ - `showcase`: Whether the component is shown on the public page.
43
+ - `onlyShowIfDegraded`: When true the component is hidden on the public page while operational.
44
+ - `position`: Sort position within the page or group.
45
+ - **`statuspage_incident`** _(entity)_ - Statuspage incidents (realtime outages plus maintenance windows) with status, impact, affected components, and the created / monitoring / resolved timestamps.
46
+ - Endpoint: `GET /v1/pages/{page_id}/incidents`
47
+ - Returned newest-first by updated_at; bounded by the incident lookback window (default 90 days) and tightened to options.since on incremental syncs.
48
+ - `name`: Incident title.
49
+ - `status`: Realtime status (investigating | identified | monitoring | resolved | postmortem) or maintenance status (scheduled | in_progress | verifying | completed).
50
+ - `impact`: Reported impact: none | maintenance | minor | major | critical.
51
+ - `componentIds`: Ids of components currently attached to the incident.
52
+ - `createdAt`: Incident creation timestamp (epoch ms).
53
+ - `resolvedAt`: Resolved timestamp (epoch ms), or null while the incident is open.
54
+ - `shortlink`: Public-facing short URL for the incident.
55
+ - **`statuspage_incident_update`** _(event)_ - Per-update transitions inside an incident timeline (each comment / status flip). Emitted at display_at (falling back to created_at).
56
+ - Endpoint: `GET /v1/pages/{page_id}/incidents`
57
+ - Derived from the inline incident_updates array on each incident; Statuspage does not expose a separate list endpoint.
58
+ - `updateId`: Incident-update id.
59
+ - `incidentId`: Parent incident id.
60
+ - `status`: Status the incident moved to at this update.
61
+ - `body`: Free-form message posted on the update.
62
+
63
+ ## Example
64
+
65
+ ```ts
66
+ import {
67
+ defineConfig,
68
+ defineDashboard,
69
+ defineMetric,
70
+ secret,
71
+ } from '@rawdash/core';
72
+
73
+ const statuspage = {
74
+ name: 'statuspage',
75
+ connectorId: 'statuspage',
76
+ config: {
77
+ apiKey: secret('STATUSPAGE_API_KEY'),
78
+ pageId: 'abc123def456',
79
+ },
80
+ };
81
+
82
+ export default defineConfig({
83
+ connectors: [statuspage],
84
+ dashboards: {
85
+ engineering: defineDashboard({
86
+ widgets: {
87
+ open_incidents: {
88
+ kind: 'stat',
89
+ title: 'Open incidents',
90
+ metric: defineMetric({
91
+ connector: statuspage,
92
+ shape: 'entity',
93
+ entityType: 'statuspage_incident',
94
+ fn: 'count',
95
+ filter: [{ field: 'status', op: 'neq', value: 'resolved' }],
96
+ }),
97
+ },
98
+ },
99
+ }),
100
+ },
101
+ });
102
+ ```
103
+
104
+ ## Rate limits
105
+
106
+ Statuspage rate-limits at roughly 1 request/second per page; this connector paginates sequentially and respects 429 Retry-After. The page size is 100.
107
+
108
+ ## Limitations
109
+
110
+ - Better Stack Uptime is a separate package and is tracked as a follow-up.
111
+ - Postmortem bodies, subscribers, metrics-provider configs, and template management are out of scope.
112
+ - Component groups are exposed via each component group_id but are not synced as separate entities.
113
+
114
+ ## Links
115
+
116
+ - [Rawdash docs](https://rawdash.dev/docs/connectors/)
117
+ - [Atlassian Statuspage API docs](https://developer.statuspage.io/)
118
+ - [GitHub](https://github.com/rawdash/rawdash)
119
+
120
+ ## License
121
+
122
+ Apache-2.0
@@ -0,0 +1,357 @@
1
+ import { BaseConnector, ConnectorContext, SyncOptions, StorageHandle, SyncResult, ConnectorDoc } from '@rawdash/core';
2
+ import { z } from 'zod';
3
+
4
+ declare const configFields: z.ZodObject<{
5
+ apiKey: z.ZodObject<{
6
+ $secret: z.ZodString;
7
+ }, z.core.$strip>;
8
+ pageId: z.ZodString;
9
+ resources: z.ZodOptional<z.ZodArray<z.ZodEnum<{
10
+ components: "components";
11
+ incidents: "incidents";
12
+ incident_updates: "incident_updates";
13
+ }>>>;
14
+ incidentLookbackDays: z.ZodOptional<z.ZodNumber>;
15
+ }, z.core.$strip>;
16
+ declare const doc: ConnectorDoc;
17
+ type StatuspageResource = 'components' | 'incidents' | 'incident_updates';
18
+ interface StatuspageSettings {
19
+ pageId: string;
20
+ resources?: readonly StatuspageResource[];
21
+ incidentLookbackDays?: number;
22
+ }
23
+ declare const statuspageCredentials: {
24
+ apiKey: {
25
+ description: string;
26
+ auth: "required";
27
+ };
28
+ };
29
+ type StatuspageCredentials = typeof statuspageCredentials;
30
+ declare const statuspageResources: {
31
+ readonly statuspage_component: {
32
+ readonly shape: "entity";
33
+ readonly description: "Statuspage components (the things on a status page that turn red), with current status, group membership, and whether they are hidden until degraded.";
34
+ readonly endpoint: "GET /v1/pages/{page_id}/components";
35
+ readonly fields: [{
36
+ readonly name: "name";
37
+ readonly description: "Component display name.";
38
+ }, {
39
+ readonly name: "status";
40
+ readonly description: "Current health: operational | under_maintenance | degraded_performance | partial_outage | major_outage.";
41
+ }, {
42
+ readonly name: "groupId";
43
+ readonly description: "Parent component-group id, or null if the component is top-level.";
44
+ }, {
45
+ readonly name: "group";
46
+ readonly description: "True if this row is itself a component group.";
47
+ }, {
48
+ readonly name: "showcase";
49
+ readonly description: "Whether the component is shown on the public page.";
50
+ }, {
51
+ readonly name: "onlyShowIfDegraded";
52
+ readonly description: "When true the component is hidden on the public page while operational.";
53
+ }, {
54
+ readonly name: "position";
55
+ readonly description: "Sort position within the page or group.";
56
+ }];
57
+ readonly responses: {
58
+ readonly components: z.ZodArray<z.ZodObject<{
59
+ id: z.ZodString;
60
+ page_id: z.ZodString;
61
+ group_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
62
+ name: z.ZodString;
63
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
64
+ status: z.ZodString;
65
+ position: z.ZodOptional<z.ZodNumber>;
66
+ showcase: z.ZodOptional<z.ZodBoolean>;
67
+ start_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
68
+ group: z.ZodOptional<z.ZodBoolean>;
69
+ only_show_if_degraded: z.ZodOptional<z.ZodBoolean>;
70
+ automation_email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
71
+ created_at: z.ZodOptional<z.ZodString>;
72
+ updated_at: z.ZodOptional<z.ZodString>;
73
+ }, z.core.$strip>>;
74
+ };
75
+ };
76
+ readonly statuspage_incident: {
77
+ readonly shape: "entity";
78
+ readonly description: "Statuspage incidents (realtime outages plus maintenance windows) with status, impact, affected components, and the created / monitoring / resolved timestamps.";
79
+ readonly endpoint: "GET /v1/pages/{page_id}/incidents";
80
+ readonly notes: "Returned newest-first by updated_at; bounded by the incident lookback window (default 90 days) and tightened to options.since on incremental syncs.";
81
+ readonly fields: [{
82
+ readonly name: "name";
83
+ readonly description: "Incident title.";
84
+ }, {
85
+ readonly name: "status";
86
+ readonly description: "Realtime status (investigating | identified | monitoring | resolved | postmortem) or maintenance status (scheduled | in_progress | verifying | completed).";
87
+ }, {
88
+ readonly name: "impact";
89
+ readonly description: "Reported impact: none | maintenance | minor | major | critical.";
90
+ }, {
91
+ readonly name: "componentIds";
92
+ readonly description: "Ids of components currently attached to the incident.";
93
+ }, {
94
+ readonly name: "createdAt";
95
+ readonly description: "Incident creation timestamp (epoch ms).";
96
+ }, {
97
+ readonly name: "resolvedAt";
98
+ readonly description: "Resolved timestamp (epoch ms), or null while the incident is open.";
99
+ }, {
100
+ readonly name: "shortlink";
101
+ readonly description: "Public-facing short URL for the incident.";
102
+ }];
103
+ readonly responses: {
104
+ readonly incidents: z.ZodArray<z.ZodObject<{
105
+ id: z.ZodString;
106
+ name: z.ZodString;
107
+ status: z.ZodString;
108
+ impact: z.ZodString;
109
+ page_id: z.ZodOptional<z.ZodString>;
110
+ shortlink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
111
+ created_at: z.ZodString;
112
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
113
+ monitoring_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
114
+ resolved_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
115
+ scheduled_for: z.ZodOptional<z.ZodNullable<z.ZodString>>;
116
+ scheduled_until: z.ZodOptional<z.ZodNullable<z.ZodString>>;
117
+ components: z.ZodOptional<z.ZodArray<z.ZodObject<{
118
+ id: z.ZodString;
119
+ name: z.ZodOptional<z.ZodString>;
120
+ status: z.ZodOptional<z.ZodString>;
121
+ }, z.core.$strip>>>;
122
+ incident_updates: z.ZodOptional<z.ZodArray<z.ZodObject<{
123
+ id: z.ZodString;
124
+ incident_id: z.ZodString;
125
+ status: z.ZodString;
126
+ body: z.ZodString;
127
+ display_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
128
+ created_at: z.ZodString;
129
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
130
+ affected_components: z.ZodOptional<z.ZodUnknown>;
131
+ }, z.core.$strip>>>;
132
+ }, z.core.$strip>>;
133
+ };
134
+ };
135
+ readonly statuspage_incident_update: {
136
+ readonly shape: "event";
137
+ readonly description: "Per-update transitions inside an incident timeline (each comment / status flip). Emitted at display_at (falling back to created_at).";
138
+ readonly endpoint: "GET /v1/pages/{page_id}/incidents";
139
+ readonly notes: "Derived from the inline incident_updates array on each incident; Statuspage does not expose a separate list endpoint.";
140
+ readonly fields: [{
141
+ readonly name: "updateId";
142
+ readonly description: "Incident-update id.";
143
+ }, {
144
+ readonly name: "incidentId";
145
+ readonly description: "Parent incident id.";
146
+ }, {
147
+ readonly name: "status";
148
+ readonly description: "Status the incident moved to at this update.";
149
+ }, {
150
+ readonly name: "body";
151
+ readonly description: "Free-form message posted on the update.";
152
+ }];
153
+ };
154
+ };
155
+ declare const id = "statuspage";
156
+ declare class StatuspageConnector extends BaseConnector<StatuspageSettings, StatuspageCredentials> {
157
+ static readonly id = "statuspage";
158
+ static readonly resources: {
159
+ readonly statuspage_component: {
160
+ readonly shape: "entity";
161
+ readonly description: "Statuspage components (the things on a status page that turn red), with current status, group membership, and whether they are hidden until degraded.";
162
+ readonly endpoint: "GET /v1/pages/{page_id}/components";
163
+ readonly fields: [{
164
+ readonly name: "name";
165
+ readonly description: "Component display name.";
166
+ }, {
167
+ readonly name: "status";
168
+ readonly description: "Current health: operational | under_maintenance | degraded_performance | partial_outage | major_outage.";
169
+ }, {
170
+ readonly name: "groupId";
171
+ readonly description: "Parent component-group id, or null if the component is top-level.";
172
+ }, {
173
+ readonly name: "group";
174
+ readonly description: "True if this row is itself a component group.";
175
+ }, {
176
+ readonly name: "showcase";
177
+ readonly description: "Whether the component is shown on the public page.";
178
+ }, {
179
+ readonly name: "onlyShowIfDegraded";
180
+ readonly description: "When true the component is hidden on the public page while operational.";
181
+ }, {
182
+ readonly name: "position";
183
+ readonly description: "Sort position within the page or group.";
184
+ }];
185
+ readonly responses: {
186
+ readonly components: z.ZodArray<z.ZodObject<{
187
+ id: z.ZodString;
188
+ page_id: z.ZodString;
189
+ group_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
190
+ name: z.ZodString;
191
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
192
+ status: z.ZodString;
193
+ position: z.ZodOptional<z.ZodNumber>;
194
+ showcase: z.ZodOptional<z.ZodBoolean>;
195
+ start_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
196
+ group: z.ZodOptional<z.ZodBoolean>;
197
+ only_show_if_degraded: z.ZodOptional<z.ZodBoolean>;
198
+ automation_email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
199
+ created_at: z.ZodOptional<z.ZodString>;
200
+ updated_at: z.ZodOptional<z.ZodString>;
201
+ }, z.core.$strip>>;
202
+ };
203
+ };
204
+ readonly statuspage_incident: {
205
+ readonly shape: "entity";
206
+ readonly description: "Statuspage incidents (realtime outages plus maintenance windows) with status, impact, affected components, and the created / monitoring / resolved timestamps.";
207
+ readonly endpoint: "GET /v1/pages/{page_id}/incidents";
208
+ readonly notes: "Returned newest-first by updated_at; bounded by the incident lookback window (default 90 days) and tightened to options.since on incremental syncs.";
209
+ readonly fields: [{
210
+ readonly name: "name";
211
+ readonly description: "Incident title.";
212
+ }, {
213
+ readonly name: "status";
214
+ readonly description: "Realtime status (investigating | identified | monitoring | resolved | postmortem) or maintenance status (scheduled | in_progress | verifying | completed).";
215
+ }, {
216
+ readonly name: "impact";
217
+ readonly description: "Reported impact: none | maintenance | minor | major | critical.";
218
+ }, {
219
+ readonly name: "componentIds";
220
+ readonly description: "Ids of components currently attached to the incident.";
221
+ }, {
222
+ readonly name: "createdAt";
223
+ readonly description: "Incident creation timestamp (epoch ms).";
224
+ }, {
225
+ readonly name: "resolvedAt";
226
+ readonly description: "Resolved timestamp (epoch ms), or null while the incident is open.";
227
+ }, {
228
+ readonly name: "shortlink";
229
+ readonly description: "Public-facing short URL for the incident.";
230
+ }];
231
+ readonly responses: {
232
+ readonly incidents: z.ZodArray<z.ZodObject<{
233
+ id: z.ZodString;
234
+ name: z.ZodString;
235
+ status: z.ZodString;
236
+ impact: z.ZodString;
237
+ page_id: z.ZodOptional<z.ZodString>;
238
+ shortlink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
239
+ created_at: z.ZodString;
240
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
241
+ monitoring_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
242
+ resolved_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
243
+ scheduled_for: z.ZodOptional<z.ZodNullable<z.ZodString>>;
244
+ scheduled_until: z.ZodOptional<z.ZodNullable<z.ZodString>>;
245
+ components: z.ZodOptional<z.ZodArray<z.ZodObject<{
246
+ id: z.ZodString;
247
+ name: z.ZodOptional<z.ZodString>;
248
+ status: z.ZodOptional<z.ZodString>;
249
+ }, z.core.$strip>>>;
250
+ incident_updates: z.ZodOptional<z.ZodArray<z.ZodObject<{
251
+ id: z.ZodString;
252
+ incident_id: z.ZodString;
253
+ status: z.ZodString;
254
+ body: z.ZodString;
255
+ display_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
256
+ created_at: z.ZodString;
257
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
258
+ affected_components: z.ZodOptional<z.ZodUnknown>;
259
+ }, z.core.$strip>>>;
260
+ }, z.core.$strip>>;
261
+ };
262
+ };
263
+ readonly statuspage_incident_update: {
264
+ readonly shape: "event";
265
+ readonly description: "Per-update transitions inside an incident timeline (each comment / status flip). Emitted at display_at (falling back to created_at).";
266
+ readonly endpoint: "GET /v1/pages/{page_id}/incidents";
267
+ readonly notes: "Derived from the inline incident_updates array on each incident; Statuspage does not expose a separate list endpoint.";
268
+ readonly fields: [{
269
+ readonly name: "updateId";
270
+ readonly description: "Incident-update id.";
271
+ }, {
272
+ readonly name: "incidentId";
273
+ readonly description: "Parent incident id.";
274
+ }, {
275
+ readonly name: "status";
276
+ readonly description: "Status the incident moved to at this update.";
277
+ }, {
278
+ readonly name: "body";
279
+ readonly description: "Free-form message posted on the update.";
280
+ }];
281
+ };
282
+ };
283
+ static readonly schemas: object & {
284
+ readonly components: z.ZodArray<z.ZodObject<{
285
+ id: z.ZodString;
286
+ page_id: z.ZodString;
287
+ group_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
288
+ name: z.ZodString;
289
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
290
+ status: z.ZodString;
291
+ position: z.ZodOptional<z.ZodNumber>;
292
+ showcase: z.ZodOptional<z.ZodBoolean>;
293
+ start_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
294
+ group: z.ZodOptional<z.ZodBoolean>;
295
+ only_show_if_degraded: z.ZodOptional<z.ZodBoolean>;
296
+ automation_email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
297
+ created_at: z.ZodOptional<z.ZodString>;
298
+ updated_at: z.ZodOptional<z.ZodString>;
299
+ }, z.core.$strip>>;
300
+ } & {
301
+ readonly incidents: z.ZodArray<z.ZodObject<{
302
+ id: z.ZodString;
303
+ name: z.ZodString;
304
+ status: z.ZodString;
305
+ impact: z.ZodString;
306
+ page_id: z.ZodOptional<z.ZodString>;
307
+ shortlink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
308
+ created_at: z.ZodString;
309
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
310
+ monitoring_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
311
+ resolved_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
312
+ scheduled_for: z.ZodOptional<z.ZodNullable<z.ZodString>>;
313
+ scheduled_until: z.ZodOptional<z.ZodNullable<z.ZodString>>;
314
+ components: z.ZodOptional<z.ZodArray<z.ZodObject<{
315
+ id: z.ZodString;
316
+ name: z.ZodOptional<z.ZodString>;
317
+ status: z.ZodOptional<z.ZodString>;
318
+ }, z.core.$strip>>>;
319
+ incident_updates: z.ZodOptional<z.ZodArray<z.ZodObject<{
320
+ id: z.ZodString;
321
+ incident_id: z.ZodString;
322
+ status: z.ZodString;
323
+ body: z.ZodString;
324
+ display_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
325
+ created_at: z.ZodString;
326
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
327
+ affected_components: z.ZodOptional<z.ZodUnknown>;
328
+ }, z.core.$strip>>>;
329
+ }, z.core.$strip>>;
330
+ } & Readonly<Record<string, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
331
+ static create(input: unknown, ctx?: ConnectorContext): StatuspageConnector;
332
+ readonly id = "statuspage";
333
+ readonly credentials: {
334
+ apiKey: {
335
+ description: string;
336
+ auth: "required";
337
+ };
338
+ };
339
+ private buildHeaders;
340
+ private fetch;
341
+ private activePhases;
342
+ private allowedPagePath;
343
+ private sanitizePageUrl;
344
+ private resolveCursor;
345
+ private buildInitialUrl;
346
+ private buildNextPageUrl;
347
+ private computeIncidentSinceMs;
348
+ private fetchComponentsPage;
349
+ private fetchIncidentsPage;
350
+ private parseTimestampMs;
351
+ private writeComponents;
352
+ private writeIncidents;
353
+ private writeIncidentUpdates;
354
+ sync(options: SyncOptions, storage: StorageHandle, signal?: AbortSignal): Promise<SyncResult>;
355
+ }
356
+
357
+ export { StatuspageConnector, type StatuspageResource, type StatuspageSettings, configFields, StatuspageConnector as default, doc, id, statuspageResources as resources };
package/dist/index.js ADDED
@@ -0,0 +1,571 @@
1
+ // ../../connector-shared/dist/index.js
2
+ var HTTP_CLIENT_VERSION = "0.0.0";
3
+ var DEFAULT_USER_AGENT = `rawdash-connector/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;
4
+ function connectorUserAgent(connectorId) {
5
+ return `rawdash-connector-${connectorId}/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;
6
+ }
7
+ function sanitizeAllowedUrl(options) {
8
+ const { url, host, pathname, protocol = "https:" } = options;
9
+ if (url === null) {
10
+ return null;
11
+ }
12
+ try {
13
+ const u = new URL(url);
14
+ if (u.protocol !== protocol || u.host !== host || u.pathname !== pathname) {
15
+ return null;
16
+ }
17
+ return u.toString();
18
+ } catch {
19
+ return null;
20
+ }
21
+ }
22
+ function parseEpoch(value, unit) {
23
+ if (value === null || value === void 0) {
24
+ return null;
25
+ }
26
+ if (unit === "iso") {
27
+ if (typeof value !== "string") {
28
+ return null;
29
+ }
30
+ const ms = new Date(value).getTime();
31
+ return Number.isFinite(ms) ? ms : null;
32
+ }
33
+ if (typeof value === "string" && value.trim() === "") {
34
+ return null;
35
+ }
36
+ const n = typeof value === "number" ? value : Number(value);
37
+ if (!Number.isFinite(n)) {
38
+ return null;
39
+ }
40
+ const result = unit === "s" ? n * 1e3 : n;
41
+ return Number.isFinite(result) ? result : null;
42
+ }
43
+
44
+ // src/statuspage.ts
45
+ import {
46
+ BaseConnector,
47
+ defineConfigFields,
48
+ defineConnectorDoc,
49
+ defineResources,
50
+ makeChunkedCursorGuard,
51
+ paginateChunked,
52
+ schemasFromResources,
53
+ selectActivePhases
54
+ } from "@rawdash/core";
55
+ import { z } from "zod";
56
+ var configFields = defineConfigFields(
57
+ z.object({
58
+ apiKey: z.object({ $secret: z.string() }).meta({
59
+ label: "API Key",
60
+ description: "Statuspage REST API key. Create one at Manage Account -> API Info -> API Key.",
61
+ placeholder: "sk_live_...",
62
+ secret: true
63
+ }),
64
+ pageId: z.string().trim().regex(/^[A-Za-z0-9]{12}$/, "Page ID must be 12 alphanumeric characters.").meta({
65
+ label: "Page ID",
66
+ description: "Statuspage page id (the 12-character identifier shown next to your page name in Manage Account -> API Info, also visible in the admin URL).",
67
+ placeholder: "abc123def456"
68
+ }),
69
+ resources: z.array(z.enum(["components", "incidents", "incident_updates"])).nonempty().optional().meta({
70
+ label: "Resources",
71
+ description: "Which Statuspage resources to sync. Omit to sync all of them. 'incident_updates' rides the 'incidents' phase - enabling it without 'incidents' still fetches incidents but skips writing incident entities."
72
+ }),
73
+ incidentLookbackDays: z.number().int().positive().max(365).optional().meta({
74
+ label: "Incident lookback (days)",
75
+ description: "How many days back to fetch incidents (and their updates) on a full sync. Defaults to 90. Statuspage returns incidents newest-first; this caps the backfill window.",
76
+ placeholder: "90"
77
+ })
78
+ })
79
+ );
80
+ var doc = defineConnectorDoc({
81
+ displayName: "Statuspage",
82
+ category: "engineering",
83
+ brandColor: "#172B4D",
84
+ tagline: "Sync Atlassian Statuspage components, incidents, and incident updates - current component health, recent incident history, and per-update status transitions.",
85
+ vendor: {
86
+ name: "Atlassian Statuspage",
87
+ apiDocs: "https://developer.statuspage.io/",
88
+ website: "https://www.atlassian.com/software/statuspage"
89
+ },
90
+ auth: {
91
+ summary: "A Statuspage REST API key is required. Keys are scoped to the issuing account and inherit that account read access; a read-only role is sufficient for the resources synced here.",
92
+ setup: [
93
+ "Open Statuspage -> Manage Account -> API Info.",
94
+ "Copy the API Key (or generate one if none exists).",
95
+ 'Store the key as a secret and reference it from the connector config as `apiKey: secret("STATUSPAGE_API_KEY")`.',
96
+ "Set `pageId` to your 12-character Page ID (shown on the same screen, e.g. `abc123def456`)."
97
+ ]
98
+ },
99
+ rateLimit: "Statuspage rate-limits at roughly 1 request/second per page; this connector paginates sequentially and respects 429 Retry-After. The page size is 100.",
100
+ limitations: [
101
+ "Better Stack Uptime is a separate package and is tracked as a follow-up.",
102
+ "Postmortem bodies, subscribers, metrics-provider configs, and template management are out of scope.",
103
+ "Component groups are exposed via each component group_id but are not synced as separate entities."
104
+ ]
105
+ });
106
+ var statuspageCredentials = {
107
+ apiKey: {
108
+ description: "Statuspage REST API key",
109
+ auth: "required"
110
+ }
111
+ };
112
+ var PHASE_ORDER = ["components", "incidents"];
113
+ var isStatuspageSyncCursor = makeChunkedCursorGuard(PHASE_ORDER);
114
+ var idString = z.string().min(1);
115
+ var componentSchema = z.object({
116
+ id: idString,
117
+ page_id: idString,
118
+ group_id: z.string().nullable().optional(),
119
+ name: z.string(),
120
+ description: z.string().nullable().optional(),
121
+ status: z.string(),
122
+ position: z.number().int().nonnegative().optional(),
123
+ showcase: z.boolean().optional(),
124
+ start_date: z.string().nullable().optional(),
125
+ group: z.boolean().optional(),
126
+ only_show_if_degraded: z.boolean().optional(),
127
+ automation_email: z.string().nullable().optional(),
128
+ created_at: z.string().optional(),
129
+ updated_at: z.string().optional()
130
+ });
131
+ var componentsResponseSchema = z.array(componentSchema);
132
+ var incidentUpdateSchema = z.object({
133
+ id: idString,
134
+ incident_id: idString,
135
+ status: z.string(),
136
+ body: z.string(),
137
+ display_at: z.string().nullable().optional(),
138
+ created_at: z.string(),
139
+ updated_at: z.string().nullable().optional(),
140
+ affected_components: z.unknown().optional()
141
+ });
142
+ var incidentSchema = z.object({
143
+ id: idString,
144
+ name: z.string(),
145
+ status: z.string(),
146
+ impact: z.string(),
147
+ page_id: z.string().optional(),
148
+ shortlink: z.string().nullable().optional(),
149
+ created_at: z.string(),
150
+ updated_at: z.string().nullable().optional(),
151
+ monitoring_at: z.string().nullable().optional(),
152
+ resolved_at: z.string().nullable().optional(),
153
+ scheduled_for: z.string().nullable().optional(),
154
+ scheduled_until: z.string().nullable().optional(),
155
+ components: z.array(
156
+ z.object({
157
+ id: idString,
158
+ name: z.string().optional(),
159
+ status: z.string().optional()
160
+ })
161
+ ).optional(),
162
+ incident_updates: z.array(incidentUpdateSchema).optional()
163
+ });
164
+ var incidentsResponseSchema = z.array(incidentSchema);
165
+ var statuspageResources = defineResources({
166
+ statuspage_component: {
167
+ shape: "entity",
168
+ description: "Statuspage components (the things on a status page that turn red), with current status, group membership, and whether they are hidden until degraded.",
169
+ endpoint: "GET /v1/pages/{page_id}/components",
170
+ fields: [
171
+ { name: "name", description: "Component display name." },
172
+ {
173
+ name: "status",
174
+ description: "Current health: operational | under_maintenance | degraded_performance | partial_outage | major_outage."
175
+ },
176
+ {
177
+ name: "groupId",
178
+ description: "Parent component-group id, or null if the component is top-level."
179
+ },
180
+ {
181
+ name: "group",
182
+ description: "True if this row is itself a component group."
183
+ },
184
+ {
185
+ name: "showcase",
186
+ description: "Whether the component is shown on the public page."
187
+ },
188
+ {
189
+ name: "onlyShowIfDegraded",
190
+ description: "When true the component is hidden on the public page while operational."
191
+ },
192
+ {
193
+ name: "position",
194
+ description: "Sort position within the page or group."
195
+ }
196
+ ],
197
+ responses: { components: componentsResponseSchema }
198
+ },
199
+ statuspage_incident: {
200
+ shape: "entity",
201
+ description: "Statuspage incidents (realtime outages plus maintenance windows) with status, impact, affected components, and the created / monitoring / resolved timestamps.",
202
+ endpoint: "GET /v1/pages/{page_id}/incidents",
203
+ notes: "Returned newest-first by updated_at; bounded by the incident lookback window (default 90 days) and tightened to options.since on incremental syncs.",
204
+ fields: [
205
+ { name: "name", description: "Incident title." },
206
+ {
207
+ name: "status",
208
+ description: "Realtime status (investigating | identified | monitoring | resolved | postmortem) or maintenance status (scheduled | in_progress | verifying | completed)."
209
+ },
210
+ {
211
+ name: "impact",
212
+ description: "Reported impact: none | maintenance | minor | major | critical."
213
+ },
214
+ {
215
+ name: "componentIds",
216
+ description: "Ids of components currently attached to the incident."
217
+ },
218
+ {
219
+ name: "createdAt",
220
+ description: "Incident creation timestamp (epoch ms)."
221
+ },
222
+ {
223
+ name: "resolvedAt",
224
+ description: "Resolved timestamp (epoch ms), or null while the incident is open."
225
+ },
226
+ {
227
+ name: "shortlink",
228
+ description: "Public-facing short URL for the incident."
229
+ }
230
+ ],
231
+ responses: { incidents: incidentsResponseSchema }
232
+ },
233
+ statuspage_incident_update: {
234
+ shape: "event",
235
+ description: "Per-update transitions inside an incident timeline (each comment / status flip). Emitted at display_at (falling back to created_at).",
236
+ endpoint: "GET /v1/pages/{page_id}/incidents",
237
+ notes: "Derived from the inline incident_updates array on each incident; Statuspage does not expose a separate list endpoint.",
238
+ fields: [
239
+ { name: "updateId", description: "Incident-update id." },
240
+ {
241
+ name: "incidentId",
242
+ description: "Parent incident id."
243
+ },
244
+ {
245
+ name: "status",
246
+ description: "Status the incident moved to at this update."
247
+ },
248
+ {
249
+ name: "body",
250
+ description: "Free-form message posted on the update."
251
+ }
252
+ ]
253
+ }
254
+ });
255
+ var SP_API_HOST = "api.statuspage.io";
256
+ var SP_API_BASE = `https://${SP_API_HOST}`;
257
+ var PAGE_SIZE = 100;
258
+ var DEFAULT_INCIDENT_LOOKBACK_DAYS = 90;
259
+ var MS_PER_DAY = 24 * 60 * 60 * 1e3;
260
+ var id = "statuspage";
261
+ var StatuspageConnector = class _StatuspageConnector extends BaseConnector {
262
+ static id = id;
263
+ static resources = statuspageResources;
264
+ static schemas = schemasFromResources(statuspageResources);
265
+ static create(input, ctx) {
266
+ const parsed = configFields.parse(input);
267
+ return new _StatuspageConnector(
268
+ {
269
+ pageId: parsed.pageId,
270
+ resources: parsed.resources,
271
+ incidentLookbackDays: parsed.incidentLookbackDays
272
+ },
273
+ { apiKey: parsed.apiKey },
274
+ ctx
275
+ );
276
+ }
277
+ id = id;
278
+ credentials = statuspageCredentials;
279
+ buildHeaders() {
280
+ return {
281
+ Authorization: `OAuth ${this.creds.apiKey}`,
282
+ Accept: "application/json",
283
+ "User-Agent": connectorUserAgent("statuspage")
284
+ };
285
+ }
286
+ fetch(url, resource, signal) {
287
+ return this.get(url, {
288
+ resource,
289
+ headers: this.buildHeaders(),
290
+ signal
291
+ });
292
+ }
293
+ // -------------------------------------------------------------------------
294
+ // Resource enablement
295
+ // -------------------------------------------------------------------------
296
+ activePhases() {
297
+ return selectActivePhases(
298
+ (r) => {
299
+ switch (r) {
300
+ case "components":
301
+ return "components";
302
+ case "incidents":
303
+ case "incident_updates":
304
+ return "incidents";
305
+ }
306
+ },
307
+ PHASE_ORDER,
308
+ this.settings.resources
309
+ );
310
+ }
311
+ // -------------------------------------------------------------------------
312
+ // URL building + sanitization
313
+ // -------------------------------------------------------------------------
314
+ allowedPagePath(phase) {
315
+ switch (phase) {
316
+ case "components":
317
+ return `/v1/pages/${this.settings.pageId}/components`;
318
+ case "incidents":
319
+ return `/v1/pages/${this.settings.pageId}/incidents`;
320
+ }
321
+ }
322
+ sanitizePageUrl(phase, pageUrl) {
323
+ if (pageUrl === null) {
324
+ return null;
325
+ }
326
+ return sanitizeAllowedUrl({
327
+ url: pageUrl,
328
+ host: SP_API_HOST,
329
+ pathname: this.allowedPagePath(phase)
330
+ });
331
+ }
332
+ resolveCursor(cursor) {
333
+ if (!isStatuspageSyncCursor(cursor)) {
334
+ return void 0;
335
+ }
336
+ return {
337
+ phase: cursor.phase,
338
+ page: this.sanitizePageUrl(cursor.phase, cursor.page)
339
+ };
340
+ }
341
+ buildInitialUrl(phase) {
342
+ const u = new URL(`${SP_API_BASE}${this.allowedPagePath(phase)}`);
343
+ u.searchParams.set("page", "1");
344
+ u.searchParams.set("per_page", String(PAGE_SIZE));
345
+ return u.toString();
346
+ }
347
+ buildNextPageUrl(phase, currentUrl) {
348
+ let u;
349
+ try {
350
+ u = new URL(currentUrl);
351
+ } catch {
352
+ return null;
353
+ }
354
+ const pageRaw = u.searchParams.get("page");
355
+ const pageNum = pageRaw === null ? 1 : Number.parseInt(pageRaw, 10);
356
+ if (!Number.isFinite(pageNum) || pageNum < 1) {
357
+ return null;
358
+ }
359
+ u.searchParams.set("page", String(pageNum + 1));
360
+ u.searchParams.set("per_page", String(PAGE_SIZE));
361
+ return this.sanitizePageUrl(phase, u.toString());
362
+ }
363
+ computeIncidentSinceMs(options) {
364
+ if (options.since) {
365
+ const ms = parseEpoch(options.since, "iso");
366
+ if (ms !== null) {
367
+ return ms;
368
+ }
369
+ }
370
+ const days = this.settings.incidentLookbackDays ?? DEFAULT_INCIDENT_LOOKBACK_DAYS;
371
+ return Date.now() - days * MS_PER_DAY;
372
+ }
373
+ // -------------------------------------------------------------------------
374
+ // Fetchers
375
+ // -------------------------------------------------------------------------
376
+ async fetchComponentsPage(page, signal) {
377
+ const url = page ?? this.buildInitialUrl("components");
378
+ const res = await this.fetch(url, "components", signal);
379
+ const items = res.body;
380
+ const next = items.length < PAGE_SIZE ? null : this.buildNextPageUrl("components", url);
381
+ return { items, next };
382
+ }
383
+ async fetchIncidentsPage(page, options, signal) {
384
+ const url = page ?? this.buildInitialUrl("incidents");
385
+ const res = await this.fetch(url, "incidents", signal);
386
+ const incidents = res.body;
387
+ const sinceMs = this.computeIncidentSinceMs(options);
388
+ const incidentTimestampMs = (inc) => {
389
+ const stamp = inc.updated_at ?? inc.created_at;
390
+ const ms = stamp ? Date.parse(stamp) : Number.NaN;
391
+ return Number.isFinite(ms) ? ms : null;
392
+ };
393
+ const last = incidents.at(-1);
394
+ const lastMs = last ? incidentTimestampMs(last) : null;
395
+ const cutoffReached = lastMs !== null && lastMs < sinceMs;
396
+ const filtered = incidents.filter((inc) => {
397
+ const ms = incidentTimestampMs(inc);
398
+ return ms === null ? true : ms >= sinceMs;
399
+ });
400
+ const next = cutoffReached || incidents.length < PAGE_SIZE ? null : this.buildNextPageUrl("incidents", url);
401
+ return {
402
+ items: filtered.map((incident) => ({ incident })),
403
+ next
404
+ };
405
+ }
406
+ // -------------------------------------------------------------------------
407
+ // Writers
408
+ // -------------------------------------------------------------------------
409
+ parseTimestampMs(stamp) {
410
+ if (!stamp) {
411
+ return null;
412
+ }
413
+ const ms = Date.parse(stamp);
414
+ return Number.isFinite(ms) ? ms : null;
415
+ }
416
+ async writeComponents(storage, components) {
417
+ for (const c of components) {
418
+ const updatedAt = this.parseTimestampMs(c.updated_at) ?? this.parseTimestampMs(c.created_at) ?? Date.now();
419
+ await storage.entity({
420
+ type: "statuspage_component",
421
+ id: c.id,
422
+ attributes: {
423
+ name: c.name,
424
+ description: c.description ?? null,
425
+ status: c.status,
426
+ groupId: c.group_id ?? null,
427
+ group: c.group ?? false,
428
+ showcase: c.showcase ?? false,
429
+ onlyShowIfDegraded: c.only_show_if_degraded ?? false,
430
+ position: c.position ?? null,
431
+ startDate: c.start_date ?? null,
432
+ createdAt: this.parseTimestampMs(c.created_at)
433
+ },
434
+ updated_at: updatedAt
435
+ });
436
+ }
437
+ }
438
+ async writeIncidents(storage, items) {
439
+ for (const { incident } of items) {
440
+ const createdAtMs = this.parseTimestampMs(incident.created_at);
441
+ const updatedAtMs = this.parseTimestampMs(incident.updated_at);
442
+ const resolvedAtMs = this.parseTimestampMs(incident.resolved_at);
443
+ const monitoringAtMs = this.parseTimestampMs(incident.monitoring_at);
444
+ const componentIds = (incident.components ?? []).map((c) => c.id);
445
+ const componentSummary = {};
446
+ for (const c of incident.components ?? []) {
447
+ componentSummary[c.id] = {
448
+ name: c.name ?? null,
449
+ status: c.status ?? null
450
+ };
451
+ }
452
+ await storage.entity({
453
+ type: "statuspage_incident",
454
+ id: incident.id,
455
+ attributes: {
456
+ name: incident.name,
457
+ status: incident.status,
458
+ impact: incident.impact,
459
+ componentIds,
460
+ components: componentSummary,
461
+ createdAt: createdAtMs,
462
+ monitoringAt: monitoringAtMs,
463
+ resolvedAt: resolvedAtMs,
464
+ scheduledFor: this.parseTimestampMs(incident.scheduled_for),
465
+ scheduledUntil: this.parseTimestampMs(incident.scheduled_until),
466
+ shortlink: incident.shortlink ?? null
467
+ },
468
+ updated_at: updatedAtMs ?? createdAtMs ?? Date.now()
469
+ });
470
+ }
471
+ }
472
+ async writeIncidentUpdates(storage, items, sinceMs) {
473
+ for (const { incident } of items) {
474
+ for (const upd of incident.incident_updates ?? []) {
475
+ const tsMs = this.parseTimestampMs(upd.display_at) ?? this.parseTimestampMs(upd.created_at);
476
+ if (tsMs === null || tsMs < sinceMs) {
477
+ continue;
478
+ }
479
+ await storage.event({
480
+ name: "statuspage_incident_update",
481
+ start_ts: tsMs,
482
+ end_ts: null,
483
+ attributes: {
484
+ updateId: upd.id,
485
+ incidentId: upd.incident_id,
486
+ incidentName: incident.name,
487
+ status: upd.status,
488
+ body: upd.body
489
+ }
490
+ });
491
+ }
492
+ }
493
+ }
494
+ // -------------------------------------------------------------------------
495
+ // sync
496
+ // -------------------------------------------------------------------------
497
+ async sync(options, storage, signal) {
498
+ const cursor = this.resolveCursor(options.cursor);
499
+ const isFull = options.mode === "full";
500
+ const phases = this.activePhases();
501
+ const incidentSinceMs = this.computeIncidentSinceMs(options);
502
+ return paginateChunked({
503
+ phases,
504
+ cursor,
505
+ signal,
506
+ logger: this.logger,
507
+ fetchPage: async (phase, page, sig) => {
508
+ switch (phase) {
509
+ case "components":
510
+ return this.fetchComponentsPage(page, sig);
511
+ case "incidents":
512
+ return this.fetchIncidentsPage(page, options, sig);
513
+ }
514
+ },
515
+ writeBatch: async (phase, items, page) => {
516
+ if (isFull && page === null) {
517
+ switch (phase) {
518
+ case "components":
519
+ if (this.isResourceEnabled("components")) {
520
+ await storage.entities([], {
521
+ types: ["statuspage_component"]
522
+ });
523
+ }
524
+ break;
525
+ case "incidents":
526
+ if (this.isResourceEnabled("incidents")) {
527
+ await storage.entities([], {
528
+ types: ["statuspage_incident"]
529
+ });
530
+ }
531
+ if (this.isResourceEnabled("incident_updates")) {
532
+ await storage.events([], {
533
+ names: ["statuspage_incident_update"]
534
+ });
535
+ }
536
+ break;
537
+ }
538
+ }
539
+ switch (phase) {
540
+ case "components":
541
+ if (!this.isResourceEnabled("components")) {
542
+ return;
543
+ }
544
+ return this.writeComponents(storage, items);
545
+ case "incidents": {
546
+ const batch = items;
547
+ if (this.isResourceEnabled("incidents")) {
548
+ await this.writeIncidents(storage, batch);
549
+ }
550
+ if (this.isResourceEnabled("incident_updates")) {
551
+ await this.writeIncidentUpdates(storage, batch, incidentSinceMs);
552
+ }
553
+ return;
554
+ }
555
+ }
556
+ }
557
+ });
558
+ }
559
+ };
560
+
561
+ // src/index.ts
562
+ var index_default = StatuspageConnector;
563
+ export {
564
+ StatuspageConnector,
565
+ configFields,
566
+ index_default as default,
567
+ doc,
568
+ id,
569
+ statuspageResources as resources
570
+ };
571
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../connector-shared/src/errors.ts","../../../connector-shared/src/retry.ts","../../../connector-shared/src/version.ts","../../../connector-shared/src/request.ts","../../../connector-shared/src/rate-limit.ts","../../../connector-shared/src/sanitize.ts","../../../connector-shared/src/epoch.ts","../../../connector-shared/src/pagination.ts","../../../connector-shared/src/logger.ts","../src/statuspage.ts","../src/index.ts"],"sourcesContent":["import type { HttpResponse } from './types';\n\nexport type HttpErrorKind =\n | 'transient'\n | 'rate_limit'\n | 'auth'\n | 'upstream_bug'\n | 'client_bug';\n\nexport abstract class HttpClientError extends Error {\n abstract readonly kind: HttpErrorKind;\n readonly response?: HttpResponse;\n\n constructor(message: string, response?: HttpResponse) {\n super(message);\n this.name = new.target.name;\n this.response = response;\n }\n}\n\nexport class TransientError extends HttpClientError {\n readonly kind = 'transient' as const;\n}\n\nexport class RateLimitError extends HttpClientError {\n readonly kind = 'rate_limit' as const;\n readonly retryAfter?: Date;\n\n constructor(message: string, response?: HttpResponse, retryAfter?: Date) {\n super(message, response);\n this.retryAfter = retryAfter;\n }\n}\n\nexport class AuthError extends HttpClientError {\n readonly kind = 'auth' as const;\n}\n\nexport class UpstreamBugError extends HttpClientError {\n readonly kind = 'upstream_bug' as const;\n}\n\nexport class ClientBugError extends HttpClientError {\n readonly kind = 'client_bug' as const;\n}\n\nexport function classifyStatus(status: number): HttpErrorKind {\n if (status === 429) {\n return 'rate_limit';\n }\n if (status === 401 || status === 403) {\n return 'auth';\n }\n if (status === 408) {\n return 'transient';\n }\n if (status >= 500) {\n return 'upstream_bug';\n }\n if (status >= 400) {\n return 'client_bug';\n }\n return 'client_bug';\n}\n\nexport function errorForStatus(\n message: string,\n response: HttpResponse,\n retryAfter?: Date,\n): HttpClientError {\n const kind = classifyStatus(response.status);\n switch (kind) {\n case 'rate_limit':\n return new RateLimitError(message, response, retryAfter);\n case 'auth':\n return new AuthError(message, response);\n case 'transient':\n return new TransientError(message, response);\n case 'upstream_bug':\n return new UpstreamBugError(message, response);\n case 'client_bug':\n return new ClientBugError(message, response);\n }\n}\n","import { HttpClientError, RateLimitError, TransientError } from './errors';\n\nexport interface RetryPolicy {\n maxAttempts?: number;\n initialDelayMs?: number;\n maxDelayMs?: number;\n retryOn?: (status: number | null, err?: Error) => boolean;\n}\n\nexport const defaultRetryOn = (status: number | null, err?: Error): boolean => {\n if (err instanceof RateLimitError) {\n return true;\n }\n if (err instanceof TransientError) {\n return true;\n }\n if (status === null) {\n return err instanceof Error && !(err instanceof HttpClientError);\n }\n if (status === 408 || status === 429) {\n return true;\n }\n if (status >= 500) {\n return true;\n }\n return false;\n};\n\nexport function backoffDelayMs(\n attempt: number,\n policy: Required<Pick<RetryPolicy, 'initialDelayMs' | 'maxDelayMs'>>,\n): number {\n const base = policy.initialDelayMs * 2 ** attempt;\n const jitter = base * 0.25 * Math.random();\n return Math.min(base + jitter, policy.maxDelayMs);\n}\n\nexport function parseRetryAfter(\n headerValue: string | null,\n now: Date = new Date(),\n): Date | undefined {\n if (!headerValue) {\n return undefined;\n }\n const trimmed = headerValue.trim();\n if (/^\\d+$/.test(trimmed)) {\n return new Date(now.getTime() + Number(trimmed) * 1000);\n }\n const parsed = Date.parse(trimmed);\n if (Number.isNaN(parsed)) {\n return undefined;\n }\n return new Date(parsed);\n}\n\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n if (signal?.aborted) {\n return Promise.reject(signal.reason ?? new Error('Aborted'));\n }\n return new Promise<void>((resolve, reject) => {\n const onAbort = () => {\n clearTimeout(timer);\n reject(signal!.reason ?? new Error('Aborted'));\n };\n const timer = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, ms);\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n}\n","export const HTTP_CLIENT_VERSION = '0.0.0';\n\nexport const DEFAULT_USER_AGENT = `rawdash-connector/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;\n\nexport function connectorUserAgent(connectorId: string): string {\n return `rawdash-connector-${connectorId}/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;\n}\n","import {\n AuthError,\n ClientBugError,\n HttpClientError,\n RateLimitError,\n TransientError,\n UpstreamBugError,\n errorForStatus,\n} from './errors';\nimport { defaultRetryOn, parseRetryAfter, sleep } from './retry';\nimport type { FetchLike, HttpMethod, HttpRequest, HttpResponse } from './types';\nimport { DEFAULT_USER_AGENT } from './version';\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\nconst DEFAULT_MAX_ATTEMPTS = 3;\nconst DEFAULT_INITIAL_DELAY_MS = 1000;\nconst DEFAULT_MAX_DELAY_MS = 60_000;\nconst OBSERVER_TIMEOUT_MS = 250;\n\nexport interface RequestObservation {\n url: string;\n method: HttpMethod;\n status: number;\n resource: string;\n requestId: string;\n body: unknown;\n}\n\nexport type RequestObserver = (\n event: RequestObservation,\n) => void | Promise<void>;\n\nexport interface RequestOptions {\n fetch?: FetchLike;\n observer?: RequestObserver;\n resource: string;\n requestId?: string;\n}\n\nasync function notifyObserver(\n observer: RequestObserver,\n event: RequestObservation,\n): Promise<void> {\n let result: void | Promise<void>;\n try {\n result = observer(event);\n } catch (err) {\n console.warn('[connector-shared] request observer threw:', err);\n return;\n }\n if (!(result instanceof Promise)) {\n return;\n }\n const guarded = result.catch((err) => {\n console.warn('[connector-shared] request observer rejected:', err);\n });\n let timer: ReturnType<typeof setTimeout> | undefined;\n const timeout = new Promise<void>((resolve) => {\n timer = setTimeout(resolve, OBSERVER_TIMEOUT_MS);\n });\n try {\n await Promise.race([guarded, timeout]);\n } finally {\n if (timer) {\n clearTimeout(timer);\n }\n }\n}\n\nfunction newRequestId(): string {\n const c = (globalThis as { crypto?: { randomUUID?: () => string } }).crypto;\n if (c?.randomUUID) {\n return c.randomUUID();\n }\n return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;\n}\n\nfunction mergeHeaders(\n defaults: Record<string, string>,\n overrides: Record<string, string> | undefined,\n): Record<string, string> {\n const merged: Record<string, string> = {};\n for (const [k, v] of Object.entries(defaults)) {\n merged[k.toLowerCase()] = v;\n }\n if (overrides) {\n for (const [k, v] of Object.entries(overrides)) {\n merged[k.toLowerCase()] = v;\n }\n }\n return merged;\n}\n\nfunction linkTimeoutSignal(\n parent: AbortSignal | undefined,\n timeoutMs: number,\n): { signal: AbortSignal; cancel: () => void } {\n const controller = new AbortController();\n const onParentAbort = () => {\n controller.abort(parent?.reason);\n };\n if (parent) {\n if (parent.aborted) {\n controller.abort(parent.reason);\n } else {\n parent.addEventListener('abort', onParentAbort, { once: true });\n }\n }\n const timer = setTimeout(() => {\n controller.abort(new Error(`Request timed out after ${timeoutMs}ms`));\n }, timeoutMs);\n return {\n signal: controller.signal,\n cancel: () => {\n clearTimeout(timer);\n if (parent) {\n parent.removeEventListener('abort', onParentAbort);\n }\n },\n };\n}\n\nasync function readBody(res: Response, parseJson: boolean): Promise<unknown> {\n if (res.status === 204 || res.status === 205) {\n return null;\n }\n const contentType = res.headers.get('content-type') ?? '';\n if (parseJson && contentType.includes('application/json')) {\n const text = await res.text();\n if (text.length === 0) {\n return null;\n }\n return JSON.parse(text);\n }\n return res.text();\n}\n\nexport async function request<T = unknown>(\n req: HttpRequest,\n options: RequestOptions,\n): Promise<HttpResponse<T>> {\n const fetchImpl: FetchLike = options.fetch ?? (globalThis.fetch as FetchLike);\n const retry = req.retry ?? {};\n const maxAttempts = retry.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;\n const initialDelayMs = retry.initialDelayMs ?? DEFAULT_INITIAL_DELAY_MS;\n const maxDelayMs = retry.maxDelayMs ?? DEFAULT_MAX_DELAY_MS;\n const retryOn = retry.retryOn ?? defaultRetryOn;\n const timeoutMs = req.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const parseJson = req.parseJson ?? true;\n\n const headers = mergeHeaders(\n {\n 'User-Agent': DEFAULT_USER_AGENT,\n Accept: 'application/json',\n },\n req.headers,\n );\n\n let lastErr: Error | undefined;\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n req.signal?.throwIfAborted();\n\n const { signal, cancel } = linkTimeoutSignal(req.signal, timeoutMs);\n let res: Response;\n try {\n res = await fetchImpl(req.url, {\n method: req.method ?? 'GET',\n headers,\n body: req.body as RequestInit['body'],\n signal,\n });\n } catch (err) {\n cancel();\n if (req.signal?.aborted) {\n throw req.signal.reason ?? err;\n }\n const error = err instanceof Error ? err : new Error(String(err));\n lastErr = error;\n if (attempt < maxAttempts - 1 && retryOn(null, error)) {\n const delay = computeDelay(attempt, initialDelayMs, maxDelayMs);\n await sleep(delay, req.signal);\n continue;\n }\n throw new TransientError(error.message);\n }\n cancel();\n\n const body = await readBody(res, parseJson);\n const httpResponse: HttpResponse<T> = {\n status: res.status,\n headers: res.headers,\n body: body as T,\n };\n if (req.rateLimit) {\n const state = req.rateLimit.parse(res.headers);\n if (state) {\n httpResponse.rateLimitState = state;\n }\n }\n\n if (options.observer) {\n await notifyObserver(options.observer, {\n url: req.url,\n method: req.method ?? 'GET',\n status: res.status,\n resource: options.resource,\n requestId: options.requestId ?? newRequestId(),\n body,\n });\n }\n\n if (res.ok) {\n return httpResponse;\n }\n\n const retryAfter = parseRetryAfter(res.headers.get('retry-after'));\n const message = `HTTP ${res.status} ${res.statusText} for ${req.method ?? 'GET'} ${req.url}`;\n const err = errorForStatus(message, httpResponse, retryAfter);\n\n if (\n attempt < maxAttempts - 1 &&\n retryOn(res.status, err) &&\n !(err instanceof AuthError) &&\n !(err instanceof ClientBugError)\n ) {\n lastErr = err;\n let delay = computeDelay(attempt, initialDelayMs, maxDelayMs);\n if (err instanceof RateLimitError && retryAfter) {\n const wait = retryAfter.getTime() - Date.now();\n if (wait > 0) {\n delay = Math.min(wait, maxDelayMs);\n }\n }\n await sleep(delay, req.signal);\n continue;\n }\n\n throw err;\n }\n\n throw lastErr ?? new UpstreamBugError('Exhausted retry attempts');\n}\n\nfunction computeDelay(\n attempt: number,\n initialDelayMs: number,\n maxDelayMs: number,\n): number {\n const base = initialDelayMs * 2 ** attempt;\n const jitter = base * 0.25 * Math.random();\n return Math.min(base + jitter, maxDelayMs);\n}\n\nexport { HttpClientError };\n","export interface RateLimitState {\n remaining: number;\n resetAt: Date;\n}\n\nexport interface RateLimitPolicy {\n parse(headers: Headers): RateLimitState | null;\n}\n\nexport interface StandardRateLimitPolicyConfig {\n remainingHeader: string;\n resetHeader: string;\n resetUnit: 's' | 'ms';\n resetFallbackMs?: number;\n}\n\nexport function standardRateLimitPolicy(\n config: StandardRateLimitPolicyConfig,\n): RateLimitPolicy {\n const { remainingHeader, resetHeader, resetUnit, resetFallbackMs } = config;\n const multiplier = resetUnit === 's' ? 1000 : 1;\n return {\n parse(h) {\n const remainingRaw = h.get(remainingHeader);\n if (remainingRaw === null || remainingRaw.trim() === '') {\n return null;\n }\n const remaining = Number(remainingRaw);\n if (!Number.isFinite(remaining)) {\n return null;\n }\n const resetRaw = h.get(resetHeader);\n if (resetRaw === null) {\n if (resetFallbackMs === undefined) {\n return null;\n }\n return {\n remaining,\n resetAt: new Date(Date.now() + resetFallbackMs),\n };\n }\n if (resetRaw.trim() === '') {\n return null;\n }\n const reset = Number(resetRaw);\n if (!Number.isFinite(reset) || reset < 0) {\n return null;\n }\n const resetMs = reset * multiplier;\n if (!Number.isFinite(resetMs)) {\n return null;\n }\n return { remaining, resetAt: new Date(resetMs) };\n },\n };\n}\n","export interface SanitizeAllowedUrlOptions {\n url: string | null;\n host: string;\n pathname: string;\n protocol?: 'https:' | 'http:';\n}\n\nexport function sanitizeAllowedUrl(\n options: SanitizeAllowedUrlOptions,\n): string | null {\n const { url, host, pathname, protocol = 'https:' } = options;\n if (url === null) {\n return null;\n }\n try {\n const u = new URL(url);\n if (u.protocol !== protocol || u.host !== host || u.pathname !== pathname) {\n return null;\n }\n return u.toString();\n } catch {\n return null;\n }\n}\n","export type EpochUnit = 'ms' | 's' | 'iso';\n\nexport function parseEpoch(\n value: number | string | null | undefined,\n unit: EpochUnit,\n): number | null {\n if (value === null || value === undefined) {\n return null;\n }\n if (unit === 'iso') {\n if (typeof value !== 'string') {\n return null;\n }\n const ms = new Date(value).getTime();\n return Number.isFinite(ms) ? ms : null;\n }\n if (typeof value === 'string' && value.trim() === '') {\n return null;\n }\n const n = typeof value === 'number' ? value : Number(value);\n if (!Number.isFinite(n)) {\n return null;\n }\n const result = unit === 's' ? n * 1000 : n;\n return Number.isFinite(result) ? result : null;\n}\n","import { request } from './request';\nimport type { HttpRequest } from './types';\n\nexport function parseLinkHeader(header: string | null): Record<string, string> {\n if (!header) {\n return {};\n }\n const result: Record<string, string> = {};\n for (const part of header.split(',')) {\n const match = part.match(/<([^>]+)>\\s*;\\s*rel=\"([^\"]+)\"/);\n if (match) {\n result[match[2]!] = match[1]!;\n }\n }\n return result;\n}\n\nexport async function* paginateLink<T>(\n initial: HttpRequest,\n parse: (body: unknown) => T[],\n options: { resource: string },\n): AsyncIterable<T> {\n let next: string | null = initial.url;\n while (next) {\n const res: Awaited<ReturnType<typeof request>> = await request(\n {\n ...initial,\n url: next,\n },\n { resource: options.resource },\n );\n for (const item of parse(res.body)) {\n yield item;\n }\n const links = parseLinkHeader(res.headers.get('link'));\n next = links['next'] ?? null;\n }\n}\n\nexport async function* paginateCursor<T>(\n initial: HttpRequest,\n parse: (body: unknown) => { items: T[]; nextCursor: string | null },\n buildNext: (req: HttpRequest, cursor: string) => HttpRequest,\n options: { resource: string },\n): AsyncIterable<T> {\n let req: HttpRequest = initial;\n while (true) {\n const res = await request(req, { resource: options.resource });\n const { items, nextCursor } = parse(res.body);\n for (const item of items) {\n yield item;\n }\n if (!nextCursor) {\n return;\n }\n req = buildNext(req, nextCursor);\n }\n}\n\nexport async function* paginatePage<T>(\n initial: HttpRequest,\n parse: (body: unknown) => { items: T[]; hasMore: boolean },\n buildPage: (req: HttpRequest, page: number) => HttpRequest,\n options: { resource: string },\n): AsyncIterable<T> {\n let page = 1;\n while (true) {\n const req = page === 1 ? initial : buildPage(initial, page);\n const res = await request(req, { resource: options.resource });\n const { items, hasMore } = parse(res.body);\n for (const item of items) {\n yield item;\n }\n if (!hasMore || items.length === 0) {\n return;\n }\n page++;\n }\n}\n","export type LogFields = Record<string, unknown>;\n\nexport interface ConnectorLogger {\n info(event: string, fields?: LogFields): void;\n warn(event: string, fields?: LogFields): void;\n}\n\nexport interface ConnectorLoggerOptions {\n scope: string;\n}\n\nconst MAX_VALUE_LEN = 120;\n\nfunction truncate(s: string, max = MAX_VALUE_LEN): string {\n if (s.length <= max) {\n return s;\n }\n return `${s.slice(0, max - 1)}…`;\n}\n\nfunction formatValue(value: unknown): string {\n if (value === null) {\n return 'null';\n }\n if (value === undefined) {\n return '';\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n if (typeof value === 'string') {\n const t = truncate(value);\n if (/[\\s\"=]/.test(t)) {\n return JSON.stringify(t);\n }\n return t;\n }\n if (typeof value === 'bigint') {\n return value.toString();\n }\n let json: string | undefined;\n try {\n json = JSON.stringify(value);\n } catch {\n json = undefined;\n }\n return truncate(json ?? String(value));\n}\n\nexport function formatLogFields(fields?: LogFields): string {\n if (!fields) {\n return '';\n }\n const parts: string[] = [];\n for (const [k, v] of Object.entries(fields)) {\n if (v === undefined) {\n continue;\n }\n parts.push(`${k}=${formatValue(v)}`);\n }\n return parts.length > 0 ? ` ${parts.join(' ')}` : '';\n}\n\nexport function formatLogLine(\n scope: string,\n event: string,\n fields?: LogFields,\n): string {\n return `[${scope}] ${event}${formatLogFields(fields)}`;\n}\n\nexport function createDefaultConnectorLogger(\n opts: ConnectorLoggerOptions,\n): ConnectorLogger {\n return {\n info(event, fields) {\n console.info(formatLogLine(opts.scope, event, fields));\n },\n warn(event, fields) {\n console.warn(formatLogLine(opts.scope, event, fields));\n },\n };\n}\n\nconst NOOP_LOGGER: ConnectorLogger = {\n info() {},\n warn() {},\n};\n\nexport function noopConnectorLogger(): ConnectorLogger {\n return NOOP_LOGGER;\n}\n","import {\n type HttpResponse,\n connectorUserAgent,\n parseEpoch,\n sanitizeAllowedUrl,\n} from '@rawdash/connector-shared';\nimport {\n BaseConnector,\n type ChunkedSyncCursor,\n type ConnectorContext,\n type ConnectorDoc,\n type CredentialsSchema,\n type JSONValue,\n type StorageHandle,\n type SyncOptions,\n type SyncResult,\n defineConfigFields,\n defineConnectorDoc,\n defineResources,\n makeChunkedCursorGuard,\n paginateChunked,\n schemasFromResources,\n selectActivePhases,\n} from '@rawdash/core';\nimport { z } from 'zod';\n\n// ---------------------------------------------------------------------------\n// configFields\n// ---------------------------------------------------------------------------\n\nexport const configFields = defineConfigFields(\n z.object({\n apiKey: z.object({ $secret: z.string() }).meta({\n label: 'API Key',\n description:\n 'Statuspage REST API key. Create one at Manage Account -> API Info -> API Key.',\n placeholder: 'sk_live_...',\n secret: true,\n }),\n pageId: z\n .string()\n .trim()\n .regex(/^[A-Za-z0-9]{12}$/, 'Page ID must be 12 alphanumeric characters.')\n .meta({\n label: 'Page ID',\n description:\n 'Statuspage page id (the 12-character identifier shown next to your page name in Manage Account -> API Info, also visible in the admin URL).',\n placeholder: 'abc123def456',\n }),\n resources: z\n .array(z.enum(['components', 'incidents', 'incident_updates']))\n .nonempty()\n .optional()\n .meta({\n label: 'Resources',\n description:\n \"Which Statuspage resources to sync. Omit to sync all of them. 'incident_updates' rides the 'incidents' phase - enabling it without 'incidents' still fetches incidents but skips writing incident entities.\",\n }),\n incidentLookbackDays: z.number().int().positive().max(365).optional().meta({\n label: 'Incident lookback (days)',\n description:\n 'How many days back to fetch incidents (and their updates) on a full sync. Defaults to 90. Statuspage returns incidents newest-first; this caps the backfill window.',\n placeholder: '90',\n }),\n }),\n);\n\nexport const doc: ConnectorDoc = defineConnectorDoc({\n displayName: 'Statuspage',\n category: 'engineering',\n brandColor: '#172B4D',\n tagline:\n 'Sync Atlassian Statuspage components, incidents, and incident updates - current component health, recent incident history, and per-update status transitions.',\n vendor: {\n name: 'Atlassian Statuspage',\n apiDocs: 'https://developer.statuspage.io/',\n website: 'https://www.atlassian.com/software/statuspage',\n },\n auth: {\n summary:\n 'A Statuspage REST API key is required. Keys are scoped to the issuing account and inherit that account read access; a read-only role is sufficient for the resources synced here.',\n setup: [\n 'Open Statuspage -> Manage Account -> API Info.',\n 'Copy the API Key (or generate one if none exists).',\n 'Store the key as a secret and reference it from the connector config as `apiKey: secret(\"STATUSPAGE_API_KEY\")`.',\n 'Set `pageId` to your 12-character Page ID (shown on the same screen, e.g. `abc123def456`).',\n ],\n },\n rateLimit:\n 'Statuspage rate-limits at roughly 1 request/second per page; this connector paginates sequentially and respects 429 Retry-After. The page size is 100.',\n limitations: [\n 'Better Stack Uptime is a separate package and is tracked as a follow-up.',\n 'Postmortem bodies, subscribers, metrics-provider configs, and template management are out of scope.',\n 'Component groups are exposed via each component group_id but are not synced as separate entities.',\n ],\n});\n\nexport type StatuspageResource =\n | 'components'\n | 'incidents'\n | 'incident_updates';\n\nexport interface StatuspageSettings {\n pageId: string;\n resources?: readonly StatuspageResource[];\n incidentLookbackDays?: number;\n}\n\nconst statuspageCredentials = {\n apiKey: {\n description: 'Statuspage REST API key',\n auth: 'required' as const,\n },\n} satisfies CredentialsSchema;\n\ntype StatuspageCredentials = typeof statuspageCredentials;\n\n// ---------------------------------------------------------------------------\n// Sync phases + cursor\n// ---------------------------------------------------------------------------\n\nconst PHASE_ORDER = ['components', 'incidents'] as const;\n\ntype StatuspagePhase = (typeof PHASE_ORDER)[number];\n\ntype StatuspageSyncCursor = ChunkedSyncCursor<StatuspagePhase, string>;\n\nconst isStatuspageSyncCursor = makeChunkedCursorGuard(PHASE_ORDER);\n\n// ---------------------------------------------------------------------------\n// Statuspage API types\n// ---------------------------------------------------------------------------\n\ninterface SPComponent {\n id: string;\n page_id: string;\n group_id?: string | null;\n name: string;\n description?: string | null;\n status: string;\n position?: number;\n showcase?: boolean;\n start_date?: string | null;\n group?: boolean;\n only_show_if_degraded?: boolean;\n automation_email?: string | null;\n created_at?: string;\n updated_at?: string;\n}\n\ninterface SPIncidentUpdate {\n id: string;\n incident_id: string;\n status: string;\n body: string;\n display_at?: string | null;\n created_at: string;\n updated_at?: string | null;\n affected_components?: unknown;\n}\n\ninterface SPIncident {\n id: string;\n name: string;\n status: string;\n impact: string;\n page_id?: string;\n shortlink?: string | null;\n created_at: string;\n updated_at?: string | null;\n monitoring_at?: string | null;\n resolved_at?: string | null;\n scheduled_for?: string | null;\n scheduled_until?: string | null;\n components?: Array<{ id: string; name?: string; status?: string }>;\n incident_updates?: SPIncidentUpdate[];\n}\n\n// ---------------------------------------------------------------------------\n// Schemas - describe the per-resource API response shape consumed by request()\n// ---------------------------------------------------------------------------\n\nconst idString = z.string().min(1);\n\nconst componentSchema = z.object({\n id: idString,\n page_id: idString,\n group_id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string().nullable().optional(),\n status: z.string(),\n position: z.number().int().nonnegative().optional(),\n showcase: z.boolean().optional(),\n start_date: z.string().nullable().optional(),\n group: z.boolean().optional(),\n only_show_if_degraded: z.boolean().optional(),\n automation_email: z.string().nullable().optional(),\n created_at: z.string().optional(),\n updated_at: z.string().optional(),\n});\n\nconst componentsResponseSchema = z.array(componentSchema);\n\nconst incidentUpdateSchema = z.object({\n id: idString,\n incident_id: idString,\n status: z.string(),\n body: z.string(),\n display_at: z.string().nullable().optional(),\n created_at: z.string(),\n updated_at: z.string().nullable().optional(),\n affected_components: z.unknown().optional(),\n});\n\nconst incidentSchema = z.object({\n id: idString,\n name: z.string(),\n status: z.string(),\n impact: z.string(),\n page_id: z.string().optional(),\n shortlink: z.string().nullable().optional(),\n created_at: z.string(),\n updated_at: z.string().nullable().optional(),\n monitoring_at: z.string().nullable().optional(),\n resolved_at: z.string().nullable().optional(),\n scheduled_for: z.string().nullable().optional(),\n scheduled_until: z.string().nullable().optional(),\n components: z\n .array(\n z.object({\n id: idString,\n name: z.string().optional(),\n status: z.string().optional(),\n }),\n )\n .optional(),\n incident_updates: z.array(incidentUpdateSchema).optional(),\n});\n\nconst incidentsResponseSchema = z.array(incidentSchema);\n\n// ---------------------------------------------------------------------------\n// Resource definitions\n// ---------------------------------------------------------------------------\n\nexport const statuspageResources = defineResources({\n statuspage_component: {\n shape: 'entity',\n description:\n 'Statuspage components (the things on a status page that turn red), with current status, group membership, and whether they are hidden until degraded.',\n endpoint: 'GET /v1/pages/{page_id}/components',\n fields: [\n { name: 'name', description: 'Component display name.' },\n {\n name: 'status',\n description:\n 'Current health: operational | under_maintenance | degraded_performance | partial_outage | major_outage.',\n },\n {\n name: 'groupId',\n description:\n 'Parent component-group id, or null if the component is top-level.',\n },\n {\n name: 'group',\n description: 'True if this row is itself a component group.',\n },\n {\n name: 'showcase',\n description: 'Whether the component is shown on the public page.',\n },\n {\n name: 'onlyShowIfDegraded',\n description:\n 'When true the component is hidden on the public page while operational.',\n },\n {\n name: 'position',\n description: 'Sort position within the page or group.',\n },\n ],\n responses: { components: componentsResponseSchema },\n },\n statuspage_incident: {\n shape: 'entity',\n description:\n 'Statuspage incidents (realtime outages plus maintenance windows) with status, impact, affected components, and the created / monitoring / resolved timestamps.',\n endpoint: 'GET /v1/pages/{page_id}/incidents',\n notes:\n 'Returned newest-first by updated_at; bounded by the incident lookback window (default 90 days) and tightened to options.since on incremental syncs.',\n fields: [\n { name: 'name', description: 'Incident title.' },\n {\n name: 'status',\n description:\n 'Realtime status (investigating | identified | monitoring | resolved | postmortem) or maintenance status (scheduled | in_progress | verifying | completed).',\n },\n {\n name: 'impact',\n description:\n 'Reported impact: none | maintenance | minor | major | critical.',\n },\n {\n name: 'componentIds',\n description: 'Ids of components currently attached to the incident.',\n },\n {\n name: 'createdAt',\n description: 'Incident creation timestamp (epoch ms).',\n },\n {\n name: 'resolvedAt',\n description:\n 'Resolved timestamp (epoch ms), or null while the incident is open.',\n },\n {\n name: 'shortlink',\n description: 'Public-facing short URL for the incident.',\n },\n ],\n responses: { incidents: incidentsResponseSchema },\n },\n statuspage_incident_update: {\n shape: 'event',\n description:\n 'Per-update transitions inside an incident timeline (each comment / status flip). Emitted at display_at (falling back to created_at).',\n endpoint: 'GET /v1/pages/{page_id}/incidents',\n notes:\n 'Derived from the inline incident_updates array on each incident; Statuspage does not expose a separate list endpoint.',\n fields: [\n { name: 'updateId', description: 'Incident-update id.' },\n {\n name: 'incidentId',\n description: 'Parent incident id.',\n },\n {\n name: 'status',\n description: 'Status the incident moved to at this update.',\n },\n {\n name: 'body',\n description: 'Free-form message posted on the update.',\n },\n ],\n },\n});\n\n// ---------------------------------------------------------------------------\n// StatuspageConnector\n// ---------------------------------------------------------------------------\n\nconst SP_API_HOST = 'api.statuspage.io';\nconst SP_API_BASE = `https://${SP_API_HOST}`;\nconst PAGE_SIZE = 100;\nconst DEFAULT_INCIDENT_LOOKBACK_DAYS = 90;\nconst MS_PER_DAY = 24 * 60 * 60 * 1000;\n\nexport const id = 'statuspage';\n\ninterface IncidentBatchItem {\n incident: SPIncident;\n}\n\nexport class StatuspageConnector extends BaseConnector<\n StatuspageSettings,\n StatuspageCredentials\n> {\n static readonly id = id;\n\n static readonly resources = statuspageResources;\n\n static readonly schemas = schemasFromResources(statuspageResources);\n\n static create(input: unknown, ctx?: ConnectorContext): StatuspageConnector {\n const parsed = configFields.parse(input);\n return new StatuspageConnector(\n {\n pageId: parsed.pageId,\n resources: parsed.resources,\n incidentLookbackDays: parsed.incidentLookbackDays,\n },\n { apiKey: parsed.apiKey },\n ctx,\n );\n }\n\n readonly id = id;\n override readonly credentials = statuspageCredentials;\n\n private buildHeaders(): Record<string, string> {\n return {\n Authorization: `OAuth ${this.creds.apiKey}`,\n Accept: 'application/json',\n 'User-Agent': connectorUserAgent('statuspage'),\n };\n }\n\n private fetch<T>(\n url: string,\n resource: string,\n signal?: AbortSignal,\n ): Promise<HttpResponse<T>> {\n return this.get<T>(url, {\n resource,\n headers: this.buildHeaders(),\n signal,\n });\n }\n\n // -------------------------------------------------------------------------\n // Resource enablement\n // -------------------------------------------------------------------------\n\n private activePhases(): StatuspagePhase[] {\n return selectActivePhases<StatuspageResource, StatuspagePhase>(\n (r) => {\n switch (r) {\n case 'components':\n return 'components';\n case 'incidents':\n case 'incident_updates':\n return 'incidents';\n }\n },\n PHASE_ORDER,\n this.settings.resources,\n );\n }\n\n // -------------------------------------------------------------------------\n // URL building + sanitization\n // -------------------------------------------------------------------------\n\n private allowedPagePath(phase: StatuspagePhase): string {\n switch (phase) {\n case 'components':\n return `/v1/pages/${this.settings.pageId}/components`;\n case 'incidents':\n return `/v1/pages/${this.settings.pageId}/incidents`;\n }\n }\n\n private sanitizePageUrl(\n phase: StatuspagePhase,\n pageUrl: string | null,\n ): string | null {\n if (pageUrl === null) {\n return null;\n }\n return sanitizeAllowedUrl({\n url: pageUrl,\n host: SP_API_HOST,\n pathname: this.allowedPagePath(phase),\n });\n }\n\n private resolveCursor(cursor: unknown): StatuspageSyncCursor | undefined {\n if (!isStatuspageSyncCursor(cursor)) {\n return undefined;\n }\n return {\n phase: cursor.phase,\n page: this.sanitizePageUrl(cursor.phase, cursor.page),\n };\n }\n\n private buildInitialUrl(phase: StatuspagePhase): string {\n const u = new URL(`${SP_API_BASE}${this.allowedPagePath(phase)}`);\n u.searchParams.set('page', '1');\n u.searchParams.set('per_page', String(PAGE_SIZE));\n return u.toString();\n }\n\n private buildNextPageUrl(\n phase: StatuspagePhase,\n currentUrl: string,\n ): string | null {\n let u: URL;\n try {\n u = new URL(currentUrl);\n } catch {\n return null;\n }\n const pageRaw = u.searchParams.get('page');\n const pageNum = pageRaw === null ? 1 : Number.parseInt(pageRaw, 10);\n if (!Number.isFinite(pageNum) || pageNum < 1) {\n return null;\n }\n u.searchParams.set('page', String(pageNum + 1));\n u.searchParams.set('per_page', String(PAGE_SIZE));\n return this.sanitizePageUrl(phase, u.toString());\n }\n\n private computeIncidentSinceMs(options: SyncOptions): number {\n if (options.since) {\n const ms = parseEpoch(options.since, 'iso');\n if (ms !== null) {\n return ms;\n }\n }\n const days =\n this.settings.incidentLookbackDays ?? DEFAULT_INCIDENT_LOOKBACK_DAYS;\n return Date.now() - days * MS_PER_DAY;\n }\n\n // -------------------------------------------------------------------------\n // Fetchers\n // -------------------------------------------------------------------------\n\n private async fetchComponentsPage(\n page: string | null,\n signal: AbortSignal | undefined,\n ): Promise<{ items: SPComponent[]; next: string | null }> {\n const url = page ?? this.buildInitialUrl('components');\n const res = await this.fetch<SPComponent[]>(url, 'components', signal);\n const items = res.body;\n const next =\n items.length < PAGE_SIZE\n ? null\n : this.buildNextPageUrl('components', url);\n return { items, next };\n }\n\n private async fetchIncidentsPage(\n page: string | null,\n options: SyncOptions,\n signal: AbortSignal | undefined,\n ): Promise<{ items: IncidentBatchItem[]; next: string | null }> {\n const url = page ?? this.buildInitialUrl('incidents');\n const res = await this.fetch<SPIncident[]>(url, 'incidents', signal);\n const incidents = res.body;\n const sinceMs = this.computeIncidentSinceMs(options);\n\n // Incidents are returned newest-first by updated_at. Short-circuit\n // pagination once a page is entirely older than the sinceMs floor.\n const incidentTimestampMs = (inc: SPIncident): number | null => {\n const stamp = inc.updated_at ?? inc.created_at;\n const ms = stamp ? Date.parse(stamp) : Number.NaN;\n return Number.isFinite(ms) ? ms : null;\n };\n\n const last = incidents.at(-1);\n const lastMs = last ? incidentTimestampMs(last) : null;\n const cutoffReached = lastMs !== null && lastMs < sinceMs;\n\n const filtered = incidents.filter((inc) => {\n const ms = incidentTimestampMs(inc);\n return ms === null ? true : ms >= sinceMs;\n });\n\n const next =\n cutoffReached || incidents.length < PAGE_SIZE\n ? null\n : this.buildNextPageUrl('incidents', url);\n\n return {\n items: filtered.map((incident) => ({ incident })),\n next,\n };\n }\n\n // -------------------------------------------------------------------------\n // Writers\n // -------------------------------------------------------------------------\n\n private parseTimestampMs(stamp: string | null | undefined): number | null {\n if (!stamp) {\n return null;\n }\n const ms = Date.parse(stamp);\n return Number.isFinite(ms) ? ms : null;\n }\n\n private async writeComponents(\n storage: StorageHandle,\n components: SPComponent[],\n ): Promise<void> {\n for (const c of components) {\n const updatedAt =\n this.parseTimestampMs(c.updated_at) ??\n this.parseTimestampMs(c.created_at) ??\n Date.now();\n await storage.entity({\n type: 'statuspage_component',\n id: c.id,\n attributes: {\n name: c.name,\n description: c.description ?? null,\n status: c.status,\n groupId: c.group_id ?? null,\n group: c.group ?? false,\n showcase: c.showcase ?? false,\n onlyShowIfDegraded: c.only_show_if_degraded ?? false,\n position: c.position ?? null,\n startDate: c.start_date ?? null,\n createdAt: this.parseTimestampMs(c.created_at),\n },\n updated_at: updatedAt,\n });\n }\n }\n\n private async writeIncidents(\n storage: StorageHandle,\n items: IncidentBatchItem[],\n ): Promise<void> {\n for (const { incident } of items) {\n const createdAtMs = this.parseTimestampMs(incident.created_at);\n const updatedAtMs = this.parseTimestampMs(incident.updated_at);\n const resolvedAtMs = this.parseTimestampMs(incident.resolved_at);\n const monitoringAtMs = this.parseTimestampMs(incident.monitoring_at);\n const componentIds = (incident.components ?? []).map((c) => c.id);\n const componentSummary: Record<string, JSONValue> = {};\n for (const c of incident.components ?? []) {\n componentSummary[c.id] = {\n name: c.name ?? null,\n status: c.status ?? null,\n };\n }\n await storage.entity({\n type: 'statuspage_incident',\n id: incident.id,\n attributes: {\n name: incident.name,\n status: incident.status,\n impact: incident.impact,\n componentIds,\n components: componentSummary,\n createdAt: createdAtMs,\n monitoringAt: monitoringAtMs,\n resolvedAt: resolvedAtMs,\n scheduledFor: this.parseTimestampMs(incident.scheduled_for),\n scheduledUntil: this.parseTimestampMs(incident.scheduled_until),\n shortlink: incident.shortlink ?? null,\n },\n updated_at: updatedAtMs ?? createdAtMs ?? Date.now(),\n });\n }\n }\n\n private async writeIncidentUpdates(\n storage: StorageHandle,\n items: IncidentBatchItem[],\n sinceMs: number,\n ): Promise<void> {\n for (const { incident } of items) {\n for (const upd of incident.incident_updates ?? []) {\n const tsMs =\n this.parseTimestampMs(upd.display_at) ??\n this.parseTimestampMs(upd.created_at);\n if (tsMs === null || tsMs < sinceMs) {\n continue;\n }\n await storage.event({\n name: 'statuspage_incident_update',\n start_ts: tsMs,\n end_ts: null,\n attributes: {\n updateId: upd.id,\n incidentId: upd.incident_id,\n incidentName: incident.name,\n status: upd.status,\n body: upd.body,\n },\n });\n }\n }\n }\n\n // -------------------------------------------------------------------------\n // sync\n // -------------------------------------------------------------------------\n\n async sync(\n options: SyncOptions,\n storage: StorageHandle,\n signal?: AbortSignal,\n ): Promise<SyncResult> {\n const cursor = this.resolveCursor(options.cursor);\n const isFull = options.mode === 'full';\n const phases = this.activePhases();\n const incidentSinceMs = this.computeIncidentSinceMs(options);\n\n return paginateChunked<StatuspagePhase, string>({\n phases,\n cursor,\n signal,\n logger: this.logger,\n fetchPage: async (phase, page, sig) => {\n switch (phase) {\n case 'components':\n return this.fetchComponentsPage(page, sig);\n case 'incidents':\n return this.fetchIncidentsPage(page, options, sig);\n }\n },\n writeBatch: async (phase, items, page) => {\n if (isFull && page === null) {\n switch (phase) {\n case 'components':\n if (this.isResourceEnabled('components')) {\n await storage.entities([], {\n types: ['statuspage_component'],\n });\n }\n break;\n case 'incidents':\n if (this.isResourceEnabled('incidents')) {\n await storage.entities([], {\n types: ['statuspage_incident'],\n });\n }\n if (this.isResourceEnabled('incident_updates')) {\n await storage.events([], {\n names: ['statuspage_incident_update'],\n });\n }\n break;\n }\n }\n switch (phase) {\n case 'components':\n if (!this.isResourceEnabled('components')) {\n return;\n }\n return this.writeComponents(storage, items as SPComponent[]);\n case 'incidents': {\n const batch = items as IncidentBatchItem[];\n if (this.isResourceEnabled('incidents')) {\n await this.writeIncidents(storage, batch);\n }\n if (this.isResourceEnabled('incident_updates')) {\n await this.writeIncidentUpdates(storage, batch, incidentSinceMs);\n }\n return;\n }\n }\n },\n });\n }\n}\n","import { StatuspageConnector } from './statuspage';\n\nexport {\n configFields,\n doc,\n StatuspageConnector,\n statuspageResources as resources,\n id,\n} from './statuspage';\nexport type { StatuspageResource, StatuspageSettings } from './statuspage';\nexport default StatuspageConnector;\n"],"mappings":";AEAO,IAAM,sBAAsB;AAE5B,IAAM,qBAAqB,qBAAqB,mBAAmB;AAEnE,SAAS,mBAAmB,aAA6B;AAC9D,SAAO,qBAAqB,WAAW,IAAI,mBAAmB;AAChE;AGCO,SAAS,mBACd,SACe;AACf,QAAM,EAAE,KAAK,MAAM,UAAU,WAAW,SAAS,IAAI;AACrD,MAAI,QAAQ,MAAM;AAChB,WAAO;EACT;AACA,MAAI;AACF,UAAM,IAAI,IAAI,IAAI,GAAG;AACrB,QAAI,EAAE,aAAa,YAAY,EAAE,SAAS,QAAQ,EAAE,aAAa,UAAU;AACzE,aAAO;IACT;AACA,WAAO,EAAE,SAAS;EACpB,QAAQ;AACN,WAAO;EACT;AACF;ACrBO,SAAS,WACd,OACA,MACe;AACf,MAAI,UAAU,QAAQ,UAAU,QAAW;AACzC,WAAO;EACT;AACA,MAAI,SAAS,OAAO;AAClB,QAAI,OAAO,UAAU,UAAU;AAC7B,aAAO;IACT;AACA,UAAM,KAAK,IAAI,KAAK,KAAK,EAAE,QAAQ;AACnC,WAAO,OAAO,SAAS,EAAE,IAAI,KAAK;EACpC;AACA,MAAI,OAAO,UAAU,YAAY,MAAM,KAAK,MAAM,IAAI;AACpD,WAAO;EACT;AACA,QAAM,IAAI,OAAO,UAAU,WAAW,QAAQ,OAAO,KAAK;AAC1D,MAAI,CAAC,OAAO,SAAS,CAAC,GAAG;AACvB,WAAO;EACT;AACA,QAAM,SAAS,SAAS,MAAM,IAAI,MAAO;AACzC,SAAO,OAAO,SAAS,MAAM,IAAI,SAAS;AAC5C;;;AGnBA;AAAA,EACE;AAAA,EASA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,S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,KAAK,mBAAmB,MAAM,SAAS,GAAG;AAAA,QACrD;AAAA,MACF;AAAA,MACA,YAAY,OAAO,OAAO,OAAO,SAAS;AACxC,YAAI,UAAU,SAAS,MAAM;AAC3B,kBAAQ,OAAO;AAAA,YACb,KAAK;AACH,kBAAI,KAAK,kBAAkB,YAAY,GAAG;AACxC,sBAAM,QAAQ,SAAS,CAAC,GAAG;AAAA,kBACzB,OAAO,CAAC,sBAAsB;AAAA,gBAChC,CAAC;AAAA,cACH;AACA;AAAA,YACF,KAAK;AACH,kBAAI,KAAK,kBAAkB,WAAW,GAAG;AACvC,sBAAM,QAAQ,SAAS,CAAC,GAAG;AAAA,kBACzB,OAAO,CAAC,qBAAqB;AAAA,gBAC/B,CAAC;AAAA,cACH;AACA,kBAAI,KAAK,kBAAkB,kBAAkB,GAAG;AAC9C,sBAAM,QAAQ,OAAO,CAAC,GAAG;AAAA,kBACvB,OAAO,CAAC,4BAA4B;AAAA,gBACtC,CAAC;AAAA,cACH;AACA;AAAA,UACJ;AAAA,QACF;AACA,gBAAQ,OAAO;AAAA,UACb,KAAK;AACH,gBAAI,CAAC,KAAK,kBAAkB,YAAY,GAAG;AACzC;AAAA,YACF;AACA,mBAAO,KAAK,gBAAgB,SAAS,KAAsB;AAAA,UAC7D,KAAK,aAAa;AAChB,kBAAM,QAAQ;AACd,gBAAI,KAAK,kBAAkB,WAAW,GAAG;AACvC,oBAAM,KAAK,eAAe,SAAS,KAAK;AAAA,YAC1C;AACA,gBAAI,KAAK,kBAAkB,kBAAkB,GAAG;AAC9C,oBAAM,KAAK,qBAAqB,SAAS,OAAO,eAAe;AAAA,YACjE;AACA;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;;;AC1tBA,IAAO,gBAAQ;","names":[]}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@rawdash/connector-statuspage",
3
+ "version": "0.0.1",
4
+ "description": "Rawdash connector for Atlassian Statuspage - components, incidents, and incident updates",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/rawdash/rawdash.git",
11
+ "directory": "packages/connectors/statuspage"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "README.md",
16
+ "LICENSE"
17
+ ],
18
+ "exports": {
19
+ ".": {
20
+ "@rawdash/source": "./src/index.ts",
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "build": "tsup",
27
+ "typecheck": "tsc --noEmit",
28
+ "lint": "eslint src",
29
+ "test": "vitest run"
30
+ },
31
+ "dependencies": {
32
+ "@rawdash/core": "workspace:*",
33
+ "zod": "^4.4.3"
34
+ },
35
+ "devDependencies": {
36
+ "@rawdash/connector-shared": "workspace:*",
37
+ "@rawdash/connector-test-utils": "workspace:*",
38
+ "fast-check": "^4.8.0",
39
+ "tsup": "^8.0.0",
40
+ "typescript": "^5.7.2",
41
+ "vitest": "^4.1.4"
42
+ }
43
+ }