n8n-nodes-dataforb2b 1.0.4 → 1.0.6
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.
|
@@ -5,22 +5,36 @@ const n8n_workflow_1 = require("n8n-workflow");
|
|
|
5
5
|
const DATAFORB2B_API_BASE_URL = "https://api.dataforb2b.ai";
|
|
6
6
|
// Operators disponibles par type
|
|
7
7
|
const textOperators = [
|
|
8
|
-
{ name: "Equals", value: "
|
|
9
|
-
{ name: "Not Equals", value: "
|
|
8
|
+
{ name: "Equals", value: "eq" },
|
|
9
|
+
{ name: "Not Equals", value: "neq" },
|
|
10
10
|
{ name: "Contains", value: "like" },
|
|
11
11
|
{ name: "Not Contains", value: "not_like" },
|
|
12
12
|
{ name: "In List", value: "in" },
|
|
13
13
|
{ name: "Not In List", value: "not_in" },
|
|
14
14
|
];
|
|
15
15
|
const numericOperators = [
|
|
16
|
-
{ name: "Equals", value: "
|
|
17
|
-
{ name: "Not Equals", value: "
|
|
18
|
-
{ name: "Greater Than", value: "
|
|
19
|
-
{ name: "Greater Than or Equal", value: "
|
|
20
|
-
{ name: "Less Than", value: "
|
|
21
|
-
{ name: "Less Than or Equal", value: "
|
|
16
|
+
{ name: "Equals", value: "eq" },
|
|
17
|
+
{ name: "Not Equals", value: "neq" },
|
|
18
|
+
{ name: "Greater Than", value: "gt" },
|
|
19
|
+
{ name: "Greater Than or Equal", value: "gte" },
|
|
20
|
+
{ name: "Less Than", value: "lt" },
|
|
21
|
+
{ name: "Less Than or Equal", value: "lte" },
|
|
22
22
|
{ name: "Between", value: "between" },
|
|
23
23
|
];
|
|
24
|
+
// Map UI operator values to API operator values
|
|
25
|
+
const operatorMap = {
|
|
26
|
+
eq: "=",
|
|
27
|
+
neq: "!=",
|
|
28
|
+
gt: ">",
|
|
29
|
+
gte: ">=",
|
|
30
|
+
lt: "<",
|
|
31
|
+
lte: "<=",
|
|
32
|
+
like: "like",
|
|
33
|
+
not_like: "not_like",
|
|
34
|
+
in: "in",
|
|
35
|
+
not_in: "not_in",
|
|
36
|
+
between: "between",
|
|
37
|
+
};
|
|
24
38
|
// People filter fields
|
|
25
39
|
const peopleFilterFields = [
|
|
26
40
|
// Profile
|
|
@@ -431,10 +445,11 @@ class DataForB2B {
|
|
|
431
445
|
const filterLogic = this.getNodeParameter("filterLogic", i);
|
|
432
446
|
const peopleFilters = this.getNodeParameter("peopleFilters", i);
|
|
433
447
|
const conditions = (peopleFilters.conditions || []).map((cond) => {
|
|
448
|
+
const apiOperator = operatorMap[cond.operator] || cond.operator;
|
|
434
449
|
const condition = {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
value:
|
|
450
|
+
column: cond.field,
|
|
451
|
+
type: apiOperator,
|
|
452
|
+
value: apiOperator === "in" || apiOperator === "not_in"
|
|
438
453
|
? cond.value.split(",").map((v) => v.trim())
|
|
439
454
|
: cond.value,
|
|
440
455
|
};
|
|
@@ -446,7 +461,6 @@ class DataForB2B {
|
|
|
446
461
|
body = {
|
|
447
462
|
filters: { op: filterLogic, conditions },
|
|
448
463
|
count: this.getNodeParameter("count", i),
|
|
449
|
-
offset: this.getNodeParameter("offset", i),
|
|
450
464
|
};
|
|
451
465
|
break;
|
|
452
466
|
}
|
|
@@ -455,10 +469,11 @@ class DataForB2B {
|
|
|
455
469
|
const filterLogic = this.getNodeParameter("filterLogic", i);
|
|
456
470
|
const companyFilters = this.getNodeParameter("companyFilters", i);
|
|
457
471
|
const conditions = (companyFilters.conditions || []).map((cond) => {
|
|
472
|
+
const apiOperator = operatorMap[cond.operator] || cond.operator;
|
|
458
473
|
const condition = {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
value:
|
|
474
|
+
column: cond.field,
|
|
475
|
+
type: apiOperator,
|
|
476
|
+
value: apiOperator === "in" || apiOperator === "not_in"
|
|
462
477
|
? cond.value.split(",").map((v) => v.trim())
|
|
463
478
|
: cond.value,
|
|
464
479
|
};
|
|
@@ -470,7 +485,6 @@ class DataForB2B {
|
|
|
470
485
|
body = {
|
|
471
486
|
filters: { op: filterLogic, conditions },
|
|
472
487
|
count: this.getNodeParameter("count", i),
|
|
473
|
-
offset: this.getNodeParameter("offset", i),
|
|
474
488
|
};
|
|
475
489
|
break;
|
|
476
490
|
}
|