@cargo-ai/cli 1.0.1
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/README.md +114 -0
- package/build/api.d.ts +4 -0
- package/build/api.d.ts.map +1 -0
- package/build/api.js +10 -0
- package/build/commands/ai/agent.d.ts +4 -0
- package/build/commands/ai/agent.d.ts.map +1 -0
- package/build/commands/ai/agent.js +83 -0
- package/build/commands/ai/chat.d.ts +4 -0
- package/build/commands/ai/chat.d.ts.map +1 -0
- package/build/commands/ai/chat.js +71 -0
- package/build/commands/ai/document.d.ts +4 -0
- package/build/commands/ai/document.d.ts.map +1 -0
- package/build/commands/ai/document.js +59 -0
- package/build/commands/ai/file.d.ts +4 -0
- package/build/commands/ai/file.d.ts.map +1 -0
- package/build/commands/ai/file.js +74 -0
- package/build/commands/ai/index.d.ts +4 -0
- package/build/commands/ai/index.d.ts.map +1 -0
- package/build/commands/ai/index.js +33 -0
- package/build/commands/ai/mcpClient.d.ts +4 -0
- package/build/commands/ai/mcpClient.d.ts.map +1 -0
- package/build/commands/ai/mcpClient.js +31 -0
- package/build/commands/ai/mcpServer.d.ts +4 -0
- package/build/commands/ai/mcpServer.d.ts.map +1 -0
- package/build/commands/ai/mcpServer.js +62 -0
- package/build/commands/ai/memory.d.ts +4 -0
- package/build/commands/ai/memory.d.ts.map +1 -0
- package/build/commands/ai/memory.js +50 -0
- package/build/commands/ai/message.d.ts +4 -0
- package/build/commands/ai/message.d.ts.map +1 -0
- package/build/commands/ai/message.js +86 -0
- package/build/commands/ai/prompt.d.ts +4 -0
- package/build/commands/ai/prompt.d.ts.map +1 -0
- package/build/commands/ai/prompt.js +34 -0
- package/build/commands/ai/release.d.ts +4 -0
- package/build/commands/ai/release.d.ts.map +1 -0
- package/build/commands/ai/release.js +150 -0
- package/build/commands/ai/skill.d.ts +4 -0
- package/build/commands/ai/skill.d.ts.map +1 -0
- package/build/commands/ai/skill.js +96 -0
- package/build/commands/ai/suggestedAction.d.ts +4 -0
- package/build/commands/ai/suggestedAction.d.ts.map +1 -0
- package/build/commands/ai/suggestedAction.js +37 -0
- package/build/commands/ai/template.d.ts +4 -0
- package/build/commands/ai/template.d.ts.map +1 -0
- package/build/commands/ai/template.js +14 -0
- package/build/commands/ai/vote.d.ts +4 -0
- package/build/commands/ai/vote.d.ts.map +1 -0
- package/build/commands/ai/vote.js +28 -0
- package/build/commands/auth.d.ts +3 -0
- package/build/commands/auth.d.ts.map +1 -0
- package/build/commands/auth.js +73 -0
- package/build/commands/billing/index.d.ts +4 -0
- package/build/commands/billing/index.d.ts.map +1 -0
- package/build/commands/billing/index.js +9 -0
- package/build/commands/billing/subscription.d.ts +4 -0
- package/build/commands/billing/subscription.d.ts.map +1 -0
- package/build/commands/billing/subscription.js +119 -0
- package/build/commands/billing/usage.d.ts +4 -0
- package/build/commands/billing/usage.d.ts.map +1 -0
- package/build/commands/billing/usage.js +33 -0
- package/build/commands/connection/connector.d.ts +4 -0
- package/build/commands/connection/connector.d.ts.map +1 -0
- package/build/commands/connection/connector.js +129 -0
- package/build/commands/connection/index.d.ts +4 -0
- package/build/commands/connection/index.d.ts.map +1 -0
- package/build/commands/connection/index.js +11 -0
- package/build/commands/connection/integration.d.ts +4 -0
- package/build/commands/connection/integration.d.ts.map +1 -0
- package/build/commands/connection/integration.js +35 -0
- package/build/commands/connection/nativeIntegration.d.ts +4 -0
- package/build/commands/connection/nativeIntegration.d.ts.map +1 -0
- package/build/commands/connection/nativeIntegration.js +14 -0
- package/build/commands/expression/expressionEval.d.ts +4 -0
- package/build/commands/expression/expressionEval.d.ts.map +1 -0
- package/build/commands/expression/expressionEval.js +32 -0
- package/build/commands/expression/favoriteRecipe.d.ts +4 -0
- package/build/commands/expression/favoriteRecipe.d.ts.map +1 -0
- package/build/commands/expression/favoriteRecipe.js +24 -0
- package/build/commands/expression/index.d.ts +4 -0
- package/build/commands/expression/index.d.ts.map +1 -0
- package/build/commands/expression/index.js +11 -0
- package/build/commands/expression/recipe.d.ts +4 -0
- package/build/commands/expression/recipe.d.ts.map +1 -0
- package/build/commands/expression/recipe.js +98 -0
- package/build/commands/init.d.ts +4 -0
- package/build/commands/init.d.ts.map +1 -0
- package/build/commands/init.js +11 -0
- package/build/commands/orchestration/batch.d.ts +4 -0
- package/build/commands/orchestration/batch.d.ts.map +1 -0
- package/build/commands/orchestration/batch.js +106 -0
- package/build/commands/orchestration/draftRelease.d.ts +4 -0
- package/build/commands/orchestration/draftRelease.d.ts.map +1 -0
- package/build/commands/orchestration/draftRelease.js +73 -0
- package/build/commands/orchestration/index.d.ts +4 -0
- package/build/commands/orchestration/index.d.ts.map +1 -0
- package/build/commands/orchestration/index.js +25 -0
- package/build/commands/orchestration/node.d.ts +4 -0
- package/build/commands/orchestration/node.d.ts.map +1 -0
- package/build/commands/orchestration/node.js +44 -0
- package/build/commands/orchestration/play.d.ts +4 -0
- package/build/commands/orchestration/play.d.ts.map +1 -0
- package/build/commands/orchestration/play.js +63 -0
- package/build/commands/orchestration/record.d.ts +4 -0
- package/build/commands/orchestration/record.d.ts.map +1 -0
- package/build/commands/orchestration/record.js +194 -0
- package/build/commands/orchestration/release.d.ts +4 -0
- package/build/commands/orchestration/release.d.ts.map +1 -0
- package/build/commands/orchestration/release.js +27 -0
- package/build/commands/orchestration/run.d.ts +4 -0
- package/build/commands/orchestration/run.d.ts.map +1 -0
- package/build/commands/orchestration/run.js +196 -0
- package/build/commands/orchestration/template.d.ts +4 -0
- package/build/commands/orchestration/template.d.ts.map +1 -0
- package/build/commands/orchestration/template.js +22 -0
- package/build/commands/orchestration/tool.d.ts +4 -0
- package/build/commands/orchestration/tool.d.ts.map +1 -0
- package/build/commands/orchestration/tool.js +72 -0
- package/build/commands/orchestration/workflow.d.ts +4 -0
- package/build/commands/orchestration/workflow.d.ts.map +1 -0
- package/build/commands/orchestration/workflow.js +14 -0
- package/build/commands/revenueOrganization/allocation.d.ts +4 -0
- package/build/commands/revenueOrganization/allocation.d.ts.map +1 -0
- package/build/commands/revenueOrganization/allocation.js +45 -0
- package/build/commands/revenueOrganization/capacity.d.ts +4 -0
- package/build/commands/revenueOrganization/capacity.d.ts.map +1 -0
- package/build/commands/revenueOrganization/capacity.js +94 -0
- package/build/commands/revenueOrganization/index.d.ts +4 -0
- package/build/commands/revenueOrganization/index.d.ts.map +1 -0
- package/build/commands/revenueOrganization/index.js +13 -0
- package/build/commands/revenueOrganization/member.d.ts +4 -0
- package/build/commands/revenueOrganization/member.d.ts.map +1 -0
- package/build/commands/revenueOrganization/member.js +62 -0
- package/build/commands/revenueOrganization/territory.d.ts +4 -0
- package/build/commands/revenueOrganization/territory.d.ts.map +1 -0
- package/build/commands/revenueOrganization/territory.js +72 -0
- package/build/commands/runHandler.d.ts +4 -0
- package/build/commands/runHandler.d.ts.map +1 -0
- package/build/commands/runHandler.js +33 -0
- package/build/commands/segmentation/change.d.ts +4 -0
- package/build/commands/segmentation/change.d.ts.map +1 -0
- package/build/commands/segmentation/change.js +61 -0
- package/build/commands/segmentation/index.d.ts +4 -0
- package/build/commands/segmentation/index.d.ts.map +1 -0
- package/build/commands/segmentation/index.js +11 -0
- package/build/commands/segmentation/record.d.ts +4 -0
- package/build/commands/segmentation/record.d.ts.map +1 -0
- package/build/commands/segmentation/record.js +21 -0
- package/build/commands/segmentation/segment.d.ts +4 -0
- package/build/commands/segmentation/segment.d.ts.map +1 -0
- package/build/commands/segmentation/segment.js +130 -0
- package/build/commands/storage/column.d.ts +4 -0
- package/build/commands/storage/column.d.ts.map +1 -0
- package/build/commands/storage/column.js +84 -0
- package/build/commands/storage/dataset.d.ts +4 -0
- package/build/commands/storage/dataset.d.ts.map +1 -0
- package/build/commands/storage/dataset.js +20 -0
- package/build/commands/storage/index.d.ts +4 -0
- package/build/commands/storage/index.d.ts.map +1 -0
- package/build/commands/storage/index.js +17 -0
- package/build/commands/storage/model.d.ts +4 -0
- package/build/commands/storage/model.d.ts.map +1 -0
- package/build/commands/storage/model.js +141 -0
- package/build/commands/storage/record.d.ts +4 -0
- package/build/commands/storage/record.d.ts.map +1 -0
- package/build/commands/storage/record.js +15 -0
- package/build/commands/storage/relationship.d.ts +4 -0
- package/build/commands/storage/relationship.d.ts.map +1 -0
- package/build/commands/storage/relationship.js +27 -0
- package/build/commands/storage/run.d.ts +4 -0
- package/build/commands/storage/run.d.ts.map +1 -0
- package/build/commands/storage/run.js +42 -0
- package/build/commands/systemOfRecordIntegration/client.d.ts +4 -0
- package/build/commands/systemOfRecordIntegration/client.d.ts.map +1 -0
- package/build/commands/systemOfRecordIntegration/client.js +46 -0
- package/build/commands/systemOfRecordIntegration/index.d.ts +4 -0
- package/build/commands/systemOfRecordIntegration/index.d.ts.map +1 -0
- package/build/commands/systemOfRecordIntegration/index.js +11 -0
- package/build/commands/systemOfRecordIntegration/log.d.ts +4 -0
- package/build/commands/systemOfRecordIntegration/log.d.ts.map +1 -0
- package/build/commands/systemOfRecordIntegration/log.js +36 -0
- package/build/commands/systemOfRecordIntegration/systemOfRecord.d.ts +4 -0
- package/build/commands/systemOfRecordIntegration/systemOfRecord.d.ts.map +1 -0
- package/build/commands/systemOfRecordIntegration/systemOfRecord.js +72 -0
- package/build/commands/userManagement/index.d.ts +4 -0
- package/build/commands/userManagement/index.d.ts.map +1 -0
- package/build/commands/userManagement/index.js +32 -0
- package/build/commands/workspace/file.d.ts +4 -0
- package/build/commands/workspace/file.d.ts.map +1 -0
- package/build/commands/workspace/file.js +44 -0
- package/build/commands/workspace/folder.d.ts +4 -0
- package/build/commands/workspace/folder.d.ts.map +1 -0
- package/build/commands/workspace/folder.js +64 -0
- package/build/commands/workspace/index.d.ts +4 -0
- package/build/commands/workspace/index.d.ts.map +1 -0
- package/build/commands/workspace/index.js +17 -0
- package/build/commands/workspace/role.d.ts +4 -0
- package/build/commands/workspace/role.d.ts.map +1 -0
- package/build/commands/workspace/role.js +12 -0
- package/build/commands/workspace/token.d.ts +4 -0
- package/build/commands/workspace/token.d.ts.map +1 -0
- package/build/commands/workspace/token.js +31 -0
- package/build/commands/workspace/user.d.ts +4 -0
- package/build/commands/workspace/user.d.ts.map +1 -0
- package/build/commands/workspace/user.js +105 -0
- package/build/commands/workspace/workspaces.d.ts +4 -0
- package/build/commands/workspace/workspaces.d.ts.map +1 -0
- package/build/commands/workspace/workspaces.js +74 -0
- package/build/config.d.ts +7 -0
- package/build/config.d.ts.map +1 -0
- package/build/config.js +45 -0
- package/build/credentials.d.ts +10 -0
- package/build/credentials.d.ts.map +1 -0
- package/build/credentials.js +31 -0
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +37 -0
- package/package.json +44 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
|
|
2
|
+
export function registerCapacityCommands(parent, getApi) {
|
|
3
|
+
const capacity = parent
|
|
4
|
+
.command("capacity")
|
|
5
|
+
.description("Capacity operations");
|
|
6
|
+
capacity
|
|
7
|
+
.command("list")
|
|
8
|
+
.description("List all capacities")
|
|
9
|
+
.action(async () => {
|
|
10
|
+
const api = getApi();
|
|
11
|
+
const result = await handleApiCall(() => api.revenueOrganization.capacity.all());
|
|
12
|
+
outputJson(result);
|
|
13
|
+
});
|
|
14
|
+
capacity
|
|
15
|
+
.command("get <uuid>")
|
|
16
|
+
.description("Get capacity by UUID")
|
|
17
|
+
.action(async (uuid) => {
|
|
18
|
+
const api = getApi();
|
|
19
|
+
const result = await handleApiCall(() => api.revenueOrganization.capacity.get(uuid));
|
|
20
|
+
outputJson(result);
|
|
21
|
+
});
|
|
22
|
+
capacity
|
|
23
|
+
.command("create")
|
|
24
|
+
.description("Create a capacity")
|
|
25
|
+
.requiredOption("--name <name>", "Capacity name")
|
|
26
|
+
.requiredOption("--color <color>", "Capacity color")
|
|
27
|
+
.option("--description <text>", "Description")
|
|
28
|
+
.option("--model-uuid <uuid>", "Model UUID")
|
|
29
|
+
.option("--id-column-slug <slug>", "ID column slug")
|
|
30
|
+
.option("--time-column-slug <slug>", "Time column slug")
|
|
31
|
+
.option("--member-capacity <n>", "Member capacity")
|
|
32
|
+
.option("--allocation-expiration-policy <policy>", "Allocation expiration policy")
|
|
33
|
+
.option("--filter <json>", 'Filter (JSON, e.g. {"conjonction":"and","groups":[]})')
|
|
34
|
+
.action(async (opts) => {
|
|
35
|
+
const api = getApi();
|
|
36
|
+
const result = await handleApiCall(() => api.revenueOrganization.capacity.create({
|
|
37
|
+
name: opts.name,
|
|
38
|
+
color: opts.color,
|
|
39
|
+
description: opts.description,
|
|
40
|
+
modelUuid: opts.modelUuid,
|
|
41
|
+
idColumnSlug: opts.idColumnSlug,
|
|
42
|
+
timeColumnSlug: opts.timeColumnSlug,
|
|
43
|
+
memberCapacity: opts.memberCapacity !== undefined
|
|
44
|
+
? parseInt(opts.memberCapacity, 10)
|
|
45
|
+
: undefined,
|
|
46
|
+
allocationExpirationPolicy: opts.allocationExpirationPolicy,
|
|
47
|
+
filter: opts.filter !== undefined
|
|
48
|
+
? parseJson(opts.filter, "--filter")
|
|
49
|
+
: undefined,
|
|
50
|
+
}));
|
|
51
|
+
outputJson(result);
|
|
52
|
+
});
|
|
53
|
+
capacity
|
|
54
|
+
.command("remove <uuid>")
|
|
55
|
+
.description("Remove a capacity")
|
|
56
|
+
.action(async (uuid) => {
|
|
57
|
+
const api = getApi();
|
|
58
|
+
await handleApiCall(() => api.revenueOrganization.capacity.remove(uuid));
|
|
59
|
+
outputJson({ ok: true });
|
|
60
|
+
});
|
|
61
|
+
capacity
|
|
62
|
+
.command("update")
|
|
63
|
+
.description("Update a capacity")
|
|
64
|
+
.requiredOption("--uuid <uuid>", "Capacity UUID")
|
|
65
|
+
.option("--filter <json>", 'Filter (JSON, use null to clear, e.g. {"conjonction":"and","groups":[]})')
|
|
66
|
+
.option("--name <name>", "Capacity name")
|
|
67
|
+
.option("--color <color>", "Capacity color")
|
|
68
|
+
.option("--description <text>", "Description")
|
|
69
|
+
.option("--member-capacity <n>", "Member capacity")
|
|
70
|
+
.option("--model-uuid <uuid>", "Model UUID")
|
|
71
|
+
.option("--id-column-slug <slug>", "ID column slug")
|
|
72
|
+
.option("--time-column-slug <slug>", "Time column slug")
|
|
73
|
+
.option("--allocation-expiration-policy <policy>", "Allocation expiration policy")
|
|
74
|
+
.action(async (opts) => {
|
|
75
|
+
const api = getApi();
|
|
76
|
+
const result = await handleApiCall(() => api.revenueOrganization.capacity.update({
|
|
77
|
+
uuid: opts.uuid,
|
|
78
|
+
filter: opts.filter !== undefined
|
|
79
|
+
? parseJson(opts.filter, "--filter")
|
|
80
|
+
: undefined,
|
|
81
|
+
name: opts.name,
|
|
82
|
+
color: opts.color,
|
|
83
|
+
description: opts.description,
|
|
84
|
+
memberCapacity: opts.memberCapacity !== undefined
|
|
85
|
+
? parseInt(opts.memberCapacity, 10)
|
|
86
|
+
: undefined,
|
|
87
|
+
modelUuid: opts.modelUuid,
|
|
88
|
+
idColumnSlug: opts.idColumnSlug,
|
|
89
|
+
timeColumnSlug: opts.timeColumnSlug,
|
|
90
|
+
allocationExpirationPolicy: opts.allocationExpirationPolicy,
|
|
91
|
+
}));
|
|
92
|
+
outputJson(result);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/revenueOrganization/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAMxC,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CASN"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { registerAllocationCommands } from "./allocation.js";
|
|
2
|
+
import { registerCapacityCommands } from "./capacity.js";
|
|
3
|
+
import { registerMemberCommands } from "./member.js";
|
|
4
|
+
import { registerTerritoryCommands } from "./territory.js";
|
|
5
|
+
export function registerRevenueOrganizationCommands(parent, getApi) {
|
|
6
|
+
const revenueOrg = parent
|
|
7
|
+
.command("revenue-organization")
|
|
8
|
+
.description("Allocations, capacities, members, territories");
|
|
9
|
+
registerAllocationCommands(revenueOrg, getApi);
|
|
10
|
+
registerCapacityCommands(revenueOrg, getApi);
|
|
11
|
+
registerMemberCommands(revenueOrg, getApi);
|
|
12
|
+
registerTerritoryCommands(revenueOrg, getApi);
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member.d.ts","sourceRoot":"","sources":["../../../src/commands/revenueOrganization/member.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CA8EN"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
|
|
2
|
+
export function registerMemberCommands(parent, getApi) {
|
|
3
|
+
const member = parent.command("member").description("Member operations");
|
|
4
|
+
member
|
|
5
|
+
.command("list")
|
|
6
|
+
.description("List all members")
|
|
7
|
+
.action(async () => {
|
|
8
|
+
const api = getApi();
|
|
9
|
+
const result = await handleApiCall(() => api.revenueOrganization.member.all());
|
|
10
|
+
outputJson(result);
|
|
11
|
+
});
|
|
12
|
+
member
|
|
13
|
+
.command("get <uuid>")
|
|
14
|
+
.description("Get member by UUID")
|
|
15
|
+
.action(async (uuid) => {
|
|
16
|
+
const api = getApi();
|
|
17
|
+
const result = await handleApiCall(() => api.revenueOrganization.member.get(uuid));
|
|
18
|
+
outputJson(result);
|
|
19
|
+
});
|
|
20
|
+
member
|
|
21
|
+
.command("sync")
|
|
22
|
+
.description("Sync members")
|
|
23
|
+
.option("--connector-uuid <uuid>", "Connector UUID")
|
|
24
|
+
.action(async (opts) => {
|
|
25
|
+
const api = getApi();
|
|
26
|
+
const result = await handleApiCall(() => api.revenueOrganization.member.sync({
|
|
27
|
+
connectorUuid: opts.connectorUuid,
|
|
28
|
+
}));
|
|
29
|
+
outputJson(result);
|
|
30
|
+
});
|
|
31
|
+
member
|
|
32
|
+
.command("archive <uuid>")
|
|
33
|
+
.description("Archive a member")
|
|
34
|
+
.action(async (uuid) => {
|
|
35
|
+
const api = getApi();
|
|
36
|
+
await handleApiCall(() => api.revenueOrganization.member.archive(uuid));
|
|
37
|
+
outputJson({ ok: true });
|
|
38
|
+
});
|
|
39
|
+
member
|
|
40
|
+
.command("unarchive <uuid>")
|
|
41
|
+
.description("Unarchive a member")
|
|
42
|
+
.action(async (uuid) => {
|
|
43
|
+
const api = getApi();
|
|
44
|
+
await handleApiCall(() => api.revenueOrganization.member.unarchive(uuid));
|
|
45
|
+
outputJson({ ok: true });
|
|
46
|
+
});
|
|
47
|
+
member
|
|
48
|
+
.command("update")
|
|
49
|
+
.description("Update a member")
|
|
50
|
+
.requiredOption("--uuid <uuid>", "Member UUID")
|
|
51
|
+
.option("--meta <json>", 'Member metadata (JSON object, e.g. {"key":"value"})')
|
|
52
|
+
.action(async (opts) => {
|
|
53
|
+
const api = getApi();
|
|
54
|
+
const result = await handleApiCall(() => api.revenueOrganization.member.update({
|
|
55
|
+
uuid: opts.uuid,
|
|
56
|
+
meta: opts.meta !== undefined
|
|
57
|
+
? parseJson(opts.meta, "--meta")
|
|
58
|
+
: undefined,
|
|
59
|
+
}));
|
|
60
|
+
outputJson(result);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"territory.d.ts","sourceRoot":"","sources":["../../../src/commands/revenueOrganization/territory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAkHN"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
|
|
2
|
+
export function registerTerritoryCommands(parent, getApi) {
|
|
3
|
+
const territory = parent
|
|
4
|
+
.command("territory")
|
|
5
|
+
.description("Territory operations");
|
|
6
|
+
territory
|
|
7
|
+
.command("list")
|
|
8
|
+
.description("List all territories")
|
|
9
|
+
.action(async () => {
|
|
10
|
+
const api = getApi();
|
|
11
|
+
const result = await handleApiCall(() => api.revenueOrganization.territory.all());
|
|
12
|
+
outputJson(result);
|
|
13
|
+
});
|
|
14
|
+
territory
|
|
15
|
+
.command("get <uuid>")
|
|
16
|
+
.description("Get territory by UUID")
|
|
17
|
+
.action(async (uuid) => {
|
|
18
|
+
const api = getApi();
|
|
19
|
+
const result = await handleApiCall(() => api.revenueOrganization.territory.get(uuid));
|
|
20
|
+
outputJson(result);
|
|
21
|
+
});
|
|
22
|
+
territory
|
|
23
|
+
.command("create")
|
|
24
|
+
.description("Create a territory")
|
|
25
|
+
.requiredOption("--label <label>", "Territory label")
|
|
26
|
+
.requiredOption("--color <color>", "Territory color (orange, red, purple, ...)")
|
|
27
|
+
.requiredOption("--members <json>", 'Members (JSON array, e.g. [{"userUuid":"...","role":"owner"}])')
|
|
28
|
+
.option("--description <text>", "Territory description")
|
|
29
|
+
.option("--fallback-member-uuid <uuid>", "Fallback member UUID")
|
|
30
|
+
.action(async (opts) => {
|
|
31
|
+
const api = getApi();
|
|
32
|
+
const result = await handleApiCall(() => api.revenueOrganization.territory.create({
|
|
33
|
+
label: opts.label,
|
|
34
|
+
color: opts.color,
|
|
35
|
+
members: parseJson(opts.members, "--members"),
|
|
36
|
+
description: opts.description,
|
|
37
|
+
fallbackMemberUuid: opts.fallbackMemberUuid,
|
|
38
|
+
}));
|
|
39
|
+
outputJson(result);
|
|
40
|
+
});
|
|
41
|
+
territory
|
|
42
|
+
.command("remove <uuid>")
|
|
43
|
+
.description("Remove a territory")
|
|
44
|
+
.action(async (uuid) => {
|
|
45
|
+
const api = getApi();
|
|
46
|
+
await handleApiCall(() => api.revenueOrganization.territory.remove(uuid));
|
|
47
|
+
outputJson({ ok: true });
|
|
48
|
+
});
|
|
49
|
+
territory
|
|
50
|
+
.command("update")
|
|
51
|
+
.description("Update a territory")
|
|
52
|
+
.requiredOption("--uuid <uuid>", "Territory UUID")
|
|
53
|
+
.option("--label <label>", "Territory label")
|
|
54
|
+
.option("--color <color>", "Territory color (orange, red, purple, ...)")
|
|
55
|
+
.option("--description <text>", "Territory description")
|
|
56
|
+
.option("--members <json>", 'Members (JSON array, e.g. [{"userUuid":"...","role":"owner"}])')
|
|
57
|
+
.option("--fallback-member-uuid <uuid>", "Fallback member UUID")
|
|
58
|
+
.action(async (opts) => {
|
|
59
|
+
const api = getApi();
|
|
60
|
+
const result = await handleApiCall(() => api.revenueOrganization.territory.update({
|
|
61
|
+
uuid: opts.uuid,
|
|
62
|
+
label: opts.label,
|
|
63
|
+
color: opts.color,
|
|
64
|
+
description: opts.description,
|
|
65
|
+
members: opts.members !== undefined
|
|
66
|
+
? parseJson(opts.members, "--members")
|
|
67
|
+
: undefined,
|
|
68
|
+
fallbackMemberUuid: opts.fallbackMemberUuid,
|
|
69
|
+
}));
|
|
70
|
+
outputJson(result);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runHandler.d.ts","sourceRoot":"","sources":["../../src/commands/runHandler.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAE/C;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,GAAG,CAWhE;AAED,wBAAsB,aAAa,CAAC,CAAC,EACnC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,CAiBpB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { determineIfIsFetcherError } from "@cargo-ai/api";
|
|
2
|
+
export function outputJson(value) {
|
|
3
|
+
console.log(JSON.stringify(value, null, 2));
|
|
4
|
+
}
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
export function parseJson(value, optionName) {
|
|
7
|
+
try {
|
|
8
|
+
return JSON.parse(value);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
console.error(JSON.stringify({
|
|
12
|
+
error: `Invalid JSON for ${optionName}: ${value}`,
|
|
13
|
+
}));
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export async function handleApiCall(fn) {
|
|
18
|
+
try {
|
|
19
|
+
return await fn();
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
if (determineIfIsFetcherError(err)) {
|
|
23
|
+
const e = err;
|
|
24
|
+
console.error(JSON.stringify({
|
|
25
|
+
error: "API error",
|
|
26
|
+
status: e.status !== undefined ? e.status : "unknown",
|
|
27
|
+
body: e.body !== undefined ? e.body : String(err),
|
|
28
|
+
}));
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
throw err;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"change.d.ts","sourceRoot":"","sources":["../../../src/commands/segmentation/change.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAgGN"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { handleApiCall, outputJson } from "../runHandler.js";
|
|
2
|
+
export function registerChangeCommands(parent, getApi) {
|
|
3
|
+
const change = parent.command("change").description("Change operations");
|
|
4
|
+
change
|
|
5
|
+
.command("list")
|
|
6
|
+
.description("List changes")
|
|
7
|
+
.option("--segment-uuid <uuid>", "Segment UUID")
|
|
8
|
+
.option("--not-empty", "Only non-empty changes")
|
|
9
|
+
.option("--has-records <kind>", "Has records of kind")
|
|
10
|
+
.option("--limit <n>", "Limit")
|
|
11
|
+
.option("--offset <n>", "Offset")
|
|
12
|
+
.action(async (opts) => {
|
|
13
|
+
const api = getApi();
|
|
14
|
+
const result = await handleApiCall(() => api.segmentation.change.list({
|
|
15
|
+
segmentUuid: opts.segmentUuid,
|
|
16
|
+
notEmpty: opts.notEmpty,
|
|
17
|
+
hasRecords: opts.hasRecords,
|
|
18
|
+
limit: opts.limit !== undefined ? parseInt(opts.limit, 10) : undefined,
|
|
19
|
+
offset: opts.offset !== undefined ? parseInt(opts.offset, 10) : undefined,
|
|
20
|
+
}));
|
|
21
|
+
outputJson(result);
|
|
22
|
+
});
|
|
23
|
+
change
|
|
24
|
+
.command("get <uuid>")
|
|
25
|
+
.description("Get a change by UUID")
|
|
26
|
+
.action(async (uuid) => {
|
|
27
|
+
const api = getApi();
|
|
28
|
+
const result = await handleApiCall(() => api.segmentation.change.get(uuid));
|
|
29
|
+
outputJson(result);
|
|
30
|
+
});
|
|
31
|
+
change
|
|
32
|
+
.command("download")
|
|
33
|
+
.description("Download change data")
|
|
34
|
+
.requiredOption("--uuid <uuid>", "Change UUID")
|
|
35
|
+
.requiredOption("--kinds <kinds>", "Change kinds (comma-separated)")
|
|
36
|
+
.action(async (opts) => {
|
|
37
|
+
const api = getApi();
|
|
38
|
+
const result = await handleApiCall(() => api.segmentation.change.download({
|
|
39
|
+
uuid: opts.uuid,
|
|
40
|
+
kinds: opts.kinds.split(",").map((s) => s.trim()),
|
|
41
|
+
}));
|
|
42
|
+
outputJson(result);
|
|
43
|
+
});
|
|
44
|
+
change
|
|
45
|
+
.command("fetch")
|
|
46
|
+
.description("Fetch change data")
|
|
47
|
+
.requiredOption("--uuid <uuid>", "Change UUID")
|
|
48
|
+
.requiredOption("--kinds <kinds>", "Change kinds (comma-separated)")
|
|
49
|
+
.option("--limit <n>", "Limit")
|
|
50
|
+
.option("--offset <n>", "Offset")
|
|
51
|
+
.action(async (opts) => {
|
|
52
|
+
const api = getApi();
|
|
53
|
+
const result = await handleApiCall(() => api.segmentation.change.fetch({
|
|
54
|
+
uuid: opts.uuid,
|
|
55
|
+
kinds: opts.kinds.split(",").map((s) => s.trim()),
|
|
56
|
+
limit: opts.limit !== undefined ? parseInt(opts.limit, 10) : undefined,
|
|
57
|
+
offset: opts.offset !== undefined ? parseInt(opts.offset, 10) : undefined,
|
|
58
|
+
}));
|
|
59
|
+
outputJson(result);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/segmentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAKxC,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAQN"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { registerChangeCommands } from "./change.js";
|
|
2
|
+
import { registerRecordCommands } from "./record.js";
|
|
3
|
+
import { registerSegmentCommands } from "./segment.js";
|
|
4
|
+
export function registerSegmentationCommands(parent, getApi) {
|
|
5
|
+
const segmentation = parent
|
|
6
|
+
.command("segmentation")
|
|
7
|
+
.description("Segments and changes");
|
|
8
|
+
registerSegmentCommands(segmentation, getApi);
|
|
9
|
+
registerChangeCommands(segmentation, getApi);
|
|
10
|
+
registerRecordCommands(segmentation, getApi);
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../../src/commands/segmentation/record.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CA4BN"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { handleApiCall, outputJson } from "../runHandler.js";
|
|
2
|
+
export function registerRecordCommands(parent, getApi) {
|
|
3
|
+
const record = parent
|
|
4
|
+
.command("record")
|
|
5
|
+
.description("Segmentation record operations");
|
|
6
|
+
record
|
|
7
|
+
.command("fetch")
|
|
8
|
+
.description("Fetch segmentation records")
|
|
9
|
+
.requiredOption("--model-uuid <uuid>", "Model UUID")
|
|
10
|
+
.requiredOption("--ids <ids>", "Record IDs (comma-separated)")
|
|
11
|
+
.option("--reset-cache", "Reset cache")
|
|
12
|
+
.action(async (opts) => {
|
|
13
|
+
const api = getApi();
|
|
14
|
+
const result = await handleApiCall(() => api.segmentation.record.fetch({
|
|
15
|
+
modelUuid: opts.modelUuid,
|
|
16
|
+
ids: opts.ids.split(",").map((s) => s.trim()),
|
|
17
|
+
resetCache: opts.resetCache,
|
|
18
|
+
}));
|
|
19
|
+
outputJson(result);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment.d.ts","sourceRoot":"","sources":["../../../src/commands/segmentation/segment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAgON"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
|
|
2
|
+
export function registerSegmentCommands(parent, getApi) {
|
|
3
|
+
const segment = parent.command("segment").description("Segment operations");
|
|
4
|
+
segment
|
|
5
|
+
.command("list")
|
|
6
|
+
.description("List all segments")
|
|
7
|
+
.action(async () => {
|
|
8
|
+
const api = getApi();
|
|
9
|
+
const result = await handleApiCall(() => api.segmentation.segment.all());
|
|
10
|
+
outputJson(result);
|
|
11
|
+
});
|
|
12
|
+
segment
|
|
13
|
+
.command("get <uuid>")
|
|
14
|
+
.description("Get a segment by UUID")
|
|
15
|
+
.action(async (uuid) => {
|
|
16
|
+
const api = getApi();
|
|
17
|
+
const result = await handleApiCall(() => api.segmentation.segment.get(uuid));
|
|
18
|
+
outputJson(result);
|
|
19
|
+
});
|
|
20
|
+
segment
|
|
21
|
+
.command("create")
|
|
22
|
+
.description("Create a segment")
|
|
23
|
+
.requiredOption("--name <name>", "Segment name")
|
|
24
|
+
.requiredOption("--model-uuid <uuid>", "Model UUID")
|
|
25
|
+
.requiredOption("--filter <json>", 'Filter (JSON, e.g. {"conjonction":"and","groups":[{"conjonction":"and","conditions":[]}]})')
|
|
26
|
+
.option("--sort <json>", 'Sort (JSON, e.g. {"slug":"created_at","order":"desc"})')
|
|
27
|
+
.option("--limit <n>", "Limit")
|
|
28
|
+
.option("--tracking-column-slugs <slugs>", "Tracking column slugs (comma-separated)")
|
|
29
|
+
.action(async (opts) => {
|
|
30
|
+
const api = getApi();
|
|
31
|
+
const result = await handleApiCall(() => api.segmentation.segment.create({
|
|
32
|
+
name: opts.name,
|
|
33
|
+
modelUuid: opts.modelUuid,
|
|
34
|
+
filter: parseJson(opts.filter, "--filter"),
|
|
35
|
+
sort: opts.sort !== undefined
|
|
36
|
+
? parseJson(opts.sort, "--sort")
|
|
37
|
+
: undefined,
|
|
38
|
+
limit: opts.limit !== undefined ? parseInt(opts.limit, 10) : undefined,
|
|
39
|
+
trackingColumnSlugs: opts.trackingColumnSlugs !== undefined
|
|
40
|
+
? opts.trackingColumnSlugs.split(",").map((s) => s.trim())
|
|
41
|
+
: undefined,
|
|
42
|
+
}));
|
|
43
|
+
outputJson(result);
|
|
44
|
+
});
|
|
45
|
+
segment
|
|
46
|
+
.command("download")
|
|
47
|
+
.description("Download segment data")
|
|
48
|
+
.requiredOption("--model-uuid <uuid>", "Model UUID")
|
|
49
|
+
.requiredOption("--filter <json>", 'Filter (JSON, e.g. {"conjonction":"and","groups":[{"conjonction":"and","conditions":[]}]})')
|
|
50
|
+
.option("--sort <json>", 'Sort (JSON, e.g. {"slug":"created_at","order":"desc"})')
|
|
51
|
+
.option("--limit <n>", "Limit")
|
|
52
|
+
.action(async (opts) => {
|
|
53
|
+
const api = getApi();
|
|
54
|
+
const result = await handleApiCall(() => api.segmentation.segment.download({
|
|
55
|
+
modelUuid: opts.modelUuid,
|
|
56
|
+
filter: parseJson(opts.filter, "--filter"),
|
|
57
|
+
sort: opts.sort !== undefined
|
|
58
|
+
? parseJson(opts.sort, "--sort")
|
|
59
|
+
: undefined,
|
|
60
|
+
limit: opts.limit !== undefined ? parseInt(opts.limit, 10) : undefined,
|
|
61
|
+
}));
|
|
62
|
+
outputJson(result);
|
|
63
|
+
});
|
|
64
|
+
segment
|
|
65
|
+
.command("fetch")
|
|
66
|
+
.description("Fetch segment data")
|
|
67
|
+
.requiredOption("--model-uuid <uuid>", "Model UUID")
|
|
68
|
+
.requiredOption("--filter <json>", 'Filter (JSON, e.g. {"conjonction":"and","groups":[{"conjonction":"and","conditions":[]}]})')
|
|
69
|
+
.option("--sort <json>", 'Sort (JSON, e.g. {"slug":"created_at","order":"desc"})')
|
|
70
|
+
.option("--limit <n>", "Limit")
|
|
71
|
+
.option("--fetching-limit <n>", "Fetching limit")
|
|
72
|
+
.option("--fetching-offset <n>", "Fetching offset")
|
|
73
|
+
.option("--enrich", "Enrich records")
|
|
74
|
+
.option("--sync", "Sync before fetching")
|
|
75
|
+
.action(async (opts) => {
|
|
76
|
+
const api = getApi();
|
|
77
|
+
const result = await handleApiCall(() => api.segmentation.segment.fetch({
|
|
78
|
+
modelUuid: opts.modelUuid,
|
|
79
|
+
filter: parseJson(opts.filter, "--filter"),
|
|
80
|
+
sort: opts.sort !== undefined
|
|
81
|
+
? parseJson(opts.sort, "--sort")
|
|
82
|
+
: undefined,
|
|
83
|
+
limit: opts.limit !== undefined ? parseInt(opts.limit, 10) : undefined,
|
|
84
|
+
fetchingLimit: opts.fetchingLimit !== undefined
|
|
85
|
+
? parseInt(opts.fetchingLimit, 10)
|
|
86
|
+
: undefined,
|
|
87
|
+
fetchingOffset: opts.fetchingOffset !== undefined
|
|
88
|
+
? parseInt(opts.fetchingOffset, 10)
|
|
89
|
+
: undefined,
|
|
90
|
+
enrich: opts.enrich,
|
|
91
|
+
sync: opts.sync,
|
|
92
|
+
}));
|
|
93
|
+
outputJson(result);
|
|
94
|
+
});
|
|
95
|
+
segment
|
|
96
|
+
.command("remove <uuid>")
|
|
97
|
+
.description("Remove a segment")
|
|
98
|
+
.action(async (uuid) => {
|
|
99
|
+
const api = getApi();
|
|
100
|
+
await handleApiCall(() => api.segmentation.segment.remove(uuid));
|
|
101
|
+
outputJson({ ok: true });
|
|
102
|
+
});
|
|
103
|
+
segment
|
|
104
|
+
.command("update")
|
|
105
|
+
.description("Update a segment")
|
|
106
|
+
.requiredOption("--uuid <uuid>", "Segment UUID")
|
|
107
|
+
.option("--name <name>", "Segment name")
|
|
108
|
+
.option("--filter <json>", 'Filter (JSON, e.g. {"conjonction":"and","groups":[{"conjonction":"and","conditions":[]}]})')
|
|
109
|
+
.option("--sort <json>", 'Sort (JSON, e.g. {"slug":"created_at","order":"desc"})')
|
|
110
|
+
.option("--limit <n>", "Limit")
|
|
111
|
+
.option("--tracking-column-slugs <slugs>", "Tracking column slugs (comma-separated)")
|
|
112
|
+
.action(async (opts) => {
|
|
113
|
+
const api = getApi();
|
|
114
|
+
const result = await handleApiCall(() => api.segmentation.segment.update({
|
|
115
|
+
uuid: opts.uuid,
|
|
116
|
+
name: opts.name,
|
|
117
|
+
filter: opts.filter !== undefined
|
|
118
|
+
? parseJson(opts.filter, "--filter")
|
|
119
|
+
: undefined,
|
|
120
|
+
sort: opts.sort !== undefined
|
|
121
|
+
? parseJson(opts.sort, "--sort")
|
|
122
|
+
: undefined,
|
|
123
|
+
limit: opts.limit !== undefined ? parseInt(opts.limit, 10) : undefined,
|
|
124
|
+
trackingColumnSlugs: opts.trackingColumnSlugs !== undefined
|
|
125
|
+
? opts.trackingColumnSlugs.split(",").map((s) => s.trim())
|
|
126
|
+
: undefined,
|
|
127
|
+
}));
|
|
128
|
+
outputJson(result);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column.d.ts","sourceRoot":"","sources":["../../../src/commands/storage/column.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAmHN"}
|