@couleetech/n8n-nodes-enlightenedmsp 1.7.1 → 1.7.2

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.
@@ -26,7 +26,7 @@ class SearchCoreCompaniesGraphql extends GraphqlBase_1.GraphqlBase {
26
26
  $active: BooleanProp
27
27
  $isOwnCompany: BooleanProp
28
28
  $autotaskCompanyId: NumberProp
29
- $order: SortCoreCompaniesArgs
29
+ $order: SortInput
30
30
  ) {
31
31
  findCoreCompaniesPaginated(
32
32
  page: $page
@@ -331,23 +331,21 @@ active`,
331
331
  async execute() {
332
332
  const items = this.getInputData();
333
333
  const returnData = [];
334
- const { endpoint, apiKey } = await GraphqlBase_1.GraphqlBase.getCredentials(this);
335
- const searchCompaniesGraphql = new SearchCoreCompaniesGraphql(endpoint, apiKey);
336
334
  const searchCompaniesTool = new tools_1.DynamicStructuredTool({
337
335
  name: 'search_companies',
338
336
  description: 'Search for companies in EnlightenedMSP with various filters and sorting options',
339
337
  schema: zod_1.z.object({
340
338
  name: zod_1.z.object({
341
- operation: zod_1.z.enum(['equals', 'notEquals', 'contains', 'notContains']),
342
- value: zod_1.z.string()
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')
343
341
  }).optional().describe('Filter by company name'),
344
342
  defaultTicketLevel: zod_1.z.object({
345
- operation: zod_1.z.enum(['equals', 'notEquals', 'contains', 'notContains']),
346
- value: zod_1.z.string()
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')
347
345
  }).optional().describe('Filter by default ticket level'),
348
346
  defaultHourlyRate: zod_1.z.object({
349
- operation: zod_1.z.enum(['equals', 'greaterThan', 'lessThan']),
350
- value: zod_1.z.number()
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')
351
349
  }).optional().describe('Filter by default hourly rate'),
352
350
  billingConfigured: zod_1.z.boolean().optional().describe('Filter by billing configured status'),
353
351
  active: zod_1.z.boolean().optional().describe('Filter by active status'),
@@ -361,11 +359,13 @@ active`,
361
359
  }),
362
360
  func: async (args) => {
363
361
  try {
362
+ const { endpoint, apiKey } = await GraphqlBase_1.GraphqlBase.getCredentials(this);
363
+ const searchCompaniesGraphql = new SearchCoreCompaniesGraphql(endpoint, apiKey);
364
364
  const variables = {
365
365
  page: args.page || 1,
366
366
  limit: args.limit || 10,
367
367
  fields: args.fields || DEFAULT_FIELDS,
368
- order: args.sortBy ? { [args.sortBy]: args.sortOrder || 'ASC' } : undefined
368
+ order: args.sortBy ? { field: args.sortBy, direction: args.sortOrder || 'ASC' } : undefined
369
369
  };
370
370
  if (args.name) {
371
371
  switch (args.name.operation) {
@@ -437,12 +437,8 @@ active`,
437
437
  }
438
438
  }
439
439
  });
440
- const toolOutput = {
441
- json: {
442
- tools: [searchCompaniesTool]
443
- }
444
- };
445
- void this.addOutputData("ai_tool", 0, [[toolOutput]]);
440
+ const { endpoint, apiKey } = await GraphqlBase_1.GraphqlBase.getCredentials(this);
441
+ const searchCompaniesGraphql = new SearchCoreCompaniesGraphql(endpoint, apiKey);
446
442
  for (let i = 0; i < items.length; i++) {
447
443
  try {
448
444
  const nameFilter = this.getNodeParameter('nameFilter', i, {});
@@ -464,7 +460,7 @@ active`,
464
460
  billingConfigured: { eq: billingConfigured },
465
461
  active: { eq: active },
466
462
  isOwnCompany: { eq: isOwnCompany },
467
- order: { [sortBy]: sortOrder },
463
+ order: { field: sortBy, direction: sortOrder },
468
464
  };
469
465
  if (nameFilter.filter) {
470
466
  switch (nameFilter.filter.operation) {
@@ -531,7 +527,14 @@ active`,
531
527
  throw error;
532
528
  }
533
529
  }
534
- return [returnData];
530
+ const firstItem = returnData[0] || { json: {} };
531
+ return [[{
532
+ ...firstItem,
533
+ json: {
534
+ ...firstItem.json,
535
+ tools: [searchCompaniesTool]
536
+ }
537
+ }]];
535
538
  }
536
539
  }
537
540
  exports.SearchCoreCompanies = SearchCoreCompanies;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@couleetech/n8n-nodes-enlightenedmsp",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "n8n node for EnlightenedMSP ticketing and workflow automation",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",