n8n-nodes-confirm8 0.7.0 → 0.12.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/README.md +36 -140
- package/dist/index.d.ts +1 -8
- package/dist/index.js +1 -11
- package/dist/nodes/Confirm8/ApiConfirm8.node.js +306 -0
- package/package.json +8 -21
- package/dist/credentials/ApiCustomCredentials.credentials.d.ts +0 -9
- package/dist/credentials/ApiCustomCredentials.credentials.js +0 -68
- 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 -3
- package/dist/nodes/index.js +0 -19
- /package/dist/nodes/{RegularNode.d.ts → Confirm8/ApiConfirm8.node.d.ts} +0 -0
package/LICENSE
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2024 Bill Hebert
|
|
4
4
|
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,162 +1,58 @@
|
|
|
1
|
-
#
|
|
1
|
+
# n8n-nodes-confirm8
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Node simples para n8n que conecta com a API Confirm8.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
Os arquivos enviados tinham **underscore** em vez de **ponto**:
|
|
5
|
+
## ✨ Características
|
|
7
6
|
|
|
8
|
-
**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
ApiAgentNode_node.ts
|
|
12
|
-
ApiAgentTool_node.ts
|
|
13
|
-
ApiCustomCredentials_credentials.ts
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
**DEPOIS (Correto):**
|
|
17
|
-
```
|
|
18
|
-
ApiCustom.node.ts ✓
|
|
19
|
-
ApiAgentNode.node.ts ✓
|
|
20
|
-
ApiAgentTool.node.ts ✓
|
|
21
|
-
ApiCustomCredentials.credentials.ts ✓
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### 2. **Erro Crítico nas Credenciais** ❌→✅
|
|
25
|
-
|
|
26
|
-
O método `authenticate()` estava usando `credentials.apiKey` que **não existe**!
|
|
27
|
-
|
|
28
|
-
**ANTES (Incorreto):**
|
|
29
|
-
```typescript
|
|
30
|
-
async authenticate(credentials, requestOptions) {
|
|
31
|
-
requestOptions.headers.Authorization = `Bearer ${credentials.apiKey}`; // ❌ apiKey não existe!
|
|
32
|
-
return requestOptions;
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
**DEPOIS (Correto):**
|
|
37
|
-
```typescript
|
|
38
|
-
async authenticate(credentials, requestOptions) {
|
|
39
|
-
requestOptions.headers = requestOptions.headers || {};
|
|
40
|
-
requestOptions.headers.Authorization = `Bearer ${credentials.bearerToken}`; // ✓
|
|
41
|
-
requestOptions.headers['X-API-DOMAIN'] = credentials.apiDomain as string; // ✓
|
|
42
|
-
requestOptions.headers['X-APIKEY-TOKEN'] = credentials.apiKeyToken as string; // ✓
|
|
43
|
-
return requestOptions;
|
|
44
|
-
}
|
|
45
|
-
```
|
|
7
|
+
- ✅ **Sem credenciais separadas** - Tudo configurado diretamente no node
|
|
8
|
+
- ✅ **Simples de usar** - Configure uma vez e use
|
|
9
|
+
- ✅ **Operações básicas** - Users e Clients
|
|
46
10
|
|
|
47
|
-
|
|
11
|
+
## 📦 Instalação
|
|
48
12
|
|
|
49
|
-
|
|
13
|
+
### Via n8n Interface
|
|
50
14
|
|
|
51
|
-
|
|
15
|
+
1. Settings → Community Nodes → Install
|
|
16
|
+
2. Digite: `n8n-nodes-confirm8`
|
|
17
|
+
3. **REINICIE o n8n**
|
|
52
18
|
|
|
53
|
-
|
|
19
|
+
### Via npm
|
|
54
20
|
|
|
55
|
-
```
|
|
56
|
-
n8n-nodes-confirm8/
|
|
57
|
-
├── nodes/
|
|
58
|
-
│ ├── ApiCustom/
|
|
59
|
-
│ │ ├── ApiCustom.node.ts ✓
|
|
60
|
-
│ │ ├── ApiAgentNode.node.ts ✓
|
|
61
|
-
│ │ ├── ApiAgentTool.node.ts ✓
|
|
62
|
-
│ │ ├── api.svg
|
|
63
|
-
│ │ └── api-agent.svg
|
|
64
|
-
│ └── index.ts ✓
|
|
65
|
-
├── credentials/
|
|
66
|
-
│ ├── ApiCustomCredentials.credentials.ts ✓
|
|
67
|
-
│ └── index.ts ✓
|
|
68
|
-
├── index.ts ✓
|
|
69
|
-
├── package.json
|
|
70
|
-
├── tsconfig.json
|
|
71
|
-
├── gulpfile.js
|
|
72
|
-
└── LICENSE
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## 🚀 Como Usar Este Pacote Corrigido
|
|
78
|
-
|
|
79
|
-
### 1. Instalar Dependências
|
|
80
21
|
```bash
|
|
81
|
-
npm install
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### 2. Compilar
|
|
85
|
-
```bash
|
|
86
|
-
npm run build
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### 3. Verificar se compilou corretamente
|
|
90
|
-
```bash
|
|
91
|
-
ls -la dist/
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Você deve ver:
|
|
95
|
-
```
|
|
96
|
-
dist/
|
|
97
|
-
├── credentials/
|
|
98
|
-
│ ├── ApiCustomCredentials.credentials.js
|
|
99
|
-
│ └── ApiCustomCredentials.credentials.d.ts
|
|
100
|
-
├── nodes/
|
|
101
|
-
│ └── ApiCustom/
|
|
102
|
-
│ ├── ApiCustom.node.js
|
|
103
|
-
│ ├── ApiAgentNode.node.js
|
|
104
|
-
│ └── ApiAgentTool.node.js
|
|
105
|
-
└── index.js
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### 4. Publicar no NPM
|
|
109
|
-
```bash
|
|
110
|
-
npm login
|
|
111
|
-
npm publish
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### 5. Instalar no n8n
|
|
115
|
-
```bash
|
|
116
|
-
# Via interface do n8n
|
|
117
|
-
Settings → Community Nodes → Install → n8n-nodes-confirm8
|
|
118
|
-
|
|
119
|
-
# OU via CLI
|
|
120
22
|
npm install n8n-nodes-confirm8
|
|
121
|
-
|
|
122
|
-
# IMPORTANTE: Sempre reinicie o n8n após instalar!
|
|
23
|
+
# Reinicie o n8n
|
|
123
24
|
```
|
|
124
25
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
## ⚠️ Por que deu erro antes?
|
|
26
|
+
## 🚀 Como Usar
|
|
128
27
|
|
|
129
|
-
1.
|
|
130
|
-
2.
|
|
131
|
-
|
|
28
|
+
1. Adicione o node "API Confirm8" ao workflow
|
|
29
|
+
2. Configure os campos:
|
|
30
|
+
- **Base URL**: `https://api.confirm8.com`
|
|
31
|
+
- **Bearer Token**: Seu token
|
|
32
|
+
- **X-API-DOMAIN**: Seu domínio
|
|
33
|
+
- **X-APIKEY-TOKEN**: Sua chave
|
|
34
|
+
3. Escolha Resource e Operation
|
|
35
|
+
4. Execute!
|
|
132
36
|
|
|
133
|
-
|
|
37
|
+
## 📋 Operações Disponíveis
|
|
134
38
|
|
|
135
|
-
|
|
39
|
+
### User
|
|
40
|
+
- Get - Buscar usuário por ID
|
|
41
|
+
- Get All - Listar todos
|
|
42
|
+
- Create - Criar novo
|
|
43
|
+
- Update - Atualizar existente
|
|
136
44
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
✅ Corrigido: todos os arquivos `index.ts`
|
|
141
|
-
✅ Verificado: estrutura de pastas
|
|
45
|
+
### Client
|
|
46
|
+
- Get - Buscar cliente por ID
|
|
47
|
+
- Get All - Listar todos
|
|
142
48
|
|
|
143
|
-
|
|
49
|
+
## 🔧 Desenvolvimento
|
|
144
50
|
|
|
145
|
-
## 📞 Teste Final
|
|
146
|
-
|
|
147
|
-
Após build, verifique:
|
|
148
51
|
```bash
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
Deve retornar:
|
|
153
|
-
```
|
|
154
|
-
Nodes: 3
|
|
155
|
-
Credentials: 1
|
|
52
|
+
npm install
|
|
53
|
+
npm run build
|
|
156
54
|
```
|
|
157
55
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
## 🎉 Pronto!
|
|
56
|
+
## 📄 Licença
|
|
161
57
|
|
|
162
|
-
|
|
58
|
+
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from "./nodes/ApiCustom/ApiAgentNode.node";
|
|
3
|
-
export * from "./nodes/ApiCustom/ApiAgentTool.node";
|
|
4
|
-
export * from "./credentials/ApiCustomCredentials.credentials";
|
|
5
|
-
import { ApiCustomNode } from "./nodes/ApiCustom/ApiCustom.node";
|
|
6
|
-
import { ApiCustomCredentials } from "./credentials/ApiCustomCredentials.credentials";
|
|
7
|
-
export declare const nodes: (typeof ApiCustomNode)[];
|
|
8
|
-
export declare const credentials: (typeof ApiCustomCredentials)[];
|
|
1
|
+
export * from './nodes/Confirm8/ApiConfirm8.node';
|
package/dist/index.js
CHANGED
|
@@ -14,14 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
__exportStar(require("./nodes/ApiCustom/ApiCustom.node"), exports);
|
|
19
|
-
__exportStar(require("./nodes/ApiCustom/ApiAgentNode.node"), exports);
|
|
20
|
-
__exportStar(require("./nodes/ApiCustom/ApiAgentTool.node"), exports);
|
|
21
|
-
__exportStar(require("./credentials/ApiCustomCredentials.credentials"), exports);
|
|
22
|
-
const ApiCustom_node_1 = require("./nodes/ApiCustom/ApiCustom.node");
|
|
23
|
-
const ApiAgentNode_node_1 = require("./nodes/ApiCustom/ApiAgentNode.node");
|
|
24
|
-
const ApiAgentTool_node_1 = require("./nodes/ApiCustom/ApiAgentTool.node");
|
|
25
|
-
const ApiCustomCredentials_credentials_1 = require("./credentials/ApiCustomCredentials.credentials");
|
|
26
|
-
exports.nodes = [ApiCustom_node_1.ApiCustomNode, ApiAgentNode_node_1.ApiAgentNode, ApiAgentTool_node_1.ApiAgentTool];
|
|
27
|
-
exports.credentials = [ApiCustomCredentials_credentials_1.ApiCustomCredentials];
|
|
17
|
+
__exportStar(require("./nodes/Confirm8/ApiConfirm8.node"), exports);
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiConfirm8 = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
class ApiConfirm8 {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: 'API Confirm8',
|
|
9
|
+
name: 'apiConfirm8',
|
|
10
|
+
icon: 'file:api.svg',
|
|
11
|
+
group: ['transform'],
|
|
12
|
+
version: 1,
|
|
13
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
14
|
+
description: 'Interact with Confirm8 API',
|
|
15
|
+
defaults: {
|
|
16
|
+
name: 'API Confirm8',
|
|
17
|
+
},
|
|
18
|
+
inputs: ['main'],
|
|
19
|
+
outputs: ['main'],
|
|
20
|
+
properties: [
|
|
21
|
+
// API Configuration
|
|
22
|
+
{
|
|
23
|
+
displayName: 'Base URL',
|
|
24
|
+
name: 'baseUrl',
|
|
25
|
+
type: 'string',
|
|
26
|
+
default: '',
|
|
27
|
+
placeholder: 'https://api.confirm8.com',
|
|
28
|
+
required: true,
|
|
29
|
+
description: 'Base URL of your API',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
displayName: 'Bearer Token',
|
|
33
|
+
name: 'bearerToken',
|
|
34
|
+
type: 'string',
|
|
35
|
+
typeOptions: {
|
|
36
|
+
password: true,
|
|
37
|
+
},
|
|
38
|
+
default: '',
|
|
39
|
+
required: true,
|
|
40
|
+
description: 'Bearer token for authentication',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
displayName: 'X-API-DOMAIN',
|
|
44
|
+
name: 'apiDomain',
|
|
45
|
+
type: 'string',
|
|
46
|
+
default: '',
|
|
47
|
+
required: true,
|
|
48
|
+
description: 'API Domain header value',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
displayName: 'X-APIKEY-TOKEN',
|
|
52
|
+
name: 'apiKeyToken',
|
|
53
|
+
type: 'string',
|
|
54
|
+
typeOptions: {
|
|
55
|
+
password: true,
|
|
56
|
+
},
|
|
57
|
+
default: '',
|
|
58
|
+
required: true,
|
|
59
|
+
description: 'API Key Token header value',
|
|
60
|
+
},
|
|
61
|
+
// Resource Selection
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Resource',
|
|
64
|
+
name: 'resource',
|
|
65
|
+
type: 'options',
|
|
66
|
+
noDataExpression: true,
|
|
67
|
+
options: [
|
|
68
|
+
{
|
|
69
|
+
name: 'User',
|
|
70
|
+
value: 'user',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'Client',
|
|
74
|
+
value: 'client',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
default: 'user',
|
|
78
|
+
},
|
|
79
|
+
// USER OPERATIONS
|
|
80
|
+
{
|
|
81
|
+
displayName: 'Operation',
|
|
82
|
+
name: 'operation',
|
|
83
|
+
type: 'options',
|
|
84
|
+
noDataExpression: true,
|
|
85
|
+
displayOptions: {
|
|
86
|
+
show: {
|
|
87
|
+
resource: ['user'],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
options: [
|
|
91
|
+
{
|
|
92
|
+
name: 'Get',
|
|
93
|
+
value: 'get',
|
|
94
|
+
description: 'Get a user',
|
|
95
|
+
action: 'Get a user',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'Get All',
|
|
99
|
+
value: 'getAll',
|
|
100
|
+
description: 'Get all users',
|
|
101
|
+
action: 'Get all users',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'Create',
|
|
105
|
+
value: 'create',
|
|
106
|
+
description: 'Create a new user',
|
|
107
|
+
action: 'Create a user',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'Update',
|
|
111
|
+
value: 'update',
|
|
112
|
+
description: 'Update a user',
|
|
113
|
+
action: 'Update a user',
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
default: 'getAll',
|
|
117
|
+
},
|
|
118
|
+
// User ID
|
|
119
|
+
{
|
|
120
|
+
displayName: 'User ID',
|
|
121
|
+
name: 'userId',
|
|
122
|
+
type: 'string',
|
|
123
|
+
required: true,
|
|
124
|
+
displayOptions: {
|
|
125
|
+
show: {
|
|
126
|
+
resource: ['user'],
|
|
127
|
+
operation: ['get', 'update'],
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
default: '',
|
|
131
|
+
description: 'The ID of the user',
|
|
132
|
+
},
|
|
133
|
+
// Username for create
|
|
134
|
+
{
|
|
135
|
+
displayName: 'Username',
|
|
136
|
+
name: 'username',
|
|
137
|
+
type: 'string',
|
|
138
|
+
required: true,
|
|
139
|
+
displayOptions: {
|
|
140
|
+
show: {
|
|
141
|
+
resource: ['user'],
|
|
142
|
+
operation: ['create'],
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
default: '',
|
|
146
|
+
description: 'Username for the new user',
|
|
147
|
+
},
|
|
148
|
+
// Additional fields
|
|
149
|
+
{
|
|
150
|
+
displayName: 'Additional Fields',
|
|
151
|
+
name: 'additionalFields',
|
|
152
|
+
type: 'collection',
|
|
153
|
+
placeholder: 'Add Field',
|
|
154
|
+
default: {},
|
|
155
|
+
displayOptions: {
|
|
156
|
+
show: {
|
|
157
|
+
resource: ['user'],
|
|
158
|
+
operation: ['create', 'update'],
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
options: [
|
|
162
|
+
{
|
|
163
|
+
displayName: 'Email',
|
|
164
|
+
name: 'email',
|
|
165
|
+
type: 'string',
|
|
166
|
+
default: '',
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
displayName: 'Name',
|
|
170
|
+
name: 'name',
|
|
171
|
+
type: 'string',
|
|
172
|
+
default: '',
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
},
|
|
176
|
+
// CLIENT OPERATIONS
|
|
177
|
+
{
|
|
178
|
+
displayName: 'Operation',
|
|
179
|
+
name: 'operation',
|
|
180
|
+
type: 'options',
|
|
181
|
+
noDataExpression: true,
|
|
182
|
+
displayOptions: {
|
|
183
|
+
show: {
|
|
184
|
+
resource: ['client'],
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
options: [
|
|
188
|
+
{
|
|
189
|
+
name: 'Get',
|
|
190
|
+
value: 'get',
|
|
191
|
+
description: 'Get a client',
|
|
192
|
+
action: 'Get a client',
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: 'Get All',
|
|
196
|
+
value: 'getAll',
|
|
197
|
+
description: 'Get all clients',
|
|
198
|
+
action: 'Get all clients',
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
default: 'getAll',
|
|
202
|
+
},
|
|
203
|
+
// Client ID
|
|
204
|
+
{
|
|
205
|
+
displayName: 'Client ID',
|
|
206
|
+
name: 'clientId',
|
|
207
|
+
type: 'string',
|
|
208
|
+
required: true,
|
|
209
|
+
displayOptions: {
|
|
210
|
+
show: {
|
|
211
|
+
resource: ['client'],
|
|
212
|
+
operation: ['get'],
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
default: '',
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
async execute() {
|
|
221
|
+
const items = this.getInputData();
|
|
222
|
+
const returnData = [];
|
|
223
|
+
for (let i = 0; i < items.length; i++) {
|
|
224
|
+
try {
|
|
225
|
+
// Get API configuration
|
|
226
|
+
const baseUrl = this.getNodeParameter('baseUrl', i);
|
|
227
|
+
const bearerToken = this.getNodeParameter('bearerToken', i);
|
|
228
|
+
const apiDomain = this.getNodeParameter('apiDomain', i);
|
|
229
|
+
const apiKeyToken = this.getNodeParameter('apiKeyToken', i);
|
|
230
|
+
const resource = this.getNodeParameter('resource', i);
|
|
231
|
+
const operation = this.getNodeParameter('operation', i);
|
|
232
|
+
let endpoint = '';
|
|
233
|
+
let method = 'GET';
|
|
234
|
+
let body = {};
|
|
235
|
+
// USER OPERATIONS
|
|
236
|
+
if (resource === 'user') {
|
|
237
|
+
if (operation === 'getAll') {
|
|
238
|
+
endpoint = '/users';
|
|
239
|
+
}
|
|
240
|
+
else if (operation === 'get') {
|
|
241
|
+
const userId = this.getNodeParameter('userId', i);
|
|
242
|
+
endpoint = `/users/${userId}`;
|
|
243
|
+
}
|
|
244
|
+
else if (operation === 'create') {
|
|
245
|
+
endpoint = '/users';
|
|
246
|
+
method = 'POST';
|
|
247
|
+
const username = this.getNodeParameter('username', i);
|
|
248
|
+
const additionalFields = this.getNodeParameter('additionalFields', i, {});
|
|
249
|
+
body = { username, ...additionalFields };
|
|
250
|
+
}
|
|
251
|
+
else if (operation === 'update') {
|
|
252
|
+
const userId = this.getNodeParameter('userId', i);
|
|
253
|
+
endpoint = `/users/${userId}`;
|
|
254
|
+
method = 'PUT';
|
|
255
|
+
body = this.getNodeParameter('additionalFields', i, {});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// CLIENT OPERATIONS
|
|
259
|
+
else if (resource === 'client') {
|
|
260
|
+
if (operation === 'getAll') {
|
|
261
|
+
endpoint = '/clients';
|
|
262
|
+
}
|
|
263
|
+
else if (operation === 'get') {
|
|
264
|
+
const clientId = this.getNodeParameter('clientId', i);
|
|
265
|
+
endpoint = `/clients/${clientId}`;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
// Make the request
|
|
269
|
+
const url = `${baseUrl}${endpoint}`;
|
|
270
|
+
const options = {
|
|
271
|
+
method,
|
|
272
|
+
uri: url,
|
|
273
|
+
headers: {
|
|
274
|
+
'Authorization': `Bearer ${bearerToken}`,
|
|
275
|
+
'X-API-DOMAIN': apiDomain,
|
|
276
|
+
'X-APIKEY-TOKEN': apiKeyToken,
|
|
277
|
+
'Content-Type': 'application/json',
|
|
278
|
+
},
|
|
279
|
+
json: true,
|
|
280
|
+
};
|
|
281
|
+
if (method !== 'GET' && Object.keys(body).length > 0) {
|
|
282
|
+
options['body'] = body;
|
|
283
|
+
}
|
|
284
|
+
const responseData = await this.helpers.request(options);
|
|
285
|
+
returnData.push({
|
|
286
|
+
json: responseData,
|
|
287
|
+
pairedItem: { item: i },
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
if (this.continueOnFail()) {
|
|
292
|
+
returnData.push({
|
|
293
|
+
json: {
|
|
294
|
+
error: error || 'Unknown Error',
|
|
295
|
+
},
|
|
296
|
+
pairedItem: { item: i },
|
|
297
|
+
});
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex: i });
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return [returnData];
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
exports.ApiConfirm8 = ApiConfirm8;
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-confirm8",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.12.0",
|
|
4
|
+
"description": "Simple n8n node for Confirm8 API - no credentials needed",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"author": "Bill
|
|
6
|
+
"author": "Bill Hebert",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"n8n-community-node-package",
|
|
9
9
|
"n8n",
|
|
10
|
-
"
|
|
11
|
-
"tool",
|
|
10
|
+
"confirm8",
|
|
12
11
|
"api"
|
|
13
12
|
],
|
|
14
13
|
"main": "dist/index.js",
|
|
@@ -17,32 +16,20 @@
|
|
|
17
16
|
"dist"
|
|
18
17
|
],
|
|
19
18
|
"scripts": {
|
|
20
|
-
"build": "
|
|
21
|
-
"dev": "
|
|
22
|
-
"prepublishOnly": "npm run build"
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"dev": "tsc --watch"
|
|
23
21
|
},
|
|
24
22
|
"n8n": {
|
|
25
|
-
"credentials": [
|
|
26
|
-
"dist/credentials/ApiCustomCredentials.credentials.js"
|
|
27
|
-
],
|
|
28
23
|
"nodes": [
|
|
29
|
-
"dist/nodes/
|
|
30
|
-
"dist/nodes/ApiCustom/ApiAgentNode.node.js",
|
|
31
|
-
"dist/nodes/ApiCustom/ApiAgentTool.node.js"
|
|
24
|
+
"dist/nodes/Confirm8/ApiConfirm8.node.js"
|
|
32
25
|
]
|
|
33
26
|
},
|
|
34
27
|
"peerDependencies": {
|
|
35
|
-
"n8n-core": "*",
|
|
36
28
|
"n8n-workflow": "*"
|
|
37
29
|
},
|
|
38
30
|
"devDependencies": {
|
|
39
31
|
"@types/node": "^18.0.0",
|
|
40
|
-
"del": "^7.0.0",
|
|
41
|
-
"gulp": "^4.0.2",
|
|
42
|
-
"gulp-cli": "^2.3.0",
|
|
43
|
-
"gulp-typescript": "^6.0.0-alpha.1",
|
|
44
32
|
"typescript": "^5.0.0",
|
|
45
|
-
"n8n-
|
|
46
|
-
"n8n-workflow": "*"
|
|
33
|
+
"n8n-workflow": "^1.0.0"
|
|
47
34
|
}
|
|
48
35
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ICredentialType, INodeProperties, ICredentialTestRequest, IHttpRequestOptions, ICredentialDataDecryptedObject } from "n8n-workflow";
|
|
2
|
-
export declare class ApiCustomCredentials implements ICredentialType {
|
|
3
|
-
name: string;
|
|
4
|
-
displayName: string;
|
|
5
|
-
documentationUrl: string;
|
|
6
|
-
properties: INodeProperties[];
|
|
7
|
-
test: ICredentialTestRequest;
|
|
8
|
-
authenticate(credentials: ICredentialDataDecryptedObject, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
9
|
-
}
|