@tavily/n8n-nodes-tavily 0.1.0

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.
Files changed (53) hide show
  1. package/LICENSE.md +19 -0
  2. package/README.md +92 -0
  3. package/dist/credentials/TavilyApi.credentials.d.ts +10 -0
  4. package/dist/credentials/TavilyApi.credentials.js +48 -0
  5. package/dist/credentials/TavilyApi.credentials.js.map +1 -0
  6. package/dist/credentials/icons/img.svg +8 -0
  7. package/dist/nodes/Tavily/Tavily.node.d.ts +6 -0
  8. package/dist/nodes/Tavily/Tavily.node.js +18 -0
  9. package/dist/nodes/Tavily/Tavily.node.js.map +1 -0
  10. package/dist/nodes/Tavily/Tavily.node.json +20 -0
  11. package/dist/nodes/Tavily/actions/extract/index.d.ts +4 -0
  12. package/dist/nodes/Tavily/actions/extract/index.js +52 -0
  13. package/dist/nodes/Tavily/actions/extract/index.js.map +1 -0
  14. package/dist/nodes/Tavily/actions/extract/urls.operation.d.ts +27 -0
  15. package/dist/nodes/Tavily/actions/extract/urls.operation.js +58 -0
  16. package/dist/nodes/Tavily/actions/extract/urls.operation.js.map +1 -0
  17. package/dist/nodes/Tavily/actions/node.description.d.ts +2 -0
  18. package/dist/nodes/Tavily/actions/node.description.js +70 -0
  19. package/dist/nodes/Tavily/actions/node.description.js.map +1 -0
  20. package/dist/nodes/Tavily/actions/node.type.d.ts +7 -0
  21. package/dist/nodes/Tavily/actions/node.type.js +3 -0
  22. package/dist/nodes/Tavily/actions/node.type.js.map +1 -0
  23. package/dist/nodes/Tavily/actions/router.d.ts +2 -0
  24. package/dist/nodes/Tavily/actions/router.js +73 -0
  25. package/dist/nodes/Tavily/actions/router.js.map +1 -0
  26. package/dist/nodes/Tavily/actions/search/index.d.ts +4 -0
  27. package/dist/nodes/Tavily/actions/search/index.js +52 -0
  28. package/dist/nodes/Tavily/actions/search/index.js.map +1 -0
  29. package/dist/nodes/Tavily/actions/search/query.operation.d.ts +27 -0
  30. package/dist/nodes/Tavily/actions/search/query.operation.js +45 -0
  31. package/dist/nodes/Tavily/actions/search/query.operation.js.map +1 -0
  32. package/dist/nodes/Tavily/descriptions/common.descriptions.d.ts +7 -0
  33. package/dist/nodes/Tavily/descriptions/common.descriptions.js +216 -0
  34. package/dist/nodes/Tavily/descriptions/common.descriptions.js.map +1 -0
  35. package/dist/nodes/Tavily/descriptions/index.d.ts +1 -0
  36. package/dist/nodes/Tavily/descriptions/index.js +18 -0
  37. package/dist/nodes/Tavily/descriptions/index.js.map +1 -0
  38. package/dist/nodes/Tavily/descriptions/rlc.description.d.ts +0 -0
  39. package/dist/nodes/Tavily/descriptions/rlc.description.js +2 -0
  40. package/dist/nodes/Tavily/descriptions/rlc.description.js.map +1 -0
  41. package/dist/nodes/Tavily/display/index.d.ts +25 -0
  42. package/dist/nodes/Tavily/display/index.js +14 -0
  43. package/dist/nodes/Tavily/display/index.js.map +1 -0
  44. package/dist/nodes/Tavily/img.svg +8 -0
  45. package/dist/nodes/Tavily/methods/debugRequest.d.ts +2 -0
  46. package/dist/nodes/Tavily/methods/debugRequest.js +8 -0
  47. package/dist/nodes/Tavily/methods/debugRequest.js.map +1 -0
  48. package/dist/nodes/Tavily/transport/index.d.ts +2 -0
  49. package/dist/nodes/Tavily/transport/index.js +32 -0
  50. package/dist/nodes/Tavily/transport/index.js.map +1 -0
  51. package/dist/package.json +55 -0
  52. package/dist/tsconfig.tsbuildinfo +1 -0
  53. package/package.json +55 -0
package/LICENSE.md ADDED
@@ -0,0 +1,19 @@
1
+ Copyright 2022 n8n
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,92 @@
1
+ # @tavily/n8n-nodes-tavily
2
+
3
+ @tavily/n8n-nodes-tavily is a n8n community node package that integrates the Tavily API for powerful web search and web content extraction.
4
+
5
+ ## Features
6
+
7
+ ### Tavily Search
8
+ - Query the web with multiple filtering options (topic, time range, domain inclusion/exclusion, etc.)
9
+ - Optionally retrieve a generated answer, raw content, or images
10
+ - Support for different search depths (basic/advanced)
11
+ - Configurable number of content chunks per source
12
+
13
+ ### Tavily Extract
14
+ - Extract text and optional images from one or more URLs
15
+ - Choose between basic or advanced extraction depth
16
+ - Support for multiple URLs in a single request
17
+
18
+ ## Getting a Tavily API Key
19
+
20
+ 1. Go to the [Tavily website](https://tavily.com) and create an account
21
+ 2. Navigate to the [Tavily dashboard](https://app.tavily.com/home) to get your API key
22
+
23
+ ## Configuring Credentials in n8n
24
+
25
+ 1. In your n8n instance, go to the "Credentials" section
26
+ 2. Click "Create Credential"
27
+ 3. Search for or select "Tavily API"
28
+ 4. Enter your Tavily API key in the appropriate field
29
+ 5. Save the credential
30
+
31
+ ## Usage
32
+
33
+ ### Tavily Search
34
+
35
+ 1. Add the "Tavily" node to your n8n workflow
36
+ 2. Connect it to the preceding node in your workflow
37
+ 3. In the node's settings:
38
+ - Select your Tavily API credential
39
+ - Enter your search query
40
+ - Configure any other desired search parameters (topic, search depth, etc.)
41
+ 4. Run the workflow to execute the search
42
+
43
+ ### Tavily Extract
44
+
45
+ 1. Add the "Tavily" node to your n8n workflow
46
+ 2. Connect it to the preceding node
47
+ 3. In the node's settings:
48
+ - Select your Tavily API credential
49
+ - Enter the URLs you want to extract content from
50
+ - Configure any other extraction parameters (include images, extract depth)
51
+ 4. Run the workflow to extract the content
52
+
53
+ ## Parameters
54
+
55
+ ### Tavily Search Parameters
56
+
57
+ | Parameter | Description |
58
+ |-----------|-------------|
59
+ | Query | The search query to execute |
60
+ | Topic | The category of the search (General, News, or Finance) |
61
+ | Search Depth | The depth of the search (Basic or Advanced) |
62
+ | Chunks Per Source | Number of content chunks to retrieve from each source (1-3) |
63
+ | Max Results | Maximum number of search results to return (1-20) |
64
+ | Time Range | Time range filter for results (day, week, month, year) |
65
+ | Days (News Only) | Number of days back from the current date to include (for News topic) |
66
+ | Include Answer | Include an LLM-generated answer in the response (Basic or Advanced) |
67
+ | Include Raw Content | Include cleaned and parsed HTML content of each search result |
68
+ | Include Images | Perform an image search and include the results in the response |
69
+ | Include Image Descriptions | When including images, also add a descriptive text for each image |
70
+ | Include Domains | A list of domains to specifically include in the search results |
71
+ | Exclude Domains | A list of domains to specifically exclude from the search results |
72
+
73
+ ### Tavily Extract Parameters
74
+
75
+ | Parameter | Description |
76
+ |-----------|-------------|
77
+ | URLs | One or more URLs to extract content from |
78
+ | Include Images | Include a list of images extracted from each URL |
79
+ | Extract Depth | How deeply to parse each URL (Basic or Advanced) |
80
+
81
+ ## Troubleshooting
82
+
83
+ ### Error Codes
84
+
85
+ | Error Code | Description | Solution |
86
+ |------------|-------------|----------|
87
+ | 400 Bad Request | Invalid request parameters or unsupported values | Check all parameters and their formats |
88
+ | 401 Unauthorized | Missing or invalid API key | Verify API key or generate a new one |
89
+ | 429 Too Many Requests | Rate limit exceeded | Reduce request frequency or implement backoff |
90
+ | 432 Plan Limit Exceeded | Exceeds plan limits | Upgrade your plan via [Tavily Dashboard](https://app.tavily.com/account/plan) |
91
+ | 433 Pay-As-You-Go Limit Exceeded | Exceeds pay-as-you-go limit | Increase limit via [Tavily Dashboard](https://app.tavily.com/account/plan) |
92
+ | 500 Internal Server Error | Server-side issue | Retry request after a few minutes |
@@ -0,0 +1,10 @@
1
+ import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties, Icon } from 'n8n-workflow';
2
+ export declare class TavilyApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ icon: Icon;
7
+ properties: INodeProperties[];
8
+ authenticate: IAuthenticateGeneric;
9
+ test: ICredentialTestRequest;
10
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TavilyApi = void 0;
4
+ class TavilyApi {
5
+ constructor() {
6
+ this.name = 'tavilyApi';
7
+ this.displayName = 'Tavily API';
8
+ this.documentationUrl = 'https://docs.tavily.com/docs/welcome';
9
+ this.icon = 'file:icons/img.svg';
10
+ this.properties = [
11
+ {
12
+ displayName: 'API Key',
13
+ name: 'apiKey',
14
+ type: 'string',
15
+ typeOptions: { password: true },
16
+ description: "Tavily API key",
17
+ default: "",
18
+ },
19
+ {
20
+ displayName: 'Base URL',
21
+ name: 'baseUrl',
22
+ type: 'string',
23
+ description: "Base URL of Tavily's API",
24
+ default: 'https://api.tavily.com',
25
+ },
26
+ ];
27
+ this.authenticate = {
28
+ type: 'generic',
29
+ properties: {
30
+ headers: {
31
+ Authorization: '=Bearer {{$credentials.apiKey}}',
32
+ },
33
+ },
34
+ };
35
+ this.test = {
36
+ request: {
37
+ baseURL: 'https://api.tavily.com',
38
+ url: '/search',
39
+ method: 'POST',
40
+ body: {
41
+ query: 'Hello n8n!',
42
+ },
43
+ },
44
+ };
45
+ }
46
+ }
47
+ exports.TavilyApi = TavilyApi;
48
+ //# sourceMappingURL=TavilyApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TavilyApi.credentials.js","sourceRoot":"","sources":["../../credentials/TavilyApi.credentials.ts"],"names":[],"mappings":";;;AAUA,MAAa,SAAS;IAAtB;QACC,SAAI,GAAG,WAAW,CAAC;QACnB,gBAAW,GAAG,YAAY,CAAC;QAC3B,qBAAgB,GACf,sCAAsC,CAAC;QACxC,SAAI,GAAS,oBAAoB,CAAC;QAClC,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,WAAW,EAAE,gBAAgB;gBAC7B,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0BAA0B;gBACvC,OAAO,EAAE,wBAAwB;aACjC;SACD,CAAC;QACF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,iCAAiC;iBAChD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC7B,OAAO,EAAE;gBACR,OAAO,EAAE,wBAAwB;gBACjC,GAAG,EAAE,SAAS;gBACd,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACL,KAAK,EAAE,YAAY;iBACnB;aACD;SACD,CAAC;IACJ,CAAC;CAAA;AA1CD,8BA0CC"}
@@ -0,0 +1,8 @@
1
+ <svg width="129" height="131" viewBox="0 0 129 131" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M49.4888 2.7286L64.8466 27.0414C67.3132 30.9459 64.5074 36.0368 59.889 36.0368H53.6101V72.4472H44.5312V-0.00366211C46.4348 -0.00366211 48.3384 0.9071 49.4888 2.7286Z" fill="#8FBCFA"/>
3
+ <path d="M24.2125 27.0414L39.5706 2.7286C40.721 0.9071 42.6246 -0.00366211 44.5282 -0.00366211V72.4477C41.2759 72.2959 38.1274 73.2369 35.4493 75.1284V36.0368H29.1704C24.552 36.0368 21.7462 30.9459 24.2125 27.0414Z" fill="#468BFF"/>
4
+ <path d="M92.678 96.4642L54.6602 96.4643C56.8539 94.0082 58.154 90.8814 58.294 87.3853H128.718C128.718 89.2887 127.808 91.1923 125.986 92.3429L101.674 107.701C97.7689 110.167 92.678 107.361 92.678 102.743V96.4642Z" fill="#FDBB11"/>
5
+ <path d="M101.674 67.0698L125.987 82.4276C127.808 83.5782 128.719 85.4817 128.719 87.3852H58.292C58.4189 84.1251 57.4071 80.9101 55.4844 78.3063H92.6785V72.0274C92.6785 67.4091 97.7694 64.6033 101.674 67.0698Z" fill="#F6D785"/>
6
+ <path d="M23.9042 106.828L1.72266 129.009C3.06864 130.355 5.05861 131.057 7.1602 130.583L35.2114 124.251C39.7164 123.234 41.3323 117.65 38.0666 114.385L33.6268 109.945L50.3062 93.2106C53.8601 89.6566 53.7026 83.9659 50.2472 80.5105L23.9042 106.828Z" fill="#FF9A9D"/>
7
+ <path d="M20.7903 97.1072L37.5263 80.4337C41.0802 76.8797 46.7953 77.0551 50.2507 80.5104L23.9073 106.83L1.72565 129.012C0.379668 127.666 -0.322315 125.676 0.152082 123.574L6.48414 95.5226C7.50105 91.0176 13.0848 89.4017 16.3505 92.6674L20.7903 97.1072Z" fill="#FE363B"/>
8
+ </svg>
@@ -0,0 +1,6 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription, INodeTypeBaseDescription } from 'n8n-workflow';
2
+ export declare class Tavily implements INodeType {
3
+ description: INodeTypeDescription;
4
+ constructor(baseDescription: INodeTypeBaseDescription);
5
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
6
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tavily = void 0;
4
+ const node_description_1 = require("./actions/node.description");
5
+ const router_1 = require("./actions/router");
6
+ class Tavily {
7
+ constructor(baseDescription) {
8
+ this.description = {
9
+ ...baseDescription,
10
+ ...node_description_1.description,
11
+ };
12
+ }
13
+ async execute() {
14
+ return await router_1.router.call(this);
15
+ }
16
+ }
17
+ exports.Tavily = Tavily;
18
+ //# sourceMappingURL=Tavily.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tavily.node.js","sourceRoot":"","sources":["../../../nodes/Tavily/Tavily.node.ts"],"names":[],"mappings":";;;AAUA,iEAAyD;AACzD,6CAA0C;AAG1C,MAAa,MAAM;IAGlB,YAAY,eAAyC;QACpD,IAAI,CAAC,WAAW,GAAG;YAClB,GAAG,eAAe;YAClB,GAAG,8BAAW;SACd,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,OAAO,MAAM,eAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACD;AAbD,wBAaC"}
@@ -0,0 +1,20 @@
1
+ {
2
+ "node": "n8n-nodes-base.Tavily",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": [
6
+ "Miscellaneous"
7
+ ],
8
+ "resources": {
9
+ "credentialDocumentation": [
10
+ {
11
+ "url": "https://docs.tavily.com/api-reference/introduction"
12
+ }
13
+ ],
14
+ "primaryDocumentation": [
15
+ {
16
+ "url": "https://docs.tavily.com/welcome"
17
+ }
18
+ ]
19
+ }
20
+ }
@@ -0,0 +1,4 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ import * as urls from './urls.operation';
3
+ export { urls };
4
+ export declare const description: INodeProperties[];
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.description = exports.urls = void 0;
27
+ const urls = __importStar(require("./urls.operation"));
28
+ exports.urls = urls;
29
+ exports.description = [
30
+ {
31
+ displayName: 'Operation',
32
+ name: 'operation',
33
+ type: 'options',
34
+ noDataExpression: true,
35
+ displayOptions: {
36
+ show: {
37
+ resource: ['extract'],
38
+ },
39
+ },
40
+ options: [
41
+ {
42
+ name: 'URLs',
43
+ value: 'urls',
44
+ description: "Extract raw content from URLs",
45
+ action: 'Extract',
46
+ },
47
+ ],
48
+ default: 'urls',
49
+ },
50
+ ...urls.description,
51
+ ];
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Tavily/actions/extract/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,uDAAyC;AAGhC,oBAAI;AAEA,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,SAAS,CAAC;aACrB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,MAAM;gBACb,WAAW,EAAE,+BAA+B;gBAC5C,MAAM,EAAE,SAAS;aACjB;SACD;QACD,OAAO,EAAE,MAAM;KACf;IACD,GAAG,IAAI,CAAC,WAAW;CACnB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
+ export declare const properties: INodeProperties[];
3
+ export declare const description: {
4
+ displayOptions: import("n8n-workflow").IDisplayOptions;
5
+ displayName: string;
6
+ name: string;
7
+ type: import("n8n-workflow").NodePropertyTypes;
8
+ typeOptions?: import("n8n-workflow").INodePropertyTypeOptions | undefined;
9
+ default: import("n8n-workflow").NodeParameterValueType;
10
+ description?: string | undefined;
11
+ hint?: string | undefined;
12
+ disabledOptions?: import("n8n-workflow").IDisplayOptions | undefined;
13
+ options?: (INodeProperties | import("n8n-workflow").INodePropertyOptions | import("n8n-workflow").INodePropertyCollection)[] | undefined;
14
+ placeholder?: string | undefined;
15
+ isNodeSetting?: boolean | undefined;
16
+ noDataExpression?: boolean | undefined;
17
+ required?: boolean | undefined;
18
+ routing?: import("n8n-workflow").INodePropertyRouting | undefined;
19
+ credentialTypes?: ("extends:oAuth2Api" | "extends:oAuth1Api" | "has:authenticate" | "has:genericAuth")[] | undefined;
20
+ extractValue?: import("n8n-workflow").INodePropertyValueExtractorRegex | undefined;
21
+ modes?: import("n8n-workflow").INodePropertyMode[] | undefined;
22
+ requiresDataPath?: "single" | "multiple" | undefined;
23
+ doNotInherit?: boolean | undefined;
24
+ validateType?: keyof import("n8n-workflow").FieldTypeMap | undefined;
25
+ ignoreValidationDuringExecution?: boolean | undefined;
26
+ }[];
27
+ export declare function execute(this: IExecuteFunctions, index: number): Promise<import("n8n-workflow").NodeExecutionWithMetadata[]>;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.execute = exports.description = exports.properties = void 0;
4
+ const transport_1 = require("../../transport");
5
+ const display_1 = require("../../display");
6
+ const common_descriptions_1 = require("../../descriptions/common.descriptions");
7
+ exports.properties = [
8
+ {
9
+ displayName: 'URLs',
10
+ name: 'urls',
11
+ description: 'A list of URLs to extract content from',
12
+ type: 'string',
13
+ typeOptions: {
14
+ multipleValues: true,
15
+ multipleValueButtonText: 'Add URL',
16
+ },
17
+ required: true,
18
+ default: [],
19
+ placeholder: 'e.g. https://tavily.com'
20
+ },
21
+ {
22
+ displayName: 'Options',
23
+ name: 'options',
24
+ type: 'collection',
25
+ placeholder: 'Add option',
26
+ default: {},
27
+ options: common_descriptions_1.extractOptions,
28
+ },
29
+ ];
30
+ const displayOptions = {
31
+ show: {
32
+ resource: ['extract'],
33
+ operation: ['urls'],
34
+ },
35
+ };
36
+ exports.description = (0, display_1.updateDisplayOptions)(displayOptions, exports.properties);
37
+ async function execute(index) {
38
+ const urls = this.getNodeParameter('urls', index);
39
+ const options = this.getNodeParameter('options', index);
40
+ const processedOptions = {};
41
+ for (const [key, value] of Object.entries(options)) {
42
+ if (typeof value === 'boolean') {
43
+ processedOptions[key] = value;
44
+ }
45
+ else {
46
+ processedOptions[key] = value;
47
+ }
48
+ }
49
+ const body = {
50
+ 'urls': urls,
51
+ ...processedOptions,
52
+ };
53
+ const endpoint = "/extract";
54
+ const responseData = await transport_1.tavilyApiRequest.call(this, 'POST', endpoint, body);
55
+ return this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: index } });
56
+ }
57
+ exports.execute = execute;
58
+ //# sourceMappingURL=urls.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"urls.operation.js","sourceRoot":"","sources":["../../../../../nodes/Tavily/actions/extract/urls.operation.ts"],"names":[],"mappings":";;;AACA,+CAAmD;AACnD,2CAAqD;AACrD,gFAAwE;AAG3D,QAAA,UAAU,GAAsB;IAC5C;QACC,WAAW,EAAE,MAAM;QACnB,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,wCAAwC;QACrD,IAAI,EAAE,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AE,QAAQ,EAAE,IAAI,CAAC,CAAC;IAE/E,OAAO,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAC7C,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,YAA6B,CAAC,EAC3D,EAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,KAAK,EAAC,EAAC,CACzB,CAAC;AACH,CAAC;AA3BD,0BA2BC"}
@@ -0,0 +1,2 @@
1
+ import { type INodeTypeDescription } from 'n8n-workflow';
2
+ export declare const description: INodeTypeDescription;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.description = void 0;
27
+ const search = __importStar(require("./search"));
28
+ const extract = __importStar(require("./extract"));
29
+ exports.description = {
30
+ displayName: 'Tavily',
31
+ name: 'tavily',
32
+ group: ['transform'],
33
+ icon: 'file:img.svg',
34
+ version: 1,
35
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
36
+ description: 'Tavily API',
37
+ defaults: {
38
+ name: 'Tavily',
39
+ },
40
+ inputs: ["main"],
41
+ outputs: `={{['main']}}`,
42
+ credentials: [
43
+ {
44
+ name: 'tavilyApi',
45
+ required: true,
46
+ },
47
+ ],
48
+ properties: [
49
+ {
50
+ displayName: 'Resource',
51
+ name: 'resource',
52
+ type: 'options',
53
+ noDataExpression: true,
54
+ default: 'search',
55
+ options: [
56
+ {
57
+ name: 'Search',
58
+ value: 'search',
59
+ },
60
+ {
61
+ name: 'Extract',
62
+ value: 'extract',
63
+ }
64
+ ],
65
+ },
66
+ ...extract.description,
67
+ ...search.description,
68
+ ],
69
+ };
70
+ //# sourceMappingURL=node.description.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.description.js","sourceRoot":"","sources":["../../../../nodes/Tavily/actions/node.description.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,iDAAmC;AACnC,mDAAqC;AAExB,QAAA,WAAW,GAAyB;IAChD,WAAW,EAAE,QAAQ;IACrB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,CAAC,WAAW,CAAC;IACpB,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,8DAA8D;IACxE,WAAW,EAAE,YAAY;IACzB,QAAQ,EAAE;QACT,IAAI,EAAE,QAAQ;KACd;IACD,MAAM,EAAE,QAAyB;IACjC,OAAO,EAAE,eAAwB;IACjC,WAAW,EAAE;QACZ;YACC,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE,IAAI;SACd;KACD;IACD,UAAU,EAAE;QACX;YACC,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,SAAS;YACf,gBAAgB,EAAE,IAAI;YACtB,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,QAAQ;iBACf;gBACD;oBACC,IAAI,EAAE,SAAS;oBACf,KAAK,EAAE,SAAS;iBAChB;aACD;SACD;QACD,GAAG,OAAO,CAAC,WAAW;QACtB,GAAG,MAAM,CAAC,WAAW;KACrB;CACD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { AllEntities } from 'n8n-workflow';
2
+ declare type NodeMap = {
3
+ search: 'query';
4
+ extract: 'urls';
5
+ };
6
+ export declare type Tavily = AllEntities<NodeMap>;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=node.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.type.js","sourceRoot":"","sources":["../../../../nodes/Tavily/actions/node.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
2
+ export declare function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.router = void 0;
27
+ const n8n_workflow_1 = require("n8n-workflow");
28
+ const search = __importStar(require("./search"));
29
+ const extract = __importStar(require("./extract"));
30
+ async function router() {
31
+ var _a;
32
+ const items = this.getInputData();
33
+ const returnData = [];
34
+ const resource = this.getNodeParameter('resource', 0);
35
+ const operation = this.getNodeParameter('operation', 0);
36
+ let responseData;
37
+ const tavily = {
38
+ resource,
39
+ operation,
40
+ };
41
+ for (let i = 0; i < items.length; i++) {
42
+ try {
43
+ switch (tavily.resource) {
44
+ case 'search':
45
+ responseData = await search[tavily.operation].execute.call(this, i);
46
+ break;
47
+ case 'extract':
48
+ responseData = await extract[tavily.operation].execute.call(this, i);
49
+ break;
50
+ default:
51
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not known`);
52
+ }
53
+ returnData.push(...responseData);
54
+ }
55
+ catch (error) {
56
+ if (this.continueOnFail()) {
57
+ const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
58
+ returnData.push(...executionErrorData);
59
+ continue;
60
+ }
61
+ if (error instanceof n8n_workflow_1.NodeApiError && ((_a = error === null || error === void 0 ? void 0 : error.context) === null || _a === void 0 ? void 0 : _a.itemIndex) === undefined) {
62
+ if (error.context === undefined) {
63
+ error.context = {};
64
+ }
65
+ error.context.itemIndex = i;
66
+ }
67
+ throw error;
68
+ }
69
+ }
70
+ return [returnData];
71
+ }
72
+ exports.router = router;
73
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.js","sourceRoot":"","sources":["../../../../nodes/Tavily/actions/router.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAAgE;AAEhE,iDAAmC;AACnC,mDAAqC;AAI9B,KAAK,UAAU,MAAM;;IAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IAElC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AkB,CAAC,CAAC;gBACvC,SAAS;aACT;YAED,IAAI,KAAK,YAAY,2BAAY,IAAI,CAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,0CAAE,SAAS,MAAK,SAAS,EAAE;gBAC7E,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE;oBAChC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;iBACnB;gBACD,KAAK,CAAC,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC;aAC5B;YACD,MAAM,KAAK,CAAC;SACZ;KACD;IACD,OAAO,CAAC,UAAU,CAAC,CAAC;AACrB,CAAC;AAlDD,wBAkDC"}
@@ -0,0 +1,4 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ import * as query from './query.operation';
3
+ export { query };
4
+ export declare const description: INodeProperties[];
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.description = exports.query = void 0;
27
+ const query = __importStar(require("./query.operation"));
28
+ exports.query = query;
29
+ exports.description = [
30
+ {
31
+ displayName: 'Operation',
32
+ name: 'operation',
33
+ type: 'options',
34
+ noDataExpression: true,
35
+ displayOptions: {
36
+ show: {
37
+ resource: ['search'],
38
+ },
39
+ },
40
+ options: [
41
+ {
42
+ name: 'Query',
43
+ value: 'query',
44
+ description: "Search query",
45
+ action: 'Search',
46
+ },
47
+ ],
48
+ default: 'query',
49
+ },
50
+ ...query.description,
51
+ ];
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Tavily/actions/search/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yDAA2C;AAGlC,sBAAK;AAED,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,QAAQ,CAAC;aACpB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,OAAO;gBACd,WAAW,EAAE,cAAc;gBAC3B,MAAM,EAAE,QAAQ;aAChB;SACD;QACD,OAAO,EAAE,OAAO;KAChB;IACD,GAAG,KAAK,CAAC,WAAW;CACpB,CAAC"}