@couleetech/n8n-nodes-enlightenedmsp 1.7.4 → 1.9.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.
@@ -0,0 +1,15 @@
1
+ import { GraphqlBase } from './GraphqlBase';
2
+ declare class CreateTodoGraphql extends GraphqlBase {
3
+ createTodo(variables: {
4
+ title?: string;
5
+ description?: string;
6
+ dueDate?: Date;
7
+ ticketBlocking?: boolean;
8
+ autotaskTicketId?: number;
9
+ isOnsite?: boolean;
10
+ estimatedMinutes?: number;
11
+ createdByModuleName?: string;
12
+ createdByModuleId?: string;
13
+ }): Promise<any>;
14
+ }
15
+ export { CreateTodoGraphql };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateTodoGraphql = void 0;
4
+ const GraphqlBase_1 = require("./GraphqlBase");
5
+ class CreateTodoGraphql extends GraphqlBase_1.GraphqlBase {
6
+ async createTodo(variables) {
7
+ const query = `
8
+ mutation CreateTodo(
9
+ $title: String
10
+ $description: String
11
+ $dueDate: Date
12
+ $ticketBlocking: Boolean
13
+ $autotaskTicketId: Float
14
+ $isOnsite: Boolean
15
+ $estimatedMinutes: Float
16
+ $createdByModuleName: String
17
+ $createdByModuleId: String
18
+ ) {
19
+ createTodosTodo(
20
+ title: $title
21
+ description: $description
22
+ dueDate: $dueDate
23
+ ticketBlocking: $ticketBlocking
24
+ autotaskTicketId: $autotaskTicketId
25
+ isOnsite: $isOnsite
26
+ estimatedMinutes: $estimatedMinutes
27
+ createdByModuleName: $createdByModuleName
28
+ createdByModuleId: $createdByModuleId
29
+ ) {
30
+ id
31
+ title
32
+ description
33
+ dueDate
34
+ ticketBlocking
35
+ autotaskTicketId
36
+ isOnsite
37
+ estimatedMinutes
38
+ createdByModuleName
39
+ createdByModuleId
40
+ createdAt
41
+ }
42
+ }
43
+ `;
44
+ return this.executeGraphql(query, variables);
45
+ }
46
+ }
47
+ exports.CreateTodoGraphql = CreateTodoGraphql;
@@ -0,0 +1,5 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class CreateTodo implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateTodo = void 0;
4
+ const CreateTodo_graphql_1 = require("./CreateTodo.graphql");
5
+ const GraphqlBase_1 = require("./GraphqlBase");
6
+ class CreateTodo {
7
+ constructor() {
8
+ this.description = {
9
+ displayName: 'Create Todo',
10
+ name: 'createTodo',
11
+ icon: 'file:enlightenedmsp.svg',
12
+ group: ['transform'],
13
+ version: 1,
14
+ description: 'Create a new todo in EnlightenedMSP',
15
+ defaults: {
16
+ name: 'Create Todo',
17
+ },
18
+ inputs: ["main"],
19
+ outputs: ["main"],
20
+ credentials: [
21
+ {
22
+ name: 'enlightenedMspGraphql',
23
+ required: true,
24
+ },
25
+ ],
26
+ properties: [
27
+ {
28
+ displayName: 'Title',
29
+ name: 'title',
30
+ type: 'string',
31
+ default: '',
32
+ required: true,
33
+ description: 'Title of the todo',
34
+ },
35
+ {
36
+ displayName: 'Description',
37
+ name: 'description',
38
+ type: 'string',
39
+ typeOptions: {
40
+ rows: 4,
41
+ },
42
+ default: '',
43
+ description: 'Description of the todo',
44
+ },
45
+ {
46
+ displayName: 'Due Date',
47
+ name: 'dueDate',
48
+ type: 'dateTime',
49
+ default: '',
50
+ description: 'Due date for the todo',
51
+ },
52
+ {
53
+ displayName: 'Ticket Blocking',
54
+ name: 'ticketBlocking',
55
+ type: 'boolean',
56
+ default: false,
57
+ description: 'Whether this todo blocks the ticket',
58
+ },
59
+ {
60
+ displayName: 'Autotask Ticket ID',
61
+ name: 'autotaskTicketId',
62
+ type: 'number',
63
+ default: 0,
64
+ description: 'ID of the associated Autotask ticket',
65
+ },
66
+ {
67
+ displayName: 'Is Onsite',
68
+ name: 'isOnsite',
69
+ type: 'boolean',
70
+ default: false,
71
+ description: 'Whether this todo requires onsite work',
72
+ },
73
+ {
74
+ displayName: 'Estimated Minutes',
75
+ name: 'estimatedMinutes',
76
+ type: 'number',
77
+ default: 0,
78
+ description: 'Estimated time to complete in minutes',
79
+ },
80
+ ],
81
+ };
82
+ }
83
+ async execute() {
84
+ const items = this.getInputData();
85
+ const returnData = [];
86
+ const length = items.length;
87
+ const { endpoint, apiKey } = await GraphqlBase_1.GraphqlBase.getCredentials(this);
88
+ const createTodoGraphql = new CreateTodo_graphql_1.CreateTodoGraphql(endpoint, apiKey);
89
+ for (let i = 0; i < length; i++) {
90
+ try {
91
+ const title = this.getNodeParameter('title', i);
92
+ const description = this.getNodeParameter('description', i);
93
+ const dueDate = this.getNodeParameter('dueDate', i);
94
+ const ticketBlocking = this.getNodeParameter('ticketBlocking', i);
95
+ const autotaskTicketId = this.getNodeParameter('autotaskTicketId', i);
96
+ const isOnsite = this.getNodeParameter('isOnsite', i);
97
+ const estimatedMinutes = this.getNodeParameter('estimatedMinutes', i);
98
+ const variables = {
99
+ title,
100
+ description,
101
+ dueDate: dueDate ? new Date(dueDate) : undefined,
102
+ ticketBlocking,
103
+ autotaskTicketId: autotaskTicketId || undefined,
104
+ isOnsite,
105
+ estimatedMinutes: estimatedMinutes || undefined,
106
+ createdByModuleName: 'N8N_WORKFLOW',
107
+ createdByModuleId: `${this.getNode().id}`,
108
+ };
109
+ const result = await createTodoGraphql.createTodo(variables);
110
+ returnData.push({
111
+ json: result.createTodosTodo,
112
+ });
113
+ }
114
+ catch (error) {
115
+ if (this.continueOnFail()) {
116
+ returnData.push({
117
+ json: {
118
+ error: error.message,
119
+ },
120
+ });
121
+ continue;
122
+ }
123
+ throw error;
124
+ }
125
+ }
126
+ return [returnData];
127
+ }
128
+ }
129
+ exports.CreateTodo = CreateTodo;
@@ -299,40 +299,36 @@ class SearchCoreCompanies {
299
299
  }
300
300
  const result = await graphqlClient.searchCompanies(variables);
301
301
  const response = result.data.findCoreCompaniesPaginated;
302
- const outputItem = {
302
+ returnData.push({
303
303
  json: {
304
304
  data: response.data,
305
305
  totalCount: response.totalCount,
306
306
  page: response.page,
307
307
  limit: response.limit
308
308
  },
309
- };
310
- returnData.push(outputItem);
311
- const aiToolOutput = {
312
- json: {
313
- companies: response.data,
314
- totalCount: response.totalCount,
315
- page: response.page,
316
- limit: response.limit
317
- },
318
- };
319
- void this.addOutputData("ai_tool", i, [[aiToolOutput]]);
309
+ });
320
310
  }
321
311
  catch (error) {
322
312
  if (this.continueOnFail()) {
323
- const errorOutput = {
313
+ returnData.push({
324
314
  json: {
325
315
  error: error.message,
326
316
  },
327
- };
328
- returnData.push(errorOutput);
329
- void this.addOutputData("ai_tool", i, [[errorOutput]]);
317
+ });
330
318
  continue;
331
319
  }
332
320
  throw error;
333
321
  }
334
322
  }
335
- return [returnData];
323
+ const aiToolData = returnData.map(item => ({
324
+ json: {
325
+ companies: item.json.data,
326
+ totalCount: item.json.totalCount,
327
+ page: item.json.page,
328
+ limit: item.json.limit,
329
+ },
330
+ }));
331
+ return [returnData, aiToolData];
336
332
  }
337
333
  }
338
334
  exports.SearchCoreCompanies = SearchCoreCompanies;
@@ -269,35 +269,31 @@ deviceClass`,
269
269
  Object.assign(variables, filters);
270
270
  }
271
271
  const result = await graphqlClient.searchDevices(variables);
272
- const outputItem = {
272
+ returnData.push({
273
273
  json: result.findDattormmDevicesPaginated,
274
- };
275
- returnData.push(outputItem);
276
- const aiToolOutput = {
277
- json: {
278
- devices: result.findDattormmDevicesPaginated.data,
279
- totalCount: result.findDattormmDevicesPaginated.totalCount,
280
- page: result.findDattormmDevicesPaginated.page,
281
- limit: result.findDattormmDevicesPaginated.limit,
282
- },
283
- };
284
- void this.addOutputData("ai_tool", i, [[aiToolOutput]]);
274
+ });
285
275
  }
286
276
  catch (error) {
287
277
  if (this.continueOnFail()) {
288
- const errorOutput = {
278
+ returnData.push({
289
279
  json: {
290
280
  error: error.message,
291
281
  },
292
- };
293
- returnData.push(errorOutput);
294
- void this.addOutputData("ai_tool", i, [[errorOutput]]);
282
+ });
295
283
  continue;
296
284
  }
297
285
  throw error;
298
286
  }
299
287
  }
300
- return [returnData];
288
+ const aiToolData = returnData.map(item => ({
289
+ json: {
290
+ devices: item.json.data,
291
+ totalCount: item.json.totalCount,
292
+ page: item.json.page,
293
+ limit: item.json.limit,
294
+ },
295
+ }));
296
+ return [returnData, aiToolData];
301
297
  }
302
298
  }
303
299
  exports.SearchDattormmDevices = SearchDattormmDevices;
@@ -468,35 +468,31 @@ description`,
468
468
  };
469
469
  }
470
470
  const result = await searchTicketGraphql.searchTickets(variables);
471
- const outputItem = {
471
+ returnData.push({
472
472
  json: result.findAutotaskTicketsPaginated,
473
- };
474
- returnData.push(outputItem);
475
- const aiToolOutput = {
476
- json: {
477
- tickets: result.findAutotaskTicketsPaginated.data,
478
- totalCount: result.findAutotaskTicketsPaginated.totalCount,
479
- page: result.findAutotaskTicketsPaginated.page,
480
- limit: result.findAutotaskTicketsPaginated.limit,
481
- },
482
- };
483
- void this.addOutputData("ai_tool", i, [[aiToolOutput]]);
473
+ });
484
474
  }
485
475
  catch (error) {
486
476
  if (this.continueOnFail()) {
487
- const errorOutput = {
477
+ returnData.push({
488
478
  json: {
489
479
  error: error.message,
490
480
  },
491
- };
492
- returnData.push(errorOutput);
493
- void this.addOutputData("ai_tool", i, [[errorOutput]]);
481
+ });
494
482
  continue;
495
483
  }
496
484
  throw error;
497
485
  }
498
486
  }
499
- return [returnData];
487
+ const aiToolData = returnData.map(item => ({
488
+ json: {
489
+ tickets: item.json.data,
490
+ totalCount: item.json.totalCount,
491
+ page: item.json.page,
492
+ limit: item.json.limit,
493
+ },
494
+ }));
495
+ return [returnData, aiToolData];
500
496
  }
501
497
  }
502
498
  exports.SearchTicket = SearchTicket;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@couleetech/n8n-nodes-enlightenedmsp",
3
- "version": "1.7.4",
3
+ "version": "1.9.0",
4
4
  "description": "n8n node for EnlightenedMSP ticketing and workflow automation",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",