vestberry-cli 0.1.0
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/LICENSE +21 -0
- package/README.md +186 -0
- package/dist/api/client.d.ts +8 -0
- package/dist/api/client.js +57 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/endpoints/auth.d.ts +6 -0
- package/dist/api/endpoints/auth.js +9 -0
- package/dist/api/endpoints/auth.js.map +1 -0
- package/dist/api/endpoints/companies.d.ts +8 -0
- package/dist/api/endpoints/companies.js +34 -0
- package/dist/api/endpoints/companies.js.map +1 -0
- package/dist/api/endpoints/funds.d.ts +10 -0
- package/dist/api/endpoints/funds.js +293 -0
- package/dist/api/endpoints/funds.js.map +1 -0
- package/dist/api/endpoints/meta.d.ts +4 -0
- package/dist/api/endpoints/meta.js +48 -0
- package/dist/api/endpoints/meta.js.map +1 -0
- package/dist/api/endpoints/metrics.d.ts +33 -0
- package/dist/api/endpoints/metrics.js +306 -0
- package/dist/api/endpoints/metrics.js.map +1 -0
- package/dist/api/endpoints/notes.d.ts +10 -0
- package/dist/api/endpoints/notes.js +63 -0
- package/dist/api/endpoints/notes.js.map +1 -0
- package/dist/api/endpoints/portco-dashboard.d.ts +6 -0
- package/dist/api/endpoints/portco-dashboard.js +123 -0
- package/dist/api/endpoints/portco-dashboard.js.map +1 -0
- package/dist/api/endpoints/raw.d.ts +3 -0
- package/dist/api/endpoints/raw.js +22 -0
- package/dist/api/endpoints/raw.js.map +1 -0
- package/dist/api/endpoints/reports.d.ts +5 -0
- package/dist/api/endpoints/reports.js +104 -0
- package/dist/api/endpoints/reports.js.map +1 -0
- package/dist/api/graphql.d.ts +7 -0
- package/dist/api/graphql.js +32 -0
- package/dist/api/graphql.js.map +1 -0
- package/dist/api/introspection.d.ts +2 -0
- package/dist/api/introspection.js +62 -0
- package/dist/api/introspection.js.map +1 -0
- package/dist/api/types.d.ts +32 -0
- package/dist/api/types.js +18 -0
- package/dist/api/types.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +57 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/auth.d.ts +2 -0
- package/dist/commands/auth.js +27 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/captable-event.d.ts +2 -0
- package/dist/commands/captable-event.js +31 -0
- package/dist/commands/captable-event.js.map +1 -0
- package/dist/commands/common.d.ts +17 -0
- package/dist/commands/common.js +46 -0
- package/dist/commands/common.js.map +1 -0
- package/dist/commands/fund.d.ts +2 -0
- package/dist/commands/fund.js +87 -0
- package/dist/commands/fund.js.map +1 -0
- package/dist/commands/intent/index.d.ts +2 -0
- package/dist/commands/intent/index.js +286 -0
- package/dist/commands/intent/index.js.map +1 -0
- package/dist/commands/investment.d.ts +2 -0
- package/dist/commands/investment.js +51 -0
- package/dist/commands/investment.js.map +1 -0
- package/dist/commands/kpi.d.ts +2 -0
- package/dist/commands/kpi.js +113 -0
- package/dist/commands/kpi.js.map +1 -0
- package/dist/commands/meta.d.ts +2 -0
- package/dist/commands/meta.js +64 -0
- package/dist/commands/meta.js.map +1 -0
- package/dist/commands/note.d.ts +2 -0
- package/dist/commands/note.js +113 -0
- package/dist/commands/note.js.map +1 -0
- package/dist/commands/portco.d.ts +2 -0
- package/dist/commands/portco.js +26 -0
- package/dist/commands/portco.js.map +1 -0
- package/dist/commands/portfolio-company.d.ts +2 -0
- package/dist/commands/portfolio-company.js +48 -0
- package/dist/commands/portfolio-company.js.map +1 -0
- package/dist/commands/portfolio-summary.d.ts +18 -0
- package/dist/commands/portfolio-summary.js +334 -0
- package/dist/commands/portfolio-summary.js.map +1 -0
- package/dist/commands/raw.d.ts +2 -0
- package/dist/commands/raw.js +57 -0
- package/dist/commands/raw.js.map +1 -0
- package/dist/commands/round.d.ts +2 -0
- package/dist/commands/round.js +68 -0
- package/dist/commands/round.js.map +1 -0
- package/dist/commands/schema.d.ts +2 -0
- package/dist/commands/schema.js +27 -0
- package/dist/commands/schema.js.map +1 -0
- package/dist/commands/stakeholder.d.ts +2 -0
- package/dist/commands/stakeholder.js +50 -0
- package/dist/commands/stakeholder.js.map +1 -0
- package/dist/formatters/csv.d.ts +1 -0
- package/dist/formatters/csv.js +16 -0
- package/dist/formatters/csv.js.map +1 -0
- package/dist/formatters/json.d.ts +1 -0
- package/dist/formatters/json.js +7 -0
- package/dist/formatters/json.js.map +1 -0
- package/dist/formatters/table.d.ts +1 -0
- package/dist/formatters/table.js +31 -0
- package/dist/formatters/table.js.map +1 -0
- package/dist/resolvers/company.d.ts +7 -0
- package/dist/resolvers/company.js +22 -0
- package/dist/resolvers/company.js.map +1 -0
- package/dist/resolvers/fund.d.ts +7 -0
- package/dist/resolvers/fund.js +22 -0
- package/dist/resolvers/fund.js.map +1 -0
- package/dist/resolvers/round.d.ts +8 -0
- package/dist/resolvers/round.js +25 -0
- package/dist/resolvers/round.js.map +1 -0
- package/dist/resolvers/search.d.ts +6 -0
- package/dist/resolvers/search.js +57 -0
- package/dist/resolvers/search.js.map +1 -0
- package/dist/resolvers/stakeholder.d.ts +7 -0
- package/dist/resolvers/stakeholder.js +22 -0
- package/dist/resolvers/stakeholder.js.map +1 -0
- package/dist/utils/cache.d.ts +7 -0
- package/dist/utils/cache.js +18 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/config.d.ts +16 -0
- package/dist/utils/config.js +25 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/errors.d.ts +12 -0
- package/dist/utils/errors.js +24 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/flatten.d.ts +3 -0
- package/dist/utils/flatten.js +77 -0
- package/dist/utils/flatten.js.map +1 -0
- package/dist/utils/json-export.d.ts +10 -0
- package/dist/utils/json-export.js +53 -0
- package/dist/utils/json-export.js.map +1 -0
- package/dist/utils/output.d.ts +4 -0
- package/dist/utils/output.js +63 -0
- package/dist/utils/output.js.map +1 -0
- package/dist/utils/pagination.d.ts +12 -0
- package/dist/utils/pagination.js +46 -0
- package/dist/utils/pagination.js.map +1 -0
- package/dist/utils/parse-json.d.ts +2 -0
- package/dist/utils/parse-json.js +34 -0
- package/dist/utils/parse-json.js.map +1 -0
- package/dist/utils/portfolio-overview.d.ts +25 -0
- package/dist/utils/portfolio-overview.js +115 -0
- package/dist/utils/portfolio-overview.js.map +1 -0
- package/dist/utils/run-log.d.ts +1 -0
- package/dist/utils/run-log.js +17 -0
- package/dist/utils/run-log.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listRounds = listRounds;
|
|
4
|
+
exports.getRoundDetail = getRoundDetail;
|
|
5
|
+
exports.listCaptableEvents = listCaptableEvents;
|
|
6
|
+
exports.listStakeholders = listStakeholders;
|
|
7
|
+
const graphql_1 = require("../graphql");
|
|
8
|
+
async function listRounds(client, companyId, until, verbose = false) {
|
|
9
|
+
const query = `
|
|
10
|
+
query FinancingRoundDashboard($input: FinancingRoundDashboardInput!) {
|
|
11
|
+
financingRoundDashboard(input: $input) {
|
|
12
|
+
id
|
|
13
|
+
name
|
|
14
|
+
eventDate
|
|
15
|
+
preMoney
|
|
16
|
+
postMoney
|
|
17
|
+
pps
|
|
18
|
+
roundSize
|
|
19
|
+
currency { code }
|
|
20
|
+
stage { id name }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
const input = { portfolioCompany: { id: companyId } };
|
|
25
|
+
if (until) {
|
|
26
|
+
input.until = until;
|
|
27
|
+
}
|
|
28
|
+
const data = await (0, graphql_1.executeGraphQL)(client, { query, variables: { input } }, verbose);
|
|
29
|
+
return data.financingRoundDashboard ?? [];
|
|
30
|
+
}
|
|
31
|
+
async function getRoundDetail(client, roundId, verbose = false) {
|
|
32
|
+
const query = `
|
|
33
|
+
query FinancingRoundDetail($input: FinancingRoundInput) {
|
|
34
|
+
financingRoundDetail(input: $input) {
|
|
35
|
+
id
|
|
36
|
+
name
|
|
37
|
+
eventDate
|
|
38
|
+
preMoney
|
|
39
|
+
postMoney
|
|
40
|
+
pps
|
|
41
|
+
roundSize
|
|
42
|
+
currency { code }
|
|
43
|
+
stage { id name }
|
|
44
|
+
positions {
|
|
45
|
+
id
|
|
46
|
+
commitment
|
|
47
|
+
role { id name priority }
|
|
48
|
+
stakeholder { id name }
|
|
49
|
+
}
|
|
50
|
+
fundData {
|
|
51
|
+
description
|
|
52
|
+
fund { id displayName }
|
|
53
|
+
files { id name }
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
const data = await (0, graphql_1.executeGraphQL)(client, { query, variables: { input: { id: roundId } } }, verbose);
|
|
59
|
+
return data.financingRoundDetail;
|
|
60
|
+
}
|
|
61
|
+
async function listCaptableEvents(client, companyId, verbose = false) {
|
|
62
|
+
const query = `
|
|
63
|
+
query CaptableEvents($input: CaptableEventsInput) {
|
|
64
|
+
captableEvents(input: $input) {
|
|
65
|
+
id
|
|
66
|
+
name
|
|
67
|
+
eventDate
|
|
68
|
+
totalShares
|
|
69
|
+
totalSharesFD
|
|
70
|
+
totalDebt
|
|
71
|
+
ownershipPerStakeholder {
|
|
72
|
+
stakeholderId
|
|
73
|
+
ownershipPercentOS
|
|
74
|
+
ownershipPercentFD
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
const data = await (0, graphql_1.executeGraphQL)(client, { query, variables: { input: { portfolioCompany: { id: companyId } } } }, verbose);
|
|
80
|
+
return data.captableEvents ?? [];
|
|
81
|
+
}
|
|
82
|
+
async function listStakeholders(client, companyId, verbose = false) {
|
|
83
|
+
const query = `
|
|
84
|
+
query Stakeholders($input: StakeholdersInputGQL) {
|
|
85
|
+
stakeholders(input: $input) {
|
|
86
|
+
id
|
|
87
|
+
name
|
|
88
|
+
stakeholderType
|
|
89
|
+
dependentFinancingRounds {
|
|
90
|
+
id
|
|
91
|
+
name
|
|
92
|
+
eventDate
|
|
93
|
+
preMoney
|
|
94
|
+
postMoney
|
|
95
|
+
pps
|
|
96
|
+
roundSize
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
`;
|
|
101
|
+
const data = await (0, graphql_1.executeGraphQL)(client, { query, variables: { input: { portfolioCompany: { id: companyId } } } }, verbose);
|
|
102
|
+
return data.stakeholders ?? [];
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=reports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reports.js","sourceRoot":"","sources":["../../../src/api/endpoints/reports.ts"],"names":[],"mappings":";;AAmBA,gCAkCC;AAED,wCAuCC;AAED,gDA8BC;AAED,4CA+BC;AA9JD,wCAA4C;AAkBrC,KAAK,UAAU,UAAU,CAC9B,MAAqB,EACrB,SAAiB,EACjB,KAAc,EACd,OAAO,GAAG,KAAK;IAEf,MAAM,KAAK,GAAG;;;;;;;;;;;;;;GAcb,CAAC;IAEF,MAAM,KAAK,GAA4B,EAAE,gBAAgB,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC;IAC/E,IAAI,KAAK,EAAE,CAAC;QACV,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,IAAA,wBAAc,EAC/B,MAAM,EACN,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,EAC/B,OAAO,CACR,CAAC;IAEF,OAAO,IAAI,CAAC,uBAAuB,IAAI,EAAE,CAAC;AAC5C,CAAC;AAEM,KAAK,UAAU,cAAc,CAClC,MAAqB,EACrB,OAAe,EACf,OAAO,GAAG,KAAK;IAEf,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;GAyBb,CAAC;IAEF,MAAM,IAAI,GAAG,MAAM,IAAA,wBAAc,EAC/B,MAAM,EACN,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAChD,OAAO,CACR,CAAC;IAEF,OAAO,IAAI,CAAC,oBAAoB,CAAC;AACnC,CAAC;AAEM,KAAK,UAAU,kBAAkB,CACtC,MAAqB,EACrB,SAAiB,EACjB,OAAO,GAAG,KAAK;IAEf,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;GAgBb,CAAC;IAEF,MAAM,IAAI,GAAG,MAAM,IAAA,wBAAc,EAC/B,MAAM,EACN,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,EACxE,OAAO,CACR,CAAC;IAEF,OAAO,IAAI,CAAC,cAAc,IAAI,EAAE,CAAC;AACnC,CAAC;AAEM,KAAK,UAAU,gBAAgB,CACpC,MAAqB,EACrB,SAAiB,EACjB,OAAO,GAAG,KAAK;IAEf,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;GAiBb,CAAC;IAEF,MAAM,IAAI,GAAG,MAAM,IAAA,wBAAc,EAC/B,MAAM,EACN,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,EACxE,OAAO,CACR,CAAC;IAEF,OAAO,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AxiosInstance } from 'axios';
|
|
2
|
+
export interface GraphQLRequest {
|
|
3
|
+
query: string;
|
|
4
|
+
variables?: Record<string, unknown>;
|
|
5
|
+
operationName?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function executeGraphQL<TData = unknown>(client: AxiosInstance, request: GraphQLRequest, verbose?: boolean): Promise<TData>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeGraphQL = executeGraphQL;
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
const errors_1 = require("../utils/errors");
|
|
6
|
+
const client_1 = require("./client");
|
|
7
|
+
async function executeGraphQL(client, request, verbose = false) {
|
|
8
|
+
try {
|
|
9
|
+
const response = await (0, client_1.requestWithRetry)(() => client.post('', request));
|
|
10
|
+
const parsed = types_1.GraphQLResponseSchema.parse(response.data);
|
|
11
|
+
if (parsed.errors && parsed.errors.length > 0) {
|
|
12
|
+
const message = parsed.errors.map((err) => err.message).join('; ');
|
|
13
|
+
throw new errors_1.CliError('GRAPHQL_ERROR', message, verbose ? parsed.errors : undefined);
|
|
14
|
+
}
|
|
15
|
+
return parsed.data;
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
if (error instanceof errors_1.CliError) {
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
if (error?.response) {
|
|
22
|
+
const status = error.response.status;
|
|
23
|
+
const message = `HTTP ${status}: ${error.response.statusText || 'Request failed'}`;
|
|
24
|
+
throw new errors_1.CliError('HTTP_ERROR', message, verbose ? error.response.data : undefined);
|
|
25
|
+
}
|
|
26
|
+
if (error?.request) {
|
|
27
|
+
throw new errors_1.CliError('NETWORK_ERROR', 'Network error while contacting Vestberry API', verbose ? error : undefined);
|
|
28
|
+
}
|
|
29
|
+
throw new errors_1.CliError('HTTP_ERROR', error?.message || 'Unknown API error', verbose ? error : undefined);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../src/api/graphql.ts"],"names":[],"mappings":";;AAWA,wCAwCC;AAlDD,mCAAgD;AAChD,4CAA2C;AAC3C,qCAA4C;AAQrC,KAAK,UAAU,cAAc,CAClC,MAAqB,EACrB,OAAuB,EACvB,OAAO,GAAG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,8CAA8C,EAC9C,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAC5B,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,iBAAQ,CAChB,YAAY,EACZ,KAAK,EAAE,OAAO,IAAI,mBAAmB,EACrC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAC5B,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.pullSchema = pullSchema;
|
|
7
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const graphql_1 = require("./graphql");
|
|
10
|
+
const INTROSPECTION_QUERY = `
|
|
11
|
+
query IntrospectionQuery {
|
|
12
|
+
__schema {
|
|
13
|
+
queryType { name }
|
|
14
|
+
mutationType { name }
|
|
15
|
+
types {
|
|
16
|
+
kind
|
|
17
|
+
name
|
|
18
|
+
description
|
|
19
|
+
fields(includeDeprecated: true) {
|
|
20
|
+
name
|
|
21
|
+
description
|
|
22
|
+
args {
|
|
23
|
+
name
|
|
24
|
+
description
|
|
25
|
+
type {
|
|
26
|
+
kind
|
|
27
|
+
name
|
|
28
|
+
ofType { kind name ofType { kind name } }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
type {
|
|
32
|
+
kind
|
|
33
|
+
name
|
|
34
|
+
ofType { kind name ofType { kind name } }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
inputFields {
|
|
38
|
+
name
|
|
39
|
+
description
|
|
40
|
+
type {
|
|
41
|
+
kind
|
|
42
|
+
name
|
|
43
|
+
ofType { kind name ofType { kind name } }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
enumValues(includeDeprecated: true) {
|
|
47
|
+
name
|
|
48
|
+
description
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
async function pullSchema(client, verbose = false) {
|
|
55
|
+
const schema = await (0, graphql_1.executeGraphQL)(client, { query: INTROSPECTION_QUERY }, verbose);
|
|
56
|
+
const outDir = node_path_1.default.join(process.cwd(), '.cache');
|
|
57
|
+
const outFile = node_path_1.default.join(outDir, 'vestberry-schema.json');
|
|
58
|
+
await promises_1.default.mkdir(outDir, { recursive: true });
|
|
59
|
+
await promises_1.default.writeFile(outFile, JSON.stringify(schema, null, 2), 'utf-8');
|
|
60
|
+
return outFile;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=introspection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"introspection.js","sourceRoot":"","sources":["../../src/api/introspection.ts"],"names":[],"mappings":";;;;;AAkDA,gCAOC;AAzDD,gEAAkC;AAClC,0DAA6B;AAE7B,uCAA2C;AAE3C,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2C3B,CAAC;AAEK,KAAK,UAAU,UAAU,CAAC,MAAqB,EAAE,OAAO,GAAG,KAAK;IACrE,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAc,EAAC,MAAM,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,EAAE,OAAO,CAAC,CAAC;IACrF,MAAM,MAAM,GAAG,mBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,mBAAI,CAAC,IAAI,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IAC3D,MAAM,kBAAE,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,MAAM,kBAAE,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACtE,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const GraphQLErrorSchema: z.ZodObject<{
|
|
3
|
+
message: z.ZodString;
|
|
4
|
+
path: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
5
|
+
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
6
|
+
}, z.core.$loose>;
|
|
7
|
+
export declare const GraphQLResponseSchema: z.ZodObject<{
|
|
8
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
9
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
10
|
+
message: z.ZodString;
|
|
11
|
+
path: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
12
|
+
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
13
|
+
}, z.core.$loose>>>;
|
|
14
|
+
}, z.core.$loose>;
|
|
15
|
+
export type GraphQLError = z.infer<typeof GraphQLErrorSchema>;
|
|
16
|
+
export type GraphQLResponse = z.infer<typeof GraphQLResponseSchema>;
|
|
17
|
+
export interface PaginationInfo {
|
|
18
|
+
limit?: number;
|
|
19
|
+
offset?: number;
|
|
20
|
+
count?: number;
|
|
21
|
+
hasNextPage?: boolean;
|
|
22
|
+
endCursor?: string | null;
|
|
23
|
+
mode?: 'offset' | 'connection' | 'none';
|
|
24
|
+
}
|
|
25
|
+
export interface ListEnvelope<T> {
|
|
26
|
+
pagination: PaginationInfo;
|
|
27
|
+
data: T[];
|
|
28
|
+
}
|
|
29
|
+
export interface SearchResult<T> {
|
|
30
|
+
score: number;
|
|
31
|
+
item: T;
|
|
32
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphQLResponseSchema = exports.GraphQLErrorSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.GraphQLErrorSchema = zod_1.z
|
|
6
|
+
.object({
|
|
7
|
+
message: zod_1.z.string(),
|
|
8
|
+
path: zod_1.z.array(zod_1.z.union([zod_1.z.string(), zod_1.z.number()])).optional(),
|
|
9
|
+
extensions: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
10
|
+
})
|
|
11
|
+
.passthrough();
|
|
12
|
+
exports.GraphQLResponseSchema = zod_1.z
|
|
13
|
+
.object({
|
|
14
|
+
data: zod_1.z.unknown().optional(),
|
|
15
|
+
errors: zod_1.z.array(exports.GraphQLErrorSchema).optional(),
|
|
16
|
+
})
|
|
17
|
+
.passthrough();
|
|
18
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,kBAAkB,GAAG,OAAC;KAChC,MAAM,CAAC;IACN,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC3D,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CACzD,CAAC;KACD,WAAW,EAAE,CAAC;AAEJ,QAAA,qBAAqB,GAAG,OAAC;KACnC,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,0BAAkB,CAAC,CAAC,QAAQ,EAAE;CAC/C,CAAC;KACD,WAAW,EAAE,CAAC"}
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.buildProgram = buildProgram;
|
|
5
|
+
const commander_1 = require("commander");
|
|
6
|
+
const auth_1 = require("./commands/auth");
|
|
7
|
+
const raw_1 = require("./commands/raw");
|
|
8
|
+
const fund_1 = require("./commands/fund");
|
|
9
|
+
const portfolio_company_1 = require("./commands/portfolio-company");
|
|
10
|
+
const investment_1 = require("./commands/investment");
|
|
11
|
+
const round_1 = require("./commands/round");
|
|
12
|
+
const captable_event_1 = require("./commands/captable-event");
|
|
13
|
+
const stakeholder_1 = require("./commands/stakeholder");
|
|
14
|
+
const kpi_1 = require("./commands/kpi");
|
|
15
|
+
const note_1 = require("./commands/note");
|
|
16
|
+
const meta_1 = require("./commands/meta");
|
|
17
|
+
const schema_1 = require("./commands/schema");
|
|
18
|
+
const intent_1 = require("./commands/intent");
|
|
19
|
+
const portco_1 = require("./commands/portco");
|
|
20
|
+
const CLI_VERSION = require('../package.json').version;
|
|
21
|
+
function buildProgram() {
|
|
22
|
+
const program = new commander_1.Command();
|
|
23
|
+
program
|
|
24
|
+
.name('vestberry')
|
|
25
|
+
.description('Production-grade GraphQL CLI for Vestberry')
|
|
26
|
+
.version(CLI_VERSION)
|
|
27
|
+
.option('--api-key <key>', 'Override API key (env fallback: VESTBERRY_API_KEY)')
|
|
28
|
+
.option('--format <format>', 'Output format: json|table|csv', 'json')
|
|
29
|
+
.option('--compact', 'Compact output mode', true)
|
|
30
|
+
.option('--no-compact', 'Disable compact output mode')
|
|
31
|
+
.option('--verbose', 'Verbose API and error output', false)
|
|
32
|
+
.option('--dry-run', 'Global dry-run for mutation operations', false);
|
|
33
|
+
(0, auth_1.registerAuthCommand)(program);
|
|
34
|
+
(0, raw_1.registerRawCommand)(program);
|
|
35
|
+
(0, fund_1.registerFundCommand)(program);
|
|
36
|
+
(0, portfolio_company_1.registerPortfolioCompanyCommand)(program);
|
|
37
|
+
(0, investment_1.registerInvestmentCommand)(program);
|
|
38
|
+
(0, round_1.registerRoundCommand)(program);
|
|
39
|
+
(0, captable_event_1.registerCaptableEventCommand)(program);
|
|
40
|
+
(0, stakeholder_1.registerStakeholderCommand)(program);
|
|
41
|
+
(0, kpi_1.registerKpiCommand)(program);
|
|
42
|
+
(0, note_1.registerNoteCommand)(program);
|
|
43
|
+
(0, meta_1.registerMetaCommand)(program);
|
|
44
|
+
(0, schema_1.registerSchemaCommand)(program);
|
|
45
|
+
(0, portco_1.registerPortcoCommand)(program);
|
|
46
|
+
(0, intent_1.registerIntentCommands)(program);
|
|
47
|
+
return program;
|
|
48
|
+
}
|
|
49
|
+
if (require.main === module) {
|
|
50
|
+
buildProgram()
|
|
51
|
+
.parseAsync(process.argv)
|
|
52
|
+
.catch((error) => {
|
|
53
|
+
process.stderr.write(`${error.message}\n`);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAmBA,oCA8BC;AAhDD,yCAAoC;AACpC,0CAAsD;AACtD,wCAAoD;AACpD,0CAAsD;AACtD,oEAA+E;AAC/E,sDAAkE;AAClE,4CAAwD;AACxD,8DAAyE;AACzE,wDAAoE;AACpE,wCAAoD;AACpD,0CAAsD;AACtD,0CAAsD;AACtD,8CAA0D;AAC1D,8CAA2D;AAC3D,8C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AO,CAAC;AACjB,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,YAAY,EAAE;SACX,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC;SACxB,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAI,KAAe,CAAC,OAAO,IAAI,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerAuthCommand = registerAuthCommand;
|
|
4
|
+
const auth_1 = require("../api/endpoints/auth");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
const output_1 = require("../utils/output");
|
|
7
|
+
function registerAuthCommand(program) {
|
|
8
|
+
const auth = program.command('auth').description('Authentication commands');
|
|
9
|
+
auth
|
|
10
|
+
.command('test')
|
|
11
|
+
.description('Verify token and connectivity')
|
|
12
|
+
.addHelpText('after', `
|
|
13
|
+
Examples:
|
|
14
|
+
$ vestberry auth test
|
|
15
|
+
$ vestberry auth test --verbose`)
|
|
16
|
+
.action(async function action() {
|
|
17
|
+
try {
|
|
18
|
+
const { client, config } = (0, common_1.getCommandContext)(this);
|
|
19
|
+
const data = await (0, auth_1.authTest)(client, config.verbose);
|
|
20
|
+
(0, output_1.printData)({ ok: true, ...data }, config);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
(0, common_1.handleCliError)(error, Boolean(this.optsWithGlobals().verbose));
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":";;AAKA,kDAsBC;AA1BD,gDAAiD;AACjD,qCAA6D;AAC7D,4CAA4C;AAE5C,SAAgB,mBAAmB,CAAC,OAAgB;IAClD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAE5E,IAAI;SACD,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,+BAA+B,CAAC;SAC5C,WAAW,CACV,OAAO,EACP;;;kCAG4B,CAC7B;SACA,MAAM,CAAC,KAAK,UAAU,MAAM;QAC3B,IAAI,CAAC;YACH,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,0BAAiB,EAAC,IAAI,CAAC,CAAC;YACnD,MAAM,IAAI,GAAG,MAAM,IAAA,eAAQ,EAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;YACpD,IAAA,kBAAS,EAAC,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAA,uBAAc,EAAC,KAAK,EAAE,OAAO,CAAE,IAAI,CAAC,eAAe,EAA4B,CAAC,OAAO,CAAC,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerCaptableEventCommand = registerCaptableEventCommand;
|
|
4
|
+
const reports_1 = require("../api/endpoints/reports");
|
|
5
|
+
const pagination_1 = require("../utils/pagination");
|
|
6
|
+
const output_1 = require("../utils/output");
|
|
7
|
+
const common_1 = require("./common");
|
|
8
|
+
function registerCaptableEventCommand(program) {
|
|
9
|
+
program
|
|
10
|
+
.command('captable-event')
|
|
11
|
+
.description('Cap table event commands')
|
|
12
|
+
.command('list')
|
|
13
|
+
.requiredOption('--company-id <id>', 'Portfolio company ID')
|
|
14
|
+
.option('--all', 'Return all available rows', false)
|
|
15
|
+
.description('List cap table events for a company')
|
|
16
|
+
.addHelpText('after', `
|
|
17
|
+
Examples:
|
|
18
|
+
$ vestberry captable-event list --company-id xyz789
|
|
19
|
+
$ vestberry captable-event list --company-id xyz789 --format table`)
|
|
20
|
+
.action(async function action(options) {
|
|
21
|
+
try {
|
|
22
|
+
const { client, config } = (0, common_1.getCommandContext)(this);
|
|
23
|
+
const rows = await (0, reports_1.listCaptableEvents)(client, options.companyId, config.verbose);
|
|
24
|
+
(0, output_1.printListEnvelope)((0, pagination_1.createListEnvelope)(rows), config);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
(0, common_1.handleCliError)(error, Boolean(this.optsWithGlobals().verbose));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=captable-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captable-event.js","sourceRoot":"","sources":["../../src/commands/captable-event.ts"],"names":[],"mappings":";;AAMA,oEAwBC;AA7BD,sDAA8D;AAC9D,oDAAyD;AACzD,4CAAoD;AACpD,qCAA6D;AAE7D,SAAgB,4BAA4B,CAAC,OAAgB;IAC3D,OAAO;SACJ,OAAO,CAAC,gBAAgB,CAAC;SACzB,WAAW,CAAC,0BAA0B,CAAC;SACvC,OAAO,CAAC,MAAM,CAAC;SACf,cAAc,CAAC,mBAAmB,EAAE,sBAAsB,CAAC;SAC3D,MAAM,CAAC,OAAO,EAAE,2BAA2B,EAAE,KAAK,CAAC;SACnD,WAAW,CAAC,qCAAqC,CAAC;SAClD,WAAW,CACV,OAAO,EACP;;;qEAG+D,CAChE;SACA,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAA6C;QACzE,IAAI,CAAC;YACH,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,0BAAiB,EAAC,IAAI,CAAC,CAAC;YACnD,MAAM,IAAI,GAAG,MAAM,IAAA,4BAAkB,EAAC,MAAM,EAAE,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;YACjF,IAAA,0BAAiB,EAAC,IAAA,+BAAkB,EAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;QACtD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAA,uBAAc,EAAC,KAAK,EAAE,OAAO,CAAE,IAAI,CAAC,eAAe,EAA4B,CAAC,OAAO,CAAC,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { createApiClient } from '../api/client';
|
|
3
|
+
import { type RuntimeConfig } from '../utils/config';
|
|
4
|
+
export interface CommandContext {
|
|
5
|
+
config: RuntimeConfig;
|
|
6
|
+
client: ReturnType<typeof createApiClient>;
|
|
7
|
+
}
|
|
8
|
+
export declare function getCommandContext(command: Command): CommandContext;
|
|
9
|
+
export declare function handleCliError(error: unknown, verbose?: boolean): never;
|
|
10
|
+
export declare function ensureMutationAllowed(options: {
|
|
11
|
+
apply?: boolean;
|
|
12
|
+
dryRun?: boolean;
|
|
13
|
+
}, globalDryRun: boolean): {
|
|
14
|
+
apply: boolean;
|
|
15
|
+
effectiveDryRun: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare function printSuccess(data: unknown, command: Command): void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCommandContext = getCommandContext;
|
|
4
|
+
exports.handleCliError = handleCliError;
|
|
5
|
+
exports.ensureMutationAllowed = ensureMutationAllowed;
|
|
6
|
+
exports.printSuccess = printSuccess;
|
|
7
|
+
const client_1 = require("../api/client");
|
|
8
|
+
const config_1 = require("../utils/config");
|
|
9
|
+
const errors_1 = require("../utils/errors");
|
|
10
|
+
const output_1 = require("../utils/output");
|
|
11
|
+
function getCommandContext(command) {
|
|
12
|
+
const options = command.optsWithGlobals();
|
|
13
|
+
const config = (0, config_1.resolveRuntimeConfig)(options);
|
|
14
|
+
const client = (0, client_1.createApiClient)(config.baseUrl, config.apiKey);
|
|
15
|
+
return { config, client };
|
|
16
|
+
}
|
|
17
|
+
function handleCliError(error, verbose = false) {
|
|
18
|
+
const cliError = (0, errors_1.toCliError)(error);
|
|
19
|
+
const payload = {
|
|
20
|
+
error: {
|
|
21
|
+
code: cliError.code,
|
|
22
|
+
message: cliError.message,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
if (verbose && cliError.details !== undefined) {
|
|
26
|
+
payload.error.details = cliError.details;
|
|
27
|
+
}
|
|
28
|
+
process.stderr.write(`${JSON.stringify(payload, null, 2)}\n`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
function ensureMutationAllowed(options, globalDryRun) {
|
|
32
|
+
const apply = options.apply ?? false;
|
|
33
|
+
const effectiveDryRun = (options.dryRun ?? globalDryRun) || !apply;
|
|
34
|
+
if (effectiveDryRun) {
|
|
35
|
+
return { apply: false, effectiveDryRun: true };
|
|
36
|
+
}
|
|
37
|
+
if (!apply) {
|
|
38
|
+
throw new errors_1.CliError('DRY_RUN', 'Mutation blocked. Pass --apply to execute write operation.');
|
|
39
|
+
}
|
|
40
|
+
return { apply: true, effectiveDryRun: false };
|
|
41
|
+
}
|
|
42
|
+
function printSuccess(data, command) {
|
|
43
|
+
const { config } = getCommandContext(command);
|
|
44
|
+
(0, output_1.printData)(data, config);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/commands/common.ts"],"names":[],"mappings":";;AAWA,8CAaC;AAED,wCAqBC;AAED,sDAmBC;AAED,oCAGC;AAxED,0CAAgD;AAChD,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AAE,CAAC;IACjD,CAAC;IAED,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,iBAAQ,CAAC,SAAS,EAAE,4DAA4D,CAAC,CAAC;IAC9F,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;AACjD,CAAC;AAED,SAAgB,YAAY,CAAC,IAAa,EAAE,OAAgB;IAC1D,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC9C,IAAA,kBAAS,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerFundCommand = registerFundCommand;
|
|
4
|
+
const funds_1 = require("../api/endpoints/funds");
|
|
5
|
+
const companies_1 = require("../api/endpoints/companies");
|
|
6
|
+
const portfolio_summary_1 = require("./portfolio-summary");
|
|
7
|
+
const fund_1 = require("../resolvers/fund");
|
|
8
|
+
const pagination_1 = require("../utils/pagination");
|
|
9
|
+
const output_1 = require("../utils/output");
|
|
10
|
+
const common_1 = require("./common");
|
|
11
|
+
function registerFundCommand(program) {
|
|
12
|
+
const fund = program.command('fund').description('Fund commands');
|
|
13
|
+
fund
|
|
14
|
+
.command('list')
|
|
15
|
+
.description('List funds')
|
|
16
|
+
.addHelpText('after', `
|
|
17
|
+
Examples:
|
|
18
|
+
$ vestberry fund list
|
|
19
|
+
$ vestberry fund list --format table
|
|
20
|
+
$ vestberry fund list --no-compact`)
|
|
21
|
+
.action(async function action() {
|
|
22
|
+
try {
|
|
23
|
+
const { client, config } = (0, common_1.getCommandContext)(this);
|
|
24
|
+
const rows = await (0, funds_1.listFunds)(client, undefined, config.verbose);
|
|
25
|
+
(0, output_1.printListEnvelope)((0, pagination_1.createListEnvelope)(rows), config);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
(0, common_1.handleCliError)(error, Boolean(this.optsWithGlobals().verbose));
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
fund
|
|
32
|
+
.command('get <id>')
|
|
33
|
+
.option('--full', 'Return full fund details', false)
|
|
34
|
+
.description('Get fund by ID')
|
|
35
|
+
.addHelpText('after', `
|
|
36
|
+
Examples:
|
|
37
|
+
$ vestberry fund get abc123
|
|
38
|
+
$ vestberry fund get abc123 --format json
|
|
39
|
+
$ vestberry fund get abc123 --full`)
|
|
40
|
+
.action(async function action(id, options) {
|
|
41
|
+
try {
|
|
42
|
+
const { client, config } = (0, common_1.getCommandContext)(this);
|
|
43
|
+
const row = await (0, funds_1.getFund)(client, id, config.verbose, Boolean(options.full));
|
|
44
|
+
(0, output_1.printData)(row, config);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
(0, common_1.handleCliError)(error, Boolean(this.optsWithGlobals().verbose));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
fund
|
|
51
|
+
.command('get-portco-list <fundId>')
|
|
52
|
+
.description('List portfolio companies for a fund')
|
|
53
|
+
.addHelpText('after', `
|
|
54
|
+
Examples:
|
|
55
|
+
$ vestberry fund get-portco-list abc123
|
|
56
|
+
$ vestberry fund get-portco-list abc123 --format table`)
|
|
57
|
+
.action(async function action(fundId) {
|
|
58
|
+
try {
|
|
59
|
+
const { client, config } = (0, common_1.getCommandContext)(this);
|
|
60
|
+
const rows = await (0, companies_1.listPortfolioCompanies)(client, fundId, config.verbose);
|
|
61
|
+
(0, output_1.printListEnvelope)((0, pagination_1.createListEnvelope)(rows), config);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
(0, common_1.handleCliError)(error, Boolean(this.optsWithGlobals().verbose));
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
fund
|
|
68
|
+
.command('search')
|
|
69
|
+
.description('Search funds by display name')
|
|
70
|
+
.requiredOption('--query <text>', 'Search text')
|
|
71
|
+
.addHelpText('after', `
|
|
72
|
+
Examples:
|
|
73
|
+
$ vestberry fund search --query "Growth Fund"
|
|
74
|
+
$ vestberry fund search --query "Seed" --format table`)
|
|
75
|
+
.action(async function action(options) {
|
|
76
|
+
try {
|
|
77
|
+
const { client, config } = (0, common_1.getCommandContext)(this);
|
|
78
|
+
const rows = await (0, fund_1.searchFunds)(client, options.query, config.verbose);
|
|
79
|
+
(0, output_1.printListEnvelope)((0, pagination_1.createListEnvelope)(rows), config);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
(0, common_1.handleCliError)(error, Boolean(this.optsWithGlobals().verbose));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
(0, portfolio_summary_1.registerFundSummarySubcommand)(fund);
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=fund.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fund.js","sourceRoot":"","sources":["../../src/commands/fund.ts"],"names":[],"mappings":";;AASA,kDAwFC;AAhGD,kDAA4D;AAC5D,0DAAoE;AACpE,2DAAoE;AACpE,4CAAgD;AAChD,oDAAyD;AACzD,4CAA+D;AAC/D,qCAA6D;AAE7D,SAAgB,mBAAmB,CAAC,OAAgB;IAClD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IAElE,IAAI;SACD,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,YAAY,CAAC;SACzB,WAAW,CACV,OAAO,EACP;;;;qCAI+B,CAChC;SACA,MAAM,CAAC,KAAK,UAAU,MAAM;QAC3B,IAAI,CAAC;YACH,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,0BAAiB,EAAC,IAAI,CAAC,CAAC;YACnD,MAAM,IAAI,GAAG,MAAM,IAAA,iBAAS,EAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,OAA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