dataiku-sdk 3.6.1 → 3.8.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 (139) hide show
  1. package/README.md +14 -6
  2. package/bin/bun-version.js +14 -0
  3. package/bin/dss.js +11 -15
  4. package/dist/build-metadata.json +1 -1
  5. package/dist/packages/types/src/index.d.ts +114 -5
  6. package/dist/packages/types/src/index.js +75 -2
  7. package/dist/src/cli/coerce.d.ts +2 -0
  8. package/dist/src/cli/coerce.js +20 -16
  9. package/dist/src/cli/command-syntax.json +3369 -144
  10. package/dist/src/cli/commands/analysis.js +19 -1
  11. package/dist/src/cli/commands/bundle.js +22 -0
  12. package/dist/src/cli/commands/connection.js +26 -2
  13. package/dist/src/cli/commands/data-quality.js +33 -1
  14. package/dist/src/cli/commands/dataset.js +76 -9
  15. package/dist/src/cli/commands/discussion.js +15 -0
  16. package/dist/src/cli/commands/doctor.js +1 -1
  17. package/dist/src/cli/commands/flow-zone.js +241 -46
  18. package/dist/src/cli/commands/flow.d.ts +5 -0
  19. package/dist/src/cli/commands/flow.js +57 -0
  20. package/dist/src/cli/commands/future.js +8 -0
  21. package/dist/src/cli/commands/index.js +6 -0
  22. package/dist/src/cli/commands/job.js +44 -6
  23. package/dist/src/cli/commands/metrics.js +21 -1
  24. package/dist/src/cli/commands/ml-task.d.ts +5 -0
  25. package/dist/src/cli/commands/ml-task.js +86 -16
  26. package/dist/src/cli/commands/mlflow.d.ts +11 -0
  27. package/dist/src/cli/commands/mlflow.js +121 -0
  28. package/dist/src/cli/commands/plugin.js +5 -11
  29. package/dist/src/cli/commands/project-deployer.js +70 -0
  30. package/dist/src/cli/commands/project-library.js +2 -5
  31. package/dist/src/cli/commands/project.js +8 -0
  32. package/dist/src/cli/commands/recipe.d.ts +13 -0
  33. package/dist/src/cli/commands/recipe.js +130 -7
  34. package/dist/src/cli/commands/saved-model.d.ts +1 -1
  35. package/dist/src/cli/commands/saved-model.js +9 -76
  36. package/dist/src/cli/commands/streaming-endpoint.js +30 -1
  37. package/dist/src/cli/commands/webapp.js +8 -0
  38. package/dist/src/cli/commands/wiki.js +78 -0
  39. package/dist/src/cli/commands/workspace.js +8 -0
  40. package/dist/src/cli/contract.d.ts +16 -15
  41. package/dist/src/cli/contract.js +150 -3407
  42. package/dist/src/cli/doctor.d.ts +13 -0
  43. package/dist/src/cli/doctor.js +43 -1
  44. package/dist/src/cli/flags.d.ts +14 -1
  45. package/dist/src/cli/flags.js +106 -8
  46. package/dist/src/cli/helpers/app-successor.js +1 -2
  47. package/dist/src/cli/helpers/dataset.d.ts +12 -0
  48. package/dist/src/cli/helpers/dataset.js +36 -0
  49. package/dist/src/cli/helpers/documentation.d.ts +21 -0
  50. package/dist/src/cli/helpers/documentation.js +53 -0
  51. package/dist/src/cli/helpers/flow-zone.d.ts +21 -0
  52. package/dist/src/cli/helpers/flow-zone.js +144 -4
  53. package/dist/src/cli/helpers/trained-model.d.ts +26 -0
  54. package/dist/src/cli/helpers/trained-model.js +144 -0
  55. package/dist/src/cli/list-output.d.ts +7 -0
  56. package/dist/src/cli/list-output.js +77 -0
  57. package/dist/src/cli/list-shapes.d.ts +21 -0
  58. package/dist/src/cli/list-shapes.js +111 -0
  59. package/dist/src/cli/output-schemas.d.ts +0 -14
  60. package/dist/src/cli/output-schemas.js +4 -7
  61. package/dist/src/cli/output.d.ts +0 -1
  62. package/dist/src/cli/output.js +33 -19
  63. package/dist/src/cli/plans.d.ts +14 -0
  64. package/dist/src/cli/plans.js +3740 -0
  65. package/dist/src/cli/types.d.ts +2 -0
  66. package/dist/src/cli/usage.d.ts +7 -0
  67. package/dist/src/cli/usage.js +20 -1
  68. package/dist/src/cli/version.d.ts +2 -2
  69. package/dist/src/cli/version.js +2 -2
  70. package/dist/src/cli.js +137 -115
  71. package/dist/src/client.d.ts +52 -43
  72. package/dist/src/client.js +267 -96
  73. package/dist/src/errors.d.ts +22 -2
  74. package/dist/src/errors.js +49 -50
  75. package/dist/src/generated/action-output-schemas.json +345 -89
  76. package/dist/src/index.d.ts +5 -1
  77. package/dist/src/index.js +3 -0
  78. package/dist/src/resources/analyses.d.ts +8 -0
  79. package/dist/src/resources/analyses.js +13 -1
  80. package/dist/src/resources/bundles.d.ts +34 -0
  81. package/dist/src/resources/bundles.js +67 -0
  82. package/dist/src/resources/connections.d.ts +9 -0
  83. package/dist/src/resources/connections.js +15 -0
  84. package/dist/src/resources/data-quality.d.ts +20 -0
  85. package/dist/src/resources/data-quality.js +30 -0
  86. package/dist/src/resources/dataset-create.d.ts +38 -0
  87. package/dist/src/resources/dataset-create.js +135 -0
  88. package/dist/src/resources/datasets.d.ts +46 -15
  89. package/dist/src/resources/datasets.js +120 -112
  90. package/dist/src/resources/discussions.d.ts +5 -0
  91. package/dist/src/resources/discussions.js +7 -0
  92. package/dist/src/resources/documentation.d.ts +25 -0
  93. package/dist/src/resources/documentation.js +16 -0
  94. package/dist/src/resources/flow-zones.d.ts +29 -3
  95. package/dist/src/resources/flow-zones.js +53 -3
  96. package/dist/src/resources/flow.d.ts +48 -0
  97. package/dist/src/resources/flow.js +65 -0
  98. package/dist/src/resources/futures.d.ts +23 -0
  99. package/dist/src/resources/futures.js +32 -0
  100. package/dist/src/resources/jobs.d.ts +34 -0
  101. package/dist/src/resources/jobs.js +170 -3
  102. package/dist/src/resources/metrics.d.ts +10 -0
  103. package/dist/src/resources/metrics.js +10 -0
  104. package/dist/src/resources/ml-tasks.d.ts +65 -2
  105. package/dist/src/resources/ml-tasks.js +102 -28
  106. package/dist/src/resources/mlflow-extension.d.ts +73 -0
  107. package/dist/src/resources/mlflow-extension.js +105 -0
  108. package/dist/src/resources/projects.d.ts +15 -0
  109. package/dist/src/resources/projects.js +18 -3
  110. package/dist/src/resources/recipe-create.d.ts +79 -0
  111. package/dist/src/resources/recipe-create.js +454 -0
  112. package/dist/src/resources/recipes.d.ts +28 -29
  113. package/dist/src/resources/recipes.js +201 -267
  114. package/dist/src/resources/saved-models.d.ts +10 -6
  115. package/dist/src/resources/saved-models.js +16 -14
  116. package/dist/src/resources/scenarios.js +8 -14
  117. package/dist/src/resources/sql.js +52 -13
  118. package/dist/src/resources/streaming-endpoints.d.ts +12 -0
  119. package/dist/src/resources/streaming-endpoints.js +15 -0
  120. package/dist/src/resources/trained-model.d.ts +60 -0
  121. package/dist/src/resources/trained-model.js +98 -0
  122. package/dist/src/resources/webapps.d.ts +8 -0
  123. package/dist/src/resources/webapps.js +10 -0
  124. package/dist/src/resources/wiki.d.ts +52 -1
  125. package/dist/src/resources/wiki.js +96 -0
  126. package/dist/src/resources/workspaces.d.ts +2 -0
  127. package/dist/src/resources/workspaces.js +4 -0
  128. package/dist/src/utils/flow-analysis.js +4 -0
  129. package/dist/src/utils/response-file.js +20 -9
  130. package/dist/src/utils/secret-sanitize.d.ts +7 -0
  131. package/dist/src/utils/secret-sanitize.js +46 -0
  132. package/package.json +25 -26
  133. package/plugin.json +1 -1
  134. package/skills/dataiku-dss/SKILL.md +1 -1
  135. package/skills/dataiku-dss/references/authentication.md +3 -1
  136. package/skills/dataiku-dss/references/coding.md +1 -0
  137. package/skills/dataiku-dss/references/discovery.md +4 -6
  138. package/skills/dataiku-dss/references/flow-maps.md +2 -2
  139. package/skills/dataiku-dss/references/troubleshooting.md +3 -2
@@ -1,5 +1,6 @@
1
- import { num, requiredJsonInput, requiredStringFlag, } from "../coerce.js";
1
+ import { num, parseBooleanOption, requiredJsonInput, requiredStringFlag, splitCsvFlag, } from "../coerce.js";
2
2
  import { executionMode, } from "../flags.js";
3
+ import { trainedModelCommands, } from "../helpers/trained-model.js";
3
4
  import { commandUsage, withUsage, } from "../syntax.js";
4
5
  import { requireArgs, UsageError, } from "../usage.js";
5
6
  function optionalStringFlag(flags, name) {
@@ -17,27 +18,47 @@ function taskType(flags, usage) {
17
18
  return normalized;
18
19
  throw new UsageError("--task-type must be PREDICTION or CLUSTERING.", "invalid_enum");
19
20
  }
21
+ /** Task definition flags shared by `create`, `create-for-dataset`, and their --plan. */
22
+ export function mlTaskFieldsFromFlags(flags, usage) {
23
+ const normalizedTaskType = taskType(flags, usage);
24
+ const targetVariable = optionalStringFlag(flags, "target");
25
+ if (normalizedTaskType === "PREDICTION" && targetVariable === undefined) {
26
+ throw new UsageError("--target is required for PREDICTION ML tasks.", "missing_required_flag");
27
+ }
28
+ const timeseriesIdentifiers = splitCsvFlag(flags["timeseries-ids"]);
29
+ return {
30
+ taskType: normalizedTaskType,
31
+ targetVariable,
32
+ predictionType: optionalStringFlag(flags, "prediction-type"),
33
+ timeVariable: optionalStringFlag(flags, "time-variable"),
34
+ ...(timeseriesIdentifiers.length > 0 ? { timeseriesIdentifiers, } : {}),
35
+ backendType: optionalStringFlag(flags, "backend-type"),
36
+ guessPolicy: optionalStringFlag(flags, "guess-policy"),
37
+ };
38
+ }
39
+ /** `reguess` flags → SDK options (shared with --plan). */
40
+ export function mlTaskReguessOptionsFromFlags(flags) {
41
+ const timeseriesIdentifiers = splitCsvFlag(flags["timeseries-ids"]);
42
+ return {
43
+ predictionType: optionalStringFlag(flags, "prediction-type"),
44
+ targetVariable: optionalStringFlag(flags, "target"),
45
+ timeVariable: optionalStringFlag(flags, "time-variable"),
46
+ ...(timeseriesIdentifiers.length > 0 ? { timeseriesIdentifiers, } : {}),
47
+ ...(flags["full-reguess"] !== undefined
48
+ ? { fullReguess: parseBooleanOption(flags["full-reguess"], "--full-reguess"), }
49
+ : {}),
50
+ };
51
+ }
20
52
  export const mlTaskCommands = withUsage("ml-task", {
21
53
  create: {
22
54
  handler: async (c, a, f) => {
23
55
  const usage = commandUsage("ml-task", "create");
24
56
  requireArgs(a, 1, usage);
25
- const projectKey = f["project-key"];
26
- const normalizedTaskType = taskType(f, usage);
27
- const targetVariable = optionalStringFlag(f, "target");
28
- if (normalizedTaskType === "PREDICTION" && targetVariable === undefined) {
29
- throw new UsageError("--target is required for PREDICTION ML tasks.", "missing_required_flag");
30
- }
31
- const options = {
57
+ const created = await c.mlTasks.create({
32
58
  analysisId: a[0],
33
- taskType: normalizedTaskType,
34
- targetVariable,
35
- predictionType: optionalStringFlag(f, "prediction-type"),
36
- backendType: optionalStringFlag(f, "backend-type"),
37
- guessPolicy: optionalStringFlag(f, "guess-policy"),
38
- projectKey,
39
- };
40
- const created = await c.mlTasks.create(options);
59
+ ...mlTaskFieldsFromFlags(f, usage),
60
+ projectKey: f["project-key"],
61
+ });
41
62
  return { created: created.mlTaskId, resource: "ml-task", analysisId: a[0], ...created, };
42
63
  },
43
64
  description: "Create a prediction or clustering task in an analysis.",
@@ -173,4 +194,53 @@ export const mlTaskCommands = withUsage("ml-task", {
173
194
  "dss ml-task delete ANALYSIS_ID TASK_ID --dry-run --project-key PROJECT",
174
195
  ],
175
196
  },
197
+ list: {
198
+ handler: (c, _a, f) => c.mlTasks.list(f["project-key"]),
199
+ description: "List every ML task of the project with its visual analysis (one analysis: dss analysis list-ml-tasks).",
200
+ examples: ["dss ml-task list",],
201
+ },
202
+ "create-for-dataset": {
203
+ handler: async (c, a, f) => {
204
+ const usage = commandUsage("ml-task", "create-for-dataset");
205
+ requireArgs(a, 1, usage);
206
+ const created = await c.mlTasks.createForDataset({
207
+ inputDataset: a[0],
208
+ ...mlTaskFieldsFromFlags(f, usage),
209
+ projectKey: f["project-key"],
210
+ });
211
+ return { created: created.mlTaskId, resource: "ml-task", ...created, };
212
+ },
213
+ description: "Create a new visual analysis on a dataset with one prediction, clustering, or forecasting task (--prediction-type TIMESERIES_FORECAST --time-variable COL [--timeseries-ids COLS]). DSS guesses settings asynchronously: poll status until guessing is false.",
214
+ examples: [
215
+ "dss ml-task create-for-dataset customers --task-type prediction --target churn",
216
+ "dss ml-task create-for-dataset sales --task-type prediction --target amount --prediction-type TIMESERIES_FORECAST --time-variable day",
217
+ ],
218
+ },
219
+ reguess: {
220
+ handler: async (c, a, f) => {
221
+ requireArgs(a, 2, commandUsage("ml-task", "reguess"));
222
+ await c.mlTasks.reguess(a[0], a[1], mlTaskReguessOptionsFromFlags(f), f["project-key"]);
223
+ return { reguessed: a[1], resource: "ml-task", analysisId: a[0], };
224
+ },
225
+ description: "Re-guess an ML task's settings: all of them, or after changing one core parameter (--prediction-type, --target, --time-variable, --timeseries-ids), only the impacted ones unless --full-reguess true.",
226
+ examples: ["dss ml-task reguess ANALYSIS_ID TASK_ID --target churn_flag",],
227
+ },
228
+ "reguess-forecasting": {
229
+ handler: async (c, a, f) => {
230
+ requireArgs(a, 2, commandUsage("ml-task", "reguess-forecasting"));
231
+ await c.mlTasks.reguessForecasting(a[0], a[1], requiredJsonInput(f, "Forecasting parameters are required via --data, --data-file, or --stdin (forecastHorizon, validationHorizons, timestepParams, updateAlgorithmSettings)."), f["project-key"]);
232
+ return { reguessed: a[1], resource: "ml-task", analysisId: a[0], };
233
+ },
234
+ description: "Time series forecasting tasks: change forecasting parameters (forecastHorizon, validationHorizons, timestepParams {timeunit, numberOfTimeunits, ...}, updateAlgorithmSettings) and re-guess impacted algorithm settings.",
235
+ examples: [
236
+ 'dss ml-task reguess-forecasting ANALYSIS_ID TASK_ID --data \'{"forecastHorizon":7,"updateAlgorithmSettings":true}\'',
237
+ ],
238
+ },
239
+ ...trainedModelCommands({
240
+ resource: "ml-task",
241
+ ids: "ANALYSIS_ID TASK_ID MODEL_ID",
242
+ noun: "lab model",
243
+ model: (c, a, pk) => c.mlTasks.model(a[0], a[1], a[2], pk),
244
+ downloadDocumentation: (c, exportId, pk) => c.mlTasks.downloadModelDocumentation(exportId, pk),
245
+ }),
176
246
  });
@@ -0,0 +1,11 @@
1
+ import type { MlflowDeployRunOptions, MlflowExperimentsDatasetOptions, MlflowInferenceInfo } from "../../resources/mlflow-extension.js";
2
+ import type { CommandMeta } from "../types.js";
3
+ type Flags = Record<string, string | boolean>;
4
+ /** `dss mlflow set-inference-info` flags → SDK inference info (shared with --plan). */
5
+ export declare function inferenceInfoFromFlags(runId: string, f: Flags): MlflowInferenceInfo;
6
+ /** `dss mlflow deploy-run` flags → SDK deploy options (shared with --plan). */
7
+ export declare function deployRunOptionsFromFlags(runId: string, savedModelId: string, f: Flags): MlflowDeployRunOptions;
8
+ /** `dss mlflow create-experiments-dataset` flags → SDK options (shared with --plan). */
9
+ export declare function experimentsDatasetOptionsFromFlags(datasetName: string, f: Flags): MlflowExperimentsDatasetOptions;
10
+ export declare const mlflowCommands: Record<string, CommandMeta>;
11
+ export {};
@@ -0,0 +1,121 @@
1
+ import { num, parseBooleanOption, splitCsvFlag, } from "../coerce.js";
2
+ import { executionMode, } from "../flags.js";
3
+ import { withUsage, } from "../syntax.js";
4
+ import { UsageError, } from "../usage.js";
5
+ /** `dss mlflow set-inference-info` flags → SDK inference info (shared with --plan). */
6
+ export function inferenceInfoFromFlags(runId, f) {
7
+ const predictionType = f["prediction-type"];
8
+ if (typeof predictionType !== "string") {
9
+ throw new UsageError("--prediction-type is required.", "missing_required_flag");
10
+ }
11
+ const classes = splitCsvFlag(f["classes"]);
12
+ return {
13
+ runId,
14
+ predictionType: predictionType.toUpperCase(),
15
+ ...(classes.length > 0 ? { classes, } : {}),
16
+ ...(typeof f["code-env"] === "string" ? { codeEnvName: f["code-env"], } : {}),
17
+ ...(typeof f["target"] === "string" ? { target: f["target"], } : {}),
18
+ };
19
+ }
20
+ /** `dss mlflow deploy-run` flags → SDK deploy options (shared with --plan). */
21
+ export function deployRunOptionsFromFlags(runId, savedModelId, f) {
22
+ const classLabels = splitCsvFlag(f["classes"]);
23
+ const setActive = f["set-active"];
24
+ const threshold = f["binary-classification-threshold"];
25
+ const optimal = f["use-optimal-threshold"];
26
+ const skipReports = f["skip-expensive-reports"];
27
+ return {
28
+ runId,
29
+ savedModelId,
30
+ ...(typeof f["version-id"] === "string" ? { versionId: f["version-id"], } : {}),
31
+ ...(typeof f["model-name"] === "string" ? { modelName: f["model-name"], } : {}),
32
+ ...(typeof f["evaluation-dataset"] === "string"
33
+ ? { evaluationDataset: f["evaluation-dataset"], }
34
+ : {}),
35
+ ...(typeof f["target"] === "string" ? { targetColumnName: f["target"], } : {}),
36
+ ...(classLabels.length > 0 ? { classLabels, } : {}),
37
+ ...(typeof f["code-env"] === "string" ? { codeEnvName: f["code-env"], } : {}),
38
+ ...(setActive !== undefined ? { activate: parseBooleanOption(setActive, "--set-active"), } : {}),
39
+ ...(threshold !== undefined
40
+ ? { binaryClassificationThreshold: num(threshold, "--binary-classification-threshold"), }
41
+ : {}),
42
+ ...(optimal !== undefined
43
+ ? { useOptimalThreshold: parseBooleanOption(optimal, "--use-optimal-threshold"), }
44
+ : {}),
45
+ ...(skipReports !== undefined
46
+ ? { skipExpensiveReports: parseBooleanOption(skipReports, "--skip-expensive-reports"), }
47
+ : {}),
48
+ };
49
+ }
50
+ /** `dss mlflow create-experiments-dataset` flags → SDK options (shared with --plan). */
51
+ export function experimentsDatasetOptionsFromFlags(datasetName, f) {
52
+ const experimentIds = splitCsvFlag(f["experiments"]);
53
+ const viewType = f["view-type"];
54
+ const format = f["format"];
55
+ return {
56
+ datasetName,
57
+ ...(experimentIds.length > 0 ? { experimentIds, } : {}),
58
+ ...(typeof viewType === "string"
59
+ ? {
60
+ viewType: viewType.toUpperCase(),
61
+ }
62
+ : {}),
63
+ ...(typeof f["filter"] === "string" ? { filter: f["filter"], } : {}),
64
+ ...(typeof format === "string"
65
+ ? { format: format.toUpperCase(), }
66
+ : {}),
67
+ };
68
+ }
69
+ export const mlflowCommands = withUsage("mlflow", {
70
+ "list-models": {
71
+ handler: (c, a, f) => c.mlflowExtension.listModels(a[0], f["project-key"]),
72
+ description: "List the models an MLflow experiment-tracking run logged ({runId, artifactPath}).",
73
+ examples: ["dss mlflow list-models RUN_ID",],
74
+ },
75
+ "set-inference-info": {
76
+ handler: async (c, a, f) => {
77
+ await c.mlflowExtension.setRunInferenceInfo(inferenceInfoFromFlags(a[0], f), f["project-key"]);
78
+ return { updated: a[0], resource: "mlflow", };
79
+ },
80
+ description: "Record an MLflow run's prediction type, classes, code env, and target so deploy-run can use them.",
81
+ examples: [
82
+ "dss mlflow set-inference-info RUN_ID --prediction-type MULTICLASS --classes a,b,c --target species",
83
+ ],
84
+ },
85
+ "deploy-run": {
86
+ handler: (c, a, f) => c.mlflowExtension.deployRun(deployRunOptionsFromFlags(a[0], a[1], f), f["project-key"]),
87
+ description: "Deploy an MLflow run's model as a version of an existing saved model (default version id: timestamp); --evaluation-dataset evaluates it. Synchronous: DSS loads the model in its code env, often past 30 s, so raise --request-timeout.",
88
+ examples: [
89
+ "dss mlflow deploy-run RUN_ID SAVED_MODEL_ID --version-id v2 --code-env py311_mlflow --request-timeout 300000",
90
+ ],
91
+ },
92
+ "create-experiments-dataset": {
93
+ handler: async (c, a, f) => {
94
+ await c.mlflowExtension.createExperimentsDataset(experimentsDatasetOptionsFromFlags(a[0], f), f["project-key"]);
95
+ return { created: a[0], resource: "mlflow", };
96
+ },
97
+ description: "Create a virtual dataset exposing the project's MLflow experiment-tracking runs.",
98
+ examples: ["dss mlflow create-experiments-dataset mlflow_runs --experiments FGXlefMU",],
99
+ },
100
+ "garbage-collect": {
101
+ handler: async (c, _a, f) => {
102
+ if (executionMode(f).dryRun) {
103
+ return { dryRun: true, action: "garbage-collect", resource: "mlflow", };
104
+ }
105
+ await c.mlflowExtension.garbageCollect(f["project-key"]);
106
+ return { garbageCollected: true, resource: "mlflow", };
107
+ },
108
+ description: "Permanently delete the project's MLflow experiments and runs marked as deleted.",
109
+ examples: ["dss mlflow garbage-collect --dry-run",],
110
+ },
111
+ "clean-db": {
112
+ handler: async (c, _a, f) => {
113
+ if (executionMode(f).dryRun)
114
+ return { dryRun: true, action: "clean-db", resource: "mlflow", };
115
+ await c.mlflowExtension.cleanDb(f["project-key"]);
116
+ return { cleaned: true, resource: "mlflow", };
117
+ },
118
+ description: "Admin: delete ALL MLflow experiment-tracking data of the project (experiments, runs, params, metrics, tags). Irreversible.",
119
+ examples: ["dss mlflow clean-db --plan",],
120
+ },
121
+ });
@@ -1,6 +1,7 @@
1
1
  import * as fs from "node:fs";
2
2
  import { validatedPluginGitUrl, validatePluginDestinationPath, validatePluginId, validatePluginName, validatePluginPath, } from "../../resources/plugins.js";
3
- import { num, readStdinText, } from "../coerce.js";
3
+ import { writeResponseToFile, } from "../../utils/response-file.js";
4
+ import { num, readStdinText, sha256Hex, } from "../coerce.js";
4
5
  import { executionMode, } from "../flags.js";
5
6
  import { planResult, } from "../output.js";
6
7
  import { commandUsage, withUsage, } from "../syntax.js";
@@ -188,7 +189,7 @@ export const pluginCommands = withUsage("plugin", {
188
189
  }
189
190
  const pluginId = validatePluginId(a[0]);
190
191
  const res = await c.plugins.download(pluginId);
191
- const bytes = await writeResponseToFileForPlugin(out, res);
192
+ const bytes = await writeResponseToFile(out, res);
192
193
  return { path: out, bytes, };
193
194
  },
194
195
  description: "Download a development plugin as a zip archive to a local file.",
@@ -598,7 +599,7 @@ export const pluginCommands = withUsage("plugin", {
598
599
  const out = f["output"];
599
600
  if (typeof out === "string" && out.trim() !== "") {
600
601
  const res = await c.plugins.downloadFile(pluginId, path);
601
- const bytes = await writeResponseToFileForPlugin(out, res);
602
+ const bytes = await writeResponseToFile(out, res);
602
603
  return { path: out, bytes, };
603
604
  }
604
605
  return { data: await c.plugins.getFile(pluginId, path), };
@@ -634,10 +635,7 @@ export const pluginCommands = withUsage("plugin", {
634
635
  : await readStdinText();
635
636
  await c.plugins.putFile(pluginId, path, content);
636
637
  const bytes = typeof content === "string" ? Buffer.byteLength(content, "utf8") : content.length;
637
- const hasher = new Bun.CryptoHasher("sha256");
638
- hasher.update(typeof content === "string" ? content : new Uint8Array(content));
639
- const sha256 = hasher.digest("hex");
640
- return { written: path, pluginId, bytes, sha256, };
638
+ return { written: path, pluginId, bytes, sha256: sha256Hex(content), };
641
639
  },
642
640
  description: "Create or replace a development plugin file with text or binary content; reports the written byte count and sha256.",
643
641
  examples: [
@@ -760,7 +758,3 @@ function readSettingsInput(flags) {
760
758
  }
761
759
  return parsed;
762
760
  }
763
- async function writeResponseToFileForPlugin(path, res) {
764
- const { writeResponseToFile, } = await import("../../utils/response-file.js");
765
- return writeResponseToFile(path, res);
766
- }
@@ -103,4 +103,74 @@ export const projectDeployerCommands = withUsage("project-deployer", {
103
103
  description: "Create a Project Deployer infrastructure.",
104
104
  examples: ["dss project-deployer create-infra --data-file infra.json",],
105
105
  },
106
+ "list-stages": {
107
+ handler: (c) => c.projectDeployer.listStages(),
108
+ description: "List the Project Deployer stages (e.g. Development, Test, Production).",
109
+ examples: ["dss project-deployer list-stages",],
110
+ },
111
+ "get-infra": {
112
+ handler: (c, a) => c.projectDeployer.getInfra(a[0]),
113
+ description: "Get a Project Deployer infrastructure (stage, automation node, deployments).",
114
+ examples: ["dss project-deployer get-infra prod-infra",],
115
+ },
116
+ "infra-settings": {
117
+ handler: (c, a) => c.projectDeployer.getInfraSettings(a[0]),
118
+ description: "Get an infrastructure's settings (permissions, automation node URL, connection remappings).",
119
+ examples: ["dss project-deployer infra-settings prod-infra",],
120
+ },
121
+ "save-infra-settings": {
122
+ handler: async (c, a, f) => {
123
+ await c.projectDeployer.saveInfraSettings(a[0], requiredJsonInput(f, "--data, --data-file, or --stdin is required (settings from infra-settings)."));
124
+ return { updated: a[0], resource: "project-deployer", };
125
+ },
126
+ description: "Save infrastructure settings obtained from infra-settings, edited.",
127
+ examples: ["dss project-deployer save-infra-settings prod-infra --data-file infra.json",],
128
+ },
129
+ "delete-infra": {
130
+ handler: async (c, a) => {
131
+ await c.projectDeployer.deleteInfra(a[0]);
132
+ return { deleted: a[0], resource: "project-deployer", };
133
+ },
134
+ description: "Delete an infrastructure that no deployment uses.",
135
+ examples: ["dss project-deployer delete-infra old-infra --plan",],
136
+ },
137
+ "deployment-settings": {
138
+ handler: (c, a) => c.projectDeployer.getDeploymentSettings(a[0]),
139
+ description: "Get a deployment's settings (infra, bundle, remappings); edit and send to save-deployment-settings.",
140
+ examples: ["dss project-deployer deployment-settings v1-on-prod",],
141
+ },
142
+ "governance-status": {
143
+ handler: (c, a, f) => c.projectDeployer.getGovernanceStatus(a[0], f["bundle-id"]),
144
+ description: "Governance status of a deployment's bundle (or --bundle-id): messages on whether it may be deployed.",
145
+ examples: ["dss project-deployer governance-status v1-on-prod",],
146
+ },
147
+ "delete-project": {
148
+ handler: async (c, a) => {
149
+ await c.projectDeployer.deleteProject(a[0]);
150
+ return { deleted: a[0], resource: "project-deployer", };
151
+ },
152
+ description: "Delete a published project that no deployment uses.",
153
+ examples: ["dss project-deployer delete-project MYPROJECT --plan",],
154
+ },
155
+ "project-settings": {
156
+ handler: (c, a) => c.projectDeployer.getProjectSettings(a[0]),
157
+ description: "Get a published project's settings (owner, permissions).",
158
+ examples: ["dss project-deployer project-settings MYPROJECT",],
159
+ },
160
+ "save-project-settings": {
161
+ handler: async (c, a, f) => {
162
+ await c.projectDeployer.saveProjectSettings(a[0], requiredJsonInput(f, "--data, --data-file, or --stdin is required (settings from project-settings)."));
163
+ return { updated: a[0], resource: "project-deployer", };
164
+ },
165
+ description: "Save published project settings obtained from project-settings, edited.",
166
+ examples: ["dss project-deployer save-project-settings MYPROJECT --data-file published.json",],
167
+ },
168
+ "delete-bundle": {
169
+ handler: async (c, a) => {
170
+ await c.projectDeployer.deleteBundle(a[0], a[1]);
171
+ return { deleted: a[1], resource: "project-deployer", project: a[0], };
172
+ },
173
+ description: "Delete a bundle of a published project that no deployment uses.",
174
+ examples: ["dss project-deployer delete-bundle MYPROJECT v1 --plan",],
175
+ },
106
176
  });
@@ -8,9 +8,6 @@ import { commandUsage, withUsage, } from "../syntax.js";
8
8
  import { requireArgs, UsageError, } from "../usage.js";
9
9
  const PROJECT_LIBRARY_EXIT_CODES = { usage: 1, error: 2, transient: 3, };
10
10
  const PUT_FLAG_ERROR_HINT = "Pass a 64-character SHA-256 hex digest (lowercase or uppercase).";
11
- function sha256BytesHex(bytes) {
12
- return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
13
- }
14
11
  function projectLibraryContentsEndpoint(client, projectKey, path) {
15
12
  return encodedProjectEndpoint(client, projectKey, `/libraries/contents/${encodeLibraryPath(path)}`);
16
13
  }
@@ -43,7 +40,7 @@ export function projectLibraryPutPayload(flags) {
43
40
  contentSource: "file",
44
41
  file: flags["file"],
45
42
  bytes: bytes.length,
46
- sha256: sha256BytesHex(bytes),
43
+ sha256: sha256Hex(bytes),
47
44
  ...(expectSha256 ? { expectSha256, } : {}),
48
45
  };
49
46
  }
@@ -90,7 +87,7 @@ export const projectLibraryCommands = withUsage("project-library", {
90
87
  throw new UsageError("--output PATH is required.", "missing_required_flag");
91
88
  const bytes = await c.projectLibrary.getFileBytes(a[0], f["project-key"]);
92
89
  const written = await Bun.write(out, bytes, { createPath: false, });
93
- return { path: out, bytes: written, sha256: sha256BytesHex(bytes), };
90
+ return { path: out, bytes: written, sha256: sha256Hex(bytes), };
94
91
  },
95
92
  description: "Download a project library file's raw bytes to a local file.",
96
93
  examples: ["dss project-library get-bytes static/logo.png --output ./logo.png",],
@@ -278,4 +278,12 @@ export const projectCommands = withUsage("project", {
278
278
  description: "Update a project's settings via JSON merge.",
279
279
  examples: ["dss project settings-set --data-file settings.json --project-key MY_PROJ",],
280
280
  },
281
+ "push-to-git-remote": {
282
+ handler: async (c, a, f) => {
283
+ await c.projects.pushToGitRemote(a[0], f["project-key"]);
284
+ return { pushed: a[0], resource: "project", };
285
+ },
286
+ description: "Push the project to a Git remote already declared in DSS (per-project Git mode). Branches, commits, pulls, and remotes: dss project-git.",
287
+ examples: ["dss project push-to-git-remote origin --plan",],
288
+ },
281
289
  });
@@ -1,4 +1,7 @@
1
+ import { recipeCreateWarnings } from "../../resources/recipe-create.js";
1
2
  import type { CommandMeta } from "../types.js";
3
+ /** Queue the stderr warnings for `recipe create` options (also used by `--plan` and `--dry-run`). */
4
+ export declare function enqueueRecipeCreateWarnings(options: Parameters<typeof recipeCreateWarnings>[0]): void;
2
5
  /** Maps `recipe create` flags to SDK options; shared by the handler and `--plan`. */
3
6
  export declare function recipeCreateOptionsFromFlags(f: Record<string, string | boolean>): {
4
7
  type: string;
@@ -13,6 +16,16 @@ export declare function recipeCreateOptionsFromFlags(f: Record<string, string |
13
16
  fuzzyDistance?: string | undefined;
14
17
  fuzzyThreshold?: number | undefined;
15
18
  fuzzyNormalize: boolean;
19
+ orderBy?: string | undefined;
20
+ formula?: string | undefined;
21
+ filter?: string | undefined;
22
+ stepOrder?: string[] | undefined;
16
23
  projectKey: string | undefined;
24
+ aggregate?: string[] | undefined;
25
+ dropColumns?: string[] | undefined;
26
+ fillEmpty?: string[] | undefined;
27
+ groupBy?: string[] | undefined;
28
+ keepColumns?: string[] | undefined;
29
+ rename?: string[] | undefined;
17
30
  };
18
31
  export declare const recipeCommands: Record<string, CommandMeta>;