bellboy 6.7.0 → 6.7.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/lib/processors/http-processor.js +3 -1
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +24 -1
- package/package.json +1 -1
|
@@ -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
|
|
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 = [];
|