bellboy 8.2.0 → 8.2.1
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
|
@@ -121,6 +121,7 @@ const job = new bellboy.Job(
|
|
|
121
121
|
|
|
122
122
|
Event listeners, which can be registered with `job.on` or `job.onAny` methods, allow you to listen to specific events in the job lifecycle and to interact with them.
|
|
123
123
|
|
|
124
|
+
- When multiple listeners are registered for the same event, those added using `.on` will always be executed first, regardless of the order in which they were added compared to `.onAny`. This ensures that specific event listeners have priority over generic ones.
|
|
124
125
|
- When multiple listeners are registered for a single event, those added by [reporters](#reporters) will be executed first, followed by the order of registration for the remaining listeners.
|
|
125
126
|
- Job always waits for the code inside a listener to complete.
|
|
126
127
|
- Any error thrown inside a listener will be ignored and warning message will be printed out.
|
|
@@ -63,10 +63,10 @@ var PostgresDestination = /** @class */ (function (_super) {
|
|
|
63
63
|
}
|
|
64
64
|
PostgresDestination.prototype.loadBatch = function (data) {
|
|
65
65
|
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
-
var dataToUpload, columnDict, upsertConstraints, columnIndex, i, transformed, _i, _a, key, columns, cs, db;
|
|
66
|
+
var dataToUpload, columnDict, upsertConstraints, columnIndex, i, transformed, _i, _a, key, columnKeys, _b, dataToUpload_1, item, itemDataKeys, _c, columnKeys_1, key, columns, cs, db;
|
|
67
67
|
var _this = this;
|
|
68
|
-
return __generator(this, function (
|
|
69
|
-
switch (
|
|
68
|
+
return __generator(this, function (_d) {
|
|
69
|
+
switch (_d.label) {
|
|
70
70
|
case 0:
|
|
71
71
|
dataToUpload = [];
|
|
72
72
|
columnDict = {};
|
|
@@ -84,11 +84,22 @@ var PostgresDestination = /** @class */ (function (_super) {
|
|
|
84
84
|
}
|
|
85
85
|
dataToUpload.push(transformed);
|
|
86
86
|
}
|
|
87
|
+
columnKeys = Object.values(columnDict);
|
|
88
|
+
for (_b = 0, dataToUpload_1 = dataToUpload; _b < dataToUpload_1.length; _b++) {
|
|
89
|
+
item = dataToUpload_1[_b];
|
|
90
|
+
itemDataKeys = Object.keys(item);
|
|
91
|
+
for (_c = 0, columnKeys_1 = columnKeys; _c < columnKeys_1.length; _c++) {
|
|
92
|
+
key = columnKeys_1[_c];
|
|
93
|
+
if (!itemDataKeys.includes(key)) {
|
|
94
|
+
item[key] = undefined;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
87
98
|
columns = Object.keys(columnDict).map(function (x) { return ({ name: x, prop: columnDict[x] }); });
|
|
88
99
|
cs = new pgp.helpers.ColumnSet(columns, { table: this.table });
|
|
89
100
|
return [4 /*yield*/, utils_1.getDb(this.connection, 'postgres')];
|
|
90
101
|
case 1:
|
|
91
|
-
db =
|
|
102
|
+
db = _d.sent();
|
|
92
103
|
return [4 /*yield*/, db.tx(function (t) { return __awaiter(_this, void 0, void 0, function () {
|
|
93
104
|
var query, columnsString;
|
|
94
105
|
return __generator(this, function (_a) {
|
|
@@ -104,7 +115,7 @@ var PostgresDestination = /** @class */ (function (_super) {
|
|
|
104
115
|
});
|
|
105
116
|
}); })];
|
|
106
117
|
case 2:
|
|
107
|
-
|
|
118
|
+
_d.sent();
|
|
108
119
|
return [2 /*return*/];
|
|
109
120
|
}
|
|
110
121
|
});
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bellboy",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.1",
|
|
4
4
|
"description": "Highly performant JavaScript data stream ETL engine.",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"types": "lib/index",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc -p .",
|
|
9
|
-
"test": "jest --coverage",
|
|
9
|
+
"test": "jest --coverage ./tests/postgres-destination.spec.ts",
|
|
10
10
|
"lint": "tslint -c tslint.json -p tsconfig.json",
|
|
11
11
|
"codecov": "codecov"
|
|
12
12
|
},
|