dataiku-sdk 0.10.1 → 0.12.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/LICENSE +21 -0
- package/dist/packages/types/src/index.d.ts +19 -2
- package/dist/packages/types/src/index.js +13 -1
- package/dist/src/cli/coerce.d.ts +36 -0
- package/dist/src/cli/coerce.js +239 -0
- package/dist/src/cli/commands/analysis.d.ts +2 -0
- package/dist/src/cli/commands/analysis.js +66 -0
- package/dist/src/cli/commands/api-deployer.d.ts +2 -0
- package/dist/src/cli/commands/api-deployer.js +170 -0
- package/dist/src/cli/commands/api-service.d.ts +2 -0
- package/dist/src/cli/commands/api-service.js +121 -0
- package/dist/src/cli/commands/app.d.ts +2 -0
- package/dist/src/cli/commands/app.js +78 -0
- package/dist/src/cli/commands/bundle.d.ts +2 -0
- package/dist/src/cli/commands/bundle.js +107 -0
- package/dist/src/cli/commands/business-app.d.ts +2 -0
- package/dist/src/cli/commands/business-app.js +76 -0
- package/dist/src/cli/commands/code-env.d.ts +2 -0
- package/dist/src/cli/commands/code-env.js +255 -0
- package/dist/src/cli/commands/code.d.ts +2 -0
- package/dist/src/cli/commands/code.js +63 -0
- package/dist/src/cli/commands/connection.d.ts +2 -0
- package/dist/src/cli/commands/connection.js +54 -0
- package/dist/src/cli/commands/continuous-activity.d.ts +2 -0
- package/dist/src/cli/commands/continuous-activity.js +38 -0
- package/dist/src/cli/commands/dashboard.d.ts +2 -0
- package/dist/src/cli/commands/dashboard.js +99 -0
- package/dist/src/cli/commands/data-quality.d.ts +2 -0
- package/dist/src/cli/commands/data-quality.js +235 -0
- package/dist/src/cli/commands/dataset.d.ts +2 -0
- package/dist/src/cli/commands/dataset.js +288 -0
- package/dist/src/cli/commands/discussion.d.ts +2 -0
- package/dist/src/cli/commands/discussion.js +47 -0
- package/dist/src/cli/commands/doctor.d.ts +2 -0
- package/dist/src/cli/commands/doctor.js +9 -0
- package/dist/src/cli/commands/flow-zone.d.ts +2 -0
- package/dist/src/cli/commands/flow-zone.js +282 -0
- package/dist/src/cli/commands/folder.d.ts +2 -0
- package/dist/src/cli/commands/folder.js +202 -0
- package/dist/src/cli/commands/future.d.ts +2 -0
- package/dist/src/cli/commands/future.js +57 -0
- package/dist/src/cli/commands/index.d.ts +2 -0
- package/dist/src/cli/commands/index.js +78 -0
- package/dist/src/cli/commands/insight.d.ts +2 -0
- package/dist/src/cli/commands/insight.js +156 -0
- package/dist/src/cli/commands/job.d.ts +2 -0
- package/dist/src/cli/commands/job.js +406 -0
- package/dist/src/cli/commands/meaning.d.ts +2 -0
- package/dist/src/cli/commands/meaning.js +115 -0
- package/dist/src/cli/commands/metrics.d.ts +2 -0
- package/dist/src/cli/commands/metrics.js +39 -0
- package/dist/src/cli/commands/ml-task.d.ts +2 -0
- package/dist/src/cli/commands/ml-task.js +171 -0
- package/dist/src/cli/commands/model-evaluation-store.d.ts +2 -0
- package/dist/src/cli/commands/model-evaluation-store.js +83 -0
- package/dist/src/cli/commands/notebook.d.ts +2 -0
- package/dist/src/cli/commands/notebook.js +242 -0
- package/dist/src/cli/commands/project-deployer.d.ts +2 -0
- package/dist/src/cli/commands/project-deployer.js +118 -0
- package/dist/src/cli/commands/project-library.d.ts +2 -0
- package/dist/src/cli/commands/project-library.js +197 -0
- package/dist/src/cli/commands/project.d.ts +2 -0
- package/dist/src/cli/commands/project.js +133 -0
- package/dist/src/cli/commands/recipe.d.ts +2 -0
- package/dist/src/cli/commands/recipe.js +659 -0
- package/dist/src/cli/commands/saved-model.d.ts +2 -0
- package/dist/src/cli/commands/saved-model.js +85 -0
- package/dist/src/cli/commands/scenario.d.ts +2 -0
- package/dist/src/cli/commands/scenario.js +190 -0
- package/dist/src/cli/commands/sql.d.ts +2 -0
- package/dist/src/cli/commands/sql.js +109 -0
- package/dist/src/cli/commands/statistics.d.ts +2 -0
- package/dist/src/cli/commands/statistics.js +165 -0
- package/dist/src/cli/commands/streaming-endpoint.d.ts +2 -0
- package/dist/src/cli/commands/streaming-endpoint.js +50 -0
- package/dist/src/cli/commands/variable.d.ts +2 -0
- package/dist/src/cli/commands/variable.js +49 -0
- package/dist/src/cli/commands/webapp.d.ts +2 -0
- package/dist/src/cli/commands/webapp.js +67 -0
- package/dist/src/cli/commands/wiki.d.ts +2 -0
- package/dist/src/cli/commands/wiki.js +123 -0
- package/dist/src/cli/commands/workspace.d.ts +2 -0
- package/dist/src/cli/commands/workspace.js +68 -0
- package/dist/src/cli/contract.d.ts +104 -0
- package/dist/src/cli/contract.js +2041 -0
- package/dist/src/cli/doctor.d.ts +104 -0
- package/dist/src/cli/doctor.js +356 -0
- package/dist/src/cli/env.d.ts +2 -0
- package/dist/src/cli/env.js +37 -0
- package/dist/src/cli/flags.d.ts +16 -0
- package/dist/src/cli/flags.js +272 -0
- package/dist/src/cli/helpers/cleanup.d.ts +3 -0
- package/dist/src/cli/helpers/cleanup.js +204 -0
- package/dist/src/cli/helpers/dataset.d.ts +2 -0
- package/dist/src/cli/helpers/dataset.js +17 -0
- package/dist/src/cli/helpers/flow-zone.d.ts +69 -0
- package/dist/src/cli/helpers/flow-zone.js +420 -0
- package/dist/src/cli/helpers/recipe.d.ts +11 -0
- package/dist/src/cli/helpers/recipe.js +83 -0
- package/dist/src/cli/output.d.ts +38 -0
- package/dist/src/cli/output.js +159 -0
- package/dist/src/cli/runtime.d.ts +15 -0
- package/dist/src/cli/runtime.js +59 -0
- package/dist/src/cli/types.d.ts +25 -0
- package/dist/src/cli/types.js +1 -0
- package/dist/src/cli/usage.d.ts +16 -0
- package/dist/src/cli/usage.js +84 -0
- package/dist/src/cli/version.d.ts +14 -0
- package/dist/src/cli/version.js +63 -0
- package/dist/src/cli.js +671 -8254
- package/dist/src/client.d.ts +13 -1
- package/dist/src/client.js +34 -13
- package/dist/src/errors.d.ts +6 -0
- package/dist/src/errors.js +102 -4
- package/dist/src/index.d.ts +7 -3
- package/dist/src/index.js +6 -2
- package/dist/src/resources/analyses.d.ts +34 -0
- package/dist/src/resources/analyses.js +31 -0
- package/dist/src/resources/api-services.d.ts +2 -0
- package/dist/src/resources/api-services.js +10 -0
- package/dist/src/resources/applications.d.ts +1 -1
- package/dist/src/resources/applications.js +27 -1
- package/dist/src/resources/continuous-activities.js +1 -0
- package/dist/src/resources/data-quality.js +5 -3
- package/dist/src/resources/datasets.d.ts +3 -0
- package/dist/src/resources/datasets.js +10 -5
- package/dist/src/resources/flow-zones.d.ts +2 -2
- package/dist/src/resources/flow-zones.js +4 -1
- package/dist/src/resources/meanings.d.ts +2 -0
- package/dist/src/resources/meanings.js +4 -0
- package/dist/src/resources/ml-tasks.d.ts +91 -0
- package/dist/src/resources/ml-tasks.js +130 -0
- package/dist/src/resources/model-evaluation-stores.d.ts +41 -0
- package/dist/src/resources/model-evaluation-stores.js +36 -0
- package/dist/src/resources/notebooks.d.ts +5 -7
- package/dist/src/resources/notebooks.js +10 -7
- package/dist/src/resources/projects.d.ts +1 -1
- package/dist/src/resources/projects.js +2 -2
- package/dist/src/resources/recipes.d.ts +3 -3
- package/dist/src/resources/recipes.js +198 -38
- package/dist/src/resources/saved-models.d.ts +41 -0
- package/dist/src/resources/saved-models.js +40 -0
- package/dist/src/resources/scenarios.js +67 -26
- package/dist/src/resources/statistics.js +9 -0
- package/dist/src/schemas.d.ts +2 -2
- package/dist/src/schemas.js +1 -1
- package/dist/src/skill.js +2 -2
- package/dist/src/utils/sanitize.js +2 -1
- package/package.json +1 -1
- package/packages/types/dist/index.d.ts +19 -2
- package/packages/types/dist/index.js +13 -1
package/dist/src/client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Static, type TSchema } from "@sinclair/typebox";
|
|
2
|
+
import { AnalysesResource } from "./resources/analyses.js";
|
|
2
3
|
import { ApiDeployerResource } from "./resources/api-deployer.js";
|
|
3
4
|
import { ApiServicesResource } from "./resources/api-services.js";
|
|
4
5
|
import { ApplicationsResource } from "./resources/applications.js";
|
|
@@ -17,10 +18,13 @@ import { InsightsResource } from "./resources/insights.js";
|
|
|
17
18
|
import { JobsResource } from "./resources/jobs.js";
|
|
18
19
|
import { MeaningsResource } from "./resources/meanings.js";
|
|
19
20
|
import { MetricsResource } from "./resources/metrics.js";
|
|
21
|
+
import { MlTasksResource } from "./resources/ml-tasks.js";
|
|
22
|
+
import { ModelEvaluationStoresResource } from "./resources/model-evaluation-stores.js";
|
|
20
23
|
import { NotebooksResource } from "./resources/notebooks.js";
|
|
21
24
|
import { ProjectLibraryResource } from "./resources/project-library.js";
|
|
22
25
|
import { ProjectsResource } from "./resources/projects.js";
|
|
23
26
|
import { RecipesResource } from "./resources/recipes.js";
|
|
27
|
+
import { SavedModelsResource } from "./resources/saved-models.js";
|
|
24
28
|
import { ScenariosResource } from "./resources/scenarios.js";
|
|
25
29
|
import { SqlResource } from "./resources/sql.js";
|
|
26
30
|
import { StatisticsResource } from "./resources/statistics.js";
|
|
@@ -107,6 +111,10 @@ export declare class DataikuClient {
|
|
|
107
111
|
private workspacesResource?;
|
|
108
112
|
private metricsResource?;
|
|
109
113
|
private meaningsResource?;
|
|
114
|
+
private analysesResource?;
|
|
115
|
+
private mlTasksResource?;
|
|
116
|
+
private savedModelsResource?;
|
|
117
|
+
private modelEvaluationStoresResource?;
|
|
110
118
|
get projects(): ProjectsResource;
|
|
111
119
|
get datasets(): DatasetsResource;
|
|
112
120
|
get dashboards(): DashboardsResource;
|
|
@@ -138,7 +146,11 @@ export declare class DataikuClient {
|
|
|
138
146
|
get workspaces(): WorkspacesResource;
|
|
139
147
|
get metrics(): MetricsResource;
|
|
140
148
|
get meanings(): MeaningsResource;
|
|
141
|
-
|
|
149
|
+
get analyses(): AnalysesResource;
|
|
150
|
+
get mlTasks(): MlTasksResource;
|
|
151
|
+
get savedModels(): SavedModelsResource;
|
|
152
|
+
get modelEvaluationStores(): ModelEvaluationStoresResource;
|
|
153
|
+
constructor(config?: DataikuClientConfig);
|
|
142
154
|
getRequestTimeoutMs(): number;
|
|
143
155
|
resolveProjectKey(paramValue?: string): string;
|
|
144
156
|
get<T = unknown>(path: string): Promise<T>;
|
package/dist/src/client.js
CHANGED
|
@@ -3,6 +3,7 @@ import { getCACertificates, } from "node:tls";
|
|
|
3
3
|
import { Value, } from "@sinclair/typebox/value";
|
|
4
4
|
import { safeParseSchema, } from "./schemas.js";
|
|
5
5
|
import { classifyDataikuError, DataikuError, } from "./errors.js";
|
|
6
|
+
import { AnalysesResource, } from "./resources/analyses.js";
|
|
6
7
|
import { ApiDeployerResource, } from "./resources/api-deployer.js";
|
|
7
8
|
import { ApiServicesResource, } from "./resources/api-services.js";
|
|
8
9
|
import { ApplicationsResource, } from "./resources/applications.js";
|
|
@@ -21,10 +22,13 @@ import { InsightsResource, } from "./resources/insights.js";
|
|
|
21
22
|
import { JobsResource, } from "./resources/jobs.js";
|
|
22
23
|
import { MeaningsResource, } from "./resources/meanings.js";
|
|
23
24
|
import { MetricsResource, } from "./resources/metrics.js";
|
|
25
|
+
import { MlTasksResource, } from "./resources/ml-tasks.js";
|
|
26
|
+
import { ModelEvaluationStoresResource, } from "./resources/model-evaluation-stores.js";
|
|
24
27
|
import { NotebooksResource, } from "./resources/notebooks.js";
|
|
25
28
|
import { ProjectLibraryResource, } from "./resources/project-library.js";
|
|
26
29
|
import { ProjectsResource, } from "./resources/projects.js";
|
|
27
30
|
import { RecipesResource, } from "./resources/recipes.js";
|
|
31
|
+
import { SavedModelsResource, } from "./resources/saved-models.js";
|
|
28
32
|
import { ScenariosResource, } from "./resources/scenarios.js";
|
|
29
33
|
import { SqlResource, } from "./resources/sql.js";
|
|
30
34
|
import { StatisticsResource, } from "./resources/statistics.js";
|
|
@@ -176,6 +180,10 @@ export class DataikuClient {
|
|
|
176
180
|
workspacesResource;
|
|
177
181
|
metricsResource;
|
|
178
182
|
meaningsResource;
|
|
183
|
+
analysesResource;
|
|
184
|
+
mlTasksResource;
|
|
185
|
+
savedModelsResource;
|
|
186
|
+
modelEvaluationStoresResource;
|
|
179
187
|
get projects() {
|
|
180
188
|
return (this.projectsResource ??= new ProjectsResource(this));
|
|
181
189
|
}
|
|
@@ -269,23 +277,36 @@ export class DataikuClient {
|
|
|
269
277
|
get meanings() {
|
|
270
278
|
return (this.meaningsResource ??= new MeaningsResource(this));
|
|
271
279
|
}
|
|
280
|
+
get analyses() {
|
|
281
|
+
return (this.analysesResource ??= new AnalysesResource(this));
|
|
282
|
+
}
|
|
283
|
+
get mlTasks() {
|
|
284
|
+
return (this.mlTasksResource ??= new MlTasksResource(this));
|
|
285
|
+
}
|
|
286
|
+
get savedModels() {
|
|
287
|
+
return (this.savedModelsResource ??= new SavedModelsResource(this));
|
|
288
|
+
}
|
|
289
|
+
get modelEvaluationStores() {
|
|
290
|
+
return (this.modelEvaluationStoresResource ??= new ModelEvaluationStoresResource(this));
|
|
291
|
+
}
|
|
272
292
|
constructor(config) {
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
const apiKey = config
|
|
277
|
-
if (!apiKey)
|
|
278
|
-
throw new Error("
|
|
293
|
+
const envUrl = process.env["DATAIKU_URL"]?.trim();
|
|
294
|
+
const envApiKey = process.env["DATAIKU_API_KEY"]?.trim();
|
|
295
|
+
const url = config?.url?.trim() || envUrl;
|
|
296
|
+
const apiKey = config?.apiKey?.trim() || envApiKey;
|
|
297
|
+
if (!url || !apiKey) {
|
|
298
|
+
throw new Error("Dataiku URL and API key are required: pass {url, apiKey} or set DATAIKU_URL/DATAIKU_API_KEY");
|
|
299
|
+
}
|
|
279
300
|
this.baseUrl = url.replace(/\/+$/, "");
|
|
280
301
|
this.apiKey = apiKey;
|
|
281
|
-
this.defaultProjectKey = config
|
|
282
|
-
this.requestTimeoutMs = config
|
|
283
|
-
const rawMax = config
|
|
302
|
+
this.defaultProjectKey = config?.projectKey?.trim() || undefined;
|
|
303
|
+
this.requestTimeoutMs = config?.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
304
|
+
const rawMax = config?.retryMaxAttempts ?? DEFAULT_RETRY_MAX_ATTEMPTS;
|
|
284
305
|
this.retryMaxAttempts = Math.min(Math.max(1, rawMax), MAX_RETRY_ATTEMPTS_CAP);
|
|
285
|
-
this.verbose = config
|
|
286
|
-
this.tlsOptions = buildFetchTlsOptions(config);
|
|
287
|
-
this.onTrace = config
|
|
288
|
-
this.onValidationWarning = config
|
|
306
|
+
this.verbose = config?.verbose === true;
|
|
307
|
+
this.tlsOptions = config ? buildFetchTlsOptions(config) : undefined;
|
|
308
|
+
this.onTrace = config?.onTrace ?? defaultTrace;
|
|
309
|
+
this.onValidationWarning = config?.onValidationWarning ?? defaultValidationWarning;
|
|
289
310
|
}
|
|
290
311
|
getRequestTimeoutMs() {
|
|
291
312
|
return this.requestTimeoutMs;
|
package/dist/src/errors.d.ts
CHANGED
|
@@ -15,6 +15,12 @@ export interface DataikuRetryMetadata {
|
|
|
15
15
|
delaysMs: number[];
|
|
16
16
|
timedOut: boolean;
|
|
17
17
|
}
|
|
18
|
+
export declare class ClientValidationError extends Error {
|
|
19
|
+
readonly code: StableErrorCode;
|
|
20
|
+
readonly hint?: string;
|
|
21
|
+
readonly details?: Record<string, unknown>;
|
|
22
|
+
constructor(message: string, code?: StableErrorCode, hint?: string, details?: Record<string, unknown>);
|
|
23
|
+
}
|
|
18
24
|
export declare function classifyDataikuError(status: number, body: string): DataikuErrorTaxonomy;
|
|
19
25
|
export declare class DataikuError extends Error {
|
|
20
26
|
status: number;
|
package/dist/src/errors.js
CHANGED
|
@@ -12,8 +12,71 @@ export function dataikuErrorCode(category) {
|
|
|
12
12
|
return "internal_error";
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
export class ClientValidationError extends Error {
|
|
16
|
+
code;
|
|
17
|
+
hint;
|
|
18
|
+
details;
|
|
19
|
+
constructor(message, code = "validation_failed", hint, details) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.name = "ClientValidationError";
|
|
22
|
+
this.code = code;
|
|
23
|
+
this.hint = hint;
|
|
24
|
+
this.details = details;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
15
27
|
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.";
|
|
16
28
|
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.";
|
|
29
|
+
const MAX_ERROR_SUMMARY_LENGTH = 200;
|
|
30
|
+
function isHtmlResponseBody(body) {
|
|
31
|
+
const lowerTrimmed = body.trimStart().slice(0, 500).toLowerCase();
|
|
32
|
+
return lowerTrimmed.startsWith("<")
|
|
33
|
+
|| lowerTrimmed.includes("<!doctype html")
|
|
34
|
+
|| lowerTrimmed.includes("<html")
|
|
35
|
+
|| lowerTrimmed.includes("<body")
|
|
36
|
+
|| lowerTrimmed.includes("<title");
|
|
37
|
+
}
|
|
38
|
+
function stripServerFilesystemPaths(text) {
|
|
39
|
+
return text
|
|
40
|
+
.replace(/\b[A-Za-z]:\\[^\s"'`<>),\]}]+/g, "[server path]")
|
|
41
|
+
.replace(/(^|[\s("'`[{])\/(?=[^\s"'`<>),\]}]*\/)(?!(?:public|dip|api|backend|auth|login|projects?|datasets?|recipes?|scenarios?|folders?)(?:\/|$))[^\s"'`<>),\]}]+/g, "$1[server path]");
|
|
42
|
+
}
|
|
43
|
+
function decodeHtmlEntities(text) {
|
|
44
|
+
return text
|
|
45
|
+
.replace(/ /gi, " ")
|
|
46
|
+
.replace(/&/gi, "&")
|
|
47
|
+
.replace(/</gi, "<")
|
|
48
|
+
.replace(/>/gi, ">")
|
|
49
|
+
.replace(/"/gi, '"')
|
|
50
|
+
.replace(/'/g, "'")
|
|
51
|
+
.replace(/'/gi, "'");
|
|
52
|
+
}
|
|
53
|
+
function firstHtmlTextLine(body) {
|
|
54
|
+
const text = decodeHtmlEntities(body
|
|
55
|
+
.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, " ")
|
|
56
|
+
.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, " ")
|
|
57
|
+
.replace(/<[^>]+>/g, "\n"));
|
|
58
|
+
return text
|
|
59
|
+
.split(/\r?\n/g)
|
|
60
|
+
.map((line) => line.trim())
|
|
61
|
+
.find((line) => line.length > 0);
|
|
62
|
+
}
|
|
63
|
+
function conciseErrorSummary(text) {
|
|
64
|
+
const sanitized = stripServerFilesystemPaths(text);
|
|
65
|
+
return sanitized.length > MAX_ERROR_SUMMARY_LENGTH
|
|
66
|
+
? `${sanitized.slice(0, MAX_ERROR_SUMMARY_LENGTH)}…`
|
|
67
|
+
: sanitized;
|
|
68
|
+
}
|
|
69
|
+
function summarizeHtmlErrorBody(body) {
|
|
70
|
+
const textLine = firstHtmlTextLine(body);
|
|
71
|
+
if (!textLine)
|
|
72
|
+
return "HTML error page from DSS";
|
|
73
|
+
return `HTML error page from DSS: ${conciseErrorSummary(textLine)}`;
|
|
74
|
+
}
|
|
75
|
+
function summarizeErrorText(text) {
|
|
76
|
+
if (isHtmlResponseBody(text))
|
|
77
|
+
return summarizeHtmlErrorBody(text);
|
|
78
|
+
return conciseErrorSummary(text);
|
|
79
|
+
}
|
|
17
80
|
function isCertificateTrustFailure(lowerBody) {
|
|
18
81
|
return lowerBody.includes("unable to verify the first certificate")
|
|
19
82
|
|| lowerBody.includes("unable to get local issuer certificate")
|
|
@@ -69,6 +132,15 @@ export function classifyDataikuError(status, body) {
|
|
|
69
132
|
retryHint: "SQL recipes require SQL/Athena-backed input datasets. Use a SQL-compatible input, associate the S3 dataset with Athena, or create a Python recipe for file/S3 inputs.",
|
|
70
133
|
};
|
|
71
134
|
}
|
|
135
|
+
const isLicenseDenied = status >= 400
|
|
136
|
+
&& lowerBody.includes("license does not allow");
|
|
137
|
+
if (isLicenseDenied) {
|
|
138
|
+
return {
|
|
139
|
+
category: "forbidden",
|
|
140
|
+
retryable: false,
|
|
141
|
+
retryHint: "DSS license or enabled features do not allow this operation. Contact a DSS administrator; do not retry unchanged.",
|
|
142
|
+
};
|
|
143
|
+
}
|
|
72
144
|
const isMissingDatasetRootPath = status === 500
|
|
73
145
|
&& lowerBody.includes("root path of the dataset")
|
|
74
146
|
&& lowerBody.includes("does not exist");
|
|
@@ -79,10 +151,36 @@ export function classifyDataikuError(status, body) {
|
|
|
79
151
|
retryHint: "Dataset files are missing on storage. Build/materialize the dataset or upstream recipes before preview/download.",
|
|
80
152
|
};
|
|
81
153
|
}
|
|
154
|
+
const isReadDirectoryAsFile = status >= 500
|
|
155
|
+
&& lowerBody.includes("cannot read directory as file");
|
|
156
|
+
if (isReadDirectoryAsFile) {
|
|
157
|
+
return {
|
|
158
|
+
category: "validation",
|
|
159
|
+
retryable: false,
|
|
160
|
+
retryHint: "The path refers to a directory, not a file. List its contents instead of reading it as a file; do not retry unchanged.",
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
const apostropheNormalizedBody = lowerBody.replace(/\\u0027|\u2019/g, "'");
|
|
164
|
+
const isServerObjectMissingContraction = status >= 500
|
|
165
|
+
&& apostropheNormalizedBody.includes("doesn't exist");
|
|
166
|
+
if (isServerObjectMissingContraction) {
|
|
167
|
+
return {
|
|
168
|
+
category: "not_found",
|
|
169
|
+
retryable: false,
|
|
170
|
+
retryHint: "Requested object was not found. Verify the identifier before retrying.",
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
const hasServerMissingObjectToken = lowerBody.includes("package")
|
|
174
|
+
|| lowerBody.includes("directory");
|
|
175
|
+
const hasServerMissingObjectLanguage = lowerBody.includes("does not exist")
|
|
176
|
+
|| lowerBody.includes("not found");
|
|
177
|
+
const isServerFilesystemNotFoundLike = status >= 500
|
|
178
|
+
&& (lowerBody.includes("not a file")
|
|
179
|
+
|| (hasServerMissingObjectToken && hasServerMissingObjectLanguage));
|
|
82
180
|
const isServerNotFoundLike = status >= 500
|
|
83
181
|
&& (lowerBody.includes("not found") || lowerBody.includes("does not exist"))
|
|
84
182
|
&& ["dataset", "recipe", "scenario", "project", "folder",].some((token) => lowerBody.includes(token));
|
|
85
|
-
if (isServerNotFoundLike) {
|
|
183
|
+
if (isServerFilesystemNotFoundLike || isServerNotFoundLike) {
|
|
86
184
|
return {
|
|
87
185
|
category: "not_found",
|
|
88
186
|
retryable: false,
|
|
@@ -133,7 +231,7 @@ export function classifyDataikuError(status, body) {
|
|
|
133
231
|
retryHint: BUSINESS_APPS_API_UNAVAILABLE_HINT,
|
|
134
232
|
};
|
|
135
233
|
}
|
|
136
|
-
const isHtmlGatewayResponse =
|
|
234
|
+
const isHtmlGatewayResponse = isHtmlResponseBody(body);
|
|
137
235
|
return {
|
|
138
236
|
category: "not_found",
|
|
139
237
|
retryable: false,
|
|
@@ -195,14 +293,14 @@ export class DataikuError extends Error {
|
|
|
195
293
|
try {
|
|
196
294
|
const parsed = JSON.parse(body);
|
|
197
295
|
if (parsed.message)
|
|
198
|
-
return String(parsed.message);
|
|
296
|
+
return summarizeErrorText(String(parsed.message));
|
|
199
297
|
}
|
|
200
298
|
catch {
|
|
201
299
|
// not JSON — use raw body
|
|
202
300
|
}
|
|
203
301
|
if (!body)
|
|
204
302
|
return "(empty response body)";
|
|
205
|
-
return body
|
|
303
|
+
return summarizeErrorText(body);
|
|
206
304
|
}
|
|
207
305
|
static formatRetryMetadata(retry) {
|
|
208
306
|
if (!retry)
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { DataikuClient, type DataikuClientConfig, type DataikuClientTraceEvent, } from "./client.js";
|
|
2
2
|
export { type CredentialValidationOptions, type CredentialValidationResult, validateCredentials, } from "./auth.js";
|
|
3
3
|
export { type DssCredentials, getConfigDir, getCredentialsPath, loadCredentials, saveCredentials, } from "./config.js";
|
|
4
|
-
export { DataikuError, type DataikuErrorCategory, type DataikuErrorTaxonomy, type DataikuRetryMetadata, } from "./errors.js";
|
|
4
|
+
export { ClientValidationError, DataikuError, type DataikuErrorCategory, type DataikuErrorTaxonomy, type DataikuRetryMetadata, } from "./errors.js";
|
|
5
|
+
export * from "./resources/analyses.js";
|
|
5
6
|
export { ApiDeployerResource, } from "./resources/api-deployer.js";
|
|
6
7
|
export { ApiServicesResource, } from "./resources/api-services.js";
|
|
7
8
|
export { ApplicationsResource, } from "./resources/applications.js";
|
|
@@ -20,10 +21,13 @@ export { InsightsResource, } from "./resources/insights.js";
|
|
|
20
21
|
export { computeNextPollDelayMs, type JobBuildAndWaitOptions, type JobBuildOptions, type JobBuildTarget, type JobBuildTargetType, type JobLogFilter, type JobLogProgress, type JobLogSummary, JobsResource, parseJobLogProgress, } from "./resources/jobs.js";
|
|
21
22
|
export { MeaningsResource, } from "./resources/meanings.js";
|
|
22
23
|
export { MetricsResource, } from "./resources/metrics.js";
|
|
24
|
+
export * from "./resources/ml-tasks.js";
|
|
25
|
+
export * from "./resources/model-evaluation-stores.js";
|
|
23
26
|
export { NotebooksResource, } from "./resources/notebooks.js";
|
|
24
27
|
export { ProjectLibraryResource, } from "./resources/project-library.js";
|
|
25
28
|
export { type FlowMapResult, ProjectsResource, } from "./resources/projects.js";
|
|
26
29
|
export { type RecipeCloneOptions, type RecipeCloneResult, type RecipeGraphReference, type RecipeGraphValidationResult, type RecipeRunOptions, type RecipeRunOutput, type RecipeRunResult, RecipesResource, } from "./resources/recipes.js";
|
|
30
|
+
export * from "./resources/saved-models.js";
|
|
27
31
|
export { normalizeScenarioUpdateData, SCENARIO_CANONICAL_EDITABLE_FIELDS, type ScenarioFieldChange, type ScenarioFieldMismatch, type ScenarioScriptRunResult, ScenariosResource, type ScenarioUpdateNormalization, type ScenarioUpdatePreview, scenarioUpdatePreview, type ScenarioUpdateResult, } from "./resources/scenarios.js";
|
|
28
32
|
export { SqlResource, } from "./resources/sql.js";
|
|
29
33
|
export { StatisticsResource, } from "./resources/statistics.js";
|
|
@@ -32,9 +36,9 @@ export { VariablesResource, } from "./resources/variables.js";
|
|
|
32
36
|
export { WebappsResource, } from "./resources/webapps.js";
|
|
33
37
|
export { WikiResource, } from "./resources/wiki.js";
|
|
34
38
|
export { WorkspacesResource, } from "./resources/workspaces.js";
|
|
35
|
-
export { BuildModeSchema, CodeEnvActionResultSchema, CodeEnvCreateOptionsSchema, CodeEnvDetailsSchema, CodeEnvPackageListSchema, CodeEnvSetPackagesOptionsSchema, CodeEnvSummaryArraySchema, CodeEnvSummarySchema, CodeEnvUpdatePackagesOptionsSchema, CodeEnvUsageArraySchema, CodeEnvWaitOptionsSchema, ConnectionSummarySchema, DashboardDetailsSchema, DashboardSummaryArraySchema, DashboardSummarySchema, DataQualityComputeResultSchema, DataQualityProjectStatusSchema, DataQualityRuleArraySchema, DataQualityRuleResultArraySchema, DataQualityRuleResultSchema, DataQualityRuleSchema, DataQualityRulesSchema, DataQualityStatusByPartitionSchema, DataQualityStatusSchema, DataQualityTimelineEntrySchema, DataQualityTimelineSchema, DatasetCreateOptionsSchema, DatasetDetailsSchema, DatasetSchemaSchema, DatasetSummaryArraySchema, DatasetSummarySchema, FlowMapOptionsSchema, FlowZoneArraySchema, FlowZoneCreateOptionsSchema, FlowZoneItemSchema, FlowZoneObjectTypeSchema, FlowZonePositionSchema, FlowZoneSchema, FlowZoneUpdateOptionsSchema, FolderCreateOptionsSchema, FolderDetailsSchema, FolderItemArraySchema, FolderItemSchema, FolderSummaryArraySchema, FolderSummarySchema, FutureStateSchema, FutureWaitResultSchema, InsightDetailsSchema, InsightSummaryArraySchema, InsightSummarySchema, JobSummaryArraySchema, JobSummarySchema, JobWaitResultSchema, JupyterCellSchema, JupyterNotebookContentSchema, JupyterNotebookSummaryArraySchema, JupyterNotebookSummarySchema, NotebookSessionArraySchema, NotebookSessionSchema, parseSchema, ProjectDetailsSchema, ProjectMetadataSchema, ProjectSummaryArraySchema, ProjectSummarySchema, ProjectVariablesSchema, RecipeCreateOptionsSchema, RecipeCreateResultSchema, RecipeDetailsSchema, RecipeSummaryArraySchema, RecipeSummarySchema, safeParseSchema, ScenarioDetailsSchema, ScenarioStatusSchema, ScenarioSummaryArraySchema, ScenarioSummarySchema, ScenarioWaitResultSchema, SqlNotebookCellSchema, SqlNotebookContentSchema, SqlNotebookSummaryArraySchema, SqlNotebookSummarySchema, SqlQueryResponseSchema, SqlQueryResultSchema, SqlQuerySchemaSchema, WikiArticleDataArraySchema, WikiArticleDataSchema, WikiArticleMetadataSchema, WikiSettingsSchema, WikiTaxonomyNodeSchema, } from "./schemas.js";
|
|
39
|
+
export { BuildModeSchema, CodeEnvActionResultSchema, CodeEnvCreateOptionsSchema, CodeEnvDetailsSchema, CodeEnvPackageListSchema, CodeEnvSetPackagesOptionsSchema, CodeEnvSummaryArraySchema, CodeEnvSummarySchema, CodeEnvUpdatePackagesOptionsSchema, CodeEnvUsageArraySchema, CodeEnvWaitOptionsSchema, ConnectionSummarySchema, DashboardDetailsSchema, DashboardSummaryArraySchema, DashboardSummarySchema, DataQualityComputeResultSchema, DataQualityProjectStatusSchema, DataQualityRuleArraySchema, DataQualityRuleResultArraySchema, DataQualityRuleResultSchema, DataQualityRuleSchema, DataQualityRulesSchema, DataQualityStatusByPartitionSchema, DataQualityStatusSchema, DataQualityTimelineEntrySchema, DataQualityTimelineSchema, DatasetCreateOptionsSchema, DatasetDetailsSchema, DatasetSchemaSchema, DatasetSummaryArraySchema, DatasetSummarySchema, FlowMapOptionsSchema, FlowZoneArraySchema, FlowZoneCreateOptionsSchema, FlowZoneItemSchema, FlowZoneObjectTypeSchema, FlowZonePositionSchema, FlowZoneSchema, FlowZoneUpdateOptionsSchema, FolderCreateOptionsSchema, FolderDetailsSchema, FolderItemArraySchema, FolderItemSchema, FolderSummaryArraySchema, FolderSummarySchema, FutureStateSchema, FutureWaitResultSchema, InsightDetailsSchema, InsightSummaryArraySchema, InsightSummarySchema, JobSummaryArraySchema, JobSummarySchema, JobWaitResultSchema, JupyterCellSchema, JupyterNotebookContentSchema, JupyterNotebookSummaryArraySchema, JupyterNotebookSummarySchema, NotebookSessionArraySchema, NotebookSessionSchema, parseSchema, ProjectDetailsSchema, ProjectMetadataSchema, ProjectSummaryArraySchema, ProjectSummarySchema, ProjectVariablesSchema, RecipeCreateOptionsSchema, RecipeCreateResultSchema, RecipeDetailsSchema, RecipeSummaryArraySchema, RecipeSummarySchema, safeParseSchema, ScenarioDetailsSchema, ScenarioStatusSchema, ScenarioStepRunSchema, ScenarioSummaryArraySchema, ScenarioSummarySchema, ScenarioWaitResultSchema, SqlNotebookCellSchema, SqlNotebookContentSchema, SqlNotebookSummaryArraySchema, SqlNotebookSummarySchema, SqlQueryResponseSchema, SqlQueryResultSchema, SqlQuerySchemaSchema, WikiArticleDataArraySchema, WikiArticleDataSchema, WikiArticleMetadataSchema, WikiSettingsSchema, WikiTaxonomyNodeSchema, } from "./schemas.js";
|
|
36
40
|
export type { SafeParseResult, } from "./schemas.js";
|
|
37
|
-
export type { BuildMode, CodeEnvActionResult, CodeEnvCreateOptions, CodeEnvDetails, CodeEnvPackageList, CodeEnvSetPackagesOptions, CodeEnvSummary, CodeEnvUpdatePackagesOptions, CodeEnvUsage, CodeEnvWaitOptions, ConnectionSummary, DashboardDetails, DashboardSummary, DataQualityComputeResult, DataQualityProjectStatus, DataQualityRule, DataQualityRuleResult, DataQualityRules, DataQualityStatus, DataQualityStatusByPartition, DataQualityTimeline, DataQualityTimelineEntry, DatasetCreateOptions, DatasetDetails, DatasetSchema, DatasetSummary, FlowMapOptions, FlowZone, FlowZoneCreateOptions, FlowZoneItem, FlowZoneObjectType, FlowZonePosition, FlowZoneUpdateOptions, FolderCreateOptions, FolderDetails, FolderItem, FolderSummary, FutureState, FutureWaitResult, InsightDetails, InsightSummary, JobSummary, JobWaitResult, JupyterCell, JupyterNotebookContent, JupyterNotebookSummary, NotebookSession, ProjectDetails, ProjectMetadata, ProjectSummary, ProjectVariables, RecipeCreateOptions, RecipeCreateResult, RecipeDetails, RecipeSummary, ScenarioDetails, ScenarioStatus, ScenarioSummary, ScenarioWaitResult, SqlNotebookCell, SqlNotebookContent, SqlNotebookSummary, SqlQueryResponse, SqlQueryResult, SqlQuerySchema, WikiArticleData, WikiArticleMetadata, WikiSettings, WikiTaxonomyNode, } from "./schemas.js";
|
|
41
|
+
export type { BuildMode, CodeEnvActionResult, CodeEnvCreateOptions, CodeEnvDetails, CodeEnvPackageList, CodeEnvSetPackagesOptions, CodeEnvSummary, CodeEnvUpdatePackagesOptions, CodeEnvUsage, CodeEnvWaitOptions, ConnectionSummary, DashboardDetails, DashboardSummary, DataQualityComputeResult, DataQualityProjectStatus, DataQualityRule, DataQualityRuleResult, DataQualityRules, DataQualityStatus, DataQualityStatusByPartition, DataQualityTimeline, DataQualityTimelineEntry, DatasetCreateOptions, DatasetDetails, DatasetSchema, DatasetSummary, FlowMapOptions, FlowZone, FlowZoneCreateOptions, FlowZoneItem, FlowZoneObjectType, FlowZonePosition, FlowZoneUpdateOptions, FolderCreateOptions, FolderDetails, FolderItem, FolderSummary, FutureState, FutureWaitResult, InsightDetails, InsightSummary, JobSummary, JobWaitResult, JupyterCell, JupyterNotebookContent, JupyterNotebookSummary, NotebookSession, ProjectDetails, ProjectMetadata, ProjectSummary, ProjectVariables, RecipeCreateOptions, RecipeCreateResult, RecipeDetails, RecipeSummary, ScenarioDetails, ScenarioStatus, ScenarioStepRun, ScenarioSummary, ScenarioWaitResult, SqlNotebookCell, SqlNotebookContent, SqlNotebookSummary, SqlQueryResponse, SqlQueryResult, SqlQuerySchema, WikiArticleData, WikiArticleMetadata, WikiSettings, WikiTaxonomyNode, } from "./schemas.js";
|
|
38
42
|
export { deepMerge, } from "./utils/deep-merge.js";
|
|
39
43
|
export { type NormalizedFlowEdge, type NormalizedFlowMap, type NormalizedFlowNode, normalizeFlowGraph, } from "./utils/flow-map.js";
|
|
40
44
|
export { sanitizeFileName, } from "./utils/sanitize.js";
|
package/dist/src/index.js
CHANGED
|
@@ -4,8 +4,9 @@ export { DataikuClient, } from "./client.js";
|
|
|
4
4
|
export { validateCredentials, } from "./auth.js";
|
|
5
5
|
export { getConfigDir, getCredentialsPath, loadCredentials, saveCredentials, } from "./config.js";
|
|
6
6
|
// Errors
|
|
7
|
-
export { DataikuError, } from "./errors.js";
|
|
7
|
+
export { ClientValidationError, DataikuError, } from "./errors.js";
|
|
8
8
|
// Resources (for advanced use / extension)
|
|
9
|
+
export * from "./resources/analyses.js";
|
|
9
10
|
export { ApiDeployerResource, } from "./resources/api-deployer.js";
|
|
10
11
|
export { ApiServicesResource, } from "./resources/api-services.js";
|
|
11
12
|
export { ApplicationsResource, } from "./resources/applications.js";
|
|
@@ -24,10 +25,13 @@ export { InsightsResource, } from "./resources/insights.js";
|
|
|
24
25
|
export { computeNextPollDelayMs, JobsResource, parseJobLogProgress, } from "./resources/jobs.js";
|
|
25
26
|
export { MeaningsResource, } from "./resources/meanings.js";
|
|
26
27
|
export { MetricsResource, } from "./resources/metrics.js";
|
|
28
|
+
export * from "./resources/ml-tasks.js";
|
|
29
|
+
export * from "./resources/model-evaluation-stores.js";
|
|
27
30
|
export { NotebooksResource, } from "./resources/notebooks.js";
|
|
28
31
|
export { ProjectLibraryResource, } from "./resources/project-library.js";
|
|
29
32
|
export { ProjectsResource, } from "./resources/projects.js";
|
|
30
33
|
export { RecipesResource, } from "./resources/recipes.js";
|
|
34
|
+
export * from "./resources/saved-models.js";
|
|
31
35
|
export { normalizeScenarioUpdateData, SCENARIO_CANONICAL_EDITABLE_FIELDS, ScenariosResource, scenarioUpdatePreview, } from "./resources/scenarios.js";
|
|
32
36
|
export { SqlResource, } from "./resources/sql.js";
|
|
33
37
|
export { StatisticsResource, } from "./resources/statistics.js";
|
|
@@ -37,7 +41,7 @@ export { WebappsResource, } from "./resources/webapps.js";
|
|
|
37
41
|
export { WikiResource, } from "./resources/wiki.js";
|
|
38
42
|
export { WorkspacesResource, } from "./resources/workspaces.js";
|
|
39
43
|
// Schemas (TypeBox schema objects for runtime validation)
|
|
40
|
-
export { BuildModeSchema, CodeEnvActionResultSchema, CodeEnvCreateOptionsSchema, CodeEnvDetailsSchema, CodeEnvPackageListSchema, CodeEnvSetPackagesOptionsSchema, CodeEnvSummaryArraySchema, CodeEnvSummarySchema, CodeEnvUpdatePackagesOptionsSchema, CodeEnvUsageArraySchema, CodeEnvWaitOptionsSchema, ConnectionSummarySchema, DashboardDetailsSchema, DashboardSummaryArraySchema, DashboardSummarySchema, DataQualityComputeResultSchema, DataQualityProjectStatusSchema, DataQualityRuleArraySchema, DataQualityRuleResultArraySchema, DataQualityRuleResultSchema, DataQualityRuleSchema, DataQualityRulesSchema, DataQualityStatusByPartitionSchema, DataQualityStatusSchema, DataQualityTimelineEntrySchema, DataQualityTimelineSchema, DatasetCreateOptionsSchema, DatasetDetailsSchema, DatasetSchemaSchema, DatasetSummaryArraySchema, DatasetSummarySchema, FlowMapOptionsSchema, FlowZoneArraySchema, FlowZoneCreateOptionsSchema, FlowZoneItemSchema, FlowZoneObjectTypeSchema, FlowZonePositionSchema, FlowZoneSchema, FlowZoneUpdateOptionsSchema, FolderCreateOptionsSchema, FolderDetailsSchema, FolderItemArraySchema, FolderItemSchema, FolderSummaryArraySchema, FolderSummarySchema, FutureStateSchema, FutureWaitResultSchema, InsightDetailsSchema, InsightSummaryArraySchema, InsightSummarySchema, JobSummaryArraySchema, JobSummarySchema, JobWaitResultSchema, JupyterCellSchema, JupyterNotebookContentSchema, JupyterNotebookSummaryArraySchema, JupyterNotebookSummarySchema, NotebookSessionArraySchema, NotebookSessionSchema, parseSchema, ProjectDetailsSchema, ProjectMetadataSchema, ProjectSummaryArraySchema, ProjectSummarySchema, ProjectVariablesSchema, RecipeCreateOptionsSchema, RecipeCreateResultSchema, RecipeDetailsSchema, RecipeSummaryArraySchema, RecipeSummarySchema, safeParseSchema, ScenarioDetailsSchema, ScenarioStatusSchema, ScenarioSummaryArraySchema, ScenarioSummarySchema, ScenarioWaitResultSchema, SqlNotebookCellSchema, SqlNotebookContentSchema, SqlNotebookSummaryArraySchema, SqlNotebookSummarySchema, SqlQueryResponseSchema, SqlQueryResultSchema, SqlQuerySchemaSchema, WikiArticleDataArraySchema, WikiArticleDataSchema, WikiArticleMetadataSchema, WikiSettingsSchema, WikiTaxonomyNodeSchema, } from "./schemas.js";
|
|
44
|
+
export { BuildModeSchema, CodeEnvActionResultSchema, CodeEnvCreateOptionsSchema, CodeEnvDetailsSchema, CodeEnvPackageListSchema, CodeEnvSetPackagesOptionsSchema, CodeEnvSummaryArraySchema, CodeEnvSummarySchema, CodeEnvUpdatePackagesOptionsSchema, CodeEnvUsageArraySchema, CodeEnvWaitOptionsSchema, ConnectionSummarySchema, DashboardDetailsSchema, DashboardSummaryArraySchema, DashboardSummarySchema, DataQualityComputeResultSchema, DataQualityProjectStatusSchema, DataQualityRuleArraySchema, DataQualityRuleResultArraySchema, DataQualityRuleResultSchema, DataQualityRuleSchema, DataQualityRulesSchema, DataQualityStatusByPartitionSchema, DataQualityStatusSchema, DataQualityTimelineEntrySchema, DataQualityTimelineSchema, DatasetCreateOptionsSchema, DatasetDetailsSchema, DatasetSchemaSchema, DatasetSummaryArraySchema, DatasetSummarySchema, FlowMapOptionsSchema, FlowZoneArraySchema, FlowZoneCreateOptionsSchema, FlowZoneItemSchema, FlowZoneObjectTypeSchema, FlowZonePositionSchema, FlowZoneSchema, FlowZoneUpdateOptionsSchema, FolderCreateOptionsSchema, FolderDetailsSchema, FolderItemArraySchema, FolderItemSchema, FolderSummaryArraySchema, FolderSummarySchema, FutureStateSchema, FutureWaitResultSchema, InsightDetailsSchema, InsightSummaryArraySchema, InsightSummarySchema, JobSummaryArraySchema, JobSummarySchema, JobWaitResultSchema, JupyterCellSchema, JupyterNotebookContentSchema, JupyterNotebookSummaryArraySchema, JupyterNotebookSummarySchema, NotebookSessionArraySchema, NotebookSessionSchema, parseSchema, ProjectDetailsSchema, ProjectMetadataSchema, ProjectSummaryArraySchema, ProjectSummarySchema, ProjectVariablesSchema, RecipeCreateOptionsSchema, RecipeCreateResultSchema, RecipeDetailsSchema, RecipeSummaryArraySchema, RecipeSummarySchema, safeParseSchema, ScenarioDetailsSchema, ScenarioStatusSchema, ScenarioStepRunSchema, ScenarioSummaryArraySchema, ScenarioSummarySchema, ScenarioWaitResultSchema, SqlNotebookCellSchema, SqlNotebookContentSchema, SqlNotebookSummaryArraySchema, SqlNotebookSummarySchema, SqlQueryResponseSchema, SqlQueryResultSchema, SqlQuerySchemaSchema, WikiArticleDataArraySchema, WikiArticleDataSchema, WikiArticleMetadataSchema, WikiSettingsSchema, WikiTaxonomyNodeSchema, } from "./schemas.js";
|
|
41
45
|
// Utilities
|
|
42
46
|
export { deepMerge, } from "./utils/deep-merge.js";
|
|
43
47
|
export { normalizeFlowGraph, } from "./utils/flow-map.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseResource } from "./base.js";
|
|
2
|
+
export interface AnalysisListItem extends Record<string, unknown> {
|
|
3
|
+
id?: string;
|
|
4
|
+
analysisId?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
inputDataset?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface AnalysisDefinition extends Record<string, unknown> {
|
|
9
|
+
id?: string;
|
|
10
|
+
analysisId?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
projectKey?: string;
|
|
13
|
+
inputDataset?: string;
|
|
14
|
+
script?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export interface AnalysisCreateOptions {
|
|
17
|
+
inputDataset: string;
|
|
18
|
+
projectKey?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface AnalysisCreateResult extends Record<string, unknown> {
|
|
21
|
+
id?: string;
|
|
22
|
+
analysisId?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare class AnalysesResource extends BaseResource {
|
|
25
|
+
/** List visual analyses in a project. */
|
|
26
|
+
list(projectKey?: string): Promise<AnalysisListItem[]>;
|
|
27
|
+
/** Get the definition of a visual analysis. */
|
|
28
|
+
get(analysisId: string, projectKey?: string): Promise<AnalysisDefinition>;
|
|
29
|
+
/** Create a visual analysis for an input dataset. */
|
|
30
|
+
create(opts: AnalysisCreateOptions): Promise<AnalysisCreateResult>;
|
|
31
|
+
/** Delete a visual analysis. */
|
|
32
|
+
delete(analysisId: string, projectKey?: string): Promise<void>;
|
|
33
|
+
private analysisPath;
|
|
34
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { UsageError, } from "../cli/usage.js";
|
|
2
|
+
import { BaseResource, } from "./base.js";
|
|
3
|
+
function requireNonEmpty(value, name) {
|
|
4
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
5
|
+
throw new UsageError(`${name} must be a non-empty string.`, "validation_failed");
|
|
6
|
+
}
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
export class AnalysesResource extends BaseResource {
|
|
10
|
+
/** List visual analyses in a project. */
|
|
11
|
+
async list(projectKey) {
|
|
12
|
+
return this.client.get(`/public/api/projects/${this.enc(projectKey)}/lab/`);
|
|
13
|
+
}
|
|
14
|
+
/** Get the definition of a visual analysis. */
|
|
15
|
+
async get(analysisId, projectKey) {
|
|
16
|
+
return this.client.get(`${this.analysisPath(analysisId, projectKey)}/`);
|
|
17
|
+
}
|
|
18
|
+
/** Create a visual analysis for an input dataset. */
|
|
19
|
+
async create(opts) {
|
|
20
|
+
const inputDataset = requireNonEmpty(opts.inputDataset, "inputDataset");
|
|
21
|
+
return this.client.post(`/public/api/projects/${this.enc(opts.projectKey)}/lab/`, { inputDataset, });
|
|
22
|
+
}
|
|
23
|
+
/** Delete a visual analysis. */
|
|
24
|
+
async delete(analysisId, projectKey) {
|
|
25
|
+
await this.client.del(`${this.analysisPath(analysisId, projectKey)}/`);
|
|
26
|
+
}
|
|
27
|
+
analysisPath(analysisId, projectKey) {
|
|
28
|
+
const id = encodeURIComponent(requireNonEmpty(analysisId, "analysisId"));
|
|
29
|
+
return `/public/api/projects/${this.enc(projectKey)}/lab/${id}`;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -19,6 +19,8 @@ export declare class ApiServicesResource extends BaseResource {
|
|
|
19
19
|
getSettings(serviceId: string, projectKey?: string): Promise<Record<string, unknown>>;
|
|
20
20
|
/** Save API service settings. */
|
|
21
21
|
saveSettings(serviceId: string, body: Record<string, unknown>, projectKey?: string): Promise<ApiServiceActionResult>;
|
|
22
|
+
/** Add a standard prediction endpoint backed by a saved model. */
|
|
23
|
+
addPredictionEndpoint(serviceId: string, endpointId: string, savedModelId: string, projectKey?: string): Promise<ApiServiceActionResult>;
|
|
22
24
|
/** List deployable packages for an API service. */
|
|
23
25
|
listPackages(serviceId: string, projectKey?: string): Promise<ApiServicePackageListItem[]>;
|
|
24
26
|
/** Get an API service package summary. */
|
|
@@ -16,6 +16,16 @@ export class ApiServicesResource extends BaseResource {
|
|
|
16
16
|
async saveSettings(serviceId, body, projectKey) {
|
|
17
17
|
return this.client.put(`${this.servicePath(serviceId, projectKey)}/settings`, body);
|
|
18
18
|
}
|
|
19
|
+
/** Add a standard prediction endpoint backed by a saved model. */
|
|
20
|
+
async addPredictionEndpoint(serviceId, endpointId, savedModelId, projectKey) {
|
|
21
|
+
const settings = await this.getSettings(serviceId, projectKey);
|
|
22
|
+
const endpoints = Array.isArray(settings.endpoints) ? settings.endpoints : [];
|
|
23
|
+
settings.endpoints = [
|
|
24
|
+
...endpoints,
|
|
25
|
+
{ id: endpointId, type: "STD_PREDICTION", modelRef: savedModelId, },
|
|
26
|
+
];
|
|
27
|
+
return this.saveSettings(serviceId, settings, projectKey);
|
|
28
|
+
}
|
|
19
29
|
/** List deployable packages for an API service. */
|
|
20
30
|
async listPackages(serviceId, projectKey) {
|
|
21
31
|
return this.client.get(`${this.servicePath(serviceId, projectKey)}/packages`);
|
|
@@ -31,7 +31,7 @@ export declare class ApplicationsResource extends BaseResource {
|
|
|
31
31
|
createInstance(appId: string, body: Record<string, unknown>): Promise<AppInstanceRef>;
|
|
32
32
|
/** Get the manifest for an app instance project. */
|
|
33
33
|
getInstanceManifest(projectKey?: string): Promise<Record<string, unknown>>;
|
|
34
|
-
/** Save the manifest for
|
|
34
|
+
/** Save the manifest for a Dataiku App template project (rejects classic app-instance projects). */
|
|
35
35
|
saveInstanceManifest(manifest: Record<string, unknown>, projectKey?: string): Promise<void>;
|
|
36
36
|
/** Delete an app instance project. */
|
|
37
37
|
deleteInstance(projectKey?: string): Promise<void>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ClientValidationError, DataikuError, } from "../errors.js";
|
|
1
2
|
import { BaseResource, } from "./base.js";
|
|
2
3
|
export class ApplicationsResource extends BaseResource {
|
|
3
4
|
/** List all Dataiku Apps. */
|
|
@@ -20,12 +21,37 @@ export class ApplicationsResource extends BaseResource {
|
|
|
20
21
|
async getInstanceManifest(projectKey) {
|
|
21
22
|
return this.client.get(`/public/api/projects/${this.enc(projectKey)}/app-manifest`);
|
|
22
23
|
}
|
|
23
|
-
/** Save the manifest for
|
|
24
|
+
/** Save the manifest for a Dataiku App template project (rejects classic app-instance projects). */
|
|
24
25
|
async saveInstanceManifest(manifest, projectKey) {
|
|
26
|
+
const currentManifest = await this.getInstanceManifest(projectKey);
|
|
27
|
+
if (currentManifest.projectAppType === "APP_INSTANCE") {
|
|
28
|
+
throw new ClientValidationError("Classic Dataiku App instance manifests cannot be saved through the app-manifest endpoint; only Dataiku App template project manifests can be updated.", "validation_failed", "Save against the Dataiku App template project instead; existing classic app-instance manifests are read-only through this endpoint.", { projectAppType: "APP_INSTANCE", projectKey: this.resolveProjectKey(projectKey), });
|
|
29
|
+
}
|
|
25
30
|
await this.client.putVoid(`/public/api/projects/${this.enc(projectKey)}/app-manifest`, manifest);
|
|
26
31
|
}
|
|
27
32
|
/** Delete an app instance project. */
|
|
28
33
|
async deleteInstance(projectKey) {
|
|
34
|
+
let manifest;
|
|
35
|
+
try {
|
|
36
|
+
manifest = await this.getInstanceManifest(projectKey);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
// DSS answers the app-manifest probe with 400 "neither an app template nor an app
|
|
40
|
+
// instance" for ordinary projects; treat only that as "not an app instance". Rethrow
|
|
41
|
+
// everything else (404 not-found, transient, permission) so real failures are not masked.
|
|
42
|
+
if (error instanceof DataikuError && error.status === 400) {
|
|
43
|
+
manifest = undefined;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (manifest?.projectAppType !== "APP_INSTANCE") {
|
|
50
|
+
throw new ClientValidationError("Only classic Dataiku App instance projects can be deleted through app delete-instance.", "validation_failed", "Use `dss app delete-instance` only for projects whose app manifest has projectAppType=APP_INSTANCE; use `dss project delete` for ordinary projects.", {
|
|
51
|
+
projectAppType: manifest?.projectAppType ?? null,
|
|
52
|
+
projectKey: this.resolveProjectKey(projectKey),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
29
55
|
await this.client.del(`/public/api/projects/${this.enc(projectKey)}`);
|
|
30
56
|
}
|
|
31
57
|
/** List all Business Apps. */
|
|
@@ -14,6 +14,7 @@ export class ContinuousActivitiesResource extends BaseResource {
|
|
|
14
14
|
}
|
|
15
15
|
/** Stop a continuous recipe activity. */
|
|
16
16
|
async stop(recipeId, projectKey) {
|
|
17
|
+
await this.getStatus(recipeId, projectKey);
|
|
17
18
|
await this.client.postText(`${this.activityPath(recipeId, projectKey)}/stop`);
|
|
18
19
|
}
|
|
19
20
|
activityPath(recipeId, projectKey) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DataikuError, } from "../errors.js";
|
|
1
2
|
import { DataQualityComputeResultSchema, DataQualityProjectStatusSchema, DataQualityRuleArraySchema, DataQualityRuleResultArraySchema, DataQualityRuleSchema, DataQualityRulesSchema, DataQualityStatusByPartitionSchema, DataQualityStatusSchema, DataQualityTimelineSchema, } from "../schemas.js";
|
|
2
3
|
import { deepMerge, } from "../utils/deep-merge.js";
|
|
3
4
|
import { BaseResource, } from "./base.js";
|
|
@@ -49,13 +50,14 @@ export class DataQualityResource extends BaseResource {
|
|
|
49
50
|
async getRule(datasetName, ruleId, projectKey) {
|
|
50
51
|
const rules = await this.listRules(datasetName, projectKey);
|
|
51
52
|
const rule = rules.find((candidate) => candidate.id === ruleId);
|
|
52
|
-
if (!rule)
|
|
53
|
-
throw new
|
|
53
|
+
if (!rule) {
|
|
54
|
+
throw new DataikuError(404, "Not Found", JSON.stringify({ message: `Data quality rule not found: ${ruleId}`, }));
|
|
55
|
+
}
|
|
54
56
|
return rule;
|
|
55
57
|
}
|
|
56
58
|
async status(datasetName, projectKey) {
|
|
57
59
|
const pk = this.resolveProjectKey(projectKey);
|
|
58
|
-
const raw = await this.client.get(`${datasetPath(pk, datasetName)}/status`);
|
|
60
|
+
const raw = await this.client.get(`${datasetPath(pk, datasetName)}/status-by-partition`);
|
|
59
61
|
return this.client.safeParse(DataQualityStatusSchema, raw, "dataQuality.status");
|
|
60
62
|
}
|
|
61
63
|
async statusByPartition(datasetName, opts = {}) {
|
|
@@ -8,6 +8,9 @@ export interface DatasetBuildValidationResult {
|
|
|
8
8
|
path: string | null;
|
|
9
9
|
formatType: string | null;
|
|
10
10
|
warnings: string[];
|
|
11
|
+
validationScope: "configuration";
|
|
12
|
+
materializationChecked: false;
|
|
13
|
+
note: string;
|
|
11
14
|
}
|
|
12
15
|
export interface DatasetSchemaColumnInput {
|
|
13
16
|
name: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as nodePath from "node:path";
|
|
3
3
|
import { Readable, Transform, } from "node:stream";
|
|
4
4
|
import { pipeline, } from "node:stream/promises";
|
|
5
5
|
import { createGzip, } from "node:zlib";
|
|
@@ -297,6 +297,7 @@ function buildDatasetCreateBody(opts) {
|
|
|
297
297
|
}
|
|
298
298
|
const DATASET_CLONE_PARAM_KEYS = [
|
|
299
299
|
"connection",
|
|
300
|
+
"uploadConnection",
|
|
300
301
|
"path",
|
|
301
302
|
"table",
|
|
302
303
|
"schema",
|
|
@@ -418,8 +419,8 @@ export class DatasetsResource extends BaseResource {
|
|
|
418
419
|
const res = await this.client.stream(`/public/api/projects/${this.enc(opts?.projectKey)}/datasets/${dsEnc}/data/?format=tsv-excel-header&limit=${limit + 1}`);
|
|
419
420
|
const safeDatasetName = sanitizeFileName(datasetName, "dataset");
|
|
420
421
|
const filePath = opts?.outputPath?.endsWith(".gz") || opts?.outputPath?.endsWith(".csv")
|
|
421
|
-
? resolve(opts.outputPath)
|
|
422
|
-
: resolve(opts?.outputPath ?? process.cwd(), `${safeDatasetName}.csv.gz`);
|
|
422
|
+
? nodePath.resolve(opts.outputPath)
|
|
423
|
+
: nodePath.resolve(opts?.outputPath ?? process.cwd(), `${safeDatasetName}.csv.gz`);
|
|
423
424
|
const onHeader = opts?.validateColumns
|
|
424
425
|
? (headerRow) => {
|
|
425
426
|
const warnings = validateStreamColumns(headerRow, opts.validateColumns);
|
|
@@ -432,7 +433,8 @@ export class DatasetsResource extends BaseResource {
|
|
|
432
433
|
const stats = { rows: 0, truncated: false, };
|
|
433
434
|
const nodeStream = Readable.fromWeb(res.body);
|
|
434
435
|
const csvTransform = tsvToCsvTransform(limit, stats, onHeader);
|
|
435
|
-
|
|
436
|
+
fs.mkdirSync(nodePath.dirname(filePath), { recursive: true, });
|
|
437
|
+
const fileOut = fs.createWriteStream(filePath);
|
|
436
438
|
if (shouldGzip) {
|
|
437
439
|
const gzip = createGzip();
|
|
438
440
|
await pipeline(nodeStream, csvTransform, gzip, fileOut);
|
|
@@ -530,6 +532,9 @@ export class DatasetsResource extends BaseResource {
|
|
|
530
532
|
path,
|
|
531
533
|
formatType,
|
|
532
534
|
warnings,
|
|
535
|
+
validationScope: "configuration",
|
|
536
|
+
materializationChecked: false,
|
|
537
|
+
note: "Validates build configuration only; it does not verify storage file existence or materialized data.",
|
|
533
538
|
};
|
|
534
539
|
}
|
|
535
540
|
/** Clone dataset settings, preserving connection/storage, format, and schema fields. */
|
|
@@ -20,6 +20,6 @@ export declare class FlowZonesResource extends BaseResource {
|
|
|
20
20
|
moveItems(zoneId: string, items: FlowZoneItemInput[], projectKey?: string): Promise<FlowZone>;
|
|
21
21
|
/** Move a single item into a flow zone. */
|
|
22
22
|
moveItem(zoneId: string, item: FlowZoneItemInput, projectKey?: string): Promise<FlowZone>;
|
|
23
|
-
/** Get the graph for a single flow zone. */
|
|
24
|
-
graph(zoneId
|
|
23
|
+
/** Get the full flow graph, or the graph for a single non-default flow zone. */
|
|
24
|
+
graph(zoneId?: string, projectKey?: string): Promise<unknown>;
|
|
25
25
|
}
|