@joshuanode/n8n-nodes-immybot 0.0.4 → 0.0.6
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/README.md +24 -10
- package/dist/nodes/ImmyBot/ImmyBot.node.d.ts +14 -0
- package/dist/nodes/ImmyBot/ImmyBot.node.d.ts.map +1 -1
- package/dist/nodes/ImmyBot/ImmyBot.node.js +54 -0
- package/dist/nodes/ImmyBot/ImmyBot.node.js.map +1 -1
- package/dist/nodes/ImmyBot/resources/ChangeRequest/ChangeRequestRouter.d.ts.map +1 -1
- package/dist/nodes/ImmyBot/resources/ChangeRequest/ChangeRequestRouter.js +9 -0
- package/dist/nodes/ImmyBot/resources/ChangeRequest/ChangeRequestRouter.js.map +1 -1
- package/dist/nodes/ImmyBot/resources/Computer/ComputerRouter.d.ts.map +1 -1
- package/dist/nodes/ImmyBot/resources/Computer/ComputerRouter.js +40 -20
- package/dist/nodes/ImmyBot/resources/Computer/ComputerRouter.js.map +1 -1
- package/dist/nodes/ImmyBot/resources/Computer/index.d.ts.map +1 -1
- package/dist/nodes/ImmyBot/resources/Computer/index.js +63 -40
- package/dist/nodes/ImmyBot/resources/Computer/index.js.map +1 -1
- package/dist/nodes/ImmyBot/resources/MaintenanceAction/MaintenanceActionRouter.d.ts.map +1 -1
- package/dist/nodes/ImmyBot/resources/MaintenanceAction/MaintenanceActionRouter.js +4 -0
- package/dist/nodes/ImmyBot/resources/MaintenanceAction/MaintenanceActionRouter.js.map +1 -1
- package/dist/nodes/ImmyBot/resources/Person/PersonRouter.d.ts.map +1 -1
- package/dist/nodes/ImmyBot/resources/Person/PersonRouter.js +4 -0
- package/dist/nodes/ImmyBot/resources/Person/PersonRouter.js.map +1 -1
- package/dist/nodes/ImmyBot/resources/Script/ScriptRouter.d.ts.map +1 -1
- package/dist/nodes/ImmyBot/resources/Script/ScriptRouter.js +5 -0
- package/dist/nodes/ImmyBot/resources/Script/ScriptRouter.js.map +1 -1
- package/dist/nodes/ImmyBot/resources/Software/SoftwareRouter.d.ts.map +1 -1
- package/dist/nodes/ImmyBot/resources/Software/SoftwareRouter.js +10 -0
- package/dist/nodes/ImmyBot/resources/Software/SoftwareRouter.js.map +1 -1
- package/dist/nodes/ImmyBot/resources/Sync/SyncRouter.d.ts.map +1 -1
- package/dist/nodes/ImmyBot/resources/Sync/SyncRouter.js +4 -0
- package/dist/nodes/ImmyBot/resources/Sync/SyncRouter.js.map +1 -1
- package/dist/nodes/ImmyBot/resources/Tag/TagRouter.d.ts.map +1 -1
- package/dist/nodes/ImmyBot/resources/Tag/TagRouter.js +4 -0
- package/dist/nodes/ImmyBot/resources/Tag/TagRouter.js.map +1 -1
- package/dist/nodes/ImmyBot/resources/Tenant/TenantRouter.d.ts.map +1 -1
- package/dist/nodes/ImmyBot/resources/Tenant/TenantRouter.js +8 -0
- package/dist/nodes/ImmyBot/resources/Tenant/TenantRouter.js.map +1 -1
- package/dist/nodes/ImmyBot/resources/User/UserRouter.d.ts.map +1 -1
- package/dist/nodes/ImmyBot/resources/User/UserRouter.js +15 -0
- package/dist/nodes/ImmyBot/resources/User/UserRouter.js.map +1 -1
- package/dist/nodes/ImmyBot/utils.d.ts +10 -2
- package/dist/nodes/ImmyBot/utils.d.ts.map +1 -1
- package/dist/nodes/ImmyBot/utils.js +27 -3
- package/dist/nodes/ImmyBot/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.userRouter = userRouter;
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
4
5
|
function getResourceLocatorValue(value) {
|
|
5
6
|
if (typeof value === 'string') {
|
|
6
7
|
return value;
|
|
@@ -23,9 +24,11 @@ function parseRoleNames(value) {
|
|
|
23
24
|
return value.split(',').map((role) => role.trim());
|
|
24
25
|
}
|
|
25
26
|
async function userRouter(index, operation) {
|
|
27
|
+
const auth = await (0, utils_1.getImmyBotAuth)(this);
|
|
26
28
|
if (operation === 'get') {
|
|
27
29
|
const userId = getResourceLocatorValue(this.getNodeParameter('userId', index));
|
|
28
30
|
return await this.helpers.httpRequest({
|
|
31
|
+
...auth,
|
|
29
32
|
method: 'GET',
|
|
30
33
|
url: `/api/v1/users/${userId}`,
|
|
31
34
|
});
|
|
@@ -38,6 +41,7 @@ async function userRouter(index, operation) {
|
|
|
38
41
|
qs.pageSize = limit;
|
|
39
42
|
}
|
|
40
43
|
const response = (await this.helpers.httpRequest({
|
|
44
|
+
...auth,
|
|
41
45
|
method: 'GET',
|
|
42
46
|
url: '/api/v1/users',
|
|
43
47
|
qs,
|
|
@@ -49,6 +53,7 @@ async function userRouter(index, operation) {
|
|
|
49
53
|
const updateFields = this.getNodeParameter('updateFields', index, {});
|
|
50
54
|
// Get current data
|
|
51
55
|
const currentData = (await this.helpers.httpRequest({
|
|
56
|
+
...auth,
|
|
52
57
|
method: 'GET',
|
|
53
58
|
url: `/api/v1/users/${userId}`,
|
|
54
59
|
}));
|
|
@@ -65,6 +70,7 @@ async function userRouter(index, operation) {
|
|
|
65
70
|
body.lastName = updateFields.lastName;
|
|
66
71
|
}
|
|
67
72
|
return await this.helpers.httpRequest({
|
|
73
|
+
...auth,
|
|
68
74
|
method: 'POST',
|
|
69
75
|
url: `/api/v1/users/${userId}`,
|
|
70
76
|
body,
|
|
@@ -73,12 +79,14 @@ async function userRouter(index, operation) {
|
|
|
73
79
|
if (operation === 'delete') {
|
|
74
80
|
const userId = getResourceLocatorValue(this.getNodeParameter('userId', index));
|
|
75
81
|
return await this.helpers.httpRequest({
|
|
82
|
+
...auth,
|
|
76
83
|
method: 'DELETE',
|
|
77
84
|
url: `/api/v1/users/${userId}`,
|
|
78
85
|
});
|
|
79
86
|
}
|
|
80
87
|
if (operation === 'getClaims') {
|
|
81
88
|
const response = (await this.helpers.httpRequest({
|
|
89
|
+
...auth,
|
|
82
90
|
method: 'GET',
|
|
83
91
|
url: '/api/v1/users/claims',
|
|
84
92
|
}));
|
|
@@ -87,6 +95,7 @@ async function userRouter(index, operation) {
|
|
|
87
95
|
if (operation === 'createFromPerson') {
|
|
88
96
|
const personId = getResourceLocatorValue(this.getNodeParameter('personId', index));
|
|
89
97
|
return await this.helpers.httpRequest({
|
|
98
|
+
...auth,
|
|
90
99
|
method: 'POST',
|
|
91
100
|
url: '/api/v1/users/create-from-person',
|
|
92
101
|
body: {
|
|
@@ -98,6 +107,7 @@ async function userRouter(index, operation) {
|
|
|
98
107
|
const userIdsStr = this.getNodeParameter('userIds', index);
|
|
99
108
|
const userIds = parseUserIds(userIdsStr);
|
|
100
109
|
return await this.helpers.httpRequest({
|
|
110
|
+
...auth,
|
|
101
111
|
method: 'DELETE',
|
|
102
112
|
url: '/api/v1/users/bulk-delete',
|
|
103
113
|
body: {
|
|
@@ -110,6 +120,7 @@ async function userRouter(index, operation) {
|
|
|
110
120
|
const roleNamesStr = this.getNodeParameter('roleNames', index);
|
|
111
121
|
const roleNames = parseRoleNames(roleNamesStr);
|
|
112
122
|
return await this.helpers.httpRequest({
|
|
123
|
+
...auth,
|
|
113
124
|
method: 'POST',
|
|
114
125
|
url: '/api/v1/users/add-roles',
|
|
115
126
|
body: {
|
|
@@ -123,6 +134,7 @@ async function userRouter(index, operation) {
|
|
|
123
134
|
const roleNamesStr = this.getNodeParameter('roleNames', index);
|
|
124
135
|
const roleNames = parseRoleNames(roleNamesStr);
|
|
125
136
|
return await this.helpers.httpRequest({
|
|
137
|
+
...auth,
|
|
126
138
|
method: 'POST',
|
|
127
139
|
url: '/api/v1/users/remove-roles',
|
|
128
140
|
body: {
|
|
@@ -135,6 +147,7 @@ async function userRouter(index, operation) {
|
|
|
135
147
|
const userEmail = this.getNodeParameter('userEmail', index);
|
|
136
148
|
const tenantId = getResourceLocatorValue(this.getNodeParameter('tenantId', index));
|
|
137
149
|
return await this.helpers.httpRequest({
|
|
150
|
+
...auth,
|
|
138
151
|
method: 'POST',
|
|
139
152
|
url: '/api/v1/users/grant-access',
|
|
140
153
|
body: {
|
|
@@ -147,6 +160,7 @@ async function userRouter(index, operation) {
|
|
|
147
160
|
const userEmail = this.getNodeParameter('userEmail', index);
|
|
148
161
|
const expirationDate = this.getNodeParameter('expirationDate', index);
|
|
149
162
|
return await this.helpers.httpRequest({
|
|
163
|
+
...auth,
|
|
150
164
|
method: 'POST',
|
|
151
165
|
url: '/api/v1/users/update-expiration',
|
|
152
166
|
body: {
|
|
@@ -157,6 +171,7 @@ async function userRouter(index, operation) {
|
|
|
157
171
|
}
|
|
158
172
|
if (operation === 'invalidateCache') {
|
|
159
173
|
return await this.helpers.httpRequest({
|
|
174
|
+
...auth,
|
|
160
175
|
method: 'POST',
|
|
161
176
|
url: '/api/v1/users/invalidate-cache',
|
|
162
177
|
body: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserRouter.js","sourceRoot":"","sources":["../../../../../src/nodes/ImmyBot/resources/User/UserRouter.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"UserRouter.js","sourceRoot":"","sources":["../../../../../src/nodes/ImmyBot/resources/User/UserRouter.ts"],"names":[],"mappings":";;AA2BA,gCAsMC;AAhOD,uCAA6C;AAE7C,SAAS,uBAAuB,CAAC,KAA2B;IAC3D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAQ,KAAK,CAAC,KAAgB,IAAI,EAAE,CAAC;AACtC,CAAC;AAED,SAAS,YAAY,CAAC,KAAwB;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAa,CAAC;QACtC,CAAC;QACD,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAU,EAAE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AAO,CAAC,WAAW,CAAC;YACrC,GAAG,IAAI;YACP,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,4BAA4B;YACjC,IAAI,EAAE;gBACL,SAAS;gBACT,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC;aAChC;SACD,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,SAAS,KAAK,kBAAkB,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,KAAK,CAAW,CAAC;QACtE,MAAM,cAAc,GAAG,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,KAAK,CAAW,CAAC;QAEhF,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;YACrC,GAAG,IAAI;YACP,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,iCAAiC;YACtC,IAAI,EAAE;gBACL,SAAS;gBACT,cAAc;aACd;SACD,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,SAAS,KAAK,iBAAiB,EAAE,CAAC;QACrC,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;YACrC,GAAG,IAAI;YACP,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,gCAAgC;YACrC,IAAI,EAAE,EAAE;SACR,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,sBAAsB,SAAS,EAAE,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import type { IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
-
export
|
|
1
|
+
import type { IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-workflow';
|
|
2
|
+
export interface ImmyBotAuthOptions {
|
|
3
|
+
baseURL: string;
|
|
4
|
+
headers: {
|
|
5
|
+
Authorization: string;
|
|
6
|
+
'Content-Type': string;
|
|
7
|
+
Accept: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare function getImmyBotAuth(context: IExecuteFunctions | ILoadOptionsFunctions): Promise<ImmyBotAuthOptions>;
|
|
3
11
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/nodes/ImmyBot/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAe,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/nodes/ImmyBot/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAe,MAAM,cAAc,CAAC;AAE1F,MAAM,WAAW,kBAAkB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QACR,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;KACf,CAAC;CACF;AAED,wBAAsB,cAAc,CACnC,OAAO,EAAE,iBAAiB,GAAG,qBAAqB,GAChD,OAAO,CAAC,kBAAkB,CAAC,CA+B7B"}
|
|
@@ -1,8 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
async function
|
|
3
|
+
exports.getImmyBotAuth = getImmyBotAuth;
|
|
4
|
+
async function getImmyBotAuth(context) {
|
|
5
5
|
const credentials = await context.getCredentials('immyDotBotOAuth2Api');
|
|
6
|
-
|
|
6
|
+
// Get OAuth2 token from Azure AD
|
|
7
|
+
const tokenUrl = `https://login.microsoftonline.com/${credentials.tenantId}/oauth2/v2.0/token`;
|
|
8
|
+
const scope = `https://${credentials.subdomain}.immy.bot/.default`;
|
|
9
|
+
const tokenBody = new URLSearchParams({
|
|
10
|
+
grant_type: 'client_credentials',
|
|
11
|
+
client_id: credentials.clientId,
|
|
12
|
+
client_secret: credentials.clientSecret,
|
|
13
|
+
scope: scope,
|
|
14
|
+
});
|
|
15
|
+
const tokenResponse = await context.helpers.httpRequest({
|
|
16
|
+
method: 'POST',
|
|
17
|
+
url: tokenUrl,
|
|
18
|
+
headers: {
|
|
19
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
20
|
+
},
|
|
21
|
+
body: tokenBody.toString(),
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
baseURL: `https://${credentials.subdomain}.immy.bot`,
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: `Bearer ${tokenResponse.access_token}`,
|
|
27
|
+
'Content-Type': 'application/json',
|
|
28
|
+
Accept: 'application/json',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
7
31
|
}
|
|
8
32
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/nodes/ImmyBot/utils.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/nodes/ImmyBot/utils.ts"],"names":[],"mappings":";;AAWA,wCAiCC;AAjCM,KAAK,UAAU,cAAc,CACnC,OAAkD;IAElD,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC;IAExE,iCAAiC;IACjC,MAAM,QAAQ,GAAG,qCAAqC,WAAW,CAAC,QAAQ,oBAAoB,CAAC;IAC/F,MAAM,KAAK,GAAG,WAAW,WAAW,CAAC,SAAS,oBAAoB,CAAC;IAEnE,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC;QACrC,UAAU,EAAE,oBAAoB;QAChC,SAAS,EAAE,WAAW,CAAC,QAAkB;QACzC,aAAa,EAAE,WAAW,CAAC,YAAsB;QACjD,KAAK,EAAE,KAAK;KACZ,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;QACvD,MAAM,EAAE,MAAM;QACd,GAAG,EAAE,QAAQ;QACb,OAAO,EAAE;YACR,cAAc,EAAE,mCAAmC;SACnD;QACD,IAAI,EAAE,SAAS,CAAC,QAAQ,EAAE;KAC1B,CAAC,CAAC;IAEH,OAAO;QACN,OAAO,EAAE,WAAW,WAAW,CAAC,SAAS,WAAW;QACpD,OAAO,EAAE;YACR,aAAa,EAAE,UAAW,aAA6B,CAAC,YAAY,EAAE;YACtE,cAAc,EAAE,kBAAkB;YAClC,MAAM,EAAE,kBAAkB;SAC1B;KACD,CAAC;AACH,CAAC"}
|