dataiku-sdk 0.4.0 → 0.5.1
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/bin/dss.js +76 -3
- package/dist/packages/types/src/index.d.ts +275 -0
- package/dist/packages/types/src/index.js +190 -0
- package/dist/src/cli.js +4287 -862
- package/dist/src/client.d.ts +18 -0
- package/dist/src/client.js +30 -0
- package/dist/src/errors.d.ts +2 -0
- package/dist/src/errors.js +45 -1
- package/dist/src/index.d.ts +9 -3
- package/dist/src/index.js +7 -1
- package/dist/src/resources/code-envs.d.ts +9 -1
- package/dist/src/resources/code-envs.js +80 -1
- package/dist/src/resources/connections.d.ts +3 -1
- package/dist/src/resources/connections.js +4 -2
- package/dist/src/resources/dashboards.d.ts +19 -0
- package/dist/src/resources/dashboards.js +30 -0
- package/dist/src/resources/data-quality.d.ts +54 -0
- package/dist/src/resources/data-quality.js +119 -0
- package/dist/src/resources/datasets.js +1 -1
- package/dist/src/resources/flow-zones.d.ts +25 -0
- package/dist/src/resources/flow-zones.js +59 -0
- package/dist/src/resources/folders.d.ts +4 -1
- package/dist/src/resources/folders.js +27 -0
- package/dist/src/resources/futures.d.ts +15 -0
- package/dist/src/resources/futures.js +86 -0
- package/dist/src/resources/insights.d.ts +28 -0
- package/dist/src/resources/insights.js +64 -0
- package/dist/src/resources/jobs.d.ts +7 -4
- package/dist/src/resources/jobs.js +9 -7
- package/dist/src/resources/notebooks.d.ts +6 -4
- package/dist/src/resources/notebooks.js +6 -4
- package/dist/src/resources/recipes.js +115 -66
- package/dist/src/resources/wiki.d.ts +22 -0
- package/dist/src/resources/wiki.js +73 -0
- package/dist/src/schemas.d.ts +2 -2
- package/dist/src/schemas.js +1 -1
- package/dist/src/utils/cleanup-ledger.d.ts +15 -0
- package/dist/src/utils/cleanup-ledger.js +15 -0
- package/node_modules/@sinclair/typebox/package.json +2 -2
- package/node_modules/@sinclair/typebox/readme.md +7 -7
- package/package.json +11 -7
- package/packages/types/dist/index.d.ts +275 -0
- package/packages/types/dist/index.js +190 -0
package/dist/src/client.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { type Static, type TSchema } from "@sinclair/typebox";
|
|
2
2
|
import { CodeEnvsResource } from "./resources/code-envs.js";
|
|
3
3
|
import { ConnectionsResource } from "./resources/connections.js";
|
|
4
|
+
import { DashboardsResource } from "./resources/dashboards.js";
|
|
5
|
+
import { DataQualityResource } from "./resources/data-quality.js";
|
|
4
6
|
import { DatasetsResource } from "./resources/datasets.js";
|
|
7
|
+
import { FlowZonesResource } from "./resources/flow-zones.js";
|
|
5
8
|
import { FoldersResource } from "./resources/folders.js";
|
|
9
|
+
import { FuturesResource } from "./resources/futures.js";
|
|
10
|
+
import { InsightsResource } from "./resources/insights.js";
|
|
6
11
|
import { JobsResource } from "./resources/jobs.js";
|
|
7
12
|
import { NotebooksResource } from "./resources/notebooks.js";
|
|
8
13
|
import { ProjectsResource } from "./resources/projects.js";
|
|
@@ -10,6 +15,7 @@ import { RecipesResource } from "./resources/recipes.js";
|
|
|
10
15
|
import { ScenariosResource } from "./resources/scenarios.js";
|
|
11
16
|
import { SqlResource } from "./resources/sql.js";
|
|
12
17
|
import { VariablesResource } from "./resources/variables.js";
|
|
18
|
+
import { WikiResource } from "./resources/wiki.js";
|
|
13
19
|
export interface DataikuClientConfig {
|
|
14
20
|
/** DSS base URL (e.g. https://dss.example.com) */
|
|
15
21
|
url: string;
|
|
@@ -47,25 +53,37 @@ export declare class DataikuClient {
|
|
|
47
53
|
private _projects?;
|
|
48
54
|
private _datasets?;
|
|
49
55
|
private _recipes?;
|
|
56
|
+
private _dashboards?;
|
|
57
|
+
private _dataQuality?;
|
|
50
58
|
private _jobs?;
|
|
59
|
+
private futuresResource?;
|
|
51
60
|
private _scenarios?;
|
|
52
61
|
private _folders?;
|
|
62
|
+
private _flowZones?;
|
|
53
63
|
private _variables?;
|
|
54
64
|
private _connections?;
|
|
55
65
|
private _codeEnvs?;
|
|
66
|
+
private _insights?;
|
|
56
67
|
private _sql?;
|
|
57
68
|
private _notebooks?;
|
|
69
|
+
private _wiki?;
|
|
58
70
|
get projects(): ProjectsResource;
|
|
59
71
|
get datasets(): DatasetsResource;
|
|
72
|
+
get dashboards(): DashboardsResource;
|
|
73
|
+
get dataQuality(): DataQualityResource;
|
|
60
74
|
get recipes(): RecipesResource;
|
|
61
75
|
get jobs(): JobsResource;
|
|
76
|
+
get futures(): FuturesResource;
|
|
62
77
|
get scenarios(): ScenariosResource;
|
|
63
78
|
get folders(): FoldersResource;
|
|
79
|
+
get flowZones(): FlowZonesResource;
|
|
64
80
|
get variables(): VariablesResource;
|
|
65
81
|
get connections(): ConnectionsResource;
|
|
66
82
|
get codeEnvs(): CodeEnvsResource;
|
|
83
|
+
get insights(): InsightsResource;
|
|
67
84
|
get sql(): SqlResource;
|
|
68
85
|
get notebooks(): NotebooksResource;
|
|
86
|
+
get wiki(): WikiResource;
|
|
69
87
|
constructor(config: DataikuClientConfig);
|
|
70
88
|
getRequestTimeoutMs(): number;
|
|
71
89
|
resolveProjectKey(paramValue?: string): string;
|
package/dist/src/client.js
CHANGED
|
@@ -5,8 +5,13 @@ import { safeParseSchema, } from "./schemas.js";
|
|
|
5
5
|
import { classifyDataikuError, DataikuError, } from "./errors.js";
|
|
6
6
|
import { CodeEnvsResource, } from "./resources/code-envs.js";
|
|
7
7
|
import { ConnectionsResource, } from "./resources/connections.js";
|
|
8
|
+
import { DashboardsResource, } from "./resources/dashboards.js";
|
|
9
|
+
import { DataQualityResource, } from "./resources/data-quality.js";
|
|
8
10
|
import { DatasetsResource, } from "./resources/datasets.js";
|
|
11
|
+
import { FlowZonesResource, } from "./resources/flow-zones.js";
|
|
9
12
|
import { FoldersResource, } from "./resources/folders.js";
|
|
13
|
+
import { FuturesResource, } from "./resources/futures.js";
|
|
14
|
+
import { InsightsResource, } from "./resources/insights.js";
|
|
10
15
|
import { JobsResource, } from "./resources/jobs.js";
|
|
11
16
|
import { NotebooksResource, } from "./resources/notebooks.js";
|
|
12
17
|
import { ProjectsResource, } from "./resources/projects.js";
|
|
@@ -14,6 +19,7 @@ import { RecipesResource, } from "./resources/recipes.js";
|
|
|
14
19
|
import { ScenariosResource, } from "./resources/scenarios.js";
|
|
15
20
|
import { SqlResource, } from "./resources/sql.js";
|
|
16
21
|
import { VariablesResource, } from "./resources/variables.js";
|
|
22
|
+
import { WikiResource, } from "./resources/wiki.js";
|
|
17
23
|
/* ------------------------------------------------------------------ */
|
|
18
24
|
/* Constants */
|
|
19
25
|
/* ------------------------------------------------------------------ */
|
|
@@ -89,32 +95,50 @@ export class DataikuClient {
|
|
|
89
95
|
_projects;
|
|
90
96
|
_datasets;
|
|
91
97
|
_recipes;
|
|
98
|
+
_dashboards;
|
|
99
|
+
_dataQuality;
|
|
92
100
|
_jobs;
|
|
101
|
+
futuresResource;
|
|
93
102
|
_scenarios;
|
|
94
103
|
_folders;
|
|
104
|
+
_flowZones;
|
|
95
105
|
_variables;
|
|
96
106
|
_connections;
|
|
97
107
|
_codeEnvs;
|
|
108
|
+
_insights;
|
|
98
109
|
_sql;
|
|
99
110
|
_notebooks;
|
|
111
|
+
_wiki;
|
|
100
112
|
get projects() {
|
|
101
113
|
return (this._projects ??= new ProjectsResource(this));
|
|
102
114
|
}
|
|
103
115
|
get datasets() {
|
|
104
116
|
return (this._datasets ??= new DatasetsResource(this));
|
|
105
117
|
}
|
|
118
|
+
get dashboards() {
|
|
119
|
+
return (this._dashboards ??= new DashboardsResource(this));
|
|
120
|
+
}
|
|
121
|
+
get dataQuality() {
|
|
122
|
+
return (this._dataQuality ??= new DataQualityResource(this));
|
|
123
|
+
}
|
|
106
124
|
get recipes() {
|
|
107
125
|
return (this._recipes ??= new RecipesResource(this));
|
|
108
126
|
}
|
|
109
127
|
get jobs() {
|
|
110
128
|
return (this._jobs ??= new JobsResource(this));
|
|
111
129
|
}
|
|
130
|
+
get futures() {
|
|
131
|
+
return (this.futuresResource ??= new FuturesResource(this));
|
|
132
|
+
}
|
|
112
133
|
get scenarios() {
|
|
113
134
|
return (this._scenarios ??= new ScenariosResource(this));
|
|
114
135
|
}
|
|
115
136
|
get folders() {
|
|
116
137
|
return (this._folders ??= new FoldersResource(this));
|
|
117
138
|
}
|
|
139
|
+
get flowZones() {
|
|
140
|
+
return (this._flowZones ??= new FlowZonesResource(this));
|
|
141
|
+
}
|
|
118
142
|
get variables() {
|
|
119
143
|
return (this._variables ??= new VariablesResource(this));
|
|
120
144
|
}
|
|
@@ -124,12 +148,18 @@ export class DataikuClient {
|
|
|
124
148
|
get codeEnvs() {
|
|
125
149
|
return (this._codeEnvs ??= new CodeEnvsResource(this));
|
|
126
150
|
}
|
|
151
|
+
get insights() {
|
|
152
|
+
return (this._insights ??= new InsightsResource(this));
|
|
153
|
+
}
|
|
127
154
|
get sql() {
|
|
128
155
|
return (this._sql ??= new SqlResource(this));
|
|
129
156
|
}
|
|
130
157
|
get notebooks() {
|
|
131
158
|
return (this._notebooks ??= new NotebooksResource(this));
|
|
132
159
|
}
|
|
160
|
+
get wiki() {
|
|
161
|
+
return (this._wiki ??= new WikiResource(this));
|
|
162
|
+
}
|
|
133
163
|
constructor(config) {
|
|
134
164
|
const url = config.url?.trim();
|
|
135
165
|
if (!url)
|
package/dist/src/errors.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export type DataikuErrorCategory = "not_found" | "forbidden" | "validation" | "transient" | "unknown";
|
|
2
|
+
export type StableErrorCode = "usage_error" | "unknown_flag" | "missing_required_arg" | "missing_required_flag" | "invalid_enum" | "not_found" | "permission_denied" | "validation_failed" | "transient" | "long_running_failure" | "internal_error";
|
|
3
|
+
export declare function dataikuErrorCode(category: DataikuErrorCategory): StableErrorCode;
|
|
2
4
|
export interface DataikuErrorTaxonomy {
|
|
3
5
|
category: DataikuErrorCategory;
|
|
4
6
|
retryable: boolean;
|
package/dist/src/errors.js
CHANGED
|
@@ -1,12 +1,56 @@
|
|
|
1
|
+
export function dataikuErrorCode(category) {
|
|
2
|
+
switch (category) {
|
|
3
|
+
case "not_found":
|
|
4
|
+
return "not_found";
|
|
5
|
+
case "forbidden":
|
|
6
|
+
return "permission_denied";
|
|
7
|
+
case "validation":
|
|
8
|
+
return "validation_failed";
|
|
9
|
+
case "transient":
|
|
10
|
+
return "transient";
|
|
11
|
+
case "unknown":
|
|
12
|
+
return "internal_error";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
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
|
+
function isCertificateTrustFailure(lowerBody) {
|
|
17
|
+
return lowerBody.includes("unable to verify the first certificate")
|
|
18
|
+
|| lowerBody.includes("unable to get local issuer certificate")
|
|
19
|
+
|| lowerBody.includes("unable to verify leaf signature")
|
|
20
|
+
|| lowerBody.includes("self-signed certificate")
|
|
21
|
+
|| lowerBody.includes("certificate has expired")
|
|
22
|
+
|| lowerBody.includes("cert_has_expired")
|
|
23
|
+
|| lowerBody.includes("self_signed_cert_in_chain")
|
|
24
|
+
|| lowerBody.includes("unable_to_verify_leaf_signature")
|
|
25
|
+
|| lowerBody.includes("err_tls_cert_altname_invalid")
|
|
26
|
+
|| (lowerBody.includes("certificate") && lowerBody.includes("verify"));
|
|
27
|
+
}
|
|
1
28
|
export function classifyDataikuError(status, body) {
|
|
29
|
+
const lowerBody = body.toLowerCase();
|
|
2
30
|
if (status === 0) {
|
|
31
|
+
if (isCertificateTrustFailure(lowerBody)) {
|
|
32
|
+
return {
|
|
33
|
+
category: "validation",
|
|
34
|
+
retryable: false,
|
|
35
|
+
retryHint: TLS_CERTIFICATE_HINT,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
3
38
|
return {
|
|
4
39
|
category: "transient",
|
|
5
40
|
retryable: true,
|
|
6
41
|
retryHint: "Network/transport failure. Retry with backoff and verify DSS URL reachability.",
|
|
7
42
|
};
|
|
8
43
|
}
|
|
9
|
-
const
|
|
44
|
+
const isSqlInputConnectionMismatch = (status === 400 || status >= 500)
|
|
45
|
+
&& lowerBody.includes("s3 dataset")
|
|
46
|
+
&& lowerBody.includes("athena connection");
|
|
47
|
+
if (isSqlInputConnectionMismatch) {
|
|
48
|
+
return {
|
|
49
|
+
category: "validation",
|
|
50
|
+
retryable: false,
|
|
51
|
+
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.",
|
|
52
|
+
};
|
|
53
|
+
}
|
|
10
54
|
const isMissingDatasetRootPath = status === 500
|
|
11
55
|
&& lowerBody.includes("root path of the dataset")
|
|
12
56
|
&& lowerBody.includes("does not exist");
|
package/dist/src/index.d.ts
CHANGED
|
@@ -4,18 +4,24 @@ export { deleteCredentials, type DssCredentials, getConfigDir, getCredentialsPat
|
|
|
4
4
|
export { DataikuError, type DataikuErrorCategory, type DataikuErrorTaxonomy, type DataikuRetryMetadata, } from "./errors.js";
|
|
5
5
|
export { CodeEnvsResource, } from "./resources/code-envs.js";
|
|
6
6
|
export { ConnectionsResource, } from "./resources/connections.js";
|
|
7
|
+
export { DashboardsResource, } from "./resources/dashboards.js";
|
|
8
|
+
export { DataQualityResource, } from "./resources/data-quality.js";
|
|
7
9
|
export { DatasetsResource, } from "./resources/datasets.js";
|
|
10
|
+
export { type FlowZoneItemInput, FlowZonesResource, } from "./resources/flow-zones.js";
|
|
8
11
|
export { FoldersResource, } from "./resources/folders.js";
|
|
9
|
-
export {
|
|
12
|
+
export { FuturesResource, } from "./resources/futures.js";
|
|
13
|
+
export { InsightsResource, } from "./resources/insights.js";
|
|
14
|
+
export { computeNextPollDelayMs, type JobBuildTargetType, JobsResource, } from "./resources/jobs.js";
|
|
10
15
|
export { NotebooksResource, } from "./resources/notebooks.js";
|
|
11
16
|
export { type FlowMapResult, ProjectsResource, } from "./resources/projects.js";
|
|
12
17
|
export { RecipesResource, } from "./resources/recipes.js";
|
|
13
18
|
export { ScenariosResource, } from "./resources/scenarios.js";
|
|
14
19
|
export { SqlResource, } from "./resources/sql.js";
|
|
15
20
|
export { VariablesResource, } from "./resources/variables.js";
|
|
16
|
-
export {
|
|
21
|
+
export { WikiResource, } from "./resources/wiki.js";
|
|
22
|
+
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, 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, SqlNotebookCellSchema, SqlNotebookContentSchema, SqlNotebookSummaryArraySchema, SqlNotebookSummarySchema, SqlQueryResponseSchema, SqlQueryResultSchema, SqlQuerySchemaSchema, WikiArticleDataArraySchema, WikiArticleDataSchema, WikiArticleMetadataSchema, WikiSettingsSchema, WikiTaxonomyNodeSchema, } from "./schemas.js";
|
|
17
23
|
export type { SafeParseResult, } from "./schemas.js";
|
|
18
|
-
export type { BuildMode, CodeEnvDetails, CodeEnvSummary, ConnectionSummary, DatasetCreateOptions, DatasetDetails, DatasetSchema, DatasetSummary, FlowMapOptions, FolderDetails, FolderItem, FolderSummary, JobSummary, JobWaitResult, JupyterCell, JupyterNotebookContent, JupyterNotebookSummary, NotebookSession, ProjectDetails, ProjectMetadata, ProjectSummary, ProjectVariables, RecipeCreateOptions, RecipeCreateResult, RecipeDetails, RecipeSummary, ScenarioDetails, ScenarioStatus, ScenarioSummary, SqlNotebookCell, SqlNotebookContent, SqlNotebookSummary, SqlQueryResponse, SqlQueryResult, SqlQuerySchema, } from "./schemas.js";
|
|
24
|
+
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, 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, SqlNotebookCell, SqlNotebookContent, SqlNotebookSummary, SqlQueryResponse, SqlQueryResult, SqlQuerySchema, WikiArticleData, WikiArticleMetadata, WikiSettings, WikiTaxonomyNode, } from "./schemas.js";
|
|
19
25
|
export { deepMerge, } from "./utils/deep-merge.js";
|
|
20
26
|
export { type NormalizedFlowEdge, type NormalizedFlowMap, type NormalizedFlowNode, normalizeFlowGraph, } from "./utils/flow-map.js";
|
|
21
27
|
export { sanitizeFileName, } from "./utils/sanitize.js";
|
package/dist/src/index.js
CHANGED
|
@@ -8,8 +8,13 @@ export { DataikuError, } from "./errors.js";
|
|
|
8
8
|
// Resources (for advanced use / extension)
|
|
9
9
|
export { CodeEnvsResource, } from "./resources/code-envs.js";
|
|
10
10
|
export { ConnectionsResource, } from "./resources/connections.js";
|
|
11
|
+
export { DashboardsResource, } from "./resources/dashboards.js";
|
|
12
|
+
export { DataQualityResource, } from "./resources/data-quality.js";
|
|
11
13
|
export { DatasetsResource, } from "./resources/datasets.js";
|
|
14
|
+
export { FlowZonesResource, } from "./resources/flow-zones.js";
|
|
12
15
|
export { FoldersResource, } from "./resources/folders.js";
|
|
16
|
+
export { FuturesResource, } from "./resources/futures.js";
|
|
17
|
+
export { InsightsResource, } from "./resources/insights.js";
|
|
13
18
|
export { computeNextPollDelayMs, JobsResource, } from "./resources/jobs.js";
|
|
14
19
|
export { NotebooksResource, } from "./resources/notebooks.js";
|
|
15
20
|
export { ProjectsResource, } from "./resources/projects.js";
|
|
@@ -17,8 +22,9 @@ export { RecipesResource, } from "./resources/recipes.js";
|
|
|
17
22
|
export { ScenariosResource, } from "./resources/scenarios.js";
|
|
18
23
|
export { SqlResource, } from "./resources/sql.js";
|
|
19
24
|
export { VariablesResource, } from "./resources/variables.js";
|
|
25
|
+
export { WikiResource, } from "./resources/wiki.js";
|
|
20
26
|
// Schemas (TypeBox schema objects for runtime validation)
|
|
21
|
-
export { BuildModeSchema, CodeEnvDetailsSchema, CodeEnvSummaryArraySchema, CodeEnvSummarySchema, ConnectionSummarySchema, DatasetCreateOptionsSchema, DatasetDetailsSchema, DatasetSchemaSchema, DatasetSummaryArraySchema, DatasetSummarySchema, FlowMapOptionsSchema, FolderDetailsSchema, FolderItemArraySchema, FolderItemSchema, FolderSummaryArraySchema, FolderSummarySchema, 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, SqlNotebookCellSchema, SqlNotebookContentSchema, SqlNotebookSummaryArraySchema, SqlNotebookSummarySchema, SqlQueryResponseSchema, SqlQueryResultSchema, SqlQuerySchemaSchema, } from "./schemas.js";
|
|
27
|
+
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, 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, SqlNotebookCellSchema, SqlNotebookContentSchema, SqlNotebookSummaryArraySchema, SqlNotebookSummarySchema, SqlQueryResponseSchema, SqlQueryResultSchema, SqlQuerySchemaSchema, WikiArticleDataArraySchema, WikiArticleDataSchema, WikiArticleMetadataSchema, WikiSettingsSchema, WikiTaxonomyNodeSchema, } from "./schemas.js";
|
|
22
28
|
// Utilities
|
|
23
29
|
export { deepMerge, } from "./utils/deep-merge.js";
|
|
24
30
|
export { normalizeFlowGraph, } from "./utils/flow-map.js";
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import type { CodeEnvDetails, CodeEnvSummary } from "../schemas.js";
|
|
1
|
+
import type { CodeEnvActionResult, CodeEnvCreateOptions, CodeEnvDetails, CodeEnvPackageList, CodeEnvSetPackagesOptions, CodeEnvSummary, CodeEnvUpdatePackagesOptions, CodeEnvWaitOptions } from "../schemas.js";
|
|
2
2
|
import { BaseResource } from "./base.js";
|
|
3
3
|
export declare class CodeEnvsResource extends BaseResource {
|
|
4
4
|
list(opts?: {
|
|
5
5
|
envLang?: "PYTHON" | "R";
|
|
6
6
|
}): Promise<CodeEnvSummary[]>;
|
|
7
7
|
get(envLang: string, envName: string): Promise<CodeEnvDetails>;
|
|
8
|
+
getDefinition(envLang: string, envName: string): Promise<Record<string, unknown>>;
|
|
9
|
+
create(opts: CodeEnvCreateOptions): Promise<CodeEnvActionResult>;
|
|
10
|
+
setDefinition(envLang: string, envName: string, definition: Record<string, unknown>): Promise<CodeEnvActionResult>;
|
|
11
|
+
setPackages(envLang: string, envName: string, packages: CodeEnvPackageList, opts?: Pick<CodeEnvSetPackagesOptions, "installCorePackages">): Promise<CodeEnvActionResult>;
|
|
12
|
+
updatePackages(envLang: string, envName: string, opts?: CodeEnvUpdatePackagesOptions): Promise<CodeEnvActionResult>;
|
|
13
|
+
setJupyterSupport(envLang: string, envName: string, active: boolean, opts?: CodeEnvWaitOptions): Promise<CodeEnvActionResult>;
|
|
14
|
+
delete(envLang: string, envName: string, opts?: CodeEnvWaitOptions): Promise<CodeEnvActionResult>;
|
|
15
|
+
listUsages(envLang?: string, envName?: string): Promise<Record<string, unknown>[]>;
|
|
8
16
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CodeEnvSummaryArraySchema, } from "../schemas.js";
|
|
1
|
+
import { CodeEnvSummaryArraySchema, CodeEnvUsageArraySchema, } from "../schemas.js";
|
|
2
2
|
import { BaseResource, } from "./base.js";
|
|
3
3
|
export class CodeEnvsResource extends BaseResource {
|
|
4
4
|
async list(opts) {
|
|
@@ -25,6 +25,78 @@ export class CodeEnvsResource extends BaseResource {
|
|
|
25
25
|
installedPackages,
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
+
async getDefinition(envLang, envName) {
|
|
29
|
+
const langEnc = encodeURIComponent(envLang);
|
|
30
|
+
const nameEnc = encodeURIComponent(envName);
|
|
31
|
+
return this.client.get(`/public/api/admin/code-envs/${langEnc}/${nameEnc}`);
|
|
32
|
+
}
|
|
33
|
+
async create(opts) {
|
|
34
|
+
const langEnc = encodeURIComponent(opts.envLang);
|
|
35
|
+
const nameEnc = encodeURIComponent(opts.envName);
|
|
36
|
+
const body = {
|
|
37
|
+
...opts.params,
|
|
38
|
+
deploymentMode: opts.deploymentMode,
|
|
39
|
+
};
|
|
40
|
+
return this.client.post(`/public/api/admin/code-envs/${langEnc}/${nameEnc}?wait=${opts.wait !== false}`, body);
|
|
41
|
+
}
|
|
42
|
+
async setDefinition(envLang, envName, definition) {
|
|
43
|
+
const langEnc = encodeURIComponent(envLang);
|
|
44
|
+
const nameEnc = encodeURIComponent(envName);
|
|
45
|
+
return this.client.put(`/public/api/admin/code-envs/${langEnc}/${nameEnc}`, definition);
|
|
46
|
+
}
|
|
47
|
+
async setPackages(envLang, envName, packages, opts) {
|
|
48
|
+
const current = await this.getDefinition(envLang, envName);
|
|
49
|
+
const next = {
|
|
50
|
+
...current,
|
|
51
|
+
specPackageList: normalizePackageList(packages),
|
|
52
|
+
};
|
|
53
|
+
if (opts?.installCorePackages !== undefined) {
|
|
54
|
+
const currentDesc = current.desc;
|
|
55
|
+
const desc = isRecord(currentDesc) ? { ...currentDesc, } : {};
|
|
56
|
+
desc.installCorePackages = opts.installCorePackages;
|
|
57
|
+
next.desc = desc;
|
|
58
|
+
}
|
|
59
|
+
return this.setDefinition(envLang, envName, next);
|
|
60
|
+
}
|
|
61
|
+
async updatePackages(envLang, envName, opts) {
|
|
62
|
+
const langEnc = encodeURIComponent(envLang);
|
|
63
|
+
const nameEnc = encodeURIComponent(envName);
|
|
64
|
+
const query = new URLSearchParams();
|
|
65
|
+
query.set("forceRebuildEnv", String(opts?.forceRebuildEnv === true));
|
|
66
|
+
if (opts?.versionToUpdate !== undefined)
|
|
67
|
+
query.set("versionToUpdate", opts.versionToUpdate);
|
|
68
|
+
query.set("wait", String(opts?.wait !== false));
|
|
69
|
+
return this.client.post(`/public/api/admin/code-envs/${langEnc}/${nameEnc}/packages?${query.toString()}`);
|
|
70
|
+
}
|
|
71
|
+
async setJupyterSupport(envLang, envName, active, opts) {
|
|
72
|
+
const langEnc = encodeURIComponent(envLang);
|
|
73
|
+
const nameEnc = encodeURIComponent(envName);
|
|
74
|
+
const query = new URLSearchParams();
|
|
75
|
+
query.set("active", String(active));
|
|
76
|
+
query.set("wait", String(opts?.wait !== false));
|
|
77
|
+
return this.client.post(`/public/api/admin/code-envs/${langEnc}/${nameEnc}/jupyter?${query.toString()}`);
|
|
78
|
+
}
|
|
79
|
+
async delete(envLang, envName, opts) {
|
|
80
|
+
const langEnc = encodeURIComponent(envLang);
|
|
81
|
+
const nameEnc = encodeURIComponent(envName);
|
|
82
|
+
await this.client.del(`/public/api/admin/code-envs/${langEnc}/${nameEnc}?wait=${opts?.wait !== false}`);
|
|
83
|
+
return { deleted: envName, envLang, };
|
|
84
|
+
}
|
|
85
|
+
async listUsages(envLang, envName) {
|
|
86
|
+
let raw;
|
|
87
|
+
if (envLang !== undefined || envName !== undefined) {
|
|
88
|
+
if (!envLang || !envName) {
|
|
89
|
+
throw new Error("codeEnvs.listUsages requires both envLang and envName when either is provided");
|
|
90
|
+
}
|
|
91
|
+
const langEnc = encodeURIComponent(envLang);
|
|
92
|
+
const nameEnc = encodeURIComponent(envName);
|
|
93
|
+
raw = await this.client.get(`/public/api/admin/code-envs/${langEnc}/${nameEnc}/usages`);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
raw = await this.client.get("/public/api/admin/code-envs/usages");
|
|
97
|
+
}
|
|
98
|
+
return this.client.safeParse(CodeEnvUsageArraySchema, raw, "codeEnvs.listUsages");
|
|
99
|
+
}
|
|
28
100
|
}
|
|
29
101
|
function splitPackageList(raw) {
|
|
30
102
|
if (!raw)
|
|
@@ -34,3 +106,10 @@ function splitPackageList(raw) {
|
|
|
34
106
|
.map((line) => line.trim())
|
|
35
107
|
.filter((line) => line.length > 0);
|
|
36
108
|
}
|
|
109
|
+
function normalizePackageList(packages) {
|
|
110
|
+
const lines = Array.isArray(packages) ? packages : packages.split(/\r?\n/);
|
|
111
|
+
return lines.map((line) => line.trim()).filter((line) => line.length > 0).join("\n");
|
|
112
|
+
}
|
|
113
|
+
function isRecord(value) {
|
|
114
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
115
|
+
}
|
|
@@ -4,7 +4,9 @@ export declare class ConnectionsResource extends BaseResource {
|
|
|
4
4
|
/**
|
|
5
5
|
* Returns sorted list of all connection names visible to the current user.
|
|
6
6
|
*/
|
|
7
|
-
list(
|
|
7
|
+
list(opts?: {
|
|
8
|
+
type?: string;
|
|
9
|
+
}): Promise<string[]>;
|
|
8
10
|
/**
|
|
9
11
|
* Infers available connections.
|
|
10
12
|
*
|
|
@@ -47,8 +47,10 @@ export class ConnectionsResource extends BaseResource {
|
|
|
47
47
|
/**
|
|
48
48
|
* Returns sorted list of all connection names visible to the current user.
|
|
49
49
|
*/
|
|
50
|
-
async list() {
|
|
51
|
-
const
|
|
50
|
+
async list(opts) {
|
|
51
|
+
const type = opts?.type?.trim();
|
|
52
|
+
const query = type ? `?type=${encodeURIComponent(type)}` : "";
|
|
53
|
+
const raw = await this.client.get(`/public/api/connections/get-names/${query}`);
|
|
52
54
|
return normalizeConnectionNames(raw);
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DashboardDetails, DashboardSummary } from "../schemas.js";
|
|
2
|
+
import { BaseResource } from "./base.js";
|
|
3
|
+
export interface DashboardCreateOptions {
|
|
4
|
+
name: string;
|
|
5
|
+
settings?: Record<string, unknown>;
|
|
6
|
+
projectKey?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface DashboardUpdateOptions {
|
|
9
|
+
name?: string;
|
|
10
|
+
data?: Record<string, unknown>;
|
|
11
|
+
projectKey?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class DashboardsResource extends BaseResource {
|
|
14
|
+
list(projectKey?: string): Promise<DashboardSummary[]>;
|
|
15
|
+
get(dashboardId: string, projectKey?: string): Promise<DashboardDetails>;
|
|
16
|
+
create(opts: DashboardCreateOptions): Promise<DashboardDetails>;
|
|
17
|
+
update(dashboardId: string, opts: DashboardUpdateOptions): Promise<DashboardDetails>;
|
|
18
|
+
delete(dashboardId: string, projectKey?: string): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DashboardDetailsSchema, DashboardSummaryArraySchema, } from "../schemas.js";
|
|
2
|
+
import { deepMerge, } from "../utils/deep-merge.js";
|
|
3
|
+
import { BaseResource, } from "./base.js";
|
|
4
|
+
export class DashboardsResource extends BaseResource {
|
|
5
|
+
async list(projectKey) {
|
|
6
|
+
const raw = await this.client.get(`/public/api/projects/${this.enc(projectKey)}/dashboards/`);
|
|
7
|
+
return this.client.safeParse(DashboardSummaryArraySchema, raw, "dashboards.list");
|
|
8
|
+
}
|
|
9
|
+
async get(dashboardId, projectKey) {
|
|
10
|
+
const raw = await this.client.get(`/public/api/projects/${this.enc(projectKey)}/dashboards/${encodeURIComponent(dashboardId)}/`);
|
|
11
|
+
return this.client.safeParse(DashboardDetailsSchema, raw, "dashboards.get");
|
|
12
|
+
}
|
|
13
|
+
async create(opts) {
|
|
14
|
+
const pk = this.resolveProjectKey(opts.projectKey);
|
|
15
|
+
const body = { ...(opts.settings ?? { pages: [], }), name: opts.name, };
|
|
16
|
+
const created = await this.client.post(`/public/api/projects/${encodeURIComponent(pk)}/dashboards/`, body);
|
|
17
|
+
return this.get(created.id, pk);
|
|
18
|
+
}
|
|
19
|
+
async update(dashboardId, opts) {
|
|
20
|
+
const current = await this.get(dashboardId, opts.projectKey);
|
|
21
|
+
const next = deepMerge(current, opts.data ?? {});
|
|
22
|
+
if (opts.name !== undefined)
|
|
23
|
+
next.name = opts.name;
|
|
24
|
+
const raw = await this.client.put(`/public/api/projects/${this.enc(opts.projectKey)}/dashboards/${encodeURIComponent(dashboardId)}/`, next);
|
|
25
|
+
return this.client.safeParse(DashboardDetailsSchema, raw, "dashboards.update");
|
|
26
|
+
}
|
|
27
|
+
async delete(dashboardId, projectKey) {
|
|
28
|
+
await this.client.del(`/public/api/projects/${this.enc(projectKey)}/dashboards/${encodeURIComponent(dashboardId)}/`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { DataQualityComputeResult, DataQualityProjectStatus, DataQualityRule, DataQualityRuleResult, DataQualityRules, DataQualityStatus, DataQualityStatusByPartition, DataQualityTimeline, FutureWaitResult } from "../schemas.js";
|
|
2
|
+
import { BaseResource } from "./base.js";
|
|
3
|
+
export interface DataQualityProjectOptions {
|
|
4
|
+
projectKey?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface DataQualityPartitionOptions extends DataQualityProjectOptions {
|
|
7
|
+
partition?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface DataQualityStatusByPartitionOptions extends DataQualityProjectOptions {
|
|
10
|
+
includeAllPartitions?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface DataQualityHistoryOptions extends DataQualityPartitionOptions {
|
|
13
|
+
minTimestamp?: number;
|
|
14
|
+
maxTimestamp?: number;
|
|
15
|
+
resultsPerPage?: number;
|
|
16
|
+
page?: number;
|
|
17
|
+
ruleId?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface DataQualityRuleCreateOptions extends DataQualityProjectOptions {
|
|
20
|
+
config: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
export interface DataQualityRuleUpdateOptions extends DataQualityProjectOptions {
|
|
23
|
+
data: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export interface DataQualityComputeOptions extends DataQualityPartitionOptions {
|
|
26
|
+
ruleId?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface DataQualityComputeAndWaitOptions extends DataQualityComputeOptions {
|
|
29
|
+
pollIntervalMs?: number;
|
|
30
|
+
timeoutMs?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface DataQualityProjectStatusOptions extends DataQualityProjectOptions {
|
|
33
|
+
onlyMonitored?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface DataQualityProjectTimelineOptions extends DataQualityProjectOptions {
|
|
36
|
+
minTimestamp?: number;
|
|
37
|
+
maxTimestamp?: number;
|
|
38
|
+
}
|
|
39
|
+
export declare class DataQualityResource extends BaseResource {
|
|
40
|
+
rules(datasetName: string, projectKey?: string): Promise<DataQualityRules>;
|
|
41
|
+
listRules(datasetName: string, projectKey?: string): Promise<DataQualityRule[]>;
|
|
42
|
+
createRule(datasetName: string, opts: DataQualityRuleCreateOptions): Promise<DataQualityRule>;
|
|
43
|
+
updateRule(datasetName: string, ruleId: string, opts: DataQualityRuleUpdateOptions): Promise<DataQualityRule>;
|
|
44
|
+
deleteRule(datasetName: string, ruleId: string, projectKey?: string): Promise<void>;
|
|
45
|
+
getRule(datasetName: string, ruleId: string, projectKey?: string): Promise<DataQualityRule>;
|
|
46
|
+
status(datasetName: string, projectKey?: string): Promise<DataQualityStatus>;
|
|
47
|
+
statusByPartition(datasetName: string, opts?: DataQualityStatusByPartitionOptions): Promise<DataQualityStatusByPartition>;
|
|
48
|
+
lastResults(datasetName: string, opts?: DataQualityHistoryOptions): Promise<DataQualityRuleResult[]>;
|
|
49
|
+
history(datasetName: string, opts?: DataQualityHistoryOptions): Promise<DataQualityRuleResult[]>;
|
|
50
|
+
computeRules(datasetName: string, opts?: DataQualityComputeOptions): Promise<DataQualityComputeResult>;
|
|
51
|
+
computeRulesAndWait(datasetName: string, opts?: DataQualityComputeAndWaitOptions): Promise<FutureWaitResult>;
|
|
52
|
+
projectStatus(opts?: DataQualityProjectStatusOptions): Promise<DataQualityProjectStatus>;
|
|
53
|
+
projectTimeline(opts?: DataQualityProjectTimelineOptions): Promise<DataQualityTimeline>;
|
|
54
|
+
}
|