n8n-nodes-databar 0.1.3 → 0.1.4
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/README.md +4 -4
- package/dist/nodes/Databar/Databar.node.js +50 -102
- package/package.json +2 -4
package/README.md
CHANGED
|
@@ -126,10 +126,10 @@ Guided Fields:
|
|
|
126
126
|
First Name: John (Optional)
|
|
127
127
|
|
|
128
128
|
Raw JSON:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
{
|
|
130
|
+
"email": "john@example.com",
|
|
131
|
+
"first_name": "John"
|
|
132
|
+
}
|
|
133
133
|
```
|
|
134
134
|
|
|
135
135
|
### Automatic Async Handling
|
|
@@ -27,17 +27,6 @@
|
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
exports.Databar = void 0;
|
|
29
29
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
30
|
-
/**
|
|
31
|
-
* Helper function to wait for a specified duration using a polling loop
|
|
32
|
-
* This avoids using restricted globals like setTimeout/setInterval
|
|
33
|
-
*/
|
|
34
|
-
async function wait(ms) {
|
|
35
|
-
const start = Date.now();
|
|
36
|
-
while (Date.now() - start < ms) {
|
|
37
|
-
// Yield control to allow other operations
|
|
38
|
-
await Promise.resolve();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
30
|
/**
|
|
42
31
|
* Helper function to poll task status until completion
|
|
43
32
|
*
|
|
@@ -75,7 +64,7 @@ async function pollTaskStatus(context, taskId, pollInterval, timeout) {
|
|
|
75
64
|
throw new n8n_workflow_1.NodeOperationError(context.getNode(), `Task ${taskId} failed: ${error}`);
|
|
76
65
|
}
|
|
77
66
|
// Wait before polling again
|
|
78
|
-
await
|
|
67
|
+
await (0, n8n_workflow_1.sleep)(pollIntervalMs);
|
|
79
68
|
}
|
|
80
69
|
}
|
|
81
70
|
class Databar {
|
|
@@ -91,8 +80,8 @@ class Databar {
|
|
|
91
80
|
defaults: {
|
|
92
81
|
name: 'Databar',
|
|
93
82
|
},
|
|
94
|
-
inputs: [
|
|
95
|
-
outputs: [
|
|
83
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
84
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
96
85
|
credentials: [
|
|
97
86
|
{
|
|
98
87
|
name: 'databarApi',
|
|
@@ -1245,7 +1234,10 @@ class Databar {
|
|
|
1245
1234
|
method: 'GET',
|
|
1246
1235
|
url: 'https://api.databar.ai/v1/user/me',
|
|
1247
1236
|
});
|
|
1248
|
-
returnData.push(
|
|
1237
|
+
returnData.push({
|
|
1238
|
+
json: response,
|
|
1239
|
+
pairedItem: { item: i },
|
|
1240
|
+
});
|
|
1249
1241
|
}
|
|
1250
1242
|
}
|
|
1251
1243
|
// ====================================
|
|
@@ -1291,10 +1283,16 @@ class Databar {
|
|
|
1291
1283
|
const taskId = taskResponse.task_id;
|
|
1292
1284
|
// Poll for completion
|
|
1293
1285
|
const completedTask = await pollTaskStatus(this, taskId, pollInterval, timeout);
|
|
1294
|
-
returnData.push(
|
|
1286
|
+
returnData.push({
|
|
1287
|
+
json: completedTask,
|
|
1288
|
+
pairedItem: { item: i },
|
|
1289
|
+
});
|
|
1295
1290
|
}
|
|
1296
1291
|
else {
|
|
1297
|
-
returnData.push(
|
|
1292
|
+
returnData.push({
|
|
1293
|
+
json: taskResponse,
|
|
1294
|
+
pairedItem: { item: i },
|
|
1295
|
+
});
|
|
1298
1296
|
}
|
|
1299
1297
|
}
|
|
1300
1298
|
else if (operation === 'bulkRun') {
|
|
@@ -1325,90 +1323,20 @@ class Databar {
|
|
|
1325
1323
|
const taskId = taskResponse.task_id;
|
|
1326
1324
|
// Poll for completion
|
|
1327
1325
|
const completedTask = await pollTaskStatus(this, taskId, pollInterval, timeout);
|
|
1328
|
-
returnData.push(
|
|
1326
|
+
returnData.push({
|
|
1327
|
+
json: completedTask,
|
|
1328
|
+
pairedItem: { item: i },
|
|
1329
|
+
});
|
|
1329
1330
|
}
|
|
1330
1331
|
else {
|
|
1331
|
-
returnData.push(
|
|
1332
|
+
returnData.push({
|
|
1333
|
+
json: taskResponse,
|
|
1334
|
+
pairedItem: { item: i },
|
|
1335
|
+
});
|
|
1332
1336
|
}
|
|
1333
1337
|
}
|
|
1334
1338
|
}
|
|
1335
1339
|
// ====================================
|
|
1336
|
-
// TABLE OPERATIONS
|
|
1337
|
-
// ====================================
|
|
1338
|
-
// Table operations temporarily hidden - can be re-enabled later
|
|
1339
|
-
// else if (resource === 'table') {
|
|
1340
|
-
// if (operation === 'create') {
|
|
1341
|
-
// const response = await this.helpers.httpRequestWithAuthentication.call(
|
|
1342
|
-
// this,
|
|
1343
|
-
// 'databarApi',
|
|
1344
|
-
// {
|
|
1345
|
-
// method: 'POST',
|
|
1346
|
-
// url: 'https://api.databar.ai/v1/table/create',
|
|
1347
|
-
// body: {},
|
|
1348
|
-
// },
|
|
1349
|
-
// );
|
|
1350
|
-
// returnData.push(response as IDataObject);
|
|
1351
|
-
// } else if (operation === 'list') {
|
|
1352
|
-
// const response = await this.helpers.httpRequestWithAuthentication.call(
|
|
1353
|
-
// this,
|
|
1354
|
-
// 'databarApi',
|
|
1355
|
-
// {
|
|
1356
|
-
// method: 'GET',
|
|
1357
|
-
// url: 'https://api.databar.ai/v1/table/',
|
|
1358
|
-
// },
|
|
1359
|
-
// );
|
|
1360
|
-
// if (Array.isArray(response)) {
|
|
1361
|
-
// returnData.push(...(response as IDataObject[]));
|
|
1362
|
-
// } else {
|
|
1363
|
-
// returnData.push(response as IDataObject);
|
|
1364
|
-
// }
|
|
1365
|
-
// } else if (operation === 'getRows') {
|
|
1366
|
-
// const tableUuid = this.getNodeParameter('tableUuid', i) as string;
|
|
1367
|
-
// const perPage = this.getNodeParameter('perPage', i) as number;
|
|
1368
|
-
// const page = this.getNodeParameter('page', i) as number;
|
|
1369
|
-
//
|
|
1370
|
-
// const response = await this.helpers.httpRequestWithAuthentication.call(
|
|
1371
|
-
// this,
|
|
1372
|
-
// 'databarApi',
|
|
1373
|
-
// {
|
|
1374
|
-
// method: 'GET',
|
|
1375
|
-
// url: `https://api.databar.ai/v1/table/${tableUuid}/rows`,
|
|
1376
|
-
// qs: { per_page: perPage, page },
|
|
1377
|
-
// },
|
|
1378
|
-
// );
|
|
1379
|
-
// returnData.push(response as IDataObject);
|
|
1380
|
-
// } else if (operation === 'getColumns') {
|
|
1381
|
-
// const tableUuid = this.getNodeParameter('tableUuid', i) as string;
|
|
1382
|
-
//
|
|
1383
|
-
// const response = await this.helpers.httpRequestWithAuthentication.call(
|
|
1384
|
-
// this,
|
|
1385
|
-
// 'databarApi',
|
|
1386
|
-
// {
|
|
1387
|
-
// method: 'GET',
|
|
1388
|
-
// url: `https://api.databar.ai/v1/table/${tableUuid}/columns`,
|
|
1389
|
-
// },
|
|
1390
|
-
// );
|
|
1391
|
-
// if (Array.isArray(response)) {
|
|
1392
|
-
// returnData.push(...(response as IDataObject[]));
|
|
1393
|
-
// } else {
|
|
1394
|
-
// returnData.push(response as IDataObject);
|
|
1395
|
-
// }
|
|
1396
|
-
// } else if (operation === 'runEnrichment') {
|
|
1397
|
-
// const tableUuid = this.getNodeParameter('tableUuid', i) as string;
|
|
1398
|
-
// const tableEnrichmentId = this.getNodeParameter('tableEnrichmentId', i) as string;
|
|
1399
|
-
//
|
|
1400
|
-
// const response = await this.helpers.httpRequestWithAuthentication.call(
|
|
1401
|
-
// this,
|
|
1402
|
-
// 'databarApi',
|
|
1403
|
-
// {
|
|
1404
|
-
// method: 'GET',
|
|
1405
|
-
// url: `https://api.databar.ai/v1/table/${tableUuid}/run-enrichment/${tableEnrichmentId}`,
|
|
1406
|
-
// },
|
|
1407
|
-
// );
|
|
1408
|
-
// returnData.push(response as IDataObject);
|
|
1409
|
-
// }
|
|
1410
|
-
// }
|
|
1411
|
-
// ====================================
|
|
1412
1340
|
// WATERFALL OPERATIONS
|
|
1413
1341
|
// ====================================
|
|
1414
1342
|
else if (resource === 'waterfall') {
|
|
@@ -1418,10 +1346,18 @@ class Databar {
|
|
|
1418
1346
|
url: 'https://api.databar.ai/v1/waterfalls/',
|
|
1419
1347
|
});
|
|
1420
1348
|
if (Array.isArray(response)) {
|
|
1421
|
-
|
|
1349
|
+
for (const item of response) {
|
|
1350
|
+
returnData.push({
|
|
1351
|
+
json: item,
|
|
1352
|
+
pairedItem: { item: i },
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1422
1355
|
}
|
|
1423
1356
|
else {
|
|
1424
|
-
returnData.push(
|
|
1357
|
+
returnData.push({
|
|
1358
|
+
json: response,
|
|
1359
|
+
pairedItem: { item: i },
|
|
1360
|
+
});
|
|
1425
1361
|
}
|
|
1426
1362
|
}
|
|
1427
1363
|
else if (operation === 'get') {
|
|
@@ -1430,7 +1366,10 @@ class Databar {
|
|
|
1430
1366
|
method: 'GET',
|
|
1431
1367
|
url: `https://api.databar.ai/v1/waterfalls/${waterfallIdentifier}`,
|
|
1432
1368
|
});
|
|
1433
|
-
returnData.push(
|
|
1369
|
+
returnData.push({
|
|
1370
|
+
json: response,
|
|
1371
|
+
pairedItem: { item: i },
|
|
1372
|
+
});
|
|
1434
1373
|
}
|
|
1435
1374
|
else if (operation === 'run') {
|
|
1436
1375
|
const waterfallIdentifier = this.getNodeParameter('waterfallIdentifier', i);
|
|
@@ -1472,10 +1411,16 @@ class Databar {
|
|
|
1472
1411
|
const taskId = taskResponse.task_id;
|
|
1473
1412
|
// Poll for completion
|
|
1474
1413
|
const completedTask = await pollTaskStatus(this, taskId, pollInterval, timeout);
|
|
1475
|
-
returnData.push(
|
|
1414
|
+
returnData.push({
|
|
1415
|
+
json: completedTask,
|
|
1416
|
+
pairedItem: { item: i },
|
|
1417
|
+
});
|
|
1476
1418
|
}
|
|
1477
1419
|
else {
|
|
1478
|
-
returnData.push(
|
|
1420
|
+
returnData.push({
|
|
1421
|
+
json: taskResponse,
|
|
1422
|
+
pairedItem: { item: i },
|
|
1423
|
+
});
|
|
1479
1424
|
}
|
|
1480
1425
|
}
|
|
1481
1426
|
}
|
|
@@ -1483,13 +1428,16 @@ class Databar {
|
|
|
1483
1428
|
catch (error) {
|
|
1484
1429
|
if (this.continueOnFail()) {
|
|
1485
1430
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1486
|
-
returnData.push({
|
|
1431
|
+
returnData.push({
|
|
1432
|
+
json: { error: errorMessage },
|
|
1433
|
+
pairedItem: { item: i },
|
|
1434
|
+
});
|
|
1487
1435
|
continue;
|
|
1488
1436
|
}
|
|
1489
1437
|
throw error;
|
|
1490
1438
|
}
|
|
1491
1439
|
}
|
|
1492
|
-
return [
|
|
1440
|
+
return [returnData];
|
|
1493
1441
|
}
|
|
1494
1442
|
}
|
|
1495
1443
|
exports.Databar = Databar;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-databar",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "n8n node for Databar.ai API - data enrichment and table management",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -53,13 +53,11 @@
|
|
|
53
53
|
"eslint": "^8.29.0",
|
|
54
54
|
"eslint-plugin-n8n-nodes-base": "^1.11.0",
|
|
55
55
|
"gulp": "^4.0.2",
|
|
56
|
-
"n8n-workflow": "^1.0.0",
|
|
57
56
|
"prettier": "^2.7.1",
|
|
58
57
|
"typescript": "^4.9.4"
|
|
59
58
|
},
|
|
60
59
|
"peerDependencies": {
|
|
61
60
|
"n8n-workflow": "*"
|
|
62
|
-
}
|
|
63
|
-
"dependencies": {}
|
|
61
|
+
}
|
|
64
62
|
}
|
|
65
63
|
|