n8n-nodes-runrunit 0.2.11 → 0.2.13
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 +43 -45
- package/dist/credentials/{RunrunIt.credentials.d.ts → RunrunItApi.credentials.d.ts} +1 -1
- package/dist/credentials/{RunrunIt.credentials.js → RunrunItApi.credentials.js} +15 -15
- package/dist/credentials/RunrunItApi.credentials.js.map +1 -0
- package/dist/{nodes/RunrunIt/runrunit_v2.svg → icons/glpi.dark.svg} +10 -10
- package/dist/icons/{runrunit.dark.svg → glpi.svg} +10 -10
- package/dist/nodes/RunrunIt/{RunrunIt.node.d.ts → RunrunItApi.node.d.ts} +1 -1
- package/dist/nodes/RunrunIt/RunrunItApi.node.js +402 -0
- package/dist/nodes/RunrunIt/RunrunItApi.node.js.map +1 -0
- package/dist/nodes/RunrunIt/{RunrunIt.node.json → RunrunItApi.node.json} +2 -2
- package/dist/nodes/RunrunIt/resources/Tasks/create.d.ts +2 -0
- package/dist/nodes/RunrunIt/resources/{Assets → Tasks}/create.js +5 -5
- package/dist/nodes/RunrunIt/resources/Tasks/create.js.map +1 -0
- package/dist/nodes/RunrunIt/resources/Tasks/delete.d.ts +2 -0
- package/dist/nodes/RunrunIt/resources/Tasks/delete.js +5 -0
- package/dist/nodes/RunrunIt/resources/Tasks/delete.js.map +1 -0
- package/dist/nodes/RunrunIt/resources/Tasks/get.d.ts +2 -0
- package/dist/nodes/RunrunIt/resources/{Assets → Tasks}/get.js +3 -3
- package/dist/nodes/RunrunIt/resources/Tasks/get.js.map +1 -0
- package/dist/nodes/RunrunIt/resources/Tasks/index.d.ts +2 -0
- package/dist/nodes/RunrunIt/resources/{Assets → Tasks}/index.js +19 -35
- package/dist/nodes/RunrunIt/resources/Tasks/index.js.map +1 -0
- package/dist/nodes/RunrunIt/resources/Tasks/options.d.ts +2 -0
- package/dist/nodes/RunrunIt/resources/Tasks/options.js +5 -0
- package/dist/nodes/RunrunIt/resources/Tasks/options.js.map +1 -0
- package/dist/nodes/RunrunIt/resources/Tasks/update.d.ts +2 -0
- package/dist/nodes/RunrunIt/resources/{Assets → Tasks}/update.js +6 -6
- package/dist/nodes/RunrunIt/resources/Tasks/update.js.map +1 -0
- package/dist/{icons → nodes/RunrunIt}/runrunit.svg +10 -10
- package/dist/package.json +7 -7
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/dist/credentials/RunrunIt.credentials.js.map +0 -1
- package/dist/nodes/RunrunIt/RunrunIt.node.js +0 -779
- package/dist/nodes/RunrunIt/RunrunIt.node.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Administration/create.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Administration/create.js +0 -60
- package/dist/nodes/RunrunIt/resources/Administration/create.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Administration/delete.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Administration/delete.js +0 -28
- package/dist/nodes/RunrunIt/resources/Administration/delete.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Administration/get.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Administration/get.js +0 -45
- package/dist/nodes/RunrunIt/resources/Administration/get.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Administration/index.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Administration/index.js +0 -57
- package/dist/nodes/RunrunIt/resources/Administration/index.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Administration/options.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Administration/options.js +0 -14
- package/dist/nodes/RunrunIt/resources/Administration/options.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Administration/update.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Administration/update.js +0 -75
- package/dist/nodes/RunrunIt/resources/Administration/update.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Assets/create.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Assets/create.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Assets/delete.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Assets/delete.js +0 -5
- package/dist/nodes/RunrunIt/resources/Assets/delete.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Assets/get.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Assets/get.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Assets/index.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Assets/index.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Assets/options.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Assets/options.js +0 -5
- package/dist/nodes/RunrunIt/resources/Assets/options.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Assets/update.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Assets/update.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Assistance/create.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Assistance/create.js +0 -104
- package/dist/nodes/RunrunIt/resources/Assistance/create.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Assistance/delete.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Assistance/delete.js +0 -38
- package/dist/nodes/RunrunIt/resources/Assistance/delete.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Assistance/get.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Assistance/get.js +0 -54
- package/dist/nodes/RunrunIt/resources/Assistance/get.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Assistance/index.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Assistance/index.js +0 -57
- package/dist/nodes/RunrunIt/resources/Assistance/index.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Assistance/options.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Assistance/options.js +0 -21
- package/dist/nodes/RunrunIt/resources/Assistance/options.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Assistance/update.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Assistance/update.js +0 -95
- package/dist/nodes/RunrunIt/resources/Assistance/update.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Components/create.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Components/create.js +0 -57
- package/dist/nodes/RunrunIt/resources/Components/create.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Components/delete.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Components/delete.js +0 -22
- package/dist/nodes/RunrunIt/resources/Components/delete.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Components/get.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Components/get.js +0 -35
- package/dist/nodes/RunrunIt/resources/Components/get.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Components/index.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Components/index.js +0 -90
- package/dist/nodes/RunrunIt/resources/Components/index.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Components/options.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Components/options.js +0 -14
- package/dist/nodes/RunrunIt/resources/Components/options.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Components/update.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Components/update.js +0 -47
- package/dist/nodes/RunrunIt/resources/Components/update.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Custom Assets/index.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Custom Assets/index.js +0 -5
- package/dist/nodes/RunrunIt/resources/Custom Assets/index.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Dropdowns/create.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Dropdowns/create.js +0 -23
- package/dist/nodes/RunrunIt/resources/Dropdowns/create.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Dropdowns/delete.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Dropdowns/delete.js +0 -5
- package/dist/nodes/RunrunIt/resources/Dropdowns/delete.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Dropdowns/get.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Dropdowns/get.js +0 -5
- package/dist/nodes/RunrunIt/resources/Dropdowns/get.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Dropdowns/index.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Dropdowns/index.js +0 -83
- package/dist/nodes/RunrunIt/resources/Dropdowns/index.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Dropdowns/options.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Dropdowns/options.js +0 -5
- package/dist/nodes/RunrunIt/resources/Dropdowns/options.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Dropdowns/update.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Dropdowns/update.js +0 -23
- package/dist/nodes/RunrunIt/resources/Dropdowns/update.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/GraphQL/execute.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/GraphQL/execute.js +0 -5
- package/dist/nodes/RunrunIt/resources/GraphQL/execute.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/GraphQL/index.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/GraphQL/index.js +0 -98
- package/dist/nodes/RunrunIt/resources/GraphQL/index.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/GraphQL/options.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/GraphQL/options.js +0 -5
- package/dist/nodes/RunrunIt/resources/GraphQL/options.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/GraphQL/schema.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/GraphQL/schema.js +0 -5
- package/dist/nodes/RunrunIt/resources/GraphQL/schema.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Management/create.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Management/create.js +0 -36
- package/dist/nodes/RunrunIt/resources/Management/create.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Management/delete.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Management/delete.js +0 -14
- package/dist/nodes/RunrunIt/resources/Management/delete.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Management/get.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Management/get.js +0 -17
- package/dist/nodes/RunrunIt/resources/Management/get.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Management/index.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Management/index.js +0 -79
- package/dist/nodes/RunrunIt/resources/Management/index.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Management/options.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Management/options.js +0 -5
- package/dist/nodes/RunrunIt/resources/Management/options.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Management/update.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Management/update.js +0 -36
- package/dist/nodes/RunrunIt/resources/Management/update.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/OAuth/index.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/OAuth/index.js +0 -96
- package/dist/nodes/RunrunIt/resources/OAuth/index.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Project/create.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Project/create.js +0 -36
- package/dist/nodes/RunrunIt/resources/Project/create.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Project/delete.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Project/delete.js +0 -22
- package/dist/nodes/RunrunIt/resources/Project/delete.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Project/get.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Project/get.js +0 -17
- package/dist/nodes/RunrunIt/resources/Project/get.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Project/index.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Project/index.js +0 -66
- package/dist/nodes/RunrunIt/resources/Project/index.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Project/options.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Project/options.js +0 -5
- package/dist/nodes/RunrunIt/resources/Project/options.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Project/update.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Project/update.js +0 -43
- package/dist/nodes/RunrunIt/resources/Project/update.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Rule/create.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Rule/create.js +0 -74
- package/dist/nodes/RunrunIt/resources/Rule/create.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Rule/delete.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Rule/delete.js +0 -23
- package/dist/nodes/RunrunIt/resources/Rule/delete.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Rule/get.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Rule/get.js +0 -14
- package/dist/nodes/RunrunIt/resources/Rule/get.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Rule/index.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Rule/index.js +0 -104
- package/dist/nodes/RunrunIt/resources/Rule/index.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Rule/options.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Rule/options.js +0 -5
- package/dist/nodes/RunrunIt/resources/Rule/options.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Rule/update.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Rule/update.js +0 -52
- package/dist/nodes/RunrunIt/resources/Rule/update.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Session/get.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Session/get.js +0 -22
- package/dist/nodes/RunrunIt/resources/Session/get.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Session/index.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Session/index.js +0 -46
- package/dist/nodes/RunrunIt/resources/Session/index.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Session/options.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Session/options.js +0 -5
- package/dist/nodes/RunrunIt/resources/Session/options.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Setup/create.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Setup/create.js +0 -23
- package/dist/nodes/RunrunIt/resources/Setup/create.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Setup/delete.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Setup/delete.js +0 -5
- package/dist/nodes/RunrunIt/resources/Setup/delete.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Setup/get.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Setup/get.js +0 -5
- package/dist/nodes/RunrunIt/resources/Setup/get.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Setup/index.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Setup/index.js +0 -112
- package/dist/nodes/RunrunIt/resources/Setup/index.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Setup/options.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Setup/options.js +0 -5
- package/dist/nodes/RunrunIt/resources/Setup/options.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Setup/update.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Setup/update.js +0 -23
- package/dist/nodes/RunrunIt/resources/Setup/update.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Status/get.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Status/get.js +0 -5
- package/dist/nodes/RunrunIt/resources/Status/get.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Status/index.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Status/index.js +0 -64
- package/dist/nodes/RunrunIt/resources/Status/index.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Status/options.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Status/options.js +0 -5
- package/dist/nodes/RunrunIt/resources/Status/options.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Tools/create.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Tools/create.js +0 -23
- package/dist/nodes/RunrunIt/resources/Tools/create.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Tools/delete.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Tools/delete.js +0 -5
- package/dist/nodes/RunrunIt/resources/Tools/delete.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Tools/get.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Tools/get.js +0 -5
- package/dist/nodes/RunrunIt/resources/Tools/get.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Tools/index.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Tools/index.js +0 -76
- package/dist/nodes/RunrunIt/resources/Tools/index.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Tools/options.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Tools/options.js +0 -5
- package/dist/nodes/RunrunIt/resources/Tools/options.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/Tools/update.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/Tools/update.js +0 -23
- package/dist/nodes/RunrunIt/resources/Tools/update.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/default/dynamic.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/default/dynamic.js +0 -5
- package/dist/nodes/RunrunIt/resources/default/dynamic.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/default/index.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/default/index.js +0 -103
- package/dist/nodes/RunrunIt/resources/default/index.js.map +0 -1
- package/dist/nodes/RunrunIt/resources/default/options.d.ts +0 -2
- package/dist/nodes/RunrunIt/resources/default/options.js +0 -5
- package/dist/nodes/RunrunIt/resources/default/options.js.map +0 -1
|
@@ -1,779 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RunrunIt = void 0;
|
|
4
|
-
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
-
const Administration_1 = require("./resources/Administration");
|
|
6
|
-
const Assistance_1 = require("./resources/Assistance");
|
|
7
|
-
const Assets_1 = require("./resources/Assets");
|
|
8
|
-
const Components_1 = require("./resources/Components");
|
|
9
|
-
const Dropdowns_1 = require("./resources/Dropdowns");
|
|
10
|
-
const Management_1 = require("./resources/Management");
|
|
11
|
-
const Project_1 = require("./resources/Project");
|
|
12
|
-
const Rule_1 = require("./resources/Rule");
|
|
13
|
-
const Session_1 = require("./resources/Session");
|
|
14
|
-
const DEFAULT_RAW_TEMPLATES = {
|
|
15
|
-
'Administration/User': {
|
|
16
|
-
id: 132,
|
|
17
|
-
username: 'teste2@teste.com',
|
|
18
|
-
realname: 'Teste inclusão',
|
|
19
|
-
firstname: 'Teste',
|
|
20
|
-
password: '123456',
|
|
21
|
-
password2: '123456',
|
|
22
|
-
phone: '',
|
|
23
|
-
phone2: '',
|
|
24
|
-
mobile: '',
|
|
25
|
-
emails: [{ email: 'teste1@teste.com', is_default: true, is_dynamic: true }],
|
|
26
|
-
comment: 'string',
|
|
27
|
-
is_active: true,
|
|
28
|
-
is_deleted: false,
|
|
29
|
-
picture: null,
|
|
30
|
-
date_password_change: '2024-08-07T04:46:21+00:00',
|
|
31
|
-
authtype: 1,
|
|
32
|
-
last_login: '2026-03-06T12:16:33+00:00',
|
|
33
|
-
location: { id: 0 },
|
|
34
|
-
default_profile: { id: 1 },
|
|
35
|
-
default_entity: { id: 0, name: 'Entidade raiz' },
|
|
36
|
-
},
|
|
37
|
-
'Assets': {
|
|
38
|
-
name: 'Teste000000',
|
|
39
|
-
comment: '',
|
|
40
|
-
contact: 'Teste CONTACT',
|
|
41
|
-
contact_num: null,
|
|
42
|
-
serial: 'TESTE0001',
|
|
43
|
-
otherserial: null,
|
|
44
|
-
is_deleted: false,
|
|
45
|
-
status: { id: 1, name: 'ATIVO' },
|
|
46
|
-
location: { id: 1, name: 'YESHGRU' },
|
|
47
|
-
entity: { id: 0, name: 'Entidade raiz', completename: 'Entidade raiz' },
|
|
48
|
-
type: { id: 1, name: 'Notebook' },
|
|
49
|
-
manufacturer: { id: 87, name: 'Acer' },
|
|
50
|
-
model: { id: 4, name: 'TESTE' },
|
|
51
|
-
user: { id: 167, name: 'Teste' },
|
|
52
|
-
user_tech: null,
|
|
53
|
-
group: [],
|
|
54
|
-
group_tech: [],
|
|
55
|
-
network: { id: 1, name: 'Sala dos Leões GRU' },
|
|
56
|
-
autoupdatesystem: { id: 1, name: 'runrun.it Native Inventory' },
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
function isEmptyObject(obj) {
|
|
60
|
-
if (obj === null || obj === undefined)
|
|
61
|
-
return true;
|
|
62
|
-
if (typeof obj === 'object' && !Array.isArray(obj)) {
|
|
63
|
-
try {
|
|
64
|
-
return Object.keys(obj).length === 0;
|
|
65
|
-
}
|
|
66
|
-
catch {
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
function buildBaseUrl(host) {
|
|
73
|
-
let baseUrl = (host || '').trim();
|
|
74
|
-
if (baseUrl.length === 0)
|
|
75
|
-
return '';
|
|
76
|
-
if (!/^https?:\/\//i.test(baseUrl)) {
|
|
77
|
-
baseUrl = `https://${baseUrl}`;
|
|
78
|
-
}
|
|
79
|
-
try {
|
|
80
|
-
const originMatch = baseUrl.match(/^(https?:\/\/[^\/]+)/i);
|
|
81
|
-
const origin = originMatch ? originMatch[1] : '';
|
|
82
|
-
const apiMatch = baseUrl.match(/\/(?:apirest|api)\.php/i);
|
|
83
|
-
if (origin) {
|
|
84
|
-
if (apiMatch) {
|
|
85
|
-
return `${origin}${apiMatch[0]}`;
|
|
86
|
-
}
|
|
87
|
-
return `${origin}/api.php`;
|
|
88
|
-
}
|
|
89
|
-
baseUrl = baseUrl.replace(/\/apirest\.php\/?/i, '');
|
|
90
|
-
baseUrl = baseUrl.replace(/\/+$/g, '');
|
|
91
|
-
if (!baseUrl.endsWith('/api.php')) {
|
|
92
|
-
baseUrl = `${baseUrl}/api.php`;
|
|
93
|
-
}
|
|
94
|
-
return baseUrl;
|
|
95
|
-
}
|
|
96
|
-
catch (e) {
|
|
97
|
-
baseUrl = baseUrl.replace(/\/apirest\.php\/?/i, '');
|
|
98
|
-
baseUrl = baseUrl.replace(/\/+$/g, '');
|
|
99
|
-
if (!baseUrl.endsWith('/api.php')) {
|
|
100
|
-
baseUrl = `${baseUrl}/api.php`;
|
|
101
|
-
}
|
|
102
|
-
return baseUrl;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
async function getOAuthToken(baseUrl, clientId, clientSecret, username, password, scope, authorizationCode, redirectUri) {
|
|
106
|
-
try {
|
|
107
|
-
const body = authorizationCode
|
|
108
|
-
? {
|
|
109
|
-
grant_type: 'authorization_code',
|
|
110
|
-
client_id: clientId,
|
|
111
|
-
client_secret: clientSecret,
|
|
112
|
-
code: authorizationCode,
|
|
113
|
-
redirect_uri: redirectUri,
|
|
114
|
-
}
|
|
115
|
-
: {
|
|
116
|
-
grant_type: 'password',
|
|
117
|
-
client_id: clientId,
|
|
118
|
-
client_secret: clientSecret,
|
|
119
|
-
username,
|
|
120
|
-
password,
|
|
121
|
-
scope,
|
|
122
|
-
};
|
|
123
|
-
const response = await this.helpers.httpRequest({
|
|
124
|
-
method: 'POST',
|
|
125
|
-
url: `${baseUrl}/token`,
|
|
126
|
-
headers: {
|
|
127
|
-
'Content-Type': 'application/json',
|
|
128
|
-
},
|
|
129
|
-
body,
|
|
130
|
-
json: true,
|
|
131
|
-
});
|
|
132
|
-
const token = (response === null || response === void 0 ? void 0 : response.session_token) || (response === null || response === void 0 ? void 0 : response.access_token);
|
|
133
|
-
if (!token) {
|
|
134
|
-
throw new n8n_workflow_1.ApplicationError('Failed to login to runrun.it: session_token/access_token not found in response', {
|
|
135
|
-
level: 'warning',
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
return token;
|
|
139
|
-
}
|
|
140
|
-
catch (error) {
|
|
141
|
-
if (error && typeof error === 'object' && 'response' in error) {
|
|
142
|
-
const httpError = error;
|
|
143
|
-
throw new n8n_workflow_1.ApplicationError(`Failed to login to runrun.it: ${httpError.response.status} ${httpError.response.statusText}. Check your credentials and URL.`, { level: 'error' });
|
|
144
|
-
}
|
|
145
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
146
|
-
throw new n8n_workflow_1.ApplicationError(`Failed to login to runrun.it: ${errorMessage}`, { level: 'error' });
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
class RunrunIt {
|
|
150
|
-
constructor() {
|
|
151
|
-
this.description = {
|
|
152
|
-
displayName: 'runrun.it Rest API V2 (Fork)',
|
|
153
|
-
name: 'runrunItFork',
|
|
154
|
-
icon: 'file:runrunit_v2.svg',
|
|
155
|
-
group: ['transform'],
|
|
156
|
-
version: 1,
|
|
157
|
-
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
158
|
-
description: 'runrun.it REST API Node compatible with runrun.it.',
|
|
159
|
-
defaults: {
|
|
160
|
-
name: 'runrun.it Rest API V2',
|
|
161
|
-
},
|
|
162
|
-
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
163
|
-
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
164
|
-
usableAsTool: true,
|
|
165
|
-
credentials: [{ name: 'runrunItApi', required: true }],
|
|
166
|
-
properties: [
|
|
167
|
-
{
|
|
168
|
-
displayName: 'Resource',
|
|
169
|
-
name: 'resource',
|
|
170
|
-
type: 'options',
|
|
171
|
-
noDataExpression: true,
|
|
172
|
-
options: [
|
|
173
|
-
{ name: 'Administration', value: 'Administration' },
|
|
174
|
-
{ name: 'Components', value: 'Components' },
|
|
175
|
-
{ name: 'Dropdowns', value: 'Dropdowns' },
|
|
176
|
-
{ name: 'Management', value: 'Management' },
|
|
177
|
-
{ name: 'Project', value: 'Project' },
|
|
178
|
-
{ name: 'Rule', value: 'Rule' },
|
|
179
|
-
{ name: 'Session', value: 'Session' },
|
|
180
|
-
{ name: 'Assistance', value: 'Assistance' },
|
|
181
|
-
{ name: 'Assets', value: 'Assets' },
|
|
182
|
-
],
|
|
183
|
-
default: 'Assets',
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
displayName: 'Show Credentials Only',
|
|
187
|
-
name: 'showCredentials',
|
|
188
|
-
type: 'boolean',
|
|
189
|
-
default: false,
|
|
190
|
-
description: 'If enabled, the node will output the configured credentials and skip any API requests.',
|
|
191
|
-
},
|
|
192
|
-
...Administration_1.administrationDescription,
|
|
193
|
-
...Assistance_1.assistanceDescription,
|
|
194
|
-
...Assets_1.AssetsDescription,
|
|
195
|
-
...Components_1.componentsDescription,
|
|
196
|
-
...Dropdowns_1.dropdownsDescription,
|
|
197
|
-
...Management_1.managementDescription,
|
|
198
|
-
...Project_1.projectDescription,
|
|
199
|
-
...Rule_1.ruleDescription,
|
|
200
|
-
...Session_1.sessionDescription,
|
|
201
|
-
],
|
|
202
|
-
};
|
|
203
|
-
this.methods = {
|
|
204
|
-
loadOptions: {
|
|
205
|
-
async getEntities() {
|
|
206
|
-
const self = this;
|
|
207
|
-
const creds = await self.getCredentials('runrunItApi');
|
|
208
|
-
const baseUrl = buildBaseUrl(creds.host);
|
|
209
|
-
const token = await getOAuthToken.call(self, baseUrl, creds.clientId, creds.clientSecret, creds.username, creds.password, creds.scope || undefined, creds.useAuthorizationCode ? creds.authorizationCode : undefined, creds.redirectUri || undefined);
|
|
210
|
-
const response = await self.helpers.httpRequest({
|
|
211
|
-
method: 'GET',
|
|
212
|
-
url: `${baseUrl}/Administration/Entity`,
|
|
213
|
-
headers: { Authorization: `Bearer ${token}` },
|
|
214
|
-
json: true,
|
|
215
|
-
});
|
|
216
|
-
const list = Array.isArray(response) ? response : (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
217
|
-
return list.map((r) => ({ name: r.name || r.realname || r.label || `${r.id}`, value: r.id }));
|
|
218
|
-
},
|
|
219
|
-
async getProfiles() {
|
|
220
|
-
const self = this;
|
|
221
|
-
const creds = await self.getCredentials('runrunItApi');
|
|
222
|
-
const baseUrl = buildBaseUrl(creds.host);
|
|
223
|
-
const token = await getOAuthToken.call(self, baseUrl, creds.clientId, creds.clientSecret, creds.username, creds.password, creds.scope || undefined, creds.useAuthorizationCode ? creds.authorizationCode : undefined, creds.redirectUri || undefined);
|
|
224
|
-
const response = await self.helpers.httpRequest({
|
|
225
|
-
method: 'GET',
|
|
226
|
-
url: `${baseUrl}/Administration/Profile`,
|
|
227
|
-
headers: { Authorization: `Bearer ${token}` },
|
|
228
|
-
json: true,
|
|
229
|
-
});
|
|
230
|
-
const list = Array.isArray(response) ? response : (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
231
|
-
return list.map((r) => ({ name: r.name || r.label || `${r.id}`, value: r.id }));
|
|
232
|
-
},
|
|
233
|
-
async getGroups() {
|
|
234
|
-
const self = this;
|
|
235
|
-
const creds = await self.getCredentials('runrunItApi');
|
|
236
|
-
const baseUrl = buildBaseUrl(creds.host);
|
|
237
|
-
const token = await getOAuthToken.call(self, baseUrl, creds.clientId, creds.clientSecret, creds.username, creds.password, creds.scope || undefined, creds.useAuthorizationCode ? creds.authorizationCode : undefined, creds.redirectUri || undefined);
|
|
238
|
-
const response = await self.helpers.httpRequest({
|
|
239
|
-
method: 'GET',
|
|
240
|
-
url: `${baseUrl}/Administration/Group`,
|
|
241
|
-
headers: { Authorization: `Bearer ${token}` },
|
|
242
|
-
json: true,
|
|
243
|
-
});
|
|
244
|
-
const list = Array.isArray(response) ? response : (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
245
|
-
return list.map((r) => ({ name: r.name || r.realname || `${r.id}`, value: r.id }));
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
async execute() {
|
|
251
|
-
const items = this.getInputData();
|
|
252
|
-
const returnData = [];
|
|
253
|
-
const creds = await this.getCredentials('runrunItApi');
|
|
254
|
-
const baseUrl = buildBaseUrl(creds.host);
|
|
255
|
-
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
256
|
-
try {
|
|
257
|
-
const resource = this.getNodeParameter('resource', itemIndex);
|
|
258
|
-
const operation = this.getNodeParameter('operation', itemIndex);
|
|
259
|
-
let itemtype = this.getNodeParameter('itemtype', itemIndex) || '';
|
|
260
|
-
if (itemtype &&
|
|
261
|
-
(resource === 'Assets' ||
|
|
262
|
-
resource === 'Administration' ||
|
|
263
|
-
resource === 'Assistance' ||
|
|
264
|
-
resource === 'Components' ||
|
|
265
|
-
resource === 'Dropdowns') &&
|
|
266
|
-
!itemtype.includes('/')) {
|
|
267
|
-
itemtype = `${resource}/${itemtype}`;
|
|
268
|
-
}
|
|
269
|
-
const defaultSendRaw = (resource === 'Assets' || (resource === 'Administration' && itemtype.endsWith('/User')))
|
|
270
|
-
? true
|
|
271
|
-
: false;
|
|
272
|
-
let options;
|
|
273
|
-
let normalizedOperation = operation;
|
|
274
|
-
if (operation === 'getGroup' || operation === 'getProfile') {
|
|
275
|
-
normalizedOperation = 'get';
|
|
276
|
-
}
|
|
277
|
-
else if (operation === 'createGroup' || operation === 'createProfile') {
|
|
278
|
-
normalizedOperation = 'create';
|
|
279
|
-
}
|
|
280
|
-
else if (operation === 'updateGroup' || operation === 'updateProfile') {
|
|
281
|
-
normalizedOperation = 'update';
|
|
282
|
-
}
|
|
283
|
-
const returnAll = this.getNodeParameter('returnAll', itemIndex, true);
|
|
284
|
-
let token = '';
|
|
285
|
-
try {
|
|
286
|
-
token = await getOAuthToken.call(this, baseUrl, creds.clientId, creds.clientSecret, creds.username, creds.password, creds.scope || undefined, creds.useAuthorizationCode ? creds.authorizationCode : undefined, creds.redirectUri || undefined);
|
|
287
|
-
}
|
|
288
|
-
catch (err) {
|
|
289
|
-
if (this.continueOnFail()) {
|
|
290
|
-
returnData.push({
|
|
291
|
-
json: { error: err instanceof Error ? err.message : String(err) },
|
|
292
|
-
pairedItem: { item: itemIndex },
|
|
293
|
-
});
|
|
294
|
-
continue;
|
|
295
|
-
}
|
|
296
|
-
throw err;
|
|
297
|
-
}
|
|
298
|
-
const headers = {
|
|
299
|
-
Authorization: `Bearer ${token}`,
|
|
300
|
-
};
|
|
301
|
-
if (normalizedOperation === 'get') {
|
|
302
|
-
const id = this.getNodeParameter('itemid', itemIndex, '');
|
|
303
|
-
if (itemtype && !itemtype.includes('/'))
|
|
304
|
-
itemtype = `${resource}/${itemtype}`;
|
|
305
|
-
let url = '';
|
|
306
|
-
if (resource === 'Components') {
|
|
307
|
-
const componentType = itemtype.includes('/') ? itemtype.split('/')[1] : itemtype;
|
|
308
|
-
const endpoint = this.getNodeParameter('componentsEndpoint', itemIndex, 'definitions');
|
|
309
|
-
if (endpoint === 'instances') {
|
|
310
|
-
url = `${baseUrl}/Components/${componentType}/Items${id ? '/' + id : ''}`;
|
|
311
|
-
if (!id && returnAll === false) {
|
|
312
|
-
const params = [];
|
|
313
|
-
const limit = this.getNodeParameter('limit', itemIndex, 50);
|
|
314
|
-
params.push(`limit=${limit}`);
|
|
315
|
-
const definitionId = this.getNodeParameter('definitionId', itemIndex, 0);
|
|
316
|
-
if (definitionId)
|
|
317
|
-
params.push(`definition_id=${definitionId}`);
|
|
318
|
-
if (params.length)
|
|
319
|
-
url += (url.includes('?') ? '&' : '?') + params.join('&');
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
else {
|
|
323
|
-
url = `${baseUrl}/Components/${componentType}${id ? '/' + id : ''}`;
|
|
324
|
-
if (!id && returnAll === false) {
|
|
325
|
-
const params = [];
|
|
326
|
-
const limit = this.getNodeParameter('limit', itemIndex, 50);
|
|
327
|
-
params.push(`limit=${limit}`);
|
|
328
|
-
if (params.length)
|
|
329
|
-
url += (url.includes('?') ? '&' : '?') + params.join('&');
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
else {
|
|
334
|
-
url = `${baseUrl}/${itemtype}${id ? '/' + id : ''}`;
|
|
335
|
-
if (!id && returnAll === false) {
|
|
336
|
-
const params = [];
|
|
337
|
-
const limit = this.getNodeParameter('limit', itemIndex, 10);
|
|
338
|
-
params.push(`limit=${limit}`);
|
|
339
|
-
if (resource === 'Assets' || resource === 'Assistance' || resource === 'Administration') {
|
|
340
|
-
const filtersParam = this.getNodeParameter('filters', itemIndex, {});
|
|
341
|
-
const filterStr = (filtersParam && filtersParam.filter) || '';
|
|
342
|
-
if (filterStr) {
|
|
343
|
-
params.push(`filter=${encodeURIComponent(filterStr)}`);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
if (params.length) {
|
|
347
|
-
url += (url.includes('?') ? '&' : '?') + params.join('&');
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
if (resource === 'Assistance') {
|
|
352
|
-
const includeTimeline = this.getNodeParameter('includeTimeline', itemIndex, false);
|
|
353
|
-
if (includeTimeline) {
|
|
354
|
-
const timelineTypes = this.getNodeParameter('timelineTypes', itemIndex, []);
|
|
355
|
-
const timelineParams = ['with_timeline=1'];
|
|
356
|
-
if (Array.isArray(timelineTypes) && timelineTypes.length) {
|
|
357
|
-
timelineParams.push(`timeline_types=${timelineTypes.join(',')}`);
|
|
358
|
-
}
|
|
359
|
-
url += (url.includes('?') ? '&' : '?') + timelineParams.join('&');
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
options = {
|
|
363
|
-
method: 'GET',
|
|
364
|
-
url,
|
|
365
|
-
headers,
|
|
366
|
-
json: true,
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
else if (normalizedOperation === 'create') {
|
|
370
|
-
const input = {};
|
|
371
|
-
if (resource === 'Administration') {
|
|
372
|
-
if (itemtype.endsWith('/User')) {
|
|
373
|
-
const rawInputParam = this.getNodeParameter('input', itemIndex, {});
|
|
374
|
-
let rawInput = rawInputParam;
|
|
375
|
-
if (typeof rawInputParam === 'string') {
|
|
376
|
-
try {
|
|
377
|
-
rawInput = JSON.parse(rawInputParam);
|
|
378
|
-
}
|
|
379
|
-
catch (e) {
|
|
380
|
-
if (this.continueOnFail()) {
|
|
381
|
-
returnData.push({ json: { error: 'Invalid JSON in Input (raw)' }, pairedItem: { item: itemIndex } });
|
|
382
|
-
continue;
|
|
383
|
-
}
|
|
384
|
-
throw new n8n_workflow_1.ApplicationError('Invalid JSON in Input (raw)', { level: 'error' });
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
const sendRawBodyParam = this.getNodeParameter('sendRawBody', itemIndex, true);
|
|
388
|
-
if (isEmptyObject(rawInput)) {
|
|
389
|
-
if (sendRawBodyParam && DEFAULT_RAW_TEMPLATES['Administration/User']) {
|
|
390
|
-
rawInput = DEFAULT_RAW_TEMPLATES['Administration/User'];
|
|
391
|
-
}
|
|
392
|
-
else {
|
|
393
|
-
if (this.continueOnFail()) {
|
|
394
|
-
returnData.push({ json: { error: 'Input (raw) is required when creating Administration/User' }, pairedItem: { item: itemIndex } });
|
|
395
|
-
continue;
|
|
396
|
-
}
|
|
397
|
-
throw new n8n_workflow_1.ApplicationError('Input (raw) is required when creating Administration/User', { level: 'error' });
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
Object.assign(input, rawInput);
|
|
401
|
-
}
|
|
402
|
-
else if (itemtype.endsWith('/Group')) {
|
|
403
|
-
input.name = this.getNodeParameter('name', itemIndex);
|
|
404
|
-
input.is_requester = this.getNodeParameter('is_requester', itemIndex, true) ? 1 : 0;
|
|
405
|
-
input.is_watcher = this.getNodeParameter('is_watcher', itemIndex, true) ? 1 : 0;
|
|
406
|
-
input.is_notify = this.getNodeParameter('is_notify', itemIndex, true) ? 1 : 0;
|
|
407
|
-
input.is_usergroup = this.getNodeParameter('is_usergroup', itemIndex, true) ? 1 : 0;
|
|
408
|
-
const optionsParam = this.getNodeParameter('options', itemIndex, {});
|
|
409
|
-
if (optionsParam.code)
|
|
410
|
-
input.code = optionsParam.code;
|
|
411
|
-
if (optionsParam.recursive_membership !== undefined)
|
|
412
|
-
input.recursive_membership = optionsParam.recursive_membership ? 1 : 0;
|
|
413
|
-
if (optionsParam.groups_id)
|
|
414
|
-
input.groups_id = optionsParam.groups_id;
|
|
415
|
-
if (optionsParam.comment)
|
|
416
|
-
input.comment = optionsParam.comment;
|
|
417
|
-
if (optionsParam.is_manager !== undefined)
|
|
418
|
-
input.is_manager = optionsParam.is_manager ? 1 : 0;
|
|
419
|
-
if (optionsParam.is_assign !== undefined)
|
|
420
|
-
input.is_assign = optionsParam.is_assign ? 1 : 0;
|
|
421
|
-
if (optionsParam.is_task !== undefined)
|
|
422
|
-
input.is_task = optionsParam.is_task ? 1 : 0;
|
|
423
|
-
}
|
|
424
|
-
else {
|
|
425
|
-
Object.assign(input, this.getNodeParameter('input', itemIndex, {}));
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
else if (resource === 'Assets') {
|
|
429
|
-
const rawInputParam = this.getNodeParameter('input', itemIndex, {});
|
|
430
|
-
let rawInput = rawInputParam;
|
|
431
|
-
if (typeof rawInputParam === 'string') {
|
|
432
|
-
try {
|
|
433
|
-
rawInput = JSON.parse(rawInputParam);
|
|
434
|
-
}
|
|
435
|
-
catch (e) {
|
|
436
|
-
if (this.continueOnFail()) {
|
|
437
|
-
returnData.push({ json: { error: 'Invalid JSON in Input (raw)' }, pairedItem: { item: itemIndex } });
|
|
438
|
-
continue;
|
|
439
|
-
}
|
|
440
|
-
throw new n8n_workflow_1.ApplicationError('Invalid JSON in Input (raw)', { level: 'error' });
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
const sendRawBodyParamAssets = this.getNodeParameter('sendRawBody', itemIndex, true);
|
|
444
|
-
if (isEmptyObject(rawInput)) {
|
|
445
|
-
if (sendRawBodyParamAssets && DEFAULT_RAW_TEMPLATES['Assets']) {
|
|
446
|
-
rawInput = DEFAULT_RAW_TEMPLATES['Assets'];
|
|
447
|
-
}
|
|
448
|
-
else {
|
|
449
|
-
if (this.continueOnFail()) {
|
|
450
|
-
returnData.push({ json: { error: 'Input (raw) is required when creating Assets' }, pairedItem: { item: itemIndex } });
|
|
451
|
-
continue;
|
|
452
|
-
}
|
|
453
|
-
throw new n8n_workflow_1.ApplicationError('Input (raw) is required when creating Assets', { level: 'error' });
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
Object.assign(input, rawInput);
|
|
457
|
-
}
|
|
458
|
-
else if (resource === 'Assistance') {
|
|
459
|
-
input.name = this.getNodeParameter('title', itemIndex);
|
|
460
|
-
input.content = this.getNodeParameter('description', itemIndex);
|
|
461
|
-
input.status = this.getNodeParameter('status', itemIndex, 0);
|
|
462
|
-
const optionsParam = this.getNodeParameter('options', itemIndex, {});
|
|
463
|
-
if (optionsParam.itilcategories_id)
|
|
464
|
-
input.itilcategories_id = optionsParam.itilcategories_id;
|
|
465
|
-
if (optionsParam.users_id_observer)
|
|
466
|
-
input._users_id_observer = optionsParam.users_id_observer;
|
|
467
|
-
const requester = this.getNodeParameter('users_id_requester', itemIndex, '');
|
|
468
|
-
if (requester)
|
|
469
|
-
input._users_id_requester = requester;
|
|
470
|
-
const assign = this.getNodeParameter('users_id_assign', itemIndex, 0);
|
|
471
|
-
if (assign)
|
|
472
|
-
input._users_id_assign = assign;
|
|
473
|
-
}
|
|
474
|
-
else if (resource === 'Components') {
|
|
475
|
-
const componentType = itemtype.includes('/') ? itemtype.split('/')[1] : itemtype;
|
|
476
|
-
const createInstance = this.getNodeParameter('createInstance', itemIndex, false);
|
|
477
|
-
if (createInstance) {
|
|
478
|
-
const definitionId = this.getNodeParameter('definitionId', itemIndex, 0);
|
|
479
|
-
if (!definitionId) {
|
|
480
|
-
if (this.continueOnFail()) {
|
|
481
|
-
returnData.push({ json: { error: 'definitionId is required when creating an instance' }, pairedItem: { item: itemIndex } });
|
|
482
|
-
continue;
|
|
483
|
-
}
|
|
484
|
-
throw new n8n_workflow_1.ApplicationError('definitionId is required when creating an instance', { level: 'error' });
|
|
485
|
-
}
|
|
486
|
-
input.name = this.getNodeParameter('title', itemIndex, '');
|
|
487
|
-
if (!input.name)
|
|
488
|
-
input.name = `Instance of ${componentType}`;
|
|
489
|
-
options = {
|
|
490
|
-
method: 'POST',
|
|
491
|
-
url: `${baseUrl}/Components/${componentType}/Items`,
|
|
492
|
-
headers,
|
|
493
|
-
body: { input },
|
|
494
|
-
json: true,
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
|
-
else {
|
|
498
|
-
input.name = this.getNodeParameter('title', itemIndex);
|
|
499
|
-
options = {
|
|
500
|
-
method: 'POST',
|
|
501
|
-
url: `${baseUrl}/Components/${componentType}`,
|
|
502
|
-
headers,
|
|
503
|
-
body: { input },
|
|
504
|
-
json: true,
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
else {
|
|
509
|
-
Object.assign(input, this.getNodeParameter('input', itemIndex, {}));
|
|
510
|
-
}
|
|
511
|
-
if (!options) {
|
|
512
|
-
const rawInputParam = this.getNodeParameter('input', itemIndex, {});
|
|
513
|
-
let rawInput = rawInputParam;
|
|
514
|
-
if (typeof rawInputParam === 'string') {
|
|
515
|
-
try {
|
|
516
|
-
rawInput = JSON.parse(rawInputParam);
|
|
517
|
-
}
|
|
518
|
-
catch (e) {
|
|
519
|
-
if (this.continueOnFail()) {
|
|
520
|
-
returnData.push({ json: { error: 'Invalid JSON in Input (raw)' }, pairedItem: { item: itemIndex } });
|
|
521
|
-
continue;
|
|
522
|
-
}
|
|
523
|
-
throw new n8n_workflow_1.ApplicationError('Invalid JSON in Input (raw)', { level: 'error' });
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
const sendRawBody = this.getNodeParameter('sendRawBody', itemIndex, defaultSendRaw);
|
|
527
|
-
if (sendRawBody && isEmptyObject(rawInput)) {
|
|
528
|
-
if (resource === 'Administration' && itemtype.endsWith('/User')) {
|
|
529
|
-
rawInput = DEFAULT_RAW_TEMPLATES['Administration/User'];
|
|
530
|
-
}
|
|
531
|
-
else if (resource === 'Assets') {
|
|
532
|
-
rawInput = DEFAULT_RAW_TEMPLATES['Assets'];
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
const bodyToSend = sendRawBody && !isEmptyObject(rawInput) ? rawInput : { input };
|
|
536
|
-
options = {
|
|
537
|
-
method: 'POST',
|
|
538
|
-
url: `${baseUrl}/${itemtype}`,
|
|
539
|
-
headers,
|
|
540
|
-
body: bodyToSend,
|
|
541
|
-
json: true,
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
else if (normalizedOperation === 'update') {
|
|
546
|
-
const id = this.getNodeParameter('itemid', itemIndex);
|
|
547
|
-
const idValueUpd = id;
|
|
548
|
-
const idNumUpd = typeof idValueUpd === 'string' ? (idValueUpd === '' ? NaN : Number(idValueUpd)) : Number(idValueUpd);
|
|
549
|
-
if (!idValueUpd || Number.isNaN(idNumUpd) || idNumUpd === 0) {
|
|
550
|
-
if (this.continueOnFail()) {
|
|
551
|
-
returnData.push({ json: { error: 'Item ID (itemid) is required and must be a positive number for update operations' }, pairedItem: { item: itemIndex } });
|
|
552
|
-
continue;
|
|
553
|
-
}
|
|
554
|
-
throw new n8n_workflow_1.ApplicationError('Item ID (itemid) is required and must be a positive number for update operations', { level: 'error' });
|
|
555
|
-
}
|
|
556
|
-
const input = {};
|
|
557
|
-
if (resource === 'Administration') {
|
|
558
|
-
if (itemtype.endsWith('/Group')) {
|
|
559
|
-
const name = this.getNodeParameter('name', itemIndex, '');
|
|
560
|
-
if (name)
|
|
561
|
-
input.name = name;
|
|
562
|
-
const isRequester = this.getNodeParameter('is_requester', itemIndex, undefined);
|
|
563
|
-
if (isRequester !== undefined)
|
|
564
|
-
input.is_requester = isRequester ? 1 : 0;
|
|
565
|
-
const isWatcher = this.getNodeParameter('is_watcher', itemIndex, undefined);
|
|
566
|
-
if (isWatcher !== undefined)
|
|
567
|
-
input.is_watcher = isWatcher ? 1 : 0;
|
|
568
|
-
const isNotify = this.getNodeParameter('is_notify', itemIndex, undefined);
|
|
569
|
-
if (isNotify !== undefined)
|
|
570
|
-
input.is_notify = isNotify ? 1 : 0;
|
|
571
|
-
const isUsergroup = this.getNodeParameter('is_usergroup', itemIndex, undefined);
|
|
572
|
-
if (isUsergroup !== undefined)
|
|
573
|
-
input.is_usergroup = isUsergroup ? 1 : 0;
|
|
574
|
-
const optionsParam = this.getNodeParameter('options', itemIndex, {});
|
|
575
|
-
if (optionsParam.code)
|
|
576
|
-
input.code = optionsParam.code;
|
|
577
|
-
if (optionsParam.recursive_membership !== undefined)
|
|
578
|
-
input.recursive_membership = optionsParam.recursive_membership ? 1 : 0;
|
|
579
|
-
if (optionsParam.groups_id)
|
|
580
|
-
input.groups_id = optionsParam.groups_id;
|
|
581
|
-
if (optionsParam.comment)
|
|
582
|
-
input.comment = optionsParam.comment;
|
|
583
|
-
if (optionsParam.is_manager !== undefined)
|
|
584
|
-
input.is_manager = optionsParam.is_manager ? 1 : 0;
|
|
585
|
-
if (optionsParam.is_assign !== undefined)
|
|
586
|
-
input.is_assign = optionsParam.is_assign ? 1 : 0;
|
|
587
|
-
if (optionsParam.is_task !== undefined)
|
|
588
|
-
input.is_task = optionsParam.is_task ? 1 : 0;
|
|
589
|
-
}
|
|
590
|
-
else {
|
|
591
|
-
Object.assign(input, this.getNodeParameter('input', itemIndex, {}));
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
else if (resource === 'Assistance') {
|
|
595
|
-
const title = this.getNodeParameter('title', itemIndex, '');
|
|
596
|
-
if (title)
|
|
597
|
-
input.name = title;
|
|
598
|
-
const description = this.getNodeParameter('description', itemIndex, '');
|
|
599
|
-
if (description)
|
|
600
|
-
input.content = description;
|
|
601
|
-
const status = this.getNodeParameter('status', itemIndex, 0);
|
|
602
|
-
if (status)
|
|
603
|
-
input.status = status;
|
|
604
|
-
const optionsParam = this.getNodeParameter('options', itemIndex, {});
|
|
605
|
-
if (optionsParam.itilcategories_id)
|
|
606
|
-
input.itilcategories_id = optionsParam.itilcategories_id;
|
|
607
|
-
if (optionsParam.users_id_observer)
|
|
608
|
-
input._users_id_observer = optionsParam.users_id_observer;
|
|
609
|
-
const requester = this.getNodeParameter('users_id_requester', itemIndex, '');
|
|
610
|
-
if (requester)
|
|
611
|
-
input._users_id_requester = requester;
|
|
612
|
-
const assign = this.getNodeParameter('users_id_assign', itemIndex, 0);
|
|
613
|
-
if (assign)
|
|
614
|
-
input._users_id_assign = assign;
|
|
615
|
-
}
|
|
616
|
-
else {
|
|
617
|
-
Object.assign(input, this.getNodeParameter('input', itemIndex, {}));
|
|
618
|
-
}
|
|
619
|
-
if (resource === 'Components') {
|
|
620
|
-
const componentType = itemtype.includes('/') ? itemtype.split('/')[1] : itemtype;
|
|
621
|
-
const endpoint = this.getNodeParameter('componentsEndpoint', itemIndex, 'definitions');
|
|
622
|
-
const url = endpoint === 'instances' ? `${baseUrl}/Components/${componentType}/Items/${id}` : `${baseUrl}/Components/${componentType}/${id}`;
|
|
623
|
-
const rawInputParam = this.getNodeParameter('input', itemIndex, {});
|
|
624
|
-
let rawInput = rawInputParam;
|
|
625
|
-
if (typeof rawInputParam === 'string') {
|
|
626
|
-
try {
|
|
627
|
-
rawInput = JSON.parse(rawInputParam);
|
|
628
|
-
}
|
|
629
|
-
catch (e) {
|
|
630
|
-
if (this.continueOnFail()) {
|
|
631
|
-
returnData.push({ json: { error: 'Invalid JSON in Input (raw)' }, pairedItem: { item: itemIndex } });
|
|
632
|
-
continue;
|
|
633
|
-
}
|
|
634
|
-
throw new n8n_workflow_1.ApplicationError('Invalid JSON in Input (raw)', { level: 'error' });
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
const sendRawBody = this.getNodeParameter('sendRawBody', itemIndex, defaultSendRaw);
|
|
638
|
-
if (sendRawBody && isEmptyObject(rawInput)) {
|
|
639
|
-
}
|
|
640
|
-
const bodyToSend = sendRawBody && !isEmptyObject(rawInput) ? rawInput : { input };
|
|
641
|
-
options = {
|
|
642
|
-
method: 'PUT',
|
|
643
|
-
url,
|
|
644
|
-
headers,
|
|
645
|
-
body: bodyToSend,
|
|
646
|
-
json: true,
|
|
647
|
-
};
|
|
648
|
-
}
|
|
649
|
-
else {
|
|
650
|
-
const rawInputParam = this.getNodeParameter('input', itemIndex, {});
|
|
651
|
-
let rawInput = rawInputParam;
|
|
652
|
-
if (typeof rawInputParam === 'string') {
|
|
653
|
-
try {
|
|
654
|
-
rawInput = JSON.parse(rawInputParam);
|
|
655
|
-
}
|
|
656
|
-
catch (e) {
|
|
657
|
-
if (this.continueOnFail()) {
|
|
658
|
-
returnData.push({ json: { error: 'Invalid JSON in Input (raw)' }, pairedItem: { item: itemIndex } });
|
|
659
|
-
continue;
|
|
660
|
-
}
|
|
661
|
-
throw new n8n_workflow_1.ApplicationError('Invalid JSON in Input (raw)', { level: 'error' });
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
const sendRawBody = this.getNodeParameter('sendRawBody', itemIndex, false);
|
|
665
|
-
if (sendRawBody && isEmptyObject(rawInput)) {
|
|
666
|
-
if (resource === 'Administration' && itemtype.endsWith('/User')) {
|
|
667
|
-
rawInput = DEFAULT_RAW_TEMPLATES['Administration/User'];
|
|
668
|
-
}
|
|
669
|
-
else if (resource === 'Assets') {
|
|
670
|
-
rawInput = DEFAULT_RAW_TEMPLATES['Assets'];
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
const bodyToSend = sendRawBody && !isEmptyObject(rawInput) ? rawInput : { input };
|
|
674
|
-
options = {
|
|
675
|
-
method: (resource === 'Assets' || resource === 'Administration' ? 'PATCH' : 'PUT'),
|
|
676
|
-
url: `${baseUrl}/${itemtype}/${id}`,
|
|
677
|
-
headers,
|
|
678
|
-
body: bodyToSend,
|
|
679
|
-
json: true,
|
|
680
|
-
};
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
else if (operation === 'delete') {
|
|
684
|
-
const id = this.getNodeParameter('itemid', itemIndex);
|
|
685
|
-
const idValueDel = id;
|
|
686
|
-
const idNumDel = typeof idValueDel === 'string' ? (idValueDel === '' ? NaN : Number(idValueDel)) : Number(idValueDel);
|
|
687
|
-
if (!idValueDel || Number.isNaN(idNumDel) || idNumDel === 0) {
|
|
688
|
-
if (this.continueOnFail()) {
|
|
689
|
-
returnData.push({ json: { error: 'Item ID (itemid) is required and must be a positive number for delete operations' }, pairedItem: { item: itemIndex } });
|
|
690
|
-
continue;
|
|
691
|
-
}
|
|
692
|
-
throw new n8n_workflow_1.ApplicationError('Item ID (itemid) is required and must be a positive number for delete operations', { level: 'error' });
|
|
693
|
-
}
|
|
694
|
-
if (resource === 'Components') {
|
|
695
|
-
const componentType = itemtype.includes('/') ? itemtype.split('/')[1] : itemtype;
|
|
696
|
-
const endpoint = this.getNodeParameter('componentsEndpoint', itemIndex, 'definitions');
|
|
697
|
-
const url = endpoint === 'instances' ? `${baseUrl}/Components/${componentType}/Items/${id}` : `${baseUrl}/Components/${componentType}/${id}`;
|
|
698
|
-
options = {
|
|
699
|
-
method: 'DELETE',
|
|
700
|
-
url,
|
|
701
|
-
headers,
|
|
702
|
-
json: true,
|
|
703
|
-
};
|
|
704
|
-
}
|
|
705
|
-
else {
|
|
706
|
-
if (itemtype && !itemtype.includes('/'))
|
|
707
|
-
itemtype = `${resource}/${itemtype}`;
|
|
708
|
-
options = {
|
|
709
|
-
method: 'DELETE',
|
|
710
|
-
url: `${baseUrl}/${itemtype}/${id}`,
|
|
711
|
-
headers,
|
|
712
|
-
json: true,
|
|
713
|
-
};
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
else {
|
|
717
|
-
throw new n8n_workflow_1.ApplicationError(`Unknown operation: ${operation}`, { level: 'warning' });
|
|
718
|
-
}
|
|
719
|
-
const showCredentials = this.getNodeParameter('showCredentials', itemIndex, false);
|
|
720
|
-
if (options && options.body !== undefined) {
|
|
721
|
-
options.headers = {
|
|
722
|
-
...(options.headers || {}),
|
|
723
|
-
'Content-Type': 'application/json',
|
|
724
|
-
};
|
|
725
|
-
}
|
|
726
|
-
if (showCredentials) {
|
|
727
|
-
returnData.push({
|
|
728
|
-
json: {
|
|
729
|
-
host: creds.host,
|
|
730
|
-
baseUrl,
|
|
731
|
-
clientId: creds.clientId,
|
|
732
|
-
clientSecret: creds.clientSecret,
|
|
733
|
-
username: creds.username,
|
|
734
|
-
password: creds.password,
|
|
735
|
-
scope: creds.scope,
|
|
736
|
-
},
|
|
737
|
-
pairedItem: { item: itemIndex },
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
else {
|
|
741
|
-
const response = await this.helpers.httpRequest(options);
|
|
742
|
-
if (Array.isArray(response)) {
|
|
743
|
-
let outputArray = response;
|
|
744
|
-
if (returnAll === false) {
|
|
745
|
-
const limit = this.getNodeParameter('limit', itemIndex, 10);
|
|
746
|
-
outputArray = outputArray.slice(0, limit);
|
|
747
|
-
}
|
|
748
|
-
for (const resItem of outputArray) {
|
|
749
|
-
returnData.push({
|
|
750
|
-
json: resItem,
|
|
751
|
-
pairedItem: { item: itemIndex },
|
|
752
|
-
});
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
else {
|
|
756
|
-
returnData.push({
|
|
757
|
-
json: response,
|
|
758
|
-
pairedItem: { item: itemIndex },
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
catch (error) {
|
|
764
|
-
if (this.continueOnFail()) {
|
|
765
|
-
returnData.push({
|
|
766
|
-
json: { error: error instanceof Error ? error.message : String(error) },
|
|
767
|
-
pairedItem: { item: itemIndex },
|
|
768
|
-
});
|
|
769
|
-
}
|
|
770
|
-
else {
|
|
771
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex });
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
return returnData.length ? [returnData] : [];
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
exports.RunrunIt = RunrunIt;
|
|
779
|
-
//# sourceMappingURL=RunrunIt.node.js.map
|