@affeldt28/n8n-nodes-ninjaone 1.1.1 → 1.2.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.
- package/dist/credentials/NinjaOneOAuth2Api.credentials.d.ts +10 -0
- package/dist/credentials/NinjaOneOAuth2Api.credentials.js +109 -0
- package/dist/credentials/NinjaOneOAuth2Api.credentials.js.map +1 -0
- package/dist/nodes/ninjaone/Ninjaone.node.js +1 -1
- package/dist/nodes/ninjaone/Ninjaone.node.js.map +1 -1
- package/dist/nodes/ninjaone/descriptions/device/Device.resource.js +1 -1
- package/dist/nodes/ninjaone/descriptions/device/Device.resource.js.map +1 -1
- package/dist/package.json +3 -2
- package/package.json +3 -2
- package/dist/credentials/NinjaoneApi.credentials.d.ts +0 -13
- package/dist/credentials/NinjaoneApi.credentials.js +0 -209
- package/dist/credentials/NinjaoneApi.credentials.js.map +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ICredentialTestRequest, ICredentialType, Icon, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class NinjaOneOAuth2Api implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
extends: string[];
|
|
6
|
+
icon: Icon;
|
|
7
|
+
documentationUrl: string;
|
|
8
|
+
properties: INodeProperties[];
|
|
9
|
+
test: ICredentialTestRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NinjaOneOAuth2Api = void 0;
|
|
4
|
+
class NinjaOneOAuth2Api {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'ninjaOneOAuth2Api';
|
|
7
|
+
this.displayName = 'NinjaOne OAuth2 API';
|
|
8
|
+
this.extends = ['oAuth2Api'];
|
|
9
|
+
this.icon = {
|
|
10
|
+
light: 'file:../icons/ninjaone.svg',
|
|
11
|
+
dark: 'file:../icons/ninjaone.dark.svg',
|
|
12
|
+
};
|
|
13
|
+
this.documentationUrl = 'https://app.ninjarmm.com/apidocs/';
|
|
14
|
+
this.properties = [
|
|
15
|
+
{
|
|
16
|
+
displayName: 'Region',
|
|
17
|
+
name: 'region',
|
|
18
|
+
type: 'options',
|
|
19
|
+
required: true,
|
|
20
|
+
default: 'app',
|
|
21
|
+
options: [
|
|
22
|
+
{
|
|
23
|
+
name: 'USA Standard (app)',
|
|
24
|
+
value: 'app',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'USA (us2)',
|
|
28
|
+
value: 'us2',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'Europe / Middle East (eu)',
|
|
32
|
+
value: 'eu',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'Canada (ca)',
|
|
36
|
+
value: 'ca',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'Australia / Oceania (oc)',
|
|
40
|
+
value: 'oc',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'Japan (jp)',
|
|
44
|
+
value: 'jp',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'Government (fed)',
|
|
48
|
+
value: 'fed',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
displayName: 'Grant Type',
|
|
54
|
+
name: 'grantType',
|
|
55
|
+
type: 'options',
|
|
56
|
+
default: 'clientCredentials',
|
|
57
|
+
options: [
|
|
58
|
+
{
|
|
59
|
+
name: 'Authorization Code',
|
|
60
|
+
value: 'authorizationCode',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'Client Credentials',
|
|
64
|
+
value: 'clientCredentials',
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
displayName: 'Authorization URL',
|
|
70
|
+
name: 'authUrl',
|
|
71
|
+
type: 'hidden',
|
|
72
|
+
default: '={{ `https://${$self["region"]}.ninjarmm.com/ws/oauth/authorize` }}',
|
|
73
|
+
required: true,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
displayName: 'Access Token URL',
|
|
77
|
+
name: 'accessTokenUrl',
|
|
78
|
+
type: 'hidden',
|
|
79
|
+
default: '={{ `https://${$self["region"]}.ninjarmm.com/ws/oauth/token` }}',
|
|
80
|
+
required: true,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
displayName: 'Scope',
|
|
84
|
+
name: 'scope',
|
|
85
|
+
type: 'string',
|
|
86
|
+
default: 'monitoring',
|
|
87
|
+
placeholder: 'monitoring management control',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
displayName: 'Authentication',
|
|
91
|
+
name: 'authentication',
|
|
92
|
+
type: 'hidden',
|
|
93
|
+
default: 'header',
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
this.test = {
|
|
97
|
+
request: {
|
|
98
|
+
baseURL: '={{ `https://${$credentials.region}.ninjarmm.com` }}',
|
|
99
|
+
url: '/v2/organizations',
|
|
100
|
+
method: 'GET',
|
|
101
|
+
headers: {
|
|
102
|
+
Accept: 'application/json',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.NinjaOneOAuth2Api = NinjaOneOAuth2Api;
|
|
109
|
+
//# sourceMappingURL=NinjaOneOAuth2Api.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NinjaOneOAuth2Api.credentials.js","sourceRoot":"","sources":["../../credentials/NinjaOneOAuth2Api.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,iBAAiB;IAA9B;QACC,SAAI,GAAG,mBAAmB,CAAC;QAE3B,gBAAW,GAAG,qBAAqB,CAAC;QAEpC,YAAO,GAAG,CAAC,WAAW,CAAC,CAAC;QAExB,SAAI,GAAS;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ACd,OAAO,EAAE,iEAAiE;gBAC1E,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,YAAY;gBACrB,WAAW,EAAE,+BAA+B;aAC5C;YACD;gBACC,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,QAAQ;aACjB;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,sDAAsD;gBAC/D,GAAG,EAAE,mBAAmB;gBACxB,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACR,MAAM,EAAE,kBAAkB;iBAC1B;aACD;SACD,CAAC;IACH,CAAC;CAAA;AA3GD,8CA2GC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ninjaone.node.js","sourceRoot":"","sources":["../../../nodes/ninjaone/Ninjaone.node.ts"],"names":[],"mappings":";;;AAAA,+CAA8F;AAC9F,iDAA6D;AAE7D,MAAa,QAAQ;IAArB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE;gBACL,KAAK,EAAE,+BAA+B;gBACtC,IAAI,EAAE,oCAAoC;aAC1C;YACD,KAAK,EAAE,CAAC,OAAO,CAAC;YAChB,QAAQ,EAAE,gEAAgE;YAC1E,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,gCAAgC;YAC7C,QAAQ,EAAE;gBACT,IAAI,EAAE,UAAU;aAChB;YACD,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"Ninj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DD,4BAuDC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Device.resource.js","sourceRoot":"","sources":["../../../../../nodes/ninjaone/descriptions/device/Device.resource.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qDAAuC;AACvC,2DAA6C;AAEhC,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ;QACjB,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,QAAQ,CAAC;aACpB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,4BAA4B;gBACzC,KAAK,EAAE,QAAQ;gBACf,OAAO,EAAE;oBACR,OAAO,EAAE;wBACR,MAAM,EAAE,KAAK;wBACb,GAAG,EAAE,aAAa;qBAClB;iBACD;gBACD,MAAM,EAAE,kBAAkB;aAC1B;YACD;gBACC,IAAI,EAAE,KAAK;gBACX,WAAW,EAAE,qBAAqB;gBAClC,KAAK,EAAE,KAAK;gBACZ,OAAO,EAAE;oBACR,OAAO,EAAE;wBACR,MAAM,EAAE,KAAK;wBACb,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"Device.resource.js","sourceRoot":"","sources":["../../../../../nodes/ninjaone/descriptions/device/Device.resource.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qDAAuC;AACvC,2DAA6C;AAEhC,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ;QACjB,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,QAAQ,CAAC;aACpB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,4BAA4B;gBACzC,KAAK,EAAE,QAAQ;gBACf,OAAO,EAAE;oBACR,OAAO,EAAE;wBACR,MAAM,EAAE,KAAK;wBACb,GAAG,EAAE,aAAa;qBAClB;iBACD;gBACD,MAAM,EAAE,kBAAkB;aAC1B;YACD;gBACC,IAAI,EAAE,KAAK;gBACX,WAAW,EAAE,qBAAqB;gBAClC,KAAK,EAAE,KAAK;gBACZ,OAAO,EAAE;oBACR,OAAO,EAAE;wBACR,MAAM,EAAE,KAAK;wBACb,GAAG,EAAE,uCAAuC;qBAC5C;iBACD;gBACD,MAAM,EAAE,cAAc;aACtB;SACD;KACD;IACD,GAAG,MAAM,CAAC,WAAW;IACrB,GAAG,GAAG,CAAC,WAAW;CAClB,CAAC"}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@affeldt28/n8n-nodes-ninjaone",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "n8n node for NinjaOne",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/affeldt28/n8n-nodes-ninjaone",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"build:watch": "tsc --watch",
|
|
25
25
|
"dev": "n8n-node dev",
|
|
26
26
|
"format": "biome format --write ",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
27
28
|
"lint": "biome check",
|
|
28
29
|
"lint:fix": "biome check --write",
|
|
29
30
|
"n8n-lint": "n8n-node lint",
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
"n8nNodesApiVersion": 1,
|
|
38
39
|
"strict": true,
|
|
39
40
|
"credentials": [
|
|
40
|
-
"dist/credentials/
|
|
41
|
+
"dist/credentials/NinjaOneOAuth2Api.credentials.js"
|
|
41
42
|
],
|
|
42
43
|
"nodes": [
|
|
43
44
|
"dist/nodes/ninjaone/Ninjaone.node.js"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@affeldt28/n8n-nodes-ninjaone",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "n8n node for NinjaOne",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/affeldt28/n8n-nodes-ninjaone",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"build:watch": "tsc --watch",
|
|
25
25
|
"dev": "n8n-node dev",
|
|
26
26
|
"format": "biome format --write ",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
27
28
|
"lint": "biome check",
|
|
28
29
|
"lint:fix": "biome check --write",
|
|
29
30
|
"n8n-lint": "n8n-node lint",
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
"n8nNodesApiVersion": 1,
|
|
38
39
|
"strict": true,
|
|
39
40
|
"credentials": [
|
|
40
|
-
"dist/credentials/
|
|
41
|
+
"dist/credentials/NinjaOneOAuth2Api.credentials.js"
|
|
41
42
|
],
|
|
42
43
|
"nodes": [
|
|
43
44
|
"dist/nodes/ninjaone/Ninjaone.node.js"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { IAuthenticateGeneric, ICredentialDataDecryptedObject, ICredentialTestRequest, ICredentialType, Icon, IHttpRequestHelper, INodeProperties } from 'n8n-workflow';
|
|
2
|
-
export declare class NinjaoneApi implements ICredentialType {
|
|
3
|
-
name: string;
|
|
4
|
-
displayName: string;
|
|
5
|
-
icon: Icon;
|
|
6
|
-
documentationUrl: string;
|
|
7
|
-
properties: INodeProperties[];
|
|
8
|
-
preAuthentication(this: IHttpRequestHelper, credentials: ICredentialDataDecryptedObject): Promise<{
|
|
9
|
-
accessToken: string;
|
|
10
|
-
}>;
|
|
11
|
-
authenticate: IAuthenticateGeneric;
|
|
12
|
-
test: ICredentialTestRequest;
|
|
13
|
-
}
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NinjaoneApi = void 0;
|
|
4
|
-
class NinjaoneApi {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.name = 'ninjaoneApi';
|
|
7
|
-
this.displayName = 'NinjaOne API';
|
|
8
|
-
this.icon = { light: 'file:../icons/ninjaone.svg', dark: 'file:../icons/ninjaone.dark.svg' };
|
|
9
|
-
this.documentationUrl = 'https://www.ninjaone.com/de/services/ninjaone-api/';
|
|
10
|
-
this.properties = [
|
|
11
|
-
{
|
|
12
|
-
displayName: 'Region',
|
|
13
|
-
name: 'region',
|
|
14
|
-
type: 'options',
|
|
15
|
-
typeOptions: { password: false },
|
|
16
|
-
required: true,
|
|
17
|
-
default: '',
|
|
18
|
-
description: '',
|
|
19
|
-
options: [
|
|
20
|
-
{
|
|
21
|
-
name: 'USA Standard (app)',
|
|
22
|
-
value: 'app',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name: 'USA (us2)',
|
|
26
|
-
value: 'us2',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: 'Europa / Middle East (eu)',
|
|
30
|
-
value: 'eu',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: 'Canada (ca)',
|
|
34
|
-
value: 'ca',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: 'Australia / Oceania (oc)',
|
|
38
|
-
value: 'oc',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: 'Japan (jp)',
|
|
42
|
-
value: 'jp',
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: 'Government (fed)',
|
|
46
|
-
value: 'fed',
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
displayName: 'Client Id',
|
|
52
|
-
name: 'clientId',
|
|
53
|
-
type: 'string',
|
|
54
|
-
typeOptions: { password: false },
|
|
55
|
-
required: true,
|
|
56
|
-
default: '',
|
|
57
|
-
description: 'Client Id can be created in the NinjaOne portal.',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
displayName: 'Client Secret',
|
|
61
|
-
name: 'clientSecret',
|
|
62
|
-
type: 'string',
|
|
63
|
-
typeOptions: { password: true },
|
|
64
|
-
default: '',
|
|
65
|
-
description: 'Client secret can be created in the NinjaOne portal.',
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
displayName: 'Redirect URI',
|
|
69
|
-
name: 'redirectUri',
|
|
70
|
-
type: 'string',
|
|
71
|
-
default: 'https://localhost',
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
displayName: 'Scope',
|
|
75
|
-
name: 'scope',
|
|
76
|
-
type: 'multiOptions',
|
|
77
|
-
default: ['monitoring'],
|
|
78
|
-
options: [
|
|
79
|
-
{
|
|
80
|
-
name: 'Monitoring',
|
|
81
|
-
value: 'monitoring',
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: 'Management',
|
|
85
|
-
value: 'management',
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
name: 'Control',
|
|
89
|
-
value: 'control',
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
displayName: 'Grant Type',
|
|
95
|
-
name: 'grantType',
|
|
96
|
-
type: 'options',
|
|
97
|
-
default: 'client_credentials',
|
|
98
|
-
required: true,
|
|
99
|
-
options: [
|
|
100
|
-
{
|
|
101
|
-
name: 'Authorization Code',
|
|
102
|
-
value: 'authorization_code',
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name: 'Client Credentials',
|
|
106
|
-
value: 'client_credentials',
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: 'Refresh Token',
|
|
110
|
-
value: 'refresh_token',
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
displayName: 'Code',
|
|
116
|
-
name: 'code',
|
|
117
|
-
type: 'string',
|
|
118
|
-
default: '',
|
|
119
|
-
displayOptions: {
|
|
120
|
-
show: {
|
|
121
|
-
grantType: ['authorization_code'],
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
displayName: 'Refresh Token',
|
|
127
|
-
name: 'refresh_token',
|
|
128
|
-
type: 'string',
|
|
129
|
-
typeOptions: { password: true },
|
|
130
|
-
default: '',
|
|
131
|
-
displayOptions: {
|
|
132
|
-
show: {
|
|
133
|
-
grantType: ['refresh_token'],
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
displayName: 'Access Token',
|
|
139
|
-
name: 'accessToken',
|
|
140
|
-
type: 'hidden',
|
|
141
|
-
typeOptions: {
|
|
142
|
-
expirable: true,
|
|
143
|
-
password: true,
|
|
144
|
-
},
|
|
145
|
-
default: '',
|
|
146
|
-
},
|
|
147
|
-
];
|
|
148
|
-
this.authenticate = {
|
|
149
|
-
type: 'generic',
|
|
150
|
-
properties: {
|
|
151
|
-
headers: {
|
|
152
|
-
Authorization: '=Bearer {{$credentials.accessToken}}',
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
this.test = {
|
|
157
|
-
request: {
|
|
158
|
-
baseURL: '={{ `https://${$credentials.region}.ninjarmm.com` }}',
|
|
159
|
-
url: '/v2/organizations',
|
|
160
|
-
method: 'GET',
|
|
161
|
-
headers: {
|
|
162
|
-
Accept: 'application/json',
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
async preAuthentication(credentials) {
|
|
168
|
-
var _a, _b, _c, _d, _e, _f;
|
|
169
|
-
const grants = Array.isArray(credentials.grantType)
|
|
170
|
-
? credentials.grantType
|
|
171
|
-
: [credentials.grantType];
|
|
172
|
-
if (grants.length !== 1 ||
|
|
173
|
-
!['client_credentials', 'authorization_code', 'refresh_token'].includes(String(grants[0]))) {
|
|
174
|
-
throw new Error('Select exactly one supported OAuth grant type.');
|
|
175
|
-
}
|
|
176
|
-
const grantType = String(grants[0]);
|
|
177
|
-
const body = {
|
|
178
|
-
grant_type: grantType,
|
|
179
|
-
client_id: String((_a = credentials.clientId) !== null && _a !== void 0 ? _a : ''),
|
|
180
|
-
client_secret: String((_b = credentials.clientSecret) !== null && _b !== void 0 ? _b : ''),
|
|
181
|
-
scope: Array.isArray(credentials.scope)
|
|
182
|
-
? credentials.scope.join(' ')
|
|
183
|
-
: String((_c = credentials.scope) !== null && _c !== void 0 ? _c : 'monitoring'),
|
|
184
|
-
};
|
|
185
|
-
if (grantType === 'authorization_code') {
|
|
186
|
-
body.code = String((_d = credentials.code) !== null && _d !== void 0 ? _d : '');
|
|
187
|
-
body.redirect_uri = String((_e = credentials.redirectUri) !== null && _e !== void 0 ? _e : '');
|
|
188
|
-
}
|
|
189
|
-
else if (grantType === 'refresh_token') {
|
|
190
|
-
body.refresh_token = String((_f = credentials.refresh_token) !== null && _f !== void 0 ? _f : '');
|
|
191
|
-
}
|
|
192
|
-
const response = (await this.helpers.httpRequest({
|
|
193
|
-
method: 'POST',
|
|
194
|
-
url: `https://${credentials.region}.ninjarmm.com/ws/oauth/token`,
|
|
195
|
-
headers: {
|
|
196
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
197
|
-
Accept: 'application/json',
|
|
198
|
-
},
|
|
199
|
-
body,
|
|
200
|
-
json: true,
|
|
201
|
-
}));
|
|
202
|
-
if (typeof response.access_token !== 'string' || !response.access_token) {
|
|
203
|
-
throw new Error('NinjaOne did not return an access token.');
|
|
204
|
-
}
|
|
205
|
-
return { accessToken: response.access_token };
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
exports.NinjaoneApi = NinjaoneApi;
|
|
209
|
-
//# sourceMappingURL=NinjaoneApi.credentials.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NinjaoneApi.credentials.js","sourceRoot":"","sources":["../../credentials/NinjaoneApi.credentials.ts"],"names":[],"mappings":";;;AAUA,MAAa,WAAW;IAAxB;QACC,SAAI,GAAG,aAAa,CAAC;QAErB,gBAAW,GAAG,cAAc,CAAC;QAE7B,SAAI,GAAS,EAAE,KAAK,EAAE,4BAA4B,EAAE,IAAI,EAAE,iCAAiC,EAAE,CAAC;QAE9F,qBAAgB,GAAG,oDAAoD,CAAC;QAExE,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,QAAQ;gBACrB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE;gBAChC,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,EAAE;gBACf,OAAO,EAAE;oBACR;wBACC,IAAI,EAAE,oBAAoB;wBAC1B,KAAK,EAAE,KAAK;qBACZ;oBACD;wBACC,IAAI,EAAE,WAAW;wBACjB,KAAK,EAAE,KAAK;qBACZ;oBACD;wBACC,IAAI,EAAE,2BAA2B;wBACjC,KAAK,EAAE,IAAI;qBACX;oBACD;wBACC,IAAI,EAAE,aAAa;wBACnB,KAAK,EAAE,IAAI;qBACX;oBACD;wBACC,IAAI,EAAE,0BAA0B;wBAChC,KAAK,EAAE,IAAI;qBACX;oBACD;wBACC,IAAI,EAAE,YAAY;wBAClB,KAAK,EAAE,IAAI;qBACX;oBACD;wBACC,IAAI,EAAE,kBAAkB;wBACxB,KAAK,EAAE,KAAK;qBACZ;iBACD;aACD;YACD;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE;gBAChC,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,kDAAkD;aAC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