diff --git a/credentials/ITGlueApi.credentials.ts b/credentials/ITGlueApi.credentials.ts index 757a131..c106b70 100644 --- a/credentials/ITGlueApi.credentials.ts +++ b/credentials/ITGlueApi.credentials.ts @@ -3,11 +3,16 @@ import { ICredentialTestRequest, ICredentialType, INodeProperties, -} from 'n8n-workflow'; + type Icon, + } from 'n8n-workflow'; export class ITGlueApi implements ICredentialType { name = 'itglueApi'; displayName = 'IT Glue API'; + icon: Icon = { + light: 'file:itglue.svg', + dark: 'file:itglue-dark.svg', + }; documentationUrl = 'https://github.com/redanthrax/itglue-node'; properties: INodeProperties[] = [ { diff --git a/credentials/itglue-dark.svg b/credentials/itglue-dark.svg new file mode 100644 index 0000000..5a77e0b --- /dev/null +++ b/credentials/itglue-dark.svg @@ -0,0 +1 @@ +ITGlue-logo \ No newline at end of file diff --git a/credentials/itglue.svg b/credentials/itglue.svg new file mode 100644 index 0000000..5a77e0b --- /dev/null +++ b/credentials/itglue.svg @@ -0,0 +1 @@ +ITGlue-logo \ No newline at end of file diff --git a/nodes/ITGlue/ITGlue.node.ts b/nodes/ITGlue/ITGlue.node.ts index 67fee88..c938b9c 100644 --- a/nodes/ITGlue/ITGlue.node.ts +++ b/nodes/ITGlue/ITGlue.node.ts @@ -46,7 +46,10 @@ export class ITGlue implements INodeType { description: INodeTypeDescription = { displayName: 'IT Glue', name: 'iTGlue', - icon: 'file:itglue.svg', + icon: { + light: 'file:itglue.svg', + dark: 'file:itglue-dark.svg', + }, group: ['transform'], version: 1, documentationUrl: 'https://github.com/redanthrax/itglue-node', diff --git a/nodes/ITGlue/actions/organization/bulkUpdate/execute.ts b/nodes/ITGlue/actions/organization/bulkUpdate/execute.ts index 78aef73..270d749 100644 --- a/nodes/ITGlue/actions/organization/bulkUpdate/execute.ts +++ b/nodes/ITGlue/actions/organization/bulkUpdate/execute.ts @@ -1,5 +1,10 @@ -import { IDataObject, IExecuteFunctions, INodeExecutionData } from "n8n-workflow"; -import { itglueRequest } from "../../../transport"; +import { + IDataObject, + IExecuteFunctions, + INodeExecutionData, + NodeOperationError, +} from 'n8n-workflow'; +import { itglueRequest } from '../../../transport'; export async function bulkUpdateOrganizations( this: IExecuteFunctions, @@ -14,12 +19,16 @@ export async function bulkUpdateOrganizations( try { organizationsData = JSON.parse(organizations); - } catch (error) { - throw new Error('Invalid JSON format for organizations data'); + } catch { + throw new NodeOperationError(this.getNode(), 'Invalid JSON format for organizations data', { + itemIndex: index, + }); } if (!Array.isArray(organizationsData)) { - throw new Error('Organizations data must be an array'); + throw new NodeOperationError(this.getNode(), 'Organizations data must be an array', { + itemIndex: index, + }); } // Transform the data to IT Glue API format diff --git a/nodes/ITGlue/actions/router.ts b/nodes/ITGlue/actions/router.ts index 7a46359..e04acab 100644 --- a/nodes/ITGlue/actions/router.ts +++ b/nodes/ITGlue/actions/router.ts @@ -2,6 +2,9 @@ import { IDataObject, IExecuteFunctions, INodeExecutionData, + type JsonObject, + NodeApiError, + NodeOperationError, } from 'n8n-workflow'; import { ITGlue } from './interfaces'; @@ -298,8 +301,14 @@ export async function router(this: IExecuteFunctions): PromiseITGlue-logo \ No newline at end of file diff --git a/nodes/ITGlue/transport.ts b/nodes/ITGlue/transport.ts index 8097e18..e22e39b 100644 --- a/nodes/ITGlue/transport.ts +++ b/nodes/ITGlue/transport.ts @@ -7,6 +7,7 @@ import { IHttpRequestOptions, ILoadOptionsFunctions, IPollFunctions, + type JsonObject, NodeOperationError, NodeApiError, } from 'n8n-workflow'; @@ -56,7 +57,7 @@ export async function itglueRequest( 'Rate limit exceeded. IT Glue is throttling requests. Please try again later.', ); } - throw error; + throw new NodeApiError(this.getNode(), error as JsonObject); } } diff --git a/package.json b/package.json index 711f089..45373ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "n8n-nodes-itglue", - "version": "2.2.2", + "version": "2.2.3", "description": "An n8n node to connect to IT Glue", "keywords": [ "n8n-nodes-itglue",