dataiku-sdk 0.10.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/LICENSE +21 -0
  2. package/dist/packages/types/src/index.d.ts +19 -2
  3. package/dist/packages/types/src/index.js +13 -1
  4. package/dist/src/cli/coerce.d.ts +36 -0
  5. package/dist/src/cli/coerce.js +239 -0
  6. package/dist/src/cli/commands/analysis.d.ts +2 -0
  7. package/dist/src/cli/commands/analysis.js +66 -0
  8. package/dist/src/cli/commands/api-deployer.d.ts +2 -0
  9. package/dist/src/cli/commands/api-deployer.js +170 -0
  10. package/dist/src/cli/commands/api-service.d.ts +2 -0
  11. package/dist/src/cli/commands/api-service.js +121 -0
  12. package/dist/src/cli/commands/app.d.ts +2 -0
  13. package/dist/src/cli/commands/app.js +78 -0
  14. package/dist/src/cli/commands/bundle.d.ts +2 -0
  15. package/dist/src/cli/commands/bundle.js +107 -0
  16. package/dist/src/cli/commands/business-app.d.ts +2 -0
  17. package/dist/src/cli/commands/business-app.js +76 -0
  18. package/dist/src/cli/commands/code-env.d.ts +2 -0
  19. package/dist/src/cli/commands/code-env.js +255 -0
  20. package/dist/src/cli/commands/code.d.ts +2 -0
  21. package/dist/src/cli/commands/code.js +63 -0
  22. package/dist/src/cli/commands/connection.d.ts +2 -0
  23. package/dist/src/cli/commands/connection.js +54 -0
  24. package/dist/src/cli/commands/continuous-activity.d.ts +2 -0
  25. package/dist/src/cli/commands/continuous-activity.js +38 -0
  26. package/dist/src/cli/commands/dashboard.d.ts +2 -0
  27. package/dist/src/cli/commands/dashboard.js +99 -0
  28. package/dist/src/cli/commands/data-quality.d.ts +2 -0
  29. package/dist/src/cli/commands/data-quality.js +235 -0
  30. package/dist/src/cli/commands/dataset.d.ts +2 -0
  31. package/dist/src/cli/commands/dataset.js +288 -0
  32. package/dist/src/cli/commands/discussion.d.ts +2 -0
  33. package/dist/src/cli/commands/discussion.js +47 -0
  34. package/dist/src/cli/commands/doctor.d.ts +2 -0
  35. package/dist/src/cli/commands/doctor.js +9 -0
  36. package/dist/src/cli/commands/flow-zone.d.ts +2 -0
  37. package/dist/src/cli/commands/flow-zone.js +282 -0
  38. package/dist/src/cli/commands/folder.d.ts +2 -0
  39. package/dist/src/cli/commands/folder.js +202 -0
  40. package/dist/src/cli/commands/future.d.ts +2 -0
  41. package/dist/src/cli/commands/future.js +57 -0
  42. package/dist/src/cli/commands/index.d.ts +2 -0
  43. package/dist/src/cli/commands/index.js +78 -0
  44. package/dist/src/cli/commands/insight.d.ts +2 -0
  45. package/dist/src/cli/commands/insight.js +156 -0
  46. package/dist/src/cli/commands/job.d.ts +2 -0
  47. package/dist/src/cli/commands/job.js +406 -0
  48. package/dist/src/cli/commands/meaning.d.ts +2 -0
  49. package/dist/src/cli/commands/meaning.js +115 -0
  50. package/dist/src/cli/commands/metrics.d.ts +2 -0
  51. package/dist/src/cli/commands/metrics.js +39 -0
  52. package/dist/src/cli/commands/ml-task.d.ts +2 -0
  53. package/dist/src/cli/commands/ml-task.js +171 -0
  54. package/dist/src/cli/commands/model-evaluation-store.d.ts +2 -0
  55. package/dist/src/cli/commands/model-evaluation-store.js +83 -0
  56. package/dist/src/cli/commands/notebook.d.ts +2 -0
  57. package/dist/src/cli/commands/notebook.js +242 -0
  58. package/dist/src/cli/commands/project-deployer.d.ts +2 -0
  59. package/dist/src/cli/commands/project-deployer.js +118 -0
  60. package/dist/src/cli/commands/project-library.d.ts +2 -0
  61. package/dist/src/cli/commands/project-library.js +197 -0
  62. package/dist/src/cli/commands/project.d.ts +2 -0
  63. package/dist/src/cli/commands/project.js +133 -0
  64. package/dist/src/cli/commands/recipe.d.ts +2 -0
  65. package/dist/src/cli/commands/recipe.js +659 -0
  66. package/dist/src/cli/commands/saved-model.d.ts +2 -0
  67. package/dist/src/cli/commands/saved-model.js +85 -0
  68. package/dist/src/cli/commands/scenario.d.ts +2 -0
  69. package/dist/src/cli/commands/scenario.js +190 -0
  70. package/dist/src/cli/commands/sql.d.ts +2 -0
  71. package/dist/src/cli/commands/sql.js +109 -0
  72. package/dist/src/cli/commands/statistics.d.ts +2 -0
  73. package/dist/src/cli/commands/statistics.js +165 -0
  74. package/dist/src/cli/commands/streaming-endpoint.d.ts +2 -0
  75. package/dist/src/cli/commands/streaming-endpoint.js +50 -0
  76. package/dist/src/cli/commands/variable.d.ts +2 -0
  77. package/dist/src/cli/commands/variable.js +49 -0
  78. package/dist/src/cli/commands/webapp.d.ts +2 -0
  79. package/dist/src/cli/commands/webapp.js +67 -0
  80. package/dist/src/cli/commands/wiki.d.ts +2 -0
  81. package/dist/src/cli/commands/wiki.js +123 -0
  82. package/dist/src/cli/commands/workspace.d.ts +2 -0
  83. package/dist/src/cli/commands/workspace.js +68 -0
  84. package/dist/src/cli/contract.d.ts +104 -0
  85. package/dist/src/cli/contract.js +2041 -0
  86. package/dist/src/cli/doctor.d.ts +104 -0
  87. package/dist/src/cli/doctor.js +356 -0
  88. package/dist/src/cli/env.d.ts +2 -0
  89. package/dist/src/cli/env.js +37 -0
  90. package/dist/src/cli/flags.d.ts +16 -0
  91. package/dist/src/cli/flags.js +272 -0
  92. package/dist/src/cli/helpers/cleanup.d.ts +3 -0
  93. package/dist/src/cli/helpers/cleanup.js +204 -0
  94. package/dist/src/cli/helpers/dataset.d.ts +2 -0
  95. package/dist/src/cli/helpers/dataset.js +17 -0
  96. package/dist/src/cli/helpers/flow-zone.d.ts +69 -0
  97. package/dist/src/cli/helpers/flow-zone.js +420 -0
  98. package/dist/src/cli/helpers/recipe.d.ts +11 -0
  99. package/dist/src/cli/helpers/recipe.js +83 -0
  100. package/dist/src/cli/output.d.ts +38 -0
  101. package/dist/src/cli/output.js +159 -0
  102. package/dist/src/cli/runtime.d.ts +15 -0
  103. package/dist/src/cli/runtime.js +59 -0
  104. package/dist/src/cli/types.d.ts +25 -0
  105. package/dist/src/cli/types.js +1 -0
  106. package/dist/src/cli/usage.d.ts +16 -0
  107. package/dist/src/cli/usage.js +84 -0
  108. package/dist/src/cli/version.d.ts +14 -0
  109. package/dist/src/cli/version.js +63 -0
  110. package/dist/src/cli.js +671 -8254
  111. package/dist/src/client.d.ts +13 -1
  112. package/dist/src/client.js +34 -13
  113. package/dist/src/errors.d.ts +6 -0
  114. package/dist/src/errors.js +102 -4
  115. package/dist/src/index.d.ts +7 -3
  116. package/dist/src/index.js +6 -2
  117. package/dist/src/resources/analyses.d.ts +34 -0
  118. package/dist/src/resources/analyses.js +31 -0
  119. package/dist/src/resources/api-services.d.ts +2 -0
  120. package/dist/src/resources/api-services.js +10 -0
  121. package/dist/src/resources/applications.d.ts +1 -1
  122. package/dist/src/resources/applications.js +27 -1
  123. package/dist/src/resources/continuous-activities.js +1 -0
  124. package/dist/src/resources/data-quality.js +5 -3
  125. package/dist/src/resources/datasets.d.ts +3 -0
  126. package/dist/src/resources/datasets.js +10 -5
  127. package/dist/src/resources/flow-zones.d.ts +2 -2
  128. package/dist/src/resources/flow-zones.js +4 -1
  129. package/dist/src/resources/meanings.d.ts +2 -0
  130. package/dist/src/resources/meanings.js +4 -0
  131. package/dist/src/resources/ml-tasks.d.ts +91 -0
  132. package/dist/src/resources/ml-tasks.js +130 -0
  133. package/dist/src/resources/model-evaluation-stores.d.ts +41 -0
  134. package/dist/src/resources/model-evaluation-stores.js +36 -0
  135. package/dist/src/resources/notebooks.d.ts +5 -7
  136. package/dist/src/resources/notebooks.js +10 -7
  137. package/dist/src/resources/projects.d.ts +1 -1
  138. package/dist/src/resources/projects.js +2 -2
  139. package/dist/src/resources/recipes.d.ts +3 -3
  140. package/dist/src/resources/recipes.js +198 -38
  141. package/dist/src/resources/saved-models.d.ts +41 -0
  142. package/dist/src/resources/saved-models.js +40 -0
  143. package/dist/src/resources/scenarios.js +67 -26
  144. package/dist/src/resources/statistics.js +9 -0
  145. package/dist/src/schemas.d.ts +2 -2
  146. package/dist/src/schemas.js +1 -1
  147. package/dist/src/skill.js +2 -2
  148. package/dist/src/utils/sanitize.js +2 -1
  149. package/package.json +1 -1
  150. package/packages/types/dist/index.d.ts +19 -2
  151. package/packages/types/dist/index.js +13 -1
@@ -54,8 +54,11 @@ export class FlowZonesResource extends BaseResource {
54
54
  async moveItem(zoneId, item, projectKey) {
55
55
  return this.moveItems(zoneId, [item,], projectKey);
56
56
  }
57
- /** Get the graph for a single flow zone. */
57
+ /** Get the full flow graph, or the graph for a single non-default flow zone. */
58
58
  async graph(zoneId, projectKey) {
59
+ if (zoneId === undefined || zoneId === "default") {
60
+ return this.client.get(`/public/api/projects/${this.enc(projectKey)}/flow/graph/`);
61
+ }
59
62
  return this.client.get(`/public/api/projects/${this.enc(projectKey)}/flow/zones/${encodeURIComponent(zoneId)}/graph`);
60
63
  }
61
64
  }
@@ -37,5 +37,7 @@ export declare class MeaningsResource extends BaseResource {
37
37
  create(id: string, label: string, type: MeaningType, body?: MeaningCreateBody): Promise<string>;
38
38
  /** Replace a user-defined meaning definition. */
39
39
  update(meaningId: string, body: MeaningDefinition): Promise<MeaningDefinition>;
40
+ /** Delete a user-defined meaning definition. */
41
+ delete(meaningId: string): Promise<void>;
40
42
  private meaningPath;
41
43
  }
@@ -27,6 +27,10 @@ export class MeaningsResource extends BaseResource {
27
27
  async update(meaningId, body) {
28
28
  return this.client.put(this.meaningPath(meaningId), body);
29
29
  }
30
+ /** Delete a user-defined meaning definition. */
31
+ async delete(meaningId) {
32
+ await this.client.del(this.meaningPath(meaningId));
33
+ }
30
34
  meaningPath(meaningId) {
31
35
  return `/public/api/meanings/${encodeURIComponent(meaningId)}`;
32
36
  }
@@ -0,0 +1,91 @@
1
+ import { BaseResource } from "./base.js";
2
+ export type MlTaskType = "PREDICTION" | "CLUSTERING";
3
+ export interface MlTaskCreateOptions {
4
+ analysisId: string;
5
+ taskType: MlTaskType;
6
+ targetVariable?: string;
7
+ predictionType?: string;
8
+ backendType?: string;
9
+ guessPolicy?: string;
10
+ projectKey?: string;
11
+ }
12
+ export interface MlTaskCreateResult extends Record<string, unknown> {
13
+ analysisId?: string;
14
+ mlTaskId?: string;
15
+ }
16
+ export interface MlTaskFullModelId extends Record<string, unknown> {
17
+ id?: string;
18
+ fullModelId?: {
19
+ sessionId?: string;
20
+ [key: string]: unknown;
21
+ };
22
+ }
23
+ export interface MlTaskStatus extends Record<string, unknown> {
24
+ guessing?: boolean;
25
+ training?: boolean;
26
+ fullModelIds?: MlTaskFullModelId[];
27
+ }
28
+ export interface MlTaskSettings extends Record<string, unknown> {
29
+ taskType?: MlTaskType;
30
+ predictionType?: string;
31
+ }
32
+ export interface MlTaskActionResult extends Record<string, unknown> {
33
+ message?: string;
34
+ }
35
+ export interface MlTaskTrainOptions {
36
+ analysisId: string;
37
+ mlTaskId: string;
38
+ sessionName?: string;
39
+ sessionDescription?: string;
40
+ runQueue?: boolean;
41
+ wait?: boolean;
42
+ projectKey?: string;
43
+ }
44
+ export interface MlTaskTrainingSession extends Record<string, unknown> {
45
+ sessionId: string;
46
+ }
47
+ export interface MlTaskTrainCompletedResult extends Record<string, unknown> {
48
+ sessionId: string;
49
+ trainedModelIds: string[];
50
+ }
51
+ export type MlTaskTrainResult = MlTaskTrainingSession | MlTaskTrainCompletedResult;
52
+ export interface MlTrainedModelDetails extends Record<string, unknown> {
53
+ id?: string;
54
+ algorithm?: string;
55
+ predictionType?: string;
56
+ }
57
+ export interface MlTaskDeployOptions {
58
+ analysisId: string;
59
+ mlTaskId: string;
60
+ modelId: string;
61
+ trainDatasetRef: string;
62
+ testDatasetRef?: string;
63
+ modelName: string;
64
+ redoOptimization?: boolean;
65
+ projectKey?: string;
66
+ }
67
+ export interface MlTaskDeployResult extends Record<string, unknown> {
68
+ savedModelId?: string;
69
+ trainRecipeName?: string;
70
+ }
71
+ export declare class MlTasksResource extends BaseResource {
72
+ /** Create a prediction or clustering task in an existing visual analysis. */
73
+ create(opts: MlTaskCreateOptions): Promise<MlTaskCreateResult>;
74
+ /** Get the current guessing, training, and trained-model status of a task. */
75
+ status(analysisId: string, mlTaskId: string, projectKey?: string): Promise<MlTaskStatus>;
76
+ /** Get the editable settings of an ML task. */
77
+ getSettings(analysisId: string, mlTaskId: string, projectKey?: string): Promise<MlTaskSettings>;
78
+ /** Save the full settings object of an ML task. */
79
+ saveSettings(analysisId: string, mlTaskId: string, settings: MlTaskSettings, projectKey?: string): Promise<MlTaskActionResult | undefined>;
80
+ /** Start training, optionally waiting for the task to finish. */
81
+ train(opts: MlTaskTrainOptions): Promise<MlTaskTrainResult>;
82
+ /** List identifiers for every trained model currently present on the task. */
83
+ listTrainedModels(analysisId: string, mlTaskId: string, projectKey?: string): Promise<string[]>;
84
+ /** Get full details for a trained model. */
85
+ trainedModelDetails(analysisId: string, mlTaskId: string, modelId: string, projectKey?: string): Promise<MlTrainedModelDetails>;
86
+ /** Deploy a trained model to the Flow as a saved model and training recipe. */
87
+ deployToFlow(opts: MlTaskDeployOptions): Promise<MlTaskDeployResult>;
88
+ /** Delete an ML task and its trained models. */
89
+ delete(analysisId: string, mlTaskId: string, projectKey?: string): Promise<void>;
90
+ private taskPath;
91
+ }
@@ -0,0 +1,130 @@
1
+ import { UsageError, } from "../cli/usage.js";
2
+ import { BaseResource, } from "./base.js";
3
+ const TRAIN_POLL_INTERVAL_MS = 5_000;
4
+ function requireNonEmpty(value, name) {
5
+ if (typeof value !== "string" || value.trim().length === 0) {
6
+ throw new UsageError(`${name} must be a non-empty string.`, "validation_failed");
7
+ }
8
+ return value;
9
+ }
10
+ function delay(ms) {
11
+ const { promise, resolve, } = Promise.withResolvers();
12
+ setTimeout(resolve, ms);
13
+ return promise;
14
+ }
15
+ function modelIdsFromStatus(status) {
16
+ if (!Array.isArray(status.fullModelIds))
17
+ return [];
18
+ const modelIds = [];
19
+ for (const model of status.fullModelIds) {
20
+ if (typeof model?.id === "string" && model.id.length > 0)
21
+ modelIds.push(model.id);
22
+ }
23
+ return modelIds;
24
+ }
25
+ export class MlTasksResource extends BaseResource {
26
+ /** Create a prediction or clustering task in an existing visual analysis. */
27
+ async create(opts) {
28
+ if (opts.taskType !== "PREDICTION" && opts.taskType !== "CLUSTERING") {
29
+ throw new UsageError("taskType must be PREDICTION or CLUSTERING.", "invalid_enum");
30
+ }
31
+ if (opts.taskType === "PREDICTION"
32
+ && (typeof opts.targetVariable !== "string" || opts.targetVariable.trim().length === 0)) {
33
+ throw new UsageError("targetVariable is required for PREDICTION ML tasks.", "missing_required_arg");
34
+ }
35
+ const analysisId = encodeURIComponent(requireNonEmpty(opts.analysisId, "analysisId"));
36
+ const backendType = opts.backendType ?? "PY_MEMORY";
37
+ const guessPolicy = opts.guessPolicy
38
+ ?? (opts.taskType === "CLUSTERING" ? "KMEANS" : "DEFAULT");
39
+ requireNonEmpty(backendType, "backendType");
40
+ requireNonEmpty(guessPolicy, "guessPolicy");
41
+ if (opts.targetVariable !== undefined)
42
+ requireNonEmpty(opts.targetVariable, "targetVariable");
43
+ if (opts.predictionType !== undefined)
44
+ requireNonEmpty(opts.predictionType, "predictionType");
45
+ return this.client.post(`/public/api/projects/${this.enc(opts.projectKey)}/lab/${analysisId}/models/`, {
46
+ taskType: opts.taskType,
47
+ ...(opts.targetVariable !== undefined
48
+ ? { targetVariable: opts.targetVariable, }
49
+ : {}),
50
+ ...(opts.predictionType !== undefined
51
+ ? { predictionType: opts.predictionType, }
52
+ : {}),
53
+ backendType,
54
+ guessPolicy,
55
+ });
56
+ }
57
+ /** Get the current guessing, training, and trained-model status of a task. */
58
+ async status(analysisId, mlTaskId, projectKey) {
59
+ return this.client.get(`${this.taskPath(analysisId, mlTaskId, projectKey)}/status`);
60
+ }
61
+ /** Get the editable settings of an ML task. */
62
+ async getSettings(analysisId, mlTaskId, projectKey) {
63
+ return this.client.get(`${this.taskPath(analysisId, mlTaskId, projectKey)}/settings`);
64
+ }
65
+ /** Save the full settings object of an ML task. */
66
+ async saveSettings(analysisId, mlTaskId, settings, projectKey) {
67
+ if (settings === null || typeof settings !== "object" || Array.isArray(settings)) {
68
+ throw new UsageError("settings must be an object.", "validation_failed");
69
+ }
70
+ return this.client.post(`${this.taskPath(analysisId, mlTaskId, projectKey)}/settings`, settings);
71
+ }
72
+ /** Start training, optionally waiting for the task to finish. */
73
+ async train(opts) {
74
+ if (opts.sessionName !== undefined)
75
+ requireNonEmpty(opts.sessionName, "sessionName");
76
+ if (opts.sessionDescription !== undefined) {
77
+ requireNonEmpty(opts.sessionDescription, "sessionDescription");
78
+ }
79
+ const taskPath = this.taskPath(opts.analysisId, opts.mlTaskId, opts.projectKey);
80
+ const session = await this.client.post(`${taskPath}/train`, {
81
+ sessionName: opts.sessionName,
82
+ sessionDescription: opts.sessionDescription,
83
+ runQueue: opts.runQueue ?? false,
84
+ });
85
+ if (opts.wait !== true)
86
+ return session;
87
+ let status = await this.status(opts.analysisId, opts.mlTaskId, opts.projectKey);
88
+ while (status.training !== false) {
89
+ await delay(TRAIN_POLL_INTERVAL_MS);
90
+ status = await this.status(opts.analysisId, opts.mlTaskId, opts.projectKey);
91
+ }
92
+ return {
93
+ sessionId: session.sessionId,
94
+ trainedModelIds: modelIdsFromStatus(status),
95
+ };
96
+ }
97
+ /** List identifiers for every trained model currently present on the task. */
98
+ async listTrainedModels(analysisId, mlTaskId, projectKey) {
99
+ return modelIdsFromStatus(await this.status(analysisId, mlTaskId, projectKey));
100
+ }
101
+ /** Get full details for a trained model. */
102
+ async trainedModelDetails(analysisId, mlTaskId, modelId, projectKey) {
103
+ const id = encodeURIComponent(requireNonEmpty(modelId, "modelId"));
104
+ return this.client.get(`${this.taskPath(analysisId, mlTaskId, projectKey)}/models/${id}/details`);
105
+ }
106
+ /** Deploy a trained model to the Flow as a saved model and training recipe. */
107
+ async deployToFlow(opts) {
108
+ const modelId = encodeURIComponent(requireNonEmpty(opts.modelId, "modelId"));
109
+ const trainDatasetRef = requireNonEmpty(opts.trainDatasetRef, "trainDatasetRef");
110
+ const modelName = requireNonEmpty(opts.modelName, "modelName");
111
+ if (opts.testDatasetRef !== undefined) {
112
+ requireNonEmpty(opts.testDatasetRef, "testDatasetRef");
113
+ }
114
+ return this.client.post(`${this.taskPath(opts.analysisId, opts.mlTaskId, opts.projectKey)}/models/${modelId}/actions/deployToFlow`, {
115
+ trainDatasetRef,
116
+ testDatasetRef: opts.testDatasetRef,
117
+ modelName,
118
+ redoOptimization: opts.redoOptimization ?? true,
119
+ });
120
+ }
121
+ /** Delete an ML task and its trained models. */
122
+ async delete(analysisId, mlTaskId, projectKey) {
123
+ await this.client.del(`${this.taskPath(analysisId, mlTaskId, projectKey)}/`);
124
+ }
125
+ taskPath(analysisId, mlTaskId, projectKey) {
126
+ const analysis = encodeURIComponent(requireNonEmpty(analysisId, "analysisId"));
127
+ const task = encodeURIComponent(requireNonEmpty(mlTaskId, "mlTaskId"));
128
+ return `/public/api/projects/${this.enc(projectKey)}/models/lab/${analysis}/${task}`;
129
+ }
130
+ }
@@ -0,0 +1,41 @@
1
+ import { BaseResource } from "./base.js";
2
+ export interface ModelEvaluationStoreListItem extends Record<string, unknown> {
3
+ id?: string;
4
+ name?: string;
5
+ projectKey?: string;
6
+ mesFlavor?: string;
7
+ }
8
+ export interface ModelEvaluationStore extends Record<string, unknown> {
9
+ id?: string;
10
+ name?: string;
11
+ projectKey?: string;
12
+ mesFlavor?: string;
13
+ }
14
+ export interface ModelEvaluationStoreCreateOptions {
15
+ name: string;
16
+ projectKey?: string;
17
+ }
18
+ export interface ModelEvaluationStoreCreateResult extends Record<string, unknown> {
19
+ id?: string;
20
+ name?: string;
21
+ projectKey?: string;
22
+ }
23
+ export interface ModelEvaluationListItem extends Record<string, unknown> {
24
+ id?: string;
25
+ evaluationId?: string;
26
+ createdOn?: number;
27
+ label?: string;
28
+ }
29
+ export declare class ModelEvaluationStoresResource extends BaseResource {
30
+ /** List model evaluation stores in a project. */
31
+ list(projectKey?: string): Promise<ModelEvaluationStoreListItem[]>;
32
+ /** Get model evaluation store settings and metadata. */
33
+ get(modelEvaluationStoreId: string, projectKey?: string): Promise<ModelEvaluationStore>;
34
+ /** Create a tabular model evaluation store. */
35
+ create(opts: ModelEvaluationStoreCreateOptions): Promise<ModelEvaluationStoreCreateResult>;
36
+ /** List evaluations in a model evaluation store. */
37
+ listEvaluations(modelEvaluationStoreId: string, projectKey?: string): Promise<ModelEvaluationListItem[]>;
38
+ /** Delete a model evaluation store and its evaluations. */
39
+ delete(modelEvaluationStoreId: string, projectKey?: string): Promise<void>;
40
+ private storePath;
41
+ }
@@ -0,0 +1,36 @@
1
+ import { UsageError, } from "../cli/usage.js";
2
+ import { BaseResource, } from "./base.js";
3
+ function requireNonEmpty(value, name) {
4
+ if (typeof value !== "string" || value.trim().length === 0) {
5
+ throw new UsageError(`${name} must be a non-empty string.`, "validation_failed");
6
+ }
7
+ return value;
8
+ }
9
+ export class ModelEvaluationStoresResource extends BaseResource {
10
+ /** List model evaluation stores in a project. */
11
+ async list(projectKey) {
12
+ return this.client.get(`/public/api/projects/${this.enc(projectKey)}/evaluationstores/`);
13
+ }
14
+ /** Get model evaluation store settings and metadata. */
15
+ async get(modelEvaluationStoreId, projectKey) {
16
+ return this.client.get(this.storePath(modelEvaluationStoreId, projectKey));
17
+ }
18
+ /** Create a tabular model evaluation store. */
19
+ async create(opts) {
20
+ const name = requireNonEmpty(opts.name, "name");
21
+ const projectKey = this.resolveProjectKey(opts.projectKey);
22
+ return this.client.post(`/public/api/projects/${encodeURIComponent(projectKey)}/evaluationstores/?flavor=TABULAR`, { projectKey, name, });
23
+ }
24
+ /** List evaluations in a model evaluation store. */
25
+ async listEvaluations(modelEvaluationStoreId, projectKey) {
26
+ return this.client.get(`${this.storePath(modelEvaluationStoreId, projectKey)}/evaluations/`);
27
+ }
28
+ /** Delete a model evaluation store and its evaluations. */
29
+ async delete(modelEvaluationStoreId, projectKey) {
30
+ await this.client.del(this.storePath(modelEvaluationStoreId, projectKey));
31
+ }
32
+ storePath(modelEvaluationStoreId, projectKey) {
33
+ const id = encodeURIComponent(requireNonEmpty(modelEvaluationStoreId, "modelEvaluationStoreId"));
34
+ return `/public/api/projects/${this.enc(projectKey)}/evaluationstores/${id}`;
35
+ }
36
+ }
@@ -5,15 +5,11 @@ export declare class NotebooksResource extends BaseResource {
5
5
  listJupyter(projectKey?: string): Promise<JupyterNotebookSummary[]>;
6
6
  /** Get the full content of a Jupyter notebook. */
7
7
  getJupyter(name: string, projectKey?: string): Promise<JupyterNotebookContent>;
8
+ /** Create a Jupyter notebook. */
9
+ createJupyter(name: string, content: JupyterNotebookContent, projectKey?: string): Promise<void>;
8
10
  /** Save (overwrite) a Jupyter notebook's content. */
9
11
  saveJupyter(name: string, content: JupyterNotebookContent, projectKey?: string): Promise<void>;
10
- /**
11
- * Delete a Jupyter notebook.
12
- *
13
- * The SDK intentionally does not expose notebook creation as a first-class
14
- * resource method yet; integration tests create disposable notebooks through
15
- * the documented project-level create endpoint.
16
- */
12
+ /** Delete a Jupyter notebook. */
17
13
  deleteJupyter(name: string, projectKey?: string): Promise<void>;
18
14
  /**
19
15
  * Clear all cell outputs from a Jupyter notebook.
@@ -36,6 +32,8 @@ export declare class NotebooksResource extends BaseResource {
36
32
  listSql(projectKey?: string): Promise<SqlNotebookSummary[]>;
37
33
  /** Get the full content of a SQL notebook. */
38
34
  getSql(id: string, projectKey?: string): Promise<SqlNotebookContent>;
35
+ /** Create a SQL notebook. */
36
+ createSql(id: string, content: SqlNotebookContent, projectKey?: string): Promise<void>;
39
37
  /** Save (overwrite) a SQL notebook's content. */
40
38
  saveSql(id: string, content: SqlNotebookContent, projectKey?: string): Promise<void>;
41
39
  /** Delete a SQL notebook. */
@@ -13,18 +13,17 @@ export class NotebooksResource extends BaseResource {
13
13
  const raw = await this.client.get(`/public/api/projects/${this.enc(projectKey)}/jupyter-notebooks/${nameEnc}`);
14
14
  return this.client.safeParse(JupyterNotebookContentSchema, raw, "notebooks.getJupyter");
15
15
  }
16
+ /** Create a Jupyter notebook. */
17
+ async createJupyter(name, content, projectKey) {
18
+ const nameEnc = encodeURIComponent(name);
19
+ await this.client.post(`/public/api/projects/${this.enc(projectKey)}/jupyter-notebooks/${nameEnc}`, content);
20
+ }
16
21
  /** Save (overwrite) a Jupyter notebook's content. */
17
22
  async saveJupyter(name, content, projectKey) {
18
23
  const nameEnc = encodeURIComponent(name);
19
24
  await this.client.putVoid(`/public/api/projects/${this.enc(projectKey)}/jupyter-notebooks/${nameEnc}`, content);
20
25
  }
21
- /**
22
- * Delete a Jupyter notebook.
23
- *
24
- * The SDK intentionally does not expose notebook creation as a first-class
25
- * resource method yet; integration tests create disposable notebooks through
26
- * the documented project-level create endpoint.
27
- */
26
+ /** Delete a Jupyter notebook. */
28
27
  async deleteJupyter(name, projectKey) {
29
28
  const nameEnc = encodeURIComponent(name);
30
29
  await this.client.del(`/public/api/projects/${this.enc(projectKey)}/jupyter-notebooks/${nameEnc}`);
@@ -74,6 +73,10 @@ export class NotebooksResource extends BaseResource {
74
73
  const raw = await this.client.get(`/public/api/projects/${this.enc(projectKey)}/sql-notebooks/${idEnc}`);
75
74
  return this.client.safeParse(SqlNotebookContentSchema, raw, "notebooks.getSql");
76
75
  }
76
+ /** Create a SQL notebook. */
77
+ async createSql(id, content, projectKey) {
78
+ await this.client.post(`/public/api/projects/${this.enc(projectKey)}/sql-notebooks/`, { ...content, id, projectKey: this.resolveProjectKey(projectKey), });
79
+ }
77
80
  /** Save (overwrite) a SQL notebook's content. */
78
81
  async saveSql(id, content, projectKey) {
79
82
  const idEnc = encodeURIComponent(id);
@@ -69,7 +69,7 @@ export declare class ProjectsResource extends BaseResource {
69
69
  private postStream;
70
70
  private uploadJson;
71
71
  /** Create a new project. */
72
- createProject(projectKey: string, name: string, ownerLogin?: string, settings?: ProjectLifecycleSettings | null): Promise<string>;
72
+ createProject(projectKey: string, name: string, ownerLogin: string, settings?: ProjectLifecycleSettings | null): Promise<Record<string, unknown>>;
73
73
  /** Delete a project using the lifecycle endpoint. */
74
74
  deleteProject(projectKey: string, dropData?: boolean): Promise<void>;
75
75
  /** Duplicate a project. */
@@ -130,10 +130,10 @@ export class ProjectsResource extends BaseResource {
130
130
  }
131
131
  /** Create a new project. */
132
132
  async createProject(projectKey, name, ownerLogin, settings) {
133
- return this.client.postText("/public/api/projects/", {
133
+ return this.client.post("/public/api/projects/", {
134
134
  projectKey,
135
135
  name,
136
- owner: ownerLogin ?? null,
136
+ owner: ownerLogin,
137
137
  settings: settings ?? null,
138
138
  description: null,
139
139
  permissions: [],
@@ -103,10 +103,10 @@ export declare class RecipesResource extends BaseResource {
103
103
  /** Clone recipe graph/settings and optionally clone a dataset output. */
104
104
  clone(sourceName: string, opts: RecipeCloneOptions): Promise<RecipeCloneResult>;
105
105
  /**
106
- * Download a recipe code payload to a local file.
106
+ * Download a recipe code payload to a local file.
107
107
 
108
- * Returns the path to the written file.
109
- */
108
+ * Returns the path to the written file.
109
+ */
110
110
  downloadCode(recipeName: string, opts?: {
111
111
  outputPath?: string;
112
112
  projectKey?: string;