dataiku-sdk 3.8.0 → 3.9.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 CHANGED
@@ -520,8 +520,10 @@ UI-click smoke test. The CLI does not guess private endpoints for those operatio
520
520
 
521
521
  `project map` returns one agent-oriented JSON view of the Flow: normalized nodes and edges,
522
522
  joined zone metadata, cycle-safe topological layers, weakly connected components, diagnostics, and
523
- a stable `topologyFingerprint`. Zone joins add `zoneId`/`zoneName` to each node; the top-level
524
- `zones` array preserves zone color, position, item count, and visible node IDs.
523
+ a stable `topologyFingerprint`. Output is deduplicated: node `name` appears only when it differs from
524
+ `id`; each node carries `zoneId`/`componentId` (zone names live in `zones[]`, membership is derived
525
+ from those ids, so `zones[]`/`components[]` omit `nodeIds`); `warnings` appears only when non-empty and
526
+ `truncation` only when the map was cut. `zones` preserves zone color, position, and item count.
525
527
 
526
528
  ```bash
527
529
  dss project map --project-key MYPROJ
@@ -1 +1 @@
1
- {"format":1,"buildRevision":"6814ed4e3da988eccd85f9f50d79e1da66253b0a"}
1
+ {"format":1,"buildRevision":"3f9f0582b0fa45ee3708215954761d75f6edf9b7"}
@@ -4513,6 +4513,15 @@
4513
4513
  {
4514
4514
  "arg": "name"
4515
4515
  },
4516
+ {
4517
+ "optional": [
4518
+ [
4519
+ {
4520
+ "flag": "full"
4521
+ }
4522
+ ]
4523
+ ]
4524
+ },
4516
4525
  {
4517
4526
  "optional": [
4518
4527
  [
@@ -4531,6 +4540,15 @@
4531
4540
  {
4532
4541
  "arg": "name"
4533
4542
  },
4543
+ {
4544
+ "optional": [
4545
+ [
4546
+ {
4547
+ "flag": "full"
4548
+ }
4549
+ ]
4550
+ ]
4551
+ },
4534
4552
  {
4535
4553
  "optional": [
4536
4554
  [
@@ -7108,6 +7126,15 @@
7108
7126
  {
7109
7127
  "arg": "id"
7110
7128
  },
7129
+ {
7130
+ "optional": [
7131
+ [
7132
+ {
7133
+ "flag": "full"
7134
+ }
7135
+ ]
7136
+ ]
7137
+ },
7111
7138
  {
7112
7139
  "optional": [
7113
7140
  [
@@ -12890,6 +12917,15 @@
12890
12917
  "dss",
12891
12918
  "project",
12892
12919
  "get",
12920
+ {
12921
+ "optional": [
12922
+ [
12923
+ {
12924
+ "flag": "full"
12925
+ }
12926
+ ]
12927
+ ]
12928
+ },
12893
12929
  {
12894
12930
  "optional": [
12895
12931
  [
@@ -143,7 +143,7 @@ export const datasetCommands = withUsage("dataset", {
143
143
  requireArgs(a, 1, commandUsage("dataset", "get"));
144
144
  return c.datasets.get(a[0], f["project-key"]);
145
145
  },
146
- description: "Get full settings for a dataset.",
146
+ description: "Get the settings for a dataset (compact by default: empty values and metrics/version metadata are dropped, structure kept for get-edit-update; --full returns the raw DSS object).",
147
147
  examples: ["dss dataset get orders", "dss dataset get orders --project-key MYPROJ",],
148
148
  },
149
149
  schema: {
@@ -506,7 +506,7 @@ export const datasetCommands = withUsage("dataset", {
506
506
  requireArgs(a, 1, commandUsage("dataset", "info"));
507
507
  return c.datasets.info(a[0], f["project-key"]);
508
508
  },
509
- description: "Get the full info object for a dataset (type, parameters, last build information, schema, etc.).",
509
+ description: "Get dataset info: type, connection, format, schema columns, flow recipes, buildability, data quality, and last modification (compact by default; --full returns the raw DSS info object).",
510
510
  examples: ["dss dataset info orders", "dss dataset info orders --project-key MYPROJ",],
511
511
  },
512
512
  "column-lineage": {
@@ -7,6 +7,32 @@ import { executionMode, } from "../flags.js";
7
7
  import { encodedProjectEndpoint, enqueueCliWarning, } from "../output.js";
8
8
  import { commandUsage, withUsage, } from "../syntax.js";
9
9
  import { requireArgs, UsageError, } from "../usage.js";
10
+ /** Lines `job log` prints to stdout when no `--max-lines` is given. */
11
+ const DEFAULT_STDOUT_LOG_LINES = 100;
12
+ /**
13
+ * Tail a (filtered) job log for stdout. `0`/`-1` return everything; a
14
+ * truncated tail enqueues a `log_truncated` warning carrying the shown and
15
+ * total line counts.
16
+ */
17
+ function tailJobLogForStdout(log, limit) {
18
+ if (!log || limit === 0 || limit === -1)
19
+ return log;
20
+ const lines = log.split(/\r?\n/);
21
+ const hasTrailingLineBreak = lines[lines.length - 1] === "";
22
+ if (hasTrailingLineBreak)
23
+ lines.pop();
24
+ const shown = Math.max(1, limit);
25
+ if (lines.length <= shown)
26
+ return log;
27
+ enqueueCliWarning({
28
+ code: "log_truncated",
29
+ shown,
30
+ total: lines.length,
31
+ hint: "Raise --max-lines (0 = all), add --errors-only, or use --output PATH.",
32
+ });
33
+ const tail = lines.slice(-shown).join("\n");
34
+ return hasTrailingLineBreak ? `${tail}\n` : tail;
35
+ }
10
36
  /**
11
37
  * With an empty output schema DSS ends a dataset build DONE after writing no
12
38
  * columns and no rows, without an error. Flag that after a successful build so
@@ -235,7 +261,7 @@ export const jobCommands = withUsage("job", {
235
261
  requireArgs(a, 1, commandUsage("job", "get"));
236
262
  return c.jobs.get(a[0], f["project-key"]);
237
263
  },
238
- description: "Get job details.",
264
+ description: "Get job state, outputs, progress, error, and per-activity status (compact by default; --full returns the raw DSS job object). The log tail is never included: use `dss job log ID --errors-only`.",
239
265
  examples: ["dss job get JOB_ID",],
240
266
  },
241
267
  summary: {
@@ -252,23 +278,25 @@ export const jobCommands = withUsage("job", {
252
278
  const logFilter = f["errors-only"] === true
253
279
  ? "errors"
254
280
  : jobLogFilterFromFlag(f["log-filter"]);
281
+ const outputFile = f["output"]
282
+ ?? f["output-file"];
283
+ const requestedLines = maxLogLinesFromFlags(f);
284
+ // Stdout is tailed here (not in the SDK) so the total can be reported.
255
285
  const log = await c.jobs.log(a[0], {
256
286
  activity: f["activity"],
257
287
  logId: f["log-id"],
258
288
  logFilter,
259
- maxLogLines: maxLogLinesFromFlags(f),
289
+ maxLogLines: outputFile ? requestedLines : -1,
260
290
  projectKey: f["project-key"],
261
291
  });
262
- const outputFile = f["output"]
263
- ?? f["output-file"];
264
292
  if (!outputFile)
265
- return log;
293
+ return tailJobLogForStdout(log, requestedLines ?? DEFAULT_STDOUT_LOG_LINES);
266
294
  const outputPath = resolve(outputFile);
267
295
  await mkdir(dirname(outputPath), { recursive: true, });
268
296
  await writeFile(outputPath, log.endsWith("\n") ? log : `${log}\n`, "utf-8");
269
297
  return outputPath;
270
298
  },
271
- description: "Get public API job log output; find why a job failed. Use --errors-only (or --log-filter errors) to surface just error/traceback lines, and --output PATH to write the log to a file (stdout returns the path). --log-id is accepted for UI parity but DSS API-key auth cannot select browser-only cat-activity-log files.",
299
+ description: "Get public API job log output (last 100 lines by default; --max-lines N, 0 = all); find why a job failed. Use --errors-only for error/traceback lines and --output PATH to write it to a file (stdout returns the path). --log-id is accepted for UI parity; API keys cannot read browser-only cat-activity-log files.",
272
300
  examples: [
273
301
  "dss job log JOB_ID",
274
302
  "dss job log JOB_ID --activity main --max-log-lines 200",
@@ -5,6 +5,7 @@ import { projectIncarnationHash, } from "../../utils/project-incarnation.js";
5
5
  import { jsonInput, num, requiredJsonInput, requiredStringFlag, } from "../coerce.js";
6
6
  import { executionMode, } from "../flags.js";
7
7
  import { CommandResultFailure, } from "../output.js";
8
+ import { compactProjectMapOutput, } from "../project-map-output.js";
8
9
  import { commandUsage, withUsage, } from "../syntax.js";
9
10
  import { requireArgs, UsageError, } from "../usage.js";
10
11
  const INSPECT_ARCHIVE_USAGE = commandUsage("project", "inspect-archive");
@@ -28,7 +29,7 @@ export const projectCommands = withUsage("project", {
28
29
  },
29
30
  get: {
30
31
  handler: (c, _a, f) => c.projects.get(f["project-key"]),
31
- description: "Get project settings and metadata.",
32
+ description: "Get project settings and metadata (compact by default: empty values, metrics/version/image metadata dropped, permission flags collapsed to deniedPermissions; --full returns the raw DSS object).",
32
33
  examples: ["dss project get", "dss project get --project-key MYPROJ",],
33
34
  },
34
35
  metadata: {
@@ -42,13 +43,13 @@ export const projectCommands = withUsage("project", {
42
43
  examples: ["dss project flow", "dss project flow --project-key MYPROJ",],
43
44
  },
44
45
  map: {
45
- handler: (c, _a, f) => c.projects.map({
46
+ handler: async (c, _a, f) => compactProjectMapOutput(await c.projects.map({
46
47
  projectKey: f["project-key"],
47
48
  maxNodes: num(f["max-nodes"], "--max-nodes"),
48
49
  maxEdges: num(f["max-edges"], "--max-edges"),
49
50
  includeRaw: f["include-raw"] === true,
50
51
  render: flowRenderFormat(f["render"]),
51
- }),
52
+ })),
52
53
  validate: (_a, f) => {
53
54
  flowRenderFormat(f["render"]);
54
55
  num(f["max-nodes"], "--max-nodes");
@@ -1400,11 +1400,10 @@ function commandRegistryJsonSchema() {
1400
1400
  function errorEnvelopeJsonSchema() {
1401
1401
  return {
1402
1402
  type: "object",
1403
- required: ["type", "ok", "error", "code", "category", "exitCode",],
1403
+ required: ["type", "error", "code", "category", "exitCode",],
1404
1404
  additionalProperties: true,
1405
1405
  properties: {
1406
1406
  type: { const: "error", },
1407
- ok: { const: false, },
1408
1407
  error: { type: "string", },
1409
1408
  code: { type: "string", },
1410
1409
  category: { enum: ["usage", "permission_or_environment", "dss", "internal",], },
@@ -1414,8 +1413,6 @@ function errorEnvelopeJsonSchema() {
1414
1413
  retryable: { type: "boolean", },
1415
1414
  requestId: { type: "string", },
1416
1415
  details: { type: "object", additionalProperties: true, },
1417
- resource: { type: "string", },
1418
- action: { type: "string", },
1419
1416
  projectKey: { type: "string", },
1420
1417
  },
1421
1418
  };
@@ -1526,7 +1523,7 @@ export function buildAgentContract() {
1526
1523
  failure: "structured-error-object",
1527
1524
  failureResultDetailLimitBytes: 65_536,
1528
1525
  fieldProjection: "Missing --fields paths: null on stdout; field_projection_missing on stderr.",
1529
- lists: "*.list: compact items; --full/--fields use DSS objects; --contains/--limit filter (list_truncated warning).",
1526
+ compactResults: "*.list, job get, dataset get/info, project get: compact; --full/--fields use DSS objects; lists take --contains/--limit (list_truncated warning).",
1530
1527
  richFailureResults: "doctor/batch/cleanup failures: own compact {ok:false,...} result on stdout and command exit code; no wrapper.",
1531
1528
  },
1532
1529
  stderr: {
@@ -13,6 +13,7 @@
13
13
  * Imported by the generator and the discovery parity test only.
14
14
  */
15
15
  import { compactListOutputSchemas, } from "./list-shapes.js";
16
+ import { compactReadOutputSchemas, DATASET_GET_DROPPED_KEYS, PROJECT_GET_DROPPED_KEYS, } from "./read-shapes.js";
16
17
  const PROJECT_LIBRARY_ITEM_OUTPUT_SCHEMA = {
17
18
  type: "object",
18
19
  additionalProperties: false,
@@ -50,6 +51,21 @@ const NOTEBOOK_SAVE_SQL_OUTPUT_SCHEMA = {
50
51
  requested: { type: "string", },
51
52
  },
52
53
  };
54
+ /**
55
+ * Discovery schema of a compact settings object (`dataset get`, `project get`):
56
+ * the SDK TypeBox schema minus the keys the CLI drops, with only the
57
+ * identifiers that survive pruning required. SDK validation keeps the
58
+ * unmodified TypeBox schema.
59
+ */
60
+ function settingsOutputSchema(schema, droppedKeys, extraProperties = {}) {
61
+ const properties = Object.fromEntries(Object.entries(schema["properties"]).filter(([key,]) => !droppedKeys.includes(key)));
62
+ const required = (schema["required"] ?? []).filter((key) => !droppedKeys.includes(key));
63
+ return {
64
+ ...schema,
65
+ properties: { ...properties, ...extraProperties, },
66
+ required: [...required, ...Object.keys(extraProperties),],
67
+ };
68
+ }
53
69
  let commandOutputSchemas;
54
70
  /**
55
71
  * Canonical TypeBox-derived output schemas, keyed by `resource.action`. This is
@@ -196,9 +212,15 @@ export function typeBoxCommandOutputSchemas() {
196
212
  maxLines: { type: "integer", minimum: 0, },
197
213
  },
198
214
  },
199
- "project.get": ProjectDetailsSchema,
215
+ "project.get": settingsOutputSchema(ProjectDetailsSchema, PROJECT_GET_DROPPED_KEYS, {
216
+ deniedPermissions: {
217
+ type: "array",
218
+ items: { type: "string", },
219
+ description: "Permission flags DSS reports as false; absent flags are granted.",
220
+ },
221
+ }),
200
222
  "project.metadata": ProjectMetadataSchema,
201
- "dataset.get": DatasetDetailsSchema,
223
+ "dataset.get": settingsOutputSchema(DatasetDetailsSchema, DATASET_GET_DROPPED_KEYS),
202
224
  "dataset.schema": DatasetSchemaSchema,
203
225
  "job.wait": JobWaitResultSchema,
204
226
  "job.monitor": JobWaitResultSchema,
@@ -224,7 +246,9 @@ export function typeBoxCommandOutputSchemas() {
224
246
  },
225
247
  ],
226
248
  },
227
- // `*.list` defaults to compact items; `--full` returns the DSS objects.
249
+ // `*.list` and the four large reads default to compact shapes; `--full`
250
+ // returns the DSS objects.
228
251
  ...compactListOutputSchemas(),
252
+ ...compactReadOutputSchemas(),
229
253
  };
230
254
  }
@@ -0,0 +1,24 @@
1
+ import type { FlowMapResult } from "../resources/projects.js";
2
+ import type { AnalyzedFlowMap, AnalyzedFlowNode, FlowMapComponent, FlowMapZone } from "../utils/flow-analysis.js";
3
+ /**
4
+ * `dss project map` output: the SDK `FlowMapResult` with derivable duplicates
5
+ * removed at the CLI boundary. Lossless — every dropped field can be rebuilt:
6
+ * node `name` defaults to `id`, `zoneName` comes from `zones[]`, zone/component
7
+ * membership comes from each node's `zoneId`/`componentId`, an absent
8
+ * `warnings` means none, and an absent `truncation` means nothing was cut.
9
+ * `topologyFingerprint` is passed through untouched.
10
+ */
11
+ export type CompactFlowMapNode = Omit<AnalyzedFlowNode, "zoneName">;
12
+ export type CompactFlowMapZone = Omit<FlowMapZone, "nodeIds">;
13
+ export type CompactFlowMapComponent = Omit<FlowMapComponent, "nodeIds">;
14
+ export interface CompactFlowMap extends Omit<AnalyzedFlowMap, "nodes" | "zones" | "components" | "warnings"> {
15
+ nodes: CompactFlowMapNode[];
16
+ zones: CompactFlowMapZone[];
17
+ components: CompactFlowMapComponent[];
18
+ warnings?: string[];
19
+ }
20
+ export interface CompactFlowMapResult extends Omit<FlowMapResult, "map" | "truncation"> {
21
+ map: CompactFlowMap;
22
+ truncation?: FlowMapResult["truncation"];
23
+ }
24
+ export declare function compactProjectMapOutput(result: FlowMapResult): CompactFlowMapResult;
@@ -0,0 +1,21 @@
1
+ function compactNode(node) {
2
+ const { zoneName: _zoneName, name, ...rest } = node;
3
+ return name === undefined || name === node.id ? rest : { ...rest, name, };
4
+ }
5
+ export function compactProjectMapOutput(result) {
6
+ const { nodes, zones, components, warnings, ...mapRest } = result.map;
7
+ const map = {
8
+ ...mapRest,
9
+ nodes: nodes.map(compactNode),
10
+ zones: zones.map(({ nodeIds: _nodeIds, ...zone }) => zone),
11
+ components: components.map(({ nodeIds: _nodeIds, ...component }) => component),
12
+ };
13
+ if (warnings.length > 0)
14
+ map.warnings = warnings;
15
+ const { map: _map, truncation, ...resultRest } = result;
16
+ return {
17
+ map,
18
+ ...(truncation.truncated ? { truncation, } : {}),
19
+ ...resultRest,
20
+ };
21
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Plain data shared by the compact read shapers (src/cli/result-shapes.ts) and
3
+ * the discovery output schemas (src/cli/output-schemas.ts), so the advertised
4
+ * schema is the emitted shape. Imports nothing: the schema generator loads it
5
+ * without the CLI runtime.
6
+ */
7
+ /**
8
+ * Settings-object noise `dataset get` / `project get` drop: metrics and check
9
+ * configuration, version stamps and checklists that agents never edit.
10
+ */
11
+ export declare const DATASET_GET_DROPPED_KEYS: readonly ["metrics", "metricsChecks", "versionTag", "creationTag", "checklists"];
12
+ export declare const PROJECT_GET_DROPPED_KEYS: readonly ["metrics", "metricsChecks", "versionTag", "creationTag", "checklists", "objectImgHash", "isProjectImg", "defaultImgColor", "imgPattern"];
13
+ /** Discovery output schemas of the `job get` and `dataset info` compact defaults. */
14
+ export declare function compactReadOutputSchemas(): Record<string, Record<string, unknown>>;
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Plain data shared by the compact read shapers (src/cli/result-shapes.ts) and
3
+ * the discovery output schemas (src/cli/output-schemas.ts), so the advertised
4
+ * schema is the emitted shape. Imports nothing: the schema generator loads it
5
+ * without the CLI runtime.
6
+ */
7
+ /**
8
+ * Settings-object noise `dataset get` / `project get` drop: metrics and check
9
+ * configuration, version stamps and checklists that agents never edit.
10
+ */
11
+ export const DATASET_GET_DROPPED_KEYS = [
12
+ "metrics",
13
+ "metricsChecks",
14
+ "versionTag",
15
+ "creationTag",
16
+ "checklists",
17
+ ];
18
+ export const PROJECT_GET_DROPPED_KEYS = [
19
+ ...DATASET_GET_DROPPED_KEYS,
20
+ "objectImgHash",
21
+ "isProjectImg",
22
+ "defaultImgColor",
23
+ "imgPattern",
24
+ ];
25
+ const STRING = { type: "string", };
26
+ const NUMBER = { type: "number", };
27
+ const BOOLEAN = { type: "boolean", };
28
+ /** Discovery output schemas of the `job get` and `dataset info` compact defaults. */
29
+ export function compactReadOutputSchemas() {
30
+ const errorSchema = {
31
+ type: "object",
32
+ additionalProperties: false,
33
+ properties: { type: STRING, message: STRING, },
34
+ };
35
+ return {
36
+ "job.get": {
37
+ type: "object",
38
+ additionalProperties: false,
39
+ required: ["id", "state",],
40
+ properties: {
41
+ id: STRING,
42
+ name: STRING,
43
+ type: STRING,
44
+ state: STRING,
45
+ initiator: STRING,
46
+ triggeredFrom: STRING,
47
+ startTime: NUMBER,
48
+ endTime: NUMBER,
49
+ outputs: {
50
+ type: "array",
51
+ items: {
52
+ type: "object",
53
+ additionalProperties: false,
54
+ properties: { type: STRING, id: STRING, projectKey: STRING, partition: STRING, },
55
+ },
56
+ },
57
+ progress: { type: "object", additionalProperties: NUMBER, },
58
+ error: errorSchema,
59
+ activities: {
60
+ type: "array",
61
+ items: {
62
+ type: "object",
63
+ additionalProperties: false,
64
+ properties: {
65
+ id: STRING,
66
+ recipe: STRING,
67
+ recipeType: STRING,
68
+ state: STRING,
69
+ totalTime: NUMBER,
70
+ warnings: NUMBER,
71
+ error: errorSchema,
72
+ message: STRING,
73
+ },
74
+ },
75
+ },
76
+ },
77
+ },
78
+ "dataset.info": {
79
+ type: "object",
80
+ additionalProperties: false,
81
+ required: ["name",],
82
+ properties: {
83
+ name: STRING,
84
+ type: STRING,
85
+ managed: BOOLEAN,
86
+ connection: STRING,
87
+ formatType: STRING,
88
+ partitioned: BOOLEAN,
89
+ schema: {
90
+ type: "array",
91
+ items: {
92
+ type: "object",
93
+ additionalProperties: false,
94
+ required: ["name", "type",],
95
+ properties: { name: STRING, type: STRING, meaning: STRING, comment: STRING, },
96
+ },
97
+ },
98
+ recipes: { type: "array", items: STRING, },
99
+ buildable: BOOLEAN,
100
+ upstreamBuildable: BOOLEAN,
101
+ downstreamBuildable: BOOLEAN,
102
+ tags: { type: "array", items: STRING, },
103
+ dataQuality: { type: "object", additionalProperties: true, },
104
+ lastBuild: {
105
+ type: "object",
106
+ additionalProperties: false,
107
+ properties: { jobId: STRING, success: BOOLEAN, startTime: NUMBER, endTime: NUMBER, },
108
+ },
109
+ lastModifiedOn: NUMBER,
110
+ lastModifiedBy: STRING,
111
+ },
112
+ },
113
+ };
114
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Compact a command result for agents: `*.list` items (filter, cap, compact
3
+ * fields) and the four large read commands. `--full` and `--fields` bypass
4
+ * the read shapers so the DSS object (or a projection of it) is returned.
5
+ */
6
+ export declare function shapeCommandResult(resource: string, action: string, result: unknown, flags: Record<string, string | boolean>): unknown;