hedge-broker 0.3.0 → 0.3.1

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 +27 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -565,6 +565,9 @@ function registerSubmissions(program2) {
565
565
  const r = await apiRequest(ctx.client, "GET", `/broker/submissions/${submissionId}/requirements`);
566
566
  if (ctx.json) return printJson(r);
567
567
  process.stdout.write(kv({ insured: r.insured_name, lines: (r.lines || []).join(", "), state: r.state, forms: (r.forms || []).join(", ") }) + "\n");
568
+ if (r.forms?.length) {
569
+ process.stdout.write("(download blanks with: hedge form <form_key>)\n");
570
+ }
568
571
  if (r.markets?.length) {
569
572
  process.stdout.write("\nMarkets:\n" + table(r.markets.map((m) => ({
570
573
  market: m.market_name,
@@ -676,6 +679,29 @@ Check in with: hedge status ${submissionId} or hedge requirements ${submission
676
679
  ` + table(rows, ["carrier", "line", "status"]) + "\n");
677
680
  process.stdout.write("\nNext: hedge requirements " + submissionId + " shows what each market still needs from you.\n");
678
681
  });
682
+ program2.command("forms [search]").description('Search the blank application-form catalog, e.g. hedge forms "liquor"').action(async (search) => {
683
+ const ctx = makeCtx(program2.opts());
684
+ const rows = await apiRequest(ctx.client, "GET", "/broker/forms", {
685
+ query: { q: search }
686
+ });
687
+ if (ctx.json) return printJson(rows);
688
+ if (!rows.length) {
689
+ process.stdout.write("No forms matched" + (search ? ` "${search}"` : "") + ".\n");
690
+ return;
691
+ }
692
+ process.stdout.write(table(rows.map((f) => ({
693
+ form_key: f.form_key,
694
+ title: f.title ?? "",
695
+ acord: f.is_acord ? "yes" : "",
696
+ pages: f.page_count ?? ""
697
+ })), ["form_key", "title", "acord", "pages"]) + "\n");
698
+ process.stdout.write("\nDownload a blank with: hedge form <form_key>\n");
699
+ });
700
+ program2.command("form <formKey>").description("Download a blank application form by its catalog key (the keys `hedge requirements` lists)").option("-o, --output <file>", "output file (default <formKey>.pdf)").action(async (formKey, opts) => {
701
+ const ctx = makeCtx(program2.opts());
702
+ const out = await downloadRequest(ctx.client, "GET", `/broker/forms/${encodeURIComponent(formKey)}/pdf`, opts.output, `${formKey}.pdf`);
703
+ process.stdout.write("Saved " + out + "\n");
704
+ });
679
705
  program2.command("documents <submissionId>").description("List a submission's finalized documents (ACORDs, quotes, binders)").action(async (submissionId) => {
680
706
  const ctx = makeCtx(program2.opts());
681
707
  const rows = await apiRequest(ctx.client, "GET", `/broker/submissions/${submissionId}/finalized-documents`);
@@ -847,7 +873,7 @@ function registerQuotes(program2) {
847
873
 
848
874
  // src/index.ts
849
875
  var program = new Command();
850
- program.name("hedge").description("Submit risks to Hedge and track them from your terminal.").version("0.3.0").option("--staging", "use the staging environment").option("--json", "output raw JSON (for scripting)");
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)");
851
877
  registerAuth(program);
852
878
  registerSubmissions(program);
853
879
  registerAppetite(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedge-broker",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
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" },