dataiku-sdk 3.1.0 → 3.3.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 (149) hide show
  1. package/README.md +253 -38
  2. package/dist/build-metadata.json +1 -1
  3. package/dist/packages/types/src/index.d.ts +102 -0
  4. package/dist/packages/types/src/index.js +76 -0
  5. package/dist/src/auth.js +1 -1
  6. package/dist/src/cli/coerce.js +11 -2
  7. package/dist/src/cli/commands/analysis.js +4 -3
  8. package/dist/src/cli/commands/api-service.js +5 -3
  9. package/dist/src/cli/commands/app.js +61 -18
  10. package/dist/src/cli/commands/bundle.js +3 -2
  11. package/dist/src/cli/commands/code-env.js +23 -16
  12. package/dist/src/cli/commands/connection.d.ts +9 -0
  13. package/dist/src/cli/commands/connection.js +267 -1
  14. package/dist/src/cli/commands/dashboard.js +7 -6
  15. package/dist/src/cli/commands/data-collection.d.ts +2 -0
  16. package/dist/src/cli/commands/data-collection.js +164 -0
  17. package/dist/src/cli/commands/data-quality.js +9 -8
  18. package/dist/src/cli/commands/dataset.js +170 -40
  19. package/dist/src/cli/commands/doctor.js +4 -2
  20. package/dist/src/cli/commands/flow-zone.js +9 -8
  21. package/dist/src/cli/commands/folder.js +9 -8
  22. package/dist/src/cli/commands/future.js +4 -3
  23. package/dist/src/cli/commands/group.d.ts +2 -0
  24. package/dist/src/cli/commands/group.js +109 -0
  25. package/dist/src/cli/commands/index.js +151 -78
  26. package/dist/src/cli/commands/insight.js +8 -7
  27. package/dist/src/cli/commands/job.js +4 -3
  28. package/dist/src/cli/commands/knowledge-bank.d.ts +2 -0
  29. package/dist/src/cli/commands/knowledge-bank.js +80 -0
  30. package/dist/src/cli/commands/llm.d.ts +2 -0
  31. package/dist/src/cli/commands/llm.js +93 -0
  32. package/dist/src/cli/commands/macro.d.ts +2 -0
  33. package/dist/src/cli/commands/macro.js +221 -0
  34. package/dist/src/cli/commands/meaning.js +5 -4
  35. package/dist/src/cli/commands/ml-task.js +21 -8
  36. package/dist/src/cli/commands/model-evaluation-store.js +4 -3
  37. package/dist/src/cli/commands/notebook.js +17 -12
  38. package/dist/src/cli/commands/plugin.d.ts +2 -0
  39. package/dist/src/cli/commands/plugin.js +799 -0
  40. package/dist/src/cli/commands/project-folder.d.ts +2 -0
  41. package/dist/src/cli/commands/project-folder.js +197 -0
  42. package/dist/src/cli/commands/project-git.js +14 -54
  43. package/dist/src/cli/commands/project-library.js +7 -6
  44. package/dist/src/cli/commands/project.js +55 -8
  45. package/dist/src/cli/commands/recipe.js +50 -14
  46. package/dist/src/cli/commands/saved-model.d.ts +5 -0
  47. package/dist/src/cli/commands/saved-model.js +392 -4
  48. package/dist/src/cli/commands/scenario.js +147 -9
  49. package/dist/src/cli/commands/sql.js +3 -2
  50. package/dist/src/cli/commands/statistics.js +7 -6
  51. package/dist/src/cli/commands/user.d.ts +8 -0
  52. package/dist/src/cli/commands/user.js +296 -0
  53. package/dist/src/cli/commands/variable.js +2 -1
  54. package/dist/src/cli/commands/webapp.js +2 -1
  55. package/dist/src/cli/commands/wiki.js +7 -6
  56. package/dist/src/cli/contract.d.ts +2 -3
  57. package/dist/src/cli/contract.js +1167 -163
  58. package/dist/src/cli/flags.d.ts +4 -0
  59. package/dist/src/cli/flags.js +50 -2
  60. package/dist/src/cli/helpers/app-successor.d.ts +19 -4
  61. package/dist/src/cli/helpers/app-successor.js +90 -30
  62. package/dist/src/cli/helpers/cleanup.js +3 -1
  63. package/dist/src/cli/helpers/flow-zone.js +1 -2
  64. package/dist/src/cli/output.d.ts +1 -1
  65. package/dist/src/cli/output.js +23 -10
  66. package/dist/src/cli/usage.d.ts +1 -0
  67. package/dist/src/cli/usage.js +47 -1
  68. package/dist/src/cli.js +225 -95
  69. package/dist/src/client.d.ts +86 -6
  70. package/dist/src/client.js +263 -50
  71. package/dist/src/errors.d.ts +3 -0
  72. package/dist/src/errors.js +4 -0
  73. package/dist/src/index.d.ts +16 -7
  74. package/dist/src/index.js +11 -2
  75. package/dist/src/resources/analyses.js +1 -8
  76. package/dist/src/resources/applications.d.ts +8 -6
  77. package/dist/src/resources/applications.js +21 -21
  78. package/dist/src/resources/base.d.ts +4 -0
  79. package/dist/src/resources/base.js +15 -0
  80. package/dist/src/resources/bundles.d.ts +9 -4
  81. package/dist/src/resources/bundles.js +10 -5
  82. package/dist/src/resources/connections.d.ts +78 -1
  83. package/dist/src/resources/connections.js +132 -1
  84. package/dist/src/resources/data-collections.d.ts +118 -0
  85. package/dist/src/resources/data-collections.js +49 -0
  86. package/dist/src/resources/datasets.d.ts +69 -0
  87. package/dist/src/resources/datasets.js +99 -1
  88. package/dist/src/resources/folders.js +2 -1
  89. package/dist/src/resources/futures.d.ts +4 -1
  90. package/dist/src/resources/futures.js +38 -6
  91. package/dist/src/resources/groups.d.ts +47 -0
  92. package/dist/src/resources/groups.js +56 -0
  93. package/dist/src/resources/jobs.d.ts +8 -13
  94. package/dist/src/resources/jobs.js +41 -16
  95. package/dist/src/resources/knowledge-banks.d.ts +58 -0
  96. package/dist/src/resources/knowledge-banks.js +61 -0
  97. package/dist/src/resources/llms.d.ts +92 -0
  98. package/dist/src/resources/llms.js +62 -0
  99. package/dist/src/resources/macros.d.ts +121 -0
  100. package/dist/src/resources/macros.js +231 -0
  101. package/dist/src/resources/ml-tasks.d.ts +37 -2
  102. package/dist/src/resources/ml-tasks.js +100 -20
  103. package/dist/src/resources/model-evaluation-stores.js +1 -8
  104. package/dist/src/resources/notebooks.d.ts +43 -7
  105. package/dist/src/resources/notebooks.js +53 -13
  106. package/dist/src/resources/plugins.d.ts +265 -0
  107. package/dist/src/resources/plugins.js +458 -0
  108. package/dist/src/resources/project-folders.d.ts +71 -0
  109. package/dist/src/resources/project-folders.js +57 -0
  110. package/dist/src/resources/project-git.d.ts +6 -0
  111. package/dist/src/resources/project-git.js +69 -42
  112. package/dist/src/resources/project-library.d.ts +0 -1
  113. package/dist/src/resources/project-library.js +1 -17
  114. package/dist/src/resources/projects.d.ts +19 -3
  115. package/dist/src/resources/projects.js +30 -18
  116. package/dist/src/resources/recipes.d.ts +15 -1
  117. package/dist/src/resources/recipes.js +73 -6
  118. package/dist/src/resources/saved-models.d.ts +134 -1
  119. package/dist/src/resources/saved-models.js +214 -6
  120. package/dist/src/resources/scenarios.d.ts +105 -0
  121. package/dist/src/resources/scenarios.js +232 -106
  122. package/dist/src/resources/sql.js +5 -1
  123. package/dist/src/resources/users.d.ts +129 -0
  124. package/dist/src/resources/users.js +128 -0
  125. package/dist/src/resources/webapps.d.ts +15 -2
  126. package/dist/src/resources/webapps.js +18 -4
  127. package/dist/src/schemas.d.ts +2 -2
  128. package/dist/src/schemas.js +1 -1
  129. package/dist/src/skill.d.ts +13 -4
  130. package/dist/src/skill.js +75 -24
  131. package/dist/src/utils/deep-merge.d.ts +1 -1
  132. package/dist/src/utils/polling.d.ts +20 -0
  133. package/dist/src/utils/polling.js +27 -0
  134. package/dist/src/utils/response-file.d.ts +2 -0
  135. package/dist/src/utils/response-file.js +34 -0
  136. package/dist/src/utils/secret-sanitize.d.ts +54 -0
  137. package/dist/src/utils/secret-sanitize.js +101 -0
  138. package/package.json +8 -5
  139. package/packages/types/dist/index.d.ts +102 -0
  140. package/packages/types/dist/index.js +76 -0
  141. package/plugin.json +1 -1
  142. package/skills/dataiku-dss/SKILL.md +47 -225
  143. package/skills/dataiku-dss/references/app-releases.md +28 -0
  144. package/skills/dataiku-dss/references/authentication.md +39 -0
  145. package/skills/dataiku-dss/references/coding.md +8 -0
  146. package/skills/dataiku-dss/references/discovery.md +30 -0
  147. package/skills/dataiku-dss/references/flow-maps.md +12 -0
  148. package/skills/dataiku-dss/references/mutations.md +33 -0
  149. package/skills/dataiku-dss/references/troubleshooting.md +29 -0
@@ -0,0 +1,265 @@
1
+ import { BaseResource } from "./base.js";
2
+ import { validateGitReferencePath } from "./project-git.js";
3
+ /** Summary entry of `/plugins/` as documented (id/version/isDev/meta). */
4
+ export interface PluginSummary {
5
+ id: string;
6
+ version?: string;
7
+ isDev?: boolean;
8
+ meta?: {
9
+ label?: string;
10
+ description?: string;
11
+ /** Opaque server-authored metadata (icon, author, tags, ...). */
12
+ [key: string]: unknown;
13
+ };
14
+ /** Opaque server fields are preserved. */
15
+ [key: string]: unknown;
16
+ }
17
+ /** Settings of a plugin (config dict + optional code env name). */
18
+ export interface PluginSettings {
19
+ config?: Record<string, unknown>;
20
+ codeEnvName?: string;
21
+ [key: string]: unknown;
22
+ }
23
+ /** One usage entry of a plugin element, as returned by listUsages. */
24
+ export interface PluginUsage {
25
+ elementKind?: string;
26
+ elementType?: string;
27
+ objectId?: string;
28
+ objectType?: string;
29
+ projectKey?: string;
30
+ [key: string]: unknown;
31
+ }
32
+ /** One missing-type entry of a plugin usage analysis. */
33
+ export interface PluginMissingType {
34
+ missingType?: string;
35
+ objectId?: string;
36
+ objectType?: string;
37
+ projectKey?: string;
38
+ [key: string]: unknown;
39
+ }
40
+ export interface PluginUsageReport {
41
+ usages?: PluginUsage[];
42
+ missingTypes?: PluginMissingType[];
43
+ [key: string]: unknown;
44
+ }
45
+ /** Contents-tree item of a dev plugin (mirrors the library listing shape). */
46
+ export interface PluginContentItem {
47
+ name: string;
48
+ /** Full plugin-relative path as observed from DSS contents listings. */
49
+ path?: string;
50
+ mimeType?: string;
51
+ size?: number;
52
+ hasData?: boolean;
53
+ lastModified?: number;
54
+ children?: PluginContentItem[];
55
+ [key: string]: unknown;
56
+ }
57
+ /** Detail record of a single plugin file (`/plugins/{id}/details/{path}`). */
58
+ export interface PluginFileDetails {
59
+ name?: string;
60
+ path?: string;
61
+ mimeType?: string;
62
+ size?: number;
63
+ hasData?: boolean;
64
+ readOnly?: boolean;
65
+ lastModified?: number;
66
+ [key: string]: unknown;
67
+ }
68
+ /** Git remote info of a dev plugin (`repositoryUrl` is null when unset). */
69
+ export interface PluginGitRemote {
70
+ repositoryUrl: string | null;
71
+ [key: string]: unknown;
72
+ }
73
+ /** Options for creating a development plugin. */
74
+ export interface PluginCreateDevOptions {
75
+ pluginId: string;
76
+ creationMode: "EMPTY" | "GIT_CLONE" | "GIT_EXPORT";
77
+ gitRepository?: string;
78
+ gitCheckout?: string;
79
+ gitSubpath?: string;
80
+ }
81
+ /** Options for installing/updating a plugin from Git. */
82
+ export interface PluginGitInstallOptions {
83
+ gitRepositoryUrl: string;
84
+ gitCheckout?: string;
85
+ gitSubpath?: string;
86
+ }
87
+ /** Options for creating the code env of a plugin. */
88
+ export interface PluginCodeEnvCreateOptions {
89
+ conda?: boolean;
90
+ pythonInterpreter?: string;
91
+ }
92
+ /** Scope selectors for plugin settings and usage analysis. */
93
+ export interface PluginProjectScopeOptions {
94
+ projectKey?: string;
95
+ }
96
+ /**
97
+ * Validate a plugin identifier. Plugin ids select the API route segment, so a
98
+ * hostile id must not be able to change which resource the URL addresses.
99
+ */
100
+ export declare function validatePluginId(pluginId: string): string;
101
+ /**
102
+ * Validate and canonicalize a path inside a plugin. Mirrors the project
103
+ * library validator: rejects empty paths, control characters, backslashes,
104
+ * empty segments, '.'/'..' traversals, whitespace-only or edge-whitespace
105
+ * segments, and trailing dot/space segments.
106
+ *
107
+ * Returns the canonical path with any leading '/' stripped (the contents
108
+ * endpoints take paths relative to the plugin root).
109
+ */
110
+ export declare function validatePluginPath(path: string): string;
111
+ /**
112
+ * Validate a destination folder for a plugin contents move. '/' (the plugin
113
+ * root) is valid; any other path must pass {@link validatePluginPath}.
114
+ * Returns the canonical destination ('/' or '/<path>').
115
+ */
116
+ export declare function validatePluginDestinationPath(path: string): string;
117
+ /** Validate a rename target: a single plugin path segment, no '/'. */
118
+ export declare function validatePluginName(name: string): string;
119
+ /** Validate and URL-encode each segment of a plugin path for endpoint use. */
120
+ export declare function encodePluginPath(path: string): string;
121
+ /**
122
+ * The documented Plugins REST section (DSS 15): instance-level plugin
123
+ * administration under `/public/api/plugins/...`. All endpoints require admin
124
+ * or plugin-developer privileges server-side.
125
+ */
126
+ export declare class PluginsResource extends BaseResource {
127
+ /** List installed plugins (including dev plugins). */
128
+ list(): Promise<PluginSummary[]>;
129
+ /**
130
+ * Install a plugin from a local zip file. Fails if already installed.
131
+ * Resolves only after the installation completed: when DSS answers with a
132
+ * future receipt the future is settled before returning.
133
+ */
134
+ installFromZip(filePath: string): Promise<void>;
135
+ /** Install a plugin from the Dataiku store. Fails if already installed. */
136
+ installFromStore(pluginId: string): Promise<void>;
137
+ /** Install a plugin by checking out a Git repository. Fails if already installed. */
138
+ installFromGit(options: PluginGitInstallOptions): Promise<void>;
139
+ /** Download a development plugin as a zip archive. */
140
+ download(pluginId: string): Promise<Response>;
141
+ /**
142
+ * Update a plugin from a local zip file. Fails if not already installed.
143
+ * Resolves only after the update completed (future receipt settled).
144
+ */
145
+ updateFromZip(pluginId: string, filePath: string): Promise<void>;
146
+ /** Update a plugin from the Dataiku Store. */
147
+ updateFromStore(pluginId: string): Promise<void>;
148
+ /**
149
+ * Update an installed plugin from Git. Fails if the plugin is not already
150
+ * installed. Resolves only after the update completed (future settled).
151
+ */
152
+ updateFromGit(pluginId: string, options: PluginGitInstallOptions): Promise<void>;
153
+ /**
154
+ * Move an installed plugin to the development environment. Resolves only
155
+ * after the move completed (future receipt settled).
156
+ */
157
+ moveToDev(pluginId: string): Promise<void>;
158
+ /**
159
+ * Delete a plugin; refuses when usages exist unless `force` is set.
160
+ * Resolves only after the deletion completed: DSS answers this route with
161
+ * a future, so reporting success before the future settles would leave
162
+ * the plugin briefly present after the call returned.
163
+ */
164
+ delete(pluginId: string, options?: {
165
+ force?: boolean;
166
+ }): Promise<void>;
167
+ /** Get plugin settings (optionally scoped to a project). */
168
+ getSettings(pluginId: string, options?: PluginProjectScopeOptions): Promise<PluginSettings>;
169
+ /**
170
+ * Replace plugin settings. DSS expects a settings object previously
171
+ * obtained through {@link getSettings}; `config` and `codeEnvName` are
172
+ * the documented fields and any extra keys the caller read are forwarded.
173
+ */
174
+ setSettings(pluginId: string, settings: PluginSettings, options?: PluginProjectScopeOptions): Promise<void>;
175
+ /** List usages of the plugin's elements, optionally scoped to a project. */
176
+ listUsages(pluginId: string, options?: PluginProjectScopeOptions): Promise<PluginUsageReport>;
177
+ /**
178
+ * Create the code env of a plugin. Returns the DSS future handle
179
+ * (`{jobId}`). The request carries the plugin-managed deployment mode and
180
+ * an explicit interpreter (null = the plugin's default), exactly as the
181
+ * official Python client sends it.
182
+ */
183
+ createCodeEnv(pluginId: string, options?: PluginCodeEnvCreateOptions): Promise<{
184
+ jobId: string;
185
+ } & Record<string, unknown>>;
186
+ /** Update the code env of a plugin. Returns the DSS future handle. */
187
+ updateCodeEnv(pluginId: string): Promise<{
188
+ jobId: string;
189
+ } & Record<string, unknown>>;
190
+ /** Create a new development plugin (empty, cloned, or exported from Git). */
191
+ createDev(options: PluginCreateDevOptions): Promise<void>;
192
+ /** Get the Git remote declared for a dev plugin (null when unset). */
193
+ getGitRemote(pluginId: string): Promise<PluginGitRemote>;
194
+ /** Set (create or replace) the Git remote of a dev plugin. */
195
+ setGitRemote(pluginId: string, repositoryUrl: string): Promise<PluginGitRemote>;
196
+ /** Delete the Git remote declared for a dev plugin. */
197
+ deleteGitRemote(pluginId: string): Promise<void>;
198
+ /**
199
+ * List the Git branches of a dev plugin. Observed DSS 15 contract: GET
200
+ * `/plugins/{pluginId}/gitBranches` answers `200 ["master"]`. The upstream
201
+ * DSS 15 REST reference documents POST for this path, but the live API
202
+ * answers that POST with 405 Method Not Allowed (upstream method wrong);
203
+ * this SDK uses the observed GET, with no POST fallback.
204
+ */
205
+ listGitBranches(pluginId: string): Promise<string[]>;
206
+ /** Push the dev plugin's content to its previously-declared Git remote. */
207
+ push(pluginId: string): Promise<Record<string, unknown>>;
208
+ /** Pull (and rebase) the dev plugin's content from its Git remote. */
209
+ pull(pluginId: string): Promise<Record<string, unknown>>;
210
+ /** Fetch the dev plugin's content from its Git remote. */
211
+ fetch(pluginId: string): Promise<Record<string, unknown>>;
212
+ /** Reset the dev plugin to its local HEAD state (discards local edits). */
213
+ resetToLocalHeadState(pluginId: string): Promise<Record<string, unknown>>;
214
+ /** Reset the dev plugin to the remote HEAD state (discards local work). */
215
+ resetToRemoteHeadState(pluginId: string): Promise<Record<string, unknown>>;
216
+ private devGitAction;
217
+ /**
218
+ * Settle a plugin action's future receipt. Plugin action endpoints answer
219
+ * with `{jobId}` when DSS processes the action asynchronously, and with an
220
+ * empty or already-settled body for synchronous ones — the official
221
+ * Python client's `DSSFuture.from_resp` accepts a missing jobId and its
222
+ * `wait_for_result` treats a jobless state as already complete. A jobless
223
+ * receipt is returned as-is (no fake wait); a jobId is polled through the
224
+ * shared futures waiter so callers only observe completion.
225
+ */
226
+ private settleActionFuture;
227
+ /** List the contents tree of a dev plugin. */
228
+ listContents(pluginId: string): Promise<PluginContentItem[]>;
229
+ /**
230
+ * Read a dev plugin file as text. DSS answers this route with the raw file
231
+ * body (no JSON envelope, `dataEncoding` is not honored), so the response
232
+ * is read as text directly.
233
+ */
234
+ getFile(pluginId: string, path: string): Promise<string>;
235
+ /** Read a dev plugin file as raw bytes (same raw-body route as getFile). */
236
+ getFileBytes(pluginId: string, path: string): Promise<Uint8Array>;
237
+ /** Download a dev plugin file as a raw stream (binary-safe). */
238
+ downloadFile(pluginId: string, path: string): Promise<Response>;
239
+ /** Get a single plugin file's detail record (size, mime, timestamps). */
240
+ getFileDetails(pluginId: string, path: string): Promise<PluginFileDetails>;
241
+ /** Upload (create or replace) a dev plugin file with text or binary content. */
242
+ putFile(pluginId: string, path: string, content: string | Uint8Array): Promise<void>;
243
+ /** Delete a file (or folder) from a dev plugin. */
244
+ deleteFile(pluginId: string, path: string): Promise<void>;
245
+ /** Add a folder to a dev plugin. */
246
+ addFolder(pluginId: string, path: string): Promise<void>;
247
+ /** Rename a file or folder inside a dev plugin (same parent folder). */
248
+ rename(pluginId: string, path: string, newName: string): Promise<void>;
249
+ /** Move a file or folder inside a dev plugin. The destination folder must exist. */
250
+ move(pluginId: string, path: string, destinationFolderPath: string): Promise<void>;
251
+ private contentsPath;
252
+ }
253
+ /**
254
+ * Reject `https://user:token@host/repo` before it reaches DSS for plugin Git
255
+ * install/update/dev-create and the dev-plugin Git remote. Same policy as the
256
+ * project Git remotes: HTTP(S) URLs must not embed credentials; SSH and
257
+ * scp-style remotes stay allowed.
258
+ */
259
+ export declare function validatedPluginGitUrl(repository: string, field?: string): string;
260
+ /**
261
+ * True when a value is a usable plugin id shape without throwing — used by the
262
+ * CLI to decide which actions need a plugin id positional.
263
+ */
264
+ export declare function isPluginIdCandidate(value: unknown): boolean;
265
+ export { validateGitReferencePath, };