@couleetech/n8n-nodes-enlightenedmsp 0.0.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/credentials/EnlightenedMspGraphql.credentials.d.ts +8 -0
  2. package/dist/credentials/EnlightenedMspGraphql.credentials.js +40 -0
  3. package/dist/nodes/EnlightenedMsp/GraphqlBase.d.ts +13 -0
  4. package/dist/nodes/EnlightenedMsp/GraphqlBase.js +50 -0
  5. package/dist/nodes/EnlightenedMsp/{McpClient.node.d.ts → UpdateTicket.node.d.ts} +1 -1
  6. package/dist/nodes/EnlightenedMsp/UpdateTicket.node.js +135 -0
  7. package/dist/nodes/EnlightenedMsp/enlightenedmsp.svg +490 -0
  8. package/dist/nodes/EnlightenedMsp/index.d.ts +2 -1
  9. package/dist/nodes/EnlightenedMsp/index.js +3 -1
  10. package/package.json +5 -3
  11. package/dist/credentials/BraveSearchApi.credentials.d.ts +0 -9
  12. package/dist/credentials/BraveSearchApi.credentials.js +0 -47
  13. package/dist/credentials/BraveSearchApi.credentials.js.map +0 -1
  14. package/dist/credentials/McpClientApi.credentials.d.ts +0 -7
  15. package/dist/credentials/McpClientApi.credentials.js +0 -29
  16. package/dist/nodes/BraveSearch/BraveSearch.node.d.ts +0 -5
  17. package/dist/nodes/BraveSearch/BraveSearch.node.js +0 -213
  18. package/dist/nodes/BraveSearch/BraveSearch.node.js.map +0 -1
  19. package/dist/nodes/BraveSearch/brave-logo-sans-text.svg +0 -1
  20. package/dist/nodes/BraveSearch/types.d.ts +0 -21
  21. package/dist/nodes/BraveSearch/types.js +0 -2
  22. package/dist/nodes/BraveSearch/types.js.map +0 -1
  23. package/dist/nodes/BraveSearchTool/BraveSearchTool.node.d.ts +0 -7
  24. package/dist/nodes/BraveSearchTool/BraveSearchTool.node.js +0 -208
  25. package/dist/nodes/BraveSearchTool/brave-logo-sans-text.svg +0 -1
  26. package/dist/nodes/EnlightenedMsp/McpClient.node.js +0 -95
  27. package/dist/nodes/EnlightenedMsp/mcpClient.svg +0 -7
  28. package/dist/nodes/McpClient/McpClient.node.d.ts +0 -5
  29. package/dist/nodes/McpClient/McpClient.node.js +0 -95
  30. package/dist/nodes/McpClient/mcpClient.svg +0 -7
  31. package/dist/nodes/NpmSearch/NpmSearch.node.d.ts +0 -5
  32. package/dist/nodes/NpmSearch/NpmSearch.node.js +0 -94
  33. package/dist/nodes/NpmSearch/npm.svg +0 -5
@@ -0,0 +1,8 @@
1
+ import { IAuthenticateGeneric, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class EnlightenedMspGraphql implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnlightenedMspGraphql = void 0;
4
+ class EnlightenedMspGraphql {
5
+ constructor() {
6
+ this.name = 'enlightenedMspGraphql';
7
+ this.displayName = 'EnlightenedMSP GraphQL API';
8
+ this.documentationUrl = '';
9
+ this.properties = [
10
+ {
11
+ displayName: 'GraphQL Endpoint',
12
+ name: 'endpoint',
13
+ type: 'string',
14
+ default: '',
15
+ required: true,
16
+ description: 'The GraphQL endpoint URL',
17
+ },
18
+ {
19
+ displayName: 'API Key',
20
+ name: 'apiKey',
21
+ type: 'string',
22
+ typeOptions: {
23
+ password: true,
24
+ },
25
+ default: '',
26
+ required: true,
27
+ description: 'The API key for authentication',
28
+ },
29
+ ];
30
+ this.authenticate = {
31
+ type: 'generic',
32
+ properties: {
33
+ headers: {
34
+ 'x-api-key': '={{$credentials.apiKey}}',
35
+ },
36
+ },
37
+ };
38
+ }
39
+ }
40
+ exports.EnlightenedMspGraphql = EnlightenedMspGraphql;
@@ -0,0 +1,13 @@
1
+ import { IExecuteFunctions } from 'n8n-workflow';
2
+ import { AxiosInstance } from 'axios';
3
+ export declare abstract class GraphqlBase {
4
+ protected readonly endpoint: string;
5
+ protected readonly apiKey: string;
6
+ protected client: AxiosInstance;
7
+ constructor(endpoint: string, apiKey: string);
8
+ protected executeGraphql(query: string, variables: Record<string, unknown>): Promise<any>;
9
+ static getCredentials(executeFunctions: IExecuteFunctions): Promise<{
10
+ endpoint: string;
11
+ apiKey: string;
12
+ }>;
13
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.GraphqlBase = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ class GraphqlBase {
9
+ constructor(endpoint, apiKey) {
10
+ this.endpoint = endpoint;
11
+ this.apiKey = apiKey;
12
+ this.client = axios_1.default.create({
13
+ baseURL: endpoint,
14
+ headers: {
15
+ 'Content-Type': 'application/json',
16
+ 'x-api-key': apiKey,
17
+ },
18
+ });
19
+ }
20
+ async executeGraphql(query, variables) {
21
+ var _a, _b;
22
+ try {
23
+ const response = await this.client.post('', {
24
+ query,
25
+ variables,
26
+ });
27
+ if (response.data.errors) {
28
+ throw new Error(response.data.errors[0].message);
29
+ }
30
+ return response.data.data;
31
+ }
32
+ catch (error) {
33
+ if (error.response) {
34
+ throw new Error(`GraphQL request failed: ${((_b = (_a = error.response.data.errors) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.message) || error.message}`);
35
+ }
36
+ throw error;
37
+ }
38
+ }
39
+ static async getCredentials(executeFunctions) {
40
+ const credentials = await executeFunctions.getCredentials('enlightenedMspGraphql');
41
+ if (!credentials) {
42
+ throw new Error('No credentials provided');
43
+ }
44
+ return {
45
+ endpoint: credentials.endpoint,
46
+ apiKey: credentials.apiKey,
47
+ };
48
+ }
49
+ }
50
+ exports.GraphqlBase = GraphqlBase;
@@ -1,5 +1,5 @@
1
1
  import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
- export declare class McpClient implements INodeType {
2
+ export declare class UpdateTicket implements INodeType {
3
3
  description: INodeTypeDescription;
4
4
  execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
5
  }
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateTicket = void 0;
4
+ const GraphqlBase_1 = require("./GraphqlBase");
5
+ class UpdateTicketGraphql extends GraphqlBase_1.GraphqlBase {
6
+ async updateTicket(variables) {
7
+ return this.executeGraphql(UpdateTicketGraphql.UPDATE_TICKET_MUTATION, variables);
8
+ }
9
+ }
10
+ UpdateTicketGraphql.UPDATE_TICKET_MUTATION = `
11
+ mutation UpdateAutotaskTicket(
12
+ $id: Int!
13
+ $status: String
14
+ $parentId: Int
15
+ $title: String
16
+ $description: String
17
+ ) {
18
+ updateAutotaskTickets(
19
+ id: $id
20
+ status: $status
21
+ parentId: $parentId
22
+ title: $title
23
+ description: $description
24
+ ) {
25
+ id
26
+ status
27
+ parentId
28
+ title
29
+ description
30
+ }
31
+ }
32
+ `;
33
+ class UpdateTicket {
34
+ constructor() {
35
+ this.description = {
36
+ displayName: 'Update Ticket',
37
+ name: 'updateTicket',
38
+ icon: 'file:enlightenedmsp.svg',
39
+ group: ['transform'],
40
+ version: 1,
41
+ description: 'Updates a ticket in EnlightenedMSP',
42
+ defaults: {
43
+ name: 'Update Ticket',
44
+ },
45
+ inputs: ['main'],
46
+ outputs: ['main'],
47
+ credentials: [
48
+ {
49
+ name: 'enlightenedMspGraphql',
50
+ required: true,
51
+ },
52
+ ],
53
+ properties: [
54
+ {
55
+ displayName: 'Ticket ID',
56
+ name: 'id',
57
+ type: 'number',
58
+ default: 0,
59
+ required: true,
60
+ description: 'The ID of the ticket to update',
61
+ },
62
+ {
63
+ displayName: 'Update Fields',
64
+ name: 'updateFields',
65
+ type: 'collection',
66
+ placeholder: 'Add Field',
67
+ default: {},
68
+ options: [
69
+ {
70
+ displayName: 'Status',
71
+ name: 'status',
72
+ type: 'string',
73
+ default: '',
74
+ description: 'The new status of the ticket',
75
+ },
76
+ {
77
+ displayName: 'Parent ID',
78
+ name: 'parentId',
79
+ type: 'number',
80
+ default: 0,
81
+ description: 'The ID of the parent ticket',
82
+ },
83
+ {
84
+ displayName: 'Title',
85
+ name: 'title',
86
+ type: 'string',
87
+ default: '',
88
+ description: 'The new title of the ticket',
89
+ },
90
+ {
91
+ displayName: 'Description',
92
+ name: 'description',
93
+ type: 'string',
94
+ default: '',
95
+ description: 'The new description of the ticket',
96
+ },
97
+ ],
98
+ },
99
+ ],
100
+ };
101
+ }
102
+ async execute() {
103
+ const items = this.getInputData();
104
+ const returnData = [];
105
+ const { endpoint, apiKey } = await UpdateTicketGraphql.getCredentials(this);
106
+ const graphqlClient = new UpdateTicketGraphql(endpoint, apiKey);
107
+ for (let i = 0; i < items.length; i++) {
108
+ try {
109
+ const id = this.getNodeParameter('id', i);
110
+ const updateFields = this.getNodeParameter('updateFields', i);
111
+ const variables = {
112
+ id,
113
+ ...updateFields,
114
+ };
115
+ const result = await graphqlClient.updateTicket(variables);
116
+ returnData.push({
117
+ json: result.updateAutotaskTickets,
118
+ });
119
+ }
120
+ catch (error) {
121
+ if (this.continueOnFail()) {
122
+ returnData.push({
123
+ json: {
124
+ error: error.message,
125
+ },
126
+ });
127
+ continue;
128
+ }
129
+ throw error;
130
+ }
131
+ }
132
+ return [returnData];
133
+ }
134
+ }
135
+ exports.UpdateTicket = UpdateTicket;