n8n-nodes-databar 0.1.2 → 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 CHANGED
@@ -126,10 +126,10 @@ Guided Fields:
126
126
  First Name: John (Optional)
127
127
 
128
128
  Raw JSON:
129
- {
130
- "email": "john@example.com",
131
- "first_name": "John"
132
- }
129
+ {
130
+ "email": "john@example.com",
131
+ "first_name": "John"
132
+ }
133
133
  ```
134
134
 
135
135
  ### Automatic Async Handling
@@ -64,9 +64,7 @@ async function pollTaskStatus(context, taskId, pollInterval, timeout) {
64
64
  throw new n8n_workflow_1.NodeOperationError(context.getNode(), `Task ${taskId} failed: ${error}`);
65
65
  }
66
66
  // Wait before polling again
67
- await new Promise((resolve) => {
68
- globalThis.setTimeout(resolve, pollIntervalMs);
69
- });
67
+ await (0, n8n_workflow_1.sleep)(pollIntervalMs);
70
68
  }
71
69
  }
72
70
  class Databar {
@@ -82,8 +80,8 @@ class Databar {
82
80
  defaults: {
83
81
  name: 'Databar',
84
82
  },
85
- inputs: ['main'],
86
- outputs: ['main'],
83
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
84
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
87
85
  credentials: [
88
86
  {
89
87
  name: 'databarApi',
@@ -1236,7 +1234,10 @@ class Databar {
1236
1234
  method: 'GET',
1237
1235
  url: 'https://api.databar.ai/v1/user/me',
1238
1236
  });
1239
- returnData.push(response);
1237
+ returnData.push({
1238
+ json: response,
1239
+ pairedItem: { item: i },
1240
+ });
1240
1241
  }
1241
1242
  }
1242
1243
  // ====================================
@@ -1282,10 +1283,16 @@ class Databar {
1282
1283
  const taskId = taskResponse.task_id;
1283
1284
  // Poll for completion
1284
1285
  const completedTask = await pollTaskStatus(this, taskId, pollInterval, timeout);
1285
- returnData.push(completedTask);
1286
+ returnData.push({
1287
+ json: completedTask,
1288
+ pairedItem: { item: i },
1289
+ });
1286
1290
  }
1287
1291
  else {
1288
- returnData.push(taskResponse);
1292
+ returnData.push({
1293
+ json: taskResponse,
1294
+ pairedItem: { item: i },
1295
+ });
1289
1296
  }
1290
1297
  }
1291
1298
  else if (operation === 'bulkRun') {
@@ -1316,90 +1323,20 @@ class Databar {
1316
1323
  const taskId = taskResponse.task_id;
1317
1324
  // Poll for completion
1318
1325
  const completedTask = await pollTaskStatus(this, taskId, pollInterval, timeout);
1319
- returnData.push(completedTask);
1326
+ returnData.push({
1327
+ json: completedTask,
1328
+ pairedItem: { item: i },
1329
+ });
1320
1330
  }
1321
1331
  else {
1322
- returnData.push(taskResponse);
1332
+ returnData.push({
1333
+ json: taskResponse,
1334
+ pairedItem: { item: i },
1335
+ });
1323
1336
  }
1324
1337
  }
1325
1338
  }
1326
1339
  // ====================================
1327
- // TABLE OPERATIONS
1328
- // ====================================
1329
- // Table operations temporarily hidden - can be re-enabled later
1330
- // else if (resource === 'table') {
1331
- // if (operation === 'create') {
1332
- // const response = await this.helpers.httpRequestWithAuthentication.call(
1333
- // this,
1334
- // 'databarApi',
1335
- // {
1336
- // method: 'POST',
1337
- // url: 'https://api.databar.ai/v1/table/create',
1338
- // body: {},
1339
- // },
1340
- // );
1341
- // returnData.push(response as IDataObject);
1342
- // } else if (operation === 'list') {
1343
- // const response = await this.helpers.httpRequestWithAuthentication.call(
1344
- // this,
1345
- // 'databarApi',
1346
- // {
1347
- // method: 'GET',
1348
- // url: 'https://api.databar.ai/v1/table/',
1349
- // },
1350
- // );
1351
- // if (Array.isArray(response)) {
1352
- // returnData.push(...(response as IDataObject[]));
1353
- // } else {
1354
- // returnData.push(response as IDataObject);
1355
- // }
1356
- // } else if (operation === 'getRows') {
1357
- // const tableUuid = this.getNodeParameter('tableUuid', i) as string;
1358
- // const perPage = this.getNodeParameter('perPage', i) as number;
1359
- // const page = this.getNodeParameter('page', i) as number;
1360
- //
1361
- // const response = await this.helpers.httpRequestWithAuthentication.call(
1362
- // this,
1363
- // 'databarApi',
1364
- // {
1365
- // method: 'GET',
1366
- // url: `https://api.databar.ai/v1/table/${tableUuid}/rows`,
1367
- // qs: { per_page: perPage, page },
1368
- // },
1369
- // );
1370
- // returnData.push(response as IDataObject);
1371
- // } else if (operation === 'getColumns') {
1372
- // const tableUuid = this.getNodeParameter('tableUuid', i) as string;
1373
- //
1374
- // const response = await this.helpers.httpRequestWithAuthentication.call(
1375
- // this,
1376
- // 'databarApi',
1377
- // {
1378
- // method: 'GET',
1379
- // url: `https://api.databar.ai/v1/table/${tableUuid}/columns`,
1380
- // },
1381
- // );
1382
- // if (Array.isArray(response)) {
1383
- // returnData.push(...(response as IDataObject[]));
1384
- // } else {
1385
- // returnData.push(response as IDataObject);
1386
- // }
1387
- // } else if (operation === 'runEnrichment') {
1388
- // const tableUuid = this.getNodeParameter('tableUuid', i) as string;
1389
- // const tableEnrichmentId = this.getNodeParameter('tableEnrichmentId', i) as string;
1390
- //
1391
- // const response = await this.helpers.httpRequestWithAuthentication.call(
1392
- // this,
1393
- // 'databarApi',
1394
- // {
1395
- // method: 'GET',
1396
- // url: `https://api.databar.ai/v1/table/${tableUuid}/run-enrichment/${tableEnrichmentId}`,
1397
- // },
1398
- // );
1399
- // returnData.push(response as IDataObject);
1400
- // }
1401
- // }
1402
- // ====================================
1403
1340
  // WATERFALL OPERATIONS
1404
1341
  // ====================================
1405
1342
  else if (resource === 'waterfall') {
@@ -1409,10 +1346,18 @@ class Databar {
1409
1346
  url: 'https://api.databar.ai/v1/waterfalls/',
1410
1347
  });
1411
1348
  if (Array.isArray(response)) {
1412
- returnData.push(...response);
1349
+ for (const item of response) {
1350
+ returnData.push({
1351
+ json: item,
1352
+ pairedItem: { item: i },
1353
+ });
1354
+ }
1413
1355
  }
1414
1356
  else {
1415
- returnData.push(response);
1357
+ returnData.push({
1358
+ json: response,
1359
+ pairedItem: { item: i },
1360
+ });
1416
1361
  }
1417
1362
  }
1418
1363
  else if (operation === 'get') {
@@ -1421,7 +1366,10 @@ class Databar {
1421
1366
  method: 'GET',
1422
1367
  url: `https://api.databar.ai/v1/waterfalls/${waterfallIdentifier}`,
1423
1368
  });
1424
- returnData.push(response);
1369
+ returnData.push({
1370
+ json: response,
1371
+ pairedItem: { item: i },
1372
+ });
1425
1373
  }
1426
1374
  else if (operation === 'run') {
1427
1375
  const waterfallIdentifier = this.getNodeParameter('waterfallIdentifier', i);
@@ -1463,10 +1411,16 @@ class Databar {
1463
1411
  const taskId = taskResponse.task_id;
1464
1412
  // Poll for completion
1465
1413
  const completedTask = await pollTaskStatus(this, taskId, pollInterval, timeout);
1466
- returnData.push(completedTask);
1414
+ returnData.push({
1415
+ json: completedTask,
1416
+ pairedItem: { item: i },
1417
+ });
1467
1418
  }
1468
1419
  else {
1469
- returnData.push(taskResponse);
1420
+ returnData.push({
1421
+ json: taskResponse,
1422
+ pairedItem: { item: i },
1423
+ });
1470
1424
  }
1471
1425
  }
1472
1426
  }
@@ -1474,13 +1428,16 @@ class Databar {
1474
1428
  catch (error) {
1475
1429
  if (this.continueOnFail()) {
1476
1430
  const errorMessage = error instanceof Error ? error.message : String(error);
1477
- returnData.push({ error: errorMessage });
1431
+ returnData.push({
1432
+ json: { error: errorMessage },
1433
+ pairedItem: { item: i },
1434
+ });
1478
1435
  continue;
1479
1436
  }
1480
1437
  throw error;
1481
1438
  }
1482
1439
  }
1483
- return [this.helpers.returnJsonArray(returnData)];
1440
+ return [returnData];
1484
1441
  }
1485
1442
  }
1486
1443
  exports.Databar = Databar;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-databar",
3
- "version": "0.1.2",
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