@opentap/runner-client 2.25.2-alpha.1.2.11280720052 → 2.25.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/dist/cjs/RunnerClient.js +27 -34
- package/dist/mjs/RunnerClient.js +21 -26
- package/package.json +1 -1
package/dist/cjs/RunnerClient.js
CHANGED
|
@@ -307,11 +307,11 @@ var RunnerClient = /** @class */ (function (_super) {
|
|
|
307
307
|
switch (_b.label) {
|
|
308
308
|
case 0:
|
|
309
309
|
_loop_1 = function () {
|
|
310
|
-
var consumerInfo, arraySize, metricData_1, messages, index, messages_1, messages_1_1, message, e_1_1, error_1
|
|
310
|
+
var consumerInfo, arraySize, metricData_1, messages, index, messages_1, messages_1_1, message, e_1_1, error_1;
|
|
311
311
|
return __generator(this, function (_c) {
|
|
312
312
|
switch (_c.label) {
|
|
313
313
|
case 0:
|
|
314
|
-
_c.trys.push([0,
|
|
314
|
+
_c.trys.push([0, 15, , 16]);
|
|
315
315
|
return [4 /*yield*/, consumer.info()];
|
|
316
316
|
case 1:
|
|
317
317
|
consumerInfo = _c.sent();
|
|
@@ -320,21 +320,18 @@ var RunnerClient = /** @class */ (function (_super) {
|
|
|
320
320
|
encodedMetrics: new Array(arraySize),
|
|
321
321
|
timestamps: new Array(arraySize),
|
|
322
322
|
};
|
|
323
|
-
_c.label = 2;
|
|
324
|
-
case 2:
|
|
325
|
-
_c.trys.push([2, 16, , 17]);
|
|
326
323
|
return [4 /*yield*/, consumer.fetch({ max_messages: arraySize })];
|
|
327
|
-
case
|
|
324
|
+
case 2:
|
|
328
325
|
messages = _c.sent();
|
|
329
326
|
index = 0;
|
|
330
|
-
_c.label =
|
|
331
|
-
case
|
|
332
|
-
_c.trys.push([
|
|
327
|
+
_c.label = 3;
|
|
328
|
+
case 3:
|
|
329
|
+
_c.trys.push([3, 8, 9, 14]);
|
|
333
330
|
messages_1 = (e_1 = void 0, __asyncValues(messages));
|
|
334
|
-
_c.label =
|
|
335
|
-
case
|
|
336
|
-
case
|
|
337
|
-
if (!(messages_1_1 = _c.sent(), !messages_1_1.done)) return [3 /*break*/,
|
|
331
|
+
_c.label = 4;
|
|
332
|
+
case 4: return [4 /*yield*/, messages_1.next()];
|
|
333
|
+
case 5:
|
|
334
|
+
if (!(messages_1_1 = _c.sent(), !messages_1_1.done)) return [3 /*break*/, 7];
|
|
338
335
|
message = messages_1_1.value;
|
|
339
336
|
// Store the message data and timestamp
|
|
340
337
|
metricData_1.encodedMetrics[index] = message.data;
|
|
@@ -344,38 +341,34 @@ var RunnerClient = /** @class */ (function (_super) {
|
|
|
344
341
|
(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
345
342
|
return [2 /*return*/, handler(metricData_1)];
|
|
346
343
|
}); }); })();
|
|
347
|
-
return [3 /*break*/,
|
|
344
|
+
return [3 /*break*/, 7];
|
|
348
345
|
}
|
|
349
346
|
// Increment the index
|
|
350
347
|
index++;
|
|
351
|
-
_c.label =
|
|
352
|
-
case
|
|
353
|
-
case
|
|
354
|
-
case
|
|
348
|
+
_c.label = 6;
|
|
349
|
+
case 6: return [3 /*break*/, 4];
|
|
350
|
+
case 7: return [3 /*break*/, 14];
|
|
351
|
+
case 8:
|
|
355
352
|
e_1_1 = _c.sent();
|
|
356
353
|
e_1 = { error: e_1_1 };
|
|
357
|
-
return [3 /*break*/,
|
|
358
|
-
case
|
|
359
|
-
_c.trys.push([
|
|
360
|
-
if (!(messages_1_1 && !messages_1_1.done && (_a = messages_1.return))) return [3 /*break*/,
|
|
354
|
+
return [3 /*break*/, 14];
|
|
355
|
+
case 9:
|
|
356
|
+
_c.trys.push([9, , 12, 13]);
|
|
357
|
+
if (!(messages_1_1 && !messages_1_1.done && (_a = messages_1.return))) return [3 /*break*/, 11];
|
|
361
358
|
return [4 /*yield*/, _a.call(messages_1)];
|
|
362
|
-
case
|
|
359
|
+
case 10:
|
|
363
360
|
_c.sent();
|
|
364
|
-
_c.label =
|
|
365
|
-
case
|
|
366
|
-
case
|
|
361
|
+
_c.label = 11;
|
|
362
|
+
case 11: return [3 /*break*/, 13];
|
|
363
|
+
case 12:
|
|
367
364
|
if (e_1) throw e_1.error;
|
|
368
365
|
return [7 /*endfinally*/];
|
|
369
|
-
case
|
|
370
|
-
case
|
|
371
|
-
case
|
|
366
|
+
case 13: return [7 /*endfinally*/];
|
|
367
|
+
case 14: return [3 /*break*/, 16];
|
|
368
|
+
case 15:
|
|
372
369
|
error_1 = _c.sent();
|
|
373
370
|
return [2 /*return*/, "break"];
|
|
374
|
-
case
|
|
375
|
-
case 18:
|
|
376
|
-
error_2 = _c.sent();
|
|
377
|
-
return [2 /*return*/, "break"];
|
|
378
|
-
case 19: return [2 /*return*/];
|
|
371
|
+
case 16: return [2 /*return*/];
|
|
379
372
|
}
|
|
380
373
|
});
|
|
381
374
|
};
|
package/dist/mjs/RunnerClient.js
CHANGED
|
@@ -252,36 +252,31 @@ export class RunnerClient extends BaseClient {
|
|
|
252
252
|
encodedMetrics: new Array(arraySize),
|
|
253
253
|
timestamps: new Array(arraySize),
|
|
254
254
|
};
|
|
255
|
+
// Fetch the messages
|
|
256
|
+
const messages = yield consumer.fetch({ max_messages: arraySize });
|
|
257
|
+
// for await of doesn't return the index, so we need to keep track of it
|
|
258
|
+
let index = 0;
|
|
255
259
|
try {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
metricData.timestamps[index] = message.info.timestampNanos;
|
|
266
|
-
// If we are at the last message or there are no more pending messages, call the handler
|
|
267
|
-
if (index === arraySize - 1 || message.info.pending === 0) {
|
|
268
|
-
(() => __awaiter(this, void 0, void 0, function* () { return handler(metricData); }))();
|
|
269
|
-
break;
|
|
270
|
-
}
|
|
271
|
-
// Increment the index
|
|
272
|
-
index++;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
276
|
-
finally {
|
|
277
|
-
try {
|
|
278
|
-
if (messages_1_1 && !messages_1_1.done && (_a = messages_1.return)) yield _a.call(messages_1);
|
|
260
|
+
for (var messages_1 = (e_1 = void 0, __asyncValues(messages)), messages_1_1; messages_1_1 = yield messages_1.next(), !messages_1_1.done;) {
|
|
261
|
+
const message = messages_1_1.value;
|
|
262
|
+
// Store the message data and timestamp
|
|
263
|
+
metricData.encodedMetrics[index] = message.data;
|
|
264
|
+
metricData.timestamps[index] = message.info.timestampNanos;
|
|
265
|
+
// If we are at the last message or there are no more pending messages, call the handler
|
|
266
|
+
if (index === arraySize - 1 || message.info.pending === 0) {
|
|
267
|
+
(() => __awaiter(this, void 0, void 0, function* () { return handler(metricData); }))();
|
|
268
|
+
break;
|
|
279
269
|
}
|
|
280
|
-
|
|
270
|
+
// Increment the index
|
|
271
|
+
index++;
|
|
281
272
|
}
|
|
282
273
|
}
|
|
283
|
-
catch (
|
|
284
|
-
|
|
274
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
275
|
+
finally {
|
|
276
|
+
try {
|
|
277
|
+
if (messages_1_1 && !messages_1_1.done && (_a = messages_1.return)) yield _a.call(messages_1);
|
|
278
|
+
}
|
|
279
|
+
finally { if (e_1) throw e_1.error; }
|
|
285
280
|
}
|
|
286
281
|
}
|
|
287
282
|
catch (error) {
|
package/package.json
CHANGED