Compare commits

...
Sign in to create a new pull request.

11 commits

Author SHA1 Message Date
Steven Milanese
c9eff5c665 Only get param if 2025-03-08 02:55:41 -05:00
Steven Milanese
745e563952 1.0.5 2025-03-08 01:49:44 -05:00
Steven Milanese
8c6c37c5e6 copy-assets.js 2025-03-08 01:49:33 -05:00
Steven Milanese
ca408074d2 1.0.4 2025-03-08 01:33:01 -05:00
Steven Milanese
d5998f44db cp svg in package.json 2025-03-08 01:31:48 -05:00
Steven Milanese
c53def8e0e 1.0.3 2025-03-07 22:44:23 -05:00
Steven Milanese
7a1a22aa50 chore: replaced svg 2025-03-07 22:44:11 -05:00
Steven Milanese
6762ff6882 1.0.2 2025-03-07 16:24:28 -05:00
Steven Milanese
c307b18824 Add untracked files 2025-03-07 16:24:12 -05:00
Steven Milanese
0abfc2d5f0 1.0.1 2025-03-07 05:26:48 -05:00
Steven Milanese
eeba6180fd Update README.md and package.json n8n-nodes-tavilyapi 2025-03-07 05:26:14 -05:00
5 changed files with 45 additions and 16 deletions

View file

@ -1,6 +1,6 @@
# n8n-tavily-nodes
# n8n-nodes-tavilyapi
**n8n-tavily-nodes** is an n8n community node package that integrates the [Tavily API](https://api.tavily.com) for powerful **web search** and **content extraction**.
**n8n-nodes-tavilyapi** is an n8n community node package that integrates the [Tavily API](https://api.tavily.com) for powerful **web search** and **content extraction**.
It contains two nodes:
@ -51,7 +51,7 @@ It contains two nodes:
1. From your n8n root directory, run:
```bash
npm install n8n-tavily-nodes
npm install n8n-nodes-tavilyapi
```
2. Restart n8n.

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "n8n-tavily-nodes",
"version": "1.0.0",
"version": "1.0.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "n8n-tavily-nodes",
"version": "1.0.0",
"version": "1.0.5",
"license": "MIT",
"dependencies": {
"axios": "^1.6.0",

View file

@ -1,12 +1,12 @@
{
"name": "n8n-tavily-nodes",
"version": "1.0.0",
"name": "n8n-nodes-tavilyapi",
"version": "1.0.5",
"description": "n8n Community Nodes for Tavily API integration",
"author": "Steven Milanese <dev@levelai.xyz> (https://StevenMilanese.com)",
"license": "MIT",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"build": "tsc && node copy-assets.js",
"prepublishOnly": "npm run build"
},
"keywords": [

View file

@ -6,11 +6,9 @@ import {
INodeTypeDescription,
INodeProperties,
} from 'n8n-workflow';
// REMOVED import { IExecuteFunctions } from 'n8n-core';
import { tavilyApiRequest } from './tavilyApi.utils';
// For older n8n usage, ALLOWED_TIME_RANGES is fine here
const ALLOWED_TIME_RANGES = ['', 'day', 'week', 'month', 'year', 'd', 'w', 'm', 'y'];
export class TavilySearch implements INodeType {
@ -217,11 +215,15 @@ export class TavilySearch implements INodeType {
const searchDepth = this.getNodeParameter('searchDepth', i) as string;
const maxResults = this.getNodeParameter('maxResults', i) as number;
const timeRange = this.getNodeParameter('timeRange', i) as string;
const days = this.getNodeParameter('days', i) as number;
const includeAnswer = this.getNodeParameter('includeAnswer', i) as string;
const includeRawContent = this.getNodeParameter('includeRawContent', i) as boolean;
const includeImages = this.getNodeParameter('includeImages', i) as boolean;
const includeImageDescriptions = this.getNodeParameter('includeImageDescriptions', i) as boolean;
let includeImageDescriptions = false;
if (includeImages) {
includeImageDescriptions = this.getNodeParameter('includeImageDescriptions', i) as boolean;
}
const includeDomains = this.getNodeParameter('includeDomains', i, []) as string[];
const excludeDomains = this.getNodeParameter('excludeDomains', i, []) as string[];
@ -237,9 +239,6 @@ export class TavilySearch implements INodeType {
message: `Invalid timeRange value. Allowed: ${ALLOWED_TIME_RANGES.join(', ')}`,
});
}
if (topic === 'news' && days < 0) {
throw new NodeApiError(this.getNode(), { message: 'Days must be >= 0 when topic is "news".' });
}
const body: Record<string, any> = {
query,
@ -254,9 +253,16 @@ export class TavilySearch implements INodeType {
if (timeRange) {
body.time_range = timeRange;
}
// Only get and add days parameter when topic is news
if (topic === 'news') {
const days = this.getNodeParameter('days', i) as number;
if (days < 0) {
throw new NodeApiError(this.getNode(), { message: 'Days must be >= 0 when topic is "news".' });
}
body.days = days;
}
if (includeAnswer !== 'false') {
body.include_answer = includeAnswer;
}
@ -286,4 +292,4 @@ export class TavilySearch implements INodeType {
return [returnData];
}
}
}

View file

@ -0,0 +1,23 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<!-- Background -->
<circle cx="12" cy="12" r="11" fill="#ffffff" stroke="#4a86e8" stroke-width="1" />
<!-- Magnifying glass with light fill -->
<circle cx="10" cy="10" r="4.5" fill="#e6f0ff" stroke="#4a86e8" stroke-width="1.8" />
<line x1="13" y1="13" x2="18" y2="18" stroke="#4a86e8" stroke-width="1.8" stroke-linecap="round" />
<!-- Small document icons representing search results -->
<rect x="14" y="8" width="4" height="5" rx="0.7" fill="#e6f0ff" stroke="#4a86e8" stroke-width="0.8" />
<rect x="7" y="15" width="4" height="5" rx="0.7" fill="#e6f0ff" stroke="#4a86e8" stroke-width="0.8" />
<rect x="13" y="15" width="4" height="5" rx="0.7" fill="#e6f0ff" stroke="#4a86e8" stroke-width="0.8" />
<!-- Simple text lines inside documents -->
<line x1="15" y1="9.5" x2="17" y2="9.5" stroke="#4a86e8" stroke-width="0.7" />
<line x1="15" y1="11" x2="17" y2="11" stroke="#4a86e8" stroke-width="0.7" />
<line x1="8" y1="16.5" x2="10" y2="16.5" stroke="#4a86e8" stroke-width="0.7" />
<line x1="8" y1="18" x2="10" y2="18" stroke="#4a86e8" stroke-width="0.7" />
<line x1="14" y1="16.5" x2="16" y2="16.5" stroke="#4a86e8" stroke-width="0.7" />
<line x1="14" y1="18" x2="16" y2="18" stroke="#4a86e8" stroke-width="0.7" />
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB