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.
- package/LICENSE +21 -0
- package/dist/packages/types/src/index.d.ts +19 -2
- package/dist/packages/types/src/index.js +13 -1
- package/dist/src/cli/coerce.d.ts +36 -0
- package/dist/src/cli/coerce.js +239 -0
- package/dist/src/cli/commands/analysis.d.ts +2 -0
- package/dist/src/cli/commands/analysis.js +66 -0
- package/dist/src/cli/commands/api-deployer.d.ts +2 -0
- package/dist/src/cli/commands/api-deployer.js +170 -0
- package/dist/src/cli/commands/api-service.d.ts +2 -0
- package/dist/src/cli/commands/api-service.js +121 -0
- package/dist/src/cli/commands/app.d.ts +2 -0
- package/dist/src/cli/commands/app.js +78 -0
- package/dist/src/cli/commands/bundle.d.ts +2 -0
- package/dist/src/cli/commands/bundle.js +107 -0
- package/dist/src/cli/commands/business-app.d.ts +2 -0
- package/dist/src/cli/commands/business-app.js +76 -0
- package/dist/src/cli/commands/code-env.d.ts +2 -0
- package/dist/src/cli/commands/code-env.js +255 -0
- package/dist/src/cli/commands/code.d.ts +2 -0
- package/dist/src/cli/commands/code.js +63 -0
- package/dist/src/cli/commands/connection.d.ts +2 -0
- package/dist/src/cli/commands/connection.js +54 -0
- package/dist/src/cli/commands/continuous-activity.d.ts +2 -0
- package/dist/src/cli/commands/continuous-activity.js +38 -0
- package/dist/src/cli/commands/dashboard.d.ts +2 -0
- package/dist/src/cli/commands/dashboard.js +99 -0
- package/dist/src/cli/commands/data-quality.d.ts +2 -0
- package/dist/src/cli/commands/data-quality.js +235 -0
- package/dist/src/cli/commands/dataset.d.ts +2 -0
- package/dist/src/cli/commands/dataset.js +288 -0
- package/dist/src/cli/commands/discussion.d.ts +2 -0
- package/dist/src/cli/commands/discussion.js +47 -0
- package/dist/src/cli/commands/doctor.d.ts +2 -0
- package/dist/src/cli/commands/doctor.js +9 -0
- package/dist/src/cli/commands/flow-zone.d.ts +2 -0
- package/dist/src/cli/commands/flow-zone.js +282 -0
- package/dist/src/cli/commands/folder.d.ts +2 -0
- package/dist/src/cli/commands/folder.js +202 -0
- package/dist/src/cli/commands/future.d.ts +2 -0
- package/dist/src/cli/commands/future.js +57 -0
- package/dist/src/cli/commands/index.d.ts +2 -0
- package/dist/src/cli/commands/index.js +78 -0
- package/dist/src/cli/commands/insight.d.ts +2 -0
- package/dist/src/cli/commands/insight.js +156 -0
- package/dist/src/cli/commands/job.d.ts +2 -0
- package/dist/src/cli/commands/job.js +406 -0
- package/dist/src/cli/commands/meaning.d.ts +2 -0
- package/dist/src/cli/commands/meaning.js +115 -0
- package/dist/src/cli/commands/metrics.d.ts +2 -0
- package/dist/src/cli/commands/metrics.js +39 -0
- package/dist/src/cli/commands/ml-task.d.ts +2 -0
- package/dist/src/cli/commands/ml-task.js +171 -0
- package/dist/src/cli/commands/model-evaluation-store.d.ts +2 -0
- package/dist/src/cli/commands/model-evaluation-store.js +83 -0
- package/dist/src/cli/commands/notebook.d.ts +2 -0
- package/dist/src/cli/commands/notebook.js +242 -0
- package/dist/src/cli/commands/project-deployer.d.ts +2 -0
- package/dist/src/cli/commands/project-deployer.js +118 -0
- package/dist/src/cli/commands/project-library.d.ts +2 -0
- package/dist/src/cli/commands/project-library.js +197 -0
- package/dist/src/cli/commands/project.d.ts +2 -0
- package/dist/src/cli/commands/project.js +133 -0
- package/dist/src/cli/commands/recipe.d.ts +2 -0
- package/dist/src/cli/commands/recipe.js +659 -0
- package/dist/src/cli/commands/saved-model.d.ts +2 -0
- package/dist/src/cli/commands/saved-model.js +85 -0
- package/dist/src/cli/commands/scenario.d.ts +2 -0
- package/dist/src/cli/commands/scenario.js +190 -0
- package/dist/src/cli/commands/sql.d.ts +2 -0
- package/dist/src/cli/commands/sql.js +109 -0
- package/dist/src/cli/commands/statistics.d.ts +2 -0
- package/dist/src/cli/commands/statistics.js +165 -0
- package/dist/src/cli/commands/streaming-endpoint.d.ts +2 -0
- package/dist/src/cli/commands/streaming-endpoint.js +50 -0
- package/dist/src/cli/commands/variable.d.ts +2 -0
- package/dist/src/cli/commands/variable.js +49 -0
- package/dist/src/cli/commands/webapp.d.ts +2 -0
- package/dist/src/cli/commands/webapp.js +67 -0
- package/dist/src/cli/commands/wiki.d.ts +2 -0
- package/dist/src/cli/commands/wiki.js +123 -0
- package/dist/src/cli/commands/workspace.d.ts +2 -0
- package/dist/src/cli/commands/workspace.js +68 -0
- package/dist/src/cli/contract.d.ts +104 -0
- package/dist/src/cli/contract.js +2041 -0
- package/dist/src/cli/doctor.d.ts +104 -0
- package/dist/src/cli/doctor.js +356 -0
- package/dist/src/cli/env.d.ts +2 -0
- package/dist/src/cli/env.js +37 -0
- package/dist/src/cli/flags.d.ts +16 -0
- package/dist/src/cli/flags.js +272 -0
- package/dist/src/cli/helpers/cleanup.d.ts +3 -0
- package/dist/src/cli/helpers/cleanup.js +204 -0
- package/dist/src/cli/helpers/dataset.d.ts +2 -0
- package/dist/src/cli/helpers/dataset.js +17 -0
- package/dist/src/cli/helpers/flow-zone.d.ts +69 -0
- package/dist/src/cli/helpers/flow-zone.js +420 -0
- package/dist/src/cli/helpers/recipe.d.ts +11 -0
- package/dist/src/cli/helpers/recipe.js +83 -0
- package/dist/src/cli/output.d.ts +38 -0
- package/dist/src/cli/output.js +159 -0
- package/dist/src/cli/runtime.d.ts +15 -0
- package/dist/src/cli/runtime.js +59 -0
- package/dist/src/cli/types.d.ts +25 -0
- package/dist/src/cli/types.js +1 -0
- package/dist/src/cli/usage.d.ts +16 -0
- package/dist/src/cli/usage.js +84 -0
- package/dist/src/cli/version.d.ts +14 -0
- package/dist/src/cli/version.js +63 -0
- package/dist/src/cli.js +671 -8254
- package/dist/src/client.d.ts +13 -1
- package/dist/src/client.js +34 -13
- package/dist/src/errors.d.ts +6 -0
- package/dist/src/errors.js +102 -4
- package/dist/src/index.d.ts +7 -3
- package/dist/src/index.js +6 -2
- package/dist/src/resources/analyses.d.ts +34 -0
- package/dist/src/resources/analyses.js +31 -0
- package/dist/src/resources/api-services.d.ts +2 -0
- package/dist/src/resources/api-services.js +10 -0
- package/dist/src/resources/applications.d.ts +1 -1
- package/dist/src/resources/applications.js +27 -1
- package/dist/src/resources/continuous-activities.js +1 -0
- package/dist/src/resources/data-quality.js +5 -3
- package/dist/src/resources/datasets.d.ts +3 -0
- package/dist/src/resources/datasets.js +10 -5
- package/dist/src/resources/flow-zones.d.ts +2 -2
- package/dist/src/resources/flow-zones.js +4 -1
- package/dist/src/resources/meanings.d.ts +2 -0
- package/dist/src/resources/meanings.js +4 -0
- package/dist/src/resources/ml-tasks.d.ts +91 -0
- package/dist/src/resources/ml-tasks.js +130 -0
- package/dist/src/resources/model-evaluation-stores.d.ts +41 -0
- package/dist/src/resources/model-evaluation-stores.js +36 -0
- package/dist/src/resources/notebooks.d.ts +5 -7
- package/dist/src/resources/notebooks.js +10 -7
- package/dist/src/resources/projects.d.ts +1 -1
- package/dist/src/resources/projects.js +2 -2
- package/dist/src/resources/recipes.d.ts +3 -3
- package/dist/src/resources/recipes.js +198 -38
- package/dist/src/resources/saved-models.d.ts +41 -0
- package/dist/src/resources/saved-models.js +40 -0
- package/dist/src/resources/scenarios.js +67 -26
- package/dist/src/resources/statistics.js +9 -0
- package/dist/src/schemas.d.ts +2 -2
- package/dist/src/schemas.js +1 -1
- package/dist/src/skill.js +2 -2
- package/dist/src/utils/sanitize.js +2 -1
- package/package.json +1 -1
- package/packages/types/dist/index.d.ts +19 -2
- package/packages/types/dist/index.js +13 -1
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, } from "node:fs";
|
|
2
|
+
import { readStdinText, } from "../coerce.js";
|
|
3
|
+
import { encodedProjectEndpoint, planResult, } from "../output.js";
|
|
4
|
+
import { requireArgs, UsageError, } from "../usage.js";
|
|
5
|
+
const PROJECT_LIBRARY_EXIT_CODES = { usage: 1, error: 2, transient: 3, };
|
|
6
|
+
function normalizeLibraryPath(path) {
|
|
7
|
+
const normalized = path.replace(/^\/+/, "");
|
|
8
|
+
if (!normalized)
|
|
9
|
+
throw new Error("Project library path is required");
|
|
10
|
+
return normalized;
|
|
11
|
+
}
|
|
12
|
+
function normalizeLibraryDestinationPath(path) {
|
|
13
|
+
if (path === "/")
|
|
14
|
+
return "/";
|
|
15
|
+
return `/${normalizeLibraryPath(path)}`;
|
|
16
|
+
}
|
|
17
|
+
function encodeLibraryPath(path) {
|
|
18
|
+
return normalizeLibraryPath(path)
|
|
19
|
+
.split("/")
|
|
20
|
+
.map((segment) => encodeURIComponent(segment))
|
|
21
|
+
.join("/");
|
|
22
|
+
}
|
|
23
|
+
function projectLibraryContentsEndpoint(client, projectKey, path) {
|
|
24
|
+
return encodedProjectEndpoint(client, projectKey, `/libraries/contents/${encodeLibraryPath(path)}`);
|
|
25
|
+
}
|
|
26
|
+
function projectLibraryFolderEndpoint(client, projectKey, path) {
|
|
27
|
+
return encodedProjectEndpoint(client, projectKey, `/libraries/folders/${encodeLibraryPath(path)}`);
|
|
28
|
+
}
|
|
29
|
+
function projectLibraryActionEndpoint(client, projectKey, action) {
|
|
30
|
+
return encodedProjectEndpoint(client, projectKey, `/libraries/contents-actions/${action}`);
|
|
31
|
+
}
|
|
32
|
+
function projectLibraryPutPayload(flags) {
|
|
33
|
+
if (typeof flags["content"] === "string")
|
|
34
|
+
return { contentSource: "flag", };
|
|
35
|
+
if (typeof flags["file"] === "string")
|
|
36
|
+
return { contentSource: "file", file: flags["file"], };
|
|
37
|
+
return { contentSource: "stdin", };
|
|
38
|
+
}
|
|
39
|
+
function projectLibraryPlan(action, options) {
|
|
40
|
+
return planResult("project-library", action, {
|
|
41
|
+
...options,
|
|
42
|
+
asyncKind: "none",
|
|
43
|
+
exitCodesOnFailure: PROJECT_LIBRARY_EXIT_CODES,
|
|
44
|
+
idempotency: "none",
|
|
45
|
+
plannedAndDryRun: true,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export const projectLibraryCommands = {
|
|
49
|
+
list: {
|
|
50
|
+
handler: (c, _a, f) => c.projectLibrary.listContents(f["project-key"]),
|
|
51
|
+
usage: "dss project-library list [--project-key KEY]",
|
|
52
|
+
description: "List the project code library (lib/) contents.",
|
|
53
|
+
examples: ["dss project-library list",],
|
|
54
|
+
},
|
|
55
|
+
get: {
|
|
56
|
+
handler: (c, a, f) => {
|
|
57
|
+
requireArgs(a, 1, "dss project-library get <path> [--project-key KEY]");
|
|
58
|
+
return c.projectLibrary.getFile(a[0], f["project-key"]);
|
|
59
|
+
},
|
|
60
|
+
usage: "dss project-library get <path> [--project-key KEY]",
|
|
61
|
+
description: "Print the text content of a project library file.",
|
|
62
|
+
examples: ["dss project-library get python/mylib/utils.py",],
|
|
63
|
+
},
|
|
64
|
+
"get-bytes": {
|
|
65
|
+
handler: async (c, a, f) => {
|
|
66
|
+
requireArgs(a, 1, "dss project-library get-bytes <path> --output PATH [--project-key KEY]");
|
|
67
|
+
const out = f["output"];
|
|
68
|
+
if (!out)
|
|
69
|
+
throw new UsageError("--output PATH is required.", "missing_required_flag");
|
|
70
|
+
const bytes = await c.projectLibrary.getFileBytes(a[0], f["project-key"]);
|
|
71
|
+
writeFileSync(out, bytes);
|
|
72
|
+
return { path: out, bytes: bytes.length, };
|
|
73
|
+
},
|
|
74
|
+
usage: "dss project-library get-bytes <path> --output PATH [--project-key KEY]",
|
|
75
|
+
description: "Download a project library file's raw bytes to a local file.",
|
|
76
|
+
examples: ["dss project-library get-bytes static/logo.png --output ./logo.png",],
|
|
77
|
+
},
|
|
78
|
+
"create-file": {
|
|
79
|
+
handler: async (c, a, f) => {
|
|
80
|
+
requireArgs(a, 1, "dss project-library create-file <path> [--dry-run] [--project-key KEY]");
|
|
81
|
+
const pk = f["project-key"];
|
|
82
|
+
if (f["dry-run"] === true) {
|
|
83
|
+
return projectLibraryPlan("create-file", {
|
|
84
|
+
method: "POST",
|
|
85
|
+
endpoint: projectLibraryContentsEndpoint(c, pk, a[0]),
|
|
86
|
+
identifiers: { path: a[0], },
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
await c.projectLibrary.addFile(a[0], pk);
|
|
90
|
+
return { created: a[0], };
|
|
91
|
+
},
|
|
92
|
+
usage: "dss project-library create-file <path> [--dry-run] [--project-key KEY]",
|
|
93
|
+
description: "Create an empty file in the project library.",
|
|
94
|
+
examples: ["dss project-library create-file python/mylib/new.py",],
|
|
95
|
+
},
|
|
96
|
+
"create-folder": {
|
|
97
|
+
handler: async (c, a, f) => {
|
|
98
|
+
requireArgs(a, 1, "dss project-library create-folder <path> [--dry-run] [--project-key KEY]");
|
|
99
|
+
const pk = f["project-key"];
|
|
100
|
+
if (f["dry-run"] === true) {
|
|
101
|
+
return projectLibraryPlan("create-folder", {
|
|
102
|
+
method: "POST",
|
|
103
|
+
endpoint: projectLibraryFolderEndpoint(c, pk, a[0]),
|
|
104
|
+
identifiers: { path: a[0], },
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
await c.projectLibrary.addFolder(a[0], pk);
|
|
108
|
+
return { created: a[0], };
|
|
109
|
+
},
|
|
110
|
+
usage: "dss project-library create-folder <path> [--dry-run] [--project-key KEY]",
|
|
111
|
+
description: "Create a folder in the project library.",
|
|
112
|
+
examples: ["dss project-library create-folder python/mylib",],
|
|
113
|
+
},
|
|
114
|
+
put: {
|
|
115
|
+
handler: async (c, a, f) => {
|
|
116
|
+
requireArgs(a, 1, "dss project-library put <path> (--content TEXT|--file PATH|--stdin) [--dry-run] [--project-key KEY]");
|
|
117
|
+
const pk = f["project-key"];
|
|
118
|
+
if (f["dry-run"] === true) {
|
|
119
|
+
return projectLibraryPlan("put", {
|
|
120
|
+
method: "POST",
|
|
121
|
+
endpoint: projectLibraryContentsEndpoint(c, pk, a[0]),
|
|
122
|
+
identifiers: { path: a[0], },
|
|
123
|
+
payload: projectLibraryPutPayload(f),
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const content = typeof f["content"] === "string"
|
|
127
|
+
? f["content"]
|
|
128
|
+
: typeof f["file"] === "string"
|
|
129
|
+
? readFileSync(f["file"], "utf-8")
|
|
130
|
+
: await readStdinText();
|
|
131
|
+
await c.projectLibrary.addOrUpdateFile(a[0], content, pk);
|
|
132
|
+
return { updated: a[0], };
|
|
133
|
+
},
|
|
134
|
+
usage: "dss project-library put <path> (--content TEXT|--file PATH|--stdin) [--dry-run] [--project-key KEY]",
|
|
135
|
+
description: "Create or overwrite a project library file with raw text content.",
|
|
136
|
+
examples: ["dss project-library put python/mylib/utils.py --file ./utils.py",],
|
|
137
|
+
},
|
|
138
|
+
delete: {
|
|
139
|
+
handler: async (c, a, f) => {
|
|
140
|
+
requireArgs(a, 1, "dss project-library delete <path> [--dry-run] [--project-key KEY]");
|
|
141
|
+
const pk = f["project-key"];
|
|
142
|
+
if (f["dry-run"] === true) {
|
|
143
|
+
return projectLibraryPlan("delete", {
|
|
144
|
+
method: "DELETE",
|
|
145
|
+
endpoint: projectLibraryContentsEndpoint(c, pk, a[0]),
|
|
146
|
+
identifiers: { path: a[0], },
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
await c.projectLibrary.deleteFile(a[0], pk);
|
|
150
|
+
return { deleted: a[0], };
|
|
151
|
+
},
|
|
152
|
+
usage: "dss project-library delete <path> [--dry-run] [--project-key KEY]",
|
|
153
|
+
description: "Delete a project library file or folder.",
|
|
154
|
+
examples: ["dss project-library delete python/mylib/old.py",],
|
|
155
|
+
},
|
|
156
|
+
rename: {
|
|
157
|
+
handler: async (c, a, f) => {
|
|
158
|
+
requireArgs(a, 2, "dss project-library rename <path> <new-name> [--dry-run] [--project-key KEY]");
|
|
159
|
+
const pk = f["project-key"];
|
|
160
|
+
if (f["dry-run"] === true) {
|
|
161
|
+
return projectLibraryPlan("rename", {
|
|
162
|
+
method: "POST",
|
|
163
|
+
endpoint: projectLibraryActionEndpoint(c, pk, "rename/"),
|
|
164
|
+
identifiers: { path: a[0], newName: a[1], },
|
|
165
|
+
payload: { oldPath: `/${normalizeLibraryPath(a[0])}`, newName: a[1], },
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
await c.projectLibrary.rename(a[0], a[1], pk);
|
|
169
|
+
return { renamed: a[0], to: a[1], };
|
|
170
|
+
},
|
|
171
|
+
usage: "dss project-library rename <path> <new-name> [--dry-run] [--project-key KEY]",
|
|
172
|
+
description: "Rename a project library file or folder within its parent.",
|
|
173
|
+
examples: ["dss project-library rename python/mylib/old.py new.py",],
|
|
174
|
+
},
|
|
175
|
+
move: {
|
|
176
|
+
handler: async (c, a, f) => {
|
|
177
|
+
requireArgs(a, 2, "dss project-library move <path> <destination-folder> [--dry-run] [--project-key KEY]");
|
|
178
|
+
const pk = f["project-key"];
|
|
179
|
+
if (f["dry-run"] === true) {
|
|
180
|
+
return projectLibraryPlan("move", {
|
|
181
|
+
method: "POST",
|
|
182
|
+
endpoint: projectLibraryActionEndpoint(c, pk, "move"),
|
|
183
|
+
identifiers: { path: a[0], destinationFolder: a[1], },
|
|
184
|
+
payload: {
|
|
185
|
+
oldPath: `/${normalizeLibraryPath(a[0])}`,
|
|
186
|
+
newPath: normalizeLibraryDestinationPath(a[1]),
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
await c.projectLibrary.move(a[0], a[1], pk);
|
|
191
|
+
return { moved: a[0], to: a[1], };
|
|
192
|
+
},
|
|
193
|
+
usage: "dss project-library move <path> <destination-folder> [--dry-run] [--project-key KEY]",
|
|
194
|
+
description: "Move a project library file or folder into another folder.",
|
|
195
|
+
examples: ["dss project-library move python/old.py python/mylib",],
|
|
196
|
+
},
|
|
197
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { deepMerge, } from "../../utils/deep-merge.js";
|
|
2
|
+
import { jsonInput, num, requiredJsonInput, } from "../coerce.js";
|
|
3
|
+
import { requireArgs, UsageError, } from "../usage.js";
|
|
4
|
+
export const projectCommands = {
|
|
5
|
+
list: {
|
|
6
|
+
handler: (c) => c.projects.list(),
|
|
7
|
+
usage: "dss project list",
|
|
8
|
+
description: "List all accessible projects.",
|
|
9
|
+
examples: ["dss project list",],
|
|
10
|
+
},
|
|
11
|
+
get: {
|
|
12
|
+
handler: (c, _a, f) => c.projects.get(f["project-key"]),
|
|
13
|
+
usage: "dss project get [--project-key KEY]",
|
|
14
|
+
description: "Get project settings and metadata.",
|
|
15
|
+
examples: ["dss project get", "dss project get --project-key MYPROJ",],
|
|
16
|
+
},
|
|
17
|
+
metadata: {
|
|
18
|
+
handler: (c, _a, f) => c.projects.metadata(f["project-key"]),
|
|
19
|
+
usage: "dss project metadata [--project-key KEY]",
|
|
20
|
+
description: "Get project-level metadata (tags, labels, custom fields).",
|
|
21
|
+
examples: ["dss project metadata", "dss project metadata --project-key MYPROJ",],
|
|
22
|
+
},
|
|
23
|
+
flow: {
|
|
24
|
+
handler: (c, _a, f) => c.projects.flow(f["project-key"]),
|
|
25
|
+
usage: "dss project flow [--project-key KEY]",
|
|
26
|
+
description: "Get the raw flow graph (all datasets, recipes, and edges).",
|
|
27
|
+
examples: ["dss project flow", "dss project flow --project-key MYPROJ",],
|
|
28
|
+
},
|
|
29
|
+
map: {
|
|
30
|
+
handler: (c, _a, f) => c.projects.map({
|
|
31
|
+
projectKey: f["project-key"],
|
|
32
|
+
maxNodes: num(f["max-nodes"]),
|
|
33
|
+
maxEdges: num(f["max-edges"]),
|
|
34
|
+
includeRaw: f["include-raw"] === true,
|
|
35
|
+
}),
|
|
36
|
+
usage: "dss project map [--max-nodes N] [--max-edges N] [--include-raw] [--project-key KEY]",
|
|
37
|
+
description: "Get a summarized, truncated flow map.",
|
|
38
|
+
examples: [
|
|
39
|
+
"dss project map",
|
|
40
|
+
"dss project map --max-nodes 50 --max-edges 100",
|
|
41
|
+
"dss project map --include-raw",
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
create: {
|
|
45
|
+
handler: (c, a, f) => {
|
|
46
|
+
const usage = "dss project create <projectKey> <name> --owner LOGIN [--data JSON|--data-file PATH|--stdin]";
|
|
47
|
+
requireArgs(a, 2, usage);
|
|
48
|
+
const owner = f["owner"];
|
|
49
|
+
if (!owner)
|
|
50
|
+
throw new UsageError(`--owner is required. Usage: ${usage}`);
|
|
51
|
+
return c.projects.createProject(a[0], a[1], owner, jsonInput(f));
|
|
52
|
+
},
|
|
53
|
+
usage: "dss project create <projectKey> <name> --owner LOGIN [--data JSON|--data-file PATH|--stdin]",
|
|
54
|
+
description: "Create a new project with owner login and optional settings.",
|
|
55
|
+
examples: ["dss project create MY_PROJ MyProject --owner alice",],
|
|
56
|
+
},
|
|
57
|
+
delete: {
|
|
58
|
+
handler: async (c, a, f) => {
|
|
59
|
+
requireArgs(a, 1, "dss project delete <projectKey> [--drop-data]");
|
|
60
|
+
await c.projects.deleteProject(a[0], f["drop-data"] === true);
|
|
61
|
+
return { deleted: a[0], };
|
|
62
|
+
},
|
|
63
|
+
usage: "dss project delete <projectKey> [--drop-data]",
|
|
64
|
+
description: "Delete a project (destructive). --drop-data also clears managed datasets.",
|
|
65
|
+
examples: ["dss project delete MY_PROJ",],
|
|
66
|
+
},
|
|
67
|
+
duplicate: {
|
|
68
|
+
handler: (c, a, f) => {
|
|
69
|
+
requireArgs(a, 3, "dss project duplicate <sourceKey> <targetKey> <targetName> [--data JSON|--data-file PATH|--stdin]");
|
|
70
|
+
return c.projects.duplicate(a[0], a[1], a[2], jsonInput(f));
|
|
71
|
+
},
|
|
72
|
+
usage: "dss project duplicate <sourceKey> <targetKey> <targetName> [--data JSON|--data-file PATH|--stdin]",
|
|
73
|
+
description: "Duplicate a project into a new project key.",
|
|
74
|
+
examples: ["dss project duplicate SRC NEW NewProject",],
|
|
75
|
+
},
|
|
76
|
+
export: {
|
|
77
|
+
handler: async (c, a, f) => {
|
|
78
|
+
requireArgs(a, 1, "dss project export <projectKey> --output PATH [--data JSON|--data-file PATH|--stdin]");
|
|
79
|
+
const out = f["output"];
|
|
80
|
+
if (!out)
|
|
81
|
+
throw new UsageError("--output PATH is required.", "missing_required_flag");
|
|
82
|
+
await c.projects.exportArchive(a[0], out, jsonInput(f));
|
|
83
|
+
return { path: out, };
|
|
84
|
+
},
|
|
85
|
+
usage: "dss project export <projectKey> --output PATH [--data JSON|--data-file PATH|--stdin]",
|
|
86
|
+
description: "Export a project to a local archive (.zip).",
|
|
87
|
+
examples: ["dss project export MY_PROJ --output ./my_proj.zip",],
|
|
88
|
+
},
|
|
89
|
+
import: {
|
|
90
|
+
handler: async (c, a) => {
|
|
91
|
+
requireArgs(a, 1, "dss project import <filePath>");
|
|
92
|
+
return c.projects.importProjectFromArchive(a[0]);
|
|
93
|
+
},
|
|
94
|
+
usage: "dss project import <filePath>",
|
|
95
|
+
description: "Upload a project archive to prepare an import (returns a temporary import id).",
|
|
96
|
+
examples: ["dss project import ./my_proj.zip",],
|
|
97
|
+
},
|
|
98
|
+
"permissions-get": {
|
|
99
|
+
handler: (c, _a, f) => c.projects.getPermissions(f["project-key"]),
|
|
100
|
+
usage: "dss project permissions-get [--project-key KEY]",
|
|
101
|
+
description: "Get a project's permissions.",
|
|
102
|
+
examples: ["dss project permissions-get --project-key MY_PROJ",],
|
|
103
|
+
},
|
|
104
|
+
"permissions-set": {
|
|
105
|
+
handler: async (c, _a, f) => {
|
|
106
|
+
const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (permissions object).");
|
|
107
|
+
await c.projects.setPermissions(f["project-key"], body);
|
|
108
|
+
return { updated: true, };
|
|
109
|
+
},
|
|
110
|
+
usage: "dss project permissions-set (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
|
|
111
|
+
description: "Replace a project's permissions.",
|
|
112
|
+
examples: ["dss project permissions-set --data-file perms.json --project-key MY_PROJ",],
|
|
113
|
+
},
|
|
114
|
+
"settings-get": {
|
|
115
|
+
handler: (c, _a, f) => c.projects.getSettings(f["project-key"]),
|
|
116
|
+
usage: "dss project settings-get [--project-key KEY]",
|
|
117
|
+
description: "Get a project's settings.",
|
|
118
|
+
examples: ["dss project settings-get --project-key MY_PROJ",],
|
|
119
|
+
},
|
|
120
|
+
"settings-set": {
|
|
121
|
+
handler: async (c, _a, f) => {
|
|
122
|
+
const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (settings object).");
|
|
123
|
+
const projectKey = f["project-key"];
|
|
124
|
+
const current = await c.projects.getSettings(projectKey);
|
|
125
|
+
const next = deepMerge(current, body);
|
|
126
|
+
await c.projects.setSettings(projectKey, next);
|
|
127
|
+
return { updated: true, };
|
|
128
|
+
},
|
|
129
|
+
usage: "dss project settings-set (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
|
|
130
|
+
description: "Update a project's settings via JSON merge.",
|
|
131
|
+
examples: ["dss project settings-set --data-file settings.json --project-key MY_PROJ",],
|
|
132
|
+
},
|
|
133
|
+
};
|