@bitcobblers/wod-wiki-lang 0.60.2248 → 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.d.cts
CHANGED
|
@@ -2605,7 +2605,9 @@ declare class ReportOutputBehavior implements IRuntimeBehavior {
|
|
|
2605
2605
|
private collectStateFragments;
|
|
2606
2606
|
private mergeFragments;
|
|
2607
2607
|
private buildMilestoneFragments;
|
|
2608
|
+
private resolveFallbackTiming;
|
|
2608
2609
|
private computeTimeResults;
|
|
2610
|
+
private buildWeightedSplitGroups;
|
|
2609
2611
|
private computeSplitTimeResults;
|
|
2610
2612
|
private writeResultMemory;
|
|
2611
2613
|
private writeResultGroups;
|
package/dist/index.d.ts
CHANGED
|
@@ -2605,7 +2605,9 @@ declare class ReportOutputBehavior implements IRuntimeBehavior {
|
|
|
2605
2605
|
private collectStateFragments;
|
|
2606
2606
|
private mergeFragments;
|
|
2607
2607
|
private buildMilestoneFragments;
|
|
2608
|
+
private resolveFallbackTiming;
|
|
2608
2609
|
private computeTimeResults;
|
|
2610
|
+
private buildWeightedSplitGroups;
|
|
2609
2611
|
private computeSplitTimeResults;
|
|
2610
2612
|
private writeResultMemory;
|
|
2611
2613
|
private writeResultGroups;
|
package/dist/index.mjs
CHANGED
|
@@ -6026,8 +6026,11 @@ var OutputEmitter = class {
|
|
|
6026
6026
|
);
|
|
6027
6027
|
}
|
|
6028
6028
|
}
|
|
6029
|
-
const
|
|
6030
|
-
const timeSpan = new TimeSpan(
|
|
6029
|
+
const recordedSpans = resultFragments.filter((m) => m.type === MetricType.Spans && Array.isArray(m.value)).flatMap((m) => m.value).filter((s) => typeof s?.started === "number" && Number.isFinite(s.started));
|
|
6030
|
+
const timeSpan = recordedSpans.length > 0 ? new TimeSpan(
|
|
6031
|
+
Math.min(...recordedSpans.map((s) => s.started)),
|
|
6032
|
+
Math.max(...recordedSpans.map((s) => typeof s.ended === "number" && Number.isFinite(s.ended) ? s.ended : fallbackEndMs))
|
|
6033
|
+
) : new TimeSpan(block.executionTiming?.startTime?.getTime() ?? fallbackEndMs, fallbackEndMs);
|
|
6031
6034
|
this.add(new OutputStatement({
|
|
6032
6035
|
outputType: "segment",
|
|
6033
6036
|
completionReason: block.completionReason,
|
|
@@ -10693,6 +10696,19 @@ var ReportOutputBehavior = class {
|
|
|
10693
10696
|
}
|
|
10694
10697
|
return metrics;
|
|
10695
10698
|
}
|
|
10699
|
+
resolveFallbackTiming(ctx, nowMs) {
|
|
10700
|
+
if (ctx.block.blockType === "WaitingToStart") return null;
|
|
10701
|
+
const timing = ctx.block.executionTiming;
|
|
10702
|
+
const execStartMs = timing?.startTime?.getTime();
|
|
10703
|
+
if (execStartMs === void 0 || !Number.isFinite(execStartMs) || execStartMs > nowMs) {
|
|
10704
|
+
return null;
|
|
10705
|
+
}
|
|
10706
|
+
return {
|
|
10707
|
+
started: execStartMs,
|
|
10708
|
+
ended: nowMs,
|
|
10709
|
+
elapsedMs: Math.max(0, nowMs - execStartMs)
|
|
10710
|
+
};
|
|
10711
|
+
}
|
|
10696
10712
|
computeTimeResults(ctx, timer, customRoundLabel) {
|
|
10697
10713
|
const now = ctx.clock.currentDate;
|
|
10698
10714
|
const nowMs = now.getTime();
|
|
@@ -10700,14 +10716,17 @@ var ReportOutputBehavior = class {
|
|
|
10700
10716
|
const round = ctx.getMemoryByTag("round")[0]?.metrics[0];
|
|
10701
10717
|
if (timer && timer.spans.length > 0) {
|
|
10702
10718
|
const elapsed = calculateElapsed(timer, nowMs);
|
|
10703
|
-
const
|
|
10704
|
-
|
|
10719
|
+
const closedSpans = timer.spans.map(
|
|
10720
|
+
(s) => s.ended !== void 0 ? s : new TimeSpan(s.started, nowMs)
|
|
10721
|
+
);
|
|
10722
|
+
const firstStart = closedSpans[0].started;
|
|
10723
|
+
const lastSpan = closedSpans[closedSpans.length - 1];
|
|
10705
10724
|
const lastEnd = lastSpan.ended ?? nowMs;
|
|
10706
10725
|
const total = Math.max(0, lastEnd - firstStart);
|
|
10707
10726
|
const metrics2 = MetricContainer.empty(blockKey).add(
|
|
10708
10727
|
new ElapsedMetric(elapsed, blockKey, now),
|
|
10709
10728
|
new TotalMetric(total, blockKey, now),
|
|
10710
|
-
new SpansMetric(
|
|
10729
|
+
new SpansMetric(closedSpans, blockKey, now),
|
|
10711
10730
|
new SystemTimeMetric(this._now.now(), blockKey)
|
|
10712
10731
|
);
|
|
10713
10732
|
if (round) {
|
|
@@ -10715,11 +10734,13 @@ var ReportOutputBehavior = class {
|
|
|
10715
10734
|
}
|
|
10716
10735
|
return metrics2;
|
|
10717
10736
|
}
|
|
10718
|
-
const
|
|
10737
|
+
const fallback = this.resolveFallbackTiming(ctx, nowMs);
|
|
10738
|
+
const span = fallback ? new TimeSpan(fallback.started, fallback.ended) : new TimeSpan(nowMs, nowMs);
|
|
10739
|
+
const fallbackElapsed = fallback?.elapsedMs ?? 0;
|
|
10719
10740
|
const metrics = MetricContainer.empty(blockKey).add(
|
|
10720
|
-
new ElapsedMetric(
|
|
10721
|
-
new TotalMetric(
|
|
10722
|
-
new SpansMetric([
|
|
10741
|
+
new ElapsedMetric(fallbackElapsed, blockKey, now),
|
|
10742
|
+
new TotalMetric(fallbackElapsed, blockKey, now),
|
|
10743
|
+
new SpansMetric([span], blockKey, now),
|
|
10723
10744
|
new SystemTimeMetric(this._now.now(), blockKey)
|
|
10724
10745
|
);
|
|
10725
10746
|
if (round) {
|
|
@@ -10727,29 +10748,7 @@ var ReportOutputBehavior = class {
|
|
|
10727
10748
|
}
|
|
10728
10749
|
return metrics;
|
|
10729
10750
|
}
|
|
10730
|
-
|
|
10731
|
-
const now = ctx.clock.currentDate;
|
|
10732
|
-
const nowMs = now.getTime();
|
|
10733
|
-
const blockKey = ctx.block.key.toString();
|
|
10734
|
-
const round = ctx.getMemoryByTag("round")[0]?.metrics[0];
|
|
10735
|
-
if (!timer || timer.spans.length === 0) {
|
|
10736
|
-
return groups.map((group) => {
|
|
10737
|
-
const groupFragments = group.clone().add(
|
|
10738
|
-
new ElapsedMetric(0, blockKey, now),
|
|
10739
|
-
new TotalMetric(0, blockKey, now),
|
|
10740
|
-
new SpansMetric([new TimeSpan(nowMs, nowMs)], blockKey, now),
|
|
10741
|
-
new SystemTimeMetric(this._now.now(), blockKey)
|
|
10742
|
-
);
|
|
10743
|
-
if (round) {
|
|
10744
|
-
groupFragments.add(new CurrentRoundMetric(round.current, round.total, blockKey, now, customRoundLabel));
|
|
10745
|
-
}
|
|
10746
|
-
return groupFragments;
|
|
10747
|
-
});
|
|
10748
|
-
}
|
|
10749
|
-
const totalElapsed = calculateElapsed(timer, nowMs);
|
|
10750
|
-
const firstStart = timer.spans[0].started;
|
|
10751
|
-
const lastEnd = timer.spans[timer.spans.length - 1].ended ?? nowMs;
|
|
10752
|
-
const totalDuration = lastEnd - firstStart;
|
|
10751
|
+
buildWeightedSplitGroups(firstStart, totalElapsed, totalDuration, now, blockKey, round, groups, customRoundLabel) {
|
|
10753
10752
|
const weights = groups.map((group) => {
|
|
10754
10753
|
const reps = group.filter((f) => f.type === MetricType.Rep && typeof f.value === "number").reduce((sum, f) => sum + f.value, 0);
|
|
10755
10754
|
return reps > 0 ? reps : 1;
|
|
@@ -10776,6 +10775,53 @@ var ReportOutputBehavior = class {
|
|
|
10776
10775
|
return groupFragments;
|
|
10777
10776
|
});
|
|
10778
10777
|
}
|
|
10778
|
+
computeSplitTimeResults(ctx, timer, groups, customRoundLabel) {
|
|
10779
|
+
const now = ctx.clock.currentDate;
|
|
10780
|
+
const nowMs = now.getTime();
|
|
10781
|
+
const blockKey = ctx.block.key.toString();
|
|
10782
|
+
const round = ctx.getMemoryByTag("round")[0]?.metrics[0];
|
|
10783
|
+
if (!timer || timer.spans.length === 0) {
|
|
10784
|
+
const fallback = this.resolveFallbackTiming(ctx, nowMs);
|
|
10785
|
+
if (fallback) {
|
|
10786
|
+
return this.buildWeightedSplitGroups(
|
|
10787
|
+
fallback.started,
|
|
10788
|
+
fallback.elapsedMs,
|
|
10789
|
+
fallback.elapsedMs,
|
|
10790
|
+
now,
|
|
10791
|
+
blockKey,
|
|
10792
|
+
round,
|
|
10793
|
+
groups,
|
|
10794
|
+
customRoundLabel
|
|
10795
|
+
);
|
|
10796
|
+
}
|
|
10797
|
+
return groups.map((group) => {
|
|
10798
|
+
const groupFragments = group.clone().add(
|
|
10799
|
+
new ElapsedMetric(0, blockKey, now),
|
|
10800
|
+
new TotalMetric(0, blockKey, now),
|
|
10801
|
+
new SpansMetric([new TimeSpan(nowMs, nowMs)], blockKey, now),
|
|
10802
|
+
new SystemTimeMetric(this._now.now(), blockKey)
|
|
10803
|
+
);
|
|
10804
|
+
if (round) {
|
|
10805
|
+
groupFragments.add(new CurrentRoundMetric(round.current, round.total, blockKey, now, customRoundLabel));
|
|
10806
|
+
}
|
|
10807
|
+
return groupFragments;
|
|
10808
|
+
});
|
|
10809
|
+
}
|
|
10810
|
+
const totalElapsed = calculateElapsed(timer, nowMs);
|
|
10811
|
+
const firstStart = timer.spans[0].started;
|
|
10812
|
+
const lastEnd = timer.spans[timer.spans.length - 1].ended ?? nowMs;
|
|
10813
|
+
const totalDuration = lastEnd - firstStart;
|
|
10814
|
+
return this.buildWeightedSplitGroups(
|
|
10815
|
+
firstStart,
|
|
10816
|
+
totalElapsed,
|
|
10817
|
+
totalDuration,
|
|
10818
|
+
now,
|
|
10819
|
+
blockKey,
|
|
10820
|
+
round,
|
|
10821
|
+
groups,
|
|
10822
|
+
customRoundLabel
|
|
10823
|
+
);
|
|
10824
|
+
}
|
|
10779
10825
|
writeResultMemory(ctx, resultFragments) {
|
|
10780
10826
|
const existing = ctx.block.getMemoryByTag("metric:result");
|
|
10781
10827
|
if (existing.length > 0) {
|