dataiku-sdk 3.4.0 → 3.6.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 +4 -4
- package/bin/dss.js +28 -2
- package/dist/build-metadata.json +1 -1
- package/dist/src/cli/coerce.d.ts +0 -1
- package/dist/src/cli/coerce.js +0 -5
- package/dist/src/cli/command-syntax.json +14524 -0
- package/dist/src/cli/commands/analysis.js +6 -9
- package/dist/src/cli/commands/api-deployer.js +15 -33
- package/dist/src/cli/commands/api-service.js +17 -27
- package/dist/src/cli/commands/app.js +25 -41
- package/dist/src/cli/commands/bundle.js +15 -24
- package/dist/src/cli/commands/business-app.js +10 -17
- package/dist/src/cli/commands/code-env.js +23 -36
- package/dist/src/cli/commands/code.js +4 -4
- package/dist/src/cli/commands/connection.js +12 -22
- package/dist/src/cli/commands/continuous-activity.js +6 -9
- package/dist/src/cli/commands/dashboard.js +8 -13
- package/dist/src/cli/commands/data-collection.js +9 -16
- package/dist/src/cli/commands/data-quality.js +14 -26
- package/dist/src/cli/commands/dataset.js +29 -54
- package/dist/src/cli/commands/discussion.js +7 -10
- package/dist/src/cli/commands/doctor.js +3 -3
- package/dist/src/cli/commands/flow-zone.js +8 -17
- package/dist/src/cli/commands/folder.js +12 -20
- package/dist/src/cli/commands/future.js +7 -10
- package/dist/src/cli/commands/group.js +7 -11
- package/dist/src/cli/commands/insight.js +7 -11
- package/dist/src/cli/commands/job.js +17 -26
- package/dist/src/cli/commands/knowledge-bank.js +5 -6
- package/dist/src/cli/commands/llm.js +5 -8
- package/dist/src/cli/commands/macro.js +9 -16
- package/dist/src/cli/commands/meaning.js +7 -11
- package/dist/src/cli/commands/metrics.js +7 -10
- package/dist/src/cli/commands/ml-task.js +12 -20
- package/dist/src/cli/commands/model-evaluation-store.js +7 -11
- package/dist/src/cli/commands/notebook.js +15 -27
- package/dist/src/cli/commands/plugin.js +35 -68
- package/dist/src/cli/commands/project-deployer.js +10 -22
- package/dist/src/cli/commands/project-folder.js +10 -17
- package/dist/src/cli/commands/project-git.js +38 -70
- package/dist/src/cli/commands/project-library.js +15 -23
- package/dist/src/cli/commands/project.js +9 -26
- package/dist/src/cli/commands/recipe.d.ts +16 -0
- package/dist/src/cli/commands/recipe.js +83 -94
- package/dist/src/cli/commands/saved-model.js +23 -39
- package/dist/src/cli/commands/scenario.js +20 -34
- package/dist/src/cli/commands/sql.js +4 -4
- package/dist/src/cli/commands/statistics.js +11 -18
- package/dist/src/cli/commands/streaming-endpoint.js +7 -11
- package/dist/src/cli/commands/user.js +11 -22
- package/dist/src/cli/commands/variable.js +3 -4
- package/dist/src/cli/commands/webapp.js +10 -16
- package/dist/src/cli/commands/wiki.js +9 -13
- package/dist/src/cli/commands/workspace.js +8 -14
- package/dist/src/cli/contract.d.ts +5 -15
- package/dist/src/cli/contract.js +157 -254
- package/dist/src/cli/doctor.js +1 -0
- package/dist/src/cli/env.d.ts +2 -0
- package/dist/src/cli/env.js +16 -1
- package/dist/src/cli/flags.d.ts +1 -0
- package/dist/src/cli/flags.js +4 -9
- package/dist/src/cli/helpers/app-permissions.js +7 -5
- package/dist/src/cli/helpers/flow-zone.js +8 -6
- package/dist/src/cli/helpers/recipe.js +2 -1
- package/dist/src/cli/syntax.d.ts +83 -0
- package/dist/src/cli/syntax.js +217 -0
- package/dist/src/cli/types.d.ts +3 -0
- package/dist/src/cli/usage.d.ts +1 -1
- package/dist/src/cli/usage.js +4 -2
- package/dist/src/cli/version.d.ts +0 -2
- package/dist/src/cli/version.js +6 -7
- package/dist/src/cli.js +132 -274
- package/dist/src/client.d.ts +2 -1
- package/dist/src/client.js +32 -17
- package/dist/src/errors.d.ts +12 -1
- package/dist/src/errors.js +28 -3
- package/dist/src/index.d.ts +1 -3
- package/dist/src/index.js +2 -2
- package/dist/src/resources/api-services.js +2 -3
- package/dist/src/resources/applications.js +2 -4
- package/dist/src/resources/base.d.ts +2 -0
- package/dist/src/resources/base.js +14 -2
- package/dist/src/resources/code-envs.js +3 -5
- package/dist/src/resources/data-quality.js +14 -13
- package/dist/src/resources/datasets.d.ts +13 -0
- package/dist/src/resources/datasets.js +5 -4
- package/dist/src/resources/flow-zones.js +4 -2
- package/dist/src/resources/folders.js +4 -2
- package/dist/src/resources/futures.js +1 -3
- package/dist/src/resources/insights.js +3 -2
- package/dist/src/resources/jobs.js +4 -6
- package/dist/src/resources/macros.d.ts +1 -1
- package/dist/src/resources/macros.js +3 -7
- package/dist/src/resources/notebooks.js +2 -3
- package/dist/src/resources/project-git.js +9 -11
- package/dist/src/resources/project-library.d.ts +0 -2
- package/dist/src/resources/project-library.js +2 -7
- package/dist/src/resources/projects.js +4 -3
- package/dist/src/resources/recipes.d.ts +28 -0
- package/dist/src/resources/recipes.js +117 -89
- package/dist/src/resources/saved-models.js +1 -13
- package/dist/src/resources/scenarios.js +1 -3
- package/dist/src/resources/sql.js +9 -8
- package/dist/src/resources/statistics.js +3 -4
- package/dist/src/resources/variables.js +2 -1
- package/dist/src/resources/webapps.js +2 -3
- package/dist/src/schemas.d.ts +1 -2
- package/dist/src/schemas.js +1 -1
- package/dist/src/skill.js +6 -7
- package/dist/src/utils/cleanup-ledger.js +9 -8
- package/dist/src/utils/deep-merge.js +2 -4
- package/dist/src/utils/flow-map.js +1 -6
- package/dist/src/utils/polling.d.ts +3 -0
- package/dist/src/utils/polling.js +3 -0
- package/dist/src/utils/project-archive.js +10 -14
- package/dist/src/utils/project-incarnation.js +3 -7
- package/dist/src/utils/records.d.ts +4 -0
- package/dist/src/utils/records.js +8 -0
- package/dist/src/utils/stable-hash.d.ts +3 -1
- package/dist/src/utils/stable-hash.js +2 -0
- package/package.json +10 -14
- package/plugin.json +1 -1
- package/skills/dataiku-dss/SKILL.md +3 -4
- package/skills/dataiku-dss/references/authentication.md +3 -3
- package/skills/dataiku-dss/references/coding.md +1 -1
- package/skills/dataiku-dss/references/discovery.md +1 -1
- package/skills/dataiku-dss/references/mutations.md +0 -1
- package/dist/src/utils/pagination.d.ts +0 -8
- package/dist/src/utils/pagination.js +0 -23
- package/packages/types/dist/index.d.ts +0 -1062
- package/packages/types/dist/index.js +0 -871
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { requiredJsonInput, } from "../coerce.js";
|
|
2
2
|
import { executionMode, } from "../flags.js";
|
|
3
3
|
import { encodedProjectEndpoint, planResult, } from "../output.js";
|
|
4
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
4
5
|
import { requireArgs, } from "../usage.js";
|
|
5
6
|
const STATISTICS_PLAN_EXIT_CODES = { usage: 1, error: 2, transient: 3, };
|
|
6
7
|
const STATISTICS_FUTURE_PLAN_EXIT_CODES = {
|
|
@@ -28,28 +29,26 @@ function statisticsPlan(action, options) {
|
|
|
28
29
|
plannedAndDryRun: true,
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
|
-
export const statisticsCommands = {
|
|
32
|
+
export const statisticsCommands = withUsage("statistics", {
|
|
32
33
|
"list-worksheets": {
|
|
33
34
|
handler: (c, a, f) => {
|
|
34
|
-
requireArgs(a, 1, "
|
|
35
|
+
requireArgs(a, 1, commandUsage("statistics", "list-worksheets"));
|
|
35
36
|
return c.statistics.listWorksheets(a[0], f["project-key"]);
|
|
36
37
|
},
|
|
37
|
-
usage: "dss statistics list-worksheets <dataset> [--project-key KEY]",
|
|
38
38
|
description: "List EDA statistics worksheets for a dataset.",
|
|
39
39
|
examples: ["dss statistics list-worksheets customers",],
|
|
40
40
|
},
|
|
41
41
|
"get-worksheet": {
|
|
42
42
|
handler: (c, a, f) => {
|
|
43
|
-
requireArgs(a, 2, "
|
|
43
|
+
requireArgs(a, 2, commandUsage("statistics", "get-worksheet"));
|
|
44
44
|
return c.statistics.getWorksheet(a[0], a[1], f["project-key"]);
|
|
45
45
|
},
|
|
46
|
-
usage: "dss statistics get-worksheet <dataset> <worksheetId> [--project-key KEY]",
|
|
47
46
|
description: "Get one statistics worksheet definition.",
|
|
48
47
|
examples: ["dss statistics get-worksheet customers ws_1",],
|
|
49
48
|
},
|
|
50
49
|
"create-worksheet": {
|
|
51
50
|
handler: async (c, a, f) => {
|
|
52
|
-
requireArgs(a, 1, "
|
|
51
|
+
requireArgs(a, 1, commandUsage("statistics", "create-worksheet"));
|
|
53
52
|
const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (worksheet definition).");
|
|
54
53
|
const projectKey = f["project-key"];
|
|
55
54
|
if (executionMode(f).dryRun) {
|
|
@@ -62,7 +61,6 @@ export const statisticsCommands = {
|
|
|
62
61
|
}
|
|
63
62
|
return c.statistics.createWorksheet(a[0], body, projectKey);
|
|
64
63
|
},
|
|
65
|
-
usage: "dss statistics create-worksheet <dataset> (--data JSON|--data-file PATH|--stdin) [--dry-run] [--project-key KEY]",
|
|
66
64
|
description: "Create a statistics worksheet from a JSON definition.",
|
|
67
65
|
examples: [
|
|
68
66
|
'dss statistics create-worksheet customers --data \'{"name":"Customer stats","dataSpec":{"inputDatasetSmartName":"customers","datasetSelection":{"partitionSelectionMethod":"ALL","maxRecords":30000,"samplingMethod":"FULL"}}}\'',
|
|
@@ -70,7 +68,7 @@ export const statisticsCommands = {
|
|
|
70
68
|
},
|
|
71
69
|
"update-worksheet": {
|
|
72
70
|
handler: async (c, a, f) => {
|
|
73
|
-
requireArgs(a, 2, "
|
|
71
|
+
requireArgs(a, 2, commandUsage("statistics", "update-worksheet"));
|
|
74
72
|
const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (worksheet definition).");
|
|
75
73
|
const projectKey = f["project-key"];
|
|
76
74
|
if (executionMode(f).dryRun) {
|
|
@@ -83,13 +81,12 @@ export const statisticsCommands = {
|
|
|
83
81
|
}
|
|
84
82
|
return c.statistics.updateWorksheet(a[0], a[1], body, projectKey);
|
|
85
83
|
},
|
|
86
|
-
usage: "dss statistics update-worksheet <dataset> <worksheetId> (--data JSON|--data-file PATH|--stdin) [--dry-run] [--project-key KEY]",
|
|
87
84
|
description: "Replace a statistics worksheet definition.",
|
|
88
85
|
examples: ["dss statistics update-worksheet customers ws_1 --data-file ws.json",],
|
|
89
86
|
},
|
|
90
87
|
"delete-worksheet": {
|
|
91
88
|
handler: async (c, a, f) => {
|
|
92
|
-
requireArgs(a, 2, "
|
|
89
|
+
requireArgs(a, 2, commandUsage("statistics", "delete-worksheet"));
|
|
93
90
|
const projectKey = f["project-key"];
|
|
94
91
|
if (executionMode(f).dryRun) {
|
|
95
92
|
return statisticsPlan("delete-worksheet", {
|
|
@@ -101,13 +98,12 @@ export const statisticsCommands = {
|
|
|
101
98
|
await c.statistics.deleteWorksheet(a[0], a[1], projectKey);
|
|
102
99
|
return { deleted: a[1], };
|
|
103
100
|
},
|
|
104
|
-
usage: "dss statistics delete-worksheet <dataset> <worksheetId> [--dry-run] [--project-key KEY]",
|
|
105
101
|
description: "Delete a statistics worksheet.",
|
|
106
102
|
examples: ["dss statistics delete-worksheet customers ws_1",],
|
|
107
103
|
},
|
|
108
104
|
"run-worksheet": {
|
|
109
105
|
handler: async (c, a, f) => {
|
|
110
|
-
requireArgs(a, 2, "
|
|
106
|
+
requireArgs(a, 2, commandUsage("statistics", "run-worksheet"));
|
|
111
107
|
const projectKey = f["project-key"];
|
|
112
108
|
if (executionMode(f).dryRun) {
|
|
113
109
|
return statisticsPlan("run-worksheet", {
|
|
@@ -119,13 +115,12 @@ export const statisticsCommands = {
|
|
|
119
115
|
}
|
|
120
116
|
return c.statistics.runWorksheet(a[0], a[1], projectKey);
|
|
121
117
|
},
|
|
122
|
-
usage: "dss statistics run-worksheet <dataset> <worksheetId> [--dry-run] [--project-key KEY]",
|
|
123
118
|
description: "Run a statistics worksheet and return the DSS future response.",
|
|
124
119
|
examples: ["dss statistics run-worksheet customers ws_1",],
|
|
125
120
|
},
|
|
126
121
|
"run-card": {
|
|
127
122
|
handler: async (c, a, f) => {
|
|
128
|
-
requireArgs(a, 2, "
|
|
123
|
+
requireArgs(a, 2, commandUsage("statistics", "run-card"));
|
|
129
124
|
const card = requiredJsonInput(f, "--data, --data-file, or --stdin is required (card settings).");
|
|
130
125
|
const projectKey = f["project-key"];
|
|
131
126
|
if (executionMode(f).dryRun) {
|
|
@@ -139,13 +134,12 @@ export const statisticsCommands = {
|
|
|
139
134
|
}
|
|
140
135
|
return c.statistics.runCard(a[0], a[1], card, projectKey);
|
|
141
136
|
},
|
|
142
|
-
usage: "dss statistics run-card <dataset> <worksheetId> (--data JSON|--data-file PATH|--stdin) [--dry-run] [--project-key KEY]",
|
|
143
137
|
description: "Run a single card in a worksheet context.",
|
|
144
138
|
examples: ["dss statistics run-card customers ws_1 --data-file card.json",],
|
|
145
139
|
},
|
|
146
140
|
"run-computation": {
|
|
147
141
|
handler: async (c, a, f) => {
|
|
148
|
-
requireArgs(a, 2, "
|
|
142
|
+
requireArgs(a, 2, commandUsage("statistics", "run-computation"));
|
|
149
143
|
const computation = requiredJsonInput(f, "--data, --data-file, or --stdin is required (computation settings).");
|
|
150
144
|
const projectKey = f["project-key"];
|
|
151
145
|
if (executionMode(f).dryRun) {
|
|
@@ -159,8 +153,7 @@ export const statisticsCommands = {
|
|
|
159
153
|
}
|
|
160
154
|
return c.statistics.runComputation(a[0], a[1], computation, projectKey);
|
|
161
155
|
},
|
|
162
|
-
usage: "dss statistics run-computation <dataset> <worksheetId> (--data JSON|--data-file PATH|--stdin) [--dry-run] [--project-key KEY]",
|
|
163
156
|
description: "Run a single computation in a worksheet context.",
|
|
164
157
|
examples: ["dss statistics run-computation customers ws_1 --data-file comp.json",],
|
|
165
158
|
},
|
|
166
|
-
};
|
|
159
|
+
});
|
|
@@ -1,50 +1,46 @@
|
|
|
1
1
|
import { jsonInput, requiredJsonInput, } from "../coerce.js";
|
|
2
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
2
3
|
import { requireArgs, } from "../usage.js";
|
|
3
|
-
export const streamingEndpointCommands = {
|
|
4
|
+
export const streamingEndpointCommands = withUsage("streaming-endpoint", {
|
|
4
5
|
list: {
|
|
5
6
|
handler: (c, _a, f) => c.streamingEndpoints.list(f["project-key"]),
|
|
6
|
-
usage: "dss streaming-endpoint list [--project-key KEY]",
|
|
7
7
|
description: "List streaming endpoints in a project.",
|
|
8
8
|
examples: ["dss streaming-endpoint list",],
|
|
9
9
|
},
|
|
10
10
|
get: {
|
|
11
11
|
handler: (c, a, f) => {
|
|
12
|
-
requireArgs(a, 1, "
|
|
12
|
+
requireArgs(a, 1, commandUsage("streaming-endpoint", "get"));
|
|
13
13
|
return c.streamingEndpoints.getSettings(a[0], f["project-key"]);
|
|
14
14
|
},
|
|
15
|
-
usage: "dss streaming-endpoint get <id> [--project-key KEY]",
|
|
16
15
|
description: "Get a streaming endpoint's settings.",
|
|
17
16
|
examples: ["dss streaming-endpoint get my-stream",],
|
|
18
17
|
},
|
|
19
18
|
create: {
|
|
20
19
|
handler: (c, a, f) => {
|
|
21
|
-
requireArgs(a, 2, "
|
|
20
|
+
requireArgs(a, 2, commandUsage("streaming-endpoint", "create"));
|
|
22
21
|
const body = jsonInput(f) ?? {};
|
|
23
22
|
return c.streamingEndpoints.create(a[0], a[1], body, f["project-key"]);
|
|
24
23
|
},
|
|
25
|
-
usage: "dss streaming-endpoint create <id> <type> [--data JSON|--data-file PATH|--stdin] [--project-key KEY]",
|
|
26
24
|
description: "Create a streaming endpoint of the given type.",
|
|
27
25
|
examples: ["dss streaming-endpoint create my-stream kafka",],
|
|
28
26
|
},
|
|
29
27
|
"update-settings": {
|
|
30
28
|
handler: async (c, a, f) => {
|
|
31
|
-
requireArgs(a, 1, "
|
|
29
|
+
requireArgs(a, 1, commandUsage("streaming-endpoint", "update-settings"));
|
|
32
30
|
const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (endpoint settings).");
|
|
33
31
|
await c.streamingEndpoints.updateSettings(a[0], body, f["project-key"]);
|
|
34
32
|
return { updated: a[0], };
|
|
35
33
|
},
|
|
36
|
-
usage: "dss streaming-endpoint update-settings <id> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
|
|
37
34
|
description: "Replace a streaming endpoint's settings.",
|
|
38
35
|
examples: ["dss streaming-endpoint update-settings my-stream --data-file settings.json",],
|
|
39
36
|
},
|
|
40
37
|
delete: {
|
|
41
38
|
handler: async (c, a, f) => {
|
|
42
|
-
requireArgs(a, 1, "
|
|
39
|
+
requireArgs(a, 1, commandUsage("streaming-endpoint", "delete"));
|
|
43
40
|
await c.streamingEndpoints.delete(a[0], f["project-key"]);
|
|
44
41
|
return { deleted: a[0], };
|
|
45
42
|
},
|
|
46
|
-
usage: "dss streaming-endpoint delete <id> [--project-key KEY]",
|
|
47
43
|
description: "Delete a streaming endpoint.",
|
|
48
44
|
examples: ["dss streaming-endpoint delete my-stream",],
|
|
49
45
|
},
|
|
50
|
-
};
|
|
46
|
+
});
|
|
@@ -2,6 +2,7 @@ import { normalizeSecretKey, sanitizeSecrets, } from "../../utils/secret-sanitiz
|
|
|
2
2
|
import { requiredJsonInput, splitCsvFlag, } from "../coerce.js";
|
|
3
3
|
import { executionMode, } from "../flags.js";
|
|
4
4
|
import { readIfExists, skipResult, } from "../output.js";
|
|
5
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
5
6
|
import { requireArgs, UsageError, } from "../usage.js";
|
|
6
7
|
/** Credential-bearing user keys, matched after stripping -/_ and lowercasing. */
|
|
7
8
|
const SENSITIVE_USER_NORMALIZED_KEYS = {
|
|
@@ -77,26 +78,24 @@ function requireLogin(value, usage) {
|
|
|
77
78
|
}
|
|
78
79
|
return trimmed;
|
|
79
80
|
}
|
|
80
|
-
export const userCommands = {
|
|
81
|
+
export const userCommands = withUsage("user", {
|
|
81
82
|
list: {
|
|
82
83
|
handler: (c, _a, f) => c.users.list(f["connected"] === true ? { connected: true, } : undefined),
|
|
83
|
-
usage: "dss user list [--connected]",
|
|
84
84
|
description: "List DSS users (admin). --connected reports currently connected users via WebSockets, which may under-report when WebSockets are disabled.",
|
|
85
85
|
examples: ["dss user list", "dss user list --connected",],
|
|
86
86
|
},
|
|
87
87
|
get: {
|
|
88
88
|
handler: (c, a) => {
|
|
89
|
-
const usage = "
|
|
89
|
+
const usage = commandUsage("user", "get");
|
|
90
90
|
requireArgs(a, 1, usage);
|
|
91
91
|
return c.users.get(requireLogin(a[0], usage));
|
|
92
92
|
},
|
|
93
|
-
usage: "dss user get <login>",
|
|
94
93
|
description: "Get a DSS user (admin).",
|
|
95
94
|
examples: ["dss user get admin",],
|
|
96
95
|
},
|
|
97
96
|
create: {
|
|
98
97
|
handler: async (c, _a, f) => {
|
|
99
|
-
const usage = "
|
|
98
|
+
const usage = commandUsage("user", "create");
|
|
100
99
|
const body = requiredUserJson(f, usage);
|
|
101
100
|
if (executionMode(f).dryRun) {
|
|
102
101
|
return {
|
|
@@ -112,7 +111,6 @@ export const userCommands = {
|
|
|
112
111
|
const result = await c.users.create(body);
|
|
113
112
|
return sanitizeUserSecrets(result, userSecretsFromBody(body));
|
|
114
113
|
},
|
|
115
|
-
usage: "dss user create (--data JSON|--data-file PATH|--stdin) [--dry-run]",
|
|
116
114
|
description: 'Create a DSS user (admin). The JSON body follows the DSS User schema, e.g. {"login":"UserA","sourceType":"LOCAL","displayName":"User A","groups":[],"userProfile":"DATA_ANALYST","password":"..."}. Secrets are never echoed in output.',
|
|
117
115
|
examples: [
|
|
118
116
|
`dss user create --data '{"login":"UserA","sourceType":"LOCAL","displayName":"User A","groups":[],"userProfile":"DATA_ANALYST","password":"s3cret"}'`,
|
|
@@ -120,7 +118,7 @@ export const userCommands = {
|
|
|
120
118
|
},
|
|
121
119
|
update: {
|
|
122
120
|
handler: async (c, a, f) => {
|
|
123
|
-
const usage = "
|
|
121
|
+
const usage = commandUsage("user", "update");
|
|
124
122
|
requireArgs(a, 1, usage);
|
|
125
123
|
const login = requireLogin(a[0], usage);
|
|
126
124
|
const body = requiredUserJson(f, usage);
|
|
@@ -139,7 +137,6 @@ export const userCommands = {
|
|
|
139
137
|
const result = await c.users.update(login, body);
|
|
140
138
|
return sanitizeUserSecrets(result, userSecretsFromBody(body));
|
|
141
139
|
},
|
|
142
|
-
usage: "dss user update <login> (--data JSON|--data-file PATH|--stdin) [--dry-run]",
|
|
143
140
|
description: "Update a DSS user (admin). The body MUST be the User object obtained from `dss user get` (PUT semantics); pass undocumented attributes through unchanged. Use --dry-run to preview the merged result without writing.",
|
|
144
141
|
examples: [
|
|
145
142
|
`dss user update UserA --data '{"login":"UserA","displayName":"User A2","groups":["administrators"],"codeAllowed":true}'`,
|
|
@@ -147,7 +144,7 @@ export const userCommands = {
|
|
|
147
144
|
},
|
|
148
145
|
delete: {
|
|
149
146
|
handler: async (c, a, f) => {
|
|
150
|
-
const usage = "
|
|
147
|
+
const usage = commandUsage("user", "delete");
|
|
151
148
|
requireArgs(a, 1, usage);
|
|
152
149
|
const login = requireLogin(a[0], usage);
|
|
153
150
|
if (executionMode(f).dryRun) {
|
|
@@ -170,13 +167,12 @@ export const userCommands = {
|
|
|
170
167
|
}
|
|
171
168
|
return c.users.delete(login);
|
|
172
169
|
},
|
|
173
|
-
usage: "dss user delete <login> [--if-exists] [--dry-run]",
|
|
174
170
|
description: "Delete a DSS user (admin). Destructive and irreversible.",
|
|
175
171
|
examples: ["dss user delete UserA", "dss user delete UserA --if-exists",],
|
|
176
172
|
},
|
|
177
173
|
resync: {
|
|
178
174
|
handler: async (c, a, f) => {
|
|
179
|
-
const usage = "
|
|
175
|
+
const usage = commandUsage("user", "resync");
|
|
180
176
|
requireArgs(a, 1, usage);
|
|
181
177
|
const login = requireLogin(a[0], usage);
|
|
182
178
|
if (executionMode(f).dryRun) {
|
|
@@ -191,7 +187,6 @@ export const userCommands = {
|
|
|
191
187
|
}
|
|
192
188
|
return c.users.resync(login);
|
|
193
189
|
},
|
|
194
|
-
usage: "dss user resync <login> [--dry-run]",
|
|
195
190
|
description: "Resync one DSS user (admin). Returns a DSS future; poll with `dss future wait <jobId>` when hasResult is false.",
|
|
196
191
|
examples: ["dss user resync UserA",],
|
|
197
192
|
},
|
|
@@ -199,7 +194,7 @@ export const userCommands = {
|
|
|
199
194
|
handler: async (c, _a, f) => {
|
|
200
195
|
const logins = splitCsvFlag(f["logins"]);
|
|
201
196
|
if (logins.length === 0) {
|
|
202
|
-
throw new UsageError(
|
|
197
|
+
throw new UsageError(`--logins is required. Usage: ${commandUsage("user", "resync-multi")}`, "missing_required_flag");
|
|
203
198
|
}
|
|
204
199
|
if (executionMode(f).dryRun) {
|
|
205
200
|
return {
|
|
@@ -214,7 +209,6 @@ export const userCommands = {
|
|
|
214
209
|
}
|
|
215
210
|
return c.users.resyncMulti(logins);
|
|
216
211
|
},
|
|
217
|
-
usage: "dss user resync-multi --logins CSV [--dry-run]",
|
|
218
212
|
description: "Resync multiple DSS users (admin). Returns a DSS future.",
|
|
219
213
|
examples: ["dss user resync-multi --logins user1,user2,user3",],
|
|
220
214
|
},
|
|
@@ -232,7 +226,6 @@ export const userCommands = {
|
|
|
232
226
|
}
|
|
233
227
|
return c.users.externalUsers();
|
|
234
228
|
},
|
|
235
|
-
usage: "dss user external-users [--dry-run]",
|
|
236
229
|
description: "Fetch externally sourced users and their provisioning status (admin). Returns a DSS future whose result is the external user list when hasResult is true.",
|
|
237
230
|
examples: ["dss user external-users",],
|
|
238
231
|
},
|
|
@@ -250,13 +243,12 @@ export const userCommands = {
|
|
|
250
243
|
}
|
|
251
244
|
return c.users.externalGroups();
|
|
252
245
|
},
|
|
253
|
-
usage: "dss user external-groups [--dry-run]",
|
|
254
246
|
description: "Fetch externally sourced groups (admin). Returns a DSS future whose result is the external group name list when hasResult is true.",
|
|
255
247
|
examples: ["dss user external-groups",],
|
|
256
248
|
},
|
|
257
249
|
provision: {
|
|
258
250
|
handler: async (c, _a, f) => {
|
|
259
|
-
const usage = "
|
|
251
|
+
const usage = commandUsage("user", "provision");
|
|
260
252
|
const body = requiredJsonInput(f, `--data, --data-file, or --stdin is required (provisioning request). Usage: ${usage}`);
|
|
261
253
|
if (executionMode(f).dryRun) {
|
|
262
254
|
return {
|
|
@@ -271,7 +263,6 @@ export const userCommands = {
|
|
|
271
263
|
}
|
|
272
264
|
return c.users.provision(body);
|
|
273
265
|
},
|
|
274
|
-
usage: "dss user provision (--data JSON|--data-file PATH|--stdin) [--dry-run]",
|
|
275
266
|
description: "Provision users from an external source (admin). Body is the documented {userSourceType, users[]} request; returns a DSS future with a provisioning summary.",
|
|
276
267
|
examples: [
|
|
277
268
|
`dss user provision --data '{"userSourceType":"AZURE_AD","users":[{"login":"bob","displayName":"Bob","sourceGroupNames":["externalGroupA"],"dkuGroupNames":["dssGroupA"]}]}'`,
|
|
@@ -279,18 +270,16 @@ export const userCommands = {
|
|
|
279
270
|
},
|
|
280
271
|
activity: {
|
|
281
272
|
handler: (c) => c.users.activityAll(),
|
|
282
|
-
usage: "dss user activity",
|
|
283
273
|
description: "Get last activity timestamps for all DSS users (admin).",
|
|
284
274
|
examples: ["dss user activity",],
|
|
285
275
|
},
|
|
286
276
|
"activity-get": {
|
|
287
277
|
handler: (c, a) => {
|
|
288
|
-
const usage = "
|
|
278
|
+
const usage = commandUsage("user", "activity-get");
|
|
289
279
|
requireArgs(a, 1, usage);
|
|
290
280
|
return c.users.activity(requireLogin(a[0], usage));
|
|
291
281
|
},
|
|
292
|
-
usage: "dss user activity-get <login>",
|
|
293
282
|
description: "Get last activity timestamps for one DSS user (admin).",
|
|
294
283
|
examples: ["dss user activity-get UserA",],
|
|
295
284
|
},
|
|
296
|
-
};
|
|
285
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { json, } from "../coerce.js";
|
|
2
2
|
import { executionMode, } from "../flags.js";
|
|
3
|
+
import { withUsage, } from "../syntax.js";
|
|
3
4
|
import { UsageError, } from "../usage.js";
|
|
4
|
-
export const variableCommands = {
|
|
5
|
+
export const variableCommands = withUsage("variable", {
|
|
5
6
|
get: {
|
|
6
7
|
handler: (c, _a, f) => c.variables.get(f["project-key"]),
|
|
7
|
-
usage: "dss variable get [--project-key KEY]",
|
|
8
8
|
description: "Get project variables (standard and local).",
|
|
9
9
|
examples: ["dss variable get", "dss variable get --project-key MYPROJ",],
|
|
10
10
|
},
|
|
@@ -40,11 +40,10 @@ export const variableCommands = {
|
|
|
40
40
|
projectKey: pk,
|
|
41
41
|
});
|
|
42
42
|
},
|
|
43
|
-
usage: `dss variable set (--standard '{"k":"v"}'|--local '{"k":"v"}') [--replace] [--dry-run] [--project-key KEY]`,
|
|
44
43
|
description: "Set project variables via JSON merge (or full replace with --replace).",
|
|
45
44
|
examples: [
|
|
46
45
|
'dss variable set --standard \'{"env":"staging"}\' --dry-run',
|
|
47
46
|
"dss variable set --local '{\"debug\":true}' --replace",
|
|
48
47
|
],
|
|
49
48
|
},
|
|
50
|
-
};
|
|
49
|
+
});
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
import { ClientValidationError, } from "../../errors.js";
|
|
2
2
|
import { deepMerge, } from "../../utils/deep-merge.js";
|
|
3
|
-
import { stableHash, } from "../../utils/stable-hash.js";
|
|
3
|
+
import { SHA256_HEX_PATTERN, stableHash, } from "../../utils/stable-hash.js";
|
|
4
4
|
import { num, requiredJsonInput, } from "../coerce.js";
|
|
5
5
|
import { executionMode, } from "../flags.js";
|
|
6
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
6
7
|
import { requireArgs, } from "../usage.js";
|
|
7
|
-
const UPDATE_SETTINGS_USAGE = "
|
|
8
|
-
const RESTART_USAGE = "
|
|
8
|
+
const UPDATE_SETTINGS_USAGE = commandUsage("webapp", "update-settings");
|
|
9
|
+
const RESTART_USAGE = commandUsage("webapp", "restart-backend");
|
|
9
10
|
function validateExpectHash(value) {
|
|
10
11
|
if (value === undefined || value === false)
|
|
11
12
|
return undefined;
|
|
12
|
-
if (typeof value !== "string" ||
|
|
13
|
+
if (typeof value !== "string" || !SHA256_HEX_PATTERN.test(value)) {
|
|
13
14
|
throw new ClientValidationError("Expected webapp hash must be a 64-character SHA-256 hex digest.", "validation_failed", "Run this update with --dry-run and capture currentHash before retrying.");
|
|
14
15
|
}
|
|
15
16
|
return value;
|
|
16
17
|
}
|
|
17
|
-
export const webappCommands = {
|
|
18
|
+
export const webappCommands = withUsage("webapp", {
|
|
18
19
|
list: {
|
|
19
20
|
handler: (c, _a, f) => c.webapps.list(f["project-key"]),
|
|
20
|
-
usage: "dss webapp list [--project-key KEY]",
|
|
21
21
|
description: "List webapps in a project.",
|
|
22
22
|
examples: ["dss webapp list",],
|
|
23
23
|
},
|
|
24
24
|
"get-settings": {
|
|
25
25
|
handler: (c, a, f) => {
|
|
26
|
-
requireArgs(a, 1, "
|
|
26
|
+
requireArgs(a, 1, commandUsage("webapp", "get-settings"));
|
|
27
27
|
return c.webapps.getSettings(a[0], f["project-key"]);
|
|
28
28
|
},
|
|
29
|
-
usage: "dss webapp get-settings <webappId> [--project-key KEY]",
|
|
30
29
|
description: "Get a webapp's settings.",
|
|
31
30
|
examples: ["dss webapp get-settings WEBAPP_ID",],
|
|
32
31
|
},
|
|
@@ -35,7 +34,6 @@ export const webappCommands = {
|
|
|
35
34
|
const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (webapp definition).");
|
|
36
35
|
return c.webapps.create(body, f["project-key"]);
|
|
37
36
|
},
|
|
38
|
-
usage: "dss webapp create (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
|
|
39
37
|
description: "Create a webapp from a JSON definition.",
|
|
40
38
|
examples: ["dss webapp create --data-file webapp.json",],
|
|
41
39
|
},
|
|
@@ -73,7 +71,6 @@ export const webappCommands = {
|
|
|
73
71
|
const updated = await c.webapps.updateSettings(a[0], body, projectKey, { expectHash, });
|
|
74
72
|
return { updated: a[0], ...updated, };
|
|
75
73
|
},
|
|
76
|
-
usage: UPDATE_SETTINGS_USAGE,
|
|
77
74
|
description: "Merge supplied fields into a webapp's settings (GET-merge-PUT) and PUT the full object, so fields outside the patch are never dropped. --expect-hash refuses the write when the object changed since it was fetched; --dry-run reports current, next, and both hashes without writing.",
|
|
78
75
|
examples: [
|
|
79
76
|
"dss webapp update-settings WEBAPP_ID --data-file webapp.json",
|
|
@@ -82,11 +79,10 @@ export const webappCommands = {
|
|
|
82
79
|
},
|
|
83
80
|
"stop-backend": {
|
|
84
81
|
handler: async (c, a, f) => {
|
|
85
|
-
requireArgs(a, 1, "
|
|
82
|
+
requireArgs(a, 1, commandUsage("webapp", "stop-backend"));
|
|
86
83
|
await c.webapps.stopBackend(a[0], f["project-key"]);
|
|
87
84
|
return { stopped: true, };
|
|
88
85
|
},
|
|
89
|
-
usage: "dss webapp stop-backend <webappId> [--project-key KEY]",
|
|
90
86
|
description: "Stop a webapp's backend.",
|
|
91
87
|
examples: ["dss webapp stop-backend WEBAPP_ID",],
|
|
92
88
|
},
|
|
@@ -103,7 +99,6 @@ export const webappCommands = {
|
|
|
103
99
|
const future = await c.webapps.startOrRestartBackend(a[0], projectKey);
|
|
104
100
|
return { restarted: true, future, };
|
|
105
101
|
},
|
|
106
|
-
usage: RESTART_USAGE,
|
|
107
102
|
description: "Start or restart a webapp's backend. The documented endpoint returns a restart future; --wait settles it and returns the FutureWaitResult.",
|
|
108
103
|
examples: [
|
|
109
104
|
"dss webapp restart-backend WEBAPP_ID",
|
|
@@ -112,11 +107,10 @@ export const webappCommands = {
|
|
|
112
107
|
},
|
|
113
108
|
"backend-state": {
|
|
114
109
|
handler: (c, a, f) => {
|
|
115
|
-
requireArgs(a, 1, "
|
|
110
|
+
requireArgs(a, 1, commandUsage("webapp", "backend-state"));
|
|
116
111
|
return c.webapps.getBackendState(a[0], f["project-key"]);
|
|
117
112
|
},
|
|
118
|
-
usage: "dss webapp backend-state <webappId> [--project-key KEY]",
|
|
119
113
|
description: "Get a webapp backend's runtime state.",
|
|
120
114
|
examples: ["dss webapp backend-state WEBAPP_ID",],
|
|
121
115
|
},
|
|
122
|
-
};
|
|
116
|
+
});
|
|
@@ -2,34 +2,33 @@ import { deepMerge, } from "../../utils/deep-merge.js";
|
|
|
2
2
|
import { jsonInput, textInput, } from "../coerce.js";
|
|
3
3
|
import { executionMode, } from "../flags.js";
|
|
4
4
|
import { readIfExists, skipResult, } from "../output.js";
|
|
5
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
5
6
|
import { requireArgs, UsageError, } from "../usage.js";
|
|
6
|
-
export const wikiCommands = {
|
|
7
|
+
export const wikiCommands = withUsage("wiki", {
|
|
7
8
|
settings: {
|
|
8
9
|
handler: (c, _a, f) => c.wiki.settings(f["project-key"]),
|
|
9
|
-
usage: "dss wiki settings [--project-key KEY]",
|
|
10
10
|
description: "Get project wiki settings and taxonomy.",
|
|
11
11
|
examples: ["dss wiki settings",],
|
|
12
12
|
},
|
|
13
13
|
list: {
|
|
14
14
|
handler: (c, _a, f) => c.wiki.list(f["project-key"]),
|
|
15
|
-
usage: "dss wiki list [--project-key KEY]",
|
|
16
15
|
description: "List wiki articles by walking the taxonomy.",
|
|
17
16
|
examples: ["dss wiki list",],
|
|
18
17
|
},
|
|
19
18
|
get: {
|
|
20
19
|
handler: (c, a, f) => {
|
|
21
|
-
requireArgs(a, 1, "
|
|
20
|
+
requireArgs(a, 1, commandUsage("wiki", "get"));
|
|
22
21
|
return c.wiki.get(a[0], f["project-key"]);
|
|
23
22
|
},
|
|
24
|
-
usage: "dss wiki get <id-or-name> [--project-key KEY]",
|
|
25
23
|
description: "Get a wiki article including markdown body.",
|
|
26
24
|
examples: ["dss wiki get ARTICLE_ID",],
|
|
27
25
|
},
|
|
28
26
|
create: {
|
|
29
27
|
handler: async (c, _a, f) => {
|
|
30
28
|
const name = f["name"];
|
|
31
|
-
if (!name)
|
|
32
|
-
throw new UsageError(
|
|
29
|
+
if (!name) {
|
|
30
|
+
throw new UsageError(`--name is required. Usage: ${commandUsage("wiki", "create")}`);
|
|
31
|
+
}
|
|
33
32
|
const content = textInput(f);
|
|
34
33
|
const pk = f["project-key"];
|
|
35
34
|
if (f["if-not-exists"] === true || executionMode(f).dryRun) {
|
|
@@ -60,7 +59,6 @@ export const wikiCommands = {
|
|
|
60
59
|
});
|
|
61
60
|
return { created: created.article.id, resource: "wiki", ...created, };
|
|
62
61
|
},
|
|
63
|
-
usage: "dss wiki create --name NAME [--parent ID] [--content TEXT|--file PATH] [--if-not-exists] [--dry-run] [--project-key KEY]",
|
|
64
62
|
description: "Create a wiki article, optionally with markdown content.",
|
|
65
63
|
examples: [
|
|
66
64
|
"dss wiki create --name 'Agent notes' --content '# Notes'",
|
|
@@ -69,7 +67,7 @@ export const wikiCommands = {
|
|
|
69
67
|
},
|
|
70
68
|
update: {
|
|
71
69
|
handler: async (c, a, f) => {
|
|
72
|
-
requireArgs(a, 1, "
|
|
70
|
+
requireArgs(a, 1, commandUsage("wiki", "update"));
|
|
73
71
|
const data = jsonInput(f);
|
|
74
72
|
const content = textInput(f);
|
|
75
73
|
const name = f["name"];
|
|
@@ -98,13 +96,12 @@ export const wikiCommands = {
|
|
|
98
96
|
projectKey: f["project-key"],
|
|
99
97
|
});
|
|
100
98
|
},
|
|
101
|
-
usage: "dss wiki update <id-or-name> (--name NAME | --content TEXT|--file PATH|--data JSON|--data-file PATH|--stdin) [--dry-run] [--project-key KEY]",
|
|
102
99
|
description: "Update wiki article metadata/body via merge.",
|
|
103
100
|
examples: ["dss wiki update ARTICLE_ID --content '# Updated' --dry-run",],
|
|
104
101
|
},
|
|
105
102
|
delete: {
|
|
106
103
|
handler: async (c, a, f) => {
|
|
107
|
-
requireArgs(a, 1, "
|
|
104
|
+
requireArgs(a, 1, commandUsage("wiki", "delete"));
|
|
108
105
|
const pk = f["project-key"];
|
|
109
106
|
if (executionMode(f).dryRun || f["if-exists"] === true) {
|
|
110
107
|
const current = await readIfExists(() => c.wiki.get(a[0], pk));
|
|
@@ -117,8 +114,7 @@ export const wikiCommands = {
|
|
|
117
114
|
await c.wiki.delete(a[0], pk);
|
|
118
115
|
return { deleted: a[0], resource: "wiki", };
|
|
119
116
|
},
|
|
120
|
-
usage: "dss wiki delete <id-or-name> [--if-exists] [--dry-run] [--project-key KEY]",
|
|
121
117
|
description: "Delete a wiki article.",
|
|
122
118
|
examples: ["dss wiki delete ARTICLE_ID --dry-run",],
|
|
123
119
|
},
|
|
124
|
-
};
|
|
120
|
+
});
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { requiredJsonInput, } from "../coerce.js";
|
|
2
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
2
3
|
import { requireArgs, } from "../usage.js";
|
|
3
|
-
export const workspaceCommands = {
|
|
4
|
+
export const workspaceCommands = withUsage("workspace", {
|
|
4
5
|
list: {
|
|
5
6
|
handler: (c) => c.workspaces.list(),
|
|
6
|
-
usage: "dss workspace list",
|
|
7
7
|
description: "List collaboration workspaces on the instance.",
|
|
8
8
|
examples: ["dss workspace list",],
|
|
9
9
|
},
|
|
10
10
|
get: {
|
|
11
11
|
handler: (c, a) => {
|
|
12
|
-
requireArgs(a, 1, "
|
|
12
|
+
requireArgs(a, 1, commandUsage("workspace", "get"));
|
|
13
13
|
return c.workspaces.get(a[0]);
|
|
14
14
|
},
|
|
15
|
-
usage: "dss workspace get <workspaceKey>",
|
|
16
15
|
description: "Get a workspace's settings.",
|
|
17
16
|
examples: ["dss workspace get MY_WS",],
|
|
18
17
|
},
|
|
@@ -21,48 +20,43 @@ export const workspaceCommands = {
|
|
|
21
20
|
const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (workspace definition).");
|
|
22
21
|
return c.workspaces.create(body);
|
|
23
22
|
},
|
|
24
|
-
usage: "dss workspace create (--data JSON|--data-file PATH|--stdin)",
|
|
25
23
|
description: "Create a collaboration workspace.",
|
|
26
24
|
examples: ["dss workspace create --data-file ws.json",],
|
|
27
25
|
},
|
|
28
26
|
"update-settings": {
|
|
29
27
|
handler: async (c, a, f) => {
|
|
30
|
-
requireArgs(a, 1, "
|
|
28
|
+
requireArgs(a, 1, commandUsage("workspace", "update-settings"));
|
|
31
29
|
const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (workspace settings).");
|
|
32
30
|
await c.workspaces.updateSettings(a[0], body);
|
|
33
31
|
return { updated: a[0], };
|
|
34
32
|
},
|
|
35
|
-
usage: "dss workspace update-settings <workspaceKey> (--data JSON|--data-file PATH|--stdin)",
|
|
36
33
|
description: "Replace a workspace's settings (admin).",
|
|
37
34
|
examples: ["dss workspace update-settings MY_WS --data-file ws.json",],
|
|
38
35
|
},
|
|
39
36
|
delete: {
|
|
40
37
|
handler: async (c, a) => {
|
|
41
|
-
requireArgs(a, 1, "
|
|
38
|
+
requireArgs(a, 1, commandUsage("workspace", "delete"));
|
|
42
39
|
await c.workspaces.delete(a[0]);
|
|
43
40
|
return { deleted: a[0], };
|
|
44
41
|
},
|
|
45
|
-
usage: "dss workspace delete <workspaceKey>",
|
|
46
42
|
description: "Delete a workspace (admin).",
|
|
47
43
|
examples: ["dss workspace delete MY_WS",],
|
|
48
44
|
},
|
|
49
45
|
"list-objects": {
|
|
50
46
|
handler: (c, a) => {
|
|
51
|
-
requireArgs(a, 1, "
|
|
47
|
+
requireArgs(a, 1, commandUsage("workspace", "list-objects"));
|
|
52
48
|
return c.workspaces.listObjects(a[0]);
|
|
53
49
|
},
|
|
54
|
-
usage: "dss workspace list-objects <workspaceKey>",
|
|
55
50
|
description: "List objects shared in a workspace.",
|
|
56
51
|
examples: ["dss workspace list-objects MY_WS",],
|
|
57
52
|
},
|
|
58
53
|
"add-object": {
|
|
59
54
|
handler: (c, a, f) => {
|
|
60
|
-
requireArgs(a, 1, "
|
|
55
|
+
requireArgs(a, 1, commandUsage("workspace", "add-object"));
|
|
61
56
|
const object = requiredJsonInput(f, "--data, --data-file, or --stdin is required (object definition).");
|
|
62
57
|
return c.workspaces.addObject(a[0], object);
|
|
63
58
|
},
|
|
64
|
-
usage: "dss workspace add-object <workspaceKey> (--data JSON|--data-file PATH|--stdin)",
|
|
65
59
|
description: "Add an object (link or DSS object) to a workspace.",
|
|
66
60
|
examples: ["dss workspace add-object MY_WS --data-file object.json",],
|
|
67
61
|
},
|
|
68
|
-
};
|
|
62
|
+
});
|