@bitcobblers/wod-wiki-lang 0.60.2250 → 0.60.2257
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/index.cjs +78 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +78 -32
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +62 -35
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -18
- package/dist/react.d.ts +1 -18
- package/dist/react.mjs +62 -35
- package/dist/react.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -6674,8 +6674,11 @@ var OutputEmitter = class {
|
|
|
6674
6674
|
);
|
|
6675
6675
|
}
|
|
6676
6676
|
}
|
|
6677
|
-
const
|
|
6678
|
-
const timeSpan = new TimeSpan(
|
|
6677
|
+
const recordedSpans = resultFragments.filter((m) => m.type === wodWikiCore.MetricType.Spans && Array.isArray(m.value)).flatMap((m) => m.value).filter((s) => typeof s?.started === "number" && Number.isFinite(s.started));
|
|
6678
|
+
const timeSpan = recordedSpans.length > 0 ? new TimeSpan(
|
|
6679
|
+
Math.min(...recordedSpans.map((s) => s.started)),
|
|
6680
|
+
Math.max(...recordedSpans.map((s) => typeof s.ended === "number" && Number.isFinite(s.ended) ? s.ended : fallbackEndMs))
|
|
6681
|
+
) : new TimeSpan(block.executionTiming?.startTime?.getTime() ?? fallbackEndMs, fallbackEndMs);
|
|
6679
6682
|
this.add(new wodWikiCore.OutputStatement({
|
|
6680
6683
|
outputType: "segment",
|
|
6681
6684
|
completionReason: block.completionReason,
|
|
@@ -11364,6 +11367,19 @@ var ReportOutputBehavior = class {
|
|
|
11364
11367
|
}
|
|
11365
11368
|
return metrics;
|
|
11366
11369
|
}
|
|
11370
|
+
resolveFallbackTiming(ctx, nowMs) {
|
|
11371
|
+
if (ctx.block.blockType === "WaitingToStart") return null;
|
|
11372
|
+
const timing = ctx.block.executionTiming;
|
|
11373
|
+
const execStartMs = timing?.startTime?.getTime();
|
|
11374
|
+
if (execStartMs === void 0 || !Number.isFinite(execStartMs) || execStartMs > nowMs) {
|
|
11375
|
+
return null;
|
|
11376
|
+
}
|
|
11377
|
+
return {
|
|
11378
|
+
started: execStartMs,
|
|
11379
|
+
ended: nowMs,
|
|
11380
|
+
elapsedMs: Math.max(0, nowMs - execStartMs)
|
|
11381
|
+
};
|
|
11382
|
+
}
|
|
11367
11383
|
computeTimeResults(ctx, timer, customRoundLabel) {
|
|
11368
11384
|
const now = ctx.clock.currentDate;
|
|
11369
11385
|
const nowMs = now.getTime();
|
|
@@ -11371,14 +11387,17 @@ var ReportOutputBehavior = class {
|
|
|
11371
11387
|
const round = ctx.getMemoryByTag("round")[0]?.metrics[0];
|
|
11372
11388
|
if (timer && timer.spans.length > 0) {
|
|
11373
11389
|
const elapsed = calculateElapsed(timer, nowMs);
|
|
11374
|
-
const
|
|
11375
|
-
|
|
11390
|
+
const closedSpans = timer.spans.map(
|
|
11391
|
+
(s) => s.ended !== void 0 ? s : new TimeSpan(s.started, nowMs)
|
|
11392
|
+
);
|
|
11393
|
+
const firstStart = closedSpans[0].started;
|
|
11394
|
+
const lastSpan = closedSpans[closedSpans.length - 1];
|
|
11376
11395
|
const lastEnd = lastSpan.ended ?? nowMs;
|
|
11377
11396
|
const total = Math.max(0, lastEnd - firstStart);
|
|
11378
11397
|
const metrics2 = wodWikiCore.MetricContainer.empty(blockKey).add(
|
|
11379
11398
|
new ElapsedMetric(elapsed, blockKey, now),
|
|
11380
11399
|
new TotalMetric(total, blockKey, now),
|
|
11381
|
-
new SpansMetric(
|
|
11400
|
+
new SpansMetric(closedSpans, blockKey, now),
|
|
11382
11401
|
new SystemTimeMetric(this._now.now(), blockKey)
|
|
11383
11402
|
);
|
|
11384
11403
|
if (round) {
|
|
@@ -11386,11 +11405,13 @@ var ReportOutputBehavior = class {
|
|
|
11386
11405
|
}
|
|
11387
11406
|
return metrics2;
|
|
11388
11407
|
}
|
|
11389
|
-
const
|
|
11408
|
+
const fallback = this.resolveFallbackTiming(ctx, nowMs);
|
|
11409
|
+
const span = fallback ? new TimeSpan(fallback.started, fallback.ended) : new TimeSpan(nowMs, nowMs);
|
|
11410
|
+
const fallbackElapsed = fallback?.elapsedMs ?? 0;
|
|
11390
11411
|
const metrics = wodWikiCore.MetricContainer.empty(blockKey).add(
|
|
11391
|
-
new ElapsedMetric(
|
|
11392
|
-
new TotalMetric(
|
|
11393
|
-
new SpansMetric([
|
|
11412
|
+
new ElapsedMetric(fallbackElapsed, blockKey, now),
|
|
11413
|
+
new TotalMetric(fallbackElapsed, blockKey, now),
|
|
11414
|
+
new SpansMetric([span], blockKey, now),
|
|
11394
11415
|
new SystemTimeMetric(this._now.now(), blockKey)
|
|
11395
11416
|
);
|
|
11396
11417
|
if (round) {
|
|
@@ -11398,29 +11419,7 @@ var ReportOutputBehavior = class {
|
|
|
11398
11419
|
}
|
|
11399
11420
|
return metrics;
|
|
11400
11421
|
}
|
|
11401
|
-
|
|
11402
|
-
const now = ctx.clock.currentDate;
|
|
11403
|
-
const nowMs = now.getTime();
|
|
11404
|
-
const blockKey = ctx.block.key.toString();
|
|
11405
|
-
const round = ctx.getMemoryByTag("round")[0]?.metrics[0];
|
|
11406
|
-
if (!timer || timer.spans.length === 0) {
|
|
11407
|
-
return groups.map((group) => {
|
|
11408
|
-
const groupFragments = group.clone().add(
|
|
11409
|
-
new ElapsedMetric(0, blockKey, now),
|
|
11410
|
-
new TotalMetric(0, blockKey, now),
|
|
11411
|
-
new SpansMetric([new TimeSpan(nowMs, nowMs)], blockKey, now),
|
|
11412
|
-
new SystemTimeMetric(this._now.now(), blockKey)
|
|
11413
|
-
);
|
|
11414
|
-
if (round) {
|
|
11415
|
-
groupFragments.add(new CurrentRoundMetric(round.current, round.total, blockKey, now, customRoundLabel));
|
|
11416
|
-
}
|
|
11417
|
-
return groupFragments;
|
|
11418
|
-
});
|
|
11419
|
-
}
|
|
11420
|
-
const totalElapsed = calculateElapsed(timer, nowMs);
|
|
11421
|
-
const firstStart = timer.spans[0].started;
|
|
11422
|
-
const lastEnd = timer.spans[timer.spans.length - 1].ended ?? nowMs;
|
|
11423
|
-
const totalDuration = lastEnd - firstStart;
|
|
11422
|
+
buildWeightedSplitGroups(firstStart, totalElapsed, totalDuration, now, blockKey, round, groups, customRoundLabel) {
|
|
11424
11423
|
const weights = groups.map((group) => {
|
|
11425
11424
|
const reps = group.filter((f) => f.type === wodWikiCore.MetricType.Rep && typeof f.value === "number").reduce((sum, f) => sum + f.value, 0);
|
|
11426
11425
|
return reps > 0 ? reps : 1;
|
|
@@ -11447,6 +11446,53 @@ var ReportOutputBehavior = class {
|
|
|
11447
11446
|
return groupFragments;
|
|
11448
11447
|
});
|
|
11449
11448
|
}
|
|
11449
|
+
computeSplitTimeResults(ctx, timer, groups, customRoundLabel) {
|
|
11450
|
+
const now = ctx.clock.currentDate;
|
|
11451
|
+
const nowMs = now.getTime();
|
|
11452
|
+
const blockKey = ctx.block.key.toString();
|
|
11453
|
+
const round = ctx.getMemoryByTag("round")[0]?.metrics[0];
|
|
11454
|
+
if (!timer || timer.spans.length === 0) {
|
|
11455
|
+
const fallback = this.resolveFallbackTiming(ctx, nowMs);
|
|
11456
|
+
if (fallback) {
|
|
11457
|
+
return this.buildWeightedSplitGroups(
|
|
11458
|
+
fallback.started,
|
|
11459
|
+
fallback.elapsedMs,
|
|
11460
|
+
fallback.elapsedMs,
|
|
11461
|
+
now,
|
|
11462
|
+
blockKey,
|
|
11463
|
+
round,
|
|
11464
|
+
groups,
|
|
11465
|
+
customRoundLabel
|
|
11466
|
+
);
|
|
11467
|
+
}
|
|
11468
|
+
return groups.map((group) => {
|
|
11469
|
+
const groupFragments = group.clone().add(
|
|
11470
|
+
new ElapsedMetric(0, blockKey, now),
|
|
11471
|
+
new TotalMetric(0, blockKey, now),
|
|
11472
|
+
new SpansMetric([new TimeSpan(nowMs, nowMs)], blockKey, now),
|
|
11473
|
+
new SystemTimeMetric(this._now.now(), blockKey)
|
|
11474
|
+
);
|
|
11475
|
+
if (round) {
|
|
11476
|
+
groupFragments.add(new CurrentRoundMetric(round.current, round.total, blockKey, now, customRoundLabel));
|
|
11477
|
+
}
|
|
11478
|
+
return groupFragments;
|
|
11479
|
+
});
|
|
11480
|
+
}
|
|
11481
|
+
const totalElapsed = calculateElapsed(timer, nowMs);
|
|
11482
|
+
const firstStart = timer.spans[0].started;
|
|
11483
|
+
const lastEnd = timer.spans[timer.spans.length - 1].ended ?? nowMs;
|
|
11484
|
+
const totalDuration = lastEnd - firstStart;
|
|
11485
|
+
return this.buildWeightedSplitGroups(
|
|
11486
|
+
firstStart,
|
|
11487
|
+
totalElapsed,
|
|
11488
|
+
totalDuration,
|
|
11489
|
+
now,
|
|
11490
|
+
blockKey,
|
|
11491
|
+
round,
|
|
11492
|
+
groups,
|
|
11493
|
+
customRoundLabel
|
|
11494
|
+
);
|
|
11495
|
+
}
|
|
11450
11496
|
writeResultMemory(ctx, resultFragments) {
|
|
11451
11497
|
const existing = ctx.block.getMemoryByTag("metric:result");
|
|
11452
11498
|
if (existing.length > 0) {
|