Openstatus sdk www.openstatus.dev

0.0.1 (#1)

* small improvment

* more improvment

* improve sdk

* improve sdk

* typo readme

authored by

Thibault Le Ouay and committed by
GitHub
67ee96a0 94543386

+1424 -158
+1
.gitignore
··· 1 1 .env 2 + npm
+21
LICENSE
··· 1 + MIT License 2 + 3 + Copyright (c) 2026 Openstatus 4 + 5 + Permission is hereby granted, free of charge, to any person obtaining a copy 6 + of this software and associated documentation files (the "Software"), to deal 7 + in the Software without restriction, including without limitation the rights 8 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 + copies of the Software, and to permit persons to whom the Software is 10 + furnished to do so, subject to the following conditions: 11 + 12 + The above copyright notice and this permission notice shall be included in all 13 + copies or substantial portions of the Software. 14 + 15 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 + SOFTWARE.
+412
README.md
··· 1 + # OpenStatus Node.js SDK 2 + 3 + [![JSR](https://jsr.io/badges/@openstatus/sdk-node)](https://jsr.io/@openstatus/sdk-node) 4 + [![npm](https://img.shields.io/npm/v/@openstatushq/sdk-node)](https://www.npmjs.com/package/@openstatushq/sdk-node) 5 + [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 6 + 7 + Official Node.js SDK for [OpenStatus](https://openstatus.dev) - the open-source 8 + monitoring platform. 9 + 10 + ## Features 11 + 12 + - **HTTP Monitoring** - Monitor websites and APIs with customizable assertions 13 + - **TCP Monitoring** - Check database connections and other TCP services 14 + - **DNS Monitoring** - Verify DNS records and resolution 15 + - **Global Regions** - Monitor from 28 locations worldwide 16 + - **Type-safe** - Full TypeScript support with generated types 17 + 18 + ## Installation 19 + 20 + ### JSR 21 + 22 + ```bash 23 + npx jsr add @openstatus/node-sdk 24 + ``` 25 + 26 + ### npm 27 + 28 + ```bash 29 + npm install @openstatus/node-sdk 30 + ``` 31 + 32 + ### Deno 33 + 34 + ```typescript 35 + import { openstatus } from "jsr:@openstatus/node-sdk"; 36 + ``` 37 + 38 + ## Quick Start 39 + 40 + ```typescript 41 + import { openstatus } from "@openstatus/node-sdk"; 42 + 43 + const headers = { 44 + "x-openstatus-key": `Bearer ${process.env.OPENSTATUS_API_KEY}`, 45 + }; 46 + 47 + // Create a monitor 48 + const monitor = await openstatus.monitor.v1.MonitorService.createHTTPMonitor( 49 + { 50 + name: "My API", 51 + url: "https://api.example.com/health", 52 + periodicity: "1m", 53 + method: "GET", 54 + regions: ["ams", "iad", "syd"], 55 + active: true, 56 + statusCodeAssertions: [{ comparator: "EQUAL", target: 200 }], 57 + }, 58 + { headers }, 59 + ); 60 + 61 + console.log(`Monitor created: ${monitor.monitor?.id}`); 62 + 63 + // List all monitors 64 + const { httpMonitors, tcpMonitors, dnsMonitors, totalSize } = 65 + await openstatus.monitor.v1.MonitorService.listMonitors({}, { headers }); 66 + 67 + console.log(`Found ${totalSize} monitors`); 68 + ``` 69 + 70 + ## Authentication 71 + 72 + All API requests require an API key. Get yours from the 73 + [OpenStatus dashboard](https://www.openstatus.dev/app). 74 + 75 + ```typescript 76 + const headers = { 77 + "x-openstatus-key": `Bearer ${process.env.OPENSTATUS_API_KEY}`, 78 + }; 79 + 80 + // Pass headers to any service method 81 + await openstatus.monitor.v1.MonitorService.listMonitors({}, { headers }); 82 + ``` 83 + 84 + ## Environment Variables 85 + 86 + | Variable | Description | Default | 87 + | -------------------- | ----------------------- | -------------------------------- | 88 + | `OPENSTATUS_API_KEY` | Your OpenStatus API key | - | 89 + | `OPENSTATUS_API_URL` | Custom API endpoint | `https://api.openstatus.dev/rpc` | 90 + 91 + ## API Reference 92 + 93 + ### Monitor Service 94 + 95 + #### `createHTTPMonitor(request, options)` 96 + 97 + Create an HTTP/HTTPS monitor. 98 + 99 + ```typescript 100 + const { monitor } = await openstatus.monitor.v1.MonitorService 101 + .createHTTPMonitor( 102 + { 103 + name: "My Website", 104 + url: "https://example.com", 105 + periodicity: "1m", 106 + method: "GET", 107 + regions: ["ams", "iad", "syd"], 108 + active: true, 109 + }, 110 + { headers }, 111 + ); 112 + ``` 113 + 114 + #### `createTCPMonitor(request, options)` 115 + 116 + Create a TCP connection monitor. 117 + 118 + ```typescript 119 + const { monitor } = await openstatus.monitor.v1.MonitorService.createTCPMonitor( 120 + { 121 + name: "Database", 122 + uri: "db.example.com:5432", 123 + periodicity: "5m", 124 + regions: ["ams", "iad"], 125 + active: true, 126 + }, 127 + { headers }, 128 + ); 129 + ``` 130 + 131 + #### `createDNSMonitor(request, options)` 132 + 133 + Create a DNS resolution monitor. 134 + 135 + ```typescript 136 + const { monitor } = await openstatus.monitor.v1.MonitorService.createDNSMonitor( 137 + { 138 + name: "DNS Check", 139 + uri: "example.com", 140 + periodicity: "10m", 141 + regions: ["ams"], 142 + active: true, 143 + recordAssertions: [{ 144 + recordType: "A", 145 + comparator: "EQUAL", 146 + target: "93.184.216.34", 147 + }], 148 + }, 149 + { headers }, 150 + ); 151 + ``` 152 + 153 + #### `listMonitors(request, options)` 154 + 155 + List all monitors with pagination. Returns monitors grouped by type. 156 + 157 + ```typescript 158 + const { httpMonitors, tcpMonitors, dnsMonitors, nextPageToken, totalSize } = 159 + await openstatus.monitor.v1.MonitorService.listMonitors( 160 + { pageSize: 10, pageToken: "" }, 161 + { headers }, 162 + ); 163 + ``` 164 + 165 + #### `triggerMonitor(request, options)` 166 + 167 + Trigger an immediate check. 168 + 169 + ```typescript 170 + await openstatus.monitor.v1.MonitorService.triggerMonitor( 171 + { id: "mon_123" }, 172 + { headers }, 173 + ); 174 + ``` 175 + 176 + #### `deleteMonitor(request, options)` 177 + 178 + Delete a monitor. 179 + 180 + ```typescript 181 + await openstatus.monitor.v1.MonitorService.deleteMonitor( 182 + { id: "mon_123" }, 183 + { headers }, 184 + ); 185 + ``` 186 + 187 + #### `getMonitorStatus(request, options)` 188 + 189 + Get the current status of a monitor across all configured regions. 190 + 191 + ```typescript 192 + const { id, regions } = 193 + await openstatus.monitor.v1.MonitorService.getMonitorStatus( 194 + { id: "mon_123" }, 195 + { headers }, 196 + ); 197 + 198 + // regions is an array of { region, status } 199 + // status: ACTIVE, DEGRADED, or ERROR 200 + for (const { region, status } of regions) { 201 + console.log(`${region}: ${status}`); 202 + } 203 + ``` 204 + 205 + #### `getMonitorSummary(request, options)` 206 + 207 + Get aggregated metrics and latency percentiles for a monitor. 208 + 209 + ```typescript 210 + import { TimeRange } from "@openstatus/node-sdk"; 211 + 212 + const summary = await openstatus.monitor.v1.MonitorService.getMonitorSummary( 213 + { 214 + id: "mon_123", 215 + timeRange: TimeRange.TIME_RANGE_7D, // 1D, 7D, or 14D 216 + regions: [], // optional: filter by specific regions 217 + }, 218 + { headers }, 219 + ); 220 + 221 + console.log(`Last ping: ${summary.lastPingAt}`); 222 + console.log(`Success: ${summary.totalSuccessful}`); 223 + console.log(`Degraded: ${summary.totalDegraded}`); 224 + console.log(`Failed: ${summary.totalFailed}`); 225 + console.log(`P50 latency: ${summary.p50}ms`); 226 + console.log(`P95 latency: ${summary.p95}ms`); 227 + console.log(`P99 latency: ${summary.p99}ms`); 228 + ``` 229 + 230 + ### Health Service 231 + 232 + Check API health status (no authentication required). 233 + 234 + ```typescript 235 + const { status } = await openstatus.health.v1.HealthService.check({}); 236 + console.log(status); // "SERVING" 237 + ``` 238 + 239 + ## Monitor Options 240 + 241 + ### HTTP Monitor 242 + 243 + | Option | Type | Required | Description | 244 + | ---------------------- | -------- | -------- | ------------------------------------------------- | 245 + | `name` | string | Yes | Monitor name (max 256 chars) | 246 + | `url` | string | Yes | URL to monitor | 247 + | `periodicity` | string | No | `30s`, `1m`, `5m`, `10m`, `30m`, `1h` | 248 + | `method` | string | No | `GET`, `POST`, `HEAD`, `PUT`, `PATCH`, `DELETE` | 249 + | `body` | string | No | Request body | 250 + | `headers` | object | No | Custom headers | 251 + | `timeout` | number | No | Timeout in ms (default: 45000, max: 120000) | 252 + | `retry` | number | No | Retry attempts (default: 3, max: 10) | 253 + | `followRedirects` | boolean | No | Follow redirects (default: true) | 254 + | `regions` | string[] | No | [Regions](#regions) for checks | 255 + | `active` | boolean | No | Enable monitoring (default: false) | 256 + | `public` | boolean | No | Public visibility (default: false) | 257 + | `degradedAt` | number | No | Latency threshold (ms) for degraded status | 258 + | `statusCodeAssertions` | array | No | [Status code assertions](#status-code-assertions) | 259 + | `bodyAssertions` | array | No | [Body assertions](#body-assertions) | 260 + | `headerAssertions` | array | No | [Header assertions](#header-assertions) | 261 + 262 + ### TCP Monitor 263 + 264 + | Option | Type | Required | Description | 265 + | ------------- | -------- | -------- | ------------------------------ | 266 + | `name` | string | Yes | Monitor name | 267 + | `uri` | string | Yes | `host:port` to monitor | 268 + | `periodicity` | string | No | Check interval | 269 + | `timeout` | number | No | Timeout in ms (default: 45000) | 270 + | `retry` | number | No | Retry attempts (default: 3) | 271 + | `regions` | string[] | No | [Regions](#regions) for checks | 272 + | `active` | boolean | No | Enable monitoring | 273 + 274 + ### DNS Monitor 275 + 276 + | Option | Type | Required | Description | 277 + | ------------------ | -------- | -------- | ----------------------------------------------- | 278 + | `name` | string | Yes | Monitor name | 279 + | `uri` | string | Yes | Domain to resolve | 280 + | `periodicity` | string | No | Check interval | 281 + | `timeout` | number | No | Timeout in ms (default: 45000) | 282 + | `retry` | number | No | Retry attempts (default: 3) | 283 + | `regions` | string[] | No | [Regions](#regions) for checks | 284 + | `recordAssertions` | array | No | [DNS record assertions](#dns-record-assertions) | 285 + 286 + ## Assertions 287 + 288 + ### Status Code Assertions 289 + 290 + Validate HTTP response status codes. 291 + 292 + ```typescript 293 + { 294 + statusCodeAssertions: [ 295 + { comparator: "EQUAL", target: 200 }, 296 + { comparator: "LESS_THAN", target: 400 }, 297 + ]; 298 + } 299 + ``` 300 + 301 + **Comparators:** `EQUAL`, `NOT_EQUAL`, `GREATER_THAN`, `GREATER_THAN_OR_EQUAL`, 302 + `LESS_THAN`, `LESS_THAN_OR_EQUAL` 303 + 304 + ### Body Assertions 305 + 306 + Validate response body content. 307 + 308 + ```typescript 309 + { 310 + bodyAssertions: [ 311 + { comparator: "CONTAINS", target: '"status":"ok"' }, 312 + { comparator: "NOT_EMPTY" }, 313 + ]; 314 + } 315 + ``` 316 + 317 + **Comparators:** `CONTAINS`, `NOT_CONTAINS`, `EQUAL`, `NOT_EQUAL`, `EMPTY`, 318 + `NOT_EMPTY` 319 + 320 + ### Header Assertions 321 + 322 + Validate response headers. 323 + 324 + ```typescript 325 + { 326 + headerAssertions: [ 327 + { key: "content-type", comparator: "CONTAINS", target: "application/json" }, 328 + ]; 329 + } 330 + ``` 331 + 332 + ### DNS Record Assertions 333 + 334 + Validate DNS records. 335 + 336 + ```typescript 337 + { 338 + recordAssertions: [ 339 + { recordType: "A", comparator: "EQUAL", target: "93.184.216.34" }, 340 + { recordType: "CNAME", comparator: "CONTAINS", target: "cdn" }, 341 + ]; 342 + } 343 + ``` 344 + 345 + **Record types:** `A`, `AAAA`, `CNAME`, `MX`, `TXT` 346 + 347 + ## Regions 348 + 349 + Monitor from 28 global locations across multiple providers: 350 + 351 + ### Fly.io Regions 352 + 353 + | Code | Location | Code | Location | 354 + | ----- | --------------- | ----- | ------------ | 355 + | `ams` | Amsterdam | `lax` | Los Angeles | 356 + | `arn` | Stockholm | `lhr` | London | 357 + | `bom` | Mumbai | `nrt` | Tokyo | 358 + | `cdg` | Paris | `ord` | Chicago | 359 + | `dfw` | Dallas | `sjc` | San Jose | 360 + | `ewr` | Newark | `sin` | Singapore | 361 + | `fra` | Frankfurt | `syd` | Sydney | 362 + | `gru` | São Paulo | `yyz` | Toronto | 363 + | `iad` | Washington D.C. | `jnb` | Johannesburg | 364 + 365 + ### Koyeb Regions 366 + 367 + | Code | Location | 368 + | ----------- | ------------- | 369 + | `koyeb_fra` | Frankfurt | 370 + | `koyeb_par` | Paris | 371 + | `koyeb_sfo` | San Francisco | 372 + | `koyeb_sin` | Singapore | 373 + | `koyeb_tyo` | Tokyo | 374 + | `koyeb_was` | Washington | 375 + 376 + ### Railway Regions 377 + 378 + | Code | Location | 379 + | ----------------------- | -------------- | 380 + | `railway_us_west2` | US West | 381 + | `railway_us_east4` | US East | 382 + | `railway_europe_west4` | Europe West | 383 + | `railway_asia_southeast1` | Asia Southeast | 384 + 385 + ## Error Handling 386 + 387 + The SDK uses Connect RPC. Errors include a `code` and `message`: 388 + 389 + ```typescript 390 + import { ConnectError } from "@connectrpc/connect"; 391 + 392 + try { 393 + await openstatus.monitor.v1.MonitorService.deleteMonitor( 394 + { id: "invalid" }, 395 + { headers }, 396 + ); 397 + } catch (error) { 398 + if (error instanceof ConnectError) { 399 + console.error(`Error ${error.code}: ${error.message}`); 400 + } 401 + } 402 + ``` 403 + 404 + ## Related 405 + 406 + - [OpenStatus](https://openstatus.dev) - Open-source monitoring platform 407 + - [Documentation](https://docs.openstatus.dev) - Full API documentation 408 + - [Status Page](https://status.openstatus.dev) - OpenStatus service status 409 + 410 + ## License 411 + 412 + MIT
+20 -5
deno.json
··· 1 1 { 2 - "tasks": { 3 - "dev": "deno run --env-file --allow-env --allow-net --watch example.ts", 4 - "generate": "buf generate buf.build/openstatus/api" 5 - }, 2 + "name": "@openstatus/sdk-node", 3 + "version": "0.0.1", 4 + "description": "SDK for openstatus", 5 + "license": "MIT", 6 6 "exports": { 7 7 ".": "./src/mod.ts" 8 8 }, 9 + "publish": { 10 + "include": ["src/**/*.ts", "README.md", "LICENSE"], 11 + "exclude": ["**/*_test.ts", "**/*.test.ts"] 12 + }, 13 + "tasks": { 14 + "dev": "deno run --env-file --allow-env --allow-net --watch example.ts", 15 + "generate": "buf generate buf.build/openstatus/api", 16 + "check": "deno check src/mod.ts", 17 + "lint": "deno lint", 18 + "fmt": "deno fmt" 19 + }, 9 20 "imports": { 10 21 "@bufbuild/buf": "npm:@bufbuild/buf@^1.64.0", 11 22 "@bufbuild/protobuf": "npm:@bufbuild/protobuf@^2.11.0", 12 23 "@bufbuild/protoc-gen-es": "npm:@bufbuild/protoc-gen-es@^2.11.0", 13 24 "@connectrpc/connect": "npm:@connectrpc/connect@^2.1.1", 14 25 "@connectrpc/connect-node": "npm:@connectrpc/connect-node@^2.1.1", 15 - "@std/assert": "jsr:@std/assert@1" 26 + "@deno/dnt": "jsr:@deno/dnt@^0.42.3" 27 + }, 28 + "compilerOptions": { 29 + "strict": true, 30 + "noImplicitAny": true 16 31 } 17 32 }
+47 -5
deno.lock
··· 1 1 { 2 2 "version": "5", 3 3 "specifiers": { 4 - "jsr:@std/assert@1": "1.0.17", 4 + "jsr:@david/code-block-writer@^13.0.3": "13.0.3", 5 + "jsr:@deno/dnt@~0.42.3": "0.42.3", 6 + "jsr:@std/fmt@1": "1.0.8", 7 + "jsr:@std/fs@1": "1.0.16", 5 8 "jsr:@std/internal@^1.0.12": "1.0.12", 9 + "jsr:@std/path@1": "1.1.4", 10 + "jsr:@std/path@^1.0.8": "1.1.4", 11 + "jsr:@ts-morph/bootstrap@0.27": "0.27.0", 12 + "jsr:@ts-morph/common@0.27": "0.27.0", 6 13 "npm:@bufbuild/buf@^1.64.0": "1.64.0", 7 14 "npm:@bufbuild/protobuf@^2.11.0": "2.11.0", 8 15 "npm:@bufbuild/protoc-gen-es@^2.11.0": "2.11.0_@bufbuild+protobuf@2.11.0", ··· 10 17 "npm:@connectrpc/connect@^2.1.1": "2.1.1_@bufbuild+protobuf@2.11.0" 11 18 }, 12 19 "jsr": { 13 - "@std/assert@1.0.17": { 14 - "integrity": "df5ebfffe77c03b3fa1401e11c762cc8f603d51021c56c4d15a8c7ab45e90dbe", 20 + "@david/code-block-writer@13.0.3": { 21 + "integrity": "f98c77d320f5957899a61bfb7a9bead7c6d83ad1515daee92dbacc861e13bb7f" 22 + }, 23 + "@deno/dnt@0.42.3": { 24 + "integrity": "62a917a0492f3c8af002dce90605bb0d41f7d29debc06aca40dba72ab65d8ae3", 15 25 "dependencies": [ 16 - "jsr:@std/internal" 26 + "jsr:@david/code-block-writer", 27 + "jsr:@std/fmt", 28 + "jsr:@std/fs", 29 + "jsr:@std/path@1", 30 + "jsr:@ts-morph/bootstrap" 31 + ] 32 + }, 33 + "@std/fmt@1.0.8": { 34 + "integrity": "71e1fc498787e4434d213647a6e43e794af4fd393ef8f52062246e06f7e372b7" 35 + }, 36 + "@std/fs@1.0.16": { 37 + "integrity": "81878f62b6eeda0bf546197fc3daa5327c132fee1273f6113f940784a468b036", 38 + "dependencies": [ 39 + "jsr:@std/path@^1.0.8" 17 40 ] 18 41 }, 19 42 "@std/internal@1.0.12": { 20 43 "integrity": "972a634fd5bc34b242024402972cd5143eac68d8dffaca5eaa4dba30ce17b027" 44 + }, 45 + "@std/path@1.1.4": { 46 + "integrity": "1d2d43f39efb1b42f0b1882a25486647cb851481862dc7313390b2bb044314b5", 47 + "dependencies": [ 48 + "jsr:@std/internal" 49 + ] 50 + }, 51 + "@ts-morph/bootstrap@0.27.0": { 52 + "integrity": "b8d7bc8f7942ce853dde4161b28f9aa96769cef3d8eebafb379a81800b9e2448", 53 + "dependencies": [ 54 + "jsr:@ts-morph/common" 55 + ] 56 + }, 57 + "@ts-morph/common@0.27.0": { 58 + "integrity": "c7b73592d78ce8479b356fd4f3d6ec3c460d77753a8680ff196effea7a939052", 59 + "dependencies": [ 60 + "jsr:@std/fs", 61 + "jsr:@std/path@1" 62 + ] 21 63 } 22 64 }, 23 65 "npm": { ··· 128 170 }, 129 171 "workspace": { 130 172 "dependencies": [ 131 - "jsr:@std/assert@1", 173 + "jsr:@deno/dnt@~0.42.3", 132 174 "npm:@bufbuild/buf@^1.64.0", 133 175 "npm:@bufbuild/protobuf@^2.11.0", 134 176 "npm:@bufbuild/protoc-gen-es@^2.11.0",
+46 -8
example.ts
··· 1 - import { openstatus } from "./src/mod.ts"; 1 + /** 2 + * Example usage of the OpenStatus Node.js SDK. 3 + * 4 + * Run with: deno task dev 5 + */ 6 + import { type HTTPMonitor, openstatus } from "./src/mod.ts"; 2 7 3 - console.log("OpenStatus SDK Node.js"); 4 - const heatlh = await openstatus.health.v1.HealthService.check({}); 8 + async function main(): Promise<void> { 9 + console.log("OpenStatus SDK Example\n"); 5 10 6 - console.log("Health status:", heatlh.status); 11 + // 1. Health check (no authentication required) 12 + console.log("1. Checking API health..."); 13 + const health = await openstatus.health.v1.HealthService.check({}); 14 + console.log(` Status: ${health.status}\n`); 7 15 8 - const monitors = await openstatus.monitor.v1.MonitorService.listMonitors({}, { 9 - headers: { "x-openstatus-key": `Bearer ${process.env.OPENSTATUS_API_KEY}` }, 10 - }); 16 + // 2. List monitors (requires authentication) 17 + const apiKey = process.env.OPENSTATUS_API_KEY; 18 + if (!apiKey) { 19 + console.log("2. Skipping monitor operations (OPENSTATUS_API_KEY not set)"); 20 + console.log( 21 + " Set OPENSTATUS_API_KEY environment variable to test monitor operations.", 22 + ); 23 + return; 24 + } 11 25 12 - console.log("Monitors:", monitors); 26 + const headers = { "x-openstatus-key": `${apiKey}` }; 27 + 28 + console.log("2. Listing monitors..."); 29 + const { httpMonitors, tcpMonitors, dnsMonitors, totalSize } = await openstatus 30 + .monitor.v1.MonitorService.listMonitors({}, { headers }); 31 + 32 + console.log(` Found ${totalSize} monitors:`); 33 + console.log(` - HTTP: ${httpMonitors.length}`); 34 + console.log(` - TCP: ${tcpMonitors.length}`); 35 + console.log(` - DNS: ${dnsMonitors.length}`); 36 + 37 + // 3. Display HTTP monitors 38 + if (httpMonitors.length > 0) { 39 + console.log("\n3. HTTP Monitors:"); 40 + httpMonitors.forEach((monitor: HTTPMonitor) => { 41 + console.log( 42 + ` - ${monitor.name}: ${monitor.url} (${ 43 + monitor.active ? "active" : "paused" 44 + })`, 45 + ); 46 + }); 47 + } 48 + } 49 + 50 + main().catch(console.error);
+31
scripts/build_npm.ts
··· 1 + import { build, emptyDir } from "@deno/dnt"; 2 + 3 + await emptyDir("./npm"); 4 + 5 + await build({ 6 + entryPoints: ["./src/mod.ts"], 7 + outDir: "./npm", 8 + shims: { 9 + // see JS docs for overview and more options 10 + deno: true, 11 + }, 12 + package: { 13 + // package.json properties 14 + name: "@openstatus/sdk-node", 15 + version: Deno.args[0], 16 + description: "SDK for openstatus.", 17 + license: "MIT", 18 + repository: { 19 + type: "git", 20 + url: "git+https://github.com/openstatushq/sdk-node.git", 21 + }, 22 + bugs: { 23 + url: "https://github.com/openstatushq/sdk-nod/issues", 24 + }, 25 + }, 26 + postBuild() { 27 + // steps to run after building and before running the tests 28 + Deno.copyFileSync("LICENSE", "npm/LICENSE"); 29 + Deno.copyFileSync("README.md", "npm/README.md"); 30 + }, 31 + });
+15 -5
src/gen/openstatus/monitor/v1/dns_monitor_pb.ts
··· 9 9 import { file_openstatus_monitor_v1_assertions } from "./assertions_pb.ts"; 10 10 import type { OpenTelemetryConfig } from "./http_monitor_pb.ts"; 11 11 import { file_openstatus_monitor_v1_http_monitor } from "./http_monitor_pb.ts"; 12 + import type { MonitorStatus, Periodicity, Region } from "./monitor_pb.ts"; 13 + import { file_openstatus_monitor_v1_monitor } from "./monitor_pb.ts"; 12 14 import type { Message } from "@bufbuild/protobuf"; 13 15 14 16 /** ··· 16 18 */ 17 19 export const file_openstatus_monitor_v1_dns_monitor: GenFile = /*@__PURE__*/ 18 20 fileDesc( 19 - "CidvcGVuc3RhdHVzL21vbml0b3IvdjEvZG5zX21vbml0b3IucHJvdG8SFW9wZW5zdGF0dXMubW9uaXRvci52MSLrBQoKRE5TTW9uaXRvchIKCgJpZBgBIAEoCRIYCgRuYW1lGAIgASgJQgq6SAdyBRABGIACEhcKA3VyaRgDIAEoCUIKukgHcgUQARiAEBI1CgtwZXJpb2RpY2l0eRgEIAEoCU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RvchIKCgJpZBgBIAEoCRIYCgRuYW1lGAIgASgJQgq6SAdyBRABGIACEhcKA3VyaRgDIAEoCUIKukgHcgUQARiAEBJBCgtwZXJpb2RpY2l0eRgEIAEoDjIiLm9wZW5zdGF0dXMubW9uaXRvci52MS5QZXJpb2RpY2l0eUIIukgFggECIAASHAoHdGltZW91dBgFIAEoA0ILukgIIgYYwKkHKAASJQoLZGVncmFkZWRfYXQYBiABKANCC7pICCIGGMCpBygASACIAQESGAoFcmV0cnkYByABKANCCbpIBiIEGAooABJLChFyZWNvcmRfYXNzZXJ0aW9ucxgIIAMoCzImLm9wZW5zdGF0dXMubW9uaXRvci52MS5SZWNvcmRBc3NlcnRpb25CCLpIBZIBAhAKEh0KC2Rlc2NyaXB0aW9uGAkgASgJQgi6SAVyAxiACBIOCgZhY3RpdmUYCiABKAgSDgoGcHVibGljGAsgASgIEj8KB3JlZ2lvbnMYDCADKA4yHS5vcGVuc3RhdHVzLm1vbml0b3IudjEuUmVnaW9uQg+6SAySAQkQHCIFggECIAASQgoOb3Blbl90ZWxlbWV0cnkYDSABKAsyKi5vcGVuc3RhdHVzLm1vbml0b3IudjEuT3BlblRlbGVtZXRyeUNvbmZpZxI0CgZzdGF0dXMYDiABKA4yJC5vcGVuc3RhdHVzLm1vbml0b3IudjEuTW9uaXRvclN0YXR1c0IOCgxfZGVncmFkZWRfYXRCU1pRZ2l0aHViLmNvbS9vcGVuc3RhdHVzaHEvb3BlbnN0YXR1cy9wYWNrYWdlcy9wcm90by9vcGVuc3RhdHVzL21vbml0b3IvdjE7bW9uaXRvcnYxYgZwcm90bzM", 20 22 [ 21 23 file_buf_validate_validate, 22 24 file_openstatus_monitor_v1_assertions, 23 25 file_openstatus_monitor_v1_http_monitor, 26 + file_openstatus_monitor_v1_monitor, 24 27 ], 25 28 ); 26 29 ··· 54 57 /** 55 58 * Check periodicity (required). 56 59 * 57 - * @generated from field: string periodicity = 4; 60 + * @generated from field: openstatus.monitor.v1.Periodicity periodicity = 4; 58 61 */ 59 - periodicity: string; 62 + periodicity: Periodicity; 60 63 61 64 /** 62 65 * Timeout in milliseconds (0-120000, defaults to 45000). ··· 110 113 /** 111 114 * Geographic regions to run checks from. 112 115 * 113 - * @generated from field: repeated string regions = 12; 116 + * @generated from field: repeated openstatus.monitor.v1.Region regions = 12; 114 117 */ 115 - regions: string[]; 118 + regions: Region[]; 116 119 117 120 /** 118 121 * OpenTelemetry configuration for exporting metrics. ··· 120 123 * @generated from field: openstatus.monitor.v1.OpenTelemetryConfig open_telemetry = 13; 121 124 */ 122 125 openTelemetry?: OpenTelemetryConfig; 126 + 127 + /** 128 + * Current operational status of the monitor. 129 + * 130 + * @generated from field: openstatus.monitor.v1.MonitorStatus status = 14; 131 + */ 132 + status: MonitorStatus; 123 133 }; 124 134 125 135 /**
+24 -59
src/gen/openstatus/monitor/v1/http_monitor_pb.ts
··· 15 15 StatusCodeAssertion, 16 16 } from "./assertions_pb.ts"; 17 17 import { file_openstatus_monitor_v1_assertions } from "./assertions_pb.ts"; 18 + import type { MonitorStatus, Periodicity, Region } from "./monitor_pb.ts"; 19 + import { file_openstatus_monitor_v1_monitor } from "./monitor_pb.ts"; 18 20 import type { Message } from "@bufbuild/protobuf"; 19 21 20 22 /** ··· 22 24 */ 23 25 export const file_openstatus_monitor_v1_http_monitor: GenFile = /*@__PURE__*/ 24 26 fileDesc( 25 - "CihvcGVuc3RhdHVzL21vbml0b3IvdjEvaHR0cF9tb25pdG9yLnByb3RvEhVvcGVuc3RhdHVzLm1vbml0b3IudjEiLgoHSGVhZGVycxIUCgNrZXkYASABKAlCB7pIBHICEAESDQoFdmFsdWUYAiABKAkibAoTT3BlblRlbGVtZXRyeUNvbmZpZxIaCghlbmRwb2ludBgBIAEoCUIIukgFcgMYgBASOQoHaGVhZGVycxgCIAMoCzIeLm9wZW5zdGF0dXMubW9uaXRvci52MS5IZWFkZXJzQgi6SAWSAQIQFCLICAoLSFRUUE1vbml0b3ISCgoCaWQYASABKAkSGAoEbm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vcGVuc3RhdHVzLm1vbml0b3IudjEuSGVhZGVyQXNzZXJ0aW9uQgi6SAWSAQIQChIdCgtkZXNjcmlwdGlvbhgPIAEoCUIIukgFcgMYgAgSDgoGYWN0aXZlGBAgASgIEg4KBnB1YmxpYxgRIAEoCBI/CgdyZWdpb25zGBIgAygOMh0ub3BlbnN0YXR1cy5tb25pdG9yLnYxLlJlZ2lvbkIPukgMkgEJEBwiBYIBAiAAEkIKDm9wZW5fdGVsZW1ldHJ5GBMgASgLMioub3BlbnN0YXR1cy5tb25pdG9yLnYxLk9wZW5UZWxlbWV0cnlDb25maWcSNAoGc3RhdHVzGBQgASgOMiQub3BlbnN0YXR1cy5tb25pdG9yLnYxLk1vbml0b3JTdGF0dXNCDgoMX2RlZ3JhZGVkX2F0QhMKEV9mb2xsb3dfcmVkaXJlY3RzKvcBCgpIVFRQTWV0aG9kEhsKF0hUVFBfTUVUSE9EX1VOU1BFQ0lGSUVEEAASEwoPSFRUUF9NRVRIT0RfR0VUEAESFAoQSFRUUF9NRVRIT0RfUE9TVBACEhQKEEhUVFBfTUVUSE9EX0hFQUQQAxITCg9IVFRQX01FVEhPRF9QVVQQBBIVChFIVFRQX01FVEhPRF9QQVRDSBAFEhYKEkhUVFBfTUVUSE9EX0RFTEVURRAGEhUKEUhUVFBfTUVUSE9EX1RSQUNFEAcSFwoTSFRUUF9NRVRIT0RfQ09OTkVDVBAIEhcKE0hUVFBfTUVUSE9EX09QVElPTlMQCUJTWlFnaXRodWIuY29tL29wZW5zdGF0dXNocS9vcGVuc3RhdHVzL3BhY2thZ2VzL3Byb3RvL29wZW5zdGF0dXMvbW9uaXRvci92MTttb25pdG9ydjFiBnByb3RvMw", 28 + [ 29 + file_buf_validate_validate, 30 + file_openstatus_monitor_v1_assertions, 31 + file_openstatus_monitor_v1_monitor, 32 + ], 27 33 ); 28 34 29 35 /** ··· 112 118 /** 113 119 * Check periodicity (required). 114 120 * 115 - * @generated from field: string periodicity = 4; 121 + * @generated from field: openstatus.monitor.v1.Periodicity periodicity = 4; 116 122 */ 117 - periodicity: string; 123 + periodicity: Periodicity; 118 124 119 125 /** 120 126 * HTTP method to use (defaults to GET). 121 127 * 122 - * @generated from field: string method = 5; 128 + * @generated from field: openstatus.monitor.v1.HTTPMethod method = 5; 123 129 */ 124 - method: string; 130 + method: HTTPMethod; 125 131 126 132 /** 127 133 * Request body (optional). ··· 152 158 retry: bigint; 153 159 154 160 /** 155 - * Whether to follow HTTP redirects (defaults to true). 161 + * Whether to follow HTTP redirects (defaults to true when not specified). 156 162 * 157 - * @generated from field: bool follow_redirects = 10; 163 + * @generated from field: optional bool follow_redirects = 10; 158 164 */ 159 - followRedirects: boolean; 165 + followRedirects?: boolean; 160 166 161 167 /** 162 168 * Custom headers for the request. ··· 210 216 /** 211 217 * Geographic regions to run checks from. 212 218 * 213 - * @generated from field: repeated string regions = 18; 219 + * @generated from field: repeated openstatus.monitor.v1.Region regions = 18; 214 220 */ 215 - regions: string[]; 221 + regions: Region[]; 216 222 217 223 /** 218 224 * OpenTelemetry configuration for exporting metrics. ··· 220 226 * @generated from field: openstatus.monitor.v1.OpenTelemetryConfig open_telemetry = 19; 221 227 */ 222 228 openTelemetry?: OpenTelemetryConfig; 229 + 230 + /** 231 + * Current operational status of the monitor. 232 + * 233 + * @generated from field: openstatus.monitor.v1.MonitorStatus status = 20; 234 + */ 235 + status: MonitorStatus; 223 236 }; 224 237 225 238 /** ··· 291 304 */ 292 305 export const HTTPMethodSchema: GenEnum<HTTPMethod> = /*@__PURE__*/ 293 306 enumDesc(file_openstatus_monitor_v1_http_monitor, 0); 294 - 295 - /** 296 - * Monitor periodicity options. 297 - * 298 - * @generated from enum openstatus.monitor.v1.Periodicity 299 - */ 300 - export enum Periodicity { 301 - /** 302 - * @generated from enum value: PERIODICITY_UNSPECIFIED = 0; 303 - */ 304 - PERIODICITY_UNSPECIFIED = 0, 305 - 306 - /** 307 - * @generated from enum value: PERIODICITY_30S = 1; 308 - */ 309 - PERIODICITY_30S = 1, 310 - 311 - /** 312 - * @generated from enum value: PERIODICITY_1M = 2; 313 - */ 314 - PERIODICITY_1M = 2, 315 - 316 - /** 317 - * @generated from enum value: PERIODICITY_5M = 3; 318 - */ 319 - PERIODICITY_5M = 3, 320 - 321 - /** 322 - * @generated from enum value: PERIODICITY_10M = 4; 323 - */ 324 - PERIODICITY_10M = 4, 325 - 326 - /** 327 - * @generated from enum value: PERIODICITY_30M = 5; 328 - */ 329 - PERIODICITY_30M = 5, 330 - 331 - /** 332 - * @generated from enum value: PERIODICITY_1H = 6; 333 - */ 334 - PERIODICITY_1H = 6, 335 - } 336 - 337 - /** 338 - * Describes the enum openstatus.monitor.v1.Periodicity. 339 - */ 340 - export const PeriodicitySchema: GenEnum<Periodicity> = /*@__PURE__*/ 341 - enumDesc(file_openstatus_monitor_v1_http_monitor, 1);
+274 -65
src/gen/openstatus/monitor/v1/monitor_pb.ts
··· 2 2 // @generated from file openstatus/monitor/v1/monitor.proto (package openstatus.monitor.v1, syntax proto3) 3 3 /* eslint-disable */ 4 4 5 - import type { 6 - GenEnum, 7 - GenFile, 8 - GenMessage, 9 - } from "@bufbuild/protobuf/codegenv2"; 10 - import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; 11 - import type { DNSMonitor } from "./dns_monitor_pb.ts"; 12 - import { file_openstatus_monitor_v1_dns_monitor } from "./dns_monitor_pb.ts"; 13 - import type { HTTPMonitor } from "./http_monitor_pb.ts"; 14 - import { file_openstatus_monitor_v1_http_monitor } from "./http_monitor_pb.ts"; 15 - import type { TCPMonitor } from "./tcp_monitor_pb.ts"; 16 - import { file_openstatus_monitor_v1_tcp_monitor } from "./tcp_monitor_pb.ts"; 17 - import type { Message } from "@bufbuild/protobuf"; 5 + import type { GenEnum, GenFile } from "@bufbuild/protobuf/codegenv2"; 6 + import { enumDesc, fileDesc } from "@bufbuild/protobuf/codegenv2"; 18 7 19 8 /** 20 9 * Describes the file openstatus/monitor/v1/monitor.proto. 21 10 */ 22 11 export const file_openstatus_monitor_v1_monitor: GenFile = /*@__PURE__*/ 23 12 fileDesc( 24 - "CiNvcGVuc3RhdHVzL21vbml0b3IvdjEvbW9uaXRvci5wcm90bxIVb3BlbnN0YXR1cy5tb25pdG9yLnYxIrEBCg1Nb25pdG9yQ29uZmlnEjIKBGh0dHAYASABKAsyIi5vcGVuc3RhdHVzLm1vbml0b3IudjEuSFRUUE1vbml0b3JIABIwCgN0Y3AYAiABKAsyIS5vcGVuc3RhdHVzLm1vbml0b3IudjEuVENQTW9uaXRvckgAEjAKA2RucxgDIAEoCzIhLm9wZW5zdGF0dXMubW9uaXRvci52MS5ETlNNb25pdG9ySABCCAoGY29uZmlnKn8KDU1vbml0b3JTdGF0dXMSHgoaTU9OSVRPUl9TVEFUVVNfVU5TUEVDSUZJRUQQABIZChVNT05JVE9SX1NUQVRVU19BQ1RJVkUQARIZChVNT05JVE9SX1NUQVRVU19QQVVTRUQQAhIYChRNT05JVE9SX1NUQVRVU19FUlJPUhADQlNaUWdpdGh1Yi5jb20vb3BlbnN0YXR1c2hxL29wZW5zdGF0dXMvcGFja2FnZXMvcHJvdG8vb3BlbnN0YXR1cy9tb25pdG9yL3YxO21vbml0b3J2MWIGcHJvdG8z", 25 - [ 26 - file_openstatus_monitor_v1_dns_monitor, 27 - file_openstatus_monitor_v1_http_monitor, 28 - file_openstatus_monitor_v1_tcp_monitor, 29 - ], 13 + "CiNvcGVuc3RhdHVzL21vbml0b3IvdjEvbW9uaXRvci5wcm90bxIVb3BlbnN0YXR1cy5tb25pdG9yLnYxKoEBCg1Nb25pdG9yU3RhdHVzEh4KGk1PTklUT1JfU1RBVFVTX1VOU1BFQ0lGSUVEEAASGQoVTU9OSVRPUl9TVEFUVVNfQUNUSVZFEAESGwoXTU9OSVRPUl9TVEFUVVNfREVHUkFERUQQAhIYChRNT05JVE9SX1NUQVRVU19FUlJPUhADKqUBCgtQZXJpb2RpY2l0eRIbChdQRVJJT0RJQ0lUWV9VTlNQRUNJ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JvdG8z", 30 14 ); 31 15 32 16 /** 33 - * MonitorConfig represents the type-specific configuration for a monitor. 34 - * 35 - * @generated from message openstatus.monitor.v1.MonitorConfig 36 - */ 37 - export type MonitorConfig = Message<"openstatus.monitor.v1.MonitorConfig"> & { 38 - /** 39 - * @generated from oneof openstatus.monitor.v1.MonitorConfig.config 40 - */ 41 - config: { 42 - /** 43 - * HTTP monitor configuration. 44 - * 45 - * @generated from field: openstatus.monitor.v1.HTTPMonitor http = 1; 46 - */ 47 - value: HTTPMonitor; 48 - case: "http"; 49 - } | { 50 - /** 51 - * TCP monitor configuration. 52 - * 53 - * @generated from field: openstatus.monitor.v1.TCPMonitor tcp = 2; 54 - */ 55 - value: TCPMonitor; 56 - case: "tcp"; 57 - } | { 58 - /** 59 - * DNS monitor configuration. 60 - * 61 - * @generated from field: openstatus.monitor.v1.DNSMonitor dns = 3; 62 - */ 63 - value: DNSMonitor; 64 - case: "dns"; 65 - } | { case: undefined; value?: undefined }; 66 - }; 67 - 68 - /** 69 - * Describes the message openstatus.monitor.v1.MonitorConfig. 70 - * Use `create(MonitorConfigSchema)` to create a new message. 71 - */ 72 - export const MonitorConfigSchema: GenMessage<MonitorConfig> = /*@__PURE__*/ 73 - messageDesc(file_openstatus_monitor_v1_monitor, 0); 74 - 75 - /** 76 17 * MonitorStatus represents the operational status of a monitor. 77 18 * 78 19 * @generated from enum openstatus.monitor.v1.MonitorStatus ··· 93 34 ACTIVE = 1, 94 35 95 36 /** 96 - * MONITOR_STATUS_PAUSED indicates the monitor is paused. 37 + * MONITOR_STATUS_DEGRADED indicates the monitor is degraded. 97 38 * 98 - * @generated from enum value: MONITOR_STATUS_PAUSED = 2; 39 + * @generated from enum value: MONITOR_STATUS_DEGRADED = 2; 99 40 */ 100 - PAUSED = 2, 41 + DEGRADED = 2, 101 42 102 43 /** 103 44 * MONITOR_STATUS_ERROR indicates the monitor is in an error state. ··· 112 53 */ 113 54 export const MonitorStatusSchema: GenEnum<MonitorStatus> = /*@__PURE__*/ 114 55 enumDesc(file_openstatus_monitor_v1_monitor, 0); 56 + 57 + /** 58 + * Monitor periodicity options. 59 + * 60 + * @generated from enum openstatus.monitor.v1.Periodicity 61 + */ 62 + export enum Periodicity { 63 + /** 64 + * @generated from enum value: PERIODICITY_UNSPECIFIED = 0; 65 + */ 66 + PERIODICITY_UNSPECIFIED = 0, 67 + 68 + /** 69 + * @generated from enum value: PERIODICITY_30S = 1; 70 + */ 71 + PERIODICITY_30S = 1, 72 + 73 + /** 74 + * @generated from enum value: PERIODICITY_1M = 2; 75 + */ 76 + PERIODICITY_1M = 2, 77 + 78 + /** 79 + * @generated from enum value: PERIODICITY_5M = 3; 80 + */ 81 + PERIODICITY_5M = 3, 82 + 83 + /** 84 + * @generated from enum value: PERIODICITY_10M = 4; 85 + */ 86 + PERIODICITY_10M = 4, 87 + 88 + /** 89 + * @generated from enum value: PERIODICITY_30M = 5; 90 + */ 91 + PERIODICITY_30M = 5, 92 + 93 + /** 94 + * @generated from enum value: PERIODICITY_1H = 6; 95 + */ 96 + PERIODICITY_1H = 6, 97 + } 98 + 99 + /** 100 + * Describes the enum openstatus.monitor.v1.Periodicity. 101 + */ 102 + export const PeriodicitySchema: GenEnum<Periodicity> = /*@__PURE__*/ 103 + enumDesc(file_openstatus_monitor_v1_monitor, 1); 104 + 105 + /** 106 + * Geographic regions where monitors can run checks from. 107 + * 108 + * @generated from enum openstatus.monitor.v1.Region 109 + */ 110 + export enum Region { 111 + /** 112 + * @generated from enum value: REGION_UNSPECIFIED = 0; 113 + */ 114 + UNSPECIFIED = 0, 115 + 116 + /** 117 + * Fly.io regions 118 + * 119 + * Amsterdam, Netherlands 120 + * 121 + * @generated from enum value: REGION_AMS = 1; 122 + */ 123 + AMS = 1, 124 + 125 + /** 126 + * Stockholm, Sweden 127 + * 128 + * @generated from enum value: REGION_ARN = 2; 129 + */ 130 + ARN = 2, 131 + 132 + /** 133 + * Mumbai, India 134 + * 135 + * @generated from enum value: REGION_BOM = 3; 136 + */ 137 + BOM = 3, 138 + 139 + /** 140 + * Paris, France 141 + * 142 + * @generated from enum value: REGION_CDG = 4; 143 + */ 144 + CDG = 4, 145 + 146 + /** 147 + * Dallas, USA 148 + * 149 + * @generated from enum value: REGION_DFW = 5; 150 + */ 151 + DFW = 5, 152 + 153 + /** 154 + * Newark, USA 155 + * 156 + * @generated from enum value: REGION_EWR = 6; 157 + */ 158 + EWR = 6, 159 + 160 + /** 161 + * Frankfurt, Germany 162 + * 163 + * @generated from enum value: REGION_FRA = 7; 164 + */ 165 + FRA = 7, 166 + 167 + /** 168 + * São Paulo, Brazil 169 + * 170 + * @generated from enum value: REGION_GRU = 8; 171 + */ 172 + GRU = 8, 173 + 174 + /** 175 + * Ashburn, USA 176 + * 177 + * @generated from enum value: REGION_IAD = 9; 178 + */ 179 + IAD = 9, 180 + 181 + /** 182 + * Johannesburg, South Africa 183 + * 184 + * @generated from enum value: REGION_JNB = 10; 185 + */ 186 + JNB = 10, 187 + 188 + /** 189 + * Los Angeles, USA 190 + * 191 + * @generated from enum value: REGION_LAX = 11; 192 + */ 193 + LAX = 11, 194 + 195 + /** 196 + * London, UK 197 + * 198 + * @generated from enum value: REGION_LHR = 12; 199 + */ 200 + LHR = 12, 201 + 202 + /** 203 + * Tokyo, Japan 204 + * 205 + * @generated from enum value: REGION_NRT = 13; 206 + */ 207 + NRT = 13, 208 + 209 + /** 210 + * Chicago, USA 211 + * 212 + * @generated from enum value: REGION_ORD = 14; 213 + */ 214 + ORD = 14, 215 + 216 + /** 217 + * San Jose, USA 218 + * 219 + * @generated from enum value: REGION_SJC = 15; 220 + */ 221 + SJC = 15, 222 + 223 + /** 224 + * Singapore 225 + * 226 + * @generated from enum value: REGION_SIN = 16; 227 + */ 228 + SIN = 16, 229 + 230 + /** 231 + * Sydney, Australia 232 + * 233 + * @generated from enum value: REGION_SYD = 17; 234 + */ 235 + SYD = 17, 236 + 237 + /** 238 + * Toronto, Canada 239 + * 240 + * @generated from enum value: REGION_YYZ = 18; 241 + */ 242 + YYZ = 18, 243 + 244 + /** 245 + * Koyeb regions 246 + * 247 + * Koyeb Frankfurt 248 + * 249 + * @generated from enum value: REGION_KOYEB_FRA = 19; 250 + */ 251 + KOYEB_FRA = 19, 252 + 253 + /** 254 + * Koyeb Paris 255 + * 256 + * @generated from enum value: REGION_KOYEB_PAR = 20; 257 + */ 258 + KOYEB_PAR = 20, 259 + 260 + /** 261 + * Koyeb San Francisco 262 + * 263 + * @generated from enum value: REGION_KOYEB_SFO = 21; 264 + */ 265 + KOYEB_SFO = 21, 266 + 267 + /** 268 + * Koyeb Singapore 269 + * 270 + * @generated from enum value: REGION_KOYEB_SIN = 22; 271 + */ 272 + KOYEB_SIN = 22, 273 + 274 + /** 275 + * Koyeb Tokyo 276 + * 277 + * @generated from enum value: REGION_KOYEB_TYO = 23; 278 + */ 279 + KOYEB_TYO = 23, 280 + 281 + /** 282 + * Koyeb Washington 283 + * 284 + * @generated from enum value: REGION_KOYEB_WAS = 24; 285 + */ 286 + KOYEB_WAS = 24, 287 + 288 + /** 289 + * Railway regions 290 + * 291 + * Railway US West 292 + * 293 + * @generated from enum value: REGION_RAILWAY_US_WEST2 = 25; 294 + */ 295 + RAILWAY_US_WEST2 = 25, 296 + 297 + /** 298 + * Railway US East 299 + * 300 + * @generated from enum value: REGION_RAILWAY_US_EAST4 = 26; 301 + */ 302 + RAILWAY_US_EAST4 = 26, 303 + 304 + /** 305 + * Railway Europe West 306 + * 307 + * @generated from enum value: REGION_RAILWAY_EUROPE_WEST4 = 27; 308 + */ 309 + RAILWAY_EUROPE_WEST4 = 27, 310 + 311 + /** 312 + * Railway Asia Southeast 313 + * 314 + * @generated from enum value: REGION_RAILWAY_ASIA_SOUTHEAST1 = 28; 315 + */ 316 + RAILWAY_ASIA_SOUTHEAST1 = 28, 317 + } 318 + 319 + /** 320 + * Describes the enum openstatus.monitor.v1.Region. 321 + */ 322 + export const RegionSchema: GenEnum<Region> = /*@__PURE__*/ 323 + enumDesc(file_openstatus_monitor_v1_monitor, 2);
+343 -1
src/gen/openstatus/monitor/v1/service_pb.ts
··· 3 3 /* eslint-disable */ 4 4 5 5 import type { 6 + GenEnum, 6 7 GenFile, 7 8 GenMessage, 8 9 GenService, 9 10 } from "@bufbuild/protobuf/codegenv2"; 10 11 import { 12 + enumDesc, 11 13 fileDesc, 12 14 messageDesc, 13 15 serviceDesc, ··· 17 19 import { file_openstatus_monitor_v1_dns_monitor } from "./dns_monitor_pb.ts"; 18 20 import type { HTTPMonitor } from "./http_monitor_pb.ts"; 19 21 import { file_openstatus_monitor_v1_http_monitor } from "./http_monitor_pb.ts"; 22 + import type { MonitorStatus, Region } from "./monitor_pb.ts"; 23 + import { file_openstatus_monitor_v1_monitor } from "./monitor_pb.ts"; 20 24 import type { TCPMonitor } from "./tcp_monitor_pb.ts"; 21 25 import { file_openstatus_monitor_v1_tcp_monitor } from "./tcp_monitor_pb.ts"; 22 26 import type { Message } from "@bufbuild/protobuf"; ··· 26 30 */ 27 31 export const file_openstatus_monitor_v1_service: GenFile = /*@__PURE__*/ 28 32 fileDesc( 29 - "CiNvcGVuc3RhdHVzL21vbml0b3IvdjEvc2VydmljZS5wcm90bxIVb3BlbnN0YXR1cy5tb25pdG9yLnYxIlcKGENyZWF0ZUhUVFBNb25pdG9yUmVxdWVzdBI7Cgdtb25pdG9yGAEgASgLMiIub3BlbnN0YXR1cy5tb25pdG9yLnYxLkhUVFBNb25pdG9yQga6SAPIAQEiUAoZQ3JlYXRlSFRUUE1vbml0b3JSZXNwb25zZRIzCgdtb25pdG9yGAEgASgLMiIub3BlbnN0YXR1cy5tb25pdG9yLnYxLkhUVFBNb25pdG9yIlUKF0NyZWF0ZVRDUE1vbml0b3JSZXF1ZXN0EjoKB21vbml0b3IYASABKAsyIS5vcGVuc3RhdHVzLm1vbml0b3IudjEuVENQTW9uaXRvckIGukgDyAEBIk4KGENyZWF0ZVRDUE1vbml0b3JSZXNwb25zZRIyCgdtb25pdG9yGAEgASgLMiEub3Blb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ci52MS5UcmlnZ2VyTW9uaXRvclJlc3BvbnNlEmoKDURlbGV0ZU1vbml0b3ISKy5vcGVuc3RhdHVzLm1vbml0b3IudjEuRGVsZXRlTW9uaXRvclJlcXVlc3QaLC5vcGVuc3RhdHVzLm1vbml0b3IudjEuRGVsZXRlTW9uaXRvclJlc3BvbnNlEmcKDExpc3RNb25pdG9ycxIqLm9wZW5zdGF0dXMubW9uaXRvci52MS5MaXN0TW9uaXRvcnNSZXF1ZXN0Gisub3BlbnN0YXR1cy5tb25pdG9yLnYxLkxpc3RNb25pdG9yc1Jlc3BvbnNlEnMKEEdldE1vbml0b3JTdGF0dXMSLi5vcGVuc3RhdHVzLm1vbml0b3IudjEuR2V0TW9uaXRvclN0YXR1c1JlcXVlc3QaLy5vcGVuc3RhdHVzLm1vbml0b3IudjEuR2V0TW9uaXRvclN0YXR1c1Jlc3BvbnNlEnYKEUdldE1vbml0b3JTdW1tYXJ5Ei8ub3BlbnN0YXR1cy5tb25pdG9yLnYxLkdldE1vbml0b3JTdW1tYXJ5UmVxdWVzdBowLm9wZW5zdGF0dXMubW9uaXRvci52MS5HZXRNb25pdG9yU3VtbWFyeVJlc3BvbnNlQlNaUWdpdGh1Yi5jb20vb3BlbnN0YXR1c2hxL29wZW5zdGF0dXMvcGFja2FnZXMvcHJvdG8vb3BlbnN0YXR1cy9tb25pdG9yL3YxO21vbml0b3J2MWIGcHJvdG8z", 30 34 [ 31 35 file_buf_validate_validate, 32 36 file_openstatus_monitor_v1_dns_monitor, 33 37 file_openstatus_monitor_v1_http_monitor, 38 + file_openstatus_monitor_v1_monitor, 34 39 file_openstatus_monitor_v1_tcp_monitor, 35 40 ], 36 41 ); ··· 352 357 * @generated from field: string next_page_token = 4; 353 358 */ 354 359 nextPageToken: string; 360 + 361 + /** 362 + * Total number of monitors across all pages. 363 + * 364 + * @generated from field: int32 total_size = 5; 365 + */ 366 + totalSize: number; 355 367 }; 356 368 357 369 /** ··· 364 376 messageDesc(file_openstatus_monitor_v1_service, 11); 365 377 366 378 /** 379 + * GetMonitorStatusRequest is the request to get the status of all regions for a monitor. 380 + * 381 + * @generated from message openstatus.monitor.v1.GetMonitorStatusRequest 382 + */ 383 + export type GetMonitorStatusRequest = 384 + & Message<"openstatus.monitor.v1.GetMonitorStatusRequest"> 385 + & { 386 + /** 387 + * Monitor ID to get status for (required). 388 + * 389 + * @generated from field: string id = 1; 390 + */ 391 + id: string; 392 + }; 393 + 394 + /** 395 + * Describes the message openstatus.monitor.v1.GetMonitorStatusRequest. 396 + * Use `create(GetMonitorStatusRequestSchema)` to create a new message. 397 + */ 398 + export const GetMonitorStatusRequestSchema: GenMessage< 399 + GetMonitorStatusRequest 400 + > = /*@__PURE__*/ 401 + messageDesc(file_openstatus_monitor_v1_service, 12); 402 + 403 + /** 404 + * RegionStatus represents the status of a monitor in a specific region. 405 + * 406 + * @generated from message openstatus.monitor.v1.RegionStatus 407 + */ 408 + export type RegionStatus = Message<"openstatus.monitor.v1.RegionStatus"> & { 409 + /** 410 + * The region identifier. 411 + * 412 + * @generated from field: openstatus.monitor.v1.Region region = 1; 413 + */ 414 + region: Region; 415 + 416 + /** 417 + * The status of the monitor in this region. 418 + * 419 + * @generated from field: openstatus.monitor.v1.MonitorStatus status = 2; 420 + */ 421 + status: MonitorStatus; 422 + }; 423 + 424 + /** 425 + * Describes the message openstatus.monitor.v1.RegionStatus. 426 + * Use `create(RegionStatusSchema)` to create a new message. 427 + */ 428 + export const RegionStatusSchema: GenMessage<RegionStatus> = /*@__PURE__*/ 429 + messageDesc(file_openstatus_monitor_v1_service, 13); 430 + 431 + /** 432 + * GetMonitorStatusResponse is the response containing the status of all regions for a monitor. 433 + * 434 + * @generated from message openstatus.monitor.v1.GetMonitorStatusResponse 435 + */ 436 + export type GetMonitorStatusResponse = 437 + & Message<"openstatus.monitor.v1.GetMonitorStatusResponse"> 438 + & { 439 + /** 440 + * Monitor ID. 441 + * 442 + * @generated from field: string id = 1; 443 + */ 444 + id: string; 445 + 446 + /** 447 + * Status for each region. 448 + * 449 + * @generated from field: repeated openstatus.monitor.v1.RegionStatus regions = 2; 450 + */ 451 + regions: RegionStatus[]; 452 + }; 453 + 454 + /** 455 + * Describes the message openstatus.monitor.v1.GetMonitorStatusResponse. 456 + * Use `create(GetMonitorStatusResponseSchema)` to create a new message. 457 + */ 458 + export const GetMonitorStatusResponseSchema: GenMessage< 459 + GetMonitorStatusResponse 460 + > = /*@__PURE__*/ 461 + messageDesc(file_openstatus_monitor_v1_service, 14); 462 + 463 + /** 464 + * MonitorConfig represents the type-specific configuration for a monitor. 465 + * 466 + * @generated from message openstatus.monitor.v1.MonitorConfig 467 + */ 468 + export type MonitorConfig = Message<"openstatus.monitor.v1.MonitorConfig"> & { 469 + /** 470 + * @generated from oneof openstatus.monitor.v1.MonitorConfig.config 471 + */ 472 + config: { 473 + /** 474 + * HTTP monitor configuration. 475 + * 476 + * @generated from field: openstatus.monitor.v1.HTTPMonitor http = 1; 477 + */ 478 + value: HTTPMonitor; 479 + case: "http"; 480 + } | { 481 + /** 482 + * TCP monitor configuration. 483 + * 484 + * @generated from field: openstatus.monitor.v1.TCPMonitor tcp = 2; 485 + */ 486 + value: TCPMonitor; 487 + case: "tcp"; 488 + } | { 489 + /** 490 + * DNS monitor configuration. 491 + * 492 + * @generated from field: openstatus.monitor.v1.DNSMonitor dns = 3; 493 + */ 494 + value: DNSMonitor; 495 + case: "dns"; 496 + } | { case: undefined; value?: undefined }; 497 + }; 498 + 499 + /** 500 + * Describes the message openstatus.monitor.v1.MonitorConfig. 501 + * Use `create(MonitorConfigSchema)` to create a new message. 502 + */ 503 + export const MonitorConfigSchema: GenMessage<MonitorConfig> = /*@__PURE__*/ 504 + messageDesc(file_openstatus_monitor_v1_service, 15); 505 + 506 + /** 507 + * GetMonitorSummaryRequest is the request to get aggregated metrics for a monitor. 508 + * 509 + * @generated from message openstatus.monitor.v1.GetMonitorSummaryRequest 510 + */ 511 + export type GetMonitorSummaryRequest = 512 + & Message<"openstatus.monitor.v1.GetMonitorSummaryRequest"> 513 + & { 514 + /** 515 + * Monitor ID to get summary for (required). 516 + * 517 + * @generated from field: string id = 1; 518 + */ 519 + id: string; 520 + 521 + /** 522 + * Time range for metrics aggregation (defaults to 1 day if unspecified). 523 + * 524 + * @generated from field: openstatus.monitor.v1.TimeRange time_range = 2; 525 + */ 526 + timeRange: TimeRange; 527 + 528 + /** 529 + * Optional filter by regions. If empty, returns metrics for all regions. 530 + * 531 + * @generated from field: repeated openstatus.monitor.v1.Region regions = 3; 532 + */ 533 + regions: Region[]; 534 + }; 535 + 536 + /** 537 + * Describes the message openstatus.monitor.v1.GetMonitorSummaryRequest. 538 + * Use `create(GetMonitorSummaryRequestSchema)` to create a new message. 539 + */ 540 + export const GetMonitorSummaryRequestSchema: GenMessage< 541 + GetMonitorSummaryRequest 542 + > = /*@__PURE__*/ 543 + messageDesc(file_openstatus_monitor_v1_service, 16); 544 + 545 + /** 546 + * GetMonitorSummaryResponse is the response containing aggregated metrics for a monitor. 547 + * 548 + * @generated from message openstatus.monitor.v1.GetMonitorSummaryResponse 549 + */ 550 + export type GetMonitorSummaryResponse = 551 + & Message<"openstatus.monitor.v1.GetMonitorSummaryResponse"> 552 + & { 553 + /** 554 + * Monitor ID. 555 + * 556 + * @generated from field: string id = 1; 557 + */ 558 + id: string; 559 + 560 + /** 561 + * Timestamp of the last check in RFC 3339 format. 562 + * 563 + * @generated from field: string last_ping_at = 2; 564 + */ 565 + lastPingAt: string; 566 + 567 + /** 568 + * Total number of successful requests. 569 + * 570 + * @generated from field: int64 total_successful = 3; 571 + */ 572 + totalSuccessful: bigint; 573 + 574 + /** 575 + * Total number of degraded requests. 576 + * 577 + * @generated from field: int64 total_degraded = 4; 578 + */ 579 + totalDegraded: bigint; 580 + 581 + /** 582 + * Total number of failed requests. 583 + * 584 + * @generated from field: int64 total_failed = 5; 585 + */ 586 + totalFailed: bigint; 587 + 588 + /** 589 + * 50th percentile (median) latency in milliseconds. 590 + * 591 + * @generated from field: int64 p50 = 6; 592 + */ 593 + p50: bigint; 594 + 595 + /** 596 + * 75th percentile latency in milliseconds. 597 + * 598 + * @generated from field: int64 p75 = 7; 599 + */ 600 + p75: bigint; 601 + 602 + /** 603 + * 90th percentile latency in milliseconds. 604 + * 605 + * @generated from field: int64 p90 = 8; 606 + */ 607 + p90: bigint; 608 + 609 + /** 610 + * 95th percentile latency in milliseconds. 611 + * 612 + * @generated from field: int64 p95 = 9; 613 + */ 614 + p95: bigint; 615 + 616 + /** 617 + * 99th percentile latency in milliseconds. 618 + * 619 + * @generated from field: int64 p99 = 10; 620 + */ 621 + p99: bigint; 622 + 623 + /** 624 + * Time range used for the metrics. 625 + * 626 + * @generated from field: openstatus.monitor.v1.TimeRange time_range = 11; 627 + */ 628 + timeRange: TimeRange; 629 + 630 + /** 631 + * Regions included in the metrics. 632 + * 633 + * @generated from field: repeated openstatus.monitor.v1.Region regions = 12; 634 + */ 635 + regions: Region[]; 636 + }; 637 + 638 + /** 639 + * Describes the message openstatus.monitor.v1.GetMonitorSummaryResponse. 640 + * Use `create(GetMonitorSummaryResponseSchema)` to create a new message. 641 + */ 642 + export const GetMonitorSummaryResponseSchema: GenMessage< 643 + GetMonitorSummaryResponse 644 + > = /*@__PURE__*/ 645 + messageDesc(file_openstatus_monitor_v1_service, 17); 646 + 647 + /** 648 + * TimeRange represents the time period for metrics aggregation. 649 + * 650 + * @generated from enum openstatus.monitor.v1.TimeRange 651 + */ 652 + export enum TimeRange { 653 + /** 654 + * Unspecified time range. 655 + * 656 + * @generated from enum value: TIME_RANGE_UNSPECIFIED = 0; 657 + */ 658 + TIME_RANGE_UNSPECIFIED = 0, 659 + 660 + /** 661 + * Last 24 hours. 662 + * 663 + * @generated from enum value: TIME_RANGE_1D = 1; 664 + */ 665 + TIME_RANGE_1D = 1, 666 + 667 + /** 668 + * Last 7 days. 669 + * 670 + * @generated from enum value: TIME_RANGE_7D = 2; 671 + */ 672 + TIME_RANGE_7D = 2, 673 + 674 + /** 675 + * Last 14 days. 676 + * 677 + * @generated from enum value: TIME_RANGE_14D = 3; 678 + */ 679 + TIME_RANGE_14D = 3, 680 + } 681 + 682 + /** 683 + * Describes the enum openstatus.monitor.v1.TimeRange. 684 + */ 685 + export const TimeRangeSchema: GenEnum<TimeRange> = /*@__PURE__*/ 686 + enumDesc(file_openstatus_monitor_v1_service, 0); 687 + 688 + /** 367 689 * MonitorService provides CRUD and operational commands for monitors. 368 690 * 369 691 * @generated from service openstatus.monitor.v1.MonitorService ··· 428 750 methodKind: "unary"; 429 751 input: typeof ListMonitorsRequestSchema; 430 752 output: typeof ListMonitorsResponseSchema; 753 + }; 754 + /** 755 + * GetMonitorStatus returns the status of all regions for a monitor. 756 + * 757 + * @generated from rpc openstatus.monitor.v1.MonitorService.GetMonitorStatus 758 + */ 759 + getMonitorStatus: { 760 + methodKind: "unary"; 761 + input: typeof GetMonitorStatusRequestSchema; 762 + output: typeof GetMonitorStatusResponseSchema; 763 + }; 764 + /** 765 + * GetMonitorSummary returns aggregated metrics and statistics for a monitor. 766 + * 767 + * @generated from rpc openstatus.monitor.v1.MonitorService.GetMonitorSummary 768 + */ 769 + getMonitorSummary: { 770 + methodKind: "unary"; 771 + input: typeof GetMonitorSummaryRequestSchema; 772 + output: typeof GetMonitorSummaryResponseSchema; 431 773 }; 432 774 }> = /*@__PURE__*/ 433 775 serviceDesc(file_openstatus_monitor_v1_service, 0);
+19 -6
src/gen/openstatus/monitor/v1/tcp_monitor_pb.ts
··· 7 7 import { file_buf_validate_validate } from "../../../buf/validate/validate_pb.ts"; 8 8 import type { OpenTelemetryConfig } from "./http_monitor_pb.ts"; 9 9 import { file_openstatus_monitor_v1_http_monitor } from "./http_monitor_pb.ts"; 10 + import type { MonitorStatus, Periodicity, Region } from "./monitor_pb.ts"; 11 + import { file_openstatus_monitor_v1_monitor } from "./monitor_pb.ts"; 10 12 import type { Message } from "@bufbuild/protobuf"; 11 13 12 14 /** ··· 14 16 */ 15 17 export const file_openstatus_monitor_v1_t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cy9wcm90by9vcGVuc3RhdHVzL21vbml0b3IvdjE7bW9uaXRvcnYxYgZwcm90bzM", 18 - [file_buf_validate_validate, file_openstatus_monitor_v1_http_monitor], 19 + "CidvcGVuc3RhdHVzL21vbml0b3IvdjEvdGNwX21vbml0b3IucHJvdG8SFW9wZW5zdGF0dXMubW9uaXRvci52MSL3AwoKVENQTW9uaXRvchIKCgJpZBgBIAEoCRIYCgRuYW1lGAIgASgJQgq6SAdyBRABGIACEhcKA3VyaRgDIAEoCUIKukgHcgUQARiAEBJBCgtwZXJpb2RpY2l0eRgEIAEoDjIiLm9wZW5zdGF0dXMubW9uaXRvci52MS5QZXJpb2RpY2l0eUIIukgFggECIAASHAoHdGltZW91dBgFIAEoA0ILukgIIgYYwKkHKAASJQoLZGVncmFkZWRfYXQYBiABKANCC7pICCIGGMCpBygASACIAQESGAoFcmV0cnkYByABKANCCbpIBiIEGAooABIdCgtkZXNjcmlwdGlvbhgIIAEoCUIIukgFcgMYgAgSDgoGYWN0aXZlGAkgASgIEg4KBnB1YmxpYxgKIAEoCBI/CgdyZWdpb25zGAsgAygOMh0ub3BlbnN0YXR1cy5tb25pdG9yLnYxLlJlZ2lvbkIPukgMkgEJEBwiBYIBAiAAEkIKDm9wZW5fdGVsZW1ldHJ5GAwgASgLMioub3BlbnN0YXR1cy5tb25pdG9yLnYxLk9wZW5UZWxlbWV0cnlDb25maWcSNAoGc3RhdHVzGA0gASgOMiQub3BlbnN0YXR1cy5tb25pdG9yLnYxLk1vbml0b3JTdGF0dXNCDgoMX2RlZ3JhZGVkX2F0QlNaUWdpdGh1Yi5jb20vb3BlbnN0YXR1c2hxL29wZW5zdGF0dXMvcGFja2FnZXMvcHJvdG8vb3BlbnN0YXR1cy9tb25pdG9yL3YxO21vbml0b3J2MWIGcHJvdG8z", 20 + [ 21 + file_buf_validate_validate, 22 + file_openstatus_monitor_v1_http_monitor, 23 + file_openstatus_monitor_v1_monitor, 24 + ], 19 25 ); 20 26 21 27 /** ··· 48 54 /** 49 55 * Check periodicity (required). 50 56 * 51 - * @generated from field: string periodicity = 4; 57 + * @generated from field: openstatus.monitor.v1.Periodicity periodicity = 4; 52 58 */ 53 - periodicity: string; 59 + periodicity: Periodicity; 54 60 55 61 /** 56 62 * Timeout in milliseconds (0-120000, defaults to 45000). ··· 97 103 /** 98 104 * Geographic regions to run checks from. 99 105 * 100 - * @generated from field: repeated string regions = 11; 106 + * @generated from field: repeated openstatus.monitor.v1.Region regions = 11; 101 107 */ 102 - regions: string[]; 108 + regions: Region[]; 103 109 104 110 /** 105 111 * OpenTelemetry configuration for exporting metrics. ··· 107 113 * @generated from field: openstatus.monitor.v1.OpenTelemetryConfig open_telemetry = 12; 108 114 */ 109 115 openTelemetry?: OpenTelemetryConfig; 116 + 117 + /** 118 + * Current operational status of the monitor. 119 + * 120 + * @generated from field: openstatus.monitor.v1.MonitorStatus status = 13; 121 + */ 122 + status: MonitorStatus; 110 123 }; 111 124 112 125 /**
+171 -4
src/mod.ts
··· 1 + /** 2 + * @module 3 + * 4 + * Official Node.js SDK for OpenStatus - the open-source monitoring platform. 5 + * 6 + * @example Basic usage 7 + * ```typescript 8 + * import { openstatus } from "@openstatus/node-sdk"; 9 + * 10 + * const headers = { 11 + * "x-openstatus-key": `Bearer ${process.env.OPENSTATUS_API_KEY}`, 12 + * }; 13 + * 14 + * // List all monitors 15 + * const { httpMonitors, tcpMonitors, dnsMonitors } = 16 + * await openstatus.monitor.v1.MonitorService.listMonitors({}, { headers }); 17 + * 18 + * // Create an HTTP monitor 19 + * const { monitor } = await openstatus.monitor.v1.MonitorService.createHTTPMonitor({ 20 + * name: "My API", 21 + * url: "https://api.example.com/health", 22 + * periodicity: "1m", 23 + * regions: ["ams", "iad", "syd"], 24 + * active: true, 25 + * }, { headers }); 26 + * ``` 27 + */ 28 + 29 + import type { Client } from "@connectrpc/connect"; 1 30 import { createClient } from "@connectrpc/connect"; 2 31 import { createConnectTransport } from "@connectrpc/connect-node"; 3 32 import { MonitorService } from "./gen/openstatus/monitor/v1/service_pb.ts"; 4 33 import { HealthService } from "./gen/openstatus/health/v1/health_pb.ts"; 5 34 35 + // Re-export monitor types 36 + export type { 37 + Headers, 38 + HTTPMonitor, 39 + OpenTelemetryConfig, 40 + } from "./gen/openstatus/monitor/v1/http_monitor_pb.ts"; 41 + 42 + export type { TCPMonitor } from "./gen/openstatus/monitor/v1/tcp_monitor_pb.ts"; 43 + 44 + export type { DNSMonitor } from "./gen/openstatus/monitor/v1/dns_monitor_pb.ts"; 45 + 46 + // Re-export assertion types 47 + export type { 48 + BodyAssertion, 49 + HeaderAssertion, 50 + RecordAssertion, 51 + StatusCodeAssertion, 52 + } from "./gen/openstatus/monitor/v1/assertions_pb.ts"; 53 + 54 + // Re-export enums 55 + export { HTTPMethod } from "./gen/openstatus/monitor/v1/http_monitor_pb.ts"; 56 + 57 + export { Periodicity, Region } from "./gen/openstatus/monitor/v1/monitor_pb.ts"; 58 + 59 + export { MonitorStatus } from "./gen/openstatus/monitor/v1/monitor_pb.ts"; 60 + 61 + // Re-export request/response types 62 + export type { 63 + CreateDNSMonitorRequest, 64 + CreateDNSMonitorResponse, 65 + CreateHTTPMonitorRequest, 66 + CreateHTTPMonitorResponse, 67 + CreateTCPMonitorRequest, 68 + CreateTCPMonitorResponse, 69 + DeleteMonitorRequest, 70 + DeleteMonitorResponse, 71 + GetMonitorStatusRequest, 72 + GetMonitorStatusResponse, 73 + GetMonitorSummaryRequest, 74 + GetMonitorSummaryResponse, 75 + ListMonitorsRequest, 76 + ListMonitorsResponse, 77 + RegionStatus, 78 + TriggerMonitorRequest, 79 + TriggerMonitorResponse, 80 + } from "./gen/openstatus/monitor/v1/service_pb.ts"; 81 + 82 + export { TimeRange } from "./gen/openstatus/monitor/v1/service_pb.ts"; 83 + 84 + // Re-export health types 85 + export type { 86 + CheckRequest, 87 + CheckResponse, 88 + } from "./gen/openstatus/health/v1/health_pb.ts"; 89 + 90 + export { CheckResponse_ServingStatus as ServingStatus } from "./gen/openstatus/health/v1/health_pb.ts"; 91 + 92 + /** 93 + * Default OpenStatus API URL. 94 + */ 95 + const DEFAULT_API_URL = "https://api.openstatus.dev/rpc"; 96 + 97 + /** 98 + * Creates a Connect RPC transport configured for the OpenStatus API. 99 + */ 6 100 const transport = createConnectTransport({ 7 - baseUrl: process.env.OPENSTATUS_API_URL ?? "https://api.openstatus.dev", 101 + baseUrl: process.env.OPENSTATUS_API_URL ?? DEFAULT_API_URL, 8 102 httpVersion: "2", 9 103 }); 10 104 11 - export const openstatus = { 12 - monitor: { v1: { MonitorService: createClient(MonitorService, transport) } }, 13 - health: { v1: { HealthService: createClient(HealthService, transport) } }, 105 + /** 106 + * OpenStatus API client interface. 107 + * 108 + * Provides access to Monitor and Health services. 109 + */ 110 + export interface OpenStatusClient { 111 + /** 112 + * Monitor service namespace (v1). 113 + */ 114 + monitor: { 115 + v1: { 116 + /** 117 + * MonitorService provides CRUD and operational commands for monitors. 118 + * 119 + * Methods: 120 + * - `createHTTPMonitor` - Create a new HTTP monitor 121 + * - `createTCPMonitor` - Create a new TCP monitor 122 + * - `createDNSMonitor` - Create a new DNS monitor 123 + * - `listMonitors` - List all monitors 124 + * - `triggerMonitor` - Trigger an immediate check 125 + * - `deleteMonitor` - Delete a monitor 126 + * - `getMonitorStatus` - Get status of all regions for a monitor 127 + * - `getMonitorSummary` - Get aggregated metrics for a monitor 128 + */ 129 + MonitorService: Client<typeof MonitorService>; 130 + }; 131 + }; 132 + /** 133 + * Health service namespace (v1). 134 + */ 135 + health: { 136 + v1: { 137 + /** 138 + * HealthService provides health check endpoints. 139 + * 140 + * Methods: 141 + * - `check` - Check API health status 142 + */ 143 + HealthService: Client<typeof HealthService>; 144 + }; 145 + }; 146 + } 147 + 148 + /** 149 + * OpenStatus SDK client. 150 + * 151 + * Provides access to the OpenStatus API for managing monitors and checking service health. 152 + * 153 + * @example 154 + * ```typescript 155 + * import { openstatus } from "@openstatus/node-sdk"; 156 + * 157 + * // Check API health (no auth required) 158 + * const { status } = await openstatus.health.v1.HealthService.check({}); 159 + * 160 + * // Create a monitor (auth required) 161 + * const headers = { "x-openstatus-key": `Bearer ${process.env.OPENSTATUS_API_KEY}` }; 162 + * const { monitor } = await openstatus.monitor.v1.MonitorService.createHTTPMonitor({ 163 + * name: "My Website", 164 + * url: "https://example.com", 165 + * periodicity: "1m", 166 + * active: true, 167 + * }, { headers }); 168 + * ``` 169 + */ 170 + export const openstatus: OpenStatusClient = { 171 + monitor: { 172 + v1: { 173 + MonitorService: createClient(MonitorService, transport), 174 + }, 175 + }, 176 + health: { 177 + v1: { 178 + HealthService: createClient(HealthService, transport), 179 + }, 180 + }, 14 181 };