@fairmint/captable-ai 0.1.37 → 0.1.38

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 +19 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -20924,6 +20924,20 @@ async function hashFile(path) {
20924
20924
  const data = await readFile4(path);
20925
20925
  return createHash2("sha256").update(data).digest("hex");
20926
20926
  }
20927
+ async function openImportSession(portalId) {
20928
+ try {
20929
+ const res = await apiRequest("/import-sessions", {
20930
+ method: "POST",
20931
+ body: { portalId },
20932
+ // Optional: a failure must throw to the catch below, not exit the process.
20933
+ softFail: true
20934
+ });
20935
+ const id = res.data?.session?.id;
20936
+ return typeof id === "string" ? id : null;
20937
+ } catch {
20938
+ return null;
20939
+ }
20940
+ }
20927
20941
  async function runDocumentsUpload(args, rawArgv) {
20928
20942
  if (rawArgv.includes("--help") || rawArgv.includes("-h")) {
20929
20943
  process.stdout.write(
@@ -20953,11 +20967,15 @@ async function runDocumentsUpload(args, rawArgv) {
20953
20967
  });
20954
20968
  }
20955
20969
  if (!isJsonMode()) printLine(`Preparing ${files.length} file(s)...`);
20970
+ const importSessionId = await openImportSession(portalId);
20956
20971
  const prepareRes = await apiRequest(
20957
20972
  `/${portalId}/documents/prepare`,
20958
20973
  {
20959
20974
  method: "POST",
20960
- body: { files: files.map(({ path: _, ...f }) => f) }
20975
+ body: {
20976
+ files: files.map(({ path: _, ...f }) => f),
20977
+ ...importSessionId === null ? {} : { importSessionId }
20978
+ }
20961
20979
  }
20962
20980
  );
20963
20981
  const documents = prepareRes.data?.documents ?? [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fairmint/captable-ai",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "description": "Agent-native CLI for Captable AI — manage companies, upload documents, run OCF extraction, and commit cap tables from the terminal.",
5
5
  "keywords": [
6
6
  "captable",