@couleetech/n8n-nodes-enlightenedmsp 1.7.2 → 1.7.4
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/nodes/EnlightenedMsp/SearchCoreCompanies.graphql.d.ts +44 -0
- package/dist/nodes/EnlightenedMsp/SearchCoreCompanies.graphql.js +61 -0
- package/dist/nodes/EnlightenedMsp/SearchCoreCompanies.node.js +89 -291
- package/dist/nodes/EnlightenedMsp/SearchDattormmDevices.node.js +2 -2
- package/dist/nodes/EnlightenedMsp/SearchTicket.node.js +2 -2
- package/dist/nodes/EnlightenedMsp/TicketCreated.node.js +1 -1
- package/dist/nodes/EnlightenedMsp/TimeclockClockIn.node.js +2 -2
- package/dist/nodes/EnlightenedMsp/TimeclockClockOut.node.js +2 -2
- package/dist/nodes/EnlightenedMsp/UpdateTicket.node.js +2 -2
- package/package.json +2 -2
@@ -0,0 +1,44 @@
|
|
1
|
+
import { GraphqlBase } from './GraphqlBase';
|
2
|
+
export declare const DEFAULT_FIELDS = "id\nname\ndefaultTicketLevel\ndefaultHourlyRate\nbillingConfigured\nactive\nisOwnCompany\nautotaskCompanyId";
|
3
|
+
export declare class SearchCoreCompaniesGraphql extends GraphqlBase {
|
4
|
+
constructor(endpoint: string, apiKey: string, userId?: string);
|
5
|
+
searchCompanies({ name, defaultTicketLevel, defaultHourlyRate, billingConfigured, active, isOwnCompany, autotaskCompanyId, order, page, limit, fields, }: {
|
6
|
+
name?: {
|
7
|
+
eq?: string;
|
8
|
+
not?: string;
|
9
|
+
like?: string;
|
10
|
+
notlike?: string;
|
11
|
+
};
|
12
|
+
defaultTicketLevel?: {
|
13
|
+
eq?: string;
|
14
|
+
not?: string;
|
15
|
+
like?: string;
|
16
|
+
notlike?: string;
|
17
|
+
};
|
18
|
+
defaultHourlyRate?: {
|
19
|
+
eq?: number;
|
20
|
+
gte?: number;
|
21
|
+
lte?: number;
|
22
|
+
};
|
23
|
+
billingConfigured?: {
|
24
|
+
eq?: boolean;
|
25
|
+
};
|
26
|
+
active?: {
|
27
|
+
eq?: boolean;
|
28
|
+
};
|
29
|
+
isOwnCompany?: {
|
30
|
+
eq?: boolean;
|
31
|
+
};
|
32
|
+
autotaskCompanyId?: {
|
33
|
+
eq?: number;
|
34
|
+
not?: number;
|
35
|
+
};
|
36
|
+
order?: {
|
37
|
+
field: string;
|
38
|
+
direction: 'ASC' | 'DESC';
|
39
|
+
};
|
40
|
+
page?: number;
|
41
|
+
limit?: number;
|
42
|
+
fields?: string;
|
43
|
+
}): Promise<any>;
|
44
|
+
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SearchCoreCompaniesGraphql = exports.DEFAULT_FIELDS = void 0;
|
4
|
+
const GraphqlBase_1 = require("./GraphqlBase");
|
5
|
+
exports.DEFAULT_FIELDS = 'id\nname\ndefaultTicketLevel\ndefaultHourlyRate\nbillingConfigured\nactive\nisOwnCompany\nautotaskCompanyId';
|
6
|
+
class SearchCoreCompaniesGraphql extends GraphqlBase_1.GraphqlBase {
|
7
|
+
constructor(endpoint, apiKey, userId) {
|
8
|
+
super(endpoint, apiKey, userId);
|
9
|
+
}
|
10
|
+
async searchCompanies({ name, defaultTicketLevel, defaultHourlyRate, billingConfigured, active, isOwnCompany, autotaskCompanyId, order, page = 1, limit = 10, fields = exports.DEFAULT_FIELDS, }) {
|
11
|
+
const cleanVariables = {
|
12
|
+
page,
|
13
|
+
limit,
|
14
|
+
};
|
15
|
+
if (fields) {
|
16
|
+
cleanVariables.fields = fields;
|
17
|
+
}
|
18
|
+
const queryParams = ['$page: Int!', '$limit: Int!'];
|
19
|
+
const queryArgs = ['page: $page', 'limit: $limit'];
|
20
|
+
const filterParams = {
|
21
|
+
name: 'StringProp',
|
22
|
+
defaultTicketLevel: 'StringProp',
|
23
|
+
defaultHourlyRate: 'NumberProp',
|
24
|
+
billingConfigured: 'BooleanProp',
|
25
|
+
active: 'BooleanProp',
|
26
|
+
isOwnCompany: 'BooleanProp',
|
27
|
+
autotaskCompanyId: 'NumberProp',
|
28
|
+
order: 'SortCoreCompaniesArgs',
|
29
|
+
};
|
30
|
+
Object.entries({
|
31
|
+
name,
|
32
|
+
defaultTicketLevel,
|
33
|
+
defaultHourlyRate,
|
34
|
+
billingConfigured,
|
35
|
+
active,
|
36
|
+
isOwnCompany,
|
37
|
+
autotaskCompanyId,
|
38
|
+
order,
|
39
|
+
}).forEach(([key, value]) => {
|
40
|
+
if (value !== undefined) {
|
41
|
+
queryParams.push(`$${key}: ${filterParams[key]}`);
|
42
|
+
queryArgs.push(`${key}: $${key}`);
|
43
|
+
cleanVariables[key] = value;
|
44
|
+
}
|
45
|
+
});
|
46
|
+
const query = `
|
47
|
+
query SearchCoreCompanies(${queryParams.join(', ')}) {
|
48
|
+
findCoreCompaniesPaginated(${queryArgs.join(', ')}) {
|
49
|
+
data {
|
50
|
+
${fields}
|
51
|
+
}
|
52
|
+
totalCount
|
53
|
+
page
|
54
|
+
limit
|
55
|
+
}
|
56
|
+
}
|
57
|
+
`;
|
58
|
+
return this.executeGraphql(query, cleanVariables);
|
59
|
+
}
|
60
|
+
}
|
61
|
+
exports.SearchCoreCompaniesGraphql = SearchCoreCompaniesGraphql;
|
@@ -1,58 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.SearchCoreCompanies = void 0;
|
4
|
-
const
|
5
|
-
const tools_1 = require("@langchain/core/tools");
|
6
|
-
const zod_1 = require("zod");
|
7
|
-
const DEFAULT_FIELDS = `id
|
8
|
-
name
|
9
|
-
defaultTicketLevel
|
10
|
-
defaultHourlyRate
|
11
|
-
billingConfigured
|
12
|
-
active
|
13
|
-
isOwnCompany
|
14
|
-
autotaskCompanyId`;
|
15
|
-
class SearchCoreCompaniesGraphql extends GraphqlBase_1.GraphqlBase {
|
16
|
-
async searchCompanies(variables) {
|
17
|
-
const query = `
|
18
|
-
query SearchCoreCompanies(
|
19
|
-
$page: Int
|
20
|
-
$limit: Int
|
21
|
-
$id: NumberProp
|
22
|
-
$name: StringProp
|
23
|
-
$defaultTicketLevel: StringProp
|
24
|
-
$defaultHourlyRate: NumberProp
|
25
|
-
$billingConfigured: BooleanProp
|
26
|
-
$active: BooleanProp
|
27
|
-
$isOwnCompany: BooleanProp
|
28
|
-
$autotaskCompanyId: NumberProp
|
29
|
-
$order: SortInput
|
30
|
-
) {
|
31
|
-
findCoreCompaniesPaginated(
|
32
|
-
page: $page
|
33
|
-
limit: $limit
|
34
|
-
id: $id
|
35
|
-
name: $name
|
36
|
-
defaultTicketLevel: $defaultTicketLevel
|
37
|
-
defaultHourlyRate: $defaultHourlyRate
|
38
|
-
billingConfigured: $billingConfigured
|
39
|
-
active: $active
|
40
|
-
isOwnCompany: $isOwnCompany
|
41
|
-
autotaskCompanyId: $autotaskCompanyId
|
42
|
-
order: $order
|
43
|
-
) {
|
44
|
-
data {
|
45
|
-
${variables.fields || DEFAULT_FIELDS}
|
46
|
-
}
|
47
|
-
totalCount
|
48
|
-
page
|
49
|
-
limit
|
50
|
-
}
|
51
|
-
}
|
52
|
-
`;
|
53
|
-
return this.executeGraphql(query, variables);
|
54
|
-
}
|
55
|
-
}
|
4
|
+
const SearchCoreCompanies_graphql_1 = require("./SearchCoreCompanies.graphql");
|
56
5
|
class SearchCoreCompanies {
|
57
6
|
constructor() {
|
58
7
|
this.description = {
|
@@ -65,8 +14,8 @@ class SearchCoreCompanies {
|
|
65
14
|
defaults: {
|
66
15
|
name: 'Search Core Companies',
|
67
16
|
},
|
68
|
-
inputs: [
|
69
|
-
outputs: [
|
17
|
+
inputs: ["main"],
|
18
|
+
outputs: ["main", "ai_tool"],
|
70
19
|
outputNames: ['Output', 'Tool'],
|
71
20
|
credentials: [
|
72
21
|
{
|
@@ -74,54 +23,49 @@ class SearchCoreCompanies {
|
|
74
23
|
required: true,
|
75
24
|
},
|
76
25
|
],
|
26
|
+
codex: {
|
27
|
+
categories: ['AI'],
|
28
|
+
subcategories: {
|
29
|
+
AI: ['Tools'],
|
30
|
+
},
|
31
|
+
resources: {
|
32
|
+
primaryDocumentation: [
|
33
|
+
{
|
34
|
+
url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.searchcorecompanies/',
|
35
|
+
},
|
36
|
+
],
|
37
|
+
},
|
38
|
+
},
|
77
39
|
properties: [
|
78
40
|
{
|
79
41
|
displayName: 'Name Filter',
|
80
42
|
name: 'nameFilter',
|
81
43
|
type: 'fixedCollection',
|
82
44
|
default: {},
|
45
|
+
placeholder: 'Add Name Filter',
|
46
|
+
description: 'Filter by company name',
|
83
47
|
options: [
|
84
48
|
{
|
85
|
-
displayName: 'Filter',
|
86
49
|
name: 'filter',
|
50
|
+
displayName: 'Filter',
|
87
51
|
values: [
|
88
52
|
{
|
89
53
|
displayName: 'Operation',
|
90
54
|
name: 'operation',
|
91
55
|
type: 'options',
|
92
56
|
options: [
|
93
|
-
{
|
94
|
-
|
95
|
-
|
96
|
-
},
|
97
|
-
{
|
98
|
-
name: 'Not Equals',
|
99
|
-
value: 'notEquals',
|
100
|
-
},
|
101
|
-
{
|
102
|
-
name: 'Contains',
|
103
|
-
value: 'contains',
|
104
|
-
},
|
105
|
-
{
|
106
|
-
name: 'Not Contains',
|
107
|
-
value: 'notContains',
|
108
|
-
},
|
57
|
+
{ name: 'Equals', value: 'equals' },
|
58
|
+
{ name: 'Not Equals', value: 'notEquals' },
|
59
|
+
{ name: 'Contains', value: 'contains' },
|
60
|
+
{ name: 'Not Contains', value: 'notContains' },
|
109
61
|
],
|
110
62
|
default: 'equals',
|
111
|
-
typeOptions: {
|
112
|
-
minWidth: '100px',
|
113
|
-
display: 'inline',
|
114
|
-
},
|
115
63
|
},
|
116
64
|
{
|
117
65
|
displayName: 'Value',
|
118
66
|
name: 'value',
|
119
67
|
type: 'string',
|
120
68
|
default: '',
|
121
|
-
typeOptions: {
|
122
|
-
minWidth: '100px',
|
123
|
-
display: 'inline',
|
124
|
-
},
|
125
69
|
},
|
126
70
|
],
|
127
71
|
},
|
@@ -132,48 +76,30 @@ class SearchCoreCompanies {
|
|
132
76
|
name: 'defaultTicketLevelFilter',
|
133
77
|
type: 'fixedCollection',
|
134
78
|
default: {},
|
79
|
+
placeholder: 'Add Ticket Level Filter',
|
80
|
+
description: 'Filter by default ticket level',
|
135
81
|
options: [
|
136
82
|
{
|
137
|
-
displayName: 'Filter',
|
138
83
|
name: 'filter',
|
84
|
+
displayName: 'Filter',
|
139
85
|
values: [
|
140
86
|
{
|
141
87
|
displayName: 'Operation',
|
142
88
|
name: 'operation',
|
143
89
|
type: 'options',
|
144
90
|
options: [
|
145
|
-
{
|
146
|
-
|
147
|
-
|
148
|
-
},
|
149
|
-
{
|
150
|
-
name: 'Not Equals',
|
151
|
-
value: 'notEquals',
|
152
|
-
},
|
153
|
-
{
|
154
|
-
name: 'Contains',
|
155
|
-
value: 'contains',
|
156
|
-
},
|
157
|
-
{
|
158
|
-
name: 'Not Contains',
|
159
|
-
value: 'notContains',
|
160
|
-
},
|
91
|
+
{ name: 'Equals', value: 'equals' },
|
92
|
+
{ name: 'Not Equals', value: 'notEquals' },
|
93
|
+
{ name: 'Contains', value: 'contains' },
|
94
|
+
{ name: 'Not Contains', value: 'notContains' },
|
161
95
|
],
|
162
96
|
default: 'equals',
|
163
|
-
typeOptions: {
|
164
|
-
minWidth: '100px',
|
165
|
-
display: 'inline',
|
166
|
-
},
|
167
97
|
},
|
168
98
|
{
|
169
99
|
displayName: 'Value',
|
170
100
|
name: 'value',
|
171
101
|
type: 'string',
|
172
102
|
default: '',
|
173
|
-
typeOptions: {
|
174
|
-
minWidth: '100px',
|
175
|
-
display: 'inline',
|
176
|
-
},
|
177
103
|
},
|
178
104
|
],
|
179
105
|
},
|
@@ -184,44 +110,29 @@ class SearchCoreCompanies {
|
|
184
110
|
name: 'defaultHourlyRateFilter',
|
185
111
|
type: 'fixedCollection',
|
186
112
|
default: {},
|
113
|
+
placeholder: 'Add Hourly Rate Filter',
|
114
|
+
description: 'Filter by default hourly rate',
|
187
115
|
options: [
|
188
116
|
{
|
189
|
-
displayName: 'Filter',
|
190
117
|
name: 'filter',
|
118
|
+
displayName: 'Filter',
|
191
119
|
values: [
|
192
120
|
{
|
193
121
|
displayName: 'Operation',
|
194
122
|
name: 'operation',
|
195
123
|
type: 'options',
|
196
124
|
options: [
|
197
|
-
{
|
198
|
-
|
199
|
-
|
200
|
-
},
|
201
|
-
{
|
202
|
-
name: 'Greater Than',
|
203
|
-
value: 'greaterThan',
|
204
|
-
},
|
205
|
-
{
|
206
|
-
name: 'Less Than',
|
207
|
-
value: 'lessThan',
|
208
|
-
},
|
125
|
+
{ name: 'Equals', value: 'equals' },
|
126
|
+
{ name: 'Greater Than', value: 'greaterThan' },
|
127
|
+
{ name: 'Less Than', value: 'lessThan' },
|
209
128
|
],
|
210
129
|
default: 'equals',
|
211
|
-
typeOptions: {
|
212
|
-
minWidth: '100px',
|
213
|
-
display: 'inline',
|
214
|
-
},
|
215
130
|
},
|
216
131
|
{
|
217
132
|
displayName: 'Value',
|
218
133
|
name: 'value',
|
219
134
|
type: 'number',
|
220
135
|
default: 0,
|
221
|
-
typeOptions: {
|
222
|
-
minWidth: '100px',
|
223
|
-
display: 'inline',
|
224
|
-
},
|
225
136
|
},
|
226
137
|
],
|
227
138
|
},
|
@@ -232,46 +143,37 @@ class SearchCoreCompanies {
|
|
232
143
|
name: 'billingConfigured',
|
233
144
|
type: 'boolean',
|
234
145
|
default: false,
|
235
|
-
description: '
|
146
|
+
description: 'Whether billing is configured for the company',
|
236
147
|
},
|
237
148
|
{
|
238
149
|
displayName: 'Active',
|
239
150
|
name: 'active',
|
240
151
|
type: 'boolean',
|
241
152
|
default: true,
|
242
|
-
description: '
|
153
|
+
description: 'Whether the company is active',
|
243
154
|
},
|
244
155
|
{
|
245
156
|
displayName: 'Is Own Company',
|
246
157
|
name: 'isOwnCompany',
|
247
158
|
type: 'boolean',
|
248
159
|
default: false,
|
249
|
-
description: '
|
160
|
+
description: 'Whether this is our own company',
|
250
161
|
},
|
251
162
|
{
|
252
163
|
displayName: 'Autotask Company ID',
|
253
164
|
name: 'autotaskCompanyId',
|
254
165
|
type: 'number',
|
255
166
|
default: 0,
|
256
|
-
description: '
|
167
|
+
description: 'Autotask company ID',
|
257
168
|
},
|
258
169
|
{
|
259
170
|
displayName: 'Sort By',
|
260
171
|
name: 'sortBy',
|
261
172
|
type: 'options',
|
262
173
|
options: [
|
263
|
-
{
|
264
|
-
|
265
|
-
|
266
|
-
},
|
267
|
-
{
|
268
|
-
name: 'Default Hourly Rate',
|
269
|
-
value: 'defaultHourlyRate',
|
270
|
-
},
|
271
|
-
{
|
272
|
-
name: 'ID',
|
273
|
-
value: 'id',
|
274
|
-
},
|
174
|
+
{ name: 'Name', value: 'name' },
|
175
|
+
{ name: 'Default Hourly Rate', value: 'defaultHourlyRate' },
|
176
|
+
{ name: 'ID', value: 'id' },
|
275
177
|
],
|
276
178
|
default: 'name',
|
277
179
|
description: 'Field to sort results by',
|
@@ -281,17 +183,11 @@ class SearchCoreCompanies {
|
|
281
183
|
name: 'sortOrder',
|
282
184
|
type: 'options',
|
283
185
|
options: [
|
284
|
-
{
|
285
|
-
|
286
|
-
value: 'ASC',
|
287
|
-
},
|
288
|
-
{
|
289
|
-
name: 'Descending',
|
290
|
-
value: 'DESC',
|
291
|
-
},
|
186
|
+
{ name: 'Ascending', value: 'ASC' },
|
187
|
+
{ name: 'Descending', value: 'DESC' },
|
292
188
|
],
|
293
189
|
default: 'ASC',
|
294
|
-
description: 'Sort order for
|
190
|
+
description: 'Sort order for results',
|
295
191
|
},
|
296
192
|
{
|
297
193
|
displayName: 'Page',
|
@@ -308,22 +204,11 @@ class SearchCoreCompanies {
|
|
308
204
|
description: 'Number of results per page',
|
309
205
|
},
|
310
206
|
{
|
311
|
-
displayName: '
|
207
|
+
displayName: 'Fields',
|
312
208
|
name: 'dataSelection',
|
313
209
|
type: 'string',
|
314
|
-
|
315
|
-
|
316
|
-
},
|
317
|
-
default: DEFAULT_FIELDS,
|
318
|
-
required: false,
|
319
|
-
noDataExpression: true,
|
320
|
-
description: 'Fields to return in the response. Leave empty to use default fields.',
|
321
|
-
placeholder: `Example fields:
|
322
|
-
id
|
323
|
-
name
|
324
|
-
defaultTicketLevel
|
325
|
-
defaultHourlyRate
|
326
|
-
active`,
|
210
|
+
default: SearchCoreCompanies_graphql_1.DEFAULT_FIELDS,
|
211
|
+
description: 'Fields to return in the response',
|
327
212
|
},
|
328
213
|
],
|
329
214
|
};
|
@@ -331,114 +216,8 @@ active`,
|
|
331
216
|
async execute() {
|
332
217
|
const items = this.getInputData();
|
333
218
|
const returnData = [];
|
334
|
-
const
|
335
|
-
|
336
|
-
description: 'Search for companies in EnlightenedMSP with various filters and sorting options',
|
337
|
-
schema: zod_1.z.object({
|
338
|
-
name: zod_1.z.object({
|
339
|
-
operation: zod_1.z.enum(['equals', 'notEquals', 'contains', 'notContains']).optional().describe('Operation to apply on company name'),
|
340
|
-
value: zod_1.z.string().optional().describe('Value to filter company name by')
|
341
|
-
}).optional().describe('Filter by company name'),
|
342
|
-
defaultTicketLevel: zod_1.z.object({
|
343
|
-
operation: zod_1.z.enum(['equals', 'notEquals', 'contains', 'notContains']).optional().describe('Operation to apply on ticket level'),
|
344
|
-
value: zod_1.z.string().optional().describe('Value to filter ticket level by')
|
345
|
-
}).optional().describe('Filter by default ticket level'),
|
346
|
-
defaultHourlyRate: zod_1.z.object({
|
347
|
-
operation: zod_1.z.enum(['equals', 'greaterThan', 'lessThan']).optional().describe('Operation to apply on hourly rate'),
|
348
|
-
value: zod_1.z.number().optional().describe('Value to filter hourly rate by')
|
349
|
-
}).optional().describe('Filter by default hourly rate'),
|
350
|
-
billingConfigured: zod_1.z.boolean().optional().describe('Filter by billing configured status'),
|
351
|
-
active: zod_1.z.boolean().optional().describe('Filter by active status'),
|
352
|
-
isOwnCompany: zod_1.z.boolean().optional().describe('Filter by own company status'),
|
353
|
-
autotaskCompanyId: zod_1.z.number().optional().describe('Filter by Autotask company ID'),
|
354
|
-
sortBy: zod_1.z.enum(['name', 'defaultHourlyRate', 'id']).optional().describe('Field to sort results by'),
|
355
|
-
sortOrder: zod_1.z.enum(['ASC', 'DESC']).optional().describe('Sort order for results'),
|
356
|
-
page: zod_1.z.number().optional().describe('Page number for pagination'),
|
357
|
-
limit: zod_1.z.number().optional().describe('Number of results per page'),
|
358
|
-
fields: zod_1.z.string().optional().describe('Fields to return in the response')
|
359
|
-
}),
|
360
|
-
func: async (args) => {
|
361
|
-
try {
|
362
|
-
const { endpoint, apiKey } = await GraphqlBase_1.GraphqlBase.getCredentials(this);
|
363
|
-
const searchCompaniesGraphql = new SearchCoreCompaniesGraphql(endpoint, apiKey);
|
364
|
-
const variables = {
|
365
|
-
page: args.page || 1,
|
366
|
-
limit: args.limit || 10,
|
367
|
-
fields: args.fields || DEFAULT_FIELDS,
|
368
|
-
order: args.sortBy ? { field: args.sortBy, direction: args.sortOrder || 'ASC' } : undefined
|
369
|
-
};
|
370
|
-
if (args.name) {
|
371
|
-
switch (args.name.operation) {
|
372
|
-
case 'equals':
|
373
|
-
variables.name = { eq: args.name.value };
|
374
|
-
break;
|
375
|
-
case 'notEquals':
|
376
|
-
variables.name = { not: args.name.value };
|
377
|
-
break;
|
378
|
-
case 'contains':
|
379
|
-
variables.name = { like: args.name.value };
|
380
|
-
break;
|
381
|
-
case 'notContains':
|
382
|
-
variables.name = { notlike: args.name.value };
|
383
|
-
break;
|
384
|
-
}
|
385
|
-
}
|
386
|
-
if (args.defaultTicketLevel) {
|
387
|
-
switch (args.defaultTicketLevel.operation) {
|
388
|
-
case 'equals':
|
389
|
-
variables.defaultTicketLevel = { eq: args.defaultTicketLevel.value };
|
390
|
-
break;
|
391
|
-
case 'notEquals':
|
392
|
-
variables.defaultTicketLevel = { not: args.defaultTicketLevel.value };
|
393
|
-
break;
|
394
|
-
case 'contains':
|
395
|
-
variables.defaultTicketLevel = { like: args.defaultTicketLevel.value };
|
396
|
-
break;
|
397
|
-
case 'notContains':
|
398
|
-
variables.defaultTicketLevel = { notlike: args.defaultTicketLevel.value };
|
399
|
-
break;
|
400
|
-
}
|
401
|
-
}
|
402
|
-
if (args.defaultHourlyRate) {
|
403
|
-
switch (args.defaultHourlyRate.operation) {
|
404
|
-
case 'equals':
|
405
|
-
variables.defaultHourlyRate = { eq: args.defaultHourlyRate.value };
|
406
|
-
break;
|
407
|
-
case 'greaterThan':
|
408
|
-
variables.defaultHourlyRate = { gte: args.defaultHourlyRate.value };
|
409
|
-
break;
|
410
|
-
case 'lessThan':
|
411
|
-
variables.defaultHourlyRate = { lte: args.defaultHourlyRate.value };
|
412
|
-
break;
|
413
|
-
}
|
414
|
-
}
|
415
|
-
if (args.billingConfigured !== undefined) {
|
416
|
-
variables.billingConfigured = { eq: args.billingConfigured };
|
417
|
-
}
|
418
|
-
if (args.active !== undefined) {
|
419
|
-
variables.active = { eq: args.active };
|
420
|
-
}
|
421
|
-
if (args.isOwnCompany !== undefined) {
|
422
|
-
variables.isOwnCompany = { eq: args.isOwnCompany };
|
423
|
-
}
|
424
|
-
if (args.autotaskCompanyId) {
|
425
|
-
variables.autotaskCompanyId = { eq: args.autotaskCompanyId };
|
426
|
-
}
|
427
|
-
const result = await searchCompaniesGraphql.searchCompanies(variables);
|
428
|
-
return JSON.stringify({
|
429
|
-
companies: result.findCoreCompaniesPaginated.data,
|
430
|
-
totalCount: result.findCoreCompaniesPaginated.totalCount,
|
431
|
-
page: result.findCoreCompaniesPaginated.page,
|
432
|
-
limit: result.findCoreCompaniesPaginated.limit
|
433
|
-
});
|
434
|
-
}
|
435
|
-
catch (error) {
|
436
|
-
throw new Error(`Failed to search companies: ${error.message}`);
|
437
|
-
}
|
438
|
-
}
|
439
|
-
});
|
440
|
-
const { endpoint, apiKey } = await GraphqlBase_1.GraphqlBase.getCredentials(this);
|
441
|
-
const searchCompaniesGraphql = new SearchCoreCompaniesGraphql(endpoint, apiKey);
|
219
|
+
const { endpoint, apiKey } = await SearchCoreCompanies_graphql_1.SearchCoreCompaniesGraphql.getCredentials(this);
|
220
|
+
const graphqlClient = new SearchCoreCompanies_graphql_1.SearchCoreCompaniesGraphql(endpoint, apiKey);
|
442
221
|
for (let i = 0; i < items.length; i++) {
|
443
222
|
try {
|
444
223
|
const nameFilter = this.getNodeParameter('nameFilter', i, {});
|
@@ -452,16 +231,24 @@ active`,
|
|
452
231
|
const sortOrder = this.getNodeParameter('sortOrder', i);
|
453
232
|
const page = this.getNodeParameter('page', i);
|
454
233
|
const limit = this.getNodeParameter('limit', i);
|
455
|
-
const dataSelection = this.getNodeParameter('dataSelection', i, DEFAULT_FIELDS);
|
234
|
+
const dataSelection = this.getNodeParameter('dataSelection', i, SearchCoreCompanies_graphql_1.DEFAULT_FIELDS);
|
456
235
|
const variables = {
|
457
236
|
page,
|
458
237
|
limit,
|
459
238
|
fields: dataSelection,
|
460
|
-
billingConfigured: { eq: billingConfigured },
|
461
|
-
active: { eq: active },
|
462
|
-
isOwnCompany: { eq: isOwnCompany },
|
463
|
-
order: { field: sortBy, direction: sortOrder },
|
464
239
|
};
|
240
|
+
if (billingConfigured !== undefined) {
|
241
|
+
variables.billingConfigured = { eq: billingConfigured };
|
242
|
+
}
|
243
|
+
if (active !== undefined) {
|
244
|
+
variables.active = { eq: active };
|
245
|
+
}
|
246
|
+
if (isOwnCompany !== undefined) {
|
247
|
+
variables.isOwnCompany = { eq: isOwnCompany };
|
248
|
+
}
|
249
|
+
if (sortBy && sortOrder) {
|
250
|
+
variables.order = { field: sortBy, direction: sortOrder };
|
251
|
+
}
|
465
252
|
if (nameFilter.filter) {
|
466
253
|
switch (nameFilter.filter.operation) {
|
467
254
|
case 'equals':
|
@@ -510,31 +297,42 @@ active`,
|
|
510
297
|
if (autotaskCompanyId) {
|
511
298
|
variables.autotaskCompanyId = { eq: autotaskCompanyId };
|
512
299
|
}
|
513
|
-
const result = await
|
514
|
-
|
515
|
-
|
516
|
-
|
300
|
+
const result = await graphqlClient.searchCompanies(variables);
|
301
|
+
const response = result.data.findCoreCompaniesPaginated;
|
302
|
+
const outputItem = {
|
303
|
+
json: {
|
304
|
+
data: response.data,
|
305
|
+
totalCount: response.totalCount,
|
306
|
+
page: response.page,
|
307
|
+
limit: response.limit
|
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]]);
|
517
320
|
}
|
518
321
|
catch (error) {
|
519
322
|
if (this.continueOnFail()) {
|
520
|
-
|
323
|
+
const errorOutput = {
|
521
324
|
json: {
|
522
325
|
error: error.message,
|
523
326
|
},
|
524
|
-
}
|
327
|
+
};
|
328
|
+
returnData.push(errorOutput);
|
329
|
+
void this.addOutputData("ai_tool", i, [[errorOutput]]);
|
525
330
|
continue;
|
526
331
|
}
|
527
332
|
throw error;
|
528
333
|
}
|
529
334
|
}
|
530
|
-
|
531
|
-
return [[{
|
532
|
-
...firstItem,
|
533
|
-
json: {
|
534
|
-
...firstItem.json,
|
535
|
-
tools: [searchCompaniesTool]
|
536
|
-
}
|
537
|
-
}]];
|
335
|
+
return [returnData];
|
538
336
|
}
|
539
337
|
}
|
540
338
|
exports.SearchCoreCompanies = SearchCoreCompanies;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@couleetech/n8n-nodes-enlightenedmsp",
|
3
|
-
"version": "1.7.
|
3
|
+
"version": "1.7.4",
|
4
4
|
"description": "n8n node for EnlightenedMSP ticketing and workflow automation",
|
5
5
|
"keywords": [
|
6
6
|
"n8n-community-node-package",
|
@@ -75,7 +75,7 @@
|
|
75
75
|
"gulp": "^4.0.2",
|
76
76
|
"jest": "^29.7.0",
|
77
77
|
"n8n-core": "^1.14.1",
|
78
|
-
"n8n-workflow": "^1.
|
78
|
+
"n8n-workflow": "^1.70.0",
|
79
79
|
"prettier": "^2.7.1",
|
80
80
|
"ts-jest": "^29.2.5",
|
81
81
|
"typescript": "~4.8.4"
|