@opentap/runner-client 2.9.1 → 2.10.0-alpha.1.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/BaseClient.js +7 -4
- package/package.json +1 -1
package/lib/BaseClient.js
CHANGED
|
@@ -145,7 +145,7 @@ var BaseClient = /** @class */ (function () {
|
|
|
145
145
|
responsePromise = new Promise(function (resolve, reject) {
|
|
146
146
|
var messages = [];
|
|
147
147
|
subscription.callback = function (error, message) {
|
|
148
|
-
var _a, _b;
|
|
148
|
+
var _a, _b, _c, _d;
|
|
149
149
|
if (error) {
|
|
150
150
|
return reject(error);
|
|
151
151
|
}
|
|
@@ -185,16 +185,19 @@ var BaseClient = /** @class */ (function () {
|
|
|
185
185
|
flattenedArray[k++] = m[i];
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
|
-
|
|
188
|
+
console.log((_c = finalMessage.headers) === null || _c === void 0 ? void 0 : _c.get('OpenTapNatsError'));
|
|
189
|
+
console.log(typeof ((_d = finalMessage.headers) === null || _d === void 0 ? void 0 : _d.get('OpenTapNatsError')));
|
|
190
|
+
return resolve({ byteArray: flattenedArray, isErrorResponse: false });
|
|
189
191
|
};
|
|
190
|
-
}).then(function (
|
|
192
|
+
}).then(function (_a) {
|
|
193
|
+
var byteArray = _a.byteArray, isErrorResponse = _a.isErrorResponse;
|
|
191
194
|
if (byteArray.length === 0) {
|
|
192
195
|
return Promise.resolve(undefined);
|
|
193
196
|
}
|
|
194
197
|
var jsonCodec = JSONCodec();
|
|
195
198
|
// If a raw response is requested, we should avoid decoding the bytes.
|
|
196
199
|
var response = (options === null || options === void 0 ? void 0 : options.rawResponse) ? byteArray : jsonCodec.decode(byteArray);
|
|
197
|
-
return
|
|
200
|
+
return isErrorResponse ? Promise.reject(ErrorResponse.fromJS(response)) : Promise.resolve(response);
|
|
198
201
|
});
|
|
199
202
|
chunk = getChunk(0);
|
|
200
203
|
this.connection.publish(subject, chunk, opts);
|