@opentap/runner-client 2.9.1-alpha.1.1 → 2.10.0-alpha.1.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/BaseClient.js +6 -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;
|
|
149
149
|
if (error) {
|
|
150
150
|
return reject(error);
|
|
151
151
|
}
|
|
@@ -185,16 +185,18 @@ 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
|
+
return resolve({ byteArray: flattenedArray, isErrorResponse: false });
|
|
189
190
|
};
|
|
190
|
-
}).then(function (
|
|
191
|
+
}).then(function (_a) {
|
|
192
|
+
var byteArray = _a.byteArray, isErrorResponse = _a.isErrorResponse;
|
|
191
193
|
if (byteArray.length === 0) {
|
|
192
194
|
return Promise.resolve(undefined);
|
|
193
195
|
}
|
|
194
196
|
var jsonCodec = JSONCodec();
|
|
195
197
|
// If a raw response is requested, we should avoid decoding the bytes.
|
|
196
198
|
var response = (options === null || options === void 0 ? void 0 : options.rawResponse) ? byteArray : jsonCodec.decode(byteArray);
|
|
197
|
-
return
|
|
199
|
+
return isErrorResponse ? Promise.reject(ErrorResponse.fromJS(response)) : Promise.resolve(response);
|
|
198
200
|
});
|
|
199
201
|
chunk = getChunk(0);
|
|
200
202
|
this.connection.publish(subject, chunk, opts);
|