@lightdash-tools/cli 0.6.0 → 0.8.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/README.md +8 -4
- package/dist/commands/agentops/apply.d.ts +5 -0
- package/dist/commands/agentops/apply.js +53 -0
- package/dist/commands/agentops/bundle-schema.d.ts +5 -0
- package/dist/commands/agentops/bundle-schema.js +16 -0
- package/dist/commands/agentops/drift.d.ts +5 -0
- package/dist/commands/agentops/drift.js +46 -0
- package/dist/commands/agentops/evaluate-gate.d.ts +5 -0
- package/dist/commands/agentops/evaluate-gate.js +89 -0
- package/dist/commands/agentops/gate-schema.d.ts +5 -0
- package/dist/commands/agentops/gate-schema.js +16 -0
- package/dist/commands/agentops/plan.d.ts +5 -0
- package/dist/commands/agentops/plan.js +42 -0
- package/dist/commands/agentops/state.d.ts +4 -0
- package/dist/commands/agentops/state.js +8 -0
- package/dist/commands/agentops.d.ts +8 -0
- package/dist/commands/agentops.js +26 -0
- package/dist/commands/agentops.test.d.ts +1 -0
- package/dist/commands/agentops.test.js +400 -0
- package/dist/commands/agents-crud.d.ts +8 -0
- package/dist/commands/agents-crud.js +144 -0
- package/dist/commands/agents-discovery.d.ts +8 -0
- package/dist/commands/agents-discovery.js +139 -0
- package/dist/commands/agents-discovery.test.d.ts +1 -0
- package/dist/commands/agents-discovery.test.js +13 -0
- package/dist/commands/agents-evals.d.ts +8 -0
- package/dist/commands/agents-evals.js +246 -0
- package/dist/commands/agents-threads.d.ts +8 -0
- package/dist/commands/agents-threads.js +83 -0
- package/dist/commands/agents.js +8 -360
- package/dist/commands/ai-agents.js +52 -70
- package/dist/commands/charts.js +35 -46
- package/dist/commands/content.js +3 -12
- package/dist/commands/dashboards.js +3 -12
- package/dist/commands/explores.js +12 -21
- package/dist/commands/groups.js +44 -63
- package/dist/commands/metrics.js +6 -15
- package/dist/commands/organization-roles.js +28 -39
- package/dist/commands/organization.js +3 -12
- package/dist/commands/project-access.js +9 -18
- package/dist/commands/project-role-assignments.js +15 -24
- package/dist/commands/projects.js +33 -26
- package/dist/commands/query.js +30 -41
- package/dist/commands/schedulers.js +6 -15
- package/dist/commands/schema.d.ts +1 -2
- package/dist/commands/schema.js +24 -97
- package/dist/commands/schema.test.js +80 -15
- package/dist/commands/space-access.js +12 -21
- package/dist/commands/spaces.js +6 -15
- package/dist/commands/tags.js +6 -15
- package/dist/commands/users.js +23 -41
- package/dist/index.js +18 -16
- package/dist/index.test.js +9 -9
- package/dist/utils/cli-params.d.ts +4 -0
- package/dist/utils/cli-params.js +15 -0
- package/dist/utils/cli-params.test.d.ts +1 -0
- package/dist/utils/cli-params.test.js +12 -0
- package/dist/utils/file-input.d.ts +30 -0
- package/dist/utils/file-input.js +77 -0
- package/dist/utils/file-input.test.d.ts +1 -0
- package/dist/utils/file-input.test.js +68 -0
- package/dist/utils/safety.d.ts +5 -0
- package/dist/utils/safety.js +97 -109
- package/dist/utils/safety.test.js +135 -33
- package/package.json +14 -5
- package/src/commands/agentops/apply.ts +77 -0
- package/src/commands/agentops/bundle-schema.ts +20 -0
- package/src/commands/agentops/drift.ts +63 -0
- package/src/commands/agentops/evaluate-gate.ts +128 -0
- package/src/commands/agentops/gate-schema.ts +20 -0
- package/src/commands/agentops/plan.ts +55 -0
- package/src/commands/agentops/state.ts +5 -0
- package/src/commands/agentops.test.ts +454 -0
- package/src/commands/agentops.ts +28 -0
- package/src/commands/agents-crud.ts +193 -0
- package/src/commands/agents-discovery.test.ts +16 -0
- package/src/commands/agents-discovery.ts +180 -0
- package/src/commands/agents-evals.ts +353 -0
- package/src/commands/agents-threads.ts +116 -0
- package/src/commands/agents.ts +9 -493
- package/src/commands/ai-agents.ts +37 -28
- package/src/commands/charts.ts +6 -3
- package/src/commands/content.ts +3 -1
- package/src/commands/dashboards.ts +3 -1
- package/src/commands/explores.ts +3 -1
- package/src/commands/groups.ts +33 -33
- package/src/commands/metrics.ts +3 -1
- package/src/commands/organization-roles.ts +3 -1
- package/src/commands/organization.ts +3 -1
- package/src/commands/project-access.ts +3 -1
- package/src/commands/project-role-assignments.ts +3 -1
- package/src/commands/projects.ts +44 -18
- package/src/commands/query.ts +4 -1
- package/src/commands/schedulers.ts +3 -1
- package/src/commands/schema.test.ts +95 -16
- package/src/commands/schema.ts +42 -99
- package/src/commands/space-access.ts +3 -1
- package/src/commands/spaces.ts +3 -1
- package/src/commands/tags.ts +3 -1
- package/src/commands/users.ts +29 -25
- package/src/index.test.ts +10 -9
- package/src/index.ts +19 -16
- package/src/utils/cli-params.test.ts +13 -0
- package/src/utils/cli-params.ts +12 -0
- package/src/utils/client.test.ts +1 -0
- package/src/utils/file-input.test.ts +91 -0
- package/src/utils/file-input.ts +83 -0
- package/src/utils/safety.test.ts +158 -2
- package/src/utils/safety.ts +27 -20
- package/tsconfig.json +2 -1
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Organization roles (v2) command implementation.
|
|
4
4
|
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
6
|
exports.registerOrganizationRolesCommand = registerOrganizationRolesCommand;
|
|
16
7
|
const common_1 = require("@lightdash-tools/common");
|
|
@@ -31,71 +22,69 @@ function registerOrganizationRolesCommand(program) {
|
|
|
31
22
|
.description('List organization roles')
|
|
32
23
|
.option('--load <value>', 'Load query param')
|
|
33
24
|
.option('--role-type-filter <value>', 'Filter by role type')
|
|
34
|
-
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, function () {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
});
|
|
25
|
+
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async function () {
|
|
26
|
+
const options = this.opts();
|
|
27
|
+
try {
|
|
28
|
+
const client = (0, client_1.getClient)();
|
|
29
|
+
const org = await client.v1.organizations.getCurrentOrganization();
|
|
30
|
+
const orgUuid = org.organizationUuid;
|
|
31
|
+
const params = options.load != null || options.roleTypeFilter != null
|
|
32
|
+
? { load: options.load, roleTypeFilter: options.roleTypeFilter }
|
|
33
|
+
: undefined;
|
|
34
|
+
const result = await client.v2.organizationRoles.getRoles(orgUuid, params);
|
|
35
|
+
console.log(JSON.stringify(result, null, 2));
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error('Error listing organization roles:', error instanceof Error ? error.message : String(error));
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
52
41
|
}));
|
|
53
42
|
rolesCmd
|
|
54
43
|
.command('get <roleUuid>')
|
|
55
44
|
.description('Get an organization role by UUID')
|
|
56
|
-
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, (roleUuid) =>
|
|
45
|
+
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (roleUuid) => {
|
|
57
46
|
try {
|
|
58
47
|
const client = (0, client_1.getClient)();
|
|
59
|
-
const org =
|
|
48
|
+
const org = await client.v1.organizations.getCurrentOrganization();
|
|
60
49
|
const orgUuid = org.organizationUuid;
|
|
61
|
-
const role =
|
|
50
|
+
const role = await client.v2.organizationRoles.getRole(orgUuid, roleUuid);
|
|
62
51
|
console.log(JSON.stringify(role, null, 2));
|
|
63
52
|
}
|
|
64
53
|
catch (error) {
|
|
65
54
|
console.error('Error fetching organization role:', error instanceof Error ? error.message : String(error));
|
|
66
55
|
process.exit(1);
|
|
67
56
|
}
|
|
68
|
-
}))
|
|
57
|
+
}));
|
|
69
58
|
const assignmentsCmd = rolesCmd
|
|
70
59
|
.command('assignments')
|
|
71
60
|
.description('Organization role assignments');
|
|
72
61
|
assignmentsCmd
|
|
73
62
|
.command('list')
|
|
74
63
|
.description('List organization role assignments')
|
|
75
|
-
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, () =>
|
|
64
|
+
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async () => {
|
|
76
65
|
try {
|
|
77
66
|
const client = (0, client_1.getClient)();
|
|
78
|
-
const org =
|
|
67
|
+
const org = await client.v1.organizations.getCurrentOrganization();
|
|
79
68
|
const orgUuid = org.organizationUuid;
|
|
80
|
-
const result =
|
|
69
|
+
const result = await client.v2.organizationRoles.listRoleAssignments(orgUuid);
|
|
81
70
|
console.log(JSON.stringify(result, null, 2));
|
|
82
71
|
}
|
|
83
72
|
catch (error) {
|
|
84
73
|
console.error('Error listing role assignments:', error instanceof Error ? error.message : String(error));
|
|
85
74
|
process.exit(1);
|
|
86
75
|
}
|
|
87
|
-
}))
|
|
76
|
+
}));
|
|
88
77
|
rolesCmd
|
|
89
78
|
.command('assign <userUuid>')
|
|
90
79
|
.description('Assign an organization role to a user')
|
|
91
80
|
.requiredOption('--role-id <roleId>', 'Role ID to assign')
|
|
92
|
-
.action((0, safety_1.wrapAction)(common_1.WRITE_IDEMPOTENT, (userUuid, cmd) =>
|
|
81
|
+
.action((0, safety_1.wrapAction)(common_1.WRITE_IDEMPOTENT, async (userUuid, cmd) => {
|
|
93
82
|
const options = cmd.opts();
|
|
94
83
|
try {
|
|
95
84
|
const client = (0, client_1.getClient)();
|
|
96
|
-
const org =
|
|
85
|
+
const org = await client.v1.organizations.getCurrentOrganization();
|
|
97
86
|
const orgUuid = org.organizationUuid;
|
|
98
|
-
const result =
|
|
87
|
+
const result = await client.v2.organizationRoles.assignRoleToUser(orgUuid, userUuid, {
|
|
99
88
|
roleId: options.roleId,
|
|
100
89
|
});
|
|
101
90
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -104,5 +93,5 @@ function registerOrganizationRolesCommand(program) {
|
|
|
104
93
|
console.error('Error assigning role to user:', error instanceof Error ? error.message : String(error));
|
|
105
94
|
process.exit(1);
|
|
106
95
|
}
|
|
107
|
-
}))
|
|
96
|
+
}));
|
|
108
97
|
}
|
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Organization command implementation.
|
|
4
4
|
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
6
|
exports.registerOrganizationCommand = registerOrganizationCommand;
|
|
16
7
|
const common_1 = require("@lightdash-tools/common");
|
|
@@ -24,15 +15,15 @@ function registerOrganizationCommand(program) {
|
|
|
24
15
|
orgCmd
|
|
25
16
|
.command('get')
|
|
26
17
|
.description('Get current organization')
|
|
27
|
-
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, () =>
|
|
18
|
+
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async () => {
|
|
28
19
|
try {
|
|
29
20
|
const client = (0, client_1.getClient)();
|
|
30
|
-
const org =
|
|
21
|
+
const org = await client.v1.organizations.getCurrentOrganization();
|
|
31
22
|
console.log(JSON.stringify(org, null, 2));
|
|
32
23
|
}
|
|
33
24
|
catch (error) {
|
|
34
25
|
console.error('Error fetching organization:', error instanceof Error ? error.message : String(error));
|
|
35
26
|
process.exit(1);
|
|
36
27
|
}
|
|
37
|
-
}))
|
|
28
|
+
}));
|
|
38
29
|
}
|
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Project access (v1) command implementation.
|
|
4
4
|
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
6
|
exports.registerProjectAccessCommand = registerProjectAccessCommand;
|
|
16
7
|
const common_1 = require("@lightdash-tools/common");
|
|
@@ -28,44 +19,44 @@ function registerProjectAccessCommand(program) {
|
|
|
28
19
|
accessCmd
|
|
29
20
|
.command('list <projectUuid>')
|
|
30
21
|
.description('List users with project access')
|
|
31
|
-
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, (projectUuid) =>
|
|
22
|
+
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (projectUuid) => {
|
|
32
23
|
try {
|
|
33
24
|
const client = (0, client_1.getClient)();
|
|
34
|
-
const result =
|
|
25
|
+
const result = await client.v1.projectAccess.listProjectAccess(projectUuid);
|
|
35
26
|
console.log(JSON.stringify(result, null, 2));
|
|
36
27
|
}
|
|
37
28
|
catch (error) {
|
|
38
29
|
console.error('Error listing project access:', error instanceof Error ? error.message : String(error));
|
|
39
30
|
process.exit(1);
|
|
40
31
|
}
|
|
41
|
-
}))
|
|
32
|
+
}));
|
|
42
33
|
const groupsCmd = accessCmd.command('groups').description('Project group access');
|
|
43
34
|
groupsCmd
|
|
44
35
|
.command('list <projectUuid>')
|
|
45
36
|
.description('List group access for a project')
|
|
46
|
-
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, (projectUuid) =>
|
|
37
|
+
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (projectUuid) => {
|
|
47
38
|
try {
|
|
48
39
|
const client = (0, client_1.getClient)();
|
|
49
|
-
const result =
|
|
40
|
+
const result = await client.v1.projectAccess.listProjectGroupAccesses(projectUuid);
|
|
50
41
|
console.log(JSON.stringify(result, null, 2));
|
|
51
42
|
}
|
|
52
43
|
catch (error) {
|
|
53
44
|
console.error('Error listing project group access:', error instanceof Error ? error.message : String(error));
|
|
54
45
|
process.exit(1);
|
|
55
46
|
}
|
|
56
|
-
}))
|
|
47
|
+
}));
|
|
57
48
|
accessCmd
|
|
58
49
|
.command('get <projectUuid> <userUuid>')
|
|
59
50
|
.description('Get a project member access')
|
|
60
|
-
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, (projectUuid, userUuid) =>
|
|
51
|
+
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (projectUuid, userUuid) => {
|
|
61
52
|
try {
|
|
62
53
|
const client = (0, client_1.getClient)();
|
|
63
|
-
const result =
|
|
54
|
+
const result = await client.v1.projectAccess.getProjectMemberAccess(projectUuid, userUuid);
|
|
64
55
|
console.log(JSON.stringify(result, null, 2));
|
|
65
56
|
}
|
|
66
57
|
catch (error) {
|
|
67
58
|
console.error('Error fetching project member access:', error instanceof Error ? error.message : String(error));
|
|
68
59
|
process.exit(1);
|
|
69
60
|
}
|
|
70
|
-
}))
|
|
61
|
+
}));
|
|
71
62
|
}
|
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Project role assignments (v2) command implementation.
|
|
4
4
|
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
6
|
exports.registerProjectRoleAssignmentsCommand = registerProjectRoleAssignmentsCommand;
|
|
16
7
|
const common_1 = require("@lightdash-tools/common");
|
|
@@ -28,77 +19,77 @@ function registerProjectRoleAssignmentsCommand(program) {
|
|
|
28
19
|
rolesCmd
|
|
29
20
|
.command('list <projectUuid>')
|
|
30
21
|
.description('List project role assignments')
|
|
31
|
-
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, (projectUuid) =>
|
|
22
|
+
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (projectUuid) => {
|
|
32
23
|
try {
|
|
33
24
|
const client = (0, client_1.getClient)();
|
|
34
|
-
const result =
|
|
25
|
+
const result = await client.v2.projectRoleAssignments.listAssignments(projectUuid);
|
|
35
26
|
console.log(JSON.stringify(result, null, 2));
|
|
36
27
|
}
|
|
37
28
|
catch (error) {
|
|
38
29
|
console.error('Error listing project role assignments:', error instanceof Error ? error.message : String(error));
|
|
39
30
|
process.exit(1);
|
|
40
31
|
}
|
|
41
|
-
}))
|
|
32
|
+
}));
|
|
42
33
|
const assignCmd = rolesCmd.command('assign').description('Assign role to user or group');
|
|
43
34
|
assignCmd
|
|
44
35
|
.command('user <projectUuid> <userUuid>')
|
|
45
36
|
.description('Assign a role to a user in a project')
|
|
46
37
|
.requiredOption('--role-id <roleId>', 'Role ID to assign')
|
|
47
|
-
.action((0, safety_1.wrapAction)(common_1.WRITE_IDEMPOTENT, (projectUuid, userUuid, cmd) =>
|
|
38
|
+
.action((0, safety_1.wrapAction)(common_1.WRITE_IDEMPOTENT, async (projectUuid, userUuid, cmd) => {
|
|
48
39
|
const opts = cmd.opts();
|
|
49
40
|
try {
|
|
50
41
|
const client = (0, client_1.getClient)();
|
|
51
|
-
const result =
|
|
42
|
+
const result = await client.v2.projectRoleAssignments.upsertUserAssignment(projectUuid, userUuid, { roleId: opts.roleId });
|
|
52
43
|
console.log(JSON.stringify(result, null, 2));
|
|
53
44
|
}
|
|
54
45
|
catch (error) {
|
|
55
46
|
console.error('Error assigning role to user:', error instanceof Error ? error.message : String(error));
|
|
56
47
|
process.exit(1);
|
|
57
48
|
}
|
|
58
|
-
}))
|
|
49
|
+
}));
|
|
59
50
|
assignCmd
|
|
60
51
|
.command('group <projectUuid> <groupId>')
|
|
61
52
|
.description('Assign a role to a group in a project')
|
|
62
53
|
.requiredOption('--role-id <roleId>', 'Role ID to assign')
|
|
63
|
-
.action((0, safety_1.wrapAction)(common_1.WRITE_IDEMPOTENT, (projectUuid, groupId, cmd) =>
|
|
54
|
+
.action((0, safety_1.wrapAction)(common_1.WRITE_IDEMPOTENT, async (projectUuid, groupId, cmd) => {
|
|
64
55
|
const opts = cmd.opts();
|
|
65
56
|
try {
|
|
66
57
|
const client = (0, client_1.getClient)();
|
|
67
|
-
const result =
|
|
58
|
+
const result = await client.v2.projectRoleAssignments.upsertGroupAssignment(projectUuid, groupId, { roleId: opts.roleId });
|
|
68
59
|
console.log(JSON.stringify(result, null, 2));
|
|
69
60
|
}
|
|
70
61
|
catch (error) {
|
|
71
62
|
console.error('Error assigning role to group:', error instanceof Error ? error.message : String(error));
|
|
72
63
|
process.exit(1);
|
|
73
64
|
}
|
|
74
|
-
}))
|
|
65
|
+
}));
|
|
75
66
|
const unassignCmd = rolesCmd.command('unassign').description('Remove role assignment');
|
|
76
67
|
unassignCmd
|
|
77
68
|
.command('user <projectUuid> <userUuid>')
|
|
78
69
|
.description('Remove role assignment from a user')
|
|
79
|
-
.action((0, safety_1.wrapAction)(common_1.WRITE_DESTRUCTIVE, (projectUuid, userUuid) =>
|
|
70
|
+
.action((0, safety_1.wrapAction)(common_1.WRITE_DESTRUCTIVE, async (projectUuid, userUuid) => {
|
|
80
71
|
try {
|
|
81
72
|
const client = (0, client_1.getClient)();
|
|
82
|
-
|
|
73
|
+
await client.v2.projectRoleAssignments.deleteUserAssignment(projectUuid, userUuid);
|
|
83
74
|
console.log(JSON.stringify({ ok: true }, null, 2));
|
|
84
75
|
}
|
|
85
76
|
catch (error) {
|
|
86
77
|
console.error('Error removing user role assignment:', error instanceof Error ? error.message : String(error));
|
|
87
78
|
process.exit(1);
|
|
88
79
|
}
|
|
89
|
-
}))
|
|
80
|
+
}));
|
|
90
81
|
unassignCmd
|
|
91
82
|
.command('group <projectUuid> <groupId>')
|
|
92
83
|
.description('Remove role assignment from a group')
|
|
93
|
-
.action((0, safety_1.wrapAction)(common_1.WRITE_DESTRUCTIVE, (projectUuid, groupId) =>
|
|
84
|
+
.action((0, safety_1.wrapAction)(common_1.WRITE_DESTRUCTIVE, async (projectUuid, groupId) => {
|
|
94
85
|
try {
|
|
95
86
|
const client = (0, client_1.getClient)();
|
|
96
|
-
|
|
87
|
+
await client.v2.projectRoleAssignments.deleteGroupAssignment(projectUuid, groupId);
|
|
97
88
|
console.log(JSON.stringify({ ok: true }, null, 2));
|
|
98
89
|
}
|
|
99
90
|
catch (error) {
|
|
100
91
|
console.error('Error removing group role assignment:', error instanceof Error ? error.message : String(error));
|
|
101
92
|
process.exit(1);
|
|
102
93
|
}
|
|
103
|
-
}))
|
|
94
|
+
}));
|
|
104
95
|
}
|
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Projects command implementation.
|
|
4
4
|
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
6
|
exports.registerProjectsCommand = registerProjectsCommand;
|
|
16
7
|
const common_1 = require("@lightdash-tools/common");
|
|
@@ -25,65 +16,81 @@ function registerProjectsCommand(program) {
|
|
|
25
16
|
.command('get')
|
|
26
17
|
.description('Get a project by UUID')
|
|
27
18
|
.argument('<projectUuid>', 'Project UUID')
|
|
28
|
-
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, (projectUuid) =>
|
|
19
|
+
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (projectUuid) => {
|
|
29
20
|
try {
|
|
30
21
|
if (!projectUuid) {
|
|
31
22
|
console.error('Error: projectUuid is required');
|
|
32
23
|
process.exit(1);
|
|
33
24
|
}
|
|
34
25
|
const client = (0, client_1.getClient)();
|
|
35
|
-
const project =
|
|
26
|
+
const project = await client.v1.projects.getProject(projectUuid);
|
|
36
27
|
console.log(JSON.stringify(project, null, 2));
|
|
37
28
|
}
|
|
38
29
|
catch (error) {
|
|
39
30
|
console.error('Error fetching project:', error instanceof Error ? error.message : String(error));
|
|
40
31
|
process.exit(1);
|
|
41
32
|
}
|
|
42
|
-
}))
|
|
33
|
+
}));
|
|
43
34
|
projectsCmd
|
|
44
35
|
.command('list')
|
|
45
36
|
.description('List all projects in the current organization')
|
|
46
|
-
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, () =>
|
|
37
|
+
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async () => {
|
|
47
38
|
try {
|
|
48
39
|
const client = (0, client_1.getClient)();
|
|
49
|
-
const projects =
|
|
40
|
+
const projects = await client.v1.projects.listProjects();
|
|
50
41
|
console.log(JSON.stringify(projects, null, 2));
|
|
51
42
|
}
|
|
52
43
|
catch (error) {
|
|
53
44
|
console.error('Error listing projects:', error instanceof Error ? error.message : String(error));
|
|
54
45
|
process.exit(1);
|
|
55
46
|
}
|
|
56
|
-
}))
|
|
47
|
+
}));
|
|
57
48
|
const validateCmd = projectsCmd.command('validate').description('Project validation');
|
|
58
49
|
validateCmd
|
|
59
50
|
.command('run <projectUuid>')
|
|
60
51
|
.description('Trigger project validation and get job ID')
|
|
61
|
-
.action((0, safety_1.wrapAction)(common_1.WRITE_IDEMPOTENT, (projectUuid) =>
|
|
52
|
+
.action((0, safety_1.wrapAction)(common_1.WRITE_IDEMPOTENT, async (projectUuid) => {
|
|
62
53
|
try {
|
|
63
54
|
const client = (0, client_1.getClient)();
|
|
64
|
-
const result =
|
|
55
|
+
const result = await client.v1.validation.validateProject(projectUuid);
|
|
65
56
|
console.log(JSON.stringify(result, null, 2));
|
|
66
57
|
}
|
|
67
58
|
catch (error) {
|
|
68
59
|
console.error('Error triggering validation:', error instanceof Error ? error.message : String(error));
|
|
69
60
|
process.exit(1);
|
|
70
61
|
}
|
|
71
|
-
}))
|
|
62
|
+
}));
|
|
72
63
|
validateCmd
|
|
73
64
|
.command('results <projectUuid>')
|
|
74
|
-
.description('Get
|
|
75
|
-
.option('--
|
|
76
|
-
.
|
|
65
|
+
.description('Get validation results for a project (v2 API, paginated)')
|
|
66
|
+
.option('--validation-id <id>', 'Specific validation result ID (number)')
|
|
67
|
+
.option('--page <number>', 'Page number (1-indexed)', (v) => parseInt(v, 10))
|
|
68
|
+
.option('--page-size <number>', 'Results per page', (v) => parseInt(v, 10))
|
|
69
|
+
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (projectUuid, options) => {
|
|
77
70
|
try {
|
|
78
71
|
const client = (0, client_1.getClient)();
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
72
|
+
if (options.validationId) {
|
|
73
|
+
// Get specific validation result by ID
|
|
74
|
+
const validationId = parseInt(options.validationId, 10);
|
|
75
|
+
if (isNaN(validationId)) {
|
|
76
|
+
console.error('Error: validation-id must be a number');
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
const result = await client.v2.validation.getValidationResult(projectUuid, validationId);
|
|
80
|
+
console.log(JSON.stringify(result, null, 2));
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
// List validation results (first page by default)
|
|
84
|
+
const result = await client.v2.validation.listValidationResults(projectUuid, {
|
|
85
|
+
page: options.page,
|
|
86
|
+
pageSize: options.pageSize,
|
|
87
|
+
});
|
|
88
|
+
console.log(JSON.stringify(result, null, 2));
|
|
89
|
+
}
|
|
83
90
|
}
|
|
84
91
|
catch (error) {
|
|
85
92
|
console.error('Error fetching validation results:', error instanceof Error ? error.message : String(error));
|
|
86
93
|
process.exit(1);
|
|
87
94
|
}
|
|
88
|
-
}))
|
|
95
|
+
}));
|
|
89
96
|
}
|
package/dist/commands/query.js
CHANGED
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Query command implementation.
|
|
4
4
|
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
6
|
exports.registerQueryCommand = registerQueryCommand;
|
|
16
7
|
const fs_1 = require("fs");
|
|
@@ -20,36 +11,34 @@ const safety_1 = require("../utils/safety");
|
|
|
20
11
|
/**
|
|
21
12
|
* Reads JSON from stdin or a file.
|
|
22
13
|
*/
|
|
23
|
-
function readJsonInput(filePath) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
async function readJsonInput(filePath) {
|
|
15
|
+
if (filePath) {
|
|
16
|
+
const content = (0, fs_1.readFileSync)(filePath, 'utf-8');
|
|
17
|
+
return JSON.parse(content);
|
|
18
|
+
}
|
|
19
|
+
// Read from stdin
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
// Check if stdin is a TTY (interactive terminal)
|
|
22
|
+
if (process.stdin.isTTY) {
|
|
23
|
+
reject(new Error('No input provided. Use --file <path> or pipe JSON to stdin.'));
|
|
24
|
+
return;
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
const chunks = [];
|
|
27
|
+
process.stdin.setEncoding('utf8');
|
|
28
|
+
process.stdin.on('data', (chunk) => {
|
|
29
|
+
chunks.push(Buffer.from(chunk));
|
|
30
|
+
});
|
|
31
|
+
process.stdin.on('end', () => {
|
|
32
|
+
try {
|
|
33
|
+
const input = Buffer.concat(chunks).toString('utf-8');
|
|
34
|
+
resolve(JSON.parse(input));
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
try {
|
|
43
|
-
const input = Buffer.concat(chunks).toString('utf-8');
|
|
44
|
-
resolve(JSON.parse(input));
|
|
45
|
-
}
|
|
46
|
-
catch (err) {
|
|
47
|
-
reject(new Error(`Failed to parse JSON: ${err instanceof Error ? err.message : String(err)}`));
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
process.stdin.on('error', (err) => {
|
|
51
|
-
reject(err);
|
|
52
|
-
});
|
|
36
|
+
catch (err) {
|
|
37
|
+
reject(new Error(`Failed to parse JSON: ${err instanceof Error ? err.message : String(err)}`));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
process.stdin.on('error', (err) => {
|
|
41
|
+
reject(err);
|
|
53
42
|
});
|
|
54
43
|
});
|
|
55
44
|
}
|
|
@@ -64,7 +53,7 @@ function registerQueryCommand(program) {
|
|
|
64
53
|
.argument('<projectUuid>', 'Project UUID')
|
|
65
54
|
.argument('<exploreId>', 'Explore ID')
|
|
66
55
|
.option('--file <path>', 'Read metric query JSON from file (default: read from stdin)')
|
|
67
|
-
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, (projectUuid, exploreId, options) =>
|
|
56
|
+
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (projectUuid, exploreId, options) => {
|
|
68
57
|
try {
|
|
69
58
|
if (!projectUuid) {
|
|
70
59
|
console.error('Error: projectUuid is required');
|
|
@@ -75,14 +64,14 @@ function registerQueryCommand(program) {
|
|
|
75
64
|
process.exit(1);
|
|
76
65
|
}
|
|
77
66
|
// Read JSON input
|
|
78
|
-
const body = (
|
|
67
|
+
const body = (await readJsonInput(options.file));
|
|
79
68
|
const client = (0, client_1.getClient)();
|
|
80
|
-
const result =
|
|
69
|
+
const result = await client.v1.query.compileQuery(projectUuid, exploreId, body);
|
|
81
70
|
console.log(JSON.stringify(result, null, 2));
|
|
82
71
|
}
|
|
83
72
|
catch (error) {
|
|
84
73
|
console.error('Error compiling query:', error instanceof Error ? error.message : String(error));
|
|
85
74
|
process.exit(1);
|
|
86
75
|
}
|
|
87
|
-
}))
|
|
76
|
+
}));
|
|
88
77
|
}
|
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Schedulers command implementation.
|
|
4
4
|
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
6
|
exports.registerSchedulersCommand = registerSchedulersCommand;
|
|
16
7
|
const common_1 = require("@lightdash-tools/common");
|
|
@@ -27,10 +18,10 @@ function registerSchedulersCommand(program) {
|
|
|
27
18
|
.option('--search <query>', 'Search query')
|
|
28
19
|
.option('--page <number>', 'Page number', (v) => parseInt(v, 10))
|
|
29
20
|
.option('--page-size <number>', 'Page size', (v) => parseInt(v, 10))
|
|
30
|
-
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, (projectUuid, options) =>
|
|
21
|
+
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (projectUuid, options) => {
|
|
31
22
|
try {
|
|
32
23
|
const client = (0, client_1.getClient)();
|
|
33
|
-
const result =
|
|
24
|
+
const result = await client.v1.schedulers.listSchedulers(projectUuid, {
|
|
34
25
|
searchQuery: options.search,
|
|
35
26
|
page: options.page,
|
|
36
27
|
pageSize: options.pageSize,
|
|
@@ -41,19 +32,19 @@ function registerSchedulersCommand(program) {
|
|
|
41
32
|
console.error('Error listing schedulers:', error instanceof Error ? error.message : String(error));
|
|
42
33
|
process.exit(1);
|
|
43
34
|
}
|
|
44
|
-
}))
|
|
35
|
+
}));
|
|
45
36
|
schedulersCmd
|
|
46
37
|
.command('get <schedulerUuid>')
|
|
47
38
|
.description('Get a scheduler by UUID')
|
|
48
|
-
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, (schedulerUuid) =>
|
|
39
|
+
.action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (schedulerUuid) => {
|
|
49
40
|
try {
|
|
50
41
|
const client = (0, client_1.getClient)();
|
|
51
|
-
const result =
|
|
42
|
+
const result = await client.v1.schedulers.getScheduler(schedulerUuid);
|
|
52
43
|
console.log(JSON.stringify(result, null, 2));
|
|
53
44
|
}
|
|
54
45
|
catch (error) {
|
|
55
46
|
console.error('Error fetching scheduler:', error instanceof Error ? error.message : String(error));
|
|
56
47
|
process.exit(1);
|
|
57
48
|
}
|
|
58
|
-
}))
|
|
49
|
+
}));
|
|
59
50
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Outputs machine-readable JSON describing API paths, methods, and parameters.
|
|
2
|
+
* Shared CLI schema command — catalog-only introspection (ADR-0013).
|
|
4
3
|
*/
|
|
5
4
|
import type { Command } from 'commander';
|
|
6
5
|
export declare function getSchema(resource: string): Record<string, unknown> | null;
|