Skip to content

Commit 6e20c61

Browse files
chore: new version (#13)
1 parent 3bdfd78 commit 6e20c61

29 files changed

Lines changed: 3873 additions & 278 deletions

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ const { monitor } = await client.monitor.v1.MonitorService.updateDNSMonitor({
281281
List all monitors with pagination. Returns monitors grouped by type.
282282

283283
```typescript
284-
const { httpMonitors, tcpMonitors, dnsMonitors, totalSize } =
285-
await client.monitor.v1.MonitorService.listMonitors({
284+
const { httpMonitors, tcpMonitors, dnsMonitors, totalSize } = await client
285+
.monitor.v1.MonitorService.listMonitors({
286286
limit: 10,
287287
offset: 0,
288288
});

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openstatus/sdk-node",
3-
"version": "0.1.4",
3+
"version": "0.1.5",
44
"description": "SDK for openstatus",
55
"license": "MIT",
66
"exports": {

docs/authentication.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
## Recommended: createOpenStatusClient
66

7-
Create a client with your API key. The key is automatically included in all requests via an interceptor.
7+
Create a client with your API key. The key is automatically included in all
8+
requests via an interceptor.
89

910
```typescript
1011
import { createOpenStatusClient } from "@openstatus/sdk-node";
@@ -14,7 +15,9 @@ const client = createOpenStatusClient({
1415
});
1516

1617
// No headers needed on individual calls
17-
const { httpMonitors } = await client.monitor.v1.MonitorService.listMonitors({});
18+
const { httpMonitors } = await client.monitor.v1.MonitorService.listMonitors(
19+
{},
20+
);
1821
```
1922

2023
## Alternative: Manual Headers
@@ -33,12 +36,13 @@ await openstatus.monitor.v1.MonitorService.listMonitors({}, { headers });
3336

3437
## Environment Variables
3538

36-
| Variable | Description | Default |
37-
|----------|-------------|---------|
39+
| Variable | Description | Default |
40+
| -------------------- | ----------------------- | -------------------------------- |
3841
| `OPENSTATUS_API_KEY` | Your OpenStatus API key | Required for authenticated calls |
39-
| `OPENSTATUS_API_URL` | Custom API endpoint | `https://api.openstatus.dev/rpc` |
42+
| `OPENSTATUS_API_URL` | Custom API endpoint | `https://api.openstatus.dev/rpc` |
4043

41-
Get your API key from the [OpenStatus dashboard](https://www.openstatus.dev/app).
44+
Get your API key from the
45+
[OpenStatus dashboard](https://www.openstatus.dev/app).
4246

4347
## Custom Base URL
4448

@@ -53,4 +57,5 @@ const client = createOpenStatusClient({
5357
});
5458
```
5559

56-
The `baseUrl` option takes precedence over the `OPENSTATUS_API_URL` environment variable.
60+
The `baseUrl` option takes precedence over the `OPENSTATUS_API_URL` environment
61+
variable.

docs/error-handling.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
# Error Handling
44

5-
The SDK uses ConnectRPC. Errors are thrown as `ConnectError` instances from the `@connectrpc/connect` package.
5+
The SDK uses ConnectRPC. Errors are thrown as `ConnectError` instances from the
6+
`@connectrpc/connect` package.
67

78
```typescript
89
import { ConnectError } from "@connectrpc/connect";
@@ -19,17 +20,18 @@ try {
1920

2021
## Common Error Codes
2122

22-
| Code | Description |
23-
|------|-------------|
24-
| `unauthenticated` | Missing or invalid API key |
25-
| `not_found` | Resource does not exist |
26-
| `invalid_argument` | Validation failure (e.g., missing required field, value out of range) |
27-
| `permission_denied` | No access to this workspace or resource |
28-
| `already_exists` | Duplicate resource (e.g., slug already taken) |
23+
| Code | Description |
24+
| ------------------- | --------------------------------------------------------------------- |
25+
| `unauthenticated` | Missing or invalid API key |
26+
| `not_found` | Resource does not exist |
27+
| `invalid_argument` | Validation failure (e.g., missing required field, value out of range) |
28+
| `permission_denied` | No access to this workspace or resource |
29+
| `already_exists` | Duplicate resource (e.g., slug already taken) |
2930

3031
## Retry Strategy
3132

32-
ConnectRPC does not retry by default. For transient failures (`unavailable`, `deadline_exceeded`), implement your own retry logic:
33+
ConnectRPC does not retry by default. For transient failures (`unavailable`,
34+
`deadline_exceeded`), implement your own retry logic:
3335

3436
```typescript
3537
import { ConnectError } from "@connectrpc/connect";
@@ -44,7 +46,9 @@ async function withRetry<T>(fn: () => Promise<T>, maxRetries = 3): Promise<T> {
4446
(error.code === "unavailable" || error.code === "deadline_exceeded") &&
4547
attempt < maxRetries
4648
) {
47-
await new Promise((resolve) => setTimeout(resolve, 1000 * 2 ** attempt));
49+
await new Promise((resolve) =>
50+
setTimeout(resolve, 1000 * 2 ** attempt)
51+
);
4852
continue;
4953
}
5054
throw error;

docs/getting-started.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,24 @@ const { monitor } = await client.monitor.v1.MonitorService.createHTTPMonitor({
5555
console.log(`Monitor created: ${monitor?.id}`);
5656

5757
// List all monitors
58-
const { httpMonitors, tcpMonitors, dnsMonitors, totalSize } =
59-
await client.monitor.v1.MonitorService.listMonitors({});
58+
const { httpMonitors, tcpMonitors, dnsMonitors, totalSize } = await client
59+
.monitor.v1.MonitorService.listMonitors({});
6060

6161
console.log(`Found ${totalSize} monitors`);
6262
```
6363

6464
## Runtime Support
6565

6666
| Runtime | Version | Module Format |
67-
|---------|---------|---------------|
67+
| ------- | ------- | ------------- |
6868
| Node.js | >= 18 | ESM and CJS |
6969
| Deno | >= 2 | ESM (native) |
7070
| Bun | Latest | ESM |
7171

7272
## Full Workflow Example
7373

74-
A complete example: create a monitor, set up a status page, add the monitor as a component, configure a Slack notification, and check overall status.
74+
A complete example: create a monitor, set up a status page, add the monitor as a
75+
component, configure a Slack notification, and check overall status.
7576

7677
```typescript
7778
import {

docs/index.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# OpenStatus Node.js SDK Documentation
22

3-
Official documentation for [`@openstatus/sdk-node`](https://www.npmjs.com/package/@openstatus/sdk-node) — the TypeScript SDK for the [OpenStatus](https://openstatus.dev) monitoring platform.
3+
Official documentation for
4+
[`@openstatus/sdk-node`](https://www.npmjs.com/package/@openstatus/sdk-node)
5+
the TypeScript SDK for the [OpenStatus](https://openstatus.dev) monitoring
6+
platform.
47

58
---
69

docs/maintenance-service.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
# Maintenance Service
44

5-
Manage scheduled maintenance windows. The Maintenance Service provides 5 RPC methods.
5+
Manage scheduled maintenance windows. The Maintenance Service provides 5 RPC
6+
methods.
67

78
## Create Maintenance Window
89

docs/monitor-service.md

Lines changed: 73 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
# Monitor Service
44

5-
Manage HTTP, TCP, and DNS monitors. The Monitor Service provides 12 RPC methods for creating, updating, listing, triggering, deleting, and querying monitor status and metrics.
5+
Manage HTTP, TCP, and DNS monitors. The Monitor Service provides 12 RPC methods
6+
for creating, updating, listing, triggering, deleting, and querying monitor
7+
status and metrics.
68

79
All examples assume you have created a client:
810

@@ -88,26 +90,26 @@ const { monitor } = await client.monitor.v1.MonitorService.updateHTTPMonitor({
8890

8991
### HTTP Monitor Options
9092

91-
| Option | Type | Required | Description |
92-
|--------|------|----------|-------------|
93-
| `name` | string | Yes | Monitor name (max 256 chars) |
94-
| `url` | string | Yes | URL to monitor (max 2048 chars) |
95-
| `periodicity` | Periodicity | Yes | Check interval |
96-
| `method` | HTTPMethod | No | HTTP method (default: GET) |
97-
| `body` | string | No | Request body |
98-
| `headers` | Headers[] | No | Custom headers `{ key, value }[]` |
99-
| `timeout` | bigint | No | Timeout in ms (default: 45000, max: 120000) |
100-
| `retry` | bigint | No | Retry attempts (default: 3, max: 10) |
101-
| `followRedirects` | boolean | No | Follow redirects (default: true) |
102-
| `regions` | Region[] | No | Regions for checks |
103-
| `active` | boolean | No | Enable monitoring (default: false) |
104-
| `public` | boolean | No | Public visibility (default: false) |
105-
| `degradedAt` | bigint | No | Latency threshold (ms) for degraded status |
106-
| `description` | string | No | Monitor description (max 1024 chars) |
107-
| `statusCodeAssertions` | StatusCodeAssertion[] | No | Status code assertions |
108-
| `bodyAssertions` | BodyAssertion[] | No | Body assertions |
109-
| `headerAssertions` | HeaderAssertion[] | No | Header assertions |
110-
| `openTelemetry` | OpenTelemetryConfig | No | OpenTelemetry export configuration |
93+
| Option | Type | Required | Description |
94+
| ---------------------- | --------------------- | -------- | ------------------------------------------- |
95+
| `name` | string | Yes | Monitor name (max 256 chars) |
96+
| `url` | string | Yes | URL to monitor (max 2048 chars) |
97+
| `periodicity` | Periodicity | Yes | Check interval |
98+
| `method` | HTTPMethod | No | HTTP method (default: GET) |
99+
| `body` | string | No | Request body |
100+
| `headers` | Headers[] | No | Custom headers `{ key, value }[]` |
101+
| `timeout` | bigint | No | Timeout in ms (default: 45000, max: 120000) |
102+
| `retry` | bigint | No | Retry attempts (default: 3, max: 10) |
103+
| `followRedirects` | boolean | No | Follow redirects (default: true) |
104+
| `regions` | Region[] | No | Regions for checks |
105+
| `active` | boolean | No | Enable monitoring (default: false) |
106+
| `public` | boolean | No | Public visibility (default: false) |
107+
| `degradedAt` | bigint | No | Latency threshold (ms) for degraded status |
108+
| `description` | string | No | Monitor description (max 1024 chars) |
109+
| `statusCodeAssertions` | StatusCodeAssertion[] | No | Status code assertions |
110+
| `bodyAssertions` | BodyAssertion[] | No | Body assertions |
111+
| `headerAssertions` | HeaderAssertion[] | No | Header assertions |
112+
| `openTelemetry` | OpenTelemetryConfig | No | OpenTelemetry export configuration |
111113

112114
## TCP Monitors
113115

@@ -148,19 +150,19 @@ const { monitor } = await client.monitor.v1.MonitorService.updateTCPMonitor({
148150

149151
### TCP Monitor Options
150152

151-
| Option | Type | Required | Description |
152-
|--------|------|----------|-------------|
153-
| `name` | string | Yes | Monitor name (max 256 chars) |
154-
| `uri` | string | Yes | `host:port` to monitor (max 2048 chars) |
155-
| `periodicity` | Periodicity | Yes | Check interval |
156-
| `timeout` | bigint | No | Timeout in ms (default: 45000, max: 120000) |
157-
| `retry` | bigint | No | Retry attempts (default: 3, max: 10) |
158-
| `regions` | Region[] | No | Regions for checks |
159-
| `active` | boolean | No | Enable monitoring (default: false) |
160-
| `public` | boolean | No | Public visibility (default: false) |
161-
| `degradedAt` | bigint | No | Latency threshold (ms) for degraded status |
162-
| `description` | string | No | Monitor description (max 1024 chars) |
163-
| `openTelemetry` | OpenTelemetryConfig | No | OpenTelemetry export configuration |
153+
| Option | Type | Required | Description |
154+
| --------------- | ------------------- | -------- | ------------------------------------------- |
155+
| `name` | string | Yes | Monitor name (max 256 chars) |
156+
| `uri` | string | Yes | `host:port` to monitor (max 2048 chars) |
157+
| `periodicity` | Periodicity | Yes | Check interval |
158+
| `timeout` | bigint | No | Timeout in ms (default: 45000, max: 120000) |
159+
| `retry` | bigint | No | Retry attempts (default: 3, max: 10) |
160+
| `regions` | Region[] | No | Regions for checks |
161+
| `active` | boolean | No | Enable monitoring (default: false) |
162+
| `public` | boolean | No | Public visibility (default: false) |
163+
| `degradedAt` | bigint | No | Latency threshold (ms) for degraded status |
164+
| `description` | string | No | Monitor description (max 1024 chars) |
165+
| `openTelemetry` | OpenTelemetryConfig | No | OpenTelemetry export configuration |
164166

165167
## DNS Monitors
166168

@@ -214,28 +216,29 @@ const { monitor } = await client.monitor.v1.MonitorService.updateDNSMonitor({
214216

215217
### DNS Monitor Options
216218

217-
| Option | Type | Required | Description |
218-
|--------|------|----------|-------------|
219-
| `name` | string | Yes | Monitor name (max 256 chars) |
220-
| `uri` | string | Yes | Domain to resolve (max 2048 chars) |
221-
| `periodicity` | Periodicity | Yes | Check interval |
222-
| `timeout` | bigint | No | Timeout in ms (default: 45000, max: 120000) |
223-
| `retry` | bigint | No | Retry attempts (default: 3, max: 10) |
224-
| `regions` | Region[] | No | Regions for checks |
225-
| `active` | boolean | No | Enable monitoring (default: false) |
226-
| `public` | boolean | No | Public visibility (default: false) |
227-
| `degradedAt` | bigint | No | Latency threshold (ms) for degraded status |
228-
| `description` | string | No | Monitor description (max 1024 chars) |
229-
| `recordAssertions` | RecordAssertion[] | No | DNS record assertions |
230-
| `openTelemetry` | OpenTelemetryConfig | No | OpenTelemetry export configuration |
219+
| Option | Type | Required | Description |
220+
| ------------------ | ------------------- | -------- | ------------------------------------------- |
221+
| `name` | string | Yes | Monitor name (max 256 chars) |
222+
| `uri` | string | Yes | Domain to resolve (max 2048 chars) |
223+
| `periodicity` | Periodicity | Yes | Check interval |
224+
| `timeout` | bigint | No | Timeout in ms (default: 45000, max: 120000) |
225+
| `retry` | bigint | No | Retry attempts (default: 3, max: 10) |
226+
| `regions` | Region[] | No | Regions for checks |
227+
| `active` | boolean | No | Enable monitoring (default: false) |
228+
| `public` | boolean | No | Public visibility (default: false) |
229+
| `degradedAt` | bigint | No | Latency threshold (ms) for degraded status |
230+
| `description` | string | No | Monitor description (max 1024 chars) |
231+
| `recordAssertions` | RecordAssertion[] | No | DNS record assertions |
232+
| `openTelemetry` | OpenTelemetryConfig | No | OpenTelemetry export configuration |
231233

232234
## List Monitors
233235

234-
List all monitors with offset-based pagination. Returns monitors grouped by type.
236+
List all monitors with offset-based pagination. Returns monitors grouped by
237+
type.
235238

236239
```typescript
237-
const { httpMonitors, tcpMonitors, dnsMonitors, totalSize } =
238-
await client.monitor.v1.MonitorService.listMonitors({
240+
const { httpMonitors, tcpMonitors, dnsMonitors, totalSize } = await client
241+
.monitor.v1.MonitorService.listMonitors({
239242
limit: 10,
240243
offset: 0,
241244
});
@@ -248,26 +251,33 @@ console.log(`DNS: ${dnsMonitors.length}`);
248251

249252
Pagination parameters:
250253

251-
| Parameter | Type | Description |
252-
|-----------|------|-------------|
253-
| `limit` | number (optional) | Max results to return (1–100, default 50) |
254-
| `offset` | number (optional) | Number of results to skip (default 0) |
254+
| Parameter | Type | Description |
255+
| --------- | ----------------- | ----------------------------------------- |
256+
| `limit` | number (optional) | Max results to return (1–100, default 50) |
257+
| `offset` | number (optional) | Number of results to skip (default 0) |
255258

256259
## Get Monitor
257260

258-
Get a single monitor by ID. The response uses a `MonitorConfig` oneof type that contains one of HTTP, TCP, or DNS configuration.
261+
Get a single monitor by ID. The response uses a `MonitorConfig` oneof type that
262+
contains one of HTTP, TCP, or DNS configuration.
259263

260264
```typescript
261265
const { monitor } = await client.monitor.v1.MonitorService.getMonitor({
262266
id: "mon_123",
263267
});
264268

265269
if (monitor?.config.case === "http") {
266-
console.log(`HTTP Monitor: ${monitor.config.value.name} — ${monitor.config.value.url}`);
270+
console.log(
271+
`HTTP Monitor: ${monitor.config.value.name} — ${monitor.config.value.url}`,
272+
);
267273
} else if (monitor?.config.case === "tcp") {
268-
console.log(`TCP Monitor: ${monitor.config.value.name} — ${monitor.config.value.uri}`);
274+
console.log(
275+
`TCP Monitor: ${monitor.config.value.name} — ${monitor.config.value.uri}`,
276+
);
269277
} else if (monitor?.config.case === "dns") {
270-
console.log(`DNS Monitor: ${monitor.config.value.name} — ${monitor.config.value.uri}`);
278+
console.log(
279+
`DNS Monitor: ${monitor.config.value.name} — ${monitor.config.value.uri}`,
280+
);
271281
}
272282
```
273283

@@ -343,4 +353,7 @@ console.log(`P95: ${summary.p95}ms`);
343353
console.log(`P99: ${summary.p99}ms`);
344354
```
345355

346-
The latency fields (`p50`, `p75`, `p90`, `p95`, `p99`) and count fields (`totalSuccessful`, `totalDegraded`, `totalFailed`) are `bigint` values. The `regions` parameter is optional — pass an empty array to get metrics across all regions.
356+
The latency fields (`p50`, `p75`, `p90`, `p95`, `p99`) and count fields
357+
(`totalSuccessful`, `totalDegraded`, `totalFailed`) are `bigint` values. The
358+
`regions` parameter is optional — pass an empty array to get metrics across all
359+
regions.

docs/notification-service.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
# Notification Service
44

5-
Manage notification channels for monitor alerts. Supports 12 providers. The Notification Service provides 7 RPC methods.
5+
Manage notification channels for monitor alerts. Supports 12 providers. The
6+
Notification Service provides 7 RPC methods.
67

78
## Create Notification
89

@@ -32,7 +33,10 @@ const { notification } = await client.notification.v1.NotificationService
3233
console.log(`Notification created: ${notification?.id}`);
3334
```
3435

35-
The `data` field uses a nested oneof pattern: the outer `data` is the `NotificationData` message, and `data.data` is the oneof that selects the provider-specific configuration. The `case` must match the provider type in lowercase.
36+
The `data` field uses a nested oneof pattern: the outer `data` is the
37+
`NotificationData` message, and `data.data` is the oneof that selects the
38+
provider-specific configuration. The `case` must match the provider type in
39+
lowercase.
3640

3741
## Provider Configurations
3842

0 commit comments

Comments
 (0)