@fairmint/captable-ai 0.1.15 → 0.1.17
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 +32 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -170,8 +170,11 @@ function parsePortals(body) {
|
|
|
170
170
|
if (!portals.every(isStoredPortal)) return null;
|
|
171
171
|
return portals;
|
|
172
172
|
}
|
|
173
|
+
function cachedPortalsNeedNameRefresh(portals) {
|
|
174
|
+
return portals.some((portal) => typeof portal.name !== "string" || portal.name.trim() === "");
|
|
175
|
+
}
|
|
173
176
|
async function refreshPortalsIfStale(creds, force = false) {
|
|
174
|
-
if (!force && creds.portalsLastFetchedAt && Date.now() - Date.parse(creds.portalsLastFetchedAt) < PORTALS_TTL_MS) {
|
|
177
|
+
if (!force && !cachedPortalsNeedNameRefresh(creds.portals) && creds.portalsLastFetchedAt && Date.now() - Date.parse(creds.portalsLastFetchedAt) < PORTALS_TTL_MS) {
|
|
175
178
|
return creds;
|
|
176
179
|
}
|
|
177
180
|
if (isTokenExpired(creds.accessToken)) {
|
|
@@ -205,6 +208,22 @@ async function markPortalsFetched(creds) {
|
|
|
205
208
|
creds.portalsLastFetchedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
206
209
|
await writeCredentials(creds);
|
|
207
210
|
}
|
|
211
|
+
async function refreshCachedPortalNames() {
|
|
212
|
+
try {
|
|
213
|
+
const creds = await readCredentials();
|
|
214
|
+
if (!creds) return;
|
|
215
|
+
const updated = await refreshPortalsIfStale(creds, true);
|
|
216
|
+
const config2 = await readConfig();
|
|
217
|
+
const activeId = config2.activePortal?.id;
|
|
218
|
+
if (!activeId) return;
|
|
219
|
+
const portal = updated.portals.find((candidate) => candidate.id === activeId);
|
|
220
|
+
if (portal) await setActivePortal(portal);
|
|
221
|
+
} catch {
|
|
222
|
+
process.stderr.write(
|
|
223
|
+
"Warning: Could not refresh company name after updating the company list.\n"
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
208
227
|
|
|
209
228
|
// src/output.ts
|
|
210
229
|
import { renameSync, rmSync, writeFileSync } from "fs";
|
|
@@ -16938,6 +16957,16 @@ var warrantResolutionItemSchema = external_exports.object({
|
|
|
16938
16957
|
shareQuantity: external_exports.number().nullable(),
|
|
16939
16958
|
shareQuantitySource: external_exports.enum(["issuance_quantity_1_to_1", "converts_to_quantity", "fixed_percent"]).nullable(),
|
|
16940
16959
|
formulaText: external_exports.string().nullable(),
|
|
16960
|
+
// Underlying share class the warrant converts into (ENG-2089). status "known"
|
|
16961
|
+
// means the OCF issuance pins the class via converts_to_stock_class_id;
|
|
16962
|
+
// "deferred" means the class does not exist yet (SAFE-paired warrants).
|
|
16963
|
+
underlyingClass: external_exports.object({
|
|
16964
|
+
stockClassId: external_exports.string().nullable(),
|
|
16965
|
+
status: external_exports.enum(["known", "deferred"]),
|
|
16966
|
+
source: external_exports.literal("converts_to_stock_class_id").nullable()
|
|
16967
|
+
}).nullable().optional(),
|
|
16968
|
+
underlyingClassName: external_exports.string().nullable().optional(),
|
|
16969
|
+
displayName: external_exports.string().optional(),
|
|
16941
16970
|
exercisePrice: external_exports.object({
|
|
16942
16971
|
amount: external_exports.string(),
|
|
16943
16972
|
currency: external_exports.string()
|
|
@@ -17971,6 +18000,7 @@ Committing ${countCopy}...
|
|
|
17971
18000
|
exitWithError("Unexpected empty response from server.");
|
|
17972
18001
|
}
|
|
17973
18002
|
const data = res.data;
|
|
18003
|
+
await refreshCachedPortalNames();
|
|
17974
18004
|
if (isJsonMode()) {
|
|
17975
18005
|
printJson({ data });
|
|
17976
18006
|
return;
|
|
@@ -20592,6 +20622,7 @@ Reverting ${selection.objectIds.length} selected draft object(s)...
|
|
|
20592
20622
|
if (!res.data) {
|
|
20593
20623
|
exitWithError("Unexpected empty response from server.");
|
|
20594
20624
|
}
|
|
20625
|
+
await refreshCachedPortalNames();
|
|
20595
20626
|
if (isJsonMode()) {
|
|
20596
20627
|
printJson({ data: res.data });
|
|
20597
20628
|
return;
|
package/package.json
CHANGED