@fairmint/captable-ai 0.1.17 → 0.1.19
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 +122 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15827,8 +15827,17 @@ var ocfObjectSchema = external_exports.object({
|
|
|
15827
15827
|
createdAt: external_exports.string().nullable().optional().describe("ISO timestamp of when the row was first inserted (DB `created_at`). Used by studiov2 as a last-resort date fallback for undated OCF objects (e.g. STAKEHOLDER, STOCK_CLASS). Present on list responses only.")
|
|
15828
15828
|
});
|
|
15829
15829
|
var objectPatchInputSchema = external_exports.object({
|
|
15830
|
-
ocfPatch: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Partial OCF object payload. The server shallow-merges this object onto the latest stored OCF object and validates the merged result."),
|
|
15831
|
-
version: external_exports.number().int().nonnegative().optional().describe("Optional optimistic-concurrency version. If provided, it must match the latest version.")
|
|
15830
|
+
ocfPatch: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Partial OCF object payload. The server shallow-merges this object onto the latest stored OCF object and validates the merged result. May be omitted when only documentId changes."),
|
|
15831
|
+
version: external_exports.number().int().nonnegative().optional().describe("Optional optimistic-concurrency version. If provided, it must match the latest version."),
|
|
15832
|
+
documentId: external_exports.string().uuid().nullable().optional().describe("Optional source document for the draft. Pass a UUID to relink, null to unlink, or omit to preserve the current link.")
|
|
15833
|
+
}).refine((input) => input.ocfPatch !== void 0 || input.documentId !== void 0, {
|
|
15834
|
+
path: ["ocfPatch"],
|
|
15835
|
+
message: "Provide ocfPatch or documentId \u2014 nothing to apply."
|
|
15836
|
+
});
|
|
15837
|
+
var objectUpdateInputSchema = external_exports.object({
|
|
15838
|
+
ocf: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Full OCF data payload."),
|
|
15839
|
+
version: external_exports.number().int().describe("Expected current version for optimistic concurrency. Must match the latest stored version."),
|
|
15840
|
+
documentId: external_exports.string().uuid().nullable().optional().describe("Optional source document for the new draft. Pass a UUID to relink, null to unlink, or omit to preserve the current link.")
|
|
15832
15841
|
});
|
|
15833
15842
|
var objectCreateInputSchema = external_exports.object({
|
|
15834
15843
|
objectId: external_exports.string().optional().describe("Optional OCF object ID. Defaults to ocf.id or ocf._id when omitted."),
|
|
@@ -16046,6 +16055,7 @@ var ERROR_CODES = {
|
|
|
16046
16055
|
MISSING_DEPENDENCIES: "MISSING_DEPENDENCIES",
|
|
16047
16056
|
BROKEN_REFERENCES: "BROKEN_REFERENCES",
|
|
16048
16057
|
DOCUMENT_INTEGRITY_FAILED: "DOCUMENT_INTEGRITY_FAILED",
|
|
16058
|
+
DOCUMENT_NOT_LINKED: "DOCUMENT_NOT_LINKED",
|
|
16049
16059
|
INVALID_CURSOR: "INVALID_CURSOR",
|
|
16050
16060
|
BATCH_TOO_LARGE: "BATCH_TOO_LARGE",
|
|
16051
16061
|
RATE_LIMITED: "RATE_LIMITED"
|
|
@@ -16068,6 +16078,7 @@ var ERROR_CODE_VALUES = [
|
|
|
16068
16078
|
ERROR_CODES.MISSING_DEPENDENCIES,
|
|
16069
16079
|
ERROR_CODES.BROKEN_REFERENCES,
|
|
16070
16080
|
ERROR_CODES.DOCUMENT_INTEGRITY_FAILED,
|
|
16081
|
+
ERROR_CODES.DOCUMENT_NOT_LINKED,
|
|
16071
16082
|
ERROR_CODES.INVALID_CURSOR,
|
|
16072
16083
|
ERROR_CODES.BATCH_TOO_LARGE,
|
|
16073
16084
|
ERROR_CODES.RATE_LIMITED
|
|
@@ -16983,6 +16994,16 @@ var warrantsSnapshotSchema = external_exports.object({
|
|
|
16983
16994
|
totalUnderlyingShares: external_exports.number().nonnegative(),
|
|
16984
16995
|
items: external_exports.array(warrantResolutionItemSchema).optional()
|
|
16985
16996
|
});
|
|
16997
|
+
var pendingSpvSchema = external_exports.object({
|
|
16998
|
+
vehicleId: external_exports.string().uuid(),
|
|
16999
|
+
vehicleName: external_exports.string(),
|
|
17000
|
+
legalName: external_exports.string(),
|
|
17001
|
+
status: external_exports.enum(["live", "paused"]),
|
|
17002
|
+
committedUsd: external_exports.string(),
|
|
17003
|
+
fundedUsd: external_exports.string(),
|
|
17004
|
+
investorCount: external_exports.number().int().nonnegative(),
|
|
17005
|
+
targetRaiseUsd: external_exports.string().nullable()
|
|
17006
|
+
});
|
|
16986
17007
|
var snapshotSchema = external_exports.object({
|
|
16987
17008
|
status: snapshotStatusSchema,
|
|
16988
17009
|
locale: snapshotLocaleSchema,
|
|
@@ -16994,7 +17015,11 @@ var snapshotSchema = external_exports.object({
|
|
|
16994
17015
|
}).nullable(),
|
|
16995
17016
|
convertibles: convertiblesPayloadSchema.nullable(),
|
|
16996
17017
|
warrants: warrantsSnapshotSchema,
|
|
16997
|
-
metrics: snapshotMetricsSchema
|
|
17018
|
+
metrics: snapshotMetricsSchema,
|
|
17019
|
+
// ENG-2088: pending SPV raises render as one virtual row on the founder cap
|
|
17020
|
+
// table until close projects the real founder SAFE (ENG-1478 rev-2). Absent —
|
|
17021
|
+
// not empty — when the portal sponsors no vehicle-backed raise.
|
|
17022
|
+
pendingSpv: external_exports.array(pendingSpvSchema).optional()
|
|
16998
17023
|
});
|
|
16999
17024
|
|
|
17000
17025
|
// ../captable-ai-core/dist/summary.js
|
|
@@ -17542,6 +17567,9 @@ Input:
|
|
|
17542
17567
|
|
|
17543
17568
|
Options:
|
|
17544
17569
|
--version N Expected current version (auto-fetched if omitted)
|
|
17570
|
+
--document UUID Link the draft to this document (must be a portal cap-table document)
|
|
17571
|
+
--clear-document Unlink the source document (documentId: null); requires
|
|
17572
|
+
--stdin/--file because update always needs the full payload
|
|
17545
17573
|
|
|
17546
17574
|
Global:
|
|
17547
17575
|
--json Machine-readable JSON output
|
|
@@ -17550,12 +17578,19 @@ Examples:
|
|
|
17550
17578
|
# Read from a file:
|
|
17551
17579
|
captable-ai objects update abc-123 --file ./stakeholder.json
|
|
17552
17580
|
|
|
17581
|
+
# Relink the source document:
|
|
17582
|
+
captable-ai objects update abc-123 --file ./stakeholder.json --document 8c25f303-1f15-4b02-b9b2-0c41442643ee
|
|
17583
|
+
|
|
17584
|
+
# Remove a wrong or missing document link:
|
|
17585
|
+
captable-ai objects update abc-123 --file ./stakeholder.json --clear-document
|
|
17586
|
+
|
|
17553
17587
|
# Pipe from jq (extract the bare OCF payload first):
|
|
17554
17588
|
captable-ai objects get abc-123 --json | jq '.data.ocf | .legal_name = "Acme Corp"' | captable-ai objects update abc-123 --stdin`;
|
|
17555
17589
|
var HELP_OBJECTS_PATCH = `objects patch \u2014 Patch an OCF object
|
|
17556
17590
|
|
|
17557
17591
|
Usage:
|
|
17558
17592
|
captable-ai objects patch <object-id> (--stdin | --file <path>) [--version N] [--json]
|
|
17593
|
+
captable-ai objects patch <object-id> --document <uuid> | --clear-document [--version N] [--json]
|
|
17559
17594
|
|
|
17560
17595
|
Shallow-merges a partial OCF payload onto the latest stored object, validates the
|
|
17561
17596
|
merged object, and writes a draft. This is not RFC 6902 JSON Patch.
|
|
@@ -17566,12 +17601,21 @@ Input:
|
|
|
17566
17601
|
|
|
17567
17602
|
Options:
|
|
17568
17603
|
--version N Optional expected current version
|
|
17604
|
+
--document UUID Link the draft to this document (must be a portal cap-table document)
|
|
17605
|
+
--clear-document Unlink the source document (documentId: null); may be used
|
|
17606
|
+
without --stdin/--file for a document-only change
|
|
17569
17607
|
|
|
17570
17608
|
Global:
|
|
17571
17609
|
--json Machine-readable JSON output
|
|
17572
17610
|
|
|
17573
17611
|
Examples:
|
|
17574
|
-
echo '{"name":{"legal_name":"Acme Corp"}}' | captable-ai objects patch stakeholder-1 --stdin
|
|
17612
|
+
echo '{"name":{"legal_name":"Acme Corp"}}' | captable-ai objects patch stakeholder-1 --stdin
|
|
17613
|
+
|
|
17614
|
+
# Relink the source document (no payload needed):
|
|
17615
|
+
captable-ai objects patch tx-1 --document c0dcf3e3-5de0-46d1-aacf-d86e9e52f459
|
|
17616
|
+
|
|
17617
|
+
# Relink with an accompanying field edit:
|
|
17618
|
+
echo '{"comments":["fixed"]}' | captable-ai objects patch tx-1 --stdin --document c0dcf3e3-5de0-46d1-aacf-d86e9e52f459`;
|
|
17575
17619
|
var HELP_OBJECTS_REVERT = `objects revert \u2014 Preview or revert draft objects
|
|
17576
17620
|
|
|
17577
17621
|
Usage:
|
|
@@ -20398,6 +20442,14 @@ More results available. Next page:
|
|
|
20398
20442
|
|
|
20399
20443
|
// src/commands/objects-patch.ts
|
|
20400
20444
|
import { readFileSync } from "fs";
|
|
20445
|
+
|
|
20446
|
+
// src/uuid.ts
|
|
20447
|
+
var UUID_PATTERN = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/;
|
|
20448
|
+
function isUuid(value) {
|
|
20449
|
+
return UUID_PATTERN.test(value);
|
|
20450
|
+
}
|
|
20451
|
+
|
|
20452
|
+
// src/commands/objects-patch.ts
|
|
20401
20453
|
async function readStdin() {
|
|
20402
20454
|
const chunks = [];
|
|
20403
20455
|
for await (const chunk of process.stdin) {
|
|
@@ -20436,7 +20488,10 @@ async function runObjectsPatch(args, rawArgv) {
|
|
|
20436
20488
|
`);
|
|
20437
20489
|
process.exit(0);
|
|
20438
20490
|
}
|
|
20439
|
-
validateFlags(args, {
|
|
20491
|
+
validateFlags(args, {
|
|
20492
|
+
flags: ["file", "version", "document"],
|
|
20493
|
+
booleans: ["stdin", "clear-document"]
|
|
20494
|
+
});
|
|
20440
20495
|
const objectId = args.positional[0];
|
|
20441
20496
|
if (!objectId) {
|
|
20442
20497
|
exitWithUsage(
|
|
@@ -20452,7 +20507,18 @@ async function runObjectsPatch(args, rawArgv) {
|
|
|
20452
20507
|
}
|
|
20453
20508
|
const useStdin = hasFlag(args, "stdin");
|
|
20454
20509
|
const filePath = getFlagValue(args, "file") ?? "";
|
|
20455
|
-
|
|
20510
|
+
const documentFlag = getFlagValue(args, "document");
|
|
20511
|
+
const clearDocument = hasFlag(args, "clear-document");
|
|
20512
|
+
const hasDocumentFlag = documentFlag !== void 0 || clearDocument;
|
|
20513
|
+
if (documentFlag !== void 0 && clearDocument) {
|
|
20514
|
+
exitWithError(
|
|
20515
|
+
"Specify either --document <uuid> or --clear-document, not both.",
|
|
20516
|
+
"VALIDATION_FAILED",
|
|
20517
|
+
void 0,
|
|
20518
|
+
EXIT.VALIDATION
|
|
20519
|
+
);
|
|
20520
|
+
}
|
|
20521
|
+
if (!useStdin && !filePath && !hasDocumentFlag) {
|
|
20456
20522
|
exitWithUsage(
|
|
20457
20523
|
"Specify how to supply the OCF patch payload: --stdin (piped JSON) or --file <path>.",
|
|
20458
20524
|
"Usage: captable-ai objects patch <object-id> (--stdin | --file <path>) [--version N] [--json]"
|
|
@@ -20464,7 +20530,7 @@ async function runObjectsPatch(args, rawArgv) {
|
|
|
20464
20530
|
"Usage: captable-ai objects patch <object-id> (--stdin | --file <path>) [--version N] [--json]"
|
|
20465
20531
|
);
|
|
20466
20532
|
}
|
|
20467
|
-
let rawPatch;
|
|
20533
|
+
let rawPatch = "{}";
|
|
20468
20534
|
if (useStdin) {
|
|
20469
20535
|
if (process.stdin.isTTY) {
|
|
20470
20536
|
exitWithError(
|
|
@@ -20475,7 +20541,7 @@ async function runObjectsPatch(args, rawArgv) {
|
|
|
20475
20541
|
);
|
|
20476
20542
|
}
|
|
20477
20543
|
rawPatch = await readStdin();
|
|
20478
|
-
} else {
|
|
20544
|
+
} else if (filePath) {
|
|
20479
20545
|
try {
|
|
20480
20546
|
rawPatch = readFileSync(filePath, "utf-8");
|
|
20481
20547
|
} catch (err) {
|
|
@@ -20505,9 +20571,27 @@ async function runObjectsPatch(args, rawArgv) {
|
|
|
20505
20571
|
}
|
|
20506
20572
|
version2 = Number.parseInt(versionRaw, 10);
|
|
20507
20573
|
}
|
|
20574
|
+
let documentId;
|
|
20575
|
+
if (documentFlag !== void 0) {
|
|
20576
|
+
if (!isUuid(documentFlag.trim())) {
|
|
20577
|
+
exitWithError(
|
|
20578
|
+
"--document must be a document UUID",
|
|
20579
|
+
"VALIDATION_FAILED",
|
|
20580
|
+
void 0,
|
|
20581
|
+
EXIT.VALIDATION
|
|
20582
|
+
);
|
|
20583
|
+
}
|
|
20584
|
+
documentId = documentFlag.trim();
|
|
20585
|
+
} else if (clearDocument) {
|
|
20586
|
+
documentId = null;
|
|
20587
|
+
}
|
|
20508
20588
|
const res = await apiRequest(`/${portalId}/objects/${encodeURIComponent(objectId)}`, {
|
|
20509
20589
|
method: "PATCH",
|
|
20510
|
-
body: {
|
|
20590
|
+
body: {
|
|
20591
|
+
ocfPatch,
|
|
20592
|
+
version: version2,
|
|
20593
|
+
...documentId !== void 0 ? { documentId } : {}
|
|
20594
|
+
}
|
|
20511
20595
|
});
|
|
20512
20596
|
const obj = res.data;
|
|
20513
20597
|
if (!obj) {
|
|
@@ -20805,7 +20889,10 @@ async function runObjectsUpdate(args, rawArgv) {
|
|
|
20805
20889
|
`);
|
|
20806
20890
|
process.exit(0);
|
|
20807
20891
|
}
|
|
20808
|
-
validateFlags(args, {
|
|
20892
|
+
validateFlags(args, {
|
|
20893
|
+
flags: ["file", "version", "document"],
|
|
20894
|
+
booleans: ["stdin", "clear-document"]
|
|
20895
|
+
});
|
|
20809
20896
|
const objectId = args.positional[0];
|
|
20810
20897
|
if (!objectId) {
|
|
20811
20898
|
exitWithUsage(
|
|
@@ -20868,6 +20955,30 @@ async function runObjectsUpdate(args, rawArgv) {
|
|
|
20868
20955
|
}
|
|
20869
20956
|
}
|
|
20870
20957
|
const ocf = parseOcfPayload(rawOcf);
|
|
20958
|
+
const documentFlag = getFlagValue(args, "document");
|
|
20959
|
+
const clearDocument = hasFlag(args, "clear-document");
|
|
20960
|
+
if (documentFlag !== void 0 && clearDocument) {
|
|
20961
|
+
exitWithError(
|
|
20962
|
+
"Specify either --document <uuid> or --clear-document, not both.",
|
|
20963
|
+
"VALIDATION_FAILED",
|
|
20964
|
+
void 0,
|
|
20965
|
+
EXIT.VALIDATION
|
|
20966
|
+
);
|
|
20967
|
+
}
|
|
20968
|
+
let documentId;
|
|
20969
|
+
if (documentFlag !== void 0) {
|
|
20970
|
+
if (!isUuid(documentFlag.trim())) {
|
|
20971
|
+
exitWithError(
|
|
20972
|
+
"--document must be a document UUID",
|
|
20973
|
+
"VALIDATION_FAILED",
|
|
20974
|
+
void 0,
|
|
20975
|
+
EXIT.VALIDATION
|
|
20976
|
+
);
|
|
20977
|
+
}
|
|
20978
|
+
documentId = documentFlag.trim();
|
|
20979
|
+
} else if (clearDocument) {
|
|
20980
|
+
documentId = null;
|
|
20981
|
+
}
|
|
20871
20982
|
const versionRaw = getFlagValue(args, "version");
|
|
20872
20983
|
const portalId = await getActivePortalId();
|
|
20873
20984
|
let version2;
|
|
@@ -20892,7 +21003,7 @@ async function runObjectsUpdate(args, rawArgv) {
|
|
|
20892
21003
|
}
|
|
20893
21004
|
const res = await apiRequest(`/${portalId}/objects/${encodeURIComponent(objectId)}`, {
|
|
20894
21005
|
method: "POST",
|
|
20895
|
-
body: { ocf, version: version2 }
|
|
21006
|
+
body: { ocf, version: version2, ...documentId !== void 0 ? { documentId } : {} }
|
|
20896
21007
|
});
|
|
20897
21008
|
const obj = res.data;
|
|
20898
21009
|
if (!obj) {
|
package/package.json
CHANGED