dataiku-sdk 2.0.0 → 3.1.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 (80) hide show
  1. package/LICENSE +107 -17
  2. package/README.md +144 -17
  3. package/dist/build-metadata.json +1 -1
  4. package/dist/packages/types/src/index.d.ts +39 -4
  5. package/dist/packages/types/src/index.js +31 -2
  6. package/dist/src/cli/commands/api-service.js +62 -16
  7. package/dist/src/cli/commands/bundle.js +49 -15
  8. package/dist/src/cli/commands/code-env.js +210 -49
  9. package/dist/src/cli/commands/code.d.ts +19 -0
  10. package/dist/src/cli/commands/code.js +87 -15
  11. package/dist/src/cli/commands/dataset.js +8 -3
  12. package/dist/src/cli/commands/flow-zone.js +33 -5
  13. package/dist/src/cli/commands/notebook.js +72 -41
  14. package/dist/src/cli/commands/project-git.js +8 -5
  15. package/dist/src/cli/commands/project-library.d.ts +21 -0
  16. package/dist/src/cli/commands/project-library.js +121 -50
  17. package/dist/src/cli/commands/project.js +16 -2
  18. package/dist/src/cli/commands/recipe.js +37 -12
  19. package/dist/src/cli/commands/sql.d.ts +10 -0
  20. package/dist/src/cli/commands/sql.js +39 -17
  21. package/dist/src/cli/commands/webapp.js +67 -13
  22. package/dist/src/cli/contract.d.ts +15 -0
  23. package/dist/src/cli/contract.js +870 -107
  24. package/dist/src/cli/env.d.ts +9 -0
  25. package/dist/src/cli/env.js +20 -2
  26. package/dist/src/cli/flags.js +9 -0
  27. package/dist/src/cli/helpers/cleanup.js +104 -3
  28. package/dist/src/cli/helpers/flow-zone.d.ts +3 -0
  29. package/dist/src/cli/helpers/flow-zone.js +33 -3
  30. package/dist/src/cli/helpers/recipe.d.ts +20 -0
  31. package/dist/src/cli/helpers/recipe.js +158 -3
  32. package/dist/src/cli/output.d.ts +2 -0
  33. package/dist/src/cli/output.js +33 -6
  34. package/dist/src/cli/runtime.d.ts +35 -1
  35. package/dist/src/cli/runtime.js +125 -18
  36. package/dist/src/cli/types.d.ts +7 -0
  37. package/dist/src/cli.js +135 -28
  38. package/dist/src/client.d.ts +60 -0
  39. package/dist/src/client.js +237 -42
  40. package/dist/src/errors.d.ts +8 -2
  41. package/dist/src/errors.js +40 -0
  42. package/dist/src/index.d.ts +4 -3
  43. package/dist/src/index.js +2 -1
  44. package/dist/src/resources/api-services.d.ts +48 -6
  45. package/dist/src/resources/api-services.js +54 -8
  46. package/dist/src/resources/bundles.d.ts +51 -6
  47. package/dist/src/resources/bundles.js +39 -9
  48. package/dist/src/resources/code-envs.d.ts +25 -3
  49. package/dist/src/resources/code-envs.js +104 -2
  50. package/dist/src/resources/datasets.d.ts +20 -0
  51. package/dist/src/resources/datasets.js +232 -52
  52. package/dist/src/resources/jobs.d.ts +35 -10
  53. package/dist/src/resources/jobs.js +92 -17
  54. package/dist/src/resources/notebooks.d.ts +77 -7
  55. package/dist/src/resources/notebooks.js +143 -19
  56. package/dist/src/resources/project-git.d.ts +12 -0
  57. package/dist/src/resources/project-git.js +39 -8
  58. package/dist/src/resources/project-library.d.ts +122 -7
  59. package/dist/src/resources/project-library.js +494 -25
  60. package/dist/src/resources/projects.d.ts +5 -2
  61. package/dist/src/resources/projects.js +18 -2
  62. package/dist/src/resources/scenarios.d.ts +30 -0
  63. package/dist/src/resources/scenarios.js +73 -27
  64. package/dist/src/resources/sql.d.ts +6 -0
  65. package/dist/src/resources/sql.js +22 -2
  66. package/dist/src/resources/webapps.d.ts +35 -4
  67. package/dist/src/resources/webapps.js +54 -5
  68. package/dist/src/schemas.d.ts +2 -2
  69. package/dist/src/schemas.js +1 -1
  70. package/dist/src/skill.d.ts +9 -0
  71. package/dist/src/skill.js +37 -4
  72. package/dist/src/utils/flow-analysis.d.ts +53 -0
  73. package/dist/src/utils/flow-analysis.js +382 -0
  74. package/dist/src/utils/project-archive.d.ts +41 -2
  75. package/dist/src/utils/project-archive.js +159 -16
  76. package/package.json +5 -5
  77. package/packages/types/dist/index.d.ts +39 -4
  78. package/packages/types/dist/index.js +31 -2
  79. package/plugin.json +2 -2
  80. package/skills/dataiku-dss/SKILL.md +75 -48
@@ -1,6 +1,16 @@
1
1
  import { BaseResource } from "./base.js";
2
2
  export interface ProjectLibraryItem {
3
3
  name: string;
4
+ /** Full library path of the item, as observed from DSS contents listings. */
5
+ path?: string;
6
+ /** File size in bytes, as observed from DSS contents listings. */
7
+ size?: number;
8
+ /** MIME type of the file content, as observed from DSS contents listings. */
9
+ mimeType?: string;
10
+ /** Whether the item carries data, as observed from DSS contents listings. */
11
+ hasData?: boolean;
12
+ /** Last modification timestamp (epoch milliseconds), as observed from DSS contents listings. */
13
+ lastModified?: number;
4
14
  children?: ProjectLibraryItem[];
5
15
  }
6
16
  export interface ProjectLibraryFileContent {
@@ -14,25 +24,130 @@ export interface ProjectLibraryMoveRequest {
14
24
  oldPath: string;
15
25
  newPath: string;
16
26
  }
27
+ export interface ProjectLibraryWriteOptions {
28
+ /**
29
+ * 64-character SHA-256 hex digest the caller last read from this file.
30
+ * Non-atomic stale-read guard: the write is refused when the remote
31
+ * content already differs at the verification read. It cannot prevent a
32
+ * concurrent write landing between that read and this write.
33
+ */
34
+ expectSha256?: string;
35
+ }
36
+ export interface ProjectLibraryWriteResult {
37
+ path: string;
38
+ /** Number of bytes written. */
39
+ bytes: number;
40
+ /** SHA-256 hex digest of the exact bytes written. */
41
+ sha256: string;
42
+ /** SHA-256 hex digest observed before the write; present when a precondition was checked. */
43
+ beforeSha256?: string;
44
+ }
45
+ export interface ProjectLibraryDiffOptions {
46
+ /** Cap on reported diff lines (default 200). */
47
+ maxLines?: number;
48
+ }
49
+ export interface ProjectLibraryDiffResult {
50
+ path: string;
51
+ /** True when remote and local content are byte-identical. */
52
+ unchanged: boolean;
53
+ /** Lines added in the local content relative to the remote file. */
54
+ added: number;
55
+ /** Lines removed from the remote file relative to the local content. */
56
+ removed: number;
57
+ /** Unified diff text; capped at `maxLines`. Empty for binary or byte-identical content. */
58
+ diff: string;
59
+ /** True when the diff text was truncated at `maxLines`. */
60
+ diffTruncated: boolean;
61
+ /** True when either side is not valid UTF-8 text; diff is never emitted for binary. */
62
+ binary?: boolean;
63
+ /** True when the remote file does not exist. */
64
+ remoteAbsent?: boolean;
65
+ remoteSha256?: string;
66
+ remoteBytes?: number;
67
+ localSha256: string;
68
+ localBytes: number;
69
+ maxLines: number;
70
+ }
71
+ /**
72
+ * The only concurrency control the public project-library API permits. DSS
73
+ * exposes no conditional write (no ETag, no If-Match, no version token), so
74
+ * `expectSha256` can only detect a hash that is already stale when it is
75
+ * checked; it can never turn the subsequent POST into a conditional write.
76
+ */
77
+ export declare const PROJECT_LIBRARY_CONCURRENCY_CONTROL = "client-side-non-atomic-stale-read-check";
78
+ /** Lowercase or uppercase SHA-256 hex digest. */
79
+ export declare const EXPECT_SHA256_PATTERN: RegExp;
80
+ /**
81
+ * Validate and canonicalize a project library path.
82
+ *
83
+ * Rejects empty paths, control characters, backslash separators, empty
84
+ * segments (leading/trailing/doubled '/'), '.'/'..' segments (including
85
+ * mid-path traversals), whitespace-only or edge-whitespace segments, and
86
+ * trailing dot/space segments that differ across filesystem normalizations.
87
+ *
88
+ * Returns the canonical path with any leading '/' prefix stripped (the DSS
89
+ * contents endpoints take paths relative to the library root).
90
+ */
91
+ export declare function validateLibraryPath(path: string): string;
92
+ /**
93
+ * Validate a rename target: a single library segment (no '/'), with the same
94
+ * character rules as path segments. Returns the validated name unchanged.
95
+ */
96
+ export declare function validateLibraryName(name: string): string;
97
+ /**
98
+ * Validate a destination folder path for a library move. '/' (the library
99
+ * root) is valid; any other path must pass {@link validateLibraryPath}.
100
+ * Returns the canonical destination ('/' or '/<path>').
101
+ */
102
+ export declare function validateLibraryDestinationPath(path: string): string;
103
+ /** Validate and URL-encode each segment of a library path for endpoint use. */
104
+ export declare function encodeLibraryPath(path: string): string;
17
105
  export declare class ProjectLibraryResource extends BaseResource {
18
- /** List the full project code-library contents tree. */
106
+ /**
107
+ * List the full project code-library contents tree. Items carry the DSS
108
+ * observed fields (path, size, mimeType, hasData, lastModified) when the
109
+ * server reports them; folders carry children, files do not.
110
+ */
19
111
  listContents(projectKey?: string): Promise<ProjectLibraryItem[]>;
20
112
  /** Read a project code-library file as text. */
21
113
  getFile(path: string, projectKey?: string): Promise<string>;
22
114
  /** Read a project code-library file as bytes. */
23
115
  getFileBytes(path: string, projectKey?: string): Promise<Uint8Array>;
24
- /** Create an empty project code-library file. */
116
+ /**
117
+ * True when a file or folder exists at the given library path. Existence is
118
+ * verified against the live contents tree read from DSS.
119
+ */
120
+ hasLibraryItem(path: string, projectKey?: string): Promise<boolean>;
121
+ /** Create an empty project code-library file; refuses to overwrite an existing item. */
25
122
  addFile(path: string, projectKey?: string): Promise<void>;
26
- /** Create a project code-library folder. */
123
+ /** Create a project code-library folder; refuses to overwrite an existing item. */
27
124
  addFolder(path: string, projectKey?: string): Promise<void>;
28
- /** Create or replace a project code-library file with raw text content. */
29
- addOrUpdateFile(path: string, content: string, projectKey?: string): Promise<void>;
30
- /** Delete a project code-library file. */
125
+ /**
126
+ * Create or replace a project code-library file with raw content. `content`
127
+ * may be a string (UTF-8 text) or raw bytes (binary-safe); the exact bytes
128
+ * sent are returned as a SHA-256 digest and byte count.
129
+ *
130
+ * When `options.expectSha256` is set, the current remote content is read
131
+ * first and the write is refused with an `assertion_failed` error when its
132
+ * SHA-256 differs. The check is non-atomic (see
133
+ * {@link PROJECT_LIBRARY_CONCURRENCY_CONTROL}).
134
+ */
135
+ addOrUpdateFile(path: string, content: string | Uint8Array, projectKey?: string, options?: ProjectLibraryWriteOptions): Promise<ProjectLibraryWriteResult>;
136
+ /**
137
+ * Diff a library file against local content. The remote side is read as
138
+ * bytes (so binary files are detected instead of dumped); the reported
139
+ * unified diff is capped at `options.maxLines` (default 200) and never
140
+ * contains binary payloads.
141
+ */
142
+ diffFile(path: string, local: string | Uint8Array, projectKey?: string, options?: ProjectLibraryDiffOptions): Promise<ProjectLibraryDiffResult>;
143
+ /** Delete a project code-library file or folder. */
31
144
  deleteFile(path: string, projectKey?: string): Promise<void>;
32
145
  /** Rename a project code-library file or folder within its current parent folder. */
33
146
  rename(path: string, newName: string, projectKey?: string): Promise<void>;
34
147
  /** Move a project code-library file or folder into another library folder. */
35
148
  move(path: string, destinationFolderPath: string, projectKey?: string): Promise<void>;
36
149
  private contentsPath;
37
- private postRawText;
150
+ private postRawBody;
151
+ private alreadyExistsError;
152
+ private assertLibraryFileAbsent;
38
153
  }