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,15 +1,14 @@
|
|
|
1
1
|
import { deepMerge, } from "../../utils/deep-merge.js";
|
|
2
|
+
import { isRecord, } from "../../utils/records.js";
|
|
2
3
|
import { compareStrings, stableHash, } from "../../utils/stable-hash.js";
|
|
3
4
|
import { jsonInput, num, schemaColumnsInput, unknownJsonInput, } from "../coerce.js";
|
|
4
5
|
import { executionMode, } from "../flags.js";
|
|
5
6
|
import { datasetSourceSummary, } from "../helpers/dataset.js";
|
|
6
7
|
import { moveCreatedItemsToZone, resolveFlowZoneIdFromFlags, } from "../helpers/flow-zone.js";
|
|
7
8
|
import { enqueueCliWarning, readIfExists, skipResult, } from "../output.js";
|
|
9
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
8
10
|
import { requireArgs, UsageError, } from "../usage.js";
|
|
9
11
|
const MAX_SCHEMA_DIFFERENCES = 50;
|
|
10
|
-
function isPlainObject(value) {
|
|
11
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12
|
-
}
|
|
13
12
|
function appendSchemaPath(parent, key) {
|
|
14
13
|
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key)
|
|
15
14
|
? (parent ? `${parent}.${key}` : key)
|
|
@@ -20,7 +19,7 @@ function collectSchemaDifferences(expected, actual, path, acc) {
|
|
|
20
19
|
// subtrees (any key order) match exactly and are never descended into.
|
|
21
20
|
if (stableHash(expected) === stableHash(actual))
|
|
22
21
|
return;
|
|
23
|
-
if (
|
|
22
|
+
if (isRecord(expected) && isRecord(actual)) {
|
|
24
23
|
const keys = [...new Set([...Object.keys(expected), ...Object.keys(actual),]),].sort(compareStrings);
|
|
25
24
|
for (const key of keys) {
|
|
26
25
|
const nextPath = appendSchemaPath(path, key);
|
|
@@ -97,82 +96,74 @@ export function compareDatasetSchemas(expected, actual) {
|
|
|
97
96
|
differencesTruncated: acc.items.length < acc.total,
|
|
98
97
|
};
|
|
99
98
|
}
|
|
100
|
-
export const datasetCommands = {
|
|
99
|
+
export const datasetCommands = withUsage("dataset", {
|
|
101
100
|
list: {
|
|
102
101
|
handler: (c, _a, f) => c.datasets.list(f["project-key"]),
|
|
103
|
-
usage: "dss dataset list [--project-key KEY]",
|
|
104
102
|
description: "List all datasets in a project.",
|
|
105
103
|
examples: ["dss dataset list", "dss dataset list --project-key MYPROJ",],
|
|
106
104
|
},
|
|
107
105
|
rename: {
|
|
108
106
|
handler: async (c, a, f) => {
|
|
109
|
-
requireArgs(a, 2, "
|
|
107
|
+
requireArgs(a, 2, commandUsage("dataset", "rename"));
|
|
110
108
|
await c.datasets.rename(a[0], a[1], f["project-key"]);
|
|
111
109
|
return { renamed: a[0], to: a[1], };
|
|
112
110
|
},
|
|
113
|
-
usage: "dss dataset rename <oldName> <newName> [--project-key KEY]",
|
|
114
111
|
description: "Rename a dataset (updates downstream flow references).",
|
|
115
112
|
examples: ["dss dataset rename old_ds new_ds",],
|
|
116
113
|
},
|
|
117
114
|
"list-partitions": {
|
|
118
115
|
handler: (c, a, f) => {
|
|
119
|
-
requireArgs(a, 1, "
|
|
116
|
+
requireArgs(a, 1, commandUsage("dataset", "list-partitions"));
|
|
120
117
|
return c.datasets.listPartitions(a[0], f["project-key"]);
|
|
121
118
|
},
|
|
122
|
-
usage: "dss dataset list-partitions <name> [--project-key KEY]",
|
|
123
119
|
description: "List the partitions of a partitioned dataset.",
|
|
124
120
|
examples: ["dss dataset list-partitions events",],
|
|
125
121
|
},
|
|
126
122
|
clear: {
|
|
127
123
|
handler: async (c, a, f) => {
|
|
128
|
-
requireArgs(a, 1, "
|
|
124
|
+
requireArgs(a, 1, commandUsage("dataset", "clear"));
|
|
129
125
|
const partitions = f["partitions"];
|
|
130
126
|
await c.datasets.clear(a[0], partitions, f["project-key"]);
|
|
131
127
|
return { cleared: a[0], partitions: partitions ?? "ALL", };
|
|
132
128
|
},
|
|
133
|
-
usage: "dss dataset clear <name> [--partitions SPEC] [--project-key KEY]",
|
|
134
129
|
description: "Clear a dataset's data (all, or a partition spec); keeps the dataset.",
|
|
135
130
|
examples: ["dss dataset clear staging", "dss dataset clear events --partitions 2024-01",],
|
|
136
131
|
},
|
|
137
132
|
get: {
|
|
138
133
|
handler: (c, a, f) => {
|
|
139
|
-
requireArgs(a, 1, "
|
|
134
|
+
requireArgs(a, 1, commandUsage("dataset", "get"));
|
|
140
135
|
return c.datasets.get(a[0], f["project-key"]);
|
|
141
136
|
},
|
|
142
|
-
usage: "dss dataset get <name> [--project-key KEY]",
|
|
143
137
|
description: "Get full settings for a dataset.",
|
|
144
138
|
examples: ["dss dataset get orders", "dss dataset get orders --project-key MYPROJ",],
|
|
145
139
|
},
|
|
146
140
|
schema: {
|
|
147
141
|
handler: (c, a, f) => {
|
|
148
|
-
requireArgs(a, 1, "
|
|
142
|
+
requireArgs(a, 1, commandUsage("dataset", "schema"));
|
|
149
143
|
return c.datasets.schema(a[0], f["project-key"]);
|
|
150
144
|
},
|
|
151
|
-
usage: "dss dataset schema <name> [--project-key KEY]",
|
|
152
145
|
description: "Show the column schema of a dataset.",
|
|
153
146
|
examples: ["dss dataset schema orders",],
|
|
154
147
|
},
|
|
155
148
|
source: {
|
|
156
149
|
handler: async (c, a, f) => {
|
|
157
|
-
requireArgs(a, 1, "
|
|
150
|
+
requireArgs(a, 1, commandUsage("dataset", "source"));
|
|
158
151
|
return datasetSourceSummary(await c.datasets.get(a[0], f["project-key"]));
|
|
159
152
|
},
|
|
160
|
-
usage: "dss dataset source <name> [--project-key KEY]",
|
|
161
153
|
description: "Show backing connection, catalog/schema/table, path, and format for a dataset.",
|
|
162
154
|
examples: ["dss dataset source orders",],
|
|
163
155
|
},
|
|
164
156
|
files: {
|
|
165
157
|
handler: (c, a, f) => {
|
|
166
|
-
requireArgs(a, 1, "
|
|
158
|
+
requireArgs(a, 1, commandUsage("dataset", "files"));
|
|
167
159
|
return c.datasets.listUploadedFiles(a[0], f["project-key"]);
|
|
168
160
|
},
|
|
169
|
-
usage: "dss dataset files <name> [--project-key KEY]",
|
|
170
161
|
description: "List files stored by an UploadedFiles dataset.",
|
|
171
162
|
examples: ["dss dataset files uploaded_input",],
|
|
172
163
|
},
|
|
173
164
|
"upload-file": {
|
|
174
165
|
handler: (c, a, f) => {
|
|
175
|
-
const usage = "
|
|
166
|
+
const usage = commandUsage("dataset", "upload-file");
|
|
176
167
|
requireArgs(a, 2, usage);
|
|
177
168
|
const fileName = f["file-name"];
|
|
178
169
|
if (!fileName || fileName.trim() === "") {
|
|
@@ -183,7 +174,6 @@ export const datasetCommands = {
|
|
|
183
174
|
projectKey: f["project-key"],
|
|
184
175
|
});
|
|
185
176
|
},
|
|
186
|
-
usage: "dss dataset upload-file <name> <localPath> --file-name NAME [--project-key KEY]",
|
|
187
177
|
description: "Add one new file to an UploadedFiles dataset and verify the stored byte length.",
|
|
188
178
|
examples: [
|
|
189
179
|
"dss dataset upload-file uploaded_input ./input.csv --file-name input.csv",
|
|
@@ -191,7 +181,7 @@ export const datasetCommands = {
|
|
|
191
181
|
},
|
|
192
182
|
"refresh-schema": {
|
|
193
183
|
handler: async (c, a, f) => {
|
|
194
|
-
const usage = "
|
|
184
|
+
const usage = commandUsage("dataset", "refresh-schema");
|
|
195
185
|
requireArgs(a, 1, usage);
|
|
196
186
|
const columns = schemaColumnsInput(f, usage);
|
|
197
187
|
const pk = f["project-key"];
|
|
@@ -209,7 +199,6 @@ export const datasetCommands = {
|
|
|
209
199
|
await c.datasets.updateSchema(a[0], columns, pk);
|
|
210
200
|
return { updated: a[0], resource: "dataset", schema: { columns, }, };
|
|
211
201
|
},
|
|
212
|
-
usage: "dss dataset refresh-schema <name> (--data JSON | --data-file PATH | --stdin) [--dry-run] [--project-key KEY]",
|
|
213
202
|
description: "Replace a dataset schema through the DSS schema endpoint.",
|
|
214
203
|
examples: [
|
|
215
204
|
`dss dataset refresh-schema orders --data '{"columns":[{"name":"id","type":"bigint"}]}' --dry-run`,
|
|
@@ -217,16 +206,15 @@ export const datasetCommands = {
|
|
|
217
206
|
},
|
|
218
207
|
"validate-build": {
|
|
219
208
|
handler: (c, a, f) => {
|
|
220
|
-
requireArgs(a, 1, "
|
|
209
|
+
requireArgs(a, 1, commandUsage("dataset", "validate-build"));
|
|
221
210
|
return c.datasets.validateBuildSettings(a[0], f["project-key"]);
|
|
222
211
|
},
|
|
223
|
-
usage: "dss dataset validate-build <name> [--project-key KEY]",
|
|
224
212
|
description: "Check common dataset settings that can make file-backed builds fail.",
|
|
225
213
|
examples: ["dss dataset validate-build orders",],
|
|
226
214
|
},
|
|
227
215
|
preview: {
|
|
228
216
|
handler: async (c, a, f) => {
|
|
229
|
-
const previewUsage = "
|
|
217
|
+
const previewUsage = commandUsage("dataset", "preview");
|
|
230
218
|
requireArgs(a, 1, previewUsage);
|
|
231
219
|
const maxRows = num(f["max-rows"], "--max-rows");
|
|
232
220
|
if (maxRows !== undefined && (!Number.isSafeInteger(maxRows) || maxRows <= 0 || maxRows > 500)) {
|
|
@@ -251,13 +239,12 @@ export const datasetCommands = {
|
|
|
251
239
|
}
|
|
252
240
|
return result;
|
|
253
241
|
},
|
|
254
|
-
usage: "dss dataset preview <name> [--max-rows N] [--rows N] [--project-key KEY] [--timeout MS]",
|
|
255
242
|
description: "Preview dataset rows (--rows is an alias for --max-rows). Returns { columns, rows, rowCount, truncated, limit }; when the dataset has more rows than the cap, truncated is true and a dataset_preview_truncated warning is written to stderr.",
|
|
256
243
|
examples: ["dss dataset preview orders", "dss dataset preview orders --rows 5",],
|
|
257
244
|
},
|
|
258
245
|
"assert-count": {
|
|
259
246
|
handler: async (c, a, f) => {
|
|
260
|
-
const assertUsage = "
|
|
247
|
+
const assertUsage = commandUsage("dataset", "assert-count");
|
|
261
248
|
requireArgs(a, 1, assertUsage);
|
|
262
249
|
const expected = num(f["expected"], "--expected");
|
|
263
250
|
if (expected === undefined || !Number.isSafeInteger(expected) || expected < 0) {
|
|
@@ -267,13 +254,12 @@ export const datasetCommands = {
|
|
|
267
254
|
const result = await c.datasets.assertRowCount(a[0], expected, f["project-key"]);
|
|
268
255
|
return { ...result, dataset: a[0], };
|
|
269
256
|
},
|
|
270
|
-
usage: "dss dataset assert-count <dataset> --expected N [--project-key KEY]",
|
|
271
257
|
description: "Stream the dataset and assert it holds exactly --expected rows, probing at most N+1 rows. Returns { satisfied, expected, count, exact }; a mismatch exits 4 with assertion_failed.",
|
|
272
258
|
examples: ["dss dataset assert-count orders --expected 1000",],
|
|
273
259
|
},
|
|
274
260
|
"assert-schema": {
|
|
275
261
|
handler: async (c, a, f) => {
|
|
276
|
-
const assertUsage = "
|
|
262
|
+
const assertUsage = commandUsage("dataset", "assert-schema");
|
|
277
263
|
requireArgs(a, 1, assertUsage);
|
|
278
264
|
const expected = unknownJsonInput(f);
|
|
279
265
|
if (expected === undefined) {
|
|
@@ -291,7 +277,6 @@ export const datasetCommands = {
|
|
|
291
277
|
differences: comparison.differences,
|
|
292
278
|
};
|
|
293
279
|
},
|
|
294
|
-
usage: "dss dataset assert-schema <dataset> (--data JSON | --data-file PATH | --stdin) [--project-key KEY]",
|
|
295
280
|
description: "Assert the dataset's full schema equals the expected schema object; reports concise per-path differences with sha256 subtree hashes. A mismatch exits 4 with assertion_failed.",
|
|
296
281
|
examples: [
|
|
297
282
|
`dss dataset assert-schema orders --data-file expected-schema.json`,
|
|
@@ -300,16 +285,15 @@ export const datasetCommands = {
|
|
|
300
285
|
},
|
|
301
286
|
metadata: {
|
|
302
287
|
handler: (c, a, f) => {
|
|
303
|
-
requireArgs(a, 1, "
|
|
288
|
+
requireArgs(a, 1, commandUsage("dataset", "metadata"));
|
|
304
289
|
return c.datasets.metadata(a[0], f["project-key"]);
|
|
305
290
|
},
|
|
306
|
-
usage: "dss dataset metadata <name> [--project-key KEY]",
|
|
307
291
|
description: "Get dataset-level metadata.",
|
|
308
292
|
examples: ["dss dataset metadata orders",],
|
|
309
293
|
},
|
|
310
294
|
"metadata-set": {
|
|
311
295
|
handler: async (c, a, f) => {
|
|
312
|
-
const usage = "
|
|
296
|
+
const usage = commandUsage("dataset", "metadata-set");
|
|
313
297
|
requireArgs(a, 1, usage);
|
|
314
298
|
// Validated identically for live, --plan, and --dry-run: the JSON
|
|
315
299
|
// input replaces the server metadata object verbatim (faithful PUT;
|
|
@@ -334,7 +318,6 @@ export const datasetCommands = {
|
|
|
334
318
|
const updated = await c.datasets.updateMetadata(a[0], metadata, pk);
|
|
335
319
|
return { updated: a[0], resource: "dataset", metadata: updated, };
|
|
336
320
|
},
|
|
337
|
-
usage: "dss dataset metadata-set <name> (--data JSON | --data-file PATH | --stdin) [--dry-run] [--project-key KEY]",
|
|
338
321
|
description: "Replace dataset-level metadata with the given JSON object (faithful PUT: GET, edit, PUT full object; no merge).",
|
|
339
322
|
examples: [
|
|
340
323
|
`dss dataset metadata-set orders --data '{"label":"Orders","tags":["prod"]}' --dry-run`,
|
|
@@ -348,7 +331,7 @@ export const datasetCommands = {
|
|
|
348
331
|
const connection = f["connection"];
|
|
349
332
|
const dsType = f["type"];
|
|
350
333
|
if (!name || !dsType) {
|
|
351
|
-
throw new UsageError(
|
|
334
|
+
throw new UsageError(`--name and --type are required. Usage: ${commandUsage("dataset", "create")}`);
|
|
352
335
|
}
|
|
353
336
|
if (!connection && dsType.toLowerCase() !== "uploadedfiles") {
|
|
354
337
|
throw new UsageError("--connection is required unless --type is UploadedFiles.");
|
|
@@ -382,7 +365,6 @@ export const datasetCommands = {
|
|
|
382
365
|
const moved = await moveCreatedItemsToZone(c, f, [{ objectId: name, objectType: "DATASET", },], pk);
|
|
383
366
|
return { created: name, resource: "dataset", ...moved, };
|
|
384
367
|
},
|
|
385
|
-
usage: "dss dataset create --name NAME --type TYPE [--connection CONN] [--zone ZONE|--zone-id ID] [--if-not-exists] [--dry-run] [--project-key KEY]",
|
|
386
368
|
description: "Create a new dataset. UploadedFiles uses the server's default upload connection when omitted.",
|
|
387
369
|
examples: [
|
|
388
370
|
"dss dataset create --name uploads --type UploadedFiles",
|
|
@@ -392,7 +374,7 @@ export const datasetCommands = {
|
|
|
392
374
|
},
|
|
393
375
|
"create-managed": {
|
|
394
376
|
handler: async (c, _a, f) => {
|
|
395
|
-
const usage = "
|
|
377
|
+
const usage = commandUsage("dataset", "create-managed");
|
|
396
378
|
const name = f["name"];
|
|
397
379
|
if (!name || name.trim() === "") {
|
|
398
380
|
throw new UsageError(`--name is required. Usage: ${usage}`);
|
|
@@ -446,7 +428,6 @@ export const datasetCommands = {
|
|
|
446
428
|
creationSettings: created.creationSettings,
|
|
447
429
|
};
|
|
448
430
|
},
|
|
449
|
-
usage: "dss dataset create-managed --name NAME --connection CONN [--type-option-id ID] [--format-option-id ID] [--copy-partitioning-from REF] [--partitioning-folder] [--dry-run] [--project-key KEY]",
|
|
450
431
|
description: "Create a managed dataset via the dedicated endpoint: DSS derives storage/format details; you pick name, connection, and optional type/format/partitioning options.",
|
|
451
432
|
examples: [
|
|
452
433
|
"dss dataset create-managed --name orders_copy --connection filesystem_managed",
|
|
@@ -456,16 +437,15 @@ export const datasetCommands = {
|
|
|
456
437
|
},
|
|
457
438
|
info: {
|
|
458
439
|
handler: (c, a, f) => {
|
|
459
|
-
requireArgs(a, 1, "
|
|
440
|
+
requireArgs(a, 1, commandUsage("dataset", "info"));
|
|
460
441
|
return c.datasets.info(a[0], f["project-key"]);
|
|
461
442
|
},
|
|
462
|
-
usage: "dss dataset info <name> [--project-key KEY]",
|
|
463
443
|
description: "Get the full info object for a dataset (type, parameters, last build information, schema, etc.).",
|
|
464
444
|
examples: ["dss dataset info orders", "dss dataset info orders --project-key MYPROJ",],
|
|
465
445
|
},
|
|
466
446
|
"column-lineage": {
|
|
467
447
|
handler: (c, a, f) => {
|
|
468
|
-
const usage = "
|
|
448
|
+
const usage = commandUsage("dataset", "column-lineage");
|
|
469
449
|
requireArgs(a, 2, usage);
|
|
470
450
|
const maxDatasetCount = num(f["max-dataset-count"], "--max-dataset-count");
|
|
471
451
|
if (maxDatasetCount !== undefined
|
|
@@ -478,7 +458,6 @@ export const datasetCommands = {
|
|
|
478
458
|
projectKey: f["project-key"],
|
|
479
459
|
});
|
|
480
460
|
},
|
|
481
|
-
usage: "dss dataset column-lineage <name> <column> [--max-dataset-count N] [--project-key KEY]",
|
|
482
461
|
description: "Get the full column lineage (auto-computed and manual) of a column; includes local and foreign project relations.",
|
|
483
462
|
examples: [
|
|
484
463
|
"dss dataset column-lineage orders customer_id",
|
|
@@ -487,7 +466,7 @@ export const datasetCommands = {
|
|
|
487
466
|
},
|
|
488
467
|
download: {
|
|
489
468
|
handler: async (c, a, f) => {
|
|
490
|
-
requireArgs(a, 1, "
|
|
469
|
+
requireArgs(a, 1, commandUsage("dataset", "download"));
|
|
491
470
|
const result = await c.datasets.download(a[0], {
|
|
492
471
|
outputPath: f["output"],
|
|
493
472
|
projectKey: f["project-key"],
|
|
@@ -516,7 +495,6 @@ export const datasetCommands = {
|
|
|
516
495
|
}
|
|
517
496
|
return result;
|
|
518
497
|
},
|
|
519
|
-
usage: "dss dataset download <name> [--output PATH] [--limit N] [--raw-data] [--project-key KEY]",
|
|
520
498
|
description: "Download up to --limit rows (default 100k) as CSV and return { path, rows, truncated, limit }. Formula-like cells are neutralized for spreadsheets; --raw-data preserves exact bytes. Warnings report truncation and the default output path.",
|
|
521
499
|
examples: [
|
|
522
500
|
"dss dataset download orders",
|
|
@@ -526,7 +504,7 @@ export const datasetCommands = {
|
|
|
526
504
|
},
|
|
527
505
|
clone: {
|
|
528
506
|
handler: async (c, a, f) => {
|
|
529
|
-
const usage = "
|
|
507
|
+
const usage = commandUsage("dataset", "clone");
|
|
530
508
|
requireArgs(a, 2, usage);
|
|
531
509
|
const pk = f["project-key"];
|
|
532
510
|
const opts = {
|
|
@@ -556,7 +534,6 @@ export const datasetCommands = {
|
|
|
556
534
|
const moved = await moveCreatedItemsToZone(c, f, [{ objectId: a[1], objectType: "DATASET", },], pk);
|
|
557
535
|
return { ...cloned, resource: "dataset", ...moved, };
|
|
558
536
|
},
|
|
559
|
-
usage: "dss dataset clone <source> <target> [--path PATH] [--table TABLE] [--metastore-table TABLE] [--allow-same-path] [--zone ZONE|--zone-id ID] [--dry-run] [--project-key KEY]",
|
|
560
537
|
description: "Clone dataset settings into a new dataset, with storage/table overrides.",
|
|
561
538
|
examples: [
|
|
562
539
|
"dss dataset clone source_ds experiment_ds --path /dataiku/TEST/experiment_ds --dry-run",
|
|
@@ -565,7 +542,7 @@ export const datasetCommands = {
|
|
|
565
542
|
},
|
|
566
543
|
delete: {
|
|
567
544
|
handler: async (c, a, f) => {
|
|
568
|
-
requireArgs(a, 1, "
|
|
545
|
+
requireArgs(a, 1, commandUsage("dataset", "delete"));
|
|
569
546
|
const pk = f["project-key"];
|
|
570
547
|
if (executionMode(f).dryRun || f["if-exists"] === true) {
|
|
571
548
|
const current = await readIfExists(() => c.datasets.get(a[0], pk));
|
|
@@ -578,16 +555,15 @@ export const datasetCommands = {
|
|
|
578
555
|
await c.datasets.delete(a[0], pk);
|
|
579
556
|
return { deleted: a[0], resource: "dataset", };
|
|
580
557
|
},
|
|
581
|
-
usage: "dss dataset delete <name> [--if-exists] [--dry-run] [--project-key KEY]",
|
|
582
558
|
description: "Delete a dataset.",
|
|
583
559
|
examples: ["dss dataset delete orders", "dss dataset delete orders --if-exists",],
|
|
584
560
|
},
|
|
585
561
|
update: {
|
|
586
562
|
handler: async (c, a, f) => {
|
|
587
|
-
requireArgs(a, 1, "
|
|
563
|
+
requireArgs(a, 1, commandUsage("dataset", "update"));
|
|
588
564
|
const data = jsonInput(f);
|
|
589
565
|
if (!data) {
|
|
590
|
-
throw new UsageError(
|
|
566
|
+
throw new UsageError(`--data, --data-file, or --stdin is required. Usage: ${commandUsage("dataset", "update")}`);
|
|
591
567
|
}
|
|
592
568
|
const pk = f["project-key"];
|
|
593
569
|
if (executionMode(f).dryRun) {
|
|
@@ -598,11 +574,10 @@ export const datasetCommands = {
|
|
|
598
574
|
await c.datasets.update(a[0], data, pk);
|
|
599
575
|
return { updated: a[0], resource: "dataset", };
|
|
600
576
|
},
|
|
601
|
-
usage: "dss dataset update <name> (--data '{...}' | --data-file PATH | --stdin) [--dry-run] [--project-key KEY]",
|
|
602
577
|
description: "Update dataset settings via JSON merge.",
|
|
603
578
|
examples: [
|
|
604
579
|
'dss dataset update orders --data \'{"tags":["production"]}\' --dry-run',
|
|
605
580
|
"echo '{\"tags\":[]}' | dss dataset update orders --stdin",
|
|
606
581
|
],
|
|
607
582
|
},
|
|
608
|
-
};
|
|
583
|
+
});
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
1
2
|
import { requireArgs, UsageError, } from "../usage.js";
|
|
2
|
-
export const discussionCommands = {
|
|
3
|
+
export const discussionCommands = withUsage("discussion", {
|
|
3
4
|
list: {
|
|
4
5
|
handler: (c, a, f) => {
|
|
5
|
-
requireArgs(a, 2, "
|
|
6
|
+
requireArgs(a, 2, commandUsage("discussion", "list"));
|
|
6
7
|
return c.discussions.list(a[0], a[1], f["project-key"]);
|
|
7
8
|
},
|
|
8
|
-
usage: "dss discussion list <objectType> <objectId> [--project-key KEY]",
|
|
9
9
|
description: "List discussions attached to a project object.",
|
|
10
10
|
examples: ["dss discussion list DATASET customers",],
|
|
11
11
|
},
|
|
12
12
|
get: {
|
|
13
13
|
handler: (c, a, f) => {
|
|
14
|
-
requireArgs(a, 3, "
|
|
14
|
+
requireArgs(a, 3, commandUsage("discussion", "get"));
|
|
15
15
|
return c.discussions.get(a[0], a[1], a[2], f["project-key"]);
|
|
16
16
|
},
|
|
17
|
-
usage: "dss discussion get <objectType> <objectId> <discussionId> [--project-key KEY]",
|
|
18
17
|
description: "Get one discussion with its replies.",
|
|
19
18
|
examples: ["dss discussion get DATASET customers d123",],
|
|
20
19
|
},
|
|
21
20
|
create: {
|
|
22
21
|
handler: (c, a, f) => {
|
|
23
|
-
requireArgs(a, 2, "
|
|
22
|
+
requireArgs(a, 2, commandUsage("discussion", "create"));
|
|
24
23
|
const topic = f["topic"];
|
|
25
24
|
const reply = f["reply"];
|
|
26
25
|
if (!topic || !reply) {
|
|
@@ -28,20 +27,18 @@ export const discussionCommands = {
|
|
|
28
27
|
}
|
|
29
28
|
return c.discussions.create(a[0], a[1], topic, reply, f["project-key"]);
|
|
30
29
|
},
|
|
31
|
-
usage: "dss discussion create <objectType> <objectId> --topic TEXT --reply TEXT [--project-key KEY]",
|
|
32
30
|
description: "Create a discussion with its first reply.",
|
|
33
31
|
examples: ["dss discussion create DATASET customers --topic Schema --reply Please-review",],
|
|
34
32
|
},
|
|
35
33
|
reply: {
|
|
36
34
|
handler: (c, a, f) => {
|
|
37
|
-
requireArgs(a, 3, "
|
|
35
|
+
requireArgs(a, 3, commandUsage("discussion", "reply"));
|
|
38
36
|
const text = f["text"];
|
|
39
37
|
if (!text)
|
|
40
38
|
throw new UsageError("--text is required.", "missing_required_flag");
|
|
41
39
|
return c.discussions.reply(a[0], a[1], a[2], text, f["project-key"]);
|
|
42
40
|
},
|
|
43
|
-
usage: "dss discussion reply <objectType> <objectId> <discussionId> --text TEXT [--project-key KEY]",
|
|
44
41
|
description: "Add a reply to an existing discussion.",
|
|
45
42
|
examples: ["dss discussion reply DATASET customers d123 --text Done",],
|
|
46
43
|
},
|
|
47
|
-
};
|
|
44
|
+
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { withUsage, } from "../syntax.js";
|
|
2
|
+
export const doctorCommands = withUsage("doctor", {
|
|
2
3
|
run: {
|
|
3
4
|
handler: async (_c, _a, f) => {
|
|
4
5
|
const { runDoctor, } = await import("../doctor.js");
|
|
5
6
|
return (await runDoctor(f)).result;
|
|
6
7
|
},
|
|
7
|
-
usage: "dss doctor [--project-key KEY] [--capabilities] [--fast]",
|
|
8
8
|
description: "Run JSON diagnostics for DSS credentials, connectivity, and project access.",
|
|
9
9
|
examples: ["dss doctor", "dss doctor --project-key MYPROJ", "dss doctor --capabilities --fast",],
|
|
10
10
|
},
|
|
11
|
-
};
|
|
11
|
+
});
|
|
@@ -3,8 +3,9 @@ import { deepMerge, } from "../../utils/deep-merge.js";
|
|
|
3
3
|
import { executionMode, } from "../flags.js";
|
|
4
4
|
import { ensureFlowZonePlanTarget, findFlowZoneForPlan, flowZoneColor, flowZoneContains, flowZoneCurrentPosition, flowZoneDetailSummary, flowZoneId, flowZoneMoveDelta, flowZoneMoveItems, flowZoneName, flowZoneOrganizeStep, flowZonePlanFromZones, flowZonePlanItemKeys, flowZonePruneItems, flowZoneSamePosition, flowZoneSummary, readFlowZoneOrganizePlan, resolveFlowZoneIdFromFlags, throwFlowZoneValidationError, validateFlowZoneOrganizeObjects, } from "../helpers/flow-zone.js";
|
|
5
5
|
import { readIfExists, skipResult, } from "../output.js";
|
|
6
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
6
7
|
import { requireArgs, UsageError, } from "../usage.js";
|
|
7
|
-
export const flowZoneCommands = {
|
|
8
|
+
export const flowZoneCommands = withUsage("flow-zone", {
|
|
8
9
|
list: {
|
|
9
10
|
handler: async (c, _a, f) => {
|
|
10
11
|
const zones = await c.flowZones.list(f["project-key"]);
|
|
@@ -14,7 +15,6 @@ export const flowZoneCommands = {
|
|
|
14
15
|
const object = objects.length === 1 ? objects[0] : undefined;
|
|
15
16
|
return zones.map((zone) => flowZoneSummary(zone, object));
|
|
16
17
|
},
|
|
17
|
-
usage: "dss flow-zone list [--summary] [--object TYPE:ID] [--project-key KEY]",
|
|
18
18
|
description: "List flow zones in a project, optionally as compact summaries.",
|
|
19
19
|
examples: ["dss flow-zone list", "dss flow-zone list --summary --object RECIPE:compute_orders",],
|
|
20
20
|
},
|
|
@@ -38,7 +38,6 @@ export const flowZoneCommands = {
|
|
|
38
38
|
.filter((zone) => flowZoneContains(zone, object))
|
|
39
39
|
.map((zone) => flowZoneSummary(zone, object));
|
|
40
40
|
},
|
|
41
|
-
usage: "dss flow-zone find [name-or-id] [--object TYPE:ID | --dataset DS | --recipe R | --folder F] [--project-key KEY]",
|
|
42
41
|
description: "Find flow zones by name/id or by contained flow object.",
|
|
43
42
|
examples: [
|
|
44
43
|
"dss flow-zone find ATH_SNW_MAP_FRG49",
|
|
@@ -48,10 +47,9 @@ export const flowZoneCommands = {
|
|
|
48
47
|
},
|
|
49
48
|
get: {
|
|
50
49
|
handler: (c, a, f) => {
|
|
51
|
-
requireArgs(a, 1, "
|
|
50
|
+
requireArgs(a, 1, commandUsage("flow-zone", "get"));
|
|
52
51
|
return c.flowZones.get(flowZoneId(a[0]), f["project-key"]);
|
|
53
52
|
},
|
|
54
|
-
usage: "dss flow-zone get <id> [--project-key KEY]",
|
|
55
53
|
description: "Get a flow zone by id.",
|
|
56
54
|
examples: ["dss flow-zone get ZONE_ID",],
|
|
57
55
|
},
|
|
@@ -84,7 +82,6 @@ export const flowZoneCommands = {
|
|
|
84
82
|
const created = await c.flowZones.create(payload);
|
|
85
83
|
return { created: created.id, resource: "flow-zone", ...created, };
|
|
86
84
|
},
|
|
87
|
-
usage: "dss flow-zone create --name NAME [--color #RRGGBB] [--if-not-exists] [--dry-run] [--project-key KEY]",
|
|
88
85
|
description: "Create a flow zone.",
|
|
89
86
|
examples: [
|
|
90
87
|
"dss flow-zone create --name Exports",
|
|
@@ -93,7 +90,7 @@ export const flowZoneCommands = {
|
|
|
93
90
|
},
|
|
94
91
|
update: {
|
|
95
92
|
handler: async (c, a, f) => {
|
|
96
|
-
requireArgs(a, 1, "
|
|
93
|
+
requireArgs(a, 1, commandUsage("flow-zone", "update"));
|
|
97
94
|
if (typeof f["name"] !== "string" && typeof f["color"] !== "string") {
|
|
98
95
|
throw new UsageError("--name and/or --color is required.");
|
|
99
96
|
}
|
|
@@ -111,13 +108,12 @@ export const flowZoneCommands = {
|
|
|
111
108
|
}
|
|
112
109
|
return c.flowZones.update(zoneId, patch);
|
|
113
110
|
},
|
|
114
|
-
usage: "dss flow-zone update <id> [--name NAME] [--color #RRGGBB] [--dry-run] [--project-key KEY]",
|
|
115
111
|
description: "Update flow zone settings.",
|
|
116
112
|
examples: ["dss flow-zone update ZONE_ID --name Exports --color '#2ab1ac' --dry-run",],
|
|
117
113
|
},
|
|
118
114
|
delete: {
|
|
119
115
|
handler: async (c, a, f) => {
|
|
120
|
-
requireArgs(a, 1, "
|
|
116
|
+
requireArgs(a, 1, commandUsage("flow-zone", "delete"));
|
|
121
117
|
const zoneId = flowZoneId(a[0]);
|
|
122
118
|
if (executionMode(f).dryRun || f["if-exists"] === true) {
|
|
123
119
|
const current = await readIfExists(() => c.flowZones.get(zoneId, f["project-key"]));
|
|
@@ -130,7 +126,6 @@ export const flowZoneCommands = {
|
|
|
130
126
|
await c.flowZones.delete(zoneId, f["project-key"]);
|
|
131
127
|
return { deleted: zoneId, resource: "flow-zone", };
|
|
132
128
|
},
|
|
133
|
-
usage: "dss flow-zone delete <id> [--if-exists] [--dry-run] [--project-key KEY]",
|
|
134
129
|
description: "Delete a flow zone. DSS moves zone items back to the default zone.",
|
|
135
130
|
examples: [
|
|
136
131
|
"dss flow-zone delete ZONE_ID --dry-run",
|
|
@@ -142,7 +137,7 @@ export const flowZoneCommands = {
|
|
|
142
137
|
const pk = f["project-key"];
|
|
143
138
|
const zoneId = a[0] ? flowZoneId(a[0]) : await resolveFlowZoneIdFromFlags(c, f, pk);
|
|
144
139
|
if (!zoneId) {
|
|
145
|
-
throw new UsageError(
|
|
140
|
+
throw new UsageError(`A zone id or --zone/--zone-id is required. Usage: ${commandUsage("flow-zone", "move")}`);
|
|
146
141
|
}
|
|
147
142
|
const items = flowZoneMoveItems(f);
|
|
148
143
|
if (items.length === 0) {
|
|
@@ -159,7 +154,6 @@ export const flowZoneCommands = {
|
|
|
159
154
|
}
|
|
160
155
|
return c.flowZones.moveItems(zoneId, items, pk);
|
|
161
156
|
},
|
|
162
|
-
usage: "dss flow-zone move [id] [--zone ZONE|--zone-id ID] [--dataset DS[,DS2]] [--recipe R] [--folder F] [--object TYPE:ID] [--dry-run] [--project-key KEY]",
|
|
163
157
|
description: "Move datasets, recipes, managed folders, or other flow objects into a zone by id or --zone name.",
|
|
164
158
|
examples: [
|
|
165
159
|
"dss flow-zone move ZONE_ID --dataset orders --dry-run",
|
|
@@ -177,13 +171,12 @@ export const flowZoneCommands = {
|
|
|
177
171
|
]);
|
|
178
172
|
return flowZonePlanFromZones(zones, topologyFingerprint);
|
|
179
173
|
},
|
|
180
|
-
usage: "dss flow-zone plan [--project-key KEY]",
|
|
181
174
|
description: "Export current visual flow-zone organization as an organize-compatible plan.",
|
|
182
175
|
examples: ["dss flow-zone plan --project-key MYPROJ",],
|
|
183
176
|
},
|
|
184
177
|
organize: {
|
|
185
178
|
handler: async (c, _a, f) => {
|
|
186
|
-
const usage = "
|
|
179
|
+
const usage = commandUsage("flow-zone", "organize");
|
|
187
180
|
const pk = f["project-key"];
|
|
188
181
|
const plan = readFlowZoneOrganizePlan(f, usage);
|
|
189
182
|
const sync = f["sync"] === true;
|
|
@@ -292,7 +285,6 @@ export const flowZoneCommands = {
|
|
|
292
285
|
pruned,
|
|
293
286
|
};
|
|
294
287
|
},
|
|
295
|
-
usage: "dss flow-zone organize (--data JSON|--data-file PATH|--file PATH|--stdin) [--sync] [--validate-objects] [--dry-run] [--project-key KEY]",
|
|
296
288
|
description: "Create/update flow zones and move objects from a declarative visual organization plan.",
|
|
297
289
|
examples: [
|
|
298
290
|
"dss flow-zone organize --file flow-zones.json --dry-run",
|
|
@@ -304,8 +296,7 @@ export const flowZoneCommands = {
|
|
|
304
296
|
const id = a[0] === undefined ? undefined : flowZoneId(a[0]);
|
|
305
297
|
return c.flowZones.graph(id, f["project-key"]);
|
|
306
298
|
},
|
|
307
|
-
usage: "dss flow-zone graph [<id>] [--project-key KEY]",
|
|
308
299
|
description: "Get the full flow graph or the graph for a single flow zone.",
|
|
309
300
|
examples: ["dss flow-zone graph", "dss flow-zone graph ZONE_ID",],
|
|
310
301
|
},
|
|
311
|
-
};
|
|
302
|
+
});
|