hedge-broker 0.3.1 → 0.3.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.
Files changed (2) hide show
  1. package/dist/index.js +31 -17
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -648,36 +648,50 @@ Track with: hedge status ${submissionId} (or use finalize --wait next time)
648
648
  }
649
649
  const timeoutMin = intFlag(opts.timeout, "--timeout");
650
650
  const deadline = Date.now() + Math.max(1, timeoutMin) * 6e4;
651
- process.stdout.write("Marketing started - waiting for markets to attach (usually ~5 minutes)");
652
- let markets = [];
651
+ process.stdout.write("Marketing started - waiting for markets to match (usually ~5 minutes)");
652
+ let req = null;
653
+ let noMarkets = false;
653
654
  while (Date.now() < deadline) {
654
655
  await new Promise((resolve) => setTimeout(resolve, 15e3));
655
656
  process.stdout.write(".");
656
- const s = await apiRequest(ctx.client, "GET", `/broker/submissions/${submissionId}`);
657
- if (s.markets?.length) {
658
- markets = s.markets;
657
+ const view = await apiRequest(ctx.client, "GET", `/broker/submissions/${submissionId}/requirements`);
658
+ if (view.marketing_status === "matched" || view.markets?.length) {
659
+ req = view;
660
+ break;
661
+ }
662
+ if (view.marketing_status === "no_markets_matched") {
663
+ req = view;
664
+ noMarkets = true;
659
665
  break;
660
666
  }
661
667
  }
662
668
  process.stdout.write("\n");
663
- if (!markets.length) {
669
+ if (!req) {
664
670
  process.stdout.write(
665
671
  `Still matching after ${timeoutMin} minutes - this can occasionally take longer.
666
- Check in with: hedge status ${submissionId} or hedge requirements ${submissionId}
672
+ Check in with: hedge requirements ${submissionId}
667
673
  `
668
674
  );
669
675
  return;
670
676
  }
671
- const rows = markets.flatMap((m) => (m.lines || []).map((l) => ({
672
- carrier: m.carrier_name,
673
- line: l.lob_label ?? l.lob_slug,
674
- status: l.status_label ?? l.status
675
- })));
676
- if (ctx.json) return printJson({ finalize: r, markets });
677
- process.stdout.write(`Matched ${markets.length} market(s):
677
+ if (noMarkets) {
678
+ if (ctx.json) return printJson({ finalize: r, requirements: req });
679
+ process.stdout.write((req.marketing_hint ?? "No carrier lanes attached - Hedge is reviewing options for this risk and will follow up.") + "\n");
680
+ return;
681
+ }
682
+ if (ctx.json) return printJson({ finalize: r, requirements: req });
683
+ const rows = (req.markets || []).map((m) => ({
684
+ market: m.market_name,
685
+ ready: m.ready ? "yes" : "no",
686
+ needs_from_you: (m.needs_from_you || []).join("; ")
687
+ }));
688
+ process.stdout.write(`Matched ${rows.length} market(s):
678
689
 
679
- ` + table(rows, ["carrier", "line", "status"]) + "\n");
680
- process.stdout.write("\nNext: hedge requirements " + submissionId + " shows what each market still needs from you.\n");
690
+ ` + table(rows, ["market", "ready", "needs_from_you"]) + "\n");
691
+ if (req.forms?.length) {
692
+ process.stdout.write("\nForms Hedge prepares: " + req.forms.join(", ") + "\n(download blanks with: hedge form <form_key>)\n");
693
+ }
694
+ process.stdout.write("\nTrack sends and quotes with: hedge status " + submissionId + "\n");
681
695
  });
682
696
  program2.command("forms [search]").description('Search the blank application-form catalog, e.g. hedge forms "liquor"').action(async (search) => {
683
697
  const ctx = makeCtx(program2.opts());
@@ -873,7 +887,7 @@ function registerQuotes(program2) {
873
887
 
874
888
  // src/index.ts
875
889
  var program = new Command();
876
- program.name("hedge").description("Submit risks to Hedge and track them from your terminal.").version("0.3.1").option("--staging", "use the staging environment").option("--json", "output raw JSON (for scripting)");
890
+ program.name("hedge").description("Submit risks to Hedge and track them from your terminal.").version("0.3.2").option("--staging", "use the staging environment").option("--json", "output raw JSON (for scripting)");
877
891
  registerAuth(program);
878
892
  registerSubmissions(program);
879
893
  registerAppetite(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedge-broker",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Command-line tool for the Hedge broker portal. Submit risks, check appetite, track quotes and policies.",
5
5
  "type": "module",
6
6
  "bin": { "hedge": "dist/index.js" },