dataiku-sdk 3.6.1 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/README.md +14 -6
  2. package/bin/bun-version.js +14 -0
  3. package/bin/dss.js +11 -15
  4. package/dist/build-metadata.json +1 -1
  5. package/dist/packages/types/src/index.d.ts +114 -5
  6. package/dist/packages/types/src/index.js +75 -2
  7. package/dist/src/cli/coerce.d.ts +2 -0
  8. package/dist/src/cli/coerce.js +20 -16
  9. package/dist/src/cli/command-syntax.json +3369 -144
  10. package/dist/src/cli/commands/analysis.js +19 -1
  11. package/dist/src/cli/commands/bundle.js +22 -0
  12. package/dist/src/cli/commands/connection.js +26 -2
  13. package/dist/src/cli/commands/data-quality.js +33 -1
  14. package/dist/src/cli/commands/dataset.js +76 -9
  15. package/dist/src/cli/commands/discussion.js +15 -0
  16. package/dist/src/cli/commands/doctor.js +1 -1
  17. package/dist/src/cli/commands/flow-zone.js +241 -46
  18. package/dist/src/cli/commands/flow.d.ts +5 -0
  19. package/dist/src/cli/commands/flow.js +57 -0
  20. package/dist/src/cli/commands/future.js +8 -0
  21. package/dist/src/cli/commands/index.js +6 -0
  22. package/dist/src/cli/commands/job.js +44 -6
  23. package/dist/src/cli/commands/metrics.js +21 -1
  24. package/dist/src/cli/commands/ml-task.d.ts +5 -0
  25. package/dist/src/cli/commands/ml-task.js +86 -16
  26. package/dist/src/cli/commands/mlflow.d.ts +11 -0
  27. package/dist/src/cli/commands/mlflow.js +121 -0
  28. package/dist/src/cli/commands/plugin.js +5 -11
  29. package/dist/src/cli/commands/project-deployer.js +70 -0
  30. package/dist/src/cli/commands/project-library.js +2 -5
  31. package/dist/src/cli/commands/project.js +8 -0
  32. package/dist/src/cli/commands/recipe.d.ts +13 -0
  33. package/dist/src/cli/commands/recipe.js +130 -7
  34. package/dist/src/cli/commands/saved-model.d.ts +1 -1
  35. package/dist/src/cli/commands/saved-model.js +9 -76
  36. package/dist/src/cli/commands/streaming-endpoint.js +30 -1
  37. package/dist/src/cli/commands/webapp.js +8 -0
  38. package/dist/src/cli/commands/wiki.js +78 -0
  39. package/dist/src/cli/commands/workspace.js +8 -0
  40. package/dist/src/cli/contract.d.ts +16 -15
  41. package/dist/src/cli/contract.js +150 -3407
  42. package/dist/src/cli/doctor.d.ts +13 -0
  43. package/dist/src/cli/doctor.js +43 -1
  44. package/dist/src/cli/flags.d.ts +14 -1
  45. package/dist/src/cli/flags.js +106 -8
  46. package/dist/src/cli/helpers/app-successor.js +1 -2
  47. package/dist/src/cli/helpers/dataset.d.ts +12 -0
  48. package/dist/src/cli/helpers/dataset.js +36 -0
  49. package/dist/src/cli/helpers/documentation.d.ts +21 -0
  50. package/dist/src/cli/helpers/documentation.js +53 -0
  51. package/dist/src/cli/helpers/flow-zone.d.ts +21 -0
  52. package/dist/src/cli/helpers/flow-zone.js +144 -4
  53. package/dist/src/cli/helpers/trained-model.d.ts +26 -0
  54. package/dist/src/cli/helpers/trained-model.js +144 -0
  55. package/dist/src/cli/list-output.d.ts +7 -0
  56. package/dist/src/cli/list-output.js +77 -0
  57. package/dist/src/cli/list-shapes.d.ts +21 -0
  58. package/dist/src/cli/list-shapes.js +111 -0
  59. package/dist/src/cli/output-schemas.d.ts +0 -14
  60. package/dist/src/cli/output-schemas.js +4 -7
  61. package/dist/src/cli/output.d.ts +0 -1
  62. package/dist/src/cli/output.js +33 -19
  63. package/dist/src/cli/plans.d.ts +14 -0
  64. package/dist/src/cli/plans.js +3740 -0
  65. package/dist/src/cli/types.d.ts +2 -0
  66. package/dist/src/cli/usage.d.ts +7 -0
  67. package/dist/src/cli/usage.js +20 -1
  68. package/dist/src/cli/version.d.ts +2 -2
  69. package/dist/src/cli/version.js +2 -2
  70. package/dist/src/cli.js +137 -115
  71. package/dist/src/client.d.ts +52 -43
  72. package/dist/src/client.js +267 -96
  73. package/dist/src/errors.d.ts +22 -2
  74. package/dist/src/errors.js +49 -50
  75. package/dist/src/generated/action-output-schemas.json +345 -89
  76. package/dist/src/index.d.ts +5 -1
  77. package/dist/src/index.js +3 -0
  78. package/dist/src/resources/analyses.d.ts +8 -0
  79. package/dist/src/resources/analyses.js +13 -1
  80. package/dist/src/resources/bundles.d.ts +34 -0
  81. package/dist/src/resources/bundles.js +67 -0
  82. package/dist/src/resources/connections.d.ts +9 -0
  83. package/dist/src/resources/connections.js +15 -0
  84. package/dist/src/resources/data-quality.d.ts +20 -0
  85. package/dist/src/resources/data-quality.js +30 -0
  86. package/dist/src/resources/dataset-create.d.ts +38 -0
  87. package/dist/src/resources/dataset-create.js +135 -0
  88. package/dist/src/resources/datasets.d.ts +46 -15
  89. package/dist/src/resources/datasets.js +120 -112
  90. package/dist/src/resources/discussions.d.ts +5 -0
  91. package/dist/src/resources/discussions.js +7 -0
  92. package/dist/src/resources/documentation.d.ts +25 -0
  93. package/dist/src/resources/documentation.js +16 -0
  94. package/dist/src/resources/flow-zones.d.ts +29 -3
  95. package/dist/src/resources/flow-zones.js +53 -3
  96. package/dist/src/resources/flow.d.ts +48 -0
  97. package/dist/src/resources/flow.js +65 -0
  98. package/dist/src/resources/futures.d.ts +23 -0
  99. package/dist/src/resources/futures.js +32 -0
  100. package/dist/src/resources/jobs.d.ts +34 -0
  101. package/dist/src/resources/jobs.js +170 -3
  102. package/dist/src/resources/metrics.d.ts +10 -0
  103. package/dist/src/resources/metrics.js +10 -0
  104. package/dist/src/resources/ml-tasks.d.ts +65 -2
  105. package/dist/src/resources/ml-tasks.js +102 -28
  106. package/dist/src/resources/mlflow-extension.d.ts +73 -0
  107. package/dist/src/resources/mlflow-extension.js +105 -0
  108. package/dist/src/resources/projects.d.ts +15 -0
  109. package/dist/src/resources/projects.js +18 -3
  110. package/dist/src/resources/recipe-create.d.ts +79 -0
  111. package/dist/src/resources/recipe-create.js +454 -0
  112. package/dist/src/resources/recipes.d.ts +28 -29
  113. package/dist/src/resources/recipes.js +201 -267
  114. package/dist/src/resources/saved-models.d.ts +10 -6
  115. package/dist/src/resources/saved-models.js +16 -14
  116. package/dist/src/resources/scenarios.js +8 -14
  117. package/dist/src/resources/sql.js +52 -13
  118. package/dist/src/resources/streaming-endpoints.d.ts +12 -0
  119. package/dist/src/resources/streaming-endpoints.js +15 -0
  120. package/dist/src/resources/trained-model.d.ts +60 -0
  121. package/dist/src/resources/trained-model.js +98 -0
  122. package/dist/src/resources/webapps.d.ts +8 -0
  123. package/dist/src/resources/webapps.js +10 -0
  124. package/dist/src/resources/wiki.d.ts +52 -1
  125. package/dist/src/resources/wiki.js +96 -0
  126. package/dist/src/resources/workspaces.d.ts +2 -0
  127. package/dist/src/resources/workspaces.js +4 -0
  128. package/dist/src/utils/flow-analysis.js +4 -0
  129. package/dist/src/utils/response-file.js +20 -9
  130. package/dist/src/utils/secret-sanitize.d.ts +7 -0
  131. package/dist/src/utils/secret-sanitize.js +46 -0
  132. package/package.json +25 -26
  133. package/plugin.json +1 -1
  134. package/skills/dataiku-dss/SKILL.md +1 -1
  135. package/skills/dataiku-dss/references/authentication.md +3 -1
  136. package/skills/dataiku-dss/references/coding.md +1 -0
  137. package/skills/dataiku-dss/references/discovery.md +4 -6
  138. package/skills/dataiku-dss/references/flow-maps.md +2 -2
  139. package/skills/dataiku-dss/references/troubleshooting.md +3 -2
@@ -74,9 +74,15 @@ export const UNEXPECTED_RESPONSE_MARKER = "Unexpected DSS response";
74
74
  export function unexpectedResponseError(detail, status = 200) {
75
75
  return new DataikuError(status, "Unexpected Response", `${UNEXPECTED_RESPONSE_MARKER}: ${detail}`);
76
76
  }
77
+ /** Hint for a DSS answer that definitively failed the request (e.g. the database rejected the SQL). */
78
+ const DEFINITE_FAILURE_HINT = "DSS reported that the request failed (for SQL: syntax error, missing object, or missing privileges of the connection's role). Fix the request or grants; do not retry unchanged.";
77
79
  /** Prefix for a SQL query failure reported by DSS on a 2xx finish-streaming response. */
78
80
  export const SQL_QUERY_FAILED_MARKER = "SQL query failed in DSS";
79
- const TLS_CERTIFICATE_HINT = "TLS certificate verification failed. Trust the DSS/corporate CA with --ca-cert PATH or NODE_EXTRA_CA_CERTS; use --insecure only for temporary troubleshooting.";
81
+ const TLS_CERTIFICATE_HINT = "TLS certificate verification failed. Trust the DSS/corporate CA with --ca-cert PATH or NODE_EXTRA_CA_CERTS, or save it for every process and directory with `dss auth login --ca-cert PATH` (a project .env applies only when dss runs in that directory); use --insecure only for temporary troubleshooting.";
82
+ /** Generic permission hint; the CLI names the project when the request was project-scoped. */
83
+ export const FORBIDDEN_HINT = "Check API key validity and project permissions for the requested action.";
84
+ /** Generic 404 hint; the CLI names the resource and project when it knows them. */
85
+ export const NOT_FOUND_HINT = "Verify projectKey and object identifiers (dataset/recipe/scenario/folder IDs).";
80
86
  const BUSINESS_APPS_API_UNAVAILABLE_HINT = "Business Apps API is not available on this DSS instance. Use classic app commands or check DSS version/feature availability.";
81
87
  const MAX_ERROR_SUMMARY_LENGTH = 200;
82
88
  function isHtmlResponseBody(body) {
@@ -136,6 +142,8 @@ function isCertificateTrustFailure(lowerBody) {
136
142
  || lowerBody.includes("unable to get local issuer certificate")
137
143
  || lowerBody.includes("unable to verify leaf signature")
138
144
  || lowerBody.includes("self-signed certificate")
145
+ || lowerBody.includes("self signed certificate")
146
+ || lowerBody.includes("depth_zero_self_signed_cert")
139
147
  || lowerBody.includes("certificate has expired")
140
148
  || lowerBody.includes("cert_has_expired")
141
149
  || lowerBody.includes("self_signed_cert_in_chain")
@@ -170,6 +178,15 @@ export function classifyDataikuError(status, body) {
170
178
  retryHint: TLS_CERTIFICATE_HINT,
171
179
  };
172
180
  }
181
+ // The same URL fails the same way on every attempt: nothing listens on
182
+ // the port, the host name does not resolve, or the URL is malformed.
183
+ if (/\b(?:connectionrefused|econnrefused|enotfound|err_invalid_url|bad port)\b/.test(lowerBody)) {
184
+ return {
185
+ category: "validation",
186
+ retryable: false,
187
+ retryHint: "DSS is not reachable at this URL. Check --url / DATAIKU_URL (scheme, host, port) and that DSS is running; do not retry unchanged.",
188
+ };
189
+ }
173
190
  return {
174
191
  category: "transient",
175
192
  retryable: true,
@@ -295,11 +312,7 @@ export function classifyDataikuError(status, body) {
295
312
  || (lowerBody.includes("permission")
296
313
  && (lowerBody.includes("cannot use") || lowerBody.includes("not allowed"))));
297
314
  if (isServerPermissionLike) {
298
- return {
299
- category: "forbidden",
300
- retryable: false,
301
- retryHint: "Check API key validity and project permissions for the requested action.",
302
- };
315
+ return { category: "forbidden", retryable: false, retryHint: FORBIDDEN_HINT, };
303
316
  }
304
317
  if (status === 404) {
305
318
  if (isBusinessAppsApiRootNotFound(lowerBody)) {
@@ -315,15 +328,11 @@ export function classifyDataikuError(status, body) {
315
328
  retryable: false,
316
329
  retryHint: isHtmlGatewayResponse
317
330
  ? "Resource was not found (gateway returned HTML). Verify DSS URL, projectKey, and object identifiers."
318
- : "Verify projectKey and object identifiers (dataset/recipe/scenario/folder IDs).",
331
+ : NOT_FOUND_HINT,
319
332
  };
320
333
  }
321
334
  if (status === 401 || status === 403) {
322
- return {
323
- category: "forbidden",
324
- retryable: false,
325
- retryHint: "Check API key validity and project permissions for the requested action.",
326
- };
335
+ return { category: "forbidden", retryable: false, retryHint: FORBIDDEN_HINT, };
327
336
  }
328
337
  if (status === 400 || status === 409 || status === 422) {
329
338
  return {
@@ -367,31 +376,40 @@ export class DataikuError extends Error {
367
376
  trustedTarget;
368
377
  trustedElapsedMs;
369
378
  bodyTruncated;
379
+ /** DSS definitively failed the whole operation; see `DataikuErrorTrustedMetadata.definiteFailure`. */
380
+ definiteFailure;
381
+ /** Client-side outcome context (e.g. rollback of partial mutations), surfaced in CLI `details`. */
382
+ details;
370
383
  constructor(status, statusText, body, retry, requestId, trustedMetadata) {
371
- const details = DataikuError.buildDetails(status, body, retry);
384
+ const details = DataikuError.buildDetails(status, body);
372
385
  super(details.message);
373
386
  this.status = status;
374
387
  this.statusText = statusText;
375
388
  this.body = body;
376
389
  this.name = "DataikuError";
377
- this.category = details.category;
378
- this.retryable = details.retryable;
379
- this.retryHint = details.retryHint;
390
+ const definite = trustedMetadata?.definiteFailure === true;
391
+ // A definite DSS refusal is not a transport/server fault: replaying it
392
+ // unchanged cannot succeed. Keep a more specific forbidden/not_found class.
393
+ const reclassify = definite
394
+ && (details.category === "transient" || details.category === "unknown"
395
+ || details.category === "unexpected_response");
396
+ this.category = reclassify ? "validation" : details.category;
397
+ this.retryable = reclassify ? false : details.retryable;
398
+ this.retryHint = reclassify ? DEFINITE_FAILURE_HINT : details.retryHint;
380
399
  this.retry = retry;
381
400
  this.requestId = requestId;
382
401
  this.trustedTarget = trustedMetadata?.target;
383
402
  this.trustedElapsedMs = trustedMetadata?.elapsedMs;
384
403
  this.bodyTruncated = trustedMetadata?.bodyTruncated === true ? true : undefined;
404
+ this.definiteFailure = definite ? true : undefined;
385
405
  }
406
+ /** Status line only: never echoes response body text. */
386
407
  get safeMessage() {
387
- const retrySummary = DataikuError.formatRetryMetadata(this.retry);
388
- return [
389
- `${this.status} ${canonicalStatusText(this.status)}`,
390
- `Error type: ${this.category}`,
391
- `Retryable: ${this.retryable ? "yes" : "no"}`,
392
- `Hint: ${this.retryHint}`,
393
- ...(retrySummary ? [retrySummary,] : []),
394
- ].join("\n");
408
+ return `${this.status} ${canonicalStatusText(this.status)}`;
409
+ }
410
+ /** The DSS message part of `message` (HTML summarized, server paths stripped, bounded). */
411
+ get summary() {
412
+ return this.message.slice(this.safeMessage.length + 2);
395
413
  }
396
414
  static extractSummary(_status, body) {
397
415
  try {
@@ -406,33 +424,14 @@ export class DataikuError extends Error {
406
424
  return "(empty response body)";
407
425
  return summarizeErrorText(body);
408
426
  }
409
- static formatRetryMetadata(retry) {
410
- if (!retry)
411
- return undefined;
412
- const shownDelays = retry.delaysMs.slice(0, 10);
413
- const delaysSuffix = retry.delaysMs.length > shownDelays.length ? ", …" : "";
414
- const delaysPart = shownDelays.length > 0 ? `[${shownDelays.join(", ")}${delaysSuffix}]` : "[]";
415
- return [
416
- `Retry attempts: ${retry.attempts}/${retry.maxAttempts}`,
417
- `Retry policy: ${retry.enabled ? "enabled" : "disabled"} for ${retry.method}`,
418
- `Retries performed: ${retry.retries}`,
419
- `Backoff delays (ms): ${delaysPart}`,
420
- `Timed out: ${retry.timedOut ? "yes" : "no"}`,
421
- ].join(" | ");
422
- }
423
- static buildDetails(status, body, retry) {
424
- const summary = DataikuError.extractSummary(status, body);
425
- const taxonomy = classifyDataikuError(status, body);
426
- const retrySummary = DataikuError.formatRetryMetadata(retry);
427
+ /**
428
+ * One line: status plus the DSS message. Category, retryability, hint, and
429
+ * retry metadata are structured fields on the error, not message prose.
430
+ */
431
+ static buildDetails(status, body) {
427
432
  return {
428
- ...taxonomy,
429
- message: [
430
- `${status} ${canonicalStatusText(status)}: ${summary}`,
431
- `Error type: ${taxonomy.category}`,
432
- `Retryable: ${taxonomy.retryable ? "yes" : "no"}`,
433
- `Hint: ${taxonomy.retryHint}`,
434
- ...(retrySummary ? [retrySummary,] : []),
435
- ].join("\n"),
433
+ ...classifyDataikuError(status, body),
434
+ message: `${status} ${canonicalStatusText(status)}: ${DataikuError.extractSummary(status, body).replace(/\s+/g, " ").trim()}`,
436
435
  };
437
436
  }
438
437
  }