@loadmap/cli 0.11.0 → 0.12.0

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/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { n as main } from "./src-0Gq92LO7.js";
2
+ import { n as main } from "./src-DATszRA9.js";
3
3
  // src/bin.ts
4
4
  main(process.argv.slice(2)).then((code) => process.exit(code), (err) => {
5
5
  console.error(err instanceof Error ? err.message : err);
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { t as USAGE, o as check, a as fmt, s as github, n as main, r as parseRecord, i as record } from "./src-0Gq92LO7.js";
1
+ export { t as USAGE, o as check, a as fmt, s as github, n as main, r as parseRecord, i as record } from "./src-DATszRA9.js";
@@ -588,6 +588,21 @@ function defineModel(def) {
588
588
  firstLimit: first
589
589
  };
590
590
  };
591
+ const resolveStages = (ctx, shed) => {
592
+ const stages = {};
593
+ for (const s of stageIds) {
594
+ const st = resolveStage(s, def.stages[s], ctx, flowIds, thresholds.full);
595
+ stages[s] = st.kind === "pass" || st.kind === "limit" || st.kind === "cache" ? {
596
+ ...st,
597
+ shed: shed(s)
598
+ } : st;
599
+ }
600
+ for (const st of Object.values(stages)) if (st.kind === "fanout") for (const b of Object.values(st.to).flat()) {
601
+ const to = stages[b.stage];
602
+ if (!to || to.kind === "queue" || to.kind === "workers" || to.kind === "fanout") throw new Error(`loadmap: fan-out "${st.id}" branches to "${b.stage}", which is not a sink, store or pass stage`);
603
+ }
604
+ return stages;
605
+ };
591
606
  const evaluate = (partial) => {
592
607
  const values = {
593
608
  ...defaults(),
@@ -632,18 +647,7 @@ function defineModel(def) {
632
647
  const full = edges("fullRange");
633
648
  const flows = {};
634
649
  for (const f of flowIds) flows[f] = ctx.flows[f];
635
- const stages = {};
636
- for (const s of stageIds) {
637
- const st = resolveStage(s, def.stages[s], ctx, flowIds, thresholds.full);
638
- stages[s] = st.kind === "pass" || st.kind === "limit" || st.kind === "cache" ? {
639
- ...st,
640
- shed: shed(s)
641
- } : st;
642
- }
643
- for (const st of Object.values(stages)) if (st.kind === "fanout") for (const b of Object.values(st.to).flat()) {
644
- const to = stages[b.stage];
645
- if (!to || to.kind === "queue" || to.kind === "workers" || to.kind === "fanout") throw new Error(`loadmap: fan-out "${st.id}" branches to "${b.stage}", which is not a sink, store or pass stage`);
646
- }
650
+ const stages = resolveStages(ctx, shed);
647
651
  const overload = {};
648
652
  for (const f of flowIds) overload[f] = overloadOf(f);
649
653
  const at = {};
@@ -710,6 +714,18 @@ function defineModel(def) {
710
714
  return d ? isEnabled(d, values) : false;
711
715
  },
712
716
  evaluate,
717
+ stagesAt: (partial) => {
718
+ const values = {
719
+ ...defaults(),
720
+ ...partial
721
+ };
722
+ const { ctx, shed } = context(def, values);
723
+ return {
724
+ values,
725
+ ctx,
726
+ stages: resolveStages(ctx, shed)
727
+ };
728
+ },
713
729
  utilization: (partial, bound) => {
714
730
  const util = context(def, {
715
731
  ...defaults(),