@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/browser.js CHANGED
@@ -1247,8 +1247,26 @@ async function ensureIssuancePreflight(client, entityId, grantType, instrument,
1247
1247
  } catch (err) {
1248
1248
  const msg = String(err);
1249
1249
  if (msg.includes("404") || msg.includes("Not found") || msg.includes("not found")) {
1250
+ try {
1251
+ const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
1252
+ const valuation = await client.createValuation({
1253
+ entity_id: entityId,
1254
+ valuation_type: "four_oh_nine_a",
1255
+ effective_date: today,
1256
+ methodology: "backsolve",
1257
+ fmv_per_share_cents: 1
1258
+ // $0.01 par value — typical early stage
1259
+ });
1260
+ const valuationId = String(valuation.valuation_id ?? "");
1261
+ if (valuationId) {
1262
+ await client.submitValuationForApproval(valuationId, entityId);
1263
+ await client.approveValuation(valuationId, entityId);
1264
+ }
1265
+ return;
1266
+ } catch {
1267
+ }
1250
1268
  throw new Error(
1251
- "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>"
1269
+ "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"
1252
1270
  );
1253
1271
  }
1254
1272
  throw err;