@useairfoil/producer-incident-io 0.0.1 → 0.0.2
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 +147 -0
- package/dist/index.d.mts +2277 -0
- package/dist/index.mjs +3 -0
- package/dist/main.d.mts +1 -0
- package/dist/main.mjs +1530 -0
- package/dist/main.mjs.map +1 -0
- package/dist/manifest.d.mts +147 -0
- package/dist/manifest.mjs +205 -0
- package/dist/manifest.mjs.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/src-BuIJYq4l.mjs +2587 -0
- package/dist/src-BuIJYq4l.mjs.map +1 -0
- package/package.json +46 -7
- package/src/client/client.ts +185 -0
- package/src/connector.ts +142 -0
- package/src/create-table.ts +5 -0
- package/src/demo/alerting.ts +185 -0
- package/src/demo/alerts.ts +129 -0
- package/src/demo/follow-ups.ts +143 -0
- package/src/demo/incidents.ts +341 -0
- package/src/demo/index.ts +178 -0
- package/src/demo/response.ts +147 -0
- package/src/demo/setup.ts +295 -0
- package/src/demo/shared.ts +171 -0
- package/src/demo/status-page.ts +87 -0
- package/src/index.ts +98 -0
- package/src/main.ts +22 -0
- package/src/manifest.ts +69 -0
- package/src/resources/catalog.ts +81 -0
- package/src/resources/incidents.ts +550 -0
- package/src/resources/on-call.ts +418 -0
- package/src/resources/pages.ts +204 -0
- package/src/resources/settings.ts +444 -0
- package/src/resources/tasks.ts +141 -0
- package/src/sandbox.ts +37 -0
- package/src/schemas/catalog.ts +122 -0
- package/src/schemas/incidents.ts +410 -0
- package/src/schemas/on-call.ts +390 -0
- package/src/schemas/settings.ts +362 -0
- package/src/schemas/shared.ts +88 -0
- package/src/schemas/tasks.ts +117 -0
- package/src/start.ts +49 -0
- package/src/tables.ts +96 -0
- package/src/webhook/route.ts +90 -0
- package/src/webhook/signature.ts +23 -0
package/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# incident.io producer
|
|
2
|
+
|
|
3
|
+
Syncs incidents and everything around them from one incident.io organization:
|
|
4
|
+
updates, timelines, follow-ups, on-call, the catalog, status pages, and
|
|
5
|
+
settings. It backfills each resource, takes webhooks at
|
|
6
|
+
`POST /webhooks/incident-io`, and polls as a backup: every 5 minutes for
|
|
7
|
+
incidents, follow-ups, actions, alerts, and escalations, and every hour for
|
|
8
|
+
the rest.
|
|
9
|
+
|
|
10
|
+
| Resource | What |
|
|
11
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
|
|
12
|
+
| `incidents` | Incidents in every mode |
|
|
13
|
+
| `incident_updates`, `incident_timeline_items`, `incident_activity_log_entries`, `incident_participants`, `incident_relationships`, `incident_attachments`, `incident_alerts`, `incident_call_sessions`, `incident_participant_workloads` | Lists read for each incident |
|
|
14
|
+
| `postmortem_documents`, `follow_ups`, `actions` | Post-mortems and work items |
|
|
15
|
+
| `alerts`, `alert_notes`, `alert_sources`, `alert_routes`, `alert_attributes` | Alerts and their setup |
|
|
16
|
+
| `escalations`, `escalation_paths`, `schedules`, `schedule_shifts`, `schedule_overrides`, `on_call_notification_pauses`, `maintenance_windows` | On-call |
|
|
17
|
+
| `catalog_types`, `catalog_entries` | The catalog |
|
|
18
|
+
| `users`, `teams` | People and teams |
|
|
19
|
+
| `severities`, `incident_statuses`, `incident_types`, `incident_roles`, `incident_timestamps`, `custom_fields`, `custom_field_options` | Incident settings, to name IDs on rows |
|
|
20
|
+
| `workflows`, `workflow_runs` | Workflows and their runs |
|
|
21
|
+
| `status_pages`, `status_page_components`, `status_page_incidents`, `status_page_maintenances` | Status pages |
|
|
22
|
+
| `policies`, `policy_findings` | Policies and what breaks them |
|
|
23
|
+
|
|
24
|
+
## Config
|
|
25
|
+
|
|
26
|
+
| Variable | Required | Default |
|
|
27
|
+
| ---------------------------- | -------- | ------- |
|
|
28
|
+
| `INCIDENT_IO_API_KEY` | yes | none |
|
|
29
|
+
| `INCIDENT_IO_WEBHOOK_SECRET` | yes | none |
|
|
30
|
+
|
|
31
|
+
## Setup
|
|
32
|
+
|
|
33
|
+
The API and webhooks need the Team plan or above. Private incidents and
|
|
34
|
+
policies need Pro.
|
|
35
|
+
|
|
36
|
+
1. Create an API key under **Settings → API keys** with these permissions
|
|
37
|
+
(API names):
|
|
38
|
+
- `viewer` for incidents, follow-ups, actions, and settings
|
|
39
|
+
- `catalog_viewer`, `on_call_viewer`, `schedules_reader`,
|
|
40
|
+
`workflows_viewer`, `status_page_viewer`, and `policies_viewer` for those
|
|
41
|
+
tables
|
|
42
|
+
- `incident_workload_viewer` and `incident_workload_private_viewer` for
|
|
43
|
+
`incident_participant_workloads`
|
|
44
|
+
- `call_transcripts_viewer` for `incident_call_sessions`
|
|
45
|
+
- `global_access` to include private incidents
|
|
46
|
+
|
|
47
|
+
`maintenance_windows` needs `on_call_editor`, the only permission that
|
|
48
|
+
covers maintenance windows. It can also change on-call setup, so leave the
|
|
49
|
+
table out unless you're fine granting that.
|
|
50
|
+
|
|
51
|
+
Use the key as `INCIDENT_IO_API_KEY`. A table whose role is missing fails
|
|
52
|
+
its check, and the others keep syncing.
|
|
53
|
+
|
|
54
|
+
2. Add a webhook endpoint under **Settings → Webhooks** at
|
|
55
|
+
`https://<host>/webhooks/incident-io`. Pick both the public and private
|
|
56
|
+
versions of these events:
|
|
57
|
+
- `incident_created_v2`, `incident_updated_v2`,
|
|
58
|
+
`incident_status_updated_v2`
|
|
59
|
+
- `follow_up_created_v2`, `follow_up_updated_v2`
|
|
60
|
+
- `action_created_v1`, `action_updated_v1`
|
|
61
|
+
- `postmortem_document_status_updated_v1`
|
|
62
|
+
- `alert_created_v1`, `alert_resolved_v1`
|
|
63
|
+
- `escalation_created_v1`, `escalation_status_updated_v1`
|
|
64
|
+
|
|
65
|
+
Also pick `schedule.created_v1`, `schedule.updated_v1`,
|
|
66
|
+
`schedule.deleted_v1`, `schedule.shift_change_v1`, and
|
|
67
|
+
`status_page_incident.update_shared_v1`. Use its signing secret as
|
|
68
|
+
`INCIDENT_IO_WEBHOOK_SECRET`.
|
|
69
|
+
|
|
70
|
+
One key reads one organization, so run one connector per organization.
|
|
71
|
+
|
|
72
|
+
## Data
|
|
73
|
+
|
|
74
|
+
- Every webhook reads the record again, so rows always have the full,
|
|
75
|
+
latest record. Private events only carry an ID, and are skipped when the key
|
|
76
|
+
can't see the incident.
|
|
77
|
+
- Incidents keep role assignments, custom field values, timestamps, and
|
|
78
|
+
duration metrics as lists. A custom field with several values has one list
|
|
79
|
+
element per value.
|
|
80
|
+
- Test and tutorial incidents are included. Filter on `mode` to leave them
|
|
81
|
+
out.
|
|
82
|
+
- incident.io has no incident deletes. Declined, canceled, and merged
|
|
83
|
+
incidents stay, with their status.
|
|
84
|
+
- Follow-ups and actions marked deleted keep `status = deleted`. If incident.io
|
|
85
|
+
drops them from its lists instead, the delete isn't seen.
|
|
86
|
+
- Archived catalog entries keep `archived_at`. Deleted schedules get
|
|
87
|
+
`_deleted`.
|
|
88
|
+
- `schedule_shifts` has shifts that ended in the last 7 days, with overrides
|
|
89
|
+
applied, keyed by the shift's fingerprint. It keeps older shifts it read
|
|
90
|
+
before.
|
|
91
|
+
- Deep config, such as workflow steps, escalation paths, and policy rules, is
|
|
92
|
+
stored as JSON text.
|
|
93
|
+
- Alert sources leave out their secret token. Users' phone numbers and
|
|
94
|
+
notification rules, call transcripts, pay data, secrets, and API keys aren't
|
|
95
|
+
synced.
|
|
96
|
+
- Tables hold names, emails, Slack IDs, and incident text. Treat them as
|
|
97
|
+
confidential.
|
|
98
|
+
|
|
99
|
+
## Limits
|
|
100
|
+
|
|
101
|
+
- An API key gets 1,200 requests a minute, and listing incidents 60 a minute.
|
|
102
|
+
A `429` waits for `Retry-After` and tries again.
|
|
103
|
+
- Lists for each incident are read again when the incident changes, and every
|
|
104
|
+
5 minutes while it's open (triage, active, or paused).
|
|
105
|
+
- `incident_call_sessions` and `incident_participant_workloads` poll on their
|
|
106
|
+
own every 5 minutes, and take no webhooks, so a key without their role only
|
|
107
|
+
stops those tables.
|
|
108
|
+
- Workload minutes on `incidents` can lag, because they grow without changing
|
|
109
|
+
`updated_at`. `incident_participant_workloads` is read again while an
|
|
110
|
+
incident is open, and for a day after its last change, because incident.io
|
|
111
|
+
updates workload now and then.
|
|
112
|
+
- Settings lists are read in full every hour. Removed items aren't seen.
|
|
113
|
+
- Alert notes are read every hour, for the alerts that have notes. Notes on
|
|
114
|
+
alert groups aren't synced, because the API can't list alert groups.
|
|
115
|
+
- Removed attachments, relationships, participants, and alert links aren't
|
|
116
|
+
seen.
|
|
117
|
+
- A webhook that fails is retried for 24 hours. Polling covers longer
|
|
118
|
+
outages.
|
|
119
|
+
|
|
120
|
+
## Demo data
|
|
121
|
+
|
|
122
|
+
`pnpm demo --size 128MiB` writes made-up incident.io data without incident.io
|
|
123
|
+
credentials. See the Connector Kit README for the flags and the variables it
|
|
124
|
+
needs.
|
|
125
|
+
|
|
126
|
+
Each incident has the alert that started it, an escalation for serious ones,
|
|
127
|
+
status updates with timeline items and activity log entries, participants with
|
|
128
|
+
workloads, actions, and workflow runs. Serious incidents also get a post-mortem,
|
|
129
|
+
follow-ups, a status page notice, and policy findings for late follow-ups. The
|
|
130
|
+
workspace is written once and doesn't grow with the size: users, teams, the
|
|
131
|
+
catalog, severities, statuses, types, roles, custom fields, alerting, on-call
|
|
132
|
+
schedules with shifts, maintenance windows, workflows, the status page, and
|
|
133
|
+
policies.
|
|
134
|
+
|
|
135
|
+
## Local development
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
cd connectors/producer-incident-io
|
|
139
|
+
pnpm sandbox
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`pnpm start` runs the hosted connector. It needs the Wings and PostgreSQL
|
|
143
|
+
variables from the [Connector Kit README](../../packages/connector-kit/README.md).
|
|
144
|
+
|
|
145
|
+
To record the VCR cassette, put a key from a test organization in `.env`, and
|
|
146
|
+
run `pnpm test:ci`. Check the new cassette for customer details before
|
|
147
|
+
committing it.
|