@thecorporation/corp-tools 26.3.40 → 26.3.42

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.js CHANGED
@@ -2715,8 +2715,26 @@ async function ensureIssuancePreflight2(client, entityId, grantType, instrument,
2715
2715
  } catch (err) {
2716
2716
  const msg = String(err);
2717
2717
  if (msg.includes("404") || msg.includes("Not found") || msg.includes("not found")) {
2718
+ try {
2719
+ const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
2720
+ const valuation = await client.createValuation({
2721
+ entity_id: entityId,
2722
+ valuation_type: "four_oh_nine_a",
2723
+ effective_date: today,
2724
+ methodology: "backsolve",
2725
+ fmv_per_share_cents: 1
2726
+ // $0.01 par value — typical early stage
2727
+ });
2728
+ const valuationId = String(valuation.valuation_id ?? "");
2729
+ if (valuationId) {
2730
+ await client.submitValuationForApproval(valuationId, entityId);
2731
+ await client.approveValuation(valuationId, entityId);
2732
+ }
2733
+ return;
2734
+ } catch {
2735
+ }
2718
2736
  throw new Error(
2719
- "Stock option issuances require a current approved 409A valuation. Create and approve one first with: corp cap-table create-valuation --type four_oh_nine_a --date YYYY-MM-DD --methodology <method>; corp cap-table submit-valuation <valuation-ref>; corp cap-table approve-valuation <valuation-ref> --resolution-id <resolution-ref>"
2737
+ "Stock option issuances require a current approved 409A valuation.\n Auto-creation failed. Create manually:\n corp cap-table create-valuation --type four_oh_nine_a --date YYYY-MM-DD --methodology backsolve --auto-approve"
2720
2738
  );
2721
2739
  }
2722
2740
  throw err;