@credibledata/cred-cli 0.0.100 → 0.0.103
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-DEV.md +2 -2
- package/README.md +1 -1
- package/coverage/coverage-summary.json +40 -0
- package/coverage/tmp/coverage-2152-1789496974457-0.json +1 -0
- package/coverage/tmp/coverage-2153-1789496954404-0.json +1 -0
- package/dist/client/api.js +6151 -2254
- package/dist/client/api.js.map +1 -1
- package/dist/client/base.js +1 -1
- package/dist/client/common.js +1 -1
- package/dist/client/configuration.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/clientconfiguration.js +114 -26
- package/dist/clientconfiguration.js.map +1 -1
- package/dist/clientconfiguration.spec.js +159 -37
- package/dist/clientconfiguration.spec.js.map +1 -1
- package/dist/commands/add.js +36 -5
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/connection/createconnections.js +4 -4
- package/dist/commands/connection/createconnections.js.map +1 -1
- package/dist/commands/connection/createconnections.spec.js +11 -1
- package/dist/commands/connection/createconnections.spec.js.map +1 -1
- package/dist/commands/connection/deleteconnection.js +4 -4
- package/dist/commands/connection/deleteconnection.js.map +1 -1
- package/dist/commands/connection/deleteconnection.spec.js +1 -1
- package/dist/commands/connection/deleteconnection.spec.js.map +1 -1
- package/dist/commands/connection/listconnections.js +4 -4
- package/dist/commands/connection/listconnections.js.map +1 -1
- package/dist/commands/connection/listconnections.spec.js +1 -1
- package/dist/commands/connection/listconnections.spec.js.map +1 -1
- package/dist/commands/{project/createproject.js → environment/createenvironment.js} +17 -14
- package/dist/commands/environment/createenvironment.js.map +1 -0
- package/dist/commands/{project/createproject.spec.js → environment/createenvironment.spec.js} +46 -46
- package/dist/commands/environment/createenvironment.spec.js.map +1 -0
- package/dist/commands/{project/deleteproject.js → environment/deleteenvironment.js} +9 -9
- package/dist/commands/environment/deleteenvironment.js.map +1 -0
- package/dist/commands/{project/deleteproject.spec.js → environment/deleteenvironment.spec.js} +29 -29
- package/dist/commands/environment/deleteenvironment.spec.js.map +1 -0
- package/dist/commands/{project/getproject.js → environment/getenvironment.js} +8 -8
- package/dist/commands/environment/getenvironment.js.map +1 -0
- package/dist/commands/{project/getproject.spec.js → environment/getenvironment.spec.js} +32 -33
- package/dist/commands/environment/getenvironment.spec.js.map +1 -0
- package/dist/commands/{project/listprojects.js → environment/listenvironments.js} +10 -10
- package/dist/commands/environment/listenvironments.js.map +1 -0
- package/dist/commands/{project/listprojects.spec.js → environment/listenvironments.spec.js} +35 -35
- package/dist/commands/environment/listenvironments.spec.js.map +1 -0
- package/dist/commands/{project/setproject.js → environment/setenvironment.js} +6 -5
- package/dist/commands/environment/setenvironment.js.map +1 -0
- package/dist/commands/{project/setproject.spec.js → environment/setenvironment.spec.js} +9 -9
- package/dist/commands/environment/setenvironment.spec.js.map +1 -0
- package/dist/commands/environment/updateenvironment.js +130 -0
- package/dist/commands/environment/updateenvironment.js.map +1 -0
- package/dist/commands/environment/updateenvironment.spec.js +213 -0
- package/dist/commands/environment/updateenvironment.spec.js.map +1 -0
- package/dist/commands/get.js +66 -5
- package/dist/commands/get.js.map +1 -1
- package/dist/commands/legacy.js +9 -0
- package/dist/commands/legacy.js.map +1 -0
- package/dist/commands/list.js +95 -4
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/materialization/cancelrun.js +62 -0
- package/dist/commands/materialization/cancelrun.js.map +1 -0
- package/dist/commands/materialization/getindex.js +52 -0
- package/dist/commands/materialization/getindex.js.map +1 -0
- package/dist/commands/materialization/getmaterialization.js +54 -0
- package/dist/commands/materialization/getmaterialization.js.map +1 -0
- package/dist/commands/materialization/getpreaggregate.js +55 -0
- package/dist/commands/materialization/getpreaggregate.js.map +1 -0
- package/dist/commands/materialization/getrun.js +54 -0
- package/dist/commands/materialization/getrun.js.map +1 -0
- package/dist/commands/materialization/listindexes.js +58 -0
- package/dist/commands/materialization/listindexes.js.map +1 -0
- package/dist/commands/materialization/listmaterializations.js +52 -0
- package/dist/commands/materialization/listmaterializations.js.map +1 -0
- package/dist/commands/materialization/listpreaggregates.js +61 -0
- package/dist/commands/materialization/listpreaggregates.js.map +1 -0
- package/dist/commands/materialization/listruns.js +60 -0
- package/dist/commands/materialization/listruns.js.map +1 -0
- package/dist/commands/materialization/rerun.js +111 -0
- package/dist/commands/materialization/rerun.js.map +1 -0
- package/dist/commands/misc/login.js +16 -2
- package/dist/commands/misc/login.js.map +1 -1
- package/dist/commands/misc/login.spec.js +133 -5
- package/dist/commands/misc/login.spec.js.map +1 -1
- package/dist/commands/package/deletepackage.js +4 -4
- package/dist/commands/package/deletepackage.js.map +1 -1
- package/dist/commands/package/deletepackage.spec.js +1 -1
- package/dist/commands/package/deletepackage.spec.js.map +1 -1
- package/dist/commands/package/listpackages.js +11 -4
- package/dist/commands/package/listpackages.js.map +1 -1
- package/dist/commands/package/listpackages.spec.js +13 -1
- package/dist/commands/package/listpackages.spec.js.map +1 -1
- package/dist/commands/package/publish.js +36 -13
- package/dist/commands/package/publish.js.map +1 -1
- package/dist/commands/package/publish.spec.js +27 -1
- package/dist/commands/package/publish.spec.js.map +1 -1
- package/dist/commands/package/updatepackage.js +4 -4
- package/dist/commands/package/updatepackage.js.map +1 -1
- package/dist/commands/package/updatepackage.spec.js +1 -1
- package/dist/commands/package/updatepackage.spec.js.map +1 -1
- package/dist/commands/permission/createpermission.js +123 -0
- package/dist/commands/permission/createpermission.js.map +1 -0
- package/dist/commands/permission/createpermission.spec.js +360 -0
- package/dist/commands/permission/createpermission.spec.js.map +1 -0
- package/dist/commands/permission/deletepermission.js +86 -0
- package/dist/commands/permission/deletepermission.js.map +1 -0
- package/dist/commands/permission/getpermission.js +85 -0
- package/dist/commands/permission/getpermission.js.map +1 -0
- package/dist/commands/permission/listpermissions.js +75 -0
- package/dist/commands/permission/listpermissions.js.map +1 -0
- package/dist/commands/permission/scope.js +140 -0
- package/dist/commands/permission/scope.js.map +1 -0
- package/dist/commands/rm.js +26 -4
- package/dist/commands/rm.js.map +1 -1
- package/dist/commands/set.js +12 -4
- package/dist/commands/set.js.map +1 -1
- package/dist/commands/update.js +29 -10
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/version/archive-unarchive-version.js +4 -5
- package/dist/commands/version/archive-unarchive-version.js.map +1 -1
- package/dist/commands/version/archive-unarchive-version.spec.js +4 -4
- package/dist/commands/version/archive-unarchive-version.spec.js.map +1 -1
- package/dist/commands/version/listversions.js +4 -4
- package/dist/commands/version/listversions.js.map +1 -1
- package/dist/commands/version/listversions.spec.js +1 -1
- package/dist/commands/version/listversions.spec.js.map +1 -1
- package/dist/common/UserGroupId.js +1 -1
- package/dist/common/UserGroupId.js.map +1 -1
- package/dist/common/UserGroupId.spec.js +2 -4
- package/dist/common/UserGroupId.spec.js.map +1 -1
- package/dist/constants.js +95 -19
- package/dist/constants.js.map +1 -1
- package/dist/constants.spec.js +90 -0
- package/dist/constants.spec.js.map +1 -0
- package/dist/index.js +128 -15
- package/dist/index.js.map +1 -1
- package/dist/logger.js +5 -1
- package/dist/logger.js.map +1 -1
- package/openapitools.json +4 -1
- package/package.json +10 -9
- package/src/client/api.ts +9363 -3093
- package/src/client/base.ts +1 -1
- package/src/client/common.ts +1 -1
- package/src/client/configuration.ts +1 -1
- package/src/client/index.ts +1 -1
- package/src/clientconfiguration.spec.ts +238 -113
- package/src/clientconfiguration.ts +131 -30
- package/src/commands/add.ts +78 -12
- package/src/commands/connection/createconnections.spec.ts +11 -1
- package/src/commands/connection/createconnections.ts +4 -4
- package/src/commands/connection/deleteconnection.spec.ts +1 -1
- package/src/commands/connection/deleteconnection.ts +4 -4
- package/src/commands/connection/listconnections.spec.ts +1 -1
- package/src/commands/connection/listconnections.ts +4 -4
- package/src/commands/{project/createproject.spec.ts → environment/createenvironment.spec.ts} +56 -54
- package/src/commands/{project/createproject.ts → environment/createenvironment.ts} +17 -14
- package/src/commands/{project/deleteproject.spec.ts → environment/deleteenvironment.spec.ts} +59 -30
- package/src/commands/{project/deleteproject.ts → environment/deleteenvironment.ts} +10 -10
- package/src/commands/environment/getenvironment.spec.ts +110 -0
- package/src/commands/{project/getproject.ts → environment/getenvironment.ts} +9 -9
- package/src/commands/{project/listprojects.spec.ts → environment/listenvironments.spec.ts} +37 -35
- package/src/commands/{project/listprojects.ts → environment/listenvironments.ts} +13 -8
- package/src/commands/{project/setproject.spec.ts → environment/setenvironment.spec.ts} +8 -8
- package/src/commands/{project/setproject.ts → environment/setenvironment.ts} +4 -4
- package/src/commands/environment/updateenvironment.spec.ts +386 -0
- package/src/commands/environment/updateenvironment.ts +168 -0
- package/src/commands/get.ts +131 -9
- package/src/commands/legacy.ts +5 -0
- package/src/commands/list.ts +204 -9
- package/src/commands/materialization/cancelrun.ts +70 -0
- package/src/commands/materialization/getindex.ts +55 -0
- package/src/commands/materialization/getmaterialization.ts +57 -0
- package/src/commands/materialization/getpreaggregate.ts +58 -0
- package/src/commands/materialization/getrun.ts +55 -0
- package/src/commands/materialization/listindexes.ts +69 -0
- package/src/commands/materialization/listmaterializations.ts +53 -0
- package/src/commands/materialization/listpreaggregates.ts +74 -0
- package/src/commands/materialization/listruns.ts +77 -0
- package/src/commands/materialization/rerun.ts +123 -0
- package/src/commands/misc/login.spec.ts +165 -7
- package/src/commands/misc/login.ts +20 -2
- package/src/commands/package/deletepackage.spec.ts +1 -1
- package/src/commands/package/deletepackage.ts +4 -4
- package/src/commands/package/listpackages.spec.ts +17 -1
- package/src/commands/package/listpackages.ts +11 -4
- package/src/commands/package/publish.spec.ts +46 -1
- package/src/commands/package/publish.ts +38 -13
- package/src/commands/package/updatepackage.spec.ts +1 -1
- package/src/commands/package/updatepackage.ts +4 -4
- package/src/commands/permission/createpermission.spec.ts +507 -0
- package/src/commands/permission/createpermission.ts +181 -0
- package/src/commands/permission/deletepermission.ts +117 -0
- package/src/commands/permission/getpermission.ts +115 -0
- package/src/commands/permission/listpermissions.ts +101 -0
- package/src/commands/permission/scope.ts +180 -0
- package/src/commands/rm.ts +54 -9
- package/src/commands/set.ts +13 -4
- package/src/commands/update.ts +66 -23
- package/src/commands/version/archive-unarchive-version.spec.ts +4 -4
- package/src/commands/version/archive-unarchive-version.ts +4 -7
- package/src/commands/version/listversions.spec.ts +1 -1
- package/src/commands/version/listversions.ts +4 -4
- package/src/common/UserGroupId.spec.ts +2 -4
- package/src/common/UserGroupId.ts +1 -1
- package/src/constants.spec.ts +111 -0
- package/src/constants.ts +131 -19
- package/src/index.ts +187 -18
- package/src/logger.ts +5 -1
- package/bun.lock +0 -1158
- package/dist/commands/project/createproject.js.map +0 -1
- package/dist/commands/project/createproject.spec.js.map +0 -1
- package/dist/commands/project/deleteproject.js.map +0 -1
- package/dist/commands/project/deleteproject.spec.js.map +0 -1
- package/dist/commands/project/getproject.js.map +0 -1
- package/dist/commands/project/getproject.spec.js.map +0 -1
- package/dist/commands/project/listprojects.js.map +0 -1
- package/dist/commands/project/listprojects.spec.js.map +0 -1
- package/dist/commands/project/setproject.js.map +0 -1
- package/dist/commands/project/setproject.spec.js.map +0 -1
- package/dist/commands/project/updateproject.js +0 -68
- package/dist/commands/project/updateproject.js.map +0 -1
- package/dist/commands/project/updateproject.spec.js +0 -129
- package/dist/commands/project/updateproject.spec.js.map +0 -1
- package/src/commands/project/getproject.spec.ts +0 -109
- package/src/commands/project/updateproject.spec.ts +0 -217
- package/src/commands/project/updateproject.ts +0 -82
package/src/commands/get.ts
CHANGED
|
@@ -1,24 +1,45 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1
2
|
import { Command } from "commander";
|
|
2
3
|
import { controlPlanesByEnv, Environment } from "../constants";
|
|
3
4
|
import { getGroup } from "./group/getgroup";
|
|
4
|
-
import {
|
|
5
|
+
import { getEnvironment } from "./environment/getenvironment";
|
|
6
|
+
import { getMaterialization } from "./materialization/getmaterialization";
|
|
7
|
+
import { getIndex } from "./materialization/getindex";
|
|
8
|
+
import { getPreaggregate } from "./materialization/getpreaggregate";
|
|
9
|
+
import { getRun } from "./materialization/getrun";
|
|
10
|
+
import { warnProjectDeprecated } from "./legacy";
|
|
11
|
+
import { getPermission } from "./permission/getpermission";
|
|
5
12
|
|
|
6
13
|
export const registerGetCommands = (cli: Command, environment: Environment) => {
|
|
7
14
|
const get = cli
|
|
8
15
|
.command("get")
|
|
9
16
|
.description("Get a resource")
|
|
10
|
-
.argument(
|
|
17
|
+
.argument(
|
|
18
|
+
"<resource>",
|
|
19
|
+
"The resource to get (environment | group | permission | materialization | index | preaggregate | run)",
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const getEnvironmentAction = (environmentName: string, options: any) => {
|
|
23
|
+
getEnvironment(
|
|
24
|
+
controlPlanesByEnv[environment],
|
|
25
|
+
environmentName,
|
|
26
|
+
options.debug,
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
get.command("environment")
|
|
31
|
+
.description("Get an environment by name.")
|
|
32
|
+
.argument("<environmentName>", "The name of the environment to get.")
|
|
33
|
+
.option("--debug")
|
|
34
|
+
.action(getEnvironmentAction);
|
|
11
35
|
|
|
12
36
|
get.command("project")
|
|
13
|
-
.description("
|
|
14
|
-
.argument("<projectName>", "The name of the
|
|
37
|
+
.description("[deprecated] Alias for 'get environment'.")
|
|
38
|
+
.argument("<projectName>", "The name of the environment to get.")
|
|
15
39
|
.option("--debug")
|
|
16
40
|
.action((projectName, options) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
projectName,
|
|
20
|
-
options.debug,
|
|
21
|
-
);
|
|
41
|
+
warnProjectDeprecated("get environment");
|
|
42
|
+
getEnvironmentAction(projectName, options);
|
|
22
43
|
});
|
|
23
44
|
|
|
24
45
|
get.command("group")
|
|
@@ -28,4 +49,105 @@ export const registerGetCommands = (cli: Command, environment: Environment) => {
|
|
|
28
49
|
.action((groupName, options) => {
|
|
29
50
|
getGroup(controlPlanesByEnv[environment], groupName, options.debug);
|
|
30
51
|
});
|
|
52
|
+
|
|
53
|
+
get.command("permission")
|
|
54
|
+
.description(
|
|
55
|
+
"Get a user or group's permission on the organization, an environment, or a package.",
|
|
56
|
+
)
|
|
57
|
+
.argument(
|
|
58
|
+
"<userGroupId>",
|
|
59
|
+
"Whose permission to get [user:{email}|group:{groupName}|user:*]",
|
|
60
|
+
)
|
|
61
|
+
.option(
|
|
62
|
+
"--environment <environmentName>",
|
|
63
|
+
"Get the permission on this environment instead of the organization.",
|
|
64
|
+
)
|
|
65
|
+
.option(
|
|
66
|
+
"--package <packageName>",
|
|
67
|
+
"Get the permission on this package. Uses --environment, or the current environment.",
|
|
68
|
+
)
|
|
69
|
+
.option("--debug")
|
|
70
|
+
.action((userGroupId, options) => {
|
|
71
|
+
getPermission(
|
|
72
|
+
controlPlanesByEnv[environment],
|
|
73
|
+
userGroupId,
|
|
74
|
+
options.debug || false,
|
|
75
|
+
{ environment: options.environment, package: options.package },
|
|
76
|
+
);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
get.command("materialization")
|
|
80
|
+
.alias("mat")
|
|
81
|
+
.description(
|
|
82
|
+
"Get a materialization anchor by id (status, physical table + connection, serving build, freshness, staleness).",
|
|
83
|
+
)
|
|
84
|
+
.argument("<packageName>", "The package that owns the materialization.")
|
|
85
|
+
.argument("<versionId>", "The version that binds it (e.g. 0.1.21).")
|
|
86
|
+
.argument("<materializationId>", "The materialization id.")
|
|
87
|
+
.option("--debug")
|
|
88
|
+
.action((packageName, versionId, materializationId, options) => {
|
|
89
|
+
getMaterialization(
|
|
90
|
+
controlPlanesByEnv[environment],
|
|
91
|
+
packageName,
|
|
92
|
+
versionId,
|
|
93
|
+
materializationId,
|
|
94
|
+
options.debug,
|
|
95
|
+
);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
get.command("index")
|
|
99
|
+
.description(
|
|
100
|
+
"Get a dimensional index anchor by id (status, row count, lastIndexedAt, freshness, staleness).",
|
|
101
|
+
)
|
|
102
|
+
.argument("<packageName>", "The package that owns the index.")
|
|
103
|
+
.argument("<versionId>", "The version that binds it (e.g. 0.1.21).")
|
|
104
|
+
.argument("<indexId>", "The index (binding) id.")
|
|
105
|
+
.option("--debug")
|
|
106
|
+
.action((packageName, versionId, indexId, options) => {
|
|
107
|
+
getIndex(
|
|
108
|
+
controlPlanesByEnv[environment],
|
|
109
|
+
packageName,
|
|
110
|
+
versionId,
|
|
111
|
+
indexId,
|
|
112
|
+
options.debug,
|
|
113
|
+
);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
get.command("preaggregate")
|
|
117
|
+
.alias("preagg")
|
|
118
|
+
.description(
|
|
119
|
+
"Get a pre-aggregated measure by id (status, grain, row count, lastBuiltAt, freshness, staleness).",
|
|
120
|
+
)
|
|
121
|
+
.argument("<packageName>", "The package that owns the pre-aggregation.")
|
|
122
|
+
.argument("<versionId>", "The version that binds it (e.g. 0.1.21).")
|
|
123
|
+
.argument(
|
|
124
|
+
"<preaggregateId>",
|
|
125
|
+
"The pre-aggregation id, as printed by `cred ls preaggregate`. It addresses a measure within a rollup — do not construct one by hand.",
|
|
126
|
+
)
|
|
127
|
+
.option("--debug")
|
|
128
|
+
.action((packageName, versionId, preaggregateId, options) => {
|
|
129
|
+
getPreaggregate(
|
|
130
|
+
controlPlanesByEnv[environment],
|
|
131
|
+
packageName,
|
|
132
|
+
versionId,
|
|
133
|
+
preaggregateId,
|
|
134
|
+
options.debug,
|
|
135
|
+
);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
get.command("run")
|
|
139
|
+
.description(
|
|
140
|
+
"Get a run by id, including its build-plan graph (per-unit state, physical table names, row counts).",
|
|
141
|
+
)
|
|
142
|
+
.argument("<packageName>", "The package that owns the run.")
|
|
143
|
+
.argument("<runId>", "The run id.")
|
|
144
|
+
.option("--debug")
|
|
145
|
+
.action((packageName, runId, options) => {
|
|
146
|
+
getRun(
|
|
147
|
+
controlPlanesByEnv[environment],
|
|
148
|
+
packageName,
|
|
149
|
+
runId,
|
|
150
|
+
options.debug,
|
|
151
|
+
);
|
|
152
|
+
});
|
|
31
153
|
};
|
package/src/commands/list.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1
2
|
import { Command } from "commander";
|
|
2
3
|
import { controlPlanesByEnv, Environment } from "../constants";
|
|
3
4
|
import { DEFAULT_PAGE_SIZE, DEFAULT_PAGE } from "../utils";
|
|
@@ -5,8 +6,14 @@ import { listConnections } from "./connection/listconnections";
|
|
|
5
6
|
import { printOutGroups } from "./group/listgroups";
|
|
6
7
|
import { listGroupAccessTokens } from "./groupaccesstoken/listTokens";
|
|
7
8
|
import { printOutPackages } from "./package/listpackages";
|
|
8
|
-
import {
|
|
9
|
+
import { printOutEnvironments } from "./environment/listenvironments";
|
|
9
10
|
import { listVersions } from "./version/listversions";
|
|
11
|
+
import { listMaterializations } from "./materialization/listmaterializations";
|
|
12
|
+
import { listIndexes } from "./materialization/listindexes";
|
|
13
|
+
import { listPreaggregates } from "./materialization/listpreaggregates";
|
|
14
|
+
import { listRuns } from "./materialization/listruns";
|
|
15
|
+
import { warnProjectDeprecated } from "./legacy";
|
|
16
|
+
import { listPermissions } from "./permission/listpermissions";
|
|
10
17
|
|
|
11
18
|
export const registerListCommands = (
|
|
12
19
|
cli: Command,
|
|
@@ -17,10 +24,36 @@ export const registerListCommands = (
|
|
|
17
24
|
.description("List resources of a given type")
|
|
18
25
|
.argument("<resource>", "The resource to list");
|
|
19
26
|
|
|
27
|
+
const listEnvironmentsAction = (options: any) => {
|
|
28
|
+
printOutEnvironments(
|
|
29
|
+
controlPlanesByEnv[environment],
|
|
30
|
+
options.debug,
|
|
31
|
+
options.page,
|
|
32
|
+
options.pageSize,
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
list
|
|
37
|
+
.command("environment")
|
|
38
|
+
.alias("environments")
|
|
39
|
+
.description("List all environments.")
|
|
40
|
+
.option("--debug")
|
|
41
|
+
.option(
|
|
42
|
+
"--page <number>",
|
|
43
|
+
`Page number (starts at ${DEFAULT_PAGE})`,
|
|
44
|
+
String(DEFAULT_PAGE),
|
|
45
|
+
)
|
|
46
|
+
.option(
|
|
47
|
+
"--page-size <number>",
|
|
48
|
+
`Items per page (default: all records, max: 500)`,
|
|
49
|
+
String(DEFAULT_PAGE_SIZE),
|
|
50
|
+
)
|
|
51
|
+
.action(listEnvironmentsAction);
|
|
52
|
+
|
|
20
53
|
list
|
|
21
54
|
.command("project")
|
|
22
55
|
.alias("projects")
|
|
23
|
-
.description("
|
|
56
|
+
.description("[deprecated] Alias for 'ls environment'.")
|
|
24
57
|
.option("--debug")
|
|
25
58
|
.option(
|
|
26
59
|
"--page <number>",
|
|
@@ -33,12 +66,8 @@ export const registerListCommands = (
|
|
|
33
66
|
String(DEFAULT_PAGE_SIZE),
|
|
34
67
|
)
|
|
35
68
|
.action((options) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
options.debug,
|
|
39
|
-
options.page,
|
|
40
|
-
options.pageSize,
|
|
41
|
-
);
|
|
69
|
+
warnProjectDeprecated("ls environment");
|
|
70
|
+
listEnvironmentsAction(options);
|
|
42
71
|
});
|
|
43
72
|
|
|
44
73
|
list
|
|
@@ -68,7 +97,7 @@ export const registerListCommands = (
|
|
|
68
97
|
list
|
|
69
98
|
.command("package")
|
|
70
99
|
.alias("packages")
|
|
71
|
-
.description("List the packages in the active
|
|
100
|
+
.description("List the packages in the active environment.")
|
|
72
101
|
.option("--debug")
|
|
73
102
|
.option(
|
|
74
103
|
"--page <number>",
|
|
@@ -106,6 +135,172 @@ export const registerListCommands = (
|
|
|
106
135
|
);
|
|
107
136
|
});
|
|
108
137
|
|
|
138
|
+
list
|
|
139
|
+
.command("materialization")
|
|
140
|
+
.alias("materializations")
|
|
141
|
+
.description(
|
|
142
|
+
"List the materializations of a package version (status + failure reason).",
|
|
143
|
+
)
|
|
144
|
+
.argument(
|
|
145
|
+
"<packageName>",
|
|
146
|
+
"The name of the package whose materializations to list.",
|
|
147
|
+
)
|
|
148
|
+
.argument(
|
|
149
|
+
"<versionId>",
|
|
150
|
+
"The version that binds the materializations (e.g. 0.1.21).",
|
|
151
|
+
)
|
|
152
|
+
.option("--debug")
|
|
153
|
+
.action((packageName, versionId, options) => {
|
|
154
|
+
listMaterializations(
|
|
155
|
+
controlPlanesByEnv[environment],
|
|
156
|
+
packageName,
|
|
157
|
+
versionId,
|
|
158
|
+
options.debug,
|
|
159
|
+
);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
list
|
|
163
|
+
.command("index")
|
|
164
|
+
.alias("indexes")
|
|
165
|
+
.description(
|
|
166
|
+
"List the dimensional search indexes of a package version (status + failure reason + freshness).",
|
|
167
|
+
)
|
|
168
|
+
.argument(
|
|
169
|
+
"<packageName>",
|
|
170
|
+
"The name of the package whose indexes to list.",
|
|
171
|
+
)
|
|
172
|
+
.argument(
|
|
173
|
+
"<versionId>",
|
|
174
|
+
"The version that binds the indexes (e.g. 0.1.21).",
|
|
175
|
+
)
|
|
176
|
+
.option("--debug")
|
|
177
|
+
// No static defaults: a Commander default of "-1" for --page-size would make it
|
|
178
|
+
// always-set, so parsePaginationParams takes its "return all records" branch and
|
|
179
|
+
// silently ignores a lone --page N. Leaving both unset (undefined) preserves the
|
|
180
|
+
// all-records default (neither flag → branch 1) while letting --page N default the
|
|
181
|
+
// page size to a finite page (utils.parsePaginationParams).
|
|
182
|
+
.option("--page <number>", `Page number (starts at ${DEFAULT_PAGE})`)
|
|
183
|
+
.option(
|
|
184
|
+
"--page-size <number>",
|
|
185
|
+
`Items per page (default: all records, max: 500)`,
|
|
186
|
+
)
|
|
187
|
+
.action((packageName, versionId, options) => {
|
|
188
|
+
listIndexes(
|
|
189
|
+
controlPlanesByEnv[environment],
|
|
190
|
+
packageName,
|
|
191
|
+
versionId,
|
|
192
|
+
options.debug,
|
|
193
|
+
options.page,
|
|
194
|
+
options.pageSize,
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
list
|
|
199
|
+
.command("preaggregate")
|
|
200
|
+
.alias("preaggregates")
|
|
201
|
+
.alias("preaggs")
|
|
202
|
+
.description(
|
|
203
|
+
"List the pre-aggregated measures of a package version (status + failure reason + grain + freshness). One entry per measure, so several may share a rollup table.",
|
|
204
|
+
)
|
|
205
|
+
.argument(
|
|
206
|
+
"<packageName>",
|
|
207
|
+
"The name of the package whose pre-aggregations to list.",
|
|
208
|
+
)
|
|
209
|
+
.argument(
|
|
210
|
+
"<versionId>",
|
|
211
|
+
"The version that binds the pre-aggregations (e.g. 0.1.21).",
|
|
212
|
+
)
|
|
213
|
+
.option("--debug")
|
|
214
|
+
.option(
|
|
215
|
+
"--source <sourceName>",
|
|
216
|
+
"Only list the pre-aggregated measures of this authored source.",
|
|
217
|
+
)
|
|
218
|
+
// No static defaults — see the note on `ls index` above.
|
|
219
|
+
.option("--page <number>", `Page number (starts at ${DEFAULT_PAGE})`)
|
|
220
|
+
.option(
|
|
221
|
+
"--page-size <number>",
|
|
222
|
+
`Items per page (default: all records, max: 500)`,
|
|
223
|
+
)
|
|
224
|
+
.action((packageName, versionId, options) => {
|
|
225
|
+
listPreaggregates(
|
|
226
|
+
controlPlanesByEnv[environment],
|
|
227
|
+
packageName,
|
|
228
|
+
versionId,
|
|
229
|
+
options.source,
|
|
230
|
+
options.debug,
|
|
231
|
+
options.page,
|
|
232
|
+
options.pageSize,
|
|
233
|
+
);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
list
|
|
237
|
+
.command("run")
|
|
238
|
+
.alias("runs")
|
|
239
|
+
.description(
|
|
240
|
+
"List the build/refresh runs of a package (most recent first). Runs are package-scoped and span all three families (materialized sources, dimensional indexes and pre-aggregations); pass a version to filter to the runs it initiated, or --source/--dimension/--measure to filter to a targeted unit.",
|
|
241
|
+
)
|
|
242
|
+
.argument("<packageName>", "The name of the package whose runs to list.")
|
|
243
|
+
.argument(
|
|
244
|
+
"[versionId]",
|
|
245
|
+
"Optional version to filter runs to (e.g. 0.1.21). Omit to list every run in the package.",
|
|
246
|
+
)
|
|
247
|
+
.option("--debug")
|
|
248
|
+
.option(
|
|
249
|
+
"--source <sourceName>",
|
|
250
|
+
"Only list runs targeting this persist source.",
|
|
251
|
+
)
|
|
252
|
+
.option(
|
|
253
|
+
"--dimension <dimension>",
|
|
254
|
+
"Only list runs targeting this indexed dimension.",
|
|
255
|
+
)
|
|
256
|
+
.option(
|
|
257
|
+
"--measure <measure>",
|
|
258
|
+
"Only list runs targeting this pre-aggregated measure.",
|
|
259
|
+
)
|
|
260
|
+
// No static defaults — see the note on `ls index` above: a "-1" --page-size default
|
|
261
|
+
// makes parsePaginationParams ignore a lone --page N. Undefined keeps the all-records
|
|
262
|
+
// default while honoring --page N.
|
|
263
|
+
.option("--page <number>", `Page number (starts at ${DEFAULT_PAGE})`)
|
|
264
|
+
.option(
|
|
265
|
+
"--page-size <number>",
|
|
266
|
+
`Items per page (default: all records, max: 500)`,
|
|
267
|
+
)
|
|
268
|
+
.action((packageName, versionId, options) => {
|
|
269
|
+
listRuns(
|
|
270
|
+
controlPlanesByEnv[environment],
|
|
271
|
+
packageName,
|
|
272
|
+
versionId,
|
|
273
|
+
options.debug,
|
|
274
|
+
options.source,
|
|
275
|
+
options.dimension,
|
|
276
|
+
options.measure,
|
|
277
|
+
options.page,
|
|
278
|
+
options.pageSize,
|
|
279
|
+
);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
list
|
|
283
|
+
.command("permission")
|
|
284
|
+
.alias("permissions")
|
|
285
|
+
.description(
|
|
286
|
+
"List the permissions on the organization, an environment, or a package.",
|
|
287
|
+
)
|
|
288
|
+
.option(
|
|
289
|
+
"--environment <environmentName>",
|
|
290
|
+
"List this environment's permissions instead of the organization's.",
|
|
291
|
+
)
|
|
292
|
+
.option(
|
|
293
|
+
"--package <packageName>",
|
|
294
|
+
"List this package's permissions. Uses --environment, or the current environment.",
|
|
295
|
+
)
|
|
296
|
+
.option("--debug")
|
|
297
|
+
.action((options) => {
|
|
298
|
+
listPermissions(controlPlanesByEnv[environment], options.debug, {
|
|
299
|
+
environment: options.environment,
|
|
300
|
+
package: options.package,
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
|
|
109
304
|
list
|
|
110
305
|
.command("group")
|
|
111
306
|
.alias("groups")
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { RunsApi, RunActionActionEnum } from "../../client/api";
|
|
2
|
+
import { Configuration } from "../../client/configuration";
|
|
3
|
+
import { ClientConfiguration } from "../../clientconfiguration";
|
|
4
|
+
import { logger } from "../../logger";
|
|
5
|
+
import { getConfirmation, prettifyJson, printOutError } from "../../utils";
|
|
6
|
+
|
|
7
|
+
const runsApi = new RunsApi(new Configuration());
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Cancel an in-flight (non-terminal) build/refresh run. No-op-safe: the control
|
|
11
|
+
* plane returns 409 if the run is already terminal. Prints the run's updated
|
|
12
|
+
* state.
|
|
13
|
+
*/
|
|
14
|
+
export async function cancelRun(
|
|
15
|
+
controlPlane: string,
|
|
16
|
+
packagePath: string,
|
|
17
|
+
runId: string,
|
|
18
|
+
debug: boolean,
|
|
19
|
+
autoConfirm: boolean,
|
|
20
|
+
) {
|
|
21
|
+
const clientConfig = new ClientConfiguration();
|
|
22
|
+
const organizationName = clientConfig.getOrganization();
|
|
23
|
+
const environmentName = clientConfig.getProject();
|
|
24
|
+
|
|
25
|
+
if (!clientConfig.doesConfigExists()) {
|
|
26
|
+
logger.error("Please, make sure that you are logged in");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (!environmentName) {
|
|
31
|
+
logger.error("Please, make sure to set an environment");
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!runId) {
|
|
36
|
+
logger.error("Please provide a run ID");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const packageName = packagePath.replace("/", "");
|
|
41
|
+
|
|
42
|
+
if (!autoConfirm) {
|
|
43
|
+
const confirmation = await getConfirmation(
|
|
44
|
+
`Cancel run ${runId} in ${packageName}?`,
|
|
45
|
+
);
|
|
46
|
+
if (!confirmation) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
logger.info(`Cancelling run ${runId} in ${packageName}`);
|
|
52
|
+
try {
|
|
53
|
+
const response = await runsApi.runAction(
|
|
54
|
+
organizationName,
|
|
55
|
+
environmentName,
|
|
56
|
+
packageName,
|
|
57
|
+
runId,
|
|
58
|
+
RunActionActionEnum.Cancel,
|
|
59
|
+
{
|
|
60
|
+
baseURL: controlPlane,
|
|
61
|
+
headers: clientConfig.getHeaders(),
|
|
62
|
+
},
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
console.log(prettifyJson(response.data));
|
|
66
|
+
} catch (e) {
|
|
67
|
+
logger.error("Failed to cancel run");
|
|
68
|
+
printOutError(e, debug);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { IndexesApi } from "../../client/api";
|
|
2
|
+
import { Configuration } from "../../client/configuration";
|
|
3
|
+
import { ClientConfiguration } from "../../clientconfiguration";
|
|
4
|
+
import { logger } from "../../logger";
|
|
5
|
+
import { prettifyJson, printOutError } from "../../utils";
|
|
6
|
+
|
|
7
|
+
const indexesApi = new IndexesApi(new Configuration());
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Get a single dimensional search index anchor (binding) by id. Prints the full
|
|
11
|
+
* anchor state — `status`/`error`, the indexed `sourceName`/`dimension`, the
|
|
12
|
+
* serving `rowCount` (indexed values) and `lastIndexedAt`, scope, freshness
|
|
13
|
+
* policy, and the `stale`/`staleSince`/`staleReasons` triple.
|
|
14
|
+
*/
|
|
15
|
+
export async function getIndex(
|
|
16
|
+
controlPlane: string,
|
|
17
|
+
packagePath: string,
|
|
18
|
+
versionId: string,
|
|
19
|
+
indexId: string,
|
|
20
|
+
debug: boolean,
|
|
21
|
+
) {
|
|
22
|
+
const clientConfig = new ClientConfiguration();
|
|
23
|
+
const organizationName = clientConfig.getOrganization();
|
|
24
|
+
const environmentName = clientConfig.getProject();
|
|
25
|
+
|
|
26
|
+
if (!clientConfig.doesConfigExists()) {
|
|
27
|
+
logger.error("Please, make sure that you are logged in");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!environmentName) {
|
|
32
|
+
logger.error("Please, make sure to set an environment");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
const packageName = packagePath.replace("/", "");
|
|
38
|
+
const response = await indexesApi.getIndex(
|
|
39
|
+
organizationName,
|
|
40
|
+
environmentName,
|
|
41
|
+
packageName,
|
|
42
|
+
versionId,
|
|
43
|
+
indexId,
|
|
44
|
+
{
|
|
45
|
+
baseURL: controlPlane,
|
|
46
|
+
headers: clientConfig.getHeaders(),
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
console.log(prettifyJson(response.data));
|
|
51
|
+
} catch (e) {
|
|
52
|
+
logger.error("Failed to get index");
|
|
53
|
+
printOutError(e, debug);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { MaterializationsApi } from "../../client/api";
|
|
2
|
+
import { Configuration } from "../../client/configuration";
|
|
3
|
+
import { ClientConfiguration } from "../../clientconfiguration";
|
|
4
|
+
import { logger } from "../../logger";
|
|
5
|
+
import { prettifyJson, printOutError } from "../../utils";
|
|
6
|
+
|
|
7
|
+
const materializationsApi = new MaterializationsApi(new Configuration());
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Get a single Malloy Persistence materialization anchor by id. Prints the full
|
|
11
|
+
* anchor state — `status`/`error`, the physical `materializedTableName` and its
|
|
12
|
+
* `connectionName` (the underlying warehouse table currently serving the
|
|
13
|
+
* source), the serving run/build number, scope, freshness policy, and the
|
|
14
|
+
* `stale`/`staleSince`/`staleReasons` triple — so the state of the derived table
|
|
15
|
+
* is inspectable from the CLI without opening the app.
|
|
16
|
+
*/
|
|
17
|
+
export async function getMaterialization(
|
|
18
|
+
controlPlane: string,
|
|
19
|
+
packagePath: string,
|
|
20
|
+
versionId: string,
|
|
21
|
+
materializationId: string,
|
|
22
|
+
debug: boolean,
|
|
23
|
+
) {
|
|
24
|
+
const clientConfig = new ClientConfiguration();
|
|
25
|
+
const organizationName = clientConfig.getOrganization();
|
|
26
|
+
const environmentName = clientConfig.getProject();
|
|
27
|
+
|
|
28
|
+
if (!clientConfig.doesConfigExists()) {
|
|
29
|
+
logger.error("Please, make sure that you are logged in");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (!environmentName) {
|
|
34
|
+
logger.error("Please, make sure to set an environment");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const packageName = packagePath.replace("/", "");
|
|
40
|
+
const response = await materializationsApi.getMaterialization(
|
|
41
|
+
organizationName,
|
|
42
|
+
environmentName,
|
|
43
|
+
packageName,
|
|
44
|
+
versionId,
|
|
45
|
+
materializationId,
|
|
46
|
+
{
|
|
47
|
+
baseURL: controlPlane,
|
|
48
|
+
headers: clientConfig.getHeaders(),
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
console.log(prettifyJson(response.data));
|
|
53
|
+
} catch (e) {
|
|
54
|
+
logger.error("Failed to get materialization");
|
|
55
|
+
printOutError(e, debug);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { PreaggregatesApi } from "../../client/api";
|
|
2
|
+
import { Configuration } from "../../client/configuration";
|
|
3
|
+
import { ClientConfiguration } from "../../clientconfiguration";
|
|
4
|
+
import { logger } from "../../logger";
|
|
5
|
+
import { prettifyJson, printOutError } from "../../utils";
|
|
6
|
+
|
|
7
|
+
const preaggregatesApi = new PreaggregatesApi(new Configuration());
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Get a single pre-aggregated measure by id. Prints its full state — `status`/`error`,
|
|
11
|
+
* the authored `sourceName` and `measure`, the `grainDimensions` it is rolled up to, the
|
|
12
|
+
* serving table and its `rowCount`/`lastBuiltAt`, scope, freshness policy, and the
|
|
13
|
+
* `stale`/`staleSince`/`staleReasons` triple.
|
|
14
|
+
*
|
|
15
|
+
* <p>The id is opaque and comes from `cred ls preaggregate` — it addresses a measure
|
|
16
|
+
* within a rollup, not the rollup table, so do not construct one by hand.
|
|
17
|
+
*/
|
|
18
|
+
export async function getPreaggregate(
|
|
19
|
+
controlPlane: string,
|
|
20
|
+
packagePath: string,
|
|
21
|
+
versionId: string,
|
|
22
|
+
preaggregateId: string,
|
|
23
|
+
debug: boolean,
|
|
24
|
+
) {
|
|
25
|
+
const clientConfig = new ClientConfiguration();
|
|
26
|
+
const organizationName = clientConfig.getOrganization();
|
|
27
|
+
const environmentName = clientConfig.getProject();
|
|
28
|
+
|
|
29
|
+
if (!clientConfig.doesConfigExists()) {
|
|
30
|
+
logger.error("Please, make sure that you are logged in");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!environmentName) {
|
|
35
|
+
logger.error("Please, make sure to set an environment");
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
const packageName = packagePath.replace("/", "");
|
|
41
|
+
const response = await preaggregatesApi.getPreaggregate(
|
|
42
|
+
organizationName,
|
|
43
|
+
environmentName,
|
|
44
|
+
packageName,
|
|
45
|
+
versionId,
|
|
46
|
+
preaggregateId,
|
|
47
|
+
{
|
|
48
|
+
baseURL: controlPlane,
|
|
49
|
+
headers: clientConfig.getHeaders(),
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
console.log(prettifyJson(response.data));
|
|
54
|
+
} catch (e) {
|
|
55
|
+
logger.error("Failed to get pre-aggregation");
|
|
56
|
+
printOutError(e, debug);
|
|
57
|
+
}
|
|
58
|
+
}
|