@joshuanode/n8n-nodes-sophos-central 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +148 -0
  3. package/dist/credentials/SophosCentralApi.credentials.d.ts +9 -0
  4. package/dist/credentials/SophosCentralApi.credentials.js +72 -0
  5. package/dist/credentials/SophosCentralApi.credentials.js.map +1 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +19 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/nodes/SophosCentral/GenericFunctions.d.ts +12 -0
  10. package/dist/nodes/SophosCentral/GenericFunctions.js +296 -0
  11. package/dist/nodes/SophosCentral/GenericFunctions.js.map +1 -0
  12. package/dist/nodes/SophosCentral/SophosCentral.node.d.ts +13 -0
  13. package/dist/nodes/SophosCentral/SophosCentral.node.js +577 -0
  14. package/dist/nodes/SophosCentral/SophosCentral.node.js.map +1 -0
  15. package/dist/nodes/SophosCentral/SophosCentral.node.json +17 -0
  16. package/dist/nodes/SophosCentral/descriptions/AlertDescription.d.ts +3 -0
  17. package/dist/nodes/SophosCentral/descriptions/AlertDescription.js +211 -0
  18. package/dist/nodes/SophosCentral/descriptions/AlertDescription.js.map +1 -0
  19. package/dist/nodes/SophosCentral/descriptions/FirewallDescription.d.ts +3 -0
  20. package/dist/nodes/SophosCentral/descriptions/FirewallDescription.js +223 -0
  21. package/dist/nodes/SophosCentral/descriptions/FirewallDescription.js.map +1 -0
  22. package/dist/nodes/SophosCentral/descriptions/FirewallGroupDescription.d.ts +3 -0
  23. package/dist/nodes/SophosCentral/descriptions/FirewallGroupDescription.js +132 -0
  24. package/dist/nodes/SophosCentral/descriptions/FirewallGroupDescription.js.map +1 -0
  25. package/dist/nodes/SophosCentral/descriptions/FirmwareDescription.d.ts +3 -0
  26. package/dist/nodes/SophosCentral/descriptions/FirmwareDescription.js +316 -0
  27. package/dist/nodes/SophosCentral/descriptions/FirmwareDescription.js.map +1 -0
  28. package/dist/nodes/SophosCentral/descriptions/HealthDescription.d.ts +3 -0
  29. package/dist/nodes/SophosCentral/descriptions/HealthDescription.js +163 -0
  30. package/dist/nodes/SophosCentral/descriptions/HealthDescription.js.map +1 -0
  31. package/dist/nodes/SophosCentral/descriptions/index.d.ts +2 -0
  32. package/dist/nodes/SophosCentral/descriptions/index.js +23 -0
  33. package/dist/nodes/SophosCentral/descriptions/index.js.map +1 -0
  34. package/dist/nodes/SophosCentral/sophosCentral.svg +18 -0
  35. package/dist/nodes/SophosCentral/types.d.ts +74 -0
  36. package/dist/nodes/SophosCentral/types.js +3 -0
  37. package/dist/nodes/SophosCentral/types.js.map +1 -0
  38. package/dist/package.json +68 -0
  39. package/dist/tsconfig.tsbuildinfo +1 -0
  40. package/package.json +68 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
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.
package/README.md ADDED
@@ -0,0 +1,148 @@
1
+ # Sophos Central Node for n8n
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@joshuanode/n8n-nodes-sophos-central?style=flat-square)](https://www.npmjs.com/package/@joshuanode/n8n-nodes-sophos-central)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT)
5
+ [![n8n community](https://img.shields.io/badge/n8n-community%20node-ff6d5a?style=flat-square)](https://n8n.io)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
7
+
8
+ Community node for the **Sophos Central Firewall Management API** — built for MSPs and Organizations.
9
+
10
+ > **Note**: This node currently focuses on **Sophos Firewalls** only, as that is the hardware I have access to for development and testing. Sophos Central supports additional products (Endpoints, Email, etc.) — contributions to expand the nodes are welcome!
11
+ >
12
+ > **Region Testing**: This node has been tested with **US data regions** (`api-us01`, `api-us03`). Non-US regions should work via the dynamic region routing, but have not been verified.
13
+
14
+ ---
15
+
16
+ ## Features
17
+
18
+ | Feature | Description |
19
+ | ------------------- | ----------------------------------------------------------------- |
20
+ | **Multi-Tenant** | Execute operations across all managed tenants in a single run |
21
+ | **Dynamic Regions** | Auto-routes to correct data region (`api-us01`, `api-eu01`, etc.) |
22
+ | **Firewall Mgmt** | List, retrieve, and monitor firewall status |
23
+ | **Firmware Ops** | Check compliance, schedule upgrades, cancel pending |
24
+ | **Alerting** | Get alerts, acknowledge, resolve — with batch support |
25
+ | **Health Checks** | Retrieve connection and managing status |
26
+
27
+ ---
28
+
29
+ ## Installation
30
+
31
+ **Community Nodes (Recommended)**
32
+
33
+ 1. In n8n, go to **Settings → Community Nodes → Install**
34
+ 2. Enter: `@joshuanode/n8n-nodes-sophos-central`
35
+ 3. Click **Install**
36
+
37
+ **Manual Installation**
38
+
39
+ ```bash
40
+ npm install @joshuanode/n8n-nodes-sophos-central
41
+ ```
42
+
43
+ ---
44
+
45
+ ## Credentials
46
+
47
+ ### Partner (MSP)
48
+
49
+ For managing multiple tenant accounts:
50
+
51
+ | Field | Value |
52
+ | ------------------ | --------------------------------------------------------------- |
53
+ | Client ID & Secret | From [Sophos Partner Portal](https://partnerportal.sophos.com/) |
54
+ | Account Type | `Partner` |
55
+ | Tenant ID | Leave empty |
56
+
57
+ > **Tip**: Leave the **Tenant** field empty in operations to aggregate data from **all managed tenants**.
58
+
59
+ ### Organization
60
+
61
+ For managing a single account:
62
+
63
+ | Field | Value |
64
+ | ------------------ | ----------------------------- |
65
+ | Client ID & Secret | From Sophos Central Admin |
66
+ | Account Type | `Organization` |
67
+ | Tenant ID | Your Tenant API ID (required) |
68
+
69
+ ---
70
+
71
+ ## Operations
72
+
73
+ ### Firewall
74
+
75
+ | Operation | Description |
76
+ | ------------ | ---------------------------------------------------- |
77
+ | **Get** | Retrieve a specific firewall |
78
+ | **Get Many** | List firewalls with filters (Name, Serial, Firmware) |
79
+
80
+ ### Firmware
81
+
82
+ | Operation | Description |
83
+ | ------------------ | -------------------------------------------- |
84
+ | **Check Upgrades** | Check current version and available upgrades |
85
+ | **Upgrade** | Schedule or trigger immediate upgrade |
86
+ | **Cancel Upgrade** | Cancel a scheduled upgrade |
87
+
88
+ ### Firewall Groups
89
+
90
+ | Operation | Description |
91
+ | ------------------- | ---------------------------- |
92
+ | **Get** | Retrieve a firewall group |
93
+ | **Get Many** | List all groups |
94
+ | **Get Sync Status** | Check synchronization status |
95
+
96
+ ### Alerts
97
+
98
+ | Operation | Description |
99
+ | ------------------ | -------------------------------------------------- |
100
+ | **Get** | Retrieve a specific alert |
101
+ | **Get Many** | List alerts with filters (Severity, Product, Date) |
102
+ | **Perform Action** | Acknowledge or Resolve (supports batch) |
103
+
104
+ ### Health
105
+
106
+ | Operation | Description |
107
+ | -------------- | ----------------------------- |
108
+ | **Get Health** | Retrieve status for firewalls |
109
+
110
+ ---
111
+
112
+ ## Architecture
113
+
114
+ ```
115
+ ┌─────────────┐ ┌──────────────┐ ┌─────────────────┐
116
+ │ n8n │ ──▶ │ This Node │ ──▶ │ Sophos Central │
117
+ │ Workflow │ │ (OAuth2) │ │ API v1 │
118
+ └─────────────┘ └──────────────┘ └─────────────────┘
119
+
120
+ ┌──────┴──────┐
121
+ ▼ ▼
122
+ Token Cache Region Cache
123
+ (5 min TTL) (per tenant)
124
+ ```
125
+
126
+ - **Automatic Region Routing**: Caches tenant-to-region mapping
127
+ - **Token Caching**: Caches OAuth tokens for 5 minutes
128
+
129
+ ---
130
+
131
+ ## Development
132
+
133
+ ```bash
134
+ # Install dependencies
135
+ npm install
136
+
137
+ # Build
138
+ npm run build
139
+
140
+ # Lint
141
+ npm run lint
142
+ ```
143
+
144
+ ---
145
+
146
+ ## License
147
+
148
+ [MIT](LICENSE)
@@ -0,0 +1,9 @@
1
+ import type { Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class SophosCentralApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ icon: Icon;
6
+ documentationUrl: string;
7
+ properties: INodeProperties[];
8
+ test: ICredentialTestRequest;
9
+ }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SophosCentralApi = void 0;
4
+ class SophosCentralApi {
5
+ constructor() {
6
+ this.name = 'sophosCentralApi';
7
+ this.displayName = 'Sophos Central API';
8
+ this.icon = 'file:sophos-central.svg';
9
+ this.documentationUrl = 'https://developer.sophos.com/getting-started';
10
+ this.properties = [
11
+ {
12
+ displayName: 'Client ID',
13
+ name: 'clientId',
14
+ type: 'string',
15
+ default: '',
16
+ required: true,
17
+ },
18
+ {
19
+ displayName: 'Client Secret',
20
+ name: 'clientSecret',
21
+ type: 'string',
22
+ typeOptions: { password: true },
23
+ default: '',
24
+ required: true,
25
+ },
26
+ {
27
+ displayName: 'Account Type',
28
+ name: 'accountType',
29
+ type: 'options',
30
+ options: [
31
+ {
32
+ name: 'Partner (Multi-Tenant)',
33
+ value: 'partner',
34
+ description: 'For MSPs managing multiple customer tenants',
35
+ },
36
+ {
37
+ name: 'Organization (Single Tenant)',
38
+ value: 'organization',
39
+ description: 'For a single organization',
40
+ },
41
+ ],
42
+ default: 'partner',
43
+ },
44
+ {
45
+ displayName: 'Tenant ID',
46
+ name: 'tenantId',
47
+ type: 'string',
48
+ default: '',
49
+ displayOptions: {
50
+ show: {
51
+ accountType: ['organization'],
52
+ },
53
+ },
54
+ description: 'Tenant ID for Organization accounts (UUID)',
55
+ placeholder: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
56
+ },
57
+ ];
58
+ this.test = {
59
+ request: {
60
+ method: 'POST',
61
+ url: 'https://id.sophos.com/api/v2/oauth2/token',
62
+ headers: {
63
+ 'Content-Type': 'application/x-www-form-urlencoded',
64
+ },
65
+ body: '={{"grant_type=client_credentials&scope=token&client_id=" + encodeURIComponent($credentials.clientId) + "&client_secret=" + encodeURIComponent($credentials.clientSecret)}}',
66
+ json: true,
67
+ },
68
+ };
69
+ }
70
+ }
71
+ exports.SophosCentralApi = SophosCentralApi;
72
+ //# sourceMappingURL=SophosCentralApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SophosCentralApi.credentials.js","sourceRoot":"","sources":["../../credentials/SophosCentralApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,gBAAgB;IAA7B;QACC,SAAI,GAAG,kBAAkB,CAAC;QAC1B,gBAAW,GAAG,oBAAoB,CAAC;QACnC,SAAI,GAAS,yBAAyB,CAAC;QACvC,qBAAgB,GAAG,8CAA8C,CAAC;QAElE,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE;oBACR;wBACC,IAAI,EAAE,wBAAwB;wBAC9B,KAAK,EAAE,SAAS;wBAChB,WAAW,EAAE,6CAA6C;qBAC1D;oBACD;wBACC,IAAI,EAAE,8BAA8B;wBACpC,KAAK,EAAE,cAAc;wBACrB,WAAW,EAAE,2BAA2B;qBACxC;iBACD;gBACD,OAAO,EAAE,SAAS;aAClB;YACD;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,cAAc,EAAE;oBACf,IAAI,EAAE;wBACL,WAAW,EAAE,CAAC,cAAc,CAAC;qBAC7B;iBACD;gBACD,WAAW,EAAE,4CAA4C;gBACzD,WAAW,EAAE,sCAAsC;aACnD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,2CAA2C;gBAChD,OAAO,EAAE;oBACR,cAAc,EAAE,mCAAmC;iBACnD;gBACD,IAAI,EAAE,6KAA6K;gBACnL,IAAI,EAAE,IAAI;aACV;SACD,CAAC;IACH,CAAC;CAAA;AAlED,4CAkEC"}
@@ -0,0 +1,2 @@
1
+ export * from './credentials/SophosCentralApi.credentials';
2
+ export * from './nodes/SophosCentral/SophosCentral.node';
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./credentials/SophosCentralApi.credentials"), exports);
18
+ __exportStar(require("./nodes/SophosCentral/SophosCentral.node"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6EAA2D;AAC3D,2EAAyD"}
@@ -0,0 +1,12 @@
1
+ import type { IDataObject, IExecuteFunctions, IHookFunctions, IHttpRequestMethods, ILoadOptionsFunctions } from 'n8n-workflow';
2
+ import type { IAuthToken, ISophosCentralCredentials, ITenant } from './types';
3
+ export declare function getAuthContext(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, credentials: ISophosCentralCredentials): Promise<IAuthToken>;
4
+ export declare function getAccessToken(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, credentials: ISophosCentralCredentials): Promise<string>;
5
+ export declare function getWhoAmI(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, token: string): Promise<IAuthToken>;
6
+ export declare function getTenantList(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, credentials: ISophosCentralCredentials): Promise<ITenant[]>;
7
+ export declare function resolveTenantId(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, tenantIdFromParameters: string | undefined): Promise<string>;
8
+ export declare function getTenantApiHost(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, tenantId: string): Promise<string>;
9
+ export declare function sophosCentralApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, query?: IDataObject, tenantId?: string): Promise<IDataObject>;
10
+ export declare function sophosCentralApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, query?: IDataObject, tenantId?: string): Promise<IDataObject[]>;
11
+ export declare function getAllTenantsFirewalls(this: IExecuteFunctions, credentials: ISophosCentralCredentials, returnAll: boolean, limit?: number): Promise<IDataObject[]>;
12
+ export declare function sleep(ms: number): Promise<void>;
@@ -0,0 +1,296 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAuthContext = getAuthContext;
4
+ exports.getAccessToken = getAccessToken;
5
+ exports.getWhoAmI = getWhoAmI;
6
+ exports.getTenantList = getTenantList;
7
+ exports.resolveTenantId = resolveTenantId;
8
+ exports.getTenantApiHost = getTenantApiHost;
9
+ exports.sophosCentralApiRequest = sophosCentralApiRequest;
10
+ exports.sophosCentralApiRequestAllItems = sophosCentralApiRequestAllItems;
11
+ exports.getAllTenantsFirewalls = getAllTenantsFirewalls;
12
+ exports.sleep = sleep;
13
+ const n8n_workflow_1 = require("n8n-workflow");
14
+ const tokenCache = new Map();
15
+ const tenantApiHostCache = new Map();
16
+ function getCacheKey(credentials) {
17
+ return `${credentials.clientId}:${credentials.clientSecret}`;
18
+ }
19
+ function joinUrl(baseUrl, endpoint) {
20
+ const normalizedBase = baseUrl.startsWith('http://') || baseUrl.startsWith('https://')
21
+ ? baseUrl
22
+ : `https://${baseUrl}`;
23
+ const base = normalizedBase.endsWith('/') ? normalizedBase.slice(0, -1) : normalizedBase;
24
+ const path = endpoint.startsWith('/') ? endpoint : `/${endpoint}`;
25
+ return `${base}${path}`;
26
+ }
27
+ async function getAuthContext(credentials) {
28
+ const cacheKey = getCacheKey(credentials);
29
+ const cached = tokenCache.get(cacheKey);
30
+ if (cached && cached.expiresAt > Date.now() + 300000 && cached.dataRegion) {
31
+ return cached;
32
+ }
33
+ const token = await getAccessToken.call(this, credentials);
34
+ const whoami = await getWhoAmI.call(this, token);
35
+ const ctx = {
36
+ token,
37
+ expiresAt: whoami.expiresAt,
38
+ partnerId: whoami.partnerId,
39
+ dataRegion: whoami.dataRegion,
40
+ };
41
+ tokenCache.set(cacheKey, ctx);
42
+ return ctx;
43
+ }
44
+ async function getAccessToken(credentials) {
45
+ var _a, _b;
46
+ const body = `grant_type=client_credentials&scope=token&client_id=${encodeURIComponent(credentials.clientId)}&client_secret=${encodeURIComponent(credentials.clientSecret)}`;
47
+ const options = {
48
+ method: 'POST',
49
+ url: 'https://id.sophos.com/api/v2/oauth2/token',
50
+ headers: {
51
+ 'Content-Type': 'application/x-www-form-urlencoded',
52
+ },
53
+ body,
54
+ json: true,
55
+ };
56
+ try {
57
+ const response = (await this.helpers.httpRequest(options));
58
+ return response.access_token;
59
+ }
60
+ catch (error) {
61
+ const err = error;
62
+ const errorResponse = (error || {});
63
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorResponse, {
64
+ message: 'Failed to authenticate with Sophos Central',
65
+ description: ((_a = err.error_description) === null || _a === void 0 ? void 0 : _a.toString()) ||
66
+ ((_b = err.message) === null || _b === void 0 ? void 0 : _b.toString()) ||
67
+ 'Invalid client credentials',
68
+ });
69
+ }
70
+ }
71
+ async function getWhoAmI(token) {
72
+ const options = {
73
+ method: 'GET',
74
+ url: 'https://api.central.sophos.com/whoami/v1',
75
+ headers: {
76
+ Authorization: `Bearer ${token}`,
77
+ },
78
+ json: true,
79
+ };
80
+ try {
81
+ const response = (await this.helpers.httpRequest(options));
82
+ const apiHosts = response.apiHosts ||
83
+ response['api-hosts'] ||
84
+ response.api_hosts;
85
+ const dataRegion = (apiHosts === null || apiHosts === void 0 ? void 0 : apiHosts.dataRegion) ||
86
+ (apiHosts === null || apiHosts === void 0 ? void 0 : apiHosts['data-region']) ||
87
+ (apiHosts === null || apiHosts === void 0 ? void 0 : apiHosts.global);
88
+ if (!dataRegion) {
89
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Could not determine data region from whoami');
90
+ }
91
+ return {
92
+ token,
93
+ expiresAt: Date.now() + 3600 * 1000,
94
+ partnerId: response.id,
95
+ dataRegion: dataRegion,
96
+ };
97
+ }
98
+ catch (error) {
99
+ const errorResponse = (error || {});
100
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorResponse, {
101
+ message: 'Failed to get Sophos Central account context',
102
+ description: 'Could not retrieve whoami information from Sophos Central',
103
+ });
104
+ }
105
+ }
106
+ async function getTenantList(credentials) {
107
+ if (credentials.accountType !== 'partner') {
108
+ return [];
109
+ }
110
+ const ctx = await getAuthContext.call(this, credentials);
111
+ const returnData = [];
112
+ let page = 1;
113
+ const pageSize = 100;
114
+ let totalPages = 1;
115
+ do {
116
+ const response = (await this.helpers.httpRequest({
117
+ method: 'GET',
118
+ url: 'https://api.central.sophos.com/partner/v1/tenants',
119
+ headers: {
120
+ Authorization: `Bearer ${ctx.token}`,
121
+ 'X-Partner-ID': ctx.partnerId,
122
+ },
123
+ qs: {
124
+ page,
125
+ pageSize,
126
+ pageTotal: true,
127
+ },
128
+ json: true,
129
+ }));
130
+ const items = response.items;
131
+ if (items === null || items === void 0 ? void 0 : items.length) {
132
+ for (const tenant of items) {
133
+ const host = tenant.apiHost ||
134
+ tenant['api-host'] ||
135
+ tenant.api_host;
136
+ if (tenant.id && host) {
137
+ tenantApiHostCache.set(tenant.id, host);
138
+ }
139
+ }
140
+ returnData.push(...items);
141
+ }
142
+ const pages = response.pages;
143
+ totalPages = typeof (pages === null || pages === void 0 ? void 0 : pages.total) === 'number' ? pages.total : page;
144
+ page += 1;
145
+ } while (page <= totalPages);
146
+ return returnData;
147
+ }
148
+ async function resolveTenantId(tenantIdFromParameters) {
149
+ if (tenantIdFromParameters) {
150
+ return tenantIdFromParameters;
151
+ }
152
+ const credentials = (await this.getCredentials('sophosCentralApi'));
153
+ if (credentials.accountType === 'organization' && credentials.tenantId) {
154
+ return credentials.tenantId;
155
+ }
156
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Tenant is required for Partner accounts. Select a tenant, or use an Organization credential.');
157
+ }
158
+ async function getTenantApiHost(tenantId) {
159
+ const cached = tenantApiHostCache.get(tenantId);
160
+ if (cached) {
161
+ return cached;
162
+ }
163
+ const credentials = (await this.getCredentials('sophosCentralApi'));
164
+ if (credentials.accountType === 'partner') {
165
+ await getTenantList.call(this, credentials);
166
+ const found = tenantApiHostCache.get(tenantId);
167
+ if (found) {
168
+ return found;
169
+ }
170
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Could not find API host for tenant ID '${tenantId}'. Ensure the tenant exists and is accessible by this Partner account.`);
171
+ }
172
+ const ctx = await getAuthContext.call(this, credentials);
173
+ return ctx.dataRegion;
174
+ }
175
+ async function sophosCentralApiRequest(method, endpoint, body = {}, query = {}, tenantId) {
176
+ var _a, _b, _c, _d, _e, _f, _g;
177
+ const credentials = (await this.getCredentials('sophosCentralApi'));
178
+ const ctx = await getAuthContext.call(this, credentials);
179
+ const effectiveTenantId = tenantId || (credentials.accountType === 'organization' ? credentials.tenantId : undefined);
180
+ if (!effectiveTenantId) {
181
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Tenant ID is required. Select a tenant in the node parameters.');
182
+ }
183
+ const apiHost = await getTenantApiHost.call(this, effectiveTenantId);
184
+ const url = joinUrl(apiHost, endpoint);
185
+ const options = {
186
+ method,
187
+ url,
188
+ headers: {
189
+ Authorization: `Bearer ${ctx.token}`,
190
+ Accept: 'application/json',
191
+ 'Content-Type': 'application/json',
192
+ 'X-Tenant-ID': effectiveTenantId,
193
+ },
194
+ qs: query,
195
+ json: true,
196
+ };
197
+ if (Object.keys(body).length > 0) {
198
+ options.body = body;
199
+ }
200
+ try {
201
+ return await this.helpers.httpRequest(options);
202
+ }
203
+ catch (error) {
204
+ const errorResponse = (error || {});
205
+ const err = error;
206
+ const statusCode = err.statusCode || ((_a = err.response) === null || _a === void 0 ? void 0 : _a.status) || ((_b = err.response) === null || _b === void 0 ? void 0 : _b.statusCode);
207
+ const debugInfo = `(URL: ${url}, Tenant: ${effectiveTenantId}, Host: ${apiHost})`;
208
+ if (statusCode === 401) {
209
+ tokenCache.delete(getCacheKey(credentials));
210
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorResponse, {
211
+ message: 'Authentication failed',
212
+ description: 'Your access token has expired or credentials are invalid. Please check your API credentials.',
213
+ });
214
+ }
215
+ if (statusCode === 403) {
216
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorResponse, {
217
+ message: 'Permission denied',
218
+ description: 'Your API credentials do not have permission to perform this action.',
219
+ });
220
+ }
221
+ if (statusCode === 404) {
222
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorResponse, {
223
+ message: `Resource not found ${debugInfo}`,
224
+ description: ((_c = err.error) === null || _c === void 0 ? void 0 : _c.message) || 'The requested resource does not exist. Check if the ID is correct and belongs to this tenant.',
225
+ });
226
+ }
227
+ if (statusCode === 429) {
228
+ const retryAfter = ((_e = (_d = err.response) === null || _d === void 0 ? void 0 : _d.headers) === null || _e === void 0 ? void 0 : _e['retry-after']) || 60;
229
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorResponse, {
230
+ message: 'Rate limit exceeded',
231
+ description: `Please retry after ${retryAfter} seconds.`,
232
+ });
233
+ }
234
+ const errorMessage = ((_f = err.error) === null || _f === void 0 ? void 0 : _f.message) || ((_g = err.error) === null || _g === void 0 ? void 0 : _g.error_description) || err.message || 'Unknown error';
235
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorResponse, {
236
+ message: `Sophos Central API Error (Status ${statusCode || 'Unknown'}) ${debugInfo}`,
237
+ description: errorMessage,
238
+ });
239
+ }
240
+ }
241
+ async function sophosCentralApiRequestAllItems(method, endpoint, body = {}, query = {}, tenantId) {
242
+ const returnData = [];
243
+ let page = 1;
244
+ const pageSize = 100;
245
+ let totalPages = 1;
246
+ do {
247
+ const response = await sophosCentralApiRequest.call(this, method, endpoint, body, {
248
+ ...query,
249
+ page,
250
+ pageSize,
251
+ pageTotal: true,
252
+ }, tenantId);
253
+ const items = response.items;
254
+ if (items === null || items === void 0 ? void 0 : items.length) {
255
+ returnData.push(...items);
256
+ }
257
+ const pages = response.pages;
258
+ totalPages = typeof (pages === null || pages === void 0 ? void 0 : pages.total) === 'number' ? pages.total : page;
259
+ page += 1;
260
+ } while (page <= totalPages);
261
+ return returnData;
262
+ }
263
+ async function getAllTenantsFirewalls(credentials, returnAll, limit) {
264
+ const tenants = await getTenantList.call(this, credentials);
265
+ const allFirewalls = [];
266
+ for (const tenant of tenants) {
267
+ try {
268
+ let tenantFirewalls;
269
+ if (returnAll) {
270
+ tenantFirewalls = await sophosCentralApiRequestAllItems.call(this, 'GET', '/firewall/v1/firewalls', {}, {}, tenant.id);
271
+ }
272
+ else {
273
+ const response = await sophosCentralApiRequest.call(this, 'GET', '/firewall/v1/firewalls', {}, { page: 1, pageSize: limit || 50, pageTotal: false }, tenant.id);
274
+ tenantFirewalls = response.items || [];
275
+ }
276
+ for (const firewall of tenantFirewalls) {
277
+ firewall.tenant = {
278
+ id: tenant.id,
279
+ name: tenant.name,
280
+ dataRegion: tenant.dataRegion,
281
+ };
282
+ }
283
+ allFirewalls.push(...tenantFirewalls);
284
+ }
285
+ catch {
286
+ continue;
287
+ }
288
+ }
289
+ return allFirewalls;
290
+ }
291
+ function sleep(ms) {
292
+ return new Promise((resolve) => {
293
+ setTimeout(resolve, ms);
294
+ });
295
+ }
296
+ //# sourceMappingURL=GenericFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/SophosCentral/GenericFunctions.ts"],"names":[],"mappings":";;AAgCA,wCAuBC;AAED,wCAgCC;AAED,8BA0CC;AAED,sCAsDC;AAED,0CAoBC;AAED,4CAkCC;AAED,0DAsGC;AAED,0EAuCC;AAGD,wDAkDC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EAAE,CACT,CAAC;gBACF,eAAe,GAAK,QAAwB,CAAC,KAAuB,IAAI,EAAE,CAAC;YAC5E,CAAC;YAGD,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE,CAAC;gBACxC,QAAQ,CAAC,MAAM,GAAG;oBACjB,EAAE,EAAE,MAAM,CAAC,EAAE;oBACb,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,UAAU,EAAE,MAAM,CAAC,UAAU;iBAC7B,CAAC;YACH,CAAC;YAED,YAAY,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC;QACvC,CAAC;QAAC,MAAM,CAAC;YAER,SAAS;QACV,CAAC;IACF,CAAC;IAED,OAAO,YAAY,CAAC;AACrB,CAAC;AAID,SAAgB,KAAK,CAAC,EAAU;IAC/B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC9B,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodeListSearchResult, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class SophosCentral implements INodeType {
3
+ description: INodeTypeDescription;
4
+ methods: {
5
+ listSearch: {
6
+ tenantSearch: (this: ILoadOptionsFunctions, filter?: string, paginationToken?: string) => Promise<INodeListSearchResult>;
7
+ firewallSearch: (this: ILoadOptionsFunctions, filter?: string, paginationToken?: string) => Promise<INodeListSearchResult>;
8
+ firmwareVersionSearch: (this: ILoadOptionsFunctions, filter?: string, paginationToken?: string) => Promise<INodeListSearchResult>;
9
+ alertSearch: (this: ILoadOptionsFunctions, filter?: string, paginationToken?: string) => Promise<INodeListSearchResult>;
10
+ };
11
+ };
12
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
13
+ }