{"id":50735385,"url":"https://github.com/wyre-technology/node-unitrends","last_synced_at":"2026-06-10T13:01:21.632Z","repository":{"id":355097912,"uuid":"1226756406","full_name":"wyre-technology/node-unitrends","owner":"wyre-technology","description":"Comprehensive Node.js/TypeScript client library for the Unitrends Backup REST API","archived":false,"fork":false,"pushed_at":"2026-06-09T01:55:48.000Z","size":781,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-09T03:21:30.507Z","etag":null,"topics":["api-client","backup","bcdr","kaseya","msp","sdk","typescript","unitrends"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wyre-technology.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-01T19:51:58.000Z","updated_at":"2026-06-09T01:53:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/wyre-technology/node-unitrends","commit_stats":null,"previous_names":["wyre-technology/node-unitrends"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/wyre-technology/node-unitrends","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyre-technology%2Fnode-unitrends","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyre-technology%2Fnode-unitrends/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyre-technology%2Fnode-unitrends/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyre-technology%2Fnode-unitrends/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wyre-technology","download_url":"https://codeload.github.com/wyre-technology/node-unitrends/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyre-technology%2Fnode-unitrends/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34153483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","backup","bcdr","kaseya","msp","sdk","typescript","unitrends"],"created_at":"2026-06-10T13:01:20.413Z","updated_at":"2026-06-10T13:01:21.619Z","avatar_url":"https://github.com/wyre-technology.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @wyre-technology/node-unitrends\n\nComprehensive, fully-typed Node.js / TypeScript client library for the\nUnitrends Backup REST API.\n\n[![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n\n## Features\n\n- Full coverage of the documented endpoints: appliances, assets, jobs (backups + history), recovery points, restores, replication queue, alerts, reports\n- Session-token (`POST /api/login`) auth with single-flight re-auth on 401\n- Self-signed TLS support (`verifyTls: false`) for on-prem appliances\n- Page-based pagination via `list()` + async iterator `listAll()`\n- Defensive client-side rate limiting tuned for per-appliance limits, with 503 = \"appliance overloaded\" backoff\n- Typed error hierarchy\n- ESM + CommonJS dual exports, full `.d.ts` types\n- Zero `any` in the public API\n\n## Install\n\n```bash\nnpm install @wyre-technology/node-unitrends\n```\n\nThe package is published to GitHub Packages under the `@wyre-technology` scope.\nAdd this to a project-local `.npmrc`:\n\n```\n@wyre-technology:registry=https://npm.pkg.github.com\n```\n\n## Quick start\n\n```typescript\nimport { UnitrendsClient } from '@wyre-technology/node-unitrends';\n\nconst client = new UnitrendsClient({\n  baseUrl:  'https://backup.example.com/api',\n  username: process.env.UNITRENDS_USER!,\n  password: process.env.UNITRENDS_PASS!,\n});\n\n// One page at a time\nconst page = await client.assets.list({ limit: 100 });\nconsole.log(page.total);\n\n// Stream every asset, fetching pages on demand\nfor await (const asset of client.assets.listAll({ limit: 200 })) {\n  console.log(asset.id, asset.hostname);\n}\n```\n\n## Configuration\n\n```typescript\nnew UnitrendsClient({\n  baseUrl:  'https://backup.example.com/api', // required\n  username: 'admin',\n  password: '...',\n\n  // Talking to an aggregating MSP Console rather than a single appliance.\n  // When true, asset operations REQUIRE an applianceId.\n  mspConsole: false,\n\n  // On-prem appliances often ship with self-signed certs.\n  // Disable verification ONLY on trusted internal networks.\n  verifyTls: true,\n\n  // Optional — tune client-side rate limiting (defaults shown).\n  rateLimit: {\n    enabled: true,\n    maxRequests: 60,\n    windowMs: 60_000,\n    throttleThreshold: 0.8,\n    retryAfterMs: 5_000,\n    maxRetries: 3,\n    applianceOverloadBackoffMs: 30_000,\n  },\n});\n```\n\n## Authentication\n\nThe SDK calls `POST /api/login` with `{ username, password }`, captures the\nreturned `token` + `expires`, and sends `Authorization: Bearer \u003ctoken\u003e` on all\nsubsequent requests. Tokens have a 60-minute idle (sliding) timeout.\n\nIf a request fails with 401 mid-session, the SDK invalidates the cached token,\nre-authenticates **once** under a single-flight lock (concurrent callers share\none in-flight login), and retries the request.\n\n## Self-signed certificates\n\nMany on-prem Unitrends Backup appliances use a self-signed TLS certificate.\nSet `verifyTls: false` to disable certificate validation:\n\n```typescript\nconst client = new UnitrendsClient({\n  baseUrl: 'https://backup.internal/api',\n  username: '...',\n  password: '...',\n  verifyTls: false,\n});\n```\n\n\u003e **Security:** disabling certificate verification removes the only protection\n\u003e against man-in-the-middle attacks. Only do this on trusted internal networks.\n\u003e Prefer installing the appliance's CA into your system trust store.\n\n## Pagination\n\n| Param   | Default | Max |\n| ------- | ------- | --- |\n| `limit` | 50      | 500 |\n| `offset`| 0       | —   |\n\nResponses include `total`. Use `listAll()` to iterate all pages automatically.\n\n## API surface\n\n```typescript\nclient.appliances.list(params)            // MSP Console only\nclient.appliances.listAll(params)         // MSP Console only\n\nclient.assets.list({ applianceId?, limit?, offset? })\nclient.assets.listAll({ applianceId?, limit?, offset? })\nclient.assets.get(assetId, applianceId?)\n\nclient.jobs.listBackups({ applianceId?, ... })\nclient.jobs.listAllBackups({ applianceId?, ... })\nclient.jobs.listHistory({ applianceId?, ... })\nclient.jobs.listAllHistory({ applianceId?, ... })\n\nclient.recoveryPoints.list({ assetId?, applianceId?, ... })\nclient.recoveryPoints.listAll({ assetId?, applianceId?, ... })\n\nclient.restores.queue({ recoveryPointId, applianceId?, ... }) // POST /api/restores\nclient.restores.get(restoreId)\n\nclient.replication.listQueue(params)\nclient.replication.listAllQueue(params)\n\nclient.alerts.list(params)\nclient.alerts.listAll(params)\n\nclient.reports.successRate({ applianceId?, startTime?, endTime? })\n```\n\n## Error handling\n\n```typescript\nimport {\n  UnitrendsError,\n  UnitrendsAuthenticationError,\n  UnitrendsForbiddenError,\n  UnitrendsNotFoundError,\n  UnitrendsRateLimitError,\n  UnitrendsServerError,\n} from '@wyre-technology/node-unitrends';\n\ntry {\n  await client.assets.get(123);\n} catch (err) {\n  if (err instanceof UnitrendsRateLimitError) {\n    await new Promise((r) =\u003e setTimeout(r, err.retryAfter));\n  } else if (err instanceof UnitrendsServerError \u0026\u0026 err.statusCode === 503) {\n    // Appliance is overloaded — already auto-retried with 30s backoff.\n  } else {\n    throw err;\n  }\n}\n```\n\n## Gotchas\n\n- **Asset IDs are appliance-scoped.** Asset `123` on appliance A is NOT the\n  same record as asset `123` on appliance B. The `Asset` type carries\n  `applianceId` for this reason. When `mspConsole: true` the SDK enforces that\n  asset operations include `applianceId`.\n- **MSP Console exposes a subset of endpoints.** Asset-level operations like\n  `restores.queue(...)` typically must target the owning appliance directly.\n- **Job `status` ≠ \"data is recoverable\".** A job can have `status: 'success'`\n  while its resulting recovery point has `verifyState: 'failed'`. The `Job`\n  type exposes both fields.\n- **Self-signed certs.** See above — `verifyTls: false` disables MITM\n  protection; use only on trusted networks.\n\n## Development\n\n```bash\nnpm install\nnpm test\nnpm run typecheck\nnpm run lint\nnpm run build\n```\n\n## License\n\nApache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyre-technology%2Fnode-unitrends","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwyre-technology%2Fnode-unitrends","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyre-technology%2Fnode-unitrends/lists"}