dataiku-sdk 4.1.0 → 4.2.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/dist/build-metadata.json +1 -1
- package/dist/packages/types/src/index.d.ts +2 -0
- package/dist/packages/types/src/index.js +2 -0
- package/dist/src/cli/command-syntax.json +2426 -1262
- package/dist/src/cli/commands/future.js +7 -2
- package/dist/src/cli/commands/index.js +4 -0
- package/dist/src/cli/commands/messaging-channel.d.ts +17 -0
- package/dist/src/cli/commands/messaging-channel.js +385 -0
- package/dist/src/cli/commands/project-deployer.js +33 -0
- package/dist/src/cli/commands/project.js +30 -0
- package/dist/src/cli/commands/scenario.d.ts +6 -0
- package/dist/src/cli/commands/scenario.js +423 -13
- package/dist/src/cli/contract.js +17 -2
- package/dist/src/cli/flags.js +34 -0
- package/dist/src/cli/helpers/cleanup.js +11 -0
- package/dist/src/cli/list-shapes.js +5 -0
- package/dist/src/cli/plans.js +94 -2
- package/dist/src/cli/read-shapes.js +2 -1
- package/dist/src/cli/result-shapes.js +1 -0
- package/dist/src/cli/usage.js +7 -0
- package/dist/src/cli/version.d.ts +2 -2
- package/dist/src/cli/version.js +2 -2
- package/dist/src/client.d.ts +11 -0
- package/dist/src/client.js +21 -2
- package/dist/src/generated/action-output-schemas.json +82 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/resources/bundles.d.ts +18 -0
- package/dist/src/resources/bundles.js +26 -0
- package/dist/src/resources/futures.d.ts +3 -0
- package/dist/src/resources/futures.js +5 -1
- package/dist/src/resources/messaging-channels.d.ts +83 -0
- package/dist/src/resources/messaging-channels.js +108 -0
- package/dist/src/resources/projects.d.ts +24 -0
- package/dist/src/resources/projects.js +36 -0
- package/dist/src/resources/scenario-authoring.d.ts +52 -0
- package/dist/src/resources/scenario-authoring.js +216 -0
- package/dist/src/resources/scenarios.d.ts +128 -11
- package/dist/src/resources/scenarios.js +273 -43
- package/dist/src/utils/messaging-channel-secrets.d.ts +17 -0
- package/dist/src/utils/messaging-channel-secrets.js +114 -0
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skills/dataiku-dss/SKILL.md +4 -3
- package/skills/dataiku-dss/references/notifications.md +29 -0
- package/skills/dataiku-dss/references/troubleshooting.md +1 -1
|
@@ -345,6 +345,17 @@ export function cleanupLedgerEntry(resource, action, args, flags, result, projec
|
|
|
345
345
|
cleanup: { argv: ["streaming-endpoint", "delete", id, ...withProject,], },
|
|
346
346
|
};
|
|
347
347
|
}
|
|
348
|
+
case "messaging-channel.create": {
|
|
349
|
+
// DSS echoes the id it allocated; an explicit --id is the fallback.
|
|
350
|
+
const id = stringField(record, ["id",]) ?? flags["id"];
|
|
351
|
+
if (!id)
|
|
352
|
+
return undefined;
|
|
353
|
+
return {
|
|
354
|
+
...base,
|
|
355
|
+
id,
|
|
356
|
+
cleanup: { argv: ["messaging-channel", "delete", id, "--if-exists",], },
|
|
357
|
+
};
|
|
358
|
+
}
|
|
348
359
|
case "meaning.create": {
|
|
349
360
|
const id = args[0];
|
|
350
361
|
return {
|
|
@@ -100,6 +100,11 @@ export const COMPACT_LIST_FIELDS = {
|
|
|
100
100
|
label: field("label", STRING),
|
|
101
101
|
type: field("type", STRING),
|
|
102
102
|
},
|
|
103
|
+
"messaging-channel": {
|
|
104
|
+
id: field("id", STRING),
|
|
105
|
+
type: field("type", STRING),
|
|
106
|
+
family: field("family", STRING),
|
|
107
|
+
},
|
|
103
108
|
};
|
|
104
109
|
/** Discovery output schemas of the compact `RESOURCE.list` defaults. */
|
|
105
110
|
export function compactListOutputSchemas() {
|
package/dist/src/cli/plans.js
CHANGED
|
@@ -10,13 +10,16 @@ import { encodeLibraryPath, PROJECT_LIBRARY_CONCURRENCY_CONTROL, validateLibrary
|
|
|
10
10
|
import { buildRecipeCreateRequest, } from "../resources/recipe-create.js";
|
|
11
11
|
import { modelDiagnosticsBody, } from "../resources/trained-model.js";
|
|
12
12
|
import { encodeGitReferencePath, validateGitReferencePath, } from "../utils/git-reference.js";
|
|
13
|
+
import { sanitizeMessagingChannelSecrets, } from "../utils/messaging-channel-secrets.js";
|
|
13
14
|
import { jobBuildTargetTypeFromFlags, json, jsonInput, num, parseBooleanOption, parseJsonObject, requiredJsonInput, rewritePairsFromFlags, schemaColumnsInput, sha256Hex, stableHash, stringField, textInput, unknownJsonInput, } from "./coerce.js";
|
|
14
15
|
import { parseCodeRunIntegerFlag, resolveCodeInputWithSource, } from "./commands/code.js";
|
|
15
16
|
import { schemaPropagationOptionsFromFlags, } from "./commands/flow.js";
|
|
17
|
+
import { messagingChannelPlanShape, } from "./commands/messaging-channel.js";
|
|
16
18
|
import { mlTaskFieldsFromFlags, mlTaskReguessOptionsFromFlags, } from "./commands/ml-task.js";
|
|
17
19
|
import { deployRunOptionsFromFlags, experimentsDatasetOptionsFromFlags, inferenceInfoFromFlags, } from "./commands/mlflow.js";
|
|
18
20
|
import { projectLibraryPutPayload, } from "./commands/project-library.js";
|
|
19
21
|
import { enqueueRecipeCreateWarnings, recipeCreateOptionsFromFlags, } from "./commands/recipe.js";
|
|
22
|
+
import { scenarioReporterFromFlags, scenarioRunParams, scenarioTriggerFromFlags, } from "./commands/scenario.js";
|
|
20
23
|
import { resolveSqlQueryInvocation, } from "./commands/sql.js";
|
|
21
24
|
import { buildRegistryEntry, splitPackageSpec, } from "./contract.js";
|
|
22
25
|
import { ambientProjectKey, } from "./env.js";
|
|
@@ -1209,7 +1212,7 @@ export function commandPlanShape(resource, action, args, flags, entry, projectKe
|
|
|
1209
1212
|
method: "POST",
|
|
1210
1213
|
endpoint: projectEndpoint(`/scenarios/${encodeURIComponent(id)}/run/`),
|
|
1211
1214
|
identifiers: { id, },
|
|
1212
|
-
payload: {},
|
|
1215
|
+
payload: scenarioRunParams(flags) ?? {},
|
|
1213
1216
|
wait: action === "run-and-wait" || flags["wait"] === true,
|
|
1214
1217
|
};
|
|
1215
1218
|
case "scenario.delete":
|
|
@@ -1230,10 +1233,84 @@ export function commandPlanShape(resource, action, args, flags, entry, projectKe
|
|
|
1230
1233
|
name: args[1],
|
|
1231
1234
|
projectKey,
|
|
1232
1235
|
type,
|
|
1233
|
-
|
|
1236
|
+
...(type === "step_based"
|
|
1237
|
+
? { params: { steps: [], }, triggers: [], reporters: [], }
|
|
1238
|
+
: { params: {}, }),
|
|
1239
|
+
...jsonInput(flags),
|
|
1234
1240
|
},
|
|
1235
1241
|
};
|
|
1236
1242
|
}
|
|
1243
|
+
case "scenario.trigger-add":
|
|
1244
|
+
case "scenario.reporter-add": {
|
|
1245
|
+
const isTrigger = action === "trigger-add";
|
|
1246
|
+
const field = isTrigger ? "triggers" : "reporters";
|
|
1247
|
+
const item = isTrigger
|
|
1248
|
+
? scenarioTriggerFromFlags(flags)
|
|
1249
|
+
: sanitizeMessagingChannelSecrets(scenarioReporterFromFlags(flags));
|
|
1250
|
+
const endpoint = projectEndpoint(`/scenarios/${encodeURIComponent(id)}/`);
|
|
1251
|
+
return {
|
|
1252
|
+
exact: false,
|
|
1253
|
+
reason: `Apply GETs the scenario, appends this element to ${field} (the others are kept), PUTs the full scenario, then GETs it back to verify; the stored element gains DSS-assigned ids.`,
|
|
1254
|
+
method: "PUT",
|
|
1255
|
+
endpoint,
|
|
1256
|
+
identifiers: { id, },
|
|
1257
|
+
payload: item,
|
|
1258
|
+
requests: [
|
|
1259
|
+
{ sequence: 1, method: "GET", endpoint, },
|
|
1260
|
+
{ sequence: 2, method: "PUT", endpoint, payloadEdits: { [field]: { append: item, }, }, },
|
|
1261
|
+
{ sequence: 3, method: "GET", endpoint, },
|
|
1262
|
+
],
|
|
1263
|
+
};
|
|
1264
|
+
}
|
|
1265
|
+
case "scenario.trigger-remove":
|
|
1266
|
+
case "scenario.reporter-remove": {
|
|
1267
|
+
const field = action === "trigger-remove" ? "triggers" : "reporters";
|
|
1268
|
+
const selector = flags["index"] !== undefined
|
|
1269
|
+
? { index: num(flags["index"], "--index"), }
|
|
1270
|
+
: { name: flags["name"], };
|
|
1271
|
+
if ((flags["index"] === undefined) === (flags["name"] === undefined)) {
|
|
1272
|
+
throw new UsageError(`Pass exactly one of --index or --name. Usage: ${entry.usage}`);
|
|
1273
|
+
}
|
|
1274
|
+
const endpoint = projectEndpoint(`/scenarios/${encodeURIComponent(id)}/`);
|
|
1275
|
+
return {
|
|
1276
|
+
exact: false,
|
|
1277
|
+
reason: `Apply GETs the scenario, drops the selected element from ${field} (the others are kept), PUTs the full scenario, then GETs it back to verify.`,
|
|
1278
|
+
method: "PUT",
|
|
1279
|
+
endpoint,
|
|
1280
|
+
identifiers: { id, },
|
|
1281
|
+
payload: selector,
|
|
1282
|
+
requests: [
|
|
1283
|
+
{ sequence: 1, method: "GET", endpoint, },
|
|
1284
|
+
{ sequence: 2, method: "PUT", endpoint, payloadEdits: { [field]: { remove: selector, }, }, },
|
|
1285
|
+
{ sequence: 3, method: "GET", endpoint, },
|
|
1286
|
+
],
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
case "scenario.run-as-set": {
|
|
1290
|
+
const user = flags["user"];
|
|
1291
|
+
if ((typeof user === "string") === (flags["clear"] === true)) {
|
|
1292
|
+
throw new UsageError(`Pass exactly one of --user LOGIN or --clear. Usage: ${entry.usage}`);
|
|
1293
|
+
}
|
|
1294
|
+
const endpoint = projectEndpoint(`/scenarios/${encodeURIComponent(id)}/`);
|
|
1295
|
+
return {
|
|
1296
|
+
exact: false,
|
|
1297
|
+
reason: "Apply GETs the scenario, sets (or, with --clear, removes) runAsUser, PUTs the full scenario, then GETs it back to verify.",
|
|
1298
|
+
method: "PUT",
|
|
1299
|
+
endpoint,
|
|
1300
|
+
identifiers: { id, },
|
|
1301
|
+
payload: { runAsUser: typeof user === "string" ? user : null, },
|
|
1302
|
+
requests: [
|
|
1303
|
+
{ sequence: 1, method: "GET", endpoint, },
|
|
1304
|
+
{
|
|
1305
|
+
sequence: 2,
|
|
1306
|
+
method: "PUT",
|
|
1307
|
+
endpoint,
|
|
1308
|
+
payloadEdits: { runAsUser: typeof user === "string" ? user : "<removed>", },
|
|
1309
|
+
},
|
|
1310
|
+
{ sequence: 3, method: "GET", endpoint, },
|
|
1311
|
+
],
|
|
1312
|
+
};
|
|
1313
|
+
}
|
|
1237
1314
|
case "scenario.update":
|
|
1238
1315
|
return {
|
|
1239
1316
|
method: "PUT",
|
|
@@ -1345,6 +1422,21 @@ export function commandPlanShape(resource, action, args, flags, entry, projectKe
|
|
|
1345
1422
|
endpoint: `/public/api/project-deployer/infras/${encodeURIComponent(id)}`,
|
|
1346
1423
|
identifiers: { infraId: id, },
|
|
1347
1424
|
};
|
|
1425
|
+
case "project-deployer.run-test-scenarios": {
|
|
1426
|
+
const nodeFlag = flags["automation-node-id"];
|
|
1427
|
+
const automationNodeId = typeof nodeFlag === "string" && nodeFlag !== "" ? nodeFlag : undefined;
|
|
1428
|
+
return {
|
|
1429
|
+
method: "POST",
|
|
1430
|
+
endpoint: `/public/api/project-deployer/deployments/${encodeURIComponent(id)}/run-test-scenarios${querySuffix({ automationNodeId, })}`,
|
|
1431
|
+
identifiers: { deploymentId: id, },
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
case "messaging-channel.create":
|
|
1435
|
+
case "messaging-channel.settings-set":
|
|
1436
|
+
case "messaging-channel.permissions-set":
|
|
1437
|
+
case "messaging-channel.delete":
|
|
1438
|
+
case "messaging-channel.send":
|
|
1439
|
+
return messagingChannelPlanShape(action, args, flags, projectKey);
|
|
1348
1440
|
case "project-deployer.delete-project":
|
|
1349
1441
|
return {
|
|
1350
1442
|
method: "DELETE",
|
|
@@ -54,7 +54,7 @@ export function compactReadOutputSchemas() {
|
|
|
54
54
|
description: "Next commands to run, each as an argv array.",
|
|
55
55
|
items: { type: "array", items: STRING, },
|
|
56
56
|
};
|
|
57
|
-
|
|
57
|
+
const schemas = {
|
|
58
58
|
"job.get": {
|
|
59
59
|
type: "object",
|
|
60
60
|
additionalProperties: false,
|
|
@@ -201,4 +201,5 @@ export function compactReadOutputSchemas() {
|
|
|
201
201
|
},
|
|
202
202
|
},
|
|
203
203
|
};
|
|
204
|
+
return { ...schemas, "scenario.runs-by-date": schemas["scenario.last-runs"], };
|
|
204
205
|
}
|
|
@@ -442,6 +442,7 @@ const READ_SHAPERS = {
|
|
|
442
442
|
"project.get": shapeProjectGet,
|
|
443
443
|
"scenario.get-run": shapeScenarioGetRun,
|
|
444
444
|
"scenario.last-runs": shapeScenarioLastRuns,
|
|
445
|
+
"scenario.runs-by-date": shapeScenarioLastRuns,
|
|
445
446
|
};
|
|
446
447
|
/**
|
|
447
448
|
* Compact a command result for agents: `*.list` items (filter, cap, compact
|
package/dist/src/cli/usage.js
CHANGED
|
@@ -10,6 +10,12 @@ function commandSuggestions(resource, action) {
|
|
|
10
10
|
const dot = key.indexOf(".");
|
|
11
11
|
(actionsByResource[key.slice(0, dot)] ??= []).push(key.slice(dot + 1));
|
|
12
12
|
}
|
|
13
|
+
// An unknown resource with no close name gets no suggestions: the same action under
|
|
14
|
+
// arbitrary resources (`pipelines list` -> `app list`) misleads more than it helps.
|
|
15
|
+
if (!Object.hasOwn(actionsByResource, resource)
|
|
16
|
+
&& suggestSelectors(resource, actionsByResource).length === 0) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
13
19
|
return suggestSelectors(action ? `${resource}.${action}` : resource, actionsByResource)
|
|
14
20
|
.map((selector) => `dss ${selector.replace(".", " ")}`);
|
|
15
21
|
}
|
|
@@ -44,6 +50,7 @@ export const RESOURCE_NAMES = [
|
|
|
44
50
|
"statistics",
|
|
45
51
|
"discussion",
|
|
46
52
|
"meaning",
|
|
53
|
+
"messaging-channel",
|
|
47
54
|
"workspace",
|
|
48
55
|
"metrics",
|
|
49
56
|
"doctor",
|
|
@@ -49,7 +49,7 @@ export declare function buildVersionPayload(input: {
|
|
|
49
49
|
export declare const PACKAGE_ROOT: string | undefined;
|
|
50
50
|
export declare const CLI_VERSION: string;
|
|
51
51
|
export declare const CLI_GIT_REVISION: string | undefined;
|
|
52
|
-
export declare const AGENT_CONTRACT_VERSION =
|
|
52
|
+
export declare const AGENT_CONTRACT_VERSION = 7;
|
|
53
53
|
export declare const JSON_SCHEMA_DRAFT = "https://json-schema.org/draft/2020-12/schema";
|
|
54
|
-
export declare const AGENT_CONTRACT_SCHEMA_ID = "https://clssck.github.io/dataiku-sdk/schemas/agent-contract-
|
|
54
|
+
export declare const AGENT_CONTRACT_SCHEMA_ID = "https://clssck.github.io/dataiku-sdk/schemas/agent-contract-v7.json";
|
|
55
55
|
export declare function cliVersionResult(): CliVersionPayload;
|
package/dist/src/cli/version.js
CHANGED
|
@@ -203,9 +203,9 @@ export function buildVersionPayload(input) {
|
|
|
203
203
|
export const PACKAGE_ROOT = findPackageRoot();
|
|
204
204
|
export const CLI_VERSION = packageVersion(PACKAGE_ROOT);
|
|
205
205
|
export const CLI_GIT_REVISION = gitRevision(PACKAGE_ROOT);
|
|
206
|
-
export const AGENT_CONTRACT_VERSION =
|
|
206
|
+
export const AGENT_CONTRACT_VERSION = 7;
|
|
207
207
|
export const JSON_SCHEMA_DRAFT = "https://json-schema.org/draft/2020-12/schema";
|
|
208
|
-
export const AGENT_CONTRACT_SCHEMA_ID = "https://clssck.github.io/dataiku-sdk/schemas/agent-contract-
|
|
208
|
+
export const AGENT_CONTRACT_SCHEMA_ID = "https://clssck.github.io/dataiku-sdk/schemas/agent-contract-v7.json";
|
|
209
209
|
export function cliVersionResult() {
|
|
210
210
|
// Only code actually loaded from dist/ may report dist provenance; an
|
|
211
211
|
// inherited DSS_LOAD_SOURCE on a source run is ignored.
|
package/dist/src/client.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ import type { KnowledgeBanksResource } from "./resources/knowledge-banks.js";
|
|
|
23
23
|
import type { LlmsResource } from "./resources/llms.js";
|
|
24
24
|
import type { MacrosResource } from "./resources/macros.js";
|
|
25
25
|
import type { MeaningsResource } from "./resources/meanings.js";
|
|
26
|
+
import type { MessagingChannelsResource } from "./resources/messaging-channels.js";
|
|
26
27
|
import type { MetricsResource } from "./resources/metrics.js";
|
|
27
28
|
import type { MlTasksResource } from "./resources/ml-tasks.js";
|
|
28
29
|
import type { MlflowExtensionResource } from "./resources/mlflow-extension.js";
|
|
@@ -196,6 +197,7 @@ export declare class DataikuClient {
|
|
|
196
197
|
private workspacesResource?;
|
|
197
198
|
private metricsResource?;
|
|
198
199
|
private meaningsResource?;
|
|
200
|
+
private messagingChannelsResource?;
|
|
199
201
|
private analysesResource?;
|
|
200
202
|
private mlTasksResource?;
|
|
201
203
|
private savedModelsResource?;
|
|
@@ -242,6 +244,7 @@ export declare class DataikuClient {
|
|
|
242
244
|
get workspaces(): WorkspacesResource;
|
|
243
245
|
get metrics(): MetricsResource;
|
|
244
246
|
get meanings(): MeaningsResource;
|
|
247
|
+
get messagingChannels(): MessagingChannelsResource;
|
|
245
248
|
get analyses(): AnalysesResource;
|
|
246
249
|
get mlTasks(): MlTasksResource;
|
|
247
250
|
get savedModels(): SavedModelsResource;
|
|
@@ -346,6 +349,14 @@ export declare class DataikuClient {
|
|
|
346
349
|
* boundary is set correctly.
|
|
347
350
|
*/
|
|
348
351
|
uploadForm<T = unknown>(path: string, parts: UploadFormPart[], query?: URLSearchParams): Promise<T>;
|
|
352
|
+
/**
|
|
353
|
+
* POST a multipart/form-data body like {@link uploadForm} for endpoints whose
|
|
354
|
+
* success carries no JSON the caller needs (e.g. mail sends): the response
|
|
355
|
+
* body is not parsed, so a non-JSON acknowledgement cannot turn an already
|
|
356
|
+
* applied write into a client error.
|
|
357
|
+
*/
|
|
358
|
+
uploadFormVoid(path: string, parts: UploadFormPart[], query?: URLSearchParams): Promise<void>;
|
|
359
|
+
private postFormData;
|
|
349
360
|
private uploadResponse;
|
|
350
361
|
upload(path: string, filePath: string, fileName?: string): Promise<void>;
|
|
351
362
|
uploadJson<T>(path: string, filePath: string, fileName?: string): Promise<T>;
|
package/dist/src/client.js
CHANGED
|
@@ -256,6 +256,7 @@ export class DataikuClient {
|
|
|
256
256
|
workspacesResource;
|
|
257
257
|
metricsResource;
|
|
258
258
|
meaningsResource;
|
|
259
|
+
messagingChannelsResource;
|
|
259
260
|
analysesResource;
|
|
260
261
|
mlTasksResource;
|
|
261
262
|
savedModelsResource;
|
|
@@ -508,6 +509,13 @@ export class DataikuClient {
|
|
|
508
509
|
}
|
|
509
510
|
return this.meaningsResource;
|
|
510
511
|
}
|
|
512
|
+
get messagingChannels() {
|
|
513
|
+
if (!this.messagingChannelsResource) {
|
|
514
|
+
const { MessagingChannelsResource: Resource, } = require("./resources/messaging-channels.js");
|
|
515
|
+
this.messagingChannelsResource = new Resource(this);
|
|
516
|
+
}
|
|
517
|
+
return this.messagingChannelsResource;
|
|
518
|
+
}
|
|
511
519
|
get analyses() {
|
|
512
520
|
if (!this.analysesResource) {
|
|
513
521
|
const { AnalysesResource: Resource, } = require("./resources/analyses.js");
|
|
@@ -820,6 +828,18 @@ export class DataikuClient {
|
|
|
820
828
|
* boundary is set correctly.
|
|
821
829
|
*/
|
|
822
830
|
async uploadForm(path, parts, query) {
|
|
831
|
+
return this.parseJsonResponse(await this.postFormData(path, parts, query));
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* POST a multipart/form-data body like {@link uploadForm} for endpoints whose
|
|
835
|
+
* success carries no JSON the caller needs (e.g. mail sends): the response
|
|
836
|
+
* body is not parsed, so a non-JSON acknowledgement cannot turn an already
|
|
837
|
+
* applied write into a client error.
|
|
838
|
+
*/
|
|
839
|
+
async uploadFormVoid(path, parts, query) {
|
|
840
|
+
await this.postFormData(path, parts, query);
|
|
841
|
+
}
|
|
842
|
+
async postFormData(path, parts, query) {
|
|
823
843
|
const formData = new FormData();
|
|
824
844
|
for (const part of parts) {
|
|
825
845
|
if (part.value !== undefined) {
|
|
@@ -838,12 +858,11 @@ export class DataikuClient {
|
|
|
838
858
|
formData.append(part.name, blob, part.fileName);
|
|
839
859
|
}
|
|
840
860
|
const suffix = query && [...query.keys(),].length > 0 ? `?${query.toString()}` : "";
|
|
841
|
-
|
|
861
|
+
return this.fetchWithRetry(`${this.baseUrl}${path}${suffix}`, {
|
|
842
862
|
method: "POST",
|
|
843
863
|
headers: { Authorization: `Bearer ${this.apiKey}`, },
|
|
844
864
|
body: formData,
|
|
845
865
|
});
|
|
846
|
-
return this.parseJsonResponse(res);
|
|
847
866
|
}
|
|
848
867
|
async uploadResponse(path, filePath, fileName) {
|
|
849
868
|
const fileBlob = Bun.file(filePath);
|
|
@@ -1300,6 +1300,33 @@
|
|
|
1300
1300
|
}
|
|
1301
1301
|
}
|
|
1302
1302
|
},
|
|
1303
|
+
"messaging-channel.list": {
|
|
1304
|
+
"type": "array",
|
|
1305
|
+
"items": {
|
|
1306
|
+
"type": "object",
|
|
1307
|
+
"additionalProperties": false,
|
|
1308
|
+
"properties": {
|
|
1309
|
+
"id": {
|
|
1310
|
+
"type": [
|
|
1311
|
+
"string",
|
|
1312
|
+
"null"
|
|
1313
|
+
]
|
|
1314
|
+
},
|
|
1315
|
+
"type": {
|
|
1316
|
+
"type": [
|
|
1317
|
+
"string",
|
|
1318
|
+
"null"
|
|
1319
|
+
]
|
|
1320
|
+
},
|
|
1321
|
+
"family": {
|
|
1322
|
+
"type": [
|
|
1323
|
+
"string",
|
|
1324
|
+
"null"
|
|
1325
|
+
]
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
},
|
|
1303
1330
|
"notebook.get-jupyter": {
|
|
1304
1331
|
"additionalProperties": true,
|
|
1305
1332
|
"type": "object",
|
|
@@ -2229,6 +2256,61 @@
|
|
|
2229
2256
|
}
|
|
2230
2257
|
}
|
|
2231
2258
|
},
|
|
2259
|
+
"scenario.runs-by-date": {
|
|
2260
|
+
"type": "array",
|
|
2261
|
+
"items": {
|
|
2262
|
+
"type": "object",
|
|
2263
|
+
"additionalProperties": false,
|
|
2264
|
+
"required": [
|
|
2265
|
+
"runId"
|
|
2266
|
+
],
|
|
2267
|
+
"properties": {
|
|
2268
|
+
"runId": {
|
|
2269
|
+
"type": "string"
|
|
2270
|
+
},
|
|
2271
|
+
"outcome": {
|
|
2272
|
+
"type": "string"
|
|
2273
|
+
},
|
|
2274
|
+
"start": {
|
|
2275
|
+
"type": "number"
|
|
2276
|
+
},
|
|
2277
|
+
"end": {
|
|
2278
|
+
"type": "number"
|
|
2279
|
+
},
|
|
2280
|
+
"trigger": {
|
|
2281
|
+
"type": "object",
|
|
2282
|
+
"additionalProperties": false,
|
|
2283
|
+
"properties": {
|
|
2284
|
+
"type": {
|
|
2285
|
+
"type": "string"
|
|
2286
|
+
},
|
|
2287
|
+
"name": {
|
|
2288
|
+
"type": "string"
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
},
|
|
2292
|
+
"failure": {
|
|
2293
|
+
"type": "object",
|
|
2294
|
+
"additionalProperties": false,
|
|
2295
|
+
"properties": {
|
|
2296
|
+
"message": {
|
|
2297
|
+
"type": "string"
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
},
|
|
2301
|
+
"next": {
|
|
2302
|
+
"type": "array",
|
|
2303
|
+
"description": "Next commands to run, each as an argv array.",
|
|
2304
|
+
"items": {
|
|
2305
|
+
"type": "array",
|
|
2306
|
+
"items": {
|
|
2307
|
+
"type": "string"
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
},
|
|
2232
2314
|
"scenario.status": {
|
|
2233
2315
|
"additionalProperties": true,
|
|
2234
2316
|
"type": "object",
|
package/dist/src/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export * from "./resources/knowledge-banks.js";
|
|
|
27
27
|
export * from "./resources/llms.js";
|
|
28
28
|
export { type MacroResultOptions, type MacroRunFailure, type MacroRunHandle, type MacroRunOptions, type MacroRunWaitedResult, MacrosResource, type MacroWaitOptions, } from "./resources/macros.js";
|
|
29
29
|
export { MeaningsResource, } from "./resources/meanings.js";
|
|
30
|
+
export * from "./resources/messaging-channels.js";
|
|
30
31
|
export { MetricsResource, } from "./resources/metrics.js";
|
|
31
32
|
export * from "./resources/ml-tasks.js";
|
|
32
33
|
export { type MlflowDeployRunOptions, type MlflowExperimentsDatasetOptions, MlflowExtensionResource, type MlflowInferenceInfo, type MlflowPredictionType, } from "./resources/mlflow-extension.js";
|
package/dist/src/index.js
CHANGED
|
@@ -30,6 +30,7 @@ export * from "./resources/knowledge-banks.js";
|
|
|
30
30
|
export * from "./resources/llms.js";
|
|
31
31
|
export { MacrosResource, } from "./resources/macros.js";
|
|
32
32
|
export { MeaningsResource, } from "./resources/meanings.js";
|
|
33
|
+
export * from "./resources/messaging-channels.js";
|
|
33
34
|
export { MetricsResource, } from "./resources/metrics.js";
|
|
34
35
|
export * from "./resources/ml-tasks.js";
|
|
35
36
|
export { MlflowExtensionResource, } from "./resources/mlflow-extension.js";
|
|
@@ -126,6 +126,24 @@ export declare class ProjectDeployerResource extends BaseResource {
|
|
|
126
126
|
getDeploymentSettings(deploymentId: string): Promise<Record<string, unknown>>;
|
|
127
127
|
/** Governance status of the deployment's bundle (or `bundleId`'s): messages on whether it may deploy. */
|
|
128
128
|
getGovernanceStatus(deploymentId: string, bundleId?: string): Promise<Record<string, unknown>>;
|
|
129
|
+
/**
|
|
130
|
+
* Combined last-run outcome of the deployment's test scenarios, worst
|
|
131
|
+
* outcome wins. `bundleId` filters the runs to one bundle;
|
|
132
|
+
* `automationNodeId` is required for multi-node deployments only.
|
|
133
|
+
*/
|
|
134
|
+
getTestingStatus(deploymentId: string, options?: {
|
|
135
|
+
bundleId?: string;
|
|
136
|
+
automationNodeId?: string;
|
|
137
|
+
}): Promise<Record<string, unknown>>;
|
|
138
|
+
/**
|
|
139
|
+
* Run every test scenario of the deployment on its Automation node and
|
|
140
|
+
* return the resulting testing status. The request stays open until the
|
|
141
|
+
* scenarios finish. `automationNodeId` is required for multi-node
|
|
142
|
+
* deployments only.
|
|
143
|
+
*/
|
|
144
|
+
runTestScenarios(deploymentId: string, options?: {
|
|
145
|
+
automationNodeId?: string;
|
|
146
|
+
}): Promise<Record<string, unknown>>;
|
|
129
147
|
/** Delete a published project no deployment uses. */
|
|
130
148
|
deleteProject(publishedProjectKey: string): Promise<void>;
|
|
131
149
|
/** Get a published project's settings (permissions, owner). */
|
|
@@ -186,6 +186,32 @@ export class ProjectDeployerResource extends BaseResource {
|
|
|
186
186
|
const query = bundleId ? `?bundleId=${encodeURIComponent(bundleId)}` : "";
|
|
187
187
|
return this.client.get(`/public/api/project-deployer/deployments/${encodeURIComponent(deploymentId)}/governance-status${query}`);
|
|
188
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Combined last-run outcome of the deployment's test scenarios, worst
|
|
191
|
+
* outcome wins. `bundleId` filters the runs to one bundle;
|
|
192
|
+
* `automationNodeId` is required for multi-node deployments only.
|
|
193
|
+
*/
|
|
194
|
+
async getTestingStatus(deploymentId, options = {}) {
|
|
195
|
+
const query = new URLSearchParams();
|
|
196
|
+
if (options.bundleId)
|
|
197
|
+
query.set("bundleId", options.bundleId);
|
|
198
|
+
if (options.automationNodeId)
|
|
199
|
+
query.set("automationNodeId", options.automationNodeId);
|
|
200
|
+
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
201
|
+
return this.client.get(`/public/api/project-deployer/deployments/${encodeURIComponent(deploymentId)}/testing-status${suffix}`);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Run every test scenario of the deployment on its Automation node and
|
|
205
|
+
* return the resulting testing status. The request stays open until the
|
|
206
|
+
* scenarios finish. `automationNodeId` is required for multi-node
|
|
207
|
+
* deployments only.
|
|
208
|
+
*/
|
|
209
|
+
async runTestScenarios(deploymentId, options = {}) {
|
|
210
|
+
const suffix = options.automationNodeId
|
|
211
|
+
? `?automationNodeId=${encodeURIComponent(options.automationNodeId)}`
|
|
212
|
+
: "";
|
|
213
|
+
return this.client.post(`/public/api/project-deployer/deployments/${encodeURIComponent(deploymentId)}/run-test-scenarios${suffix}`);
|
|
214
|
+
}
|
|
189
215
|
/** Delete a published project no deployment uses. */
|
|
190
216
|
async deleteProject(publishedProjectKey) {
|
|
191
217
|
await this.client.del(`/public/api/project-deployer/projects/${encodeURIComponent(publishedProjectKey)}`);
|
|
@@ -21,10 +21,13 @@ export declare class FuturesResource extends BaseResource {
|
|
|
21
21
|
/**
|
|
22
22
|
* Long tasks in progress (GET /futures/): the caller's own by default,
|
|
23
23
|
* every user's with `allUsers`, running scenarios too with `withScenarios`.
|
|
24
|
+
* `scenariosOnly` lists running scenarios and nothing else, like dataikuapi's
|
|
25
|
+
* `list_running_scenarios` (`withScenarios=true&withNotScenarios=false`).
|
|
24
26
|
*/
|
|
25
27
|
list(opts?: {
|
|
26
28
|
allUsers?: boolean;
|
|
27
29
|
withScenarios?: boolean;
|
|
30
|
+
scenariosOnly?: boolean;
|
|
28
31
|
}): Promise<FutureState[]>;
|
|
29
32
|
/** Wait for a started task; a task DSS already finished inline is returned as is. */
|
|
30
33
|
waitTask(task: DssTask, opts?: FutureWaitOptions): Promise<FutureWaitResult | DssTask>;
|
|
@@ -37,12 +37,16 @@ export class FuturesResource extends BaseResource {
|
|
|
37
37
|
/**
|
|
38
38
|
* Long tasks in progress (GET /futures/): the caller's own by default,
|
|
39
39
|
* every user's with `allUsers`, running scenarios too with `withScenarios`.
|
|
40
|
+
* `scenariosOnly` lists running scenarios and nothing else, like dataikuapi's
|
|
41
|
+
* `list_running_scenarios` (`withScenarios=true&withNotScenarios=false`).
|
|
40
42
|
*/
|
|
41
43
|
async list(opts = {}) {
|
|
42
44
|
const query = new URLSearchParams({
|
|
43
45
|
allUsers: String(opts.allUsers === true),
|
|
44
|
-
withScenarios: String(opts.withScenarios === true),
|
|
46
|
+
withScenarios: String(opts.withScenarios === true || opts.scenariosOnly === true),
|
|
45
47
|
});
|
|
48
|
+
if (opts.scenariosOnly === true)
|
|
49
|
+
query.set("withNotScenarios", "false");
|
|
46
50
|
return this.client.get(`/public/api/futures/?${query}`);
|
|
47
51
|
}
|
|
48
52
|
/** Wait for a started task; a task DSS already finished inline is returned as is. */
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { BaseResource } from "./base.js";
|
|
2
|
+
/** One entry of a channel's permission list: a group or a user, and whether it may use the channel. */
|
|
3
|
+
export interface MessagingChannelPermission extends Record<string, unknown> {
|
|
4
|
+
group?: string;
|
|
5
|
+
user?: string;
|
|
6
|
+
canUse?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** A channel as DSS lists or returns it. Configuration fields (credentials included) arrive unredacted. */
|
|
9
|
+
export interface MessagingChannel extends Record<string, unknown> {
|
|
10
|
+
id?: string;
|
|
11
|
+
type?: string;
|
|
12
|
+
family?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface MessagingChannelListOptions {
|
|
15
|
+
/** Channel type to filter by, e.g. `smtp`, `aws-ses-mail`, `slack`. */
|
|
16
|
+
channelType?: string;
|
|
17
|
+
/** Channel family to filter by; `mail` selects every channel that sends email-like messages. */
|
|
18
|
+
channelFamily?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface MessagingChannelCreateRequest {
|
|
21
|
+
type: string;
|
|
22
|
+
/** Channel id; DSS allocates one when omitted. */
|
|
23
|
+
id?: string;
|
|
24
|
+
/** Type-specific configuration (host, sender, webhookUrl, ...). */
|
|
25
|
+
configuration?: Record<string, unknown>;
|
|
26
|
+
/** Usage permissions; `null`/omitted lets DSS grant every user. */
|
|
27
|
+
permissions?: MessagingChannelPermission[] | null;
|
|
28
|
+
}
|
|
29
|
+
export interface MailAttachment {
|
|
30
|
+
/** Local file to attach. */
|
|
31
|
+
path: string;
|
|
32
|
+
/** Name the recipient sees; defaults to the file's base name. */
|
|
33
|
+
fileName?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface MailMessageRequest {
|
|
36
|
+
to: string[];
|
|
37
|
+
subject: string;
|
|
38
|
+
body: string;
|
|
39
|
+
cc?: string[];
|
|
40
|
+
bcc?: string[];
|
|
41
|
+
/** Sender address; defaults to the sender configured on the channel. */
|
|
42
|
+
from?: string;
|
|
43
|
+
/** Send `body` as plain text instead of HTML. */
|
|
44
|
+
plainText?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface MailSendOptions {
|
|
47
|
+
/** Project issuing the email; the caller needs "Write content" on it. Defaults to the client's project. */
|
|
48
|
+
projectKey?: string;
|
|
49
|
+
/** One message to every `to` address (true) or one message per address (false, DSS default). */
|
|
50
|
+
sendAsSingleMessage?: boolean;
|
|
51
|
+
attachments?: MailAttachment[];
|
|
52
|
+
}
|
|
53
|
+
/** The JSON `message` part of the send request, shaped like the official Python client's payload. */
|
|
54
|
+
export declare function mailMessagePayload(message: MailMessageRequest): Record<string, unknown>;
|
|
55
|
+
/** Query string of the send request. */
|
|
56
|
+
export declare function mailSendQuery(projectKey: string, sendAsSingleMessage: boolean | undefined): URLSearchParams;
|
|
57
|
+
/** The POST body of a channel creation, as the official Python client sends it. */
|
|
58
|
+
export declare function messagingChannelCreateBody(request: MessagingChannelCreateRequest): Record<string, unknown>;
|
|
59
|
+
export declare class MessagingChannelsResource extends BaseResource {
|
|
60
|
+
/** List messaging channels visible to the caller, optionally filtered by type or family. */
|
|
61
|
+
list(options?: MessagingChannelListOptions): Promise<MessagingChannel[]>;
|
|
62
|
+
/** Get one channel (type, family, and for mail channels the sender). */
|
|
63
|
+
get(channelId: string): Promise<MessagingChannel>;
|
|
64
|
+
/** Create a channel (admin). DSS returns the created channel. */
|
|
65
|
+
create(request: MessagingChannelCreateRequest): Promise<MessagingChannel>;
|
|
66
|
+
/** Get a channel's settings, i.e. its configuration (admin). */
|
|
67
|
+
getSettings(channelId: string): Promise<Record<string, unknown>>;
|
|
68
|
+
/** Replace a channel's settings (admin); pass the object obtained from {@link getSettings}. */
|
|
69
|
+
saveSettings(channelId: string, settings: Record<string, unknown>): Promise<void>;
|
|
70
|
+
/** Get the users and groups allowed to use a channel. */
|
|
71
|
+
getPermissions(channelId: string): Promise<MessagingChannelPermission[]>;
|
|
72
|
+
/** Replace a channel's permission list. */
|
|
73
|
+
setPermissions(channelId: string, permissions: MessagingChannelPermission[]): Promise<void>;
|
|
74
|
+
/** Delete a channel (admin). */
|
|
75
|
+
delete(channelId: string): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Send an email through a mail-family channel, as a multipart request: a JSON
|
|
78
|
+
* `message` part plus one `attachments` part per file. This sends real mail
|
|
79
|
+
* and is never retried.
|
|
80
|
+
*/
|
|
81
|
+
send(channelId: string, message: MailMessageRequest, options?: MailSendOptions): Promise<void>;
|
|
82
|
+
private channelPath;
|
|
83
|
+
}
|