From 20a83e9d842810571a0b3a77444fffa3cc6bea29 Mon Sep 17 00:00:00 2001 From: Aaron Sachs <898627+asachs01@users.noreply.github.com> Date: Tue, 31 Mar 2026 15:57:54 -0400 Subject: [PATCH] feat: add Canada, US2, and Federal region support Add ca (Canada), us2 (US2), and fed (Federal) to the NinjaOneRegion type and REGION_URLS map. This is a config-only change with no architectural modifications. Co-Authored-By: Claude Opus 4.6 (1M context) --- README.md | 4 ++-- src/client.ts | 2 +- src/config.ts | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7578746..dba6dd6 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Comprehensive, fully-typed Node.js/TypeScript library for the NinjaOne/NinjaRMM - Full TypeScript support with comprehensive type definitions - OAuth 2.0 authentication with automatic token refresh -- Support for all three regional endpoints (US, EU, Oceania) +- Support for all six regional endpoints (US, EU, Oceania, Canada, US2, Federal) - Built-in rate limiting with configurable thresholds - Automatic retry logic for rate limits and server errors - Clean, intuitive API design @@ -25,7 +25,7 @@ import { NinjaOneClient } from '@asachs01/node-ninjaone'; const client = new NinjaOneClient({ clientId: process.env.NINJAONE_CLIENT_ID!, clientSecret: process.env.NINJAONE_CLIENT_SECRET!, - region: 'us', // 'us' | 'eu' | 'oc' + region: 'us', // 'us' | 'eu' | 'oc' | 'ca' | 'us2' | 'fed' }); // List organizations diff --git a/src/client.ts b/src/client.ts index 3f43f91..907cd75 100644 --- a/src/client.ts +++ b/src/client.ts @@ -21,7 +21,7 @@ import { WebhooksResource } from './resources/webhooks.js'; * const client = new NinjaOneClient({ * clientId: process.env.NINJAONE_CLIENT_ID!, * clientSecret: process.env.NINJAONE_CLIENT_SECRET!, - * region: 'us', // or 'eu', 'oc' + * region: 'us', // or 'eu', 'oc', 'ca', 'us2', 'fed' * }); * * // List organizations diff --git a/src/config.ts b/src/config.ts index 29be174..296ff82 100644 --- a/src/config.ts +++ b/src/config.ts @@ -5,7 +5,7 @@ /** * NinjaOne regional endpoints */ -export type NinjaOneRegion = 'us' | 'eu' | 'oc'; +export type NinjaOneRegion = 'us' | 'eu' | 'oc' | 'ca' | 'us2' | 'fed'; /** * Regional base URLs @@ -14,6 +14,9 @@ export const REGION_URLS: Record = { us: 'https://app.ninjarmm.com', eu: 'https://eu.ninjarmm.com', oc: 'https://oc.ninjarmm.com', + ca: 'https://ca.ninjarmm.com', + us2: 'https://us2.ninjarmm.com', + fed: 'https://fed.ninjarmm.com', }; /** @@ -94,7 +97,7 @@ export function resolveConfig(config: NinjaOneConfig): ResolvedConfig { const region = config.region ?? 'us'; const regionUrl = REGION_URLS[region]; if (!regionUrl) { - throw new Error(`Invalid region: ${region}. Valid regions are: us, eu, oc`); + throw new Error(`Invalid region: ${region}. Valid regions are: us, eu, oc, ca, us2, fed`); } baseUrl = regionUrl; }