n8n-nodes-confirm8 0.6.0 → 0.10.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.
- package/LICENSE +18 -2
- package/dist/credentials/{ApiCustomCredentials.credentials.d.ts → Confirm8Api.credentials.d.ts} +2 -2
- package/dist/credentials/Confirm8Api.credentials.js +63 -0
- package/dist/index.d.ts +2 -8
- package/dist/index.js +2 -11
- package/dist/nodes/Confirm8/ApiConfirm8.node.js +261 -0
- package/package.json +9 -19
- package/dist/credentials/ApiCustomCredentials.credentials.js +0 -66
- package/dist/credentials/index.d.ts +0 -1
- package/dist/credentials/index.js +0 -17
- package/dist/nodes/ApiCustom/ApiAgentNode.node.d.ts +0 -9
- package/dist/nodes/ApiCustom/ApiAgentNode.node.js +0 -599
- package/dist/nodes/ApiCustom/ApiAgentTool.node.d.ts +0 -19
- package/dist/nodes/ApiCustom/ApiAgentTool.node.js +0 -170
- package/dist/nodes/ApiCustom/ApiCustom.node.d.ts +0 -5
- package/dist/nodes/ApiCustom/ApiCustom.node.js +0 -973
- package/dist/nodes/RegularNode.js +0 -976
- package/dist/nodes/index.d.ts +0 -4
- package/dist/nodes/index.js +0 -20
- /package/dist/nodes/{RegularNode.d.ts → Confirm8/ApiConfirm8.node.d.ts} +0 -0
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiAgentTool = void 0;
|
|
4
|
-
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
-
/**
|
|
6
|
-
* AI Agent Tool node
|
|
7
|
-
*
|
|
8
|
-
* - Designed to be easy for LLMs to call (OpenAI-friendly schema)
|
|
9
|
-
* - Uses apiCustomCredentials to inject:
|
|
10
|
-
* Authorization: Bearer <token>
|
|
11
|
-
* X-API-DOMAIN: <domain>
|
|
12
|
-
* X-APIKEY-TOKEN: <apikey>
|
|
13
|
-
*/
|
|
14
|
-
class ApiAgentTool {
|
|
15
|
-
constructor() {
|
|
16
|
-
this.description = {
|
|
17
|
-
displayName: 'API Agent Tool',
|
|
18
|
-
name: 'apiAgentTool',
|
|
19
|
-
icon: 'file:api-agent.svg',
|
|
20
|
-
group: ['transform'],
|
|
21
|
-
version: 1,
|
|
22
|
-
description: 'Tool for AI Agent: calls an API endpoint and returns structured JSON',
|
|
23
|
-
defaults: { name: 'API Agent Tool' },
|
|
24
|
-
// Makes the node show up in AI Agent "Tools"
|
|
25
|
-
usableAsTool: true,
|
|
26
|
-
inputs: ['main'],
|
|
27
|
-
outputs: ['main'],
|
|
28
|
-
credentials: [{ name: 'apiCustomCredentials', required: true }],
|
|
29
|
-
properties: [
|
|
30
|
-
{
|
|
31
|
-
displayName: 'Endpoint',
|
|
32
|
-
name: 'endpoint',
|
|
33
|
-
type: 'string',
|
|
34
|
-
default: '/v1/resource',
|
|
35
|
-
required: true,
|
|
36
|
-
description: 'Path after Base URL. Example: /v1/users/123',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
displayName: 'Method',
|
|
40
|
-
name: 'method',
|
|
41
|
-
type: 'options',
|
|
42
|
-
default: 'GET',
|
|
43
|
-
options: [
|
|
44
|
-
{ name: 'GET', value: 'GET' },
|
|
45
|
-
{ name: 'POST', value: 'POST' },
|
|
46
|
-
{ name: 'PUT', value: 'PUT' },
|
|
47
|
-
{ name: 'PATCH', value: 'PATCH' },
|
|
48
|
-
{ name: 'DELETE', value: 'DELETE' },
|
|
49
|
-
],
|
|
50
|
-
description: 'HTTP method. Use GET to fetch, POST to create, PATCH to update.',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
displayName: 'Query (JSON)',
|
|
54
|
-
name: 'query',
|
|
55
|
-
type: 'json',
|
|
56
|
-
default: '{}',
|
|
57
|
-
description: 'Querystring params as JSON. Example: {"limit": 10, "page": 2}',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
displayName: 'Body (JSON)',
|
|
61
|
-
name: 'body',
|
|
62
|
-
type: 'json',
|
|
63
|
-
default: '{}',
|
|
64
|
-
displayOptions: { show: { method: ['POST', 'PUT', 'PATCH'] } },
|
|
65
|
-
description: 'Request body as JSON. Example: {"name":"Alan","active":true}',
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
displayName: 'Timeout (ms)',
|
|
69
|
-
name: 'timeout',
|
|
70
|
-
type: 'number',
|
|
71
|
-
default: 60000,
|
|
72
|
-
description: 'Request timeout in milliseconds',
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Tool schema + semantic auto-description
|
|
79
|
-
* The AI Agent uses this to decide WHEN to call the tool and HOW to format inputs.
|
|
80
|
-
*/
|
|
81
|
-
getToolDescription() {
|
|
82
|
-
return {
|
|
83
|
-
name: 'call_api',
|
|
84
|
-
description: 'Call the configured API to read/create/update data. ' +
|
|
85
|
-
'Use when you need fresh data from the API. ' +
|
|
86
|
-
'Do NOT use for pure text generation or math. ' +
|
|
87
|
-
'Returns JSON only.',
|
|
88
|
-
properties: [
|
|
89
|
-
{
|
|
90
|
-
displayName: 'endpoint',
|
|
91
|
-
name: 'endpoint',
|
|
92
|
-
type: 'string',
|
|
93
|
-
default: '/v1/resource',
|
|
94
|
-
required: true,
|
|
95
|
-
description: 'API path after Base URL. Example: /v1/users/123',
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
displayName: 'method',
|
|
99
|
-
name: 'method',
|
|
100
|
-
type: 'options',
|
|
101
|
-
default: 'GET',
|
|
102
|
-
required: true,
|
|
103
|
-
options: [
|
|
104
|
-
{ name: 'GET', value: 'GET' },
|
|
105
|
-
{ name: 'POST', value: 'POST' },
|
|
106
|
-
{ name: 'PUT', value: 'PUT' },
|
|
107
|
-
{ name: 'PATCH', value: 'PATCH' },
|
|
108
|
-
{ name: 'DELETE', value: 'DELETE' },
|
|
109
|
-
],
|
|
110
|
-
description: 'HTTP method (GET fetch, POST create, PATCH update).',
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
displayName: 'query',
|
|
114
|
-
name: 'query',
|
|
115
|
-
type: 'json',
|
|
116
|
-
default: '{}',
|
|
117
|
-
required: false,
|
|
118
|
-
description: 'Query params JSON. Example: {"status":"open","limit":20}',
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
displayName: 'body',
|
|
122
|
-
name: 'body',
|
|
123
|
-
type: 'json',
|
|
124
|
-
default: '{}',
|
|
125
|
-
required: false,
|
|
126
|
-
description: 'Body JSON (required for POST/PUT/PATCH).',
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
async execute() {
|
|
132
|
-
const items = this.getInputData();
|
|
133
|
-
const out = [];
|
|
134
|
-
for (let i = 0; i < items.length; i++) {
|
|
135
|
-
try {
|
|
136
|
-
const endpoint = this.getNodeParameter('endpoint', i);
|
|
137
|
-
const method = this.getNodeParameter('method', i);
|
|
138
|
-
const query = this.getNodeParameter('query', i, {});
|
|
139
|
-
const body = this.getNodeParameter('body', i, {});
|
|
140
|
-
const timeout = this.getNodeParameter('timeout', i);
|
|
141
|
-
const requestOptions = {
|
|
142
|
-
method: method,
|
|
143
|
-
url: endpoint,
|
|
144
|
-
qs: query,
|
|
145
|
-
json: true,
|
|
146
|
-
timeout,
|
|
147
|
-
headers: {
|
|
148
|
-
'Content-Type': 'application/json',
|
|
149
|
-
},
|
|
150
|
-
};
|
|
151
|
-
if (['POST', 'PUT', 'PATCH'].includes(method) && Object.keys(body).length > 0) {
|
|
152
|
-
requestOptions.body = body;
|
|
153
|
-
}
|
|
154
|
-
const resp = await this.helpers.httpRequestWithAuthentication.call(this, 'apiCustomCredentials', requestOptions);
|
|
155
|
-
out.push({
|
|
156
|
-
json: {
|
|
157
|
-
ok: true,
|
|
158
|
-
meta: { endpoint, method },
|
|
159
|
-
data: resp,
|
|
160
|
-
},
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
catch (err) {
|
|
164
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), err, { itemIndex: i });
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
return [out];
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
exports.ApiAgentTool = ApiAgentTool;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
-
export declare class ApiCustomNode implements INodeType {
|
|
3
|
-
description: INodeTypeDescription;
|
|
4
|
-
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
-
}
|