bellboy 6.7.0 → 6.7.2

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/lib/job.js CHANGED
@@ -89,6 +89,7 @@ var Job = /** @class */ (function () {
89
89
  this.stop = function (message) {
90
90
  _this.stopped = true;
91
91
  if (readStream && (readStream instanceof stream_1.Readable)) {
92
+ readStream.emit('end');
92
93
  readStream.destroy();
93
94
  }
94
95
  errorMessage = message;
@@ -151,7 +151,9 @@ var HttpProcessor = /** @class */ (function (_super) {
151
151
  return [4 /*yield*/, axios_1.default(__assign(__assign({}, options), { responseType: 'stream' }))];
152
152
  case 7:
153
153
  requestStream = _a.sent();
154
- xmlStream = requestStream.data.pipe(saxStream(this.saxOptions));
154
+ xmlStream = requestStream.data
155
+ .pipe(saxStream(this.saxOptions))
156
+ .pipe(utils_1.removeCircularReferencesFromChunk());
155
157
  return [4 /*yield*/, processStream(xmlStream)];
156
158
  case 8:
157
159
  _a.sent();
package/lib/utils.d.ts CHANGED
@@ -5,6 +5,7 @@ import { AuthorizationRequest, DbTypes, IDbConnection } from './types';
5
5
  export declare function getDb(databaseConfig: IDbConnection, dbType: DbTypes): Promise<any>;
6
6
  export declare function closeDbConnection(databaseConfig: IDbConnection): Promise<void>;
7
7
  export declare function getValueFromJSONChunk(): Transform;
8
+ export declare function removeCircularReferencesFromChunk(): Transform;
8
9
  export declare function getDelimitedGenerator({ readStream, hasHeader, }: {
9
10
  readStream: any;
10
11
  hasHeader: boolean;
package/lib/utils.js CHANGED
@@ -88,7 +88,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
88
88
  return (mod && mod.__esModule) ? mod : { "default": mod };
89
89
  };
90
90
  Object.defineProperty(exports, "__esModule", { value: true });
91
- exports.applyHttpAuthorization = exports.getDelimitedGenerator = exports.getValueFromJSONChunk = exports.closeDbConnection = exports.getDb = void 0;
91
+ exports.applyHttpAuthorization = exports.getDelimitedGenerator = exports.removeCircularReferencesFromChunk = exports.getValueFromJSONChunk = exports.closeDbConnection = exports.getDb = void 0;
92
92
  var axios_1 = __importDefault(require("axios"));
93
93
  var stream_1 = require("stream");
94
94
  var cachedDbConnections = new Map();
@@ -172,6 +172,29 @@ function getValueFromJSONChunk() {
172
172
  }
173
173
  exports.getValueFromJSONChunk = getValueFromJSONChunk;
174
174
  ;
175
+ function removeCircularReferencesFromChunk() {
176
+ return new stream_1.Transform({
177
+ objectMode: true,
178
+ transform: function (chunk, encoding, callback) {
179
+ function getCircularReplacer() {
180
+ var seen = new WeakSet();
181
+ return function (key, value) {
182
+ if (typeof value === "object" && value !== null) {
183
+ if (seen.has(value)) {
184
+ return;
185
+ }
186
+ seen.add(value);
187
+ }
188
+ return value;
189
+ };
190
+ }
191
+ this.push(JSON.parse(JSON.stringify(chunk, getCircularReplacer())));
192
+ callback();
193
+ }
194
+ });
195
+ }
196
+ exports.removeCircularReferencesFromChunk = removeCircularReferencesFromChunk;
197
+ ;
175
198
  function getDelimitedGenerator(_a) {
176
199
  var readStream = _a.readStream, hasHeader = _a.hasHeader;
177
200
  var header = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bellboy",
3
- "version": "6.7.0",
3
+ "version": "6.7.2",
4
4
  "description": "Highly performant JavaScript data stream ETL engine.",
5
5
  "main": "lib/index",
6
6
  "types": "lib/index",