dataiku-sdk 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/dist/src/cli.js +1668 -32
- package/dist/src/client.d.ts +61 -2
- package/dist/src/client.js +184 -5
- package/dist/src/index.d.ts +14 -1
- package/dist/src/index.js +13 -0
- package/dist/src/resources/api-deployer.d.ts +66 -0
- package/dist/src/resources/api-deployer.js +79 -0
- package/dist/src/resources/api-services.d.ts +38 -0
- package/dist/src/resources/api-services.js +50 -0
- package/dist/src/resources/applications.d.ts +56 -0
- package/dist/src/resources/applications.js +67 -0
- package/dist/src/resources/bundles.d.ts +53 -0
- package/dist/src/resources/bundles.js +103 -0
- package/dist/src/resources/continuous-activities.d.ts +27 -0
- package/dist/src/resources/continuous-activities.js +22 -0
- package/dist/src/resources/datasets.d.ts +6 -0
- package/dist/src/resources/datasets.js +15 -0
- package/dist/src/resources/discussions.d.ts +26 -0
- package/dist/src/resources/discussions.js +29 -0
- package/dist/src/resources/meanings.d.ts +41 -0
- package/dist/src/resources/meanings.js +33 -0
- package/dist/src/resources/metrics.d.ts +44 -0
- package/dist/src/resources/metrics.js +31 -0
- package/dist/src/resources/project-library.d.ts +38 -0
- package/dist/src/resources/project-library.js +82 -0
- package/dist/src/resources/projects.d.ts +70 -0
- package/dist/src/resources/projects.js +97 -0
- package/dist/src/resources/recipes.js +10 -8
- package/dist/src/resources/scenarios.d.ts +3 -0
- package/dist/src/resources/scenarios.js +8 -1
- package/dist/src/resources/statistics.d.ts +56 -0
- package/dist/src/resources/statistics.js +51 -0
- package/dist/src/resources/streaming-endpoints.d.ts +45 -0
- package/dist/src/resources/streaming-endpoints.js +36 -0
- package/dist/src/resources/webapps.d.ts +27 -0
- package/dist/src/resources/webapps.js +36 -0
- package/dist/src/resources/workspaces.d.ts +59 -0
- package/dist/src/resources/workspaces.js +31 -0
- package/dist/src/skill.js +6 -4
- package/package.json +1 -1
package/dist/src/client.d.ts
CHANGED
|
@@ -1,21 +1,45 @@
|
|
|
1
1
|
import { type Static, type TSchema } from "@sinclair/typebox";
|
|
2
|
+
import { ApiDeployerResource } from "./resources/api-deployer.js";
|
|
3
|
+
import { ApiServicesResource } from "./resources/api-services.js";
|
|
4
|
+
import { ApplicationsResource } from "./resources/applications.js";
|
|
5
|
+
import { BundlesResource, ProjectDeployerResource } from "./resources/bundles.js";
|
|
2
6
|
import { CodeEnvsResource } from "./resources/code-envs.js";
|
|
3
7
|
import { ConnectionsResource } from "./resources/connections.js";
|
|
8
|
+
import { ContinuousActivitiesResource } from "./resources/continuous-activities.js";
|
|
4
9
|
import { DashboardsResource } from "./resources/dashboards.js";
|
|
5
10
|
import { DataQualityResource } from "./resources/data-quality.js";
|
|
6
11
|
import { DatasetsResource } from "./resources/datasets.js";
|
|
12
|
+
import { DiscussionsResource } from "./resources/discussions.js";
|
|
7
13
|
import { FlowZonesResource } from "./resources/flow-zones.js";
|
|
8
14
|
import { FoldersResource } from "./resources/folders.js";
|
|
9
15
|
import { FuturesResource } from "./resources/futures.js";
|
|
10
16
|
import { InsightsResource } from "./resources/insights.js";
|
|
11
17
|
import { JobsResource } from "./resources/jobs.js";
|
|
18
|
+
import { MeaningsResource } from "./resources/meanings.js";
|
|
19
|
+
import { MetricsResource } from "./resources/metrics.js";
|
|
12
20
|
import { NotebooksResource } from "./resources/notebooks.js";
|
|
21
|
+
import { ProjectLibraryResource } from "./resources/project-library.js";
|
|
13
22
|
import { ProjectsResource } from "./resources/projects.js";
|
|
14
23
|
import { RecipesResource } from "./resources/recipes.js";
|
|
15
24
|
import { ScenariosResource } from "./resources/scenarios.js";
|
|
16
25
|
import { SqlResource } from "./resources/sql.js";
|
|
26
|
+
import { StatisticsResource } from "./resources/statistics.js";
|
|
27
|
+
import { StreamingEndpointsResource } from "./resources/streaming-endpoints.js";
|
|
17
28
|
import { VariablesResource } from "./resources/variables.js";
|
|
29
|
+
import { WebappsResource } from "./resources/webapps.js";
|
|
18
30
|
import { WikiResource } from "./resources/wiki.js";
|
|
31
|
+
import { WorkspacesResource } from "./resources/workspaces.js";
|
|
32
|
+
export interface DataikuClientTraceEvent {
|
|
33
|
+
type: "trace";
|
|
34
|
+
phase: "request" | "response" | "error";
|
|
35
|
+
method: string;
|
|
36
|
+
url: string;
|
|
37
|
+
attempt: number;
|
|
38
|
+
maxAttempts: number;
|
|
39
|
+
status?: number;
|
|
40
|
+
elapsedMs?: number;
|
|
41
|
+
detail?: string;
|
|
42
|
+
}
|
|
19
43
|
export interface DataikuClientConfig {
|
|
20
44
|
/** DSS base URL (e.g. https://dss.example.com) */
|
|
21
45
|
url: string;
|
|
@@ -27,8 +51,9 @@ export interface DataikuClientConfig {
|
|
|
27
51
|
requestTimeoutMs?: number;
|
|
28
52
|
/** Max retry attempts for idempotent requests (default 4, capped at 10) */
|
|
29
53
|
retryMaxAttempts?: number;
|
|
30
|
-
/** Emit HTTP request/response
|
|
54
|
+
/** Emit HTTP request/response trace events. Defaults to JSONL on stderr when verbose is true. */
|
|
31
55
|
verbose?: boolean;
|
|
56
|
+
onTrace?: (event: DataikuClientTraceEvent) => void;
|
|
32
57
|
/** Override TLS certificate verification for HTTPS requests. */
|
|
33
58
|
tlsRejectUnauthorized?: boolean;
|
|
34
59
|
/** Extra PEM CA bundle to trust in addition to Bun's default trust store. */
|
|
@@ -49,6 +74,7 @@ export declare class DataikuClient {
|
|
|
49
74
|
private readonly retryMaxAttempts;
|
|
50
75
|
private readonly verbose;
|
|
51
76
|
private readonly tlsOptions;
|
|
77
|
+
private readonly onTrace;
|
|
52
78
|
private readonly onValidationWarning;
|
|
53
79
|
private projectsResource?;
|
|
54
80
|
private datasetsResource?;
|
|
@@ -67,6 +93,20 @@ export declare class DataikuClient {
|
|
|
67
93
|
private sqlResource?;
|
|
68
94
|
private notebooksResource?;
|
|
69
95
|
private wikiResource?;
|
|
96
|
+
private applicationsResource?;
|
|
97
|
+
private webappsResource?;
|
|
98
|
+
private apiServicesResource?;
|
|
99
|
+
private apiDeployerResource?;
|
|
100
|
+
private bundlesResource?;
|
|
101
|
+
private projectDeployerResource?;
|
|
102
|
+
private projectLibraryResource?;
|
|
103
|
+
private streamingEndpointsResource?;
|
|
104
|
+
private continuousActivitiesResource?;
|
|
105
|
+
private statisticsResource?;
|
|
106
|
+
private discussionsResource?;
|
|
107
|
+
private workspacesResource?;
|
|
108
|
+
private metricsResource?;
|
|
109
|
+
private meaningsResource?;
|
|
70
110
|
get projects(): ProjectsResource;
|
|
71
111
|
get datasets(): DatasetsResource;
|
|
72
112
|
get dashboards(): DashboardsResource;
|
|
@@ -84,12 +124,31 @@ export declare class DataikuClient {
|
|
|
84
124
|
get sql(): SqlResource;
|
|
85
125
|
get notebooks(): NotebooksResource;
|
|
86
126
|
get wiki(): WikiResource;
|
|
127
|
+
get applications(): ApplicationsResource;
|
|
128
|
+
get webapps(): WebappsResource;
|
|
129
|
+
get apiServices(): ApiServicesResource;
|
|
130
|
+
get apiDeployer(): ApiDeployerResource;
|
|
131
|
+
get bundles(): BundlesResource;
|
|
132
|
+
get projectDeployer(): ProjectDeployerResource;
|
|
133
|
+
get projectLibrary(): ProjectLibraryResource;
|
|
134
|
+
get streamingEndpoints(): StreamingEndpointsResource;
|
|
135
|
+
get continuousActivities(): ContinuousActivitiesResource;
|
|
136
|
+
get statistics(): StatisticsResource;
|
|
137
|
+
get discussions(): DiscussionsResource;
|
|
138
|
+
get workspaces(): WorkspacesResource;
|
|
139
|
+
get metrics(): MetricsResource;
|
|
140
|
+
get meanings(): MeaningsResource;
|
|
87
141
|
constructor(config: DataikuClientConfig);
|
|
88
142
|
getRequestTimeoutMs(): number;
|
|
89
143
|
resolveProjectKey(paramValue?: string): string;
|
|
90
144
|
get<T = unknown>(path: string): Promise<T>;
|
|
91
145
|
getText(path: string): Promise<string>;
|
|
146
|
+
getTextLimited(path: string, maxBytes: number): Promise<{
|
|
147
|
+
text: string;
|
|
148
|
+
truncated: boolean;
|
|
149
|
+
}>;
|
|
92
150
|
post<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
151
|
+
postText(path: string, body?: unknown): Promise<string>;
|
|
93
152
|
put<T = unknown>(path: string, body: unknown): Promise<T>;
|
|
94
153
|
del(path: string): Promise<void>;
|
|
95
154
|
putVoid(path: string, body: unknown): Promise<void>;
|
|
@@ -97,7 +156,7 @@ export declare class DataikuClient {
|
|
|
97
156
|
stream(path: string): Promise<Response>;
|
|
98
157
|
private getHeaders;
|
|
99
158
|
private getAnyHeaders;
|
|
100
|
-
private
|
|
159
|
+
private logTrace;
|
|
101
160
|
/**
|
|
102
161
|
* Validate raw data against a TypeBox schema, throwing on structural mismatch.
|
|
103
162
|
* Resources call this instead of bare `as T` casts for validated responses.
|
package/dist/src/client.js
CHANGED
|
@@ -3,23 +3,36 @@ 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 { ApiDeployerResource, } from "./resources/api-deployer.js";
|
|
7
|
+
import { ApiServicesResource, } from "./resources/api-services.js";
|
|
8
|
+
import { ApplicationsResource, } from "./resources/applications.js";
|
|
9
|
+
import { BundlesResource, ProjectDeployerResource, } from "./resources/bundles.js";
|
|
6
10
|
import { CodeEnvsResource, } from "./resources/code-envs.js";
|
|
7
11
|
import { ConnectionsResource, } from "./resources/connections.js";
|
|
12
|
+
import { ContinuousActivitiesResource, } from "./resources/continuous-activities.js";
|
|
8
13
|
import { DashboardsResource, } from "./resources/dashboards.js";
|
|
9
14
|
import { DataQualityResource, } from "./resources/data-quality.js";
|
|
10
15
|
import { DatasetsResource, } from "./resources/datasets.js";
|
|
16
|
+
import { DiscussionsResource, } from "./resources/discussions.js";
|
|
11
17
|
import { FlowZonesResource, } from "./resources/flow-zones.js";
|
|
12
18
|
import { FoldersResource, } from "./resources/folders.js";
|
|
13
19
|
import { FuturesResource, } from "./resources/futures.js";
|
|
14
20
|
import { InsightsResource, } from "./resources/insights.js";
|
|
15
21
|
import { JobsResource, } from "./resources/jobs.js";
|
|
22
|
+
import { MeaningsResource, } from "./resources/meanings.js";
|
|
23
|
+
import { MetricsResource, } from "./resources/metrics.js";
|
|
16
24
|
import { NotebooksResource, } from "./resources/notebooks.js";
|
|
25
|
+
import { ProjectLibraryResource, } from "./resources/project-library.js";
|
|
17
26
|
import { ProjectsResource, } from "./resources/projects.js";
|
|
18
27
|
import { RecipesResource, } from "./resources/recipes.js";
|
|
19
28
|
import { ScenariosResource, } from "./resources/scenarios.js";
|
|
20
29
|
import { SqlResource, } from "./resources/sql.js";
|
|
30
|
+
import { StatisticsResource, } from "./resources/statistics.js";
|
|
31
|
+
import { StreamingEndpointsResource, } from "./resources/streaming-endpoints.js";
|
|
21
32
|
import { VariablesResource, } from "./resources/variables.js";
|
|
33
|
+
import { WebappsResource, } from "./resources/webapps.js";
|
|
22
34
|
import { WikiResource, } from "./resources/wiki.js";
|
|
35
|
+
import { WorkspacesResource, } from "./resources/workspaces.js";
|
|
23
36
|
/* ------------------------------------------------------------------ */
|
|
24
37
|
/* Constants */
|
|
25
38
|
/* ------------------------------------------------------------------ */
|
|
@@ -31,6 +44,9 @@ const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
|
|
|
31
44
|
/* ------------------------------------------------------------------ */
|
|
32
45
|
/* Helpers */
|
|
33
46
|
/* ------------------------------------------------------------------ */
|
|
47
|
+
function defaultTrace(event) {
|
|
48
|
+
process.stderr.write(`${JSON.stringify(event)}\n`);
|
|
49
|
+
}
|
|
34
50
|
function defaultValidationWarning(_method, _errors) {
|
|
35
51
|
}
|
|
36
52
|
function sleep(ms) {
|
|
@@ -46,6 +62,43 @@ function isTransientError(status, body) {
|
|
|
46
62
|
function shouldRetryMethod(method) {
|
|
47
63
|
return method.toUpperCase() === "GET";
|
|
48
64
|
}
|
|
65
|
+
function concatBytes(chunks, total) {
|
|
66
|
+
const out = new Uint8Array(total);
|
|
67
|
+
let offset = 0;
|
|
68
|
+
for (const chunk of chunks) {
|
|
69
|
+
out.set(chunk, offset);
|
|
70
|
+
offset += chunk.byteLength;
|
|
71
|
+
}
|
|
72
|
+
return out;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Drop a trailing incomplete UTF-8 multibyte sequence so the bytes end on a
|
|
76
|
+
* character boundary. Guarantees the decoded string re-encodes to no more bytes
|
|
77
|
+
* than the input, so a byte cap is never exceeded by a replacement character.
|
|
78
|
+
*/
|
|
79
|
+
function trimToUtf8Boundary(bytes) {
|
|
80
|
+
let i = bytes.length - 1;
|
|
81
|
+
let continuation = 0;
|
|
82
|
+
while (i >= 0 && (bytes[i] & 0xC0) === 0x80) {
|
|
83
|
+
i--;
|
|
84
|
+
continuation++;
|
|
85
|
+
}
|
|
86
|
+
if (i < 0)
|
|
87
|
+
return bytes;
|
|
88
|
+
const lead = bytes[i];
|
|
89
|
+
let expected;
|
|
90
|
+
if ((lead & 0x80) === 0x00)
|
|
91
|
+
expected = 1;
|
|
92
|
+
else if ((lead & 0xE0) === 0xC0)
|
|
93
|
+
expected = 2;
|
|
94
|
+
else if ((lead & 0xF0) === 0xE0)
|
|
95
|
+
expected = 3;
|
|
96
|
+
else if ((lead & 0xF8) === 0xF0)
|
|
97
|
+
expected = 4;
|
|
98
|
+
else
|
|
99
|
+
return bytes;
|
|
100
|
+
return continuation + 1 < expected ? bytes.subarray(0, i) : bytes;
|
|
101
|
+
}
|
|
49
102
|
function buildRetryMetadata(method, enabled, maxAttempts, attempts, delaysMs, timedOut) {
|
|
50
103
|
return {
|
|
51
104
|
method,
|
|
@@ -89,6 +142,7 @@ export class DataikuClient {
|
|
|
89
142
|
retryMaxAttempts;
|
|
90
143
|
verbose;
|
|
91
144
|
tlsOptions;
|
|
145
|
+
onTrace;
|
|
92
146
|
onValidationWarning;
|
|
93
147
|
/* Resource namespaces — lazily initialized to break circular imports */
|
|
94
148
|
projectsResource;
|
|
@@ -108,6 +162,20 @@ export class DataikuClient {
|
|
|
108
162
|
sqlResource;
|
|
109
163
|
notebooksResource;
|
|
110
164
|
wikiResource;
|
|
165
|
+
applicationsResource;
|
|
166
|
+
webappsResource;
|
|
167
|
+
apiServicesResource;
|
|
168
|
+
apiDeployerResource;
|
|
169
|
+
bundlesResource;
|
|
170
|
+
projectDeployerResource;
|
|
171
|
+
projectLibraryResource;
|
|
172
|
+
streamingEndpointsResource;
|
|
173
|
+
continuousActivitiesResource;
|
|
174
|
+
statisticsResource;
|
|
175
|
+
discussionsResource;
|
|
176
|
+
workspacesResource;
|
|
177
|
+
metricsResource;
|
|
178
|
+
meaningsResource;
|
|
111
179
|
get projects() {
|
|
112
180
|
return (this.projectsResource ??= new ProjectsResource(this));
|
|
113
181
|
}
|
|
@@ -159,6 +227,48 @@ export class DataikuClient {
|
|
|
159
227
|
get wiki() {
|
|
160
228
|
return (this.wikiResource ??= new WikiResource(this));
|
|
161
229
|
}
|
|
230
|
+
get applications() {
|
|
231
|
+
return (this.applicationsResource ??= new ApplicationsResource(this));
|
|
232
|
+
}
|
|
233
|
+
get webapps() {
|
|
234
|
+
return (this.webappsResource ??= new WebappsResource(this));
|
|
235
|
+
}
|
|
236
|
+
get apiServices() {
|
|
237
|
+
return (this.apiServicesResource ??= new ApiServicesResource(this));
|
|
238
|
+
}
|
|
239
|
+
get apiDeployer() {
|
|
240
|
+
return (this.apiDeployerResource ??= new ApiDeployerResource(this));
|
|
241
|
+
}
|
|
242
|
+
get bundles() {
|
|
243
|
+
return (this.bundlesResource ??= new BundlesResource(this));
|
|
244
|
+
}
|
|
245
|
+
get projectDeployer() {
|
|
246
|
+
return (this.projectDeployerResource ??= new ProjectDeployerResource(this));
|
|
247
|
+
}
|
|
248
|
+
get projectLibrary() {
|
|
249
|
+
return (this.projectLibraryResource ??= new ProjectLibraryResource(this));
|
|
250
|
+
}
|
|
251
|
+
get streamingEndpoints() {
|
|
252
|
+
return (this.streamingEndpointsResource ??= new StreamingEndpointsResource(this));
|
|
253
|
+
}
|
|
254
|
+
get continuousActivities() {
|
|
255
|
+
return (this.continuousActivitiesResource ??= new ContinuousActivitiesResource(this));
|
|
256
|
+
}
|
|
257
|
+
get statistics() {
|
|
258
|
+
return (this.statisticsResource ??= new StatisticsResource(this));
|
|
259
|
+
}
|
|
260
|
+
get discussions() {
|
|
261
|
+
return (this.discussionsResource ??= new DiscussionsResource(this));
|
|
262
|
+
}
|
|
263
|
+
get workspaces() {
|
|
264
|
+
return (this.workspacesResource ??= new WorkspacesResource(this));
|
|
265
|
+
}
|
|
266
|
+
get metrics() {
|
|
267
|
+
return (this.metricsResource ??= new MetricsResource(this));
|
|
268
|
+
}
|
|
269
|
+
get meanings() {
|
|
270
|
+
return (this.meaningsResource ??= new MeaningsResource(this));
|
|
271
|
+
}
|
|
162
272
|
constructor(config) {
|
|
163
273
|
const url = config.url?.trim();
|
|
164
274
|
if (!url)
|
|
@@ -174,6 +284,7 @@ export class DataikuClient {
|
|
|
174
284
|
this.retryMaxAttempts = Math.min(Math.max(1, rawMax), MAX_RETRY_ATTEMPTS_CAP);
|
|
175
285
|
this.verbose = config.verbose === true;
|
|
176
286
|
this.tlsOptions = buildFetchTlsOptions(config);
|
|
287
|
+
this.onTrace = config.onTrace ?? defaultTrace;
|
|
177
288
|
this.onValidationWarning = config.onValidationWarning ?? defaultValidationWarning;
|
|
178
289
|
}
|
|
179
290
|
getRequestTimeoutMs() {
|
|
@@ -203,6 +314,50 @@ export class DataikuClient {
|
|
|
203
314
|
});
|
|
204
315
|
return res.text();
|
|
205
316
|
}
|
|
317
|
+
async getTextLimited(path, maxBytes) {
|
|
318
|
+
const limit = Math.max(0, Math.floor(maxBytes));
|
|
319
|
+
const res = await this.fetchWithRetry(`${this.baseUrl}${path}`, {
|
|
320
|
+
method: "GET",
|
|
321
|
+
headers: this.getAnyHeaders(),
|
|
322
|
+
});
|
|
323
|
+
if (!res.body)
|
|
324
|
+
return { text: "", truncated: false, };
|
|
325
|
+
const reader = res.body.getReader();
|
|
326
|
+
const chunks = [];
|
|
327
|
+
let bytesRead = 0;
|
|
328
|
+
let truncated = false;
|
|
329
|
+
try {
|
|
330
|
+
while (bytesRead < limit) {
|
|
331
|
+
const { done, value, } = await reader.read();
|
|
332
|
+
if (done)
|
|
333
|
+
break;
|
|
334
|
+
const room = limit - bytesRead;
|
|
335
|
+
if (value.byteLength > room) {
|
|
336
|
+
chunks.push(value.slice(0, room));
|
|
337
|
+
bytesRead += room;
|
|
338
|
+
truncated = true;
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
chunks.push(value);
|
|
342
|
+
bytesRead += value.byteLength;
|
|
343
|
+
}
|
|
344
|
+
if (!truncated && bytesRead >= limit) {
|
|
345
|
+
// Buffer filled exactly on a chunk boundary; peek whether more data remains.
|
|
346
|
+
const { done, } = await reader.read();
|
|
347
|
+
if (!done)
|
|
348
|
+
truncated = true;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
finally {
|
|
352
|
+
await reader.cancel();
|
|
353
|
+
}
|
|
354
|
+
const collected = concatBytes(chunks, bytesRead);
|
|
355
|
+
// On truncation, drop any trailing partial UTF-8 character so the decoded
|
|
356
|
+
// text never re-encodes beyond the byte cap (a stream-flush would otherwise
|
|
357
|
+
// emit a 3-byte replacement char for a split multibyte sequence).
|
|
358
|
+
const usable = truncated ? trimToUtf8Boundary(collected) : collected;
|
|
359
|
+
return { text: new TextDecoder().decode(usable), truncated, };
|
|
360
|
+
}
|
|
206
361
|
async post(path, body) {
|
|
207
362
|
const res = await this.fetchWithRetry(`${this.baseUrl}${path}`, {
|
|
208
363
|
method: "POST",
|
|
@@ -211,6 +366,14 @@ export class DataikuClient {
|
|
|
211
366
|
});
|
|
212
367
|
return this.parseJsonResponse(res);
|
|
213
368
|
}
|
|
369
|
+
async postText(path, body) {
|
|
370
|
+
const res = await this.fetchWithRetry(`${this.baseUrl}${path}`, {
|
|
371
|
+
method: "POST",
|
|
372
|
+
headers: this.getHeaders(),
|
|
373
|
+
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
374
|
+
});
|
|
375
|
+
return res.text();
|
|
376
|
+
}
|
|
214
377
|
async put(path, body) {
|
|
215
378
|
const res = await this.fetchWithRetry(`${this.baseUrl}${path}`, {
|
|
216
379
|
method: "PUT",
|
|
@@ -265,9 +428,9 @@ export class DataikuClient {
|
|
|
265
428
|
Accept: "*/*",
|
|
266
429
|
};
|
|
267
430
|
}
|
|
268
|
-
|
|
431
|
+
logTrace(event) {
|
|
269
432
|
if (this.verbose)
|
|
270
|
-
|
|
433
|
+
this.onTrace({ type: "trace", ...event, });
|
|
271
434
|
}
|
|
272
435
|
/* ---- public: schema-validated parsing ---- */
|
|
273
436
|
/**
|
|
@@ -340,7 +503,7 @@ export class DataikuClient {
|
|
|
340
503
|
timedOut = true;
|
|
341
504
|
controller.abort();
|
|
342
505
|
}, this.requestTimeoutMs);
|
|
343
|
-
this.
|
|
506
|
+
this.logTrace({ phase: "request", method, url, attempt, maxAttempts, });
|
|
344
507
|
try {
|
|
345
508
|
const requestInit = {
|
|
346
509
|
...init,
|
|
@@ -350,7 +513,15 @@ export class DataikuClient {
|
|
|
350
513
|
if (this.tlsOptions)
|
|
351
514
|
requestInit.tls = this.tlsOptions;
|
|
352
515
|
const res = await fetch(url, requestInit);
|
|
353
|
-
this.
|
|
516
|
+
this.logTrace({
|
|
517
|
+
phase: "response",
|
|
518
|
+
method,
|
|
519
|
+
url,
|
|
520
|
+
attempt,
|
|
521
|
+
maxAttempts,
|
|
522
|
+
status: res.status,
|
|
523
|
+
elapsedMs: Date.now() - startedAt,
|
|
524
|
+
});
|
|
354
525
|
if (!res.ok) {
|
|
355
526
|
const text = await res.text();
|
|
356
527
|
const canRetry = retryEnabled && attempt < maxAttempts && isTransientError(res.status, text);
|
|
@@ -379,7 +550,15 @@ export class DataikuClient {
|
|
|
379
550
|
: error instanceof Error
|
|
380
551
|
? error.message
|
|
381
552
|
: "Unknown transport error";
|
|
382
|
-
this.
|
|
553
|
+
this.logTrace({
|
|
554
|
+
phase: "error",
|
|
555
|
+
method,
|
|
556
|
+
url,
|
|
557
|
+
attempt,
|
|
558
|
+
maxAttempts,
|
|
559
|
+
elapsedMs: Date.now() - startedAt,
|
|
560
|
+
detail,
|
|
561
|
+
});
|
|
383
562
|
const statusText = timedOut ? "Request Timeout" : "Network Error";
|
|
384
563
|
throw new DataikuError(0, statusText, detail, buildRetryMetadata(method, retryEnabled, maxAttempts, attempt, delaysMs, timedOut));
|
|
385
564
|
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,24 +1,37 @@
|
|
|
1
|
-
export { DataikuClient, type DataikuClientConfig, } from "./client.js";
|
|
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
4
|
export { DataikuError, type DataikuErrorCategory, type DataikuErrorTaxonomy, type DataikuRetryMetadata, } from "./errors.js";
|
|
5
|
+
export { ApiDeployerResource, } from "./resources/api-deployer.js";
|
|
6
|
+
export { ApiServicesResource, } from "./resources/api-services.js";
|
|
7
|
+
export { ApplicationsResource, } from "./resources/applications.js";
|
|
8
|
+
export { BundlesResource, ProjectDeployerResource, } from "./resources/bundles.js";
|
|
5
9
|
export { CodeEnvsResource, } from "./resources/code-envs.js";
|
|
6
10
|
export { type ConnectionSchemaListOptions, ConnectionsResource, type ConnectionTableListOptions, } from "./resources/connections.js";
|
|
11
|
+
export { ContinuousActivitiesResource, } from "./resources/continuous-activities.js";
|
|
7
12
|
export { DashboardsResource, } from "./resources/dashboards.js";
|
|
8
13
|
export { DataQualityResource, } from "./resources/data-quality.js";
|
|
9
14
|
export { type DatasetBuildValidationResult, type DatasetCloneOptions, type DatasetCloneResult, type DatasetSchemaColumnInput, DatasetsResource, } from "./resources/datasets.js";
|
|
15
|
+
export { DiscussionsResource, } from "./resources/discussions.js";
|
|
10
16
|
export { type FlowZoneItemInput, FlowZonesResource, } from "./resources/flow-zones.js";
|
|
11
17
|
export { FoldersResource, } from "./resources/folders.js";
|
|
12
18
|
export { FuturesResource, } from "./resources/futures.js";
|
|
13
19
|
export { InsightsResource, } from "./resources/insights.js";
|
|
14
20
|
export { computeNextPollDelayMs, type JobBuildAndWaitOptions, type JobBuildOptions, type JobBuildTarget, type JobBuildTargetType, type JobLogFilter, type JobLogProgress, type JobLogSummary, JobsResource, parseJobLogProgress, } from "./resources/jobs.js";
|
|
21
|
+
export { MeaningsResource, } from "./resources/meanings.js";
|
|
22
|
+
export { MetricsResource, } from "./resources/metrics.js";
|
|
15
23
|
export { NotebooksResource, } from "./resources/notebooks.js";
|
|
24
|
+
export { ProjectLibraryResource, } from "./resources/project-library.js";
|
|
16
25
|
export { type FlowMapResult, ProjectsResource, } from "./resources/projects.js";
|
|
17
26
|
export { type RecipeCloneOptions, type RecipeCloneResult, type RecipeGraphReference, type RecipeGraphValidationResult, type RecipeRunOptions, type RecipeRunOutput, type RecipeRunResult, RecipesResource, } from "./resources/recipes.js";
|
|
18
27
|
export { normalizeScenarioUpdateData, SCENARIO_CANONICAL_EDITABLE_FIELDS, type ScenarioFieldChange, type ScenarioFieldMismatch, type ScenarioScriptRunResult, ScenariosResource, type ScenarioUpdateNormalization, type ScenarioUpdatePreview, scenarioUpdatePreview, type ScenarioUpdateResult, } from "./resources/scenarios.js";
|
|
19
28
|
export { SqlResource, } from "./resources/sql.js";
|
|
29
|
+
export { StatisticsResource, } from "./resources/statistics.js";
|
|
30
|
+
export { StreamingEndpointsResource, } from "./resources/streaming-endpoints.js";
|
|
20
31
|
export { VariablesResource, } from "./resources/variables.js";
|
|
32
|
+
export { WebappsResource, } from "./resources/webapps.js";
|
|
21
33
|
export { WikiResource, } from "./resources/wiki.js";
|
|
34
|
+
export { WorkspacesResource, } from "./resources/workspaces.js";
|
|
22
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";
|
|
23
36
|
export type { SafeParseResult, } from "./schemas.js";
|
|
24
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";
|
package/dist/src/index.js
CHANGED
|
@@ -6,23 +6,36 @@ export { getConfigDir, getCredentialsPath, loadCredentials, saveCredentials, } f
|
|
|
6
6
|
// Errors
|
|
7
7
|
export { DataikuError, } from "./errors.js";
|
|
8
8
|
// Resources (for advanced use / extension)
|
|
9
|
+
export { ApiDeployerResource, } from "./resources/api-deployer.js";
|
|
10
|
+
export { ApiServicesResource, } from "./resources/api-services.js";
|
|
11
|
+
export { ApplicationsResource, } from "./resources/applications.js";
|
|
12
|
+
export { BundlesResource, ProjectDeployerResource, } from "./resources/bundles.js";
|
|
9
13
|
export { CodeEnvsResource, } from "./resources/code-envs.js";
|
|
10
14
|
export { ConnectionsResource, } from "./resources/connections.js";
|
|
15
|
+
export { ContinuousActivitiesResource, } from "./resources/continuous-activities.js";
|
|
11
16
|
export { DashboardsResource, } from "./resources/dashboards.js";
|
|
12
17
|
export { DataQualityResource, } from "./resources/data-quality.js";
|
|
13
18
|
export { DatasetsResource, } from "./resources/datasets.js";
|
|
19
|
+
export { DiscussionsResource, } from "./resources/discussions.js";
|
|
14
20
|
export { FlowZonesResource, } from "./resources/flow-zones.js";
|
|
15
21
|
export { FoldersResource, } from "./resources/folders.js";
|
|
16
22
|
export { FuturesResource, } from "./resources/futures.js";
|
|
17
23
|
export { InsightsResource, } from "./resources/insights.js";
|
|
18
24
|
export { computeNextPollDelayMs, JobsResource, parseJobLogProgress, } from "./resources/jobs.js";
|
|
25
|
+
export { MeaningsResource, } from "./resources/meanings.js";
|
|
26
|
+
export { MetricsResource, } from "./resources/metrics.js";
|
|
19
27
|
export { NotebooksResource, } from "./resources/notebooks.js";
|
|
28
|
+
export { ProjectLibraryResource, } from "./resources/project-library.js";
|
|
20
29
|
export { ProjectsResource, } from "./resources/projects.js";
|
|
21
30
|
export { RecipesResource, } from "./resources/recipes.js";
|
|
22
31
|
export { normalizeScenarioUpdateData, SCENARIO_CANONICAL_EDITABLE_FIELDS, ScenariosResource, scenarioUpdatePreview, } from "./resources/scenarios.js";
|
|
23
32
|
export { SqlResource, } from "./resources/sql.js";
|
|
33
|
+
export { StatisticsResource, } from "./resources/statistics.js";
|
|
34
|
+
export { StreamingEndpointsResource, } from "./resources/streaming-endpoints.js";
|
|
24
35
|
export { VariablesResource, } from "./resources/variables.js";
|
|
36
|
+
export { WebappsResource, } from "./resources/webapps.js";
|
|
25
37
|
export { WikiResource, } from "./resources/wiki.js";
|
|
38
|
+
export { WorkspacesResource, } from "./resources/workspaces.js";
|
|
26
39
|
// Schemas (TypeBox schema objects for runtime validation)
|
|
27
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";
|
|
28
41
|
// Utilities
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { BaseResource } from "./base.js";
|
|
2
|
+
export interface ApiDeployerInfra extends Record<string, unknown> {
|
|
3
|
+
id?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ApiDeployerStage extends Record<string, unknown> {
|
|
6
|
+
id?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ApiDeployerService extends Record<string, unknown> {
|
|
9
|
+
id?: string;
|
|
10
|
+
publishedServiceId?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ApiDeployerDeployment extends Record<string, unknown> {
|
|
13
|
+
id?: string;
|
|
14
|
+
deploymentId?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ApiDeployerDeploymentStatus extends Record<string, unknown> {
|
|
17
|
+
id?: string;
|
|
18
|
+
deploymentId?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ApiDeployerDeploymentSettings extends Record<string, unknown> {
|
|
21
|
+
id?: string;
|
|
22
|
+
deploymentId?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ApiDeployerActionResult extends Record<string, unknown> {
|
|
25
|
+
jobId?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare class ApiDeployerResource extends BaseResource {
|
|
28
|
+
/** List API Deployer infrastructures. */
|
|
29
|
+
listInfras(): Promise<ApiDeployerInfra[]>;
|
|
30
|
+
/** Create an API Deployer infrastructure. */
|
|
31
|
+
createInfra(body: Record<string, unknown>): Promise<ApiDeployerInfra>;
|
|
32
|
+
/** Get an API Deployer infrastructure. */
|
|
33
|
+
getInfra(infraId: string): Promise<ApiDeployerInfra>;
|
|
34
|
+
/** Delete an API Deployer infrastructure. */
|
|
35
|
+
deleteInfra(infraId: string): Promise<void>;
|
|
36
|
+
/** List API Deployer stages. */
|
|
37
|
+
listStages(): Promise<ApiDeployerStage[]>;
|
|
38
|
+
/** List published API Deployer services. */
|
|
39
|
+
listServices(): Promise<ApiDeployerService[]>;
|
|
40
|
+
/** Create a published API Deployer service. */
|
|
41
|
+
createService(body: Record<string, unknown>): Promise<ApiDeployerService>;
|
|
42
|
+
/** Get a published API Deployer service. */
|
|
43
|
+
getService(serviceId: string): Promise<ApiDeployerService>;
|
|
44
|
+
/** Delete a published API Deployer service. */
|
|
45
|
+
deleteService(serviceId: string): Promise<void>;
|
|
46
|
+
/** Publish a service version archive to the API Deployer. */
|
|
47
|
+
publishServiceVersion(serviceId: string, filePath: string): Promise<void>;
|
|
48
|
+
/** Delete a published service version. */
|
|
49
|
+
deleteServiceVersion(serviceId: string, version: string): Promise<void>;
|
|
50
|
+
/** List API Deployer deployments. */
|
|
51
|
+
listDeployments(): Promise<ApiDeployerDeployment[]>;
|
|
52
|
+
/** Create an API Deployer deployment. */
|
|
53
|
+
createDeployment(body: Record<string, unknown>): Promise<ApiDeployerDeployment>;
|
|
54
|
+
/** Get an API Deployer deployment. */
|
|
55
|
+
getDeployment(deploymentId: string): Promise<ApiDeployerDeployment>;
|
|
56
|
+
/** Get an API Deployer deployment's full status. */
|
|
57
|
+
getDeploymentStatus(deploymentId: string): Promise<ApiDeployerDeploymentStatus>;
|
|
58
|
+
/** Get API Deployer deployment settings. */
|
|
59
|
+
getDeploymentSettings(deploymentId: string): Promise<ApiDeployerDeploymentSettings>;
|
|
60
|
+
/** Save API Deployer deployment settings. */
|
|
61
|
+
saveDeploymentSettings(deploymentId: string, body: Record<string, unknown>): Promise<void>;
|
|
62
|
+
/** Start an API Deployer deployment update. */
|
|
63
|
+
startDeploymentUpdate(deploymentId: string): Promise<ApiDeployerActionResult>;
|
|
64
|
+
/** Delete an API Deployer deployment. */
|
|
65
|
+
deleteDeployment(deploymentId: string): Promise<void>;
|
|
66
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { BaseResource, } from "./base.js";
|
|
2
|
+
export class ApiDeployerResource extends BaseResource {
|
|
3
|
+
/** List API Deployer infrastructures. */
|
|
4
|
+
async listInfras() {
|
|
5
|
+
return this.client.get("/public/api/api-deployer/infras");
|
|
6
|
+
}
|
|
7
|
+
/** Create an API Deployer infrastructure. */
|
|
8
|
+
async createInfra(body) {
|
|
9
|
+
return this.client.post("/public/api/api-deployer/infras", body);
|
|
10
|
+
}
|
|
11
|
+
/** Get an API Deployer infrastructure. */
|
|
12
|
+
async getInfra(infraId) {
|
|
13
|
+
return this.client.get(`/public/api/api-deployer/infras/${encodeURIComponent(infraId)}`);
|
|
14
|
+
}
|
|
15
|
+
/** Delete an API Deployer infrastructure. */
|
|
16
|
+
async deleteInfra(infraId) {
|
|
17
|
+
await this.client.del(`/public/api/api-deployer/infras/${encodeURIComponent(infraId)}`);
|
|
18
|
+
}
|
|
19
|
+
/** List API Deployer stages. */
|
|
20
|
+
async listStages() {
|
|
21
|
+
return this.client.get("/public/api/api-deployer/stages");
|
|
22
|
+
}
|
|
23
|
+
/** List published API Deployer services. */
|
|
24
|
+
async listServices() {
|
|
25
|
+
return this.client.get("/public/api/api-deployer/services");
|
|
26
|
+
}
|
|
27
|
+
/** Create a published API Deployer service. */
|
|
28
|
+
async createService(body) {
|
|
29
|
+
return this.client.post("/public/api/api-deployer/services", body);
|
|
30
|
+
}
|
|
31
|
+
/** Get a published API Deployer service. */
|
|
32
|
+
async getService(serviceId) {
|
|
33
|
+
return this.client.get(`/public/api/api-deployer/services/${encodeURIComponent(serviceId)}`);
|
|
34
|
+
}
|
|
35
|
+
/** Delete a published API Deployer service. */
|
|
36
|
+
async deleteService(serviceId) {
|
|
37
|
+
await this.client.del(`/public/api/api-deployer/services/${encodeURIComponent(serviceId)}`);
|
|
38
|
+
}
|
|
39
|
+
/** Publish a service version archive to the API Deployer. */
|
|
40
|
+
async publishServiceVersion(serviceId, filePath) {
|
|
41
|
+
await this.client.upload(`/public/api/api-deployer/services/${encodeURIComponent(serviceId)}/versions`, filePath);
|
|
42
|
+
}
|
|
43
|
+
/** Delete a published service version. */
|
|
44
|
+
async deleteServiceVersion(serviceId, version) {
|
|
45
|
+
await this.client.del(`/public/api/api-deployer/services/${encodeURIComponent(serviceId)}/versions/${encodeURIComponent(version)}`);
|
|
46
|
+
}
|
|
47
|
+
/** List API Deployer deployments. */
|
|
48
|
+
async listDeployments() {
|
|
49
|
+
return this.client.get("/public/api/api-deployer/deployments");
|
|
50
|
+
}
|
|
51
|
+
/** Create an API Deployer deployment. */
|
|
52
|
+
async createDeployment(body) {
|
|
53
|
+
return this.client.post("/public/api/api-deployer/deployments", body);
|
|
54
|
+
}
|
|
55
|
+
/** Get an API Deployer deployment. */
|
|
56
|
+
async getDeployment(deploymentId) {
|
|
57
|
+
return this.client.get(`/public/api/api-deployer/deployments/${encodeURIComponent(deploymentId)}`);
|
|
58
|
+
}
|
|
59
|
+
/** Get an API Deployer deployment's full status. */
|
|
60
|
+
async getDeploymentStatus(deploymentId) {
|
|
61
|
+
return this.client.get(`/public/api/api-deployer/deployments/${encodeURIComponent(deploymentId)}/status`);
|
|
62
|
+
}
|
|
63
|
+
/** Get API Deployer deployment settings. */
|
|
64
|
+
async getDeploymentSettings(deploymentId) {
|
|
65
|
+
return this.client.get(`/public/api/api-deployer/deployments/${encodeURIComponent(deploymentId)}/settings`);
|
|
66
|
+
}
|
|
67
|
+
/** Save API Deployer deployment settings. */
|
|
68
|
+
async saveDeploymentSettings(deploymentId, body) {
|
|
69
|
+
await this.client.putVoid(`/public/api/api-deployer/deployments/${encodeURIComponent(deploymentId)}/settings`, body);
|
|
70
|
+
}
|
|
71
|
+
/** Start an API Deployer deployment update. */
|
|
72
|
+
async startDeploymentUpdate(deploymentId) {
|
|
73
|
+
return this.client.post(`/public/api/api-deployer/deployments/${encodeURIComponent(deploymentId)}/actions/update`, {});
|
|
74
|
+
}
|
|
75
|
+
/** Delete an API Deployer deployment. */
|
|
76
|
+
async deleteDeployment(deploymentId) {
|
|
77
|
+
await this.client.del(`/public/api/api-deployer/deployments/${encodeURIComponent(deploymentId)}`);
|
|
78
|
+
}
|
|
79
|
+
}
|