diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f0c9d19..8dd3896 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,6 +22,7 @@ jobs: cache: npm - run: npm install --global npm@11.6.0 - run: npm ci + - run: npm run format:check - run: npm run lint - run: npm run typecheck - run: npm test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a2837b4..d6baaed 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,6 +23,7 @@ jobs: registry-url: https://registry.npmjs.org - run: npm install --global npm@11.6.0 - run: npm ci + - run: npm run format:check - run: npm run lint - run: npm run typecheck - run: npm test diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..5874450 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +dist +node_modules +.cache +package-lock.json diff --git a/.prettierrc.js b/.prettierrc.js index f6ef3aa..f385577 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -9,4 +9,4 @@ module.exports = { quoteProps: 'as-needed', endOfLine: 'lf', printWidth: 100, -}; \ No newline at end of file +}; diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b01acf3..0636954 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,6 +15,7 @@ Keep changes focused and preserve the persisted `name`, resource, and operation Before opening a pull request, run: ```bash +npm run format:check npm run lint npm run typecheck npm test diff --git a/README.md b/README.md index 3bad28f..08bac49 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ The trigger lifecycle does not register a remote webhook itself; the URL is part ```bash npm ci +npm run format:check npm run lint npm run typecheck npm test diff --git a/credentials/ParallelApi.credentials.ts b/credentials/ParallelApi.credentials.ts index ba4f8b8..e5f9ef2 100644 --- a/credentials/ParallelApi.credentials.ts +++ b/credentials/ParallelApi.credentials.ts @@ -35,7 +35,8 @@ export class ParallelApi implements ICredentialType { }, default: '', required: false, - description: 'Optional webhook secret for validating webhook signatures. Find this in Settings → Webhooks at https://platform.parallel.ai/settings', + description: + 'Optional webhook secret for validating webhook signatures. Find this in Settings → Webhooks at https://platform.parallel.ai/settings', hint: 'Webhook validation ensures secure communication. Get your secret from platform.parallel.ai/settings', }, ]; diff --git a/nodes/Parallel/Parallel.node.ts b/nodes/Parallel/Parallel.node.ts index 92f3cf3..eca230c 100644 --- a/nodes/Parallel/Parallel.node.ts +++ b/nodes/Parallel/Parallel.node.ts @@ -37,7 +37,8 @@ export class Parallel implements INodeType { icon: { light: 'file:parallel.svg', dark: 'file:parallel.dark.svg' }, group: ['transform'], version: 1, - subtitle: '={{$parameter["resource"] === "monitor" ? "Monitor / " + $parameter["monitorOperation"] : $parameter["operation"]}}', + subtitle: + '={{$parameter["resource"] === "monitor" ? "Monitor / " + $parameter["monitorOperation"] : $parameter["operation"]}}', description: 'Highest accuracy web search tools for AI agents', defaults: { name: 'Parallel', @@ -153,8 +154,10 @@ export class Parallel implements INodeType { inputType: ['json'], }, }, - default: '{\n "company_name": "Apple Inc.",\n "company_domain": "apple.com",\n "company_ticker": "AAPL"\n}', - description: 'System will expect inputs of this JSON structure. Provide actual data values here.', + default: + '{\n "company_name": "Apple Inc.",\n "company_domain": "apple.com",\n "company_ticker": "AAPL"\n}', + description: + 'System will expect inputs of this JSON structure. Provide actual data values here.', }, { displayName: 'Output Schema Type', @@ -206,7 +209,8 @@ export class Parallel implements INodeType { { name: 'Auto', value: 'auto', - description: 'Only supported in Pro and above. Optimized JSON output with nested citations.', + description: + 'Only supported in Pro and above. Optimized JSON output with nested citations.', }, ], default: 'text', @@ -224,7 +228,8 @@ export class Parallel implements INodeType { }, }, default: '', - placeholder: 'Optional: Describe the desired output (e.g., "Format as $X.X trillion (year)")', + placeholder: + 'Optional: Describe the desired output (e.g., "Format as $X.X trillion (year)")', description: 'Optional description of how you want the text output formatted', }, { @@ -241,7 +246,8 @@ export class Parallel implements INodeType { }, }, default: '', - placeholder: 'Required: Describe what text output you want from the JSON input (e.g., "Generate a company summary")', + placeholder: + 'Required: Describe what text output you want from the JSON input (e.g., "Generate a company summary")', description: 'Required description of what text output you want when providing JSON input', }, { @@ -261,7 +267,8 @@ export class Parallel implements INodeType { }, default: '{\n "type": "object",\n "properties": {\n "company_name": {\n "type": "string",\n "description": "Official company name from recent filings or website."\n },\n "ceo_name": {\n "type": "string",\n "description": "Current CEO full name from company website or recent news."\n },\n "employee_count": {\n "type": "string",\n "description": "Current number of employees as approximate number or range (e.g., \'500-1000\', \'2500\')."\n },\n "annual_revenue_2024": {\n "type": "string",\n "description": "2024 annual revenue in millions USD format (e.g., \'$500M\', \'$2.5B\')."\n },\n "headquarters_city": {\n "type": "string",\n "description": "Primary headquarters city and country (e.g., \'San Francisco, USA\')."\n },\n "founded_year": {\n "type": "string",\n "description": "Year company was founded in YYYY format."\n }\n },\n "required": ["company_name", "ceo_name", "employee_count", "annual_revenue_2024", "headquarters_city", "founded_year"],\n "additionalProperties": false\n}', - description: 'JSON schema defining the structure of the expected output (description fields serve as field-level prompts)', + description: + 'JSON schema defining the structure of the expected output (description fields serve as field-level prompts)', }, { displayName: 'JSON Schema', @@ -280,7 +287,8 @@ export class Parallel implements INodeType { }, default: '{\n "type": "object",\n "properties": {\n "company_name": {\n "type": "string",\n "description": "Official company name from recent filings or website."\n },\n "ceo_name": {\n "type": "string",\n "description": "Current CEO full name from company website or recent news."\n },\n "employee_count": {\n "type": "string",\n "description": "Current number of employees as approximate number or range (e.g., \'500-1000\', \'2500\')."\n },\n "annual_revenue_2024": {\n "type": "string",\n "description": "2024 annual revenue in millions USD format (e.g., \'$500M\', \'$2.5B\')."\n },\n "headquarters_city": {\n "type": "string",\n "description": "Primary headquarters city and country (e.g., \'San Francisco, USA\')."\n },\n "founded_year": {\n "type": "string",\n "description": "Year company was founded in YYYY format."\n }\n },\n "required": ["company_name", "ceo_name", "employee_count", "annual_revenue_2024", "headquarters_city", "founded_year"],\n "additionalProperties": false\n}', - description: 'JSON schema defining the structure of the expected output (required when JSON type is selected)', + description: + 'JSON schema defining the structure of the expected output (required when JSON type is selected)', }, { displayName: 'Processor', @@ -300,7 +308,8 @@ export class Parallel implements INodeType { displayName: 'Processor', name: 'asyncProcessor', type: 'options', - description: 'Processor used for the async task. Higher-end processors for longer-running tasks.', + description: + 'Processor used for the async task. Higher-end processors for longer-running tasks.', displayOptions: { show: { resource: ['task'], @@ -322,7 +331,8 @@ export class Parallel implements INodeType { }, default: '', placeholder: 'https://your-domain.com/webhooks/parallel', - description: 'Optional webhook URL to receive real-time notifications when the task completes', + description: + 'Optional webhook URL to receive real-time notifications when the task completes', }, { displayName: 'Additional Fields', @@ -591,30 +601,38 @@ export class Parallel implements INodeType { chatResponseFormat: ['json'], }, }, - default: JSON.stringify({ - type: 'object', - properties: { - answer: { - type: 'string', - description: 'Direct factual answer to the user question based on web research. If unavailable, return \'Information not found\'.', - }, - key_findings: { - type: 'array', - items: { type: 'string' }, - description: 'List of 3-5 most important facts or insights related to the question. Return empty array if no findings.', - }, - confidence_level: { - type: 'string', - description: 'Confidence level of the answer as \'High\', \'Medium\', or \'Low\' based on source quality and consistency.', - }, - last_updated_date: { - type: 'string', - description: 'Most recent date of information found in YYYY-MM-DD format. If unavailable, return \'Unknown\'.', + default: JSON.stringify( + { + type: 'object', + properties: { + answer: { + type: 'string', + description: + "Direct factual answer to the user question based on web research. If unavailable, return 'Information not found'.", + }, + key_findings: { + type: 'array', + items: { type: 'string' }, + description: + 'List of 3-5 most important facts or insights related to the question. Return empty array if no findings.', + }, + confidence_level: { + type: 'string', + description: + "Confidence level of the answer as 'High', 'Medium', or 'Low' based on source quality and consistency.", + }, + last_updated_date: { + type: 'string', + description: + "Most recent date of information found in YYYY-MM-DD format. If unavailable, return 'Unknown'.", + }, }, + required: ['answer', 'key_findings', 'confidence_level', 'last_updated_date'], + additionalProperties: false, }, - required: ['answer', 'key_findings', 'confidence_level', 'last_updated_date'], - additionalProperties: false, - }, null, 2), + null, + 2, + ), description: 'JSON schema defining the structure of the expected response', }, { @@ -639,7 +657,7 @@ export class Parallel implements INodeType { }, default: '', placeholder: 'You are a helpful assistant that provides accurate information...', - description: 'Optional system prompt to define the AI\'s behavior and role', + description: "Optional system prompt to define the AI's behavior and role", }, ], }, @@ -677,7 +695,8 @@ export class Parallel implements INodeType { }, default: '', placeholder: 'Track funding announcements for AI startups', - description: 'What to monitor - natural language description of the events to track on the web', + description: + 'What to monitor - natural language description of the events to track on the web', }, { displayName: 'Task Run ID', @@ -782,7 +801,8 @@ export class Parallel implements INodeType { monitorOutputSchemaType: ['json'], }, }, - default: '{\n "type": "object",\n "properties": {\n "company_name": {\n "type": "string",\n "description": "Company name"\n },\n "event_summary": {\n "type": "string",\n "description": "Brief summary of the event"\n },\n "sentiment": {\n "type": "string",\n "description": "Sentiment: positive, negative, or neutral"\n }\n }\n}', + default: + '{\n "type": "object",\n "properties": {\n "company_name": {\n "type": "string",\n "description": "Company name"\n },\n "event_summary": {\n "type": "string",\n "description": "Brief summary of the event"\n },\n "sentiment": {\n "type": "string",\n "description": "Sentiment: positive, negative, or neutral"\n }\n }\n}', description: 'JSON schema defining the structure of monitor event outputs', }, { @@ -797,7 +817,8 @@ export class Parallel implements INodeType { }, default: '', placeholder: 'https://your-n8n-instance.com/webhook/parallel-monitor-event', - description: 'Webhook URL to receive notifications when events are detected. Use the URL from a Parallel Monitor Event Trigger node.', + description: + 'Webhook URL to receive notifications when events are detected. Use the URL from a Parallel Monitor Event Trigger node.', }, { displayName: 'Webhook Event Types', @@ -888,7 +909,14 @@ export class Parallel implements INodeType { displayOptions: { show: { resource: ['monitor'], - monitorOperation: ['getMonitor', 'updateMonitor', 'deleteMonitor', 'listMonitorEvents', 'getMonitorEventGroup', 'triggerMonitor'], + monitorOperation: [ + 'getMonitor', + 'updateMonitor', + 'deleteMonitor', + 'listMonitorEvents', + 'getMonitorEventGroup', + 'triggerMonitor', + ], }, }, default: '', @@ -1171,9 +1199,13 @@ export class Parallel implements INodeType { result = await operations.triggerMonitor.execute(this, i); break; default: - throw new NodeOperationError(this.getNode(), `Unknown monitor operation: ${monitorOperation}`, { - itemIndex: i, - }); + throw new NodeOperationError( + this.getNode(), + `Unknown monitor operation: ${monitorOperation}`, + { + itemIndex: i, + }, + ); } } else { const operation = this.getNodeParameter('operation', i) as string; diff --git a/nodes/Parallel/actions/asyncWebEnrichment.operation.ts b/nodes/Parallel/actions/asyncWebEnrichment.operation.ts index 84d01ea..06067d1 100644 --- a/nodes/Parallel/actions/asyncWebEnrichment.operation.ts +++ b/nodes/Parallel/actions/asyncWebEnrichment.operation.ts @@ -1,8 +1,4 @@ -import type { - IExecuteFunctions, - IDataObject, - INodePropertyOptions, -} from 'n8n-workflow'; +import type { IExecuteFunctions, IDataObject, INodePropertyOptions } from 'n8n-workflow'; import { NodeOperationError } from 'n8n-workflow'; import { assertTaskOutputSchemaCompatibility } from '../contracts/requests'; import { parallelApiRequest } from '../transport/ParallelApi'; @@ -11,7 +7,8 @@ import { buildSourcePolicy, buildMetadata } from '../utils'; export const description: INodePropertyOptions = { name: 'Async Web Enrichment', value: 'asyncWebEnrichment', - description: 'Create a Task with the Parallel Task API and retrieve its Run ID for async retrieval', + description: + 'Create a Task with the Parallel Task API and retrieve its Run ID for async retrieval', action: 'Async Web Enrichment', }; @@ -72,7 +69,10 @@ export async function execute( type: 'text', }; } else if (outputSchemaType === 'json') { - const jsonSchemaString = executeFunctions.getNodeParameter('asyncOutputJsonSchema', itemIndex) as string; + const jsonSchemaString = executeFunctions.getNodeParameter( + 'asyncOutputJsonSchema', + itemIndex, + ) as string; try { const jsonSchema = JSON.parse(jsonSchemaString); taskSpec.output_schema = { @@ -134,7 +134,8 @@ export async function execute( if (webhookUrl) { result.webhook_configured = true; result.webhook_url = webhookUrl; - result.message = 'Task started successfully with webhook notifications. You will receive a webhook call when the task completes.'; + result.message = + 'Task started successfully with webhook notifications. You will receive a webhook call when the task completes.'; } else { result.webhook_configured = false; } diff --git a/nodes/Parallel/actions/createMonitor.operation.ts b/nodes/Parallel/actions/createMonitor.operation.ts index 4edcc31..c00a05c 100644 --- a/nodes/Parallel/actions/createMonitor.operation.ts +++ b/nodes/Parallel/actions/createMonitor.operation.ts @@ -1,8 +1,4 @@ -import type { - IExecuteFunctions, - IDataObject, - INodePropertyOptions, -} from 'n8n-workflow'; +import type { IExecuteFunctions, IDataObject, INodePropertyOptions } from 'n8n-workflow'; import { NodeOperationError } from 'n8n-workflow'; import { buildMonitorCreateRequest, type MonitorType } from '../contracts/requests'; import { parallelApiRequest } from '../transport/ParallelApi'; @@ -11,7 +7,8 @@ import { buildMetadata } from '../utils'; export const description: INodePropertyOptions = { name: 'Create Monitor', value: 'createMonitor', - description: 'Create a new web monitor that continuously tracks the web for changes on a schedule', + description: + 'Create a new web monitor that continuously tracks the web for changes on a schedule', action: 'Create a monitor', }; @@ -21,26 +18,49 @@ export async function execute( ): Promise { const query = executeFunctions.getNodeParameter('monitorQuery', itemIndex) as string; const cadence = executeFunctions.getNodeParameter('monitorCadence', itemIndex) as string; - const type = executeFunctions.getNodeParameter('monitorType', itemIndex, 'event_stream') as MonitorType; + const type = executeFunctions.getNodeParameter( + 'monitorType', + itemIndex, + 'event_stream', + ) as MonitorType; const taskRunId = executeFunctions.getNodeParameter('monitorTaskRunId', itemIndex, '') as string; - const processor = executeFunctions.getNodeParameter('monitorProcessor', itemIndex, 'lite') as string; + const processor = executeFunctions.getNodeParameter( + 'monitorProcessor', + itemIndex, + 'lite', + ) as string; // Webhook URL - const webhookUrl = executeFunctions.getNodeParameter('monitorWebhookUrl', itemIndex, '') as string; + const webhookUrl = executeFunctions.getNodeParameter( + 'monitorWebhookUrl', + itemIndex, + '', + ) as string; const eventTypes = webhookUrl ? (executeFunctions.getNodeParameter('monitorWebhookEventTypes', itemIndex, []) as string[]) : undefined; // Output schema - const outputSchemaType = executeFunctions.getNodeParameter('monitorOutputSchemaType', itemIndex, 'text') as string; + const outputSchemaType = executeFunctions.getNodeParameter( + 'monitorOutputSchemaType', + itemIndex, + 'text', + ) as string; let outputSchema: IDataObject | undefined; if (type === 'event_stream' && outputSchemaType === 'json') { - const jsonSchemaStr = executeFunctions.getNodeParameter('monitorOutputJsonSchema', itemIndex) as string; + const jsonSchemaStr = executeFunctions.getNodeParameter( + 'monitorOutputJsonSchema', + itemIndex, + ) as string; let jsonSchema: IDataObject; try { jsonSchema = typeof jsonSchemaStr === 'string' ? JSON.parse(jsonSchemaStr) : jsonSchemaStr; } catch { - throw new NodeOperationError(executeFunctions.getNode(), 'Invalid JSON schema for monitor output. Please provide valid JSON.', { itemIndex }); + throw new NodeOperationError( + executeFunctions.getNode(), + 'Invalid JSON schema for monitor output. Please provide valid JSON.', + { itemIndex }, + ); } outputSchema = { type: 'json', @@ -49,7 +69,11 @@ export async function execute( } // Metadata - const additionalFields = executeFunctions.getNodeParameter('monitorAdditionalFields', itemIndex, {}) as IDataObject; + const additionalFields = executeFunctions.getNodeParameter( + 'monitorAdditionalFields', + itemIndex, + {}, + ) as IDataObject; const metadata = buildMetadata(additionalFields); let body: IDataObject; try { diff --git a/nodes/Parallel/actions/deleteMonitor.operation.ts b/nodes/Parallel/actions/deleteMonitor.operation.ts index 273a807..4795061 100644 --- a/nodes/Parallel/actions/deleteMonitor.operation.ts +++ b/nodes/Parallel/actions/deleteMonitor.operation.ts @@ -1,8 +1,4 @@ -import type { - IExecuteFunctions, - IDataObject, - INodePropertyOptions, -} from 'n8n-workflow'; +import type { IExecuteFunctions, IDataObject, INodePropertyOptions } from 'n8n-workflow'; import { parallelApiRequest } from '../transport/ParallelApi'; export const description: INodePropertyOptions = { diff --git a/nodes/Parallel/actions/getMonitor.operation.ts b/nodes/Parallel/actions/getMonitor.operation.ts index 1d76395..5dbc3ac 100644 --- a/nodes/Parallel/actions/getMonitor.operation.ts +++ b/nodes/Parallel/actions/getMonitor.operation.ts @@ -1,8 +1,4 @@ -import type { - IExecuteFunctions, - IDataObject, - INodePropertyOptions, -} from 'n8n-workflow'; +import type { IExecuteFunctions, IDataObject, INodePropertyOptions } from 'n8n-workflow'; import { parallelApiRequest } from '../transport/ParallelApi'; export const description: INodePropertyOptions = { diff --git a/nodes/Parallel/actions/getMonitorEventGroup.operation.ts b/nodes/Parallel/actions/getMonitorEventGroup.operation.ts index 6ad0d4e..95bb0d1 100644 --- a/nodes/Parallel/actions/getMonitorEventGroup.operation.ts +++ b/nodes/Parallel/actions/getMonitorEventGroup.operation.ts @@ -1,8 +1,4 @@ -import type { - IExecuteFunctions, - IDataObject, - INodePropertyOptions, -} from 'n8n-workflow'; +import type { IExecuteFunctions, IDataObject, INodePropertyOptions } from 'n8n-workflow'; import { parallelApiRequest } from '../transport/ParallelApi'; export const description: INodePropertyOptions = { diff --git a/nodes/Parallel/actions/getTaskRun.operation.ts b/nodes/Parallel/actions/getTaskRun.operation.ts index 1779dd0..53f2aa0 100644 --- a/nodes/Parallel/actions/getTaskRun.operation.ts +++ b/nodes/Parallel/actions/getTaskRun.operation.ts @@ -1,8 +1,4 @@ -import type { - IExecuteFunctions, - IDataObject, - INodePropertyOptions, -} from 'n8n-workflow'; +import type { IExecuteFunctions, IDataObject, INodePropertyOptions } from 'n8n-workflow'; import { parallelApiRequest } from '../transport/ParallelApi'; export const description: INodePropertyOptions = { diff --git a/nodes/Parallel/actions/getTaskRunResult.operation.ts b/nodes/Parallel/actions/getTaskRunResult.operation.ts index d8a7dcd..74ce5ec 100644 --- a/nodes/Parallel/actions/getTaskRunResult.operation.ts +++ b/nodes/Parallel/actions/getTaskRunResult.operation.ts @@ -1,8 +1,4 @@ -import type { - IExecuteFunctions, - IDataObject, - INodePropertyOptions, -} from 'n8n-workflow'; +import type { IExecuteFunctions, IDataObject, INodePropertyOptions } from 'n8n-workflow'; import { parallelApiRequest } from '../transport/ParallelApi'; export const description: INodePropertyOptions = { diff --git a/nodes/Parallel/actions/listMonitorEvents.operation.ts b/nodes/Parallel/actions/listMonitorEvents.operation.ts index 396a966..beb3aee 100644 --- a/nodes/Parallel/actions/listMonitorEvents.operation.ts +++ b/nodes/Parallel/actions/listMonitorEvents.operation.ts @@ -1,8 +1,4 @@ -import type { - IExecuteFunctions, - IDataObject, - INodePropertyOptions, -} from 'n8n-workflow'; +import type { IExecuteFunctions, IDataObject, INodePropertyOptions } from 'n8n-workflow'; import { parallelApiRequest } from '../transport/ParallelApi'; import { buildMonitorEventsQuery } from '../contracts/requests'; @@ -18,7 +14,11 @@ export async function execute( itemIndex: number, ): Promise { const monitorId = executeFunctions.getNodeParameter('monitorId', itemIndex) as string; - const additionalFields = executeFunctions.getNodeParameter('monitorEventsAdditionalFields', itemIndex, {}) as IDataObject; + const additionalFields = executeFunctions.getNodeParameter( + 'monitorEventsAdditionalFields', + itemIndex, + {}, + ) as IDataObject; return await parallelApiRequest( executeFunctions, diff --git a/nodes/Parallel/actions/listMonitors.operation.ts b/nodes/Parallel/actions/listMonitors.operation.ts index 99382e6..e82801a 100644 --- a/nodes/Parallel/actions/listMonitors.operation.ts +++ b/nodes/Parallel/actions/listMonitors.operation.ts @@ -1,8 +1,4 @@ -import type { - IExecuteFunctions, - IDataObject, - INodePropertyOptions, -} from 'n8n-workflow'; +import type { IExecuteFunctions, IDataObject, INodePropertyOptions } from 'n8n-workflow'; import { parallelApiRequest } from '../transport/ParallelApi'; export const description: INodePropertyOptions = { @@ -16,7 +12,11 @@ export async function execute( executeFunctions: IExecuteFunctions, itemIndex: number, ): Promise { - const additionalFields = executeFunctions.getNodeParameter('listMonitorsAdditionalFields', itemIndex, {}) as IDataObject; + const additionalFields = executeFunctions.getNodeParameter( + 'listMonitorsAdditionalFields', + itemIndex, + {}, + ) as IDataObject; const query: IDataObject = {}; if (additionalFields.limit) { diff --git a/nodes/Parallel/actions/triggerMonitor.operation.ts b/nodes/Parallel/actions/triggerMonitor.operation.ts index cc0618a..f54bef0 100644 --- a/nodes/Parallel/actions/triggerMonitor.operation.ts +++ b/nodes/Parallel/actions/triggerMonitor.operation.ts @@ -1,8 +1,4 @@ -import type { - IExecuteFunctions, - IDataObject, - INodePropertyOptions, -} from 'n8n-workflow'; +import type { IExecuteFunctions, IDataObject, INodePropertyOptions } from 'n8n-workflow'; import { parallelApiRequest } from '../transport/ParallelApi'; export const description: INodePropertyOptions = { diff --git a/nodes/Parallel/actions/updateMonitor.operation.ts b/nodes/Parallel/actions/updateMonitor.operation.ts index 5beae7e..4437c49 100644 --- a/nodes/Parallel/actions/updateMonitor.operation.ts +++ b/nodes/Parallel/actions/updateMonitor.operation.ts @@ -1,8 +1,4 @@ -import type { - IExecuteFunctions, - IDataObject, - INodePropertyOptions, -} from 'n8n-workflow'; +import type { IExecuteFunctions, IDataObject, INodePropertyOptions } from 'n8n-workflow'; import { NodeOperationError } from 'n8n-workflow'; import { buildMonitorUpdateRequest } from '../contracts/requests'; import { parallelApiRequest } from '../transport/ParallelApi'; @@ -11,7 +7,7 @@ import { buildMetadata } from '../utils'; export const description: INodePropertyOptions = { name: 'Update Monitor', value: 'updateMonitor', - description: 'Update an existing monitor\'s query, cadence, webhook, or metadata', + description: "Update an existing monitor's query, cadence, webhook, or metadata", action: 'Update a monitor', }; @@ -20,7 +16,11 @@ export async function execute( itemIndex: number, ): Promise { const monitorId = executeFunctions.getNodeParameter('monitorId', itemIndex) as string; - const updateFields = executeFunctions.getNodeParameter('monitorUpdateFields', itemIndex, {}) as IDataObject; + const updateFields = executeFunctions.getNodeParameter( + 'monitorUpdateFields', + itemIndex, + {}, + ) as IDataObject; const metadata = buildMetadata(updateFields); let body: IDataObject; diff --git a/nodes/Parallel/actions/webChat.operation.ts b/nodes/Parallel/actions/webChat.operation.ts index 7a76615..d9cd0d7 100644 --- a/nodes/Parallel/actions/webChat.operation.ts +++ b/nodes/Parallel/actions/webChat.operation.ts @@ -1,8 +1,4 @@ -import type { - IExecuteFunctions, - IDataObject, - INodePropertyOptions, -} from 'n8n-workflow'; +import type { IExecuteFunctions, IDataObject, INodePropertyOptions } from 'n8n-workflow'; import { NodeOperationError } from 'n8n-workflow'; import { parallelApiRequest } from '../transport/ParallelApi'; @@ -19,8 +15,15 @@ export async function execute( ): Promise { const inputPrompt = executeFunctions.getNodeParameter('chatInputPrompt', itemIndex) as string; const model = executeFunctions.getNodeParameter('chatModel', itemIndex, 'speed') as string; - const responseFormat = executeFunctions.getNodeParameter('chatResponseFormat', itemIndex) as string; - const additionalOptions = executeFunctions.getNodeParameter('chatAdditionalOptions', itemIndex, {}) as IDataObject; + const responseFormat = executeFunctions.getNodeParameter( + 'chatResponseFormat', + itemIndex, + ) as string; + const additionalOptions = executeFunctions.getNodeParameter( + 'chatAdditionalOptions', + itemIndex, + {}, + ) as IDataObject; // Build messages array const messages: IDataObject[] = []; @@ -48,13 +51,19 @@ export async function execute( // Add response format if JSON is selected if (responseFormat === 'json') { - const jsonSchemaName = executeFunctions.getNodeParameter('chatJsonSchemaName', itemIndex) as string; + const jsonSchemaName = executeFunctions.getNodeParameter( + 'chatJsonSchemaName', + itemIndex, + ) as string; if (!jsonSchemaName.trim()) { throw new NodeOperationError(executeFunctions.getNode(), 'JSON schema name is required.', { itemIndex, }); } - const jsonSchemaString = executeFunctions.getNodeParameter('chatJsonSchema', itemIndex) as string; + const jsonSchemaString = executeFunctions.getNodeParameter( + 'chatJsonSchema', + itemIndex, + ) as string; try { const jsonSchema = JSON.parse(jsonSchemaString); diff --git a/nodes/Parallel/actions/webEnrichment.operation.ts b/nodes/Parallel/actions/webEnrichment.operation.ts index 51531a3..9172ba8 100644 --- a/nodes/Parallel/actions/webEnrichment.operation.ts +++ b/nodes/Parallel/actions/webEnrichment.operation.ts @@ -1,11 +1,13 @@ -import type { - IExecuteFunctions, - IDataObject, - INodePropertyOptions, -} from 'n8n-workflow'; +import type { IExecuteFunctions, IDataObject, INodePropertyOptions } from 'n8n-workflow'; import { NodeOperationError } from 'n8n-workflow'; import { getErrorStatusCode, parallelApiRequest } from '../transport/ParallelApi'; -import { buildSourcePolicy, buildMetadata, wait, calculateBackoffDelay, isRetryableError } from '../utils'; +import { + buildSourcePolicy, + buildMetadata, + wait, + calculateBackoffDelay, + isRetryableError, +} from '../utils'; export const description: INodePropertyOptions = { name: 'Sync Web Enrichment', @@ -61,7 +63,10 @@ export async function execute( type: 'text', }; } else if (outputSchemaType === 'json') { - const jsonSchemaString = executeFunctions.getNodeParameter('syncOutputJsonSchema', itemIndex) as string; + const jsonSchemaString = executeFunctions.getNodeParameter( + 'syncOutputJsonSchema', + itemIndex, + ) as string; try { const jsonSchema = JSON.parse(jsonSchemaString); taskSpec.output_schema = { @@ -82,10 +87,17 @@ export async function execute( let textDescription = ''; if (inputType === 'json') { // Required description when input is JSON - textDescription = executeFunctions.getNodeParameter('textOutputDescriptionRequired', itemIndex) as string; + textDescription = executeFunctions.getNodeParameter( + 'textOutputDescriptionRequired', + itemIndex, + ) as string; } else { // Optional description when input is text - const optionalDescription = executeFunctions.getNodeParameter('textOutputDescription', itemIndex, '') as string; + const optionalDescription = executeFunctions.getNodeParameter( + 'textOutputDescription', + itemIndex, + '', + ) as string; if (optionalDescription) { textDescription = optionalDescription; } @@ -93,7 +105,11 @@ export async function execute( // If we have a text description, modify the task spec to include it if (textDescription) { - if (taskSpec.output_schema && typeof taskSpec.output_schema === 'object' && (taskSpec.output_schema as IDataObject).type === 'text') { + if ( + taskSpec.output_schema && + typeof taskSpec.output_schema === 'object' && + (taskSpec.output_schema as IDataObject).type === 'text' + ) { // Add description to existing text schema (taskSpec.output_schema as IDataObject).description = textDescription; } else { diff --git a/nodes/Parallel/actions/webSearch.operation.ts b/nodes/Parallel/actions/webSearch.operation.ts index 363e233..8571b53 100644 --- a/nodes/Parallel/actions/webSearch.operation.ts +++ b/nodes/Parallel/actions/webSearch.operation.ts @@ -1,8 +1,4 @@ -import type { - IExecuteFunctions, - IDataObject, - INodePropertyOptions, -} from 'n8n-workflow'; +import type { IExecuteFunctions, IDataObject, INodePropertyOptions } from 'n8n-workflow'; import { NodeOperationError } from 'n8n-workflow'; import { buildSearchRequest } from '../contracts/requests'; import { parallelApiRequest } from '../transport/ParallelApi'; @@ -10,7 +6,8 @@ import { parallelApiRequest } from '../transport/ParallelApi'; export const description: INodePropertyOptions = { name: 'Web Search', value: 'webSearch', - description: 'Search the web with the Parallel Search API and retrieve a list of results with excerpts', + description: + 'Search the web with the Parallel Search API and retrieve a list of results with excerpts', action: 'Web Search', }; diff --git a/nodes/Parallel/utils/index.ts b/nodes/Parallel/utils/index.ts index ded15ff..6ba61ea 100644 --- a/nodes/Parallel/utils/index.ts +++ b/nodes/Parallel/utils/index.ts @@ -61,7 +61,11 @@ export function wait(ms: number): Promise { /** * Calculates exponential backoff delay with jitter */ -export function calculateBackoffDelay(attempt: number, baseDelay: number = 2000, maxDelay: number = 60000): number { +export function calculateBackoffDelay( + attempt: number, + baseDelay: number = 2000, + maxDelay: number = 60000, +): number { // Calculate exponential backoff delay (base 2 seconds, max 60 seconds) const delay = Math.min(baseDelay * Math.pow(2, attempt - 1), maxDelay); diff --git a/nodes/ParallelMonitorTrigger/ParallelMonitorTrigger.node.ts b/nodes/ParallelMonitorTrigger/ParallelMonitorTrigger.node.ts index e07d27f..e040052 100644 --- a/nodes/ParallelMonitorTrigger/ParallelMonitorTrigger.node.ts +++ b/nodes/ParallelMonitorTrigger/ParallelMonitorTrigger.node.ts @@ -49,7 +49,8 @@ export class ParallelMonitorTrigger implements INodeType { group: ['trigger'], version: 1, subtitle: '={{$parameter["eventTypeFilter"].join(", ")}}', - description: 'Triggers when a Parallel Monitor detects events, completes an execution, or encounters an error', + description: + 'Triggers when a Parallel Monitor detects events, completes an execution, or encounters an error', defaults: { name: 'Parallel Monitor Event', }, @@ -75,7 +76,8 @@ export class ParallelMonitorTrigger implements INodeType { name: 'webhookUrl', type: 'notice', default: '', - description: 'Use the webhook URL that n8n provides for this trigger node when creating or updating your Parallel monitor', + description: + 'Use the webhook URL that n8n provides for this trigger node when creating or updating your Parallel monitor', }, { displayName: 'Event Types', @@ -113,7 +115,8 @@ export class ParallelMonitorTrigger implements INodeType { name: 'validateSignatures', type: 'boolean', default: true, - description: 'Whether to validate the exact request body using the configured webhook secret', + description: + 'Whether to validate the exact request body using the configured webhook secret', }, { displayName: 'Include Webhook Data', diff --git a/nodes/ParallelTrigger/ParallelTrigger.node.ts b/nodes/ParallelTrigger/ParallelTrigger.node.ts index 7cee2ad..8f15089 100644 --- a/nodes/ParallelTrigger/ParallelTrigger.node.ts +++ b/nodes/ParallelTrigger/ParallelTrigger.node.ts @@ -75,14 +75,16 @@ export class ParallelTrigger implements INodeType { name: 'webhookUrl', type: 'notice', default: '', - description: 'Use the webhook URL that n8n provides for this trigger node when configuring your Parallel task webhook', + description: + 'Use the webhook URL that n8n provides for this trigger node when configuring your Parallel task webhook', }, { displayName: 'Validate Webhook Signatures', name: 'validateSignatures', type: 'boolean', default: true, - description: 'Whether to validate the exact request body using the configured webhook secret', + description: + 'Whether to validate the exact request body using the configured webhook secret', }, { displayName: 'Only Trigger on Successful Tasks', diff --git a/package.json b/package.json index e1a27b3..9e9234f 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "scripts": { "build": "n8n-node build", "dev": "n8n-node dev", - "format": "prettier --write", + "format": "prettier --write .", + "format:check": "prettier --check .", "lint": "n8n-node lint", "lintfix": "n8n-node lint --fix", "typecheck": "tsc --noEmit --incremental false",