@databricks/sdk-workspacefiles 0.0.0-beta → 0.0.1

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 ADDED
@@ -0,0 +1,203 @@
1
+ Copyright 2026 Databricks, Inc. All rights reserved.
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright [yyyy] [name of copyright owner]
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
package/README.md CHANGED
@@ -1 +1,23 @@
1
- This is a placeholder release used to enable OIDC trusted publishing. Real code lands in a later version.
1
+ # @databricks/sdk-workspacefiles
2
+
3
+ > [!NOTE]
4
+ >
5
+ > ## Beta
6
+ >
7
+ > **This SDK is in Beta and is supported for production use cases.** Interfaces might still change slightly before GA (e.g. name standardization and minor ergonomic tweaks). We are keen to hear feedback from early adopters — please [file issues](https://github.com/databricks/sdk-js/issues), and we will address them.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @databricks/sdk-workspacefiles
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```typescript
18
+ import {WorkspaceFilesClient} from '@databricks/sdk-workspacefiles/v1';
19
+
20
+ const client = new WorkspaceFilesClient({});
21
+ ```
22
+
23
+ For a full getting-started guide, see the [root README](../../README.md).
@@ -0,0 +1,7 @@
1
+ //#region package.json
2
+ var name = "@databricks/sdk-workspacefiles";
3
+ var version = "0.0.1";
4
+
5
+ //#endregion
6
+ export { name, version };
7
+ //# sourceMappingURL=package.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -0,0 +1,59 @@
1
+ import { DeleteRequest, DeleteResponse, ExportRequest, ExportResponse, GetStatusRequest, ImportRequest, ImportResponse, ListRequest, ListResponse, MkdirsRequest, MkdirsResponse, ObjectInfo } from "./model.js";
2
+ import { CallOptions } from "@databricks/sdk-options/call";
3
+ import { ClientOptions } from "@databricks/sdk-options/client";
4
+
5
+ //#region src/v1/client.d.ts
6
+ declare class WorkspaceFilesClient {
7
+ private readonly options;
8
+ private readonly logger;
9
+ private readonly userAgent;
10
+ private config;
11
+ constructor(options: ClientOptions);
12
+ private resolveConfig;
13
+ /**
14
+ * Deletes an object or a directory (and optionally recursively deletes all objects in the directory).
15
+ * * If `path` does not exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`.
16
+ * * If `path` is a non-empty directory and `recursive` is set to `false`, this call returns an error `DIRECTORY_NOT_EMPTY`.
17
+ *
18
+ * Object deletion cannot be undone and deleting a directory recursively is not atomic.
19
+ */
20
+ delete(req: DeleteRequest, options?: CallOptions): Promise<DeleteResponse>;
21
+ /**
22
+ * Exports an object or the contents of an entire directory.
23
+ *
24
+ * If `path` does not exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`.
25
+ *
26
+ * If the exported data would exceed size limit, this call returns `MAX_NOTEBOOK_SIZE_EXCEEDED`.
27
+ * Currently, this API does not support exporting a library.
28
+ */
29
+ export(req: ExportRequest, options?: CallOptions): Promise<ExportResponse>;
30
+ /**
31
+ * Gets the status of an object or a directory.
32
+ * If `path` does not exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`.
33
+ */
34
+ getStatus(req: GetStatusRequest, options?: CallOptions): Promise<ObjectInfo>;
35
+ /**
36
+ * Imports a workspace object (for example, a notebook or file) or the contents of an entire directory.
37
+ * If `path` already exists and `overwrite` is set to `false`, this call returns an error `RESOURCE_ALREADY_EXISTS`.
38
+ * To import a directory, you can use either the `DBC` format or the `SOURCE` format with the `language` field unset.
39
+ * To import a single file as `SOURCE`, you must set the `language` field.
40
+ * Zip files within directories are not supported.
41
+ */
42
+ import(req: ImportRequest, options?: CallOptions): Promise<ImportResponse>;
43
+ /**
44
+ * Lists the contents of a directory, or the object if it is not a directory.
45
+ * If the input path does not exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`.
46
+ */
47
+ list(req: ListRequest, options?: CallOptions): Promise<ListResponse>;
48
+ /**
49
+ * Creates the specified directory (and necessary parent directories if they do not exist).
50
+ * If there is an object (not a directory) at any prefix of the input path, this call returns
51
+ * an error `RESOURCE_ALREADY_EXISTS`.
52
+ *
53
+ * Note that if this operation fails it may have succeeded in creating some of the necessary parent directories.
54
+ */
55
+ mkdirs(req: MkdirsRequest, options?: CallOptions): Promise<MkdirsResponse>;
56
+ }
57
+ //#endregion
58
+ export { WorkspaceFilesClient };
59
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","names":[],"sources":["../../src/v1/client.ts"],"mappings":";;;;;cAkDa,oBAAA;EAAA,iBACM,OAAA;EAAA,iBACA,MAAA;EAAA,iBAIA,SAAA;EAAA,QAIT,MAAA;cAEI,OAAA,EAAS,aAAA;EAAA,QAUb,aAAA;EAcI;;;;;;;EAFN,MAAA,CACJ,GAAA,EAAK,aAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,cAAA;EAgFC;;;;;;;;EA9CN,MAAA,CACJ,GAAA,EAAK,aAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,cAAA;EAmHkD;;;;EA1EvD,SAAA,CACJ,GAAA,EAAK,gBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,UAAA;EAsHR;;;;;;;EAhFG,MAAA,CACJ,GAAA,EAAK,aAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,cAAA;EAnJU;;;;EAiLf,IAAA,CAAK,GAAA,EAAK,WAAA,EAAa,OAAA,GAAU,WAAA,GAAc,OAAA,CAAQ,YAAA;EA1J3D;;;;;;;EAsMI,MAAA,CACJ,GAAA,EAAK,aAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,cAAA;AAAA"}
@@ -0,0 +1,201 @@
1
+ import { resolveClientConfig } from "./transport.js";
2
+ import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse } from "./utils.js";
3
+ import { name, version } from "../package.js";
4
+ import { marshalDeleteRequestSchema, marshalImportRequestSchema, marshalMkdirsRequestSchema, unmarshalDeleteResponseSchema, unmarshalExportResponseSchema, unmarshalImportResponseSchema, unmarshalListResponseSchema, unmarshalMkdirsResponseSchema, unmarshalObjectInfoSchema } from "./model.js";
5
+ import { VERSION } from "@databricks/sdk-auth";
6
+ import { createDefault } from "@databricks/sdk-core/clientinfo";
7
+ import { NoOpLogger } from "@databricks/sdk-core/logger";
8
+
9
+ //#region src/v1/client.ts
10
+ const PACKAGE_SEGMENT = {
11
+ key: "sdk-js-" + name.replace(/^@[^/]+\/sdk-/, ""),
12
+ value: version
13
+ };
14
+ var WorkspaceFilesClient = class {
15
+ options;
16
+ logger;
17
+ userAgent;
18
+ config;
19
+ constructor(options) {
20
+ this.options = options;
21
+ this.logger = options.logger ?? new NoOpLogger();
22
+ this.userAgent = createDefault().with(PACKAGE_SEGMENT).with({
23
+ key: "sdk-js-auth",
24
+ value: VERSION
25
+ }).with({
26
+ key: "auth",
27
+ value: options.credentials?.name() ?? "default"
28
+ }).toString();
29
+ }
30
+ resolveConfig() {
31
+ this.config ??= resolveClientConfig(this.options);
32
+ return this.config;
33
+ }
34
+ /**
35
+ * Deletes an object or a directory (and optionally recursively deletes all objects in the directory).
36
+ * * If `path` does not exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`.
37
+ * * If `path` is a non-empty directory and `recursive` is set to `false`, this call returns an error `DIRECTORY_NOT_EMPTY`.
38
+ *
39
+ * Object deletion cannot be undone and deleting a directory recursively is not atomic.
40
+ */
41
+ async delete(req, options) {
42
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
43
+ const url = `${host}/api/2.0/workspace/delete`;
44
+ const body = marshalRequest(req, marshalDeleteRequestSchema);
45
+ let resp;
46
+ const call = async (callSignal) => {
47
+ const headers = new Headers({ "Content-Type": "application/json" });
48
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
49
+ headers.set("User-Agent", this.userAgent);
50
+ resp = parseResponse(await executeHttpCall({
51
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
52
+ httpClient,
53
+ logger: this.logger
54
+ }), unmarshalDeleteResponseSchema);
55
+ };
56
+ await executeCall(call, options);
57
+ if (resp === void 0) throw new Error("operation completed without a result.");
58
+ return resp;
59
+ }
60
+ /**
61
+ * Exports an object or the contents of an entire directory.
62
+ *
63
+ * If `path` does not exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`.
64
+ *
65
+ * If the exported data would exceed size limit, this call returns `MAX_NOTEBOOK_SIZE_EXCEEDED`.
66
+ * Currently, this API does not support exporting a library.
67
+ */
68
+ async export(req, options) {
69
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
70
+ const url = `${host}/api/2.0/workspace/export`;
71
+ const params = new URLSearchParams();
72
+ if (req.path !== void 0) params.append("path", req.path);
73
+ if (req.format !== void 0) params.append("format", req.format);
74
+ if (req.directDownload !== void 0) params.append("direct_download", String(req.directDownload));
75
+ const query = params.toString();
76
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
77
+ let resp;
78
+ const call = async (callSignal) => {
79
+ const headers = new Headers();
80
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
81
+ headers.set("User-Agent", this.userAgent);
82
+ resp = parseResponse(await executeHttpCall({
83
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
84
+ httpClient,
85
+ logger: this.logger
86
+ }), unmarshalExportResponseSchema);
87
+ };
88
+ await executeCall(call, options);
89
+ if (resp === void 0) throw new Error("operation completed without a result.");
90
+ return resp;
91
+ }
92
+ /**
93
+ * Gets the status of an object or a directory.
94
+ * If `path` does not exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`.
95
+ */
96
+ async getStatus(req, options) {
97
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
98
+ const url = `${host}/api/2.0/workspace/get-status`;
99
+ const params = new URLSearchParams();
100
+ if (req.path !== void 0) params.append("path", req.path);
101
+ const query = params.toString();
102
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
103
+ let resp;
104
+ const call = async (callSignal) => {
105
+ const headers = new Headers();
106
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
107
+ headers.set("User-Agent", this.userAgent);
108
+ resp = parseResponse(await executeHttpCall({
109
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
110
+ httpClient,
111
+ logger: this.logger
112
+ }), unmarshalObjectInfoSchema);
113
+ };
114
+ await executeCall(call, options);
115
+ if (resp === void 0) throw new Error("operation completed without a result.");
116
+ return resp;
117
+ }
118
+ /**
119
+ * Imports a workspace object (for example, a notebook or file) or the contents of an entire directory.
120
+ * If `path` already exists and `overwrite` is set to `false`, this call returns an error `RESOURCE_ALREADY_EXISTS`.
121
+ * To import a directory, you can use either the `DBC` format or the `SOURCE` format with the `language` field unset.
122
+ * To import a single file as `SOURCE`, you must set the `language` field.
123
+ * Zip files within directories are not supported.
124
+ */
125
+ async import(req, options) {
126
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
127
+ const url = `${host}/api/2.0/workspace/import`;
128
+ const body = marshalRequest(req, marshalImportRequestSchema);
129
+ let resp;
130
+ const call = async (callSignal) => {
131
+ const headers = new Headers({ "Content-Type": "application/json" });
132
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
133
+ headers.set("User-Agent", this.userAgent);
134
+ resp = parseResponse(await executeHttpCall({
135
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
136
+ httpClient,
137
+ logger: this.logger
138
+ }), unmarshalImportResponseSchema);
139
+ };
140
+ await executeCall(call, options);
141
+ if (resp === void 0) throw new Error("operation completed without a result.");
142
+ return resp;
143
+ }
144
+ /**
145
+ * Lists the contents of a directory, or the object if it is not a directory.
146
+ * If the input path does not exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`.
147
+ */
148
+ async list(req, options) {
149
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
150
+ const url = `${host}/api/2.0/workspace/list`;
151
+ const params = new URLSearchParams();
152
+ if (req.path !== void 0) params.append("path", req.path);
153
+ if (req.notebooksModifiedAfter !== void 0) params.append("notebooks_modified_after", String(req.notebooksModifiedAfter));
154
+ const query = params.toString();
155
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
156
+ let resp;
157
+ const call = async (callSignal) => {
158
+ const headers = new Headers();
159
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
160
+ headers.set("User-Agent", this.userAgent);
161
+ resp = parseResponse(await executeHttpCall({
162
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
163
+ httpClient,
164
+ logger: this.logger
165
+ }), unmarshalListResponseSchema);
166
+ };
167
+ await executeCall(call, options);
168
+ if (resp === void 0) throw new Error("operation completed without a result.");
169
+ return resp;
170
+ }
171
+ /**
172
+ * Creates the specified directory (and necessary parent directories if they do not exist).
173
+ * If there is an object (not a directory) at any prefix of the input path, this call returns
174
+ * an error `RESOURCE_ALREADY_EXISTS`.
175
+ *
176
+ * Note that if this operation fails it may have succeeded in creating some of the necessary parent directories.
177
+ */
178
+ async mkdirs(req, options) {
179
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
180
+ const url = `${host}/api/2.0/workspace/mkdirs`;
181
+ const body = marshalRequest(req, marshalMkdirsRequestSchema);
182
+ let resp;
183
+ const call = async (callSignal) => {
184
+ const headers = new Headers({ "Content-Type": "application/json" });
185
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
186
+ headers.set("User-Agent", this.userAgent);
187
+ resp = parseResponse(await executeHttpCall({
188
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
189
+ httpClient,
190
+ logger: this.logger
191
+ }), unmarshalMkdirsResponseSchema);
192
+ };
193
+ await executeCall(call, options);
194
+ if (resp === void 0) throw new Error("operation completed without a result.");
195
+ return resp;
196
+ }
197
+ };
198
+
199
+ //#endregion
200
+ export { WorkspaceFilesClient };
201
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","names":["pkgJson.version","AUTH_VERSION"],"sources":["../../src/v1/client.ts"],"sourcesContent":["// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.\n\nimport {VERSION as AUTH_VERSION} from '@databricks/sdk-auth';\nimport {createDefault} from '@databricks/sdk-core/clientinfo';\nimport type {Logger} from '@databricks/sdk-core/logger';\nimport {NoOpLogger} from '@databricks/sdk-core/logger';\nimport type {CallOptions} from '@databricks/sdk-options/call';\nimport type {ClientOptions} from '@databricks/sdk-options/client';\nimport type {ResolvedClientConfig} from './transport';\nimport {resolveClientConfig} from './transport';\nimport {\n buildHttpRequest,\n executeCall,\n executeHttpCall,\n marshalRequest,\n parseResponse,\n} from './utils';\nimport pkgJson from '../../package.json' with {type: 'json'};\nimport type {\n DeleteRequest,\n DeleteResponse,\n ExportRequest,\n ExportResponse,\n GetStatusRequest,\n ImportRequest,\n ImportResponse,\n ListRequest,\n ListResponse,\n MkdirsRequest,\n MkdirsResponse,\n ObjectInfo,\n} from './model';\nimport {\n marshalDeleteRequestSchema,\n marshalImportRequestSchema,\n marshalMkdirsRequestSchema,\n unmarshalDeleteResponseSchema,\n unmarshalExportResponseSchema,\n unmarshalImportResponseSchema,\n unmarshalListResponseSchema,\n unmarshalMkdirsResponseSchema,\n unmarshalObjectInfoSchema,\n} from './model';\n\n// Package identity segment for this client to be used in the User-Agent header.\nconst PACKAGE_SEGMENT = {\n key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\\/sdk-/, ''),\n value: pkgJson.version,\n};\n\nexport class WorkspaceFilesClient {\n private readonly options: ClientOptions;\n private readonly logger: Logger;\n // User-Agent header value. Composed once at construction from\n // createDefault() merged with this package's identity and the active\n // credential's name.\n private readonly userAgent: string;\n // Memoized configuration. The profile is resolved once, lazily, on the first\n // request, then reused; host, workspaceId/accountId, and credentials are\n // filled from it when not set explicitly on the options.\n private config: Promise<ResolvedClientConfig> | undefined;\n\n constructor(options: ClientOptions) {\n this.options = options;\n this.logger = options.logger ?? new NoOpLogger();\n const info = createDefault()\n .with(PACKAGE_SEGMENT)\n .with({key: 'sdk-js-auth', value: AUTH_VERSION})\n .with({key: 'auth', value: options.credentials?.name() ?? 'default'});\n this.userAgent = info.toString();\n }\n\n private resolveConfig(): Promise<ResolvedClientConfig> {\n this.config ??= resolveClientConfig(this.options);\n return this.config;\n }\n\n /**\n * Deletes an object or a directory (and optionally recursively deletes all objects in the directory).\n * * If `path` does not exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`.\n * * If `path` is a non-empty directory and `recursive` is set to `false`, this call returns an error `DIRECTORY_NOT_EMPTY`.\n *\n * Object deletion cannot be undone and deleting a directory recursively is not atomic.\n */\n async delete(\n req: DeleteRequest,\n options?: CallOptions\n ): Promise<DeleteResponse> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/workspace/delete`;\n const body = marshalRequest(req, marshalDeleteRequestSchema);\n let resp: DeleteResponse | undefined;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers({'Content-Type': 'application/json'});\n if (workspaceId !== undefined) {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\n headers.set('User-Agent', this.userAgent);\n const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);\n const respBody = await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n resp = parseResponse(respBody, unmarshalDeleteResponseSchema);\n };\n await executeCall(call, options);\n if (resp === undefined) {\n throw new Error('operation completed without a result.');\n }\n return resp;\n }\n\n /**\n * Exports an object or the contents of an entire directory.\n *\n * If `path` does not exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`.\n *\n * If the exported data would exceed size limit, this call returns `MAX_NOTEBOOK_SIZE_EXCEEDED`.\n * Currently, this API does not support exporting a library.\n */\n async export(\n req: ExportRequest,\n options?: CallOptions\n ): Promise<ExportResponse> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/workspace/export`;\n const params = new URLSearchParams();\n if (req.path !== undefined) {\n params.append('path', req.path);\n }\n if (req.format !== undefined) {\n params.append('format', req.format);\n }\n if (req.directDownload !== undefined) {\n params.append('direct_download', String(req.directDownload));\n }\n const query = params.toString();\n const fullUrl = query !== '' ? `${url}?${query}` : url;\n let resp: ExportResponse | undefined;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers();\n if (workspaceId !== undefined) {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\n headers.set('User-Agent', this.userAgent);\n const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);\n const respBody = await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n resp = parseResponse(respBody, unmarshalExportResponseSchema);\n };\n await executeCall(call, options);\n if (resp === undefined) {\n throw new Error('operation completed without a result.');\n }\n return resp;\n }\n\n /**\n * Gets the status of an object or a directory.\n * If `path` does not exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`.\n */\n async getStatus(\n req: GetStatusRequest,\n options?: CallOptions\n ): Promise<ObjectInfo> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/workspace/get-status`;\n const params = new URLSearchParams();\n if (req.path !== undefined) {\n params.append('path', req.path);\n }\n const query = params.toString();\n const fullUrl = query !== '' ? `${url}?${query}` : url;\n let resp: ObjectInfo | undefined;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers();\n if (workspaceId !== undefined) {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\n headers.set('User-Agent', this.userAgent);\n const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);\n const respBody = await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n resp = parseResponse(respBody, unmarshalObjectInfoSchema);\n };\n await executeCall(call, options);\n if (resp === undefined) {\n throw new Error('operation completed without a result.');\n }\n return resp;\n }\n\n /**\n * Imports a workspace object (for example, a notebook or file) or the contents of an entire directory.\n * If `path` already exists and `overwrite` is set to `false`, this call returns an error `RESOURCE_ALREADY_EXISTS`.\n * To import a directory, you can use either the `DBC` format or the `SOURCE` format with the `language` field unset.\n * To import a single file as `SOURCE`, you must set the `language` field.\n * Zip files within directories are not supported.\n */\n async import(\n req: ImportRequest,\n options?: CallOptions\n ): Promise<ImportResponse> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/workspace/import`;\n const body = marshalRequest(req, marshalImportRequestSchema);\n let resp: ImportResponse | undefined;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers({'Content-Type': 'application/json'});\n if (workspaceId !== undefined) {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\n headers.set('User-Agent', this.userAgent);\n const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);\n const respBody = await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n resp = parseResponse(respBody, unmarshalImportResponseSchema);\n };\n await executeCall(call, options);\n if (resp === undefined) {\n throw new Error('operation completed without a result.');\n }\n return resp;\n }\n\n /**\n * Lists the contents of a directory, or the object if it is not a directory.\n * If the input path does not exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`.\n */\n async list(req: ListRequest, options?: CallOptions): Promise<ListResponse> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/workspace/list`;\n const params = new URLSearchParams();\n if (req.path !== undefined) {\n params.append('path', req.path);\n }\n if (req.notebooksModifiedAfter !== undefined) {\n params.append(\n 'notebooks_modified_after',\n String(req.notebooksModifiedAfter)\n );\n }\n const query = params.toString();\n const fullUrl = query !== '' ? `${url}?${query}` : url;\n let resp: ListResponse | undefined;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers();\n if (workspaceId !== undefined) {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\n headers.set('User-Agent', this.userAgent);\n const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);\n const respBody = await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n resp = parseResponse(respBody, unmarshalListResponseSchema);\n };\n await executeCall(call, options);\n if (resp === undefined) {\n throw new Error('operation completed without a result.');\n }\n return resp;\n }\n\n /**\n * Creates the specified directory (and necessary parent directories if they do not exist).\n * If there is an object (not a directory) at any prefix of the input path, this call returns\n * an error `RESOURCE_ALREADY_EXISTS`.\n *\n * Note that if this operation fails it may have succeeded in creating some of the necessary parent directories.\n */\n async mkdirs(\n req: MkdirsRequest,\n options?: CallOptions\n ): Promise<MkdirsResponse> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/workspace/mkdirs`;\n const body = marshalRequest(req, marshalMkdirsRequestSchema);\n let resp: MkdirsResponse | undefined;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers({'Content-Type': 'application/json'});\n if (workspaceId !== undefined) {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\n headers.set('User-Agent', this.userAgent);\n const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);\n const respBody = await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n resp = parseResponse(respBody, unmarshalMkdirsResponseSchema);\n };\n await executeCall(call, options);\n if (resp === undefined) {\n throw new Error('operation completed without a result.');\n }\n return resp;\n }\n}\n"],"mappings":";;;;;;;;;AA6CA,MAAM,kBAAkB;CACtB,KAAK,iBAAyB,QAAQ,iBAAiB,GAAG;CAC1D,OAAOA;CACR;AAED,IAAa,uBAAb,MAAkC;CAChC,AAAiB;CACjB,AAAiB;CAIjB,AAAiB;CAIjB,AAAQ;CAER,YAAY,SAAwB;AAClC,OAAK,UAAU;AACf,OAAK,SAAS,QAAQ,UAAU,IAAI,YAAY;AAKhD,OAAK,YAJQ,eAAe,CACzB,KAAK,gBAAgB,CACrB,KAAK;GAAC,KAAK;GAAe,OAAOC;GAAa,CAAC,CAC/C,KAAK;GAAC,KAAK;GAAQ,OAAO,QAAQ,aAAa,MAAM,IAAI;GAAU,CAAC,CACjD,UAAU;;CAGlC,AAAQ,gBAA+C;A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BAA2B;EAC5D,IAAI;EACJ,MAAM,OAAO,OAAO,eAA4C;GAC9D,MAAM,UAAU,IAAI,QAAQ,EAAC,gBAAgB,oBAAmB,CAAC;AACjE,OAAI,gBAAgB,OAClB,SAAQ,IAAI,6BAA6B,YAAY;AAEvD,WAAQ,IAAI,cAAc,KAAK,UAAU;AAOzC,UAAO,cALU,MAAM,gBAAgB;IACrC,SAFc,iBAAiB,QAAQ,KAAK,SAAS,YAAY,KAAK;IAGtE;IACA,QAAQ,KAAK;IACd,CAAC,EAC6B,8BAA8B;;AAE/D,QAAM,YAAY,MAAM,QAAQ;AAChC,MAAI,SAAS,OACX,OAAM,IAAI,MAAM,wCAAwC;AAE1D,SAAO"}
@@ -0,0 +1,3 @@
1
+ import { DeleteRequest, DeleteResponse, DirectoryInfo, ExportFormat, ExportRequest, ExportResponse, GetStatusRequest, ImportRequest, ImportResponse, Language, ListRequest, ListResponse, MkdirsRequest, MkdirsResponse, ObjectInfo, ObjectType } from "./model.js";
2
+ import { WorkspaceFilesClient } from "./client.js";
3
+ export { type DeleteRequest, type DeleteResponse, type DirectoryInfo, ExportFormat, type ExportRequest, type ExportResponse, type GetStatusRequest, type ImportRequest, type ImportResponse, Language, type ListRequest, type ListResponse, type MkdirsRequest, type MkdirsResponse, type ObjectInfo, ObjectType, WorkspaceFilesClient };
@@ -0,0 +1,4 @@
1
+ import { ExportFormat, Language, ObjectType } from "./model.js";
2
+ import { WorkspaceFilesClient } from "./client.js";
3
+
4
+ export { ExportFormat, Language, ObjectType, WorkspaceFilesClient };
@@ -0,0 +1,204 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/v1/model.d.ts
4
+ /** The format for workspace import and export. */
5
+ declare const ExportFormat: {
6
+ /** The notebook will be imported/exported as source code. */readonly SOURCE: "SOURCE"; /** The notebook will be imported/exported as an HTML file. */
7
+ readonly HTML: "HTML"; /** The notebook will be imported/exported as a Jupyter/IPython Notebook file. */
8
+ readonly JUPYTER: "JUPYTER"; /** The notebook will be imported/exported as Databricks archive format. */
9
+ readonly DBC: "DBC"; /** The notebook will be imported/exported as a R Markdown document. */
10
+ readonly R_MARKDOWN: "R_MARKDOWN"; /** We will inspect the content of the payload to determine the type */
11
+ readonly AUTO: "AUTO";
12
+ /**
13
+ * This is introduced to unblock a DR use case importing .zip file as is.
14
+ * If you import .zip file with AUTO format, it will be imported as a folder.
15
+ * In workspace 3.0 folder import will be supported via a different API.
16
+ */
17
+ readonly RAW: "RAW";
18
+ };
19
+ type ExportFormat = (typeof ExportFormat)[keyof typeof ExportFormat] | (string & {});
20
+ /** The language of notebook. */
21
+ declare const Language: {
22
+ /** Scala notebook. */readonly SCALA: "SCALA"; /** Python notebook. */
23
+ readonly PYTHON: "PYTHON"; /** SQL notebook. */
24
+ readonly SQL: "SQL"; /** R notebook. */
25
+ readonly R: "R";
26
+ };
27
+ type Language = (typeof Language)[keyof typeof Language] | (string & {});
28
+ /** The type of the object in workspace. */
29
+ declare const ObjectType: {
30
+ /**
31
+ * As of 2023-10 this is used only by list-repo API so that repos can gracefully handle errors
32
+ * for unsupported types.
33
+ */
34
+ readonly OBJECT_TYPE_UNSPECIFIED: "OBJECT_TYPE_UNSPECIFIED";
35
+ readonly NOTEBOOK: "NOTEBOOK";
36
+ readonly DIRECTORY: "DIRECTORY";
37
+ readonly LIBRARY: "LIBRARY";
38
+ readonly FILE: "FILE";
39
+ readonly REPO: "REPO";
40
+ /**
41
+ * Lakeview Dashboard. Using this since DBSQL dashboards will be deprecated soon and are planning
42
+ * on using the dbsql_dashboard prefix in permissions APIs
43
+ */
44
+ readonly DASHBOARD: "DASHBOARD";
45
+ };
46
+ type ObjectType = (typeof ObjectType)[keyof typeof ObjectType] | (string & {});
47
+ interface DeleteRequest {
48
+ /** The absolute path of the notebook or directory. */
49
+ path?: string | undefined;
50
+ /**
51
+ * The flag that specifies whether to delete the object recursively. It is `false` by default.
52
+ * Please note this deleting directory is not atomic. If it fails in the middle, some of objects
53
+ * under this directory may be deleted and cannot be undone.
54
+ */
55
+ recursive?: boolean | undefined;
56
+ }
57
+ interface DeleteResponse {}
58
+ /** Additional metadata about a directory. */
59
+ interface DirectoryInfo {
60
+ /**
61
+ * Whether the directory is a Git folder, whose contents are version-controlled by a remote Git
62
+ * repository. How a Git folder is represented depends on whether it has Git CLI access:
63
+ *
64
+ * - A Git folder with Git CLI access has an object type of ``DIRECTORY``, with this field set
65
+ * to ``true``.
66
+ * - A standard Git folder, which does not have Git CLI access, has an object type of ``REPO``
67
+ * and does not include this field.
68
+ * - A directory that is not Git-backed has this field set to ``false``.
69
+ *
70
+ * Use this field together with ``object_type`` to identify every Git folder in a workspace.
71
+ */
72
+ isGitFolder?: boolean | undefined;
73
+ }
74
+ interface ExportRequest {
75
+ /** The absolute path of the object or directory. Exporting a directory is only supported for the `DBC`, `SOURCE`, and `AUTO` format. */
76
+ path?: string | undefined;
77
+ /**
78
+ * This specifies the format of the exported file. By default, this is `SOURCE`.
79
+ *
80
+ * The value is case sensitive.
81
+ *
82
+ * - `SOURCE`: The notebook is exported as source code. Directory exports will not include non-notebook entries.
83
+ * - `HTML`: The notebook is exported as an HTML file.
84
+ * - `JUPYTER`: The notebook is exported as a Jupyter/IPython Notebook file.
85
+ * - `DBC`: The notebook is exported in <Databricks> archive format. Directory exports will not include non-notebook entries.
86
+ * - `R_MARKDOWN`: The notebook is exported to R Markdown format.
87
+ * - `AUTO`: The object or directory is exported depending on the objects type. Directory exports will include notebooks and workspace files.
88
+ */
89
+ format?: ExportFormat | undefined;
90
+ /**
91
+ * Flag to enable direct download. If it is `true`, the response is the exported file itself.
92
+ * Otherwise, by default, the response contains content in the form of a base64 encoded string.
93
+ */
94
+ directDownload?: boolean | undefined;
95
+ }
96
+ /** The request field `direct_download` determines whether a JSON response or binary contents are returned by this endpoint. */
97
+ interface ExportResponse {
98
+ /**
99
+ * The base64-encoded content.
100
+ * If the limit (10MB) is exceeded, exception with error code **MAX_NOTEBOOK_SIZE_EXCEEDED** is thrown.
101
+ */
102
+ content?: Uint8Array | undefined;
103
+ /** The file type of the exported file. */
104
+ fileType?: string | undefined;
105
+ }
106
+ interface GetStatusRequest {
107
+ /** The absolute path of the notebook or directory. */
108
+ path?: string | undefined;
109
+ }
110
+ interface ImportRequest {
111
+ /** The absolute path of the object or directory. Importing a directory is only supported for the `DBC` and `SOURCE` formats. */
112
+ path?: string | undefined;
113
+ /**
114
+ * This specifies the format of the file to be imported.
115
+ *
116
+ * The value is case sensitive.
117
+ *
118
+ * - `AUTO`: The item is imported depending on an analysis of the item's extension and
119
+ * the header content provided in the request. If the item is imported as a notebook,
120
+ * then the item's extension is automatically removed.
121
+ * - `SOURCE`: The notebook or directory is imported as source code.
122
+ * - `HTML`: The notebook is imported as an HTML file.
123
+ * - `JUPYTER`: The notebook is imported as a Jupyter/IPython Notebook file.
124
+ * - `DBC`: The notebook is imported in <Databricks> archive format. Required for directories.
125
+ * - `R_MARKDOWN`: The notebook is imported from R Markdown format.
126
+ */
127
+ format?: ExportFormat | undefined;
128
+ /** The language of the object. This value is set only if the object type is `NOTEBOOK`. */
129
+ language?: Language | undefined;
130
+ /**
131
+ * The base64-encoded content. This has a limit of 10 MB.
132
+ *
133
+ * If the limit (10MB) is exceeded, exception with error code **MAX_NOTEBOOK_SIZE_EXCEEDED** is thrown.
134
+ * This parameter might be absent, and instead a posted file is used.
135
+ */
136
+ content?: Uint8Array | undefined;
137
+ /**
138
+ * The flag that specifies whether to overwrite existing object. It is `false` by default.
139
+ * For `DBC` format, `overwrite` is not supported since it may contain a directory.
140
+ */
141
+ overwrite?: boolean | undefined;
142
+ }
143
+ interface ImportResponse {}
144
+ interface ListRequest {
145
+ /** The absolute path of the notebook or directory. */
146
+ path?: string | undefined;
147
+ /** UTC timestamp in milliseconds */
148
+ notebooksModifiedAfter?: bigint | undefined;
149
+ }
150
+ interface ListResponse {
151
+ /** List of objects. */
152
+ objects?: ObjectInfo[] | undefined;
153
+ }
154
+ interface MkdirsRequest {
155
+ /**
156
+ * The absolute path of the directory. If the parent directories do not exist, it will also create them.
157
+ * If the directory already exists, this command will do nothing and succeed.
158
+ */
159
+ path?: string | undefined;
160
+ }
161
+ interface MkdirsResponse {}
162
+ /** The information of the object in workspace. It will be returned by ``list`` and ``get-status``. */
163
+ interface ObjectInfo {
164
+ /**
165
+ * The type of the object in workspace.
166
+ *
167
+ * - `NOTEBOOK`: document that contains runnable code, visualizations, and explanatory text.
168
+ * - `DIRECTORY`: directory
169
+ * - `LIBRARY`: library
170
+ * - `FILE`: file
171
+ * - `REPO`: repository
172
+ * - `DASHBOARD`: Lakeview dashboard
173
+ */
174
+ objectType?: ObjectType | undefined;
175
+ /** The absolute path of the object. */
176
+ path?: string | undefined;
177
+ /** The language of the object. This value is set only if the object type is ``NOTEBOOK``. For Jupyter (.ipynb) notebooks, this is always ``PYTHON``. */
178
+ language?: Language | undefined;
179
+ /** Only applicable to files. The creation UTC timestamp. */
180
+ createdAt?: bigint | undefined;
181
+ /** Only applicable to files, the last modified UTC timestamp. */
182
+ modifiedAt?: bigint | undefined;
183
+ /** Unique identifier for the object. */
184
+ objectId?: bigint | undefined;
185
+ /** Only applicable to files. The file size in bytes can be returned. */
186
+ size?: bigint | undefined;
187
+ /** A unique identifier for the object that is consistent across all Databricks APIs. */
188
+ resourceId?: string | undefined;
189
+ /** Additional metadata about the directory. Only set for objects of type ``DIRECTORY``. */
190
+ directoryInfo?: DirectoryInfo | undefined;
191
+ }
192
+ declare const unmarshalDeleteResponseSchema: z.ZodType<DeleteResponse>;
193
+ declare const unmarshalDirectoryInfoSchema: z.ZodType<DirectoryInfo>;
194
+ declare const unmarshalExportResponseSchema: z.ZodType<ExportResponse>;
195
+ declare const unmarshalImportResponseSchema: z.ZodType<ImportResponse>;
196
+ declare const unmarshalListResponseSchema: z.ZodType<ListResponse>;
197
+ declare const unmarshalMkdirsResponseSchema: z.ZodType<MkdirsResponse>;
198
+ declare const unmarshalObjectInfoSchema: z.ZodType<ObjectInfo>;
199
+ declare const marshalDeleteRequestSchema: z.ZodType;
200
+ declare const marshalImportRequestSchema: z.ZodType;
201
+ declare const marshalMkdirsRequestSchema: z.ZodType;
202
+ //#endregion
203
+ export { DeleteRequest, DeleteResponse, DirectoryInfo, ExportFormat, ExportRequest, ExportResponse, GetStatusRequest, ImportRequest, ImportResponse, Language, ListRequest, ListResponse, MkdirsRequest, MkdirsResponse, ObjectInfo, ObjectType, marshalDeleteRequestSchema, marshalImportRequestSchema, marshalMkdirsRequestSchema, unmarshalDeleteResponseSchema, unmarshalDirectoryInfoSchema, unmarshalExportResponseSchema, unmarshalImportResponseSchema, unmarshalListResponseSchema, unmarshalMkdirsResponseSchema, unmarshalObjectInfoSchema };
204
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","names":[],"sources":["../../src/v1/model.ts"],"mappings":";;;;cAMa,YAAA;EAAA;;;;;;;AAoBb;;;;;;KAAY,YAAA,WACA,YAAA,eAA2B,YAAA;;cAK1B,QAAA;;;uBAUD;EAAA;;KAAA,QAAA,WAAmB,QAAA,eAAuB,QAAA;;cAIzC,UAAA;EAgBH;;;;EAAA;;;;;;;;AACV;;;;KAAY,UAAA,WACA,UAAA,eAAyB,UAAA;AAAA,UAGpB,aAAA;EAAa;EAE5B,IAAA;EAAA;;AAUF;;;EAJE,SAAA;AAAA;AAAA,UAIe,cAAA;;UAGA,aAAA;EAaJ;AAGb;;;;;;;;;;AAwBA;EA3BE,WAAA;AAAA;AAAA,UAGe,aAAA;EA6Bf;EA3BA,IAAA;EA6BA;;;AAGF;;;;;AAKA;;;;EAxBE,MAAA,GAAS,YAAA;EAkDC;;;;EA7CV,cAAA;AAAA;;UAIe,cAAA;EAyCf;;;;EApCA,OAAA,GAAU,UAAA;EA6CK;EA3Cf,QAAA;AAAA;AAAA,UAGe,gBAAA;EAwCc;EAtC7B,IAAA;AAAA;AAAA,UAGe,aAAA;EAuCf;EArCA,IAAA;EA0Ce;;;;;AAKjB;;;;;AASA;;;;EAzCE,MA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
6
+ SOURCE: "SOURCE",
7
+ HTML: "HTML",
8
+ JUPYTER: "JUPYTER",
9
+ DBC: "DBC",
10
+ R_MARKDOWN: "R_MARKDOWN",
11
+ AUTO: "AUTO",
12
+ RAW: "RAW"
13
+ };
14
+ /** The language of notebook. */
15
+ const Language = {
16
+ SCALA: "SCALA",
17
+ PYTHON: "PYTHON",
18
+ SQL: "SQL",
19
+ R: "R"
20
+ };
21
+ /** The type of the object in workspace. */
22
+ const ObjectType = {
23
+ OBJECT_TYPE_UNSPECIFIED: "OBJECT_TYPE_UNSPECIFIED",
24
+ NOTEBOOK: "NOTEBOOK",
25
+ DIRECTORY: "DIRECTORY",
26
+ LIBRARY: "LIBRARY",
27
+ FILE: "FILE",
28
+ REPO: "REPO",
29
+ DASHBOARD: "DASHBOARD"
30
+ };
31
+ const unmarshalDeleteResponseSchema = z.object({});
32
+ const unmarshalDirectoryInfoSchema = z.object({ is_git_folder: z.boolean().optional() }).transform((d) => ({ isGitFolder: d.is_git_folder }));
33
+ const unmarshalExportResponseSchema = z.object({
34
+ content: z.string().transform((s) => Uint8Array.from(atob(s), (c) => c.charCodeAt(0))).optional(),
35
+ file_type: z.string().optional()
36
+ }).transform((d) => ({
37
+ content: d.content,
38
+ fileType: d.file_type
39
+ }));
40
+ const unmarshalImportResponseSchema = z.object({});
41
+ const unmarshalListResponseSchema = z.object({ objects: z.array(z.lazy(() => unmarshalObjectInfoSchema)).optional() }).transform((d) => ({ objects: d.objects }));
42
+ const unmarshalMkdirsResponseSchema = z.object({});
43
+ const unmarshalObjectInfoSchema = z.object({
44
+ object_type: z.string().optional(),
45
+ path: z.string().optional(),
46
+ language: z.string().optional(),
47
+ created_at: z.union([
48
+ z.number(),
49
+ z.bigint(),
50
+ z.string()
51
+ ]).transform((v) => BigInt(v)).optional(),
52
+ modified_at: z.union([
53
+ z.number(),
54
+ z.bigint(),
55
+ z.string()
56
+ ]).transform((v) => BigInt(v)).optional(),
57
+ object_id: z.union([
58
+ z.number(),
59
+ z.bigint(),
60
+ z.string()
61
+ ]).transform((v) => BigInt(v)).optional(),
62
+ size: z.union([
63
+ z.number(),
64
+ z.bigint(),
65
+ z.string()
66
+ ]).transform((v) => BigInt(v)).optional(),
67
+ resource_id: z.string().optional(),
68
+ directory_info: z.lazy(() => unmarshalDirectoryInfoSchema).optional()
69
+ }).transform((d) => ({
70
+ objectType: d.object_type,
71
+ path: d.path,
72
+ language: d.language,
73
+ createdAt: d.created_at,
74
+ modifiedAt: d.modified_at,
75
+ objectId: d.object_id,
76
+ size: d.size,
77
+ resourceId: d.resource_id,
78
+ directoryInfo: d.directory_info
79
+ }));
80
+ const marshalDeleteRequestSchema = z.object({
81
+ path: z.string().optional(),
82
+ recursive: z.boolean().optional()
83
+ }).transform((d) => ({
84
+ path: d.path,
85
+ recursive: d.recursive
86
+ }));
87
+ const marshalImportRequestSchema = z.object({
88
+ path: z.string().optional(),
89
+ format: z.string().optional(),
90
+ language: z.string().optional(),
91
+ content: z.any().transform((d) => btoa(Array.from(d, (b) => String.fromCharCode(b)).join(""))).optional(),
92
+ overwrite: z.boolean().optional()
93
+ }).transform((d) => ({
94
+ path: d.path,
95
+ format: d.format,
96
+ language: d.language,
97
+ content: d.content,
98
+ overwrite: d.overwrite
99
+ }));
100
+ const marshalMkdirsRequestSchema = z.object({ path: z.string().optional() }).transform((d) => ({ path: d.path }));
101
+
102
+ //#endregion
103
+ export { ExportFormat, Language, ObjectType, marshalDeleteRequestSchema, marshalImportRequestSchema, marshalMkdirsRequestSchema, unmarshalDeleteResponseSchema, unmarshalDirectoryInfoSchema, unmarshalExportResponseSchema, unmarshalImportResponseSchema, unmarshalListResponseSchema, unmarshalMkdirsResponseSchema, unmarshalObjectInfoSchema };
104
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","names":[],"sources":["../../src/v1/model.ts"],"sourcesContent":["// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.\n\nimport {z} from 'zod';\n\n/** The format for workspace import and export. */\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.\nexport const ExportFormat = {\n /** The notebook will be imported/exported as source code. */\n SOURCE: 'SOURCE',\n /** The notebook will be imported/exported as an HTML file. */\n HTML: 'HTML',\n /** The notebook will be imported/exported as a Jupyter/IPython Notebook file. */\n JUPYTER: 'JUPYTER',\n /** The notebook will be imported/exported as Databricks archive format. */\n DBC: 'DBC',\n /** The notebook will be imported/exported as a R Markdown document. */\n R_MARKDOWN: 'R_MARKDOWN',\n /** We will inspect the content of the payload to determine the type */\n AUTO: 'AUTO',\n /**\n * This is introduced to unblock a DR use case importing .zip file as is.\n * If you import .zip file with AUTO format, it will be imported as a folder.\n * In workspace 3.0 folder import will be supported via a different API.\n */\n RAW: 'RAW',\n} as const;\nexport type ExportFormat =\n | (typeof ExportFormat)[keyof typeof ExportFormat]\n | (string & {});\n\n/** The language of notebook. */\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.\nexport const Language = {\n /** Scala notebook. */\n SCALA: 'SCALA',\n /** Python notebook. */\n PYTHON: 'PYTHON',\n /** SQL notebook. */\n SQL: 'SQL',\n /** R notebook. */\n R: 'R',\n} as const;\nexport type Language = (typeof Language)[keyof typeof Language] | (string & {});\n\n/** The type of the object in workspace. */\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.\nexport const ObjectType = {\n /**\n * As of 2023-10 this is used only by list-repo API so that repos can gracefully handle errors\n * for unsupported types.\n */\n OBJECT_TYPE_UNSPECIFIED: 'OBJECT_TYPE_UNSPECIFIED',\n NOTEBOOK: 'NOTEBOOK',\n DIRECTORY: 'DIRECTORY',\n LIBRARY: 'LIBRARY',\n FILE: 'FILE',\n REPO: 'REPO',\n /**\n * Lakeview Dashboard. Using this since DBSQL dashboards will be deprecated soon and are planning\n * on using the dbsql_dashboard prefix in permissions APIs\n */\n DASHBOARD: 'DASHBOARD',\n} as const;\nexport type ObjectType =\n | (typeof ObjectType)[keyof typeof ObjectType]\n | (string & {});\n\nexport interface DeleteRequest {\n /** The absolute path of the notebook or directory. */\n path?: string | undefined;\n /**\n * The flag that specifies whether to delete the object recursively. It is `false` by default.\n * Please note this deleting directory is not atomic. If it fails in the middle, some of objects\n * under this directory may be deleted and cannot be undone.\n */\n recursive?: boolean | undefined;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface DeleteResponse {}\n\n/** Additional metadata about a directory. */\nexport interface DirectoryInfo {\n /**\n * Whether the directory is a Git folder, whose contents are version-controlled by a remote Git\n * repository. How a Git folder is represented depends on whether it has Git CLI access:\n *\n * - A Git folder with Git CLI access has an object type of ``DIRECTORY``, with this field set\n * to ``true``.\n * - A standard Git folder, which does not have Git CLI access, has an object type of ``REPO``\n * and does not include this field.\n * - A directory that is not Git-backed has this field set to ``false``.\n *\n * Use this field together with ``object_type`` to identify every Git folder in a workspace.\n */\n isGitFolder?: boolean | undefined;\n}\n\nexport interface ExportRequest {\n /** The absolute path of the object or directory. Exporting a directory is only supported for the `DBC`, `SOURCE`, and `AUTO` format. */\n path?: string | undefined;\n /**\n * This specifies the format of the exported file. By default, this is `SOURCE`.\n *\n * The value is case sensitive.\n *\n * - `SOURCE`: The notebook is exported as source code. Directory exports will not include non-notebook entries.\n * - `HTML`: The notebook is exported as an HTML file.\n * - `JUPYTER`: The notebook is exported as a Jupyter/IPython Notebook file.\n * - `DBC`: The notebook is exported in <Databricks> archive format. Directory exports will not include non-notebook entries.\n * - `R_MARKDOWN`: The notebook is exported to R Markdown format.\n * - `AUTO`: The object or directory is exported depending on the objects type. Directory exports will include notebooks and workspace files.\n */\n format?: ExportFormat | undefined;\n /**\n * Flag to enable direct download. If it is `true`, the response is the exported file itself.\n * Otherwise, by default, the response contains content in the form of a base64 encoded string.\n */\n directDownload?: boolean | undefined;\n}\n\n/** The request field `direct_download` determines whether a JSON response or binary contents are returned by this endpoint. */\nexport interface ExportResponse {\n /**\n * The base64-encoded content.\n * If the limit (10MB) is exceeded, exception with error code **MAX_NOTEBOOK_SIZE_EXCEEDED** is thrown.\n */\n content?: Uint8Array | undefined;\n /** The file type of the exported file. */\n fileType?: string | undefined;\n}\n\nexport interface GetStatusRequest {\n /** The absolute path of the notebook or directory. */\n path?: string | undefined;\n}\n\nexport interface ImportRequest {\n /** The absolute path of the object or directory. Importing a directory is only supported for the `DBC` and `SOURCE` formats. */\n path?: string | undefined;\n /**\n * This specifies the format of the file to be imported.\n *\n * The value is case sensitive.\n *\n * - `AUTO`: The item is imported depending on an analysis of the item's extension and\n * the header content provided in the request. If the item is imported as a notebook,\n * then the item's extension is automatically removed.\n * - `SOURCE`: The notebook or directory is imported as source code.\n * - `HTML`: The notebook is imported as an HTML file.\n * - `JUPYTER`: The notebook is imported as a Jupyter/IPython Notebook file.\n * - `DBC`: The notebook is imported in <Databricks> archive format. Required for directories.\n * - `R_MARKDOWN`: The notebook is imported from R Markdown format.\n */\n format?: ExportFormat | undefined;\n /** The language of the object. This value is set only if the object type is `NOTEBOOK`. */\n language?: Language | undefined;\n /**\n * The base64-encoded content. This has a limit of 10 MB.\n *\n * If the limit (10MB) is exceeded, exception with error code **MAX_NOTEBOOK_SIZE_EXCEEDED** is thrown.\n * This parameter might be absent, and instead a posted file is used.\n */\n content?: Uint8Array | undefined;\n /**\n * The flag that specifies whether to overwrite existing object. It is `false` by default.\n * For `DBC` format, `overwrite` is not supported since it may contain a directory.\n */\n overwrite?: boolean | undefined;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface ImportResponse {}\n\nexport interface ListRequest {\n /** The absolute path of the notebook or directory. */\n path?: string | undefined;\n /** UTC timestamp in milliseconds */\n notebooksModifiedAfter?: bigint | undefined;\n}\n\nexport interface ListResponse {\n /** List of objects. */\n objects?: ObjectInfo[] | undefined;\n}\n\nexport interface MkdirsRequest {\n /**\n * The absolute path of the directory. If the parent directories do not exist, it will also create them.\n * If the directory already exists, this command will do nothing and succeed.\n */\n path?: string | undefined;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface MkdirsResponse {}\n\n/** The information of the object in workspace. It will be returned by ``list`` and ``get-status``. */\nexport interface ObjectInfo {\n /**\n * The type of the object in workspace.\n *\n * - `NOTEBOOK`: document that contains runnable code, visualizations, and explanatory text.\n * - `DIRECTORY`: directory\n * - `LIBRARY`: library\n * - `FILE`: file\n * - `REPO`: repository\n * - `DASHBOARD`: Lakeview dashboard\n */\n objectType?: ObjectType | undefined;\n /** The absolute path of the object. */\n path?: string | undefined;\n /** The language of the object. This value is set only if the object type is ``NOTEBOOK``. For Jupyter (.ipynb) notebooks, this is always ``PYTHON``. */\n language?: Language | undefined;\n /** Only applicable to files. The creation UTC timestamp. */\n createdAt?: bigint | undefined;\n /** Only applicable to files, the last modified UTC timestamp. */\n modifiedAt?: bigint | undefined;\n /** Unique identifier for the object. */\n objectId?: bigint | undefined;\n /** Only applicable to files. The file size in bytes can be returned. */\n size?: bigint | undefined;\n /** A unique identifier for the object that is consistent across all Databricks APIs. */\n resourceId?: string | undefined;\n /** Additional metadata about the directory. Only set for objects of type ``DIRECTORY``. */\n directoryInfo?: DirectoryInfo | undefined;\n}\n\nexport const unmarshalDeleteResponseSchema: z.ZodType<DeleteResponse> =\n z.object({});\n\nexport const unmarshalDirectoryInfoSchema: z.ZodType<DirectoryInfo> = z\n .object({\n is_git_folder: z.boolean().optional(),\n })\n .transform(d => ({\n isGitFolder: d.is_git_folder,\n }));\n\nexport const unmarshalExportResponseSchema: z.ZodType<ExportResponse> = z\n .object({\n content: z\n .string()\n .transform(s => Uint8Array.from(atob(s), c => c.charCodeAt(0)))\n .optional(),\n file_type: z.string().optional(),\n })\n .transform(d => ({\n content: d.content,\n fileType: d.file_type,\n }));\n\nexport const unmarshalImportResponseSchema: z.ZodType<ImportResponse> =\n z.object({});\n\nexport const unmarshalListResponseSchema: z.ZodType<ListResponse> = z\n .object({\n objects: z.array(z.lazy(() => unmarshalObjectInfoSchema)).optional(),\n })\n .transform(d => ({\n objects: d.objects,\n }));\n\nexport const unmarshalMkdirsResponseSchema: z.ZodType<MkdirsResponse> =\n z.object({});\n\nexport const unmarshalObjectInfoSchema: z.ZodType<ObjectInfo> = z\n .object({\n object_type: z.string().optional(),\n path: z.string().optional(),\n language: z.string().optional(),\n created_at: z\n .union([z.number(), z.bigint(), z.string()])\n .transform(v => BigInt(v))\n .optional(),\n modified_at: z\n .union([z.number(), z.bigint(), z.string()])\n .transform(v => BigInt(v))\n .optional(),\n object_id: z\n .union([z.number(), z.bigint(), z.string()])\n .transform(v => BigInt(v))\n .optional(),\n size: z\n .union([z.number(), z.bigint(), z.string()])\n .transform(v => BigInt(v))\n .optional(),\n resource_id: z.string().optional(),\n directory_info: z.lazy(() => unmarshalDirectoryInfoSchema).optional(),\n })\n .transform(d => ({\n objectType: d.object_type,\n path: d.path,\n language: d.language,\n createdAt: d.created_at,\n modifiedAt: d.modified_at,\n objectId: d.object_id,\n size: d.size,\n resourceId: d.resource_id,\n directoryInfo: d.directory_info,\n }));\n\nexport const marshalDeleteRequestSchema: z.ZodType = z\n .object({\n path: z.string().optional(),\n recursive: z.boolean().optional(),\n })\n .transform(d => ({\n path: d.path,\n recursive: d.recursive,\n }));\n\nexport const marshalImportRequestSchema: z.ZodType = z\n .object({\n path: z.string().optional(),\n format: z.string().optional(),\n language: z.string().optional(),\n content: z\n .any()\n .transform((d: Uint8Array) =>\n btoa(Array.from(d, b => String.fromCharCode(b)).join(''))\n )\n .optional(),\n overwrite: z.boolean().optional(),\n })\n .transform(d => ({\n path: d.path,\n format: d.format,\n language: d.language,\n content: d.content,\n overwrite: d.overwrite,\n }));\n\nexport const marshalMkdirsRequestSchema: z.ZodType = z\n .object({\n path: z.string().optional(),\n })\n .transform(d => ({\n path: d.path,\n }));\n"],"mappings":";;;;AAMA,MAAa,eAAe;CAE1B,QAAQ;CAER,MAAM;CAEN,SAAS;CAET,KAAK;CAEL,YAAY;CAEZ,MAAM;CAMN,KAAK;CACN;;AAOD,MAAa,WAAW;CA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,OAAO,EACN,MAAM,EAAE,QAAQ,CAAC,UAAU,EAC5B,CAAC,CACD,WAAU,OAAM,EACf,MAAM,EAAE,MACT,EAAE"}
@@ -0,0 +1,37 @@
1
+ import { HttpClient } from "@databricks/sdk-core/http";
2
+ import { ClientOptions } from "@databricks/sdk-options/client";
3
+
4
+ //#region src/v1/transport.d.ts
5
+ /**
6
+ * The configuration a client needs to issue requests, resolved from
7
+ * {@link ClientOptions} and a configuration profile.
8
+ */
9
+ interface ResolvedClientConfig {
10
+ /** Host with any trailing slash removed. */
11
+ host: string;
12
+ /**
13
+ * Default account ID for account-level paths that contain an account_id
14
+ * segment. A request's own accountId still wins.
15
+ */
16
+ accountId?: string;
17
+ /**
18
+ * Workspace ID used to route workspace-level calls on unified hosts (SPOG).
19
+ */
20
+ workspaceId?: string;
21
+ /** HTTP client with authentication, and any configured timeout, applied. */
22
+ httpClient: HttpClient;
23
+ }
24
+ /**
25
+ * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
26
+ *
27
+ * A configuration profile is always resolved from the config file and
28
+ * environment variables (per options.profileOptions); it supplies host,
29
+ * accountId, workspaceId, and credentials wherever the caller did not set them
30
+ * explicitly. Explicit options always take precedence.
31
+ *
32
+ * @throws if host is neither provided nor present in the resolved profile.
33
+ */
34
+ declare function resolveClientConfig(options: ClientOptions): Promise<ResolvedClientConfig>;
35
+ //#endregion
36
+ export { ResolvedClientConfig, resolveClientConfig };
37
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","names":[],"sources":["../../src/v1/transport.ts"],"mappings":";;;;;;AAkBA;;UAAiB,oBAAA;EAgBO;EAdtB,IAAA;EAMA;;;;EAAA,SAAA;EAQsB;AAaxB;;EAhBE,WAAA;EAiBS;EAdT,UAAA,EAAY,UAAA;AAAA;;;;;;;;;;;iBAaQ,mBAAA,CACpB,OAAA,EAAS,aAAA,GACR,OAAA,CAAQ,oBAAA"}
@@ -0,0 +1,73 @@
1
+ import { defaultCredentials } from "@databricks/sdk-auth/credentials";
2
+ import { newFetchHttpClient } from "@databricks/sdk-core/http";
3
+ import { resolve } from "@databricks/sdk-core/profiles";
4
+
5
+ //#region src/v1/transport.ts
6
+ /**
7
+ * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
8
+ *
9
+ * A configuration profile is always resolved from the config file and
10
+ * environment variables (per options.profileOptions); it supplies host,
11
+ * accountId, workspaceId, and credentials wherever the caller did not set them
12
+ * explicitly. Explicit options always take precedence.
13
+ *
14
+ * @throws if host is neither provided nor present in the resolved profile.
15
+ */
16
+ async function resolveClientConfig(options) {
17
+ const profile = await resolve(options.profileOptions);
18
+ const host = normalizeHost(options.host ?? profile.host);
19
+ if (host === void 0) throw new Error("Host is required.");
20
+ let httpClient = new AuthHttpClient(options.httpClient ?? newFetchHttpClient(), options.credentials ?? defaultCredentials({ profile: {
21
+ ...profile,
22
+ host
23
+ } }));
24
+ if (options.timeout !== void 0) httpClient = new TimeoutHttpClient(httpClient, options.timeout);
25
+ const accountId = options.accountId ?? profile.accountId;
26
+ const workspaceId = options.workspaceId ?? profile.workspaceId;
27
+ return {
28
+ host,
29
+ httpClient,
30
+ ...accountId !== void 0 && { accountId },
31
+ ...workspaceId !== void 0 && { workspaceId }
32
+ };
33
+ }
34
+ function normalizeHost(host) {
35
+ const trimmed = host?.trim();
36
+ if (trimmed === void 0 || trimmed === "") return;
37
+ return (/^https?:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`).replace(/\/$/, "");
38
+ }
39
+ /** Wraps an HttpClient and adds authentication headers to requests. */
40
+ var AuthHttpClient = class {
41
+ constructor(base, credentials) {
42
+ this.base = base;
43
+ this.credentials = credentials;
44
+ }
45
+ async send(request) {
46
+ const authHeaders = await this.credentials.authHeaders();
47
+ const headers = new Headers(request.headers);
48
+ for (const h of authHeaders) headers.set(h.key, h.value);
49
+ return this.base.send({
50
+ ...request,
51
+ headers
52
+ });
53
+ }
54
+ };
55
+ /** Wraps an HttpClient and applies a default timeout to requests. */
56
+ var TimeoutHttpClient = class {
57
+ constructor(base, timeout) {
58
+ this.base = base;
59
+ this.timeout = timeout;
60
+ }
61
+ async send(request) {
62
+ const timeoutSignal = AbortSignal.timeout(this.timeout);
63
+ const signal = request.signal !== void 0 ? AbortSignal.any([request.signal, timeoutSignal]) : timeoutSignal;
64
+ return this.base.send({
65
+ ...request,
66
+ signal
67
+ });
68
+ }
69
+ };
70
+
71
+ //#endregion
72
+ export { resolveClientConfig };
73
+ //# sourceMappingURL=transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.js","names":[],"sources":["../../src/v1/transport.ts"],"sourcesContent":["// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.\n\nimport type {Credentials} from '@databricks/sdk-auth';\nimport {defaultCredentials} from '@databricks/sdk-auth/credentials';\nimport type {\n HttpClient,\n HttpRequest,\n HttpResponse,\n} from '@databricks/sdk-core/http';\nimport {newFetchHttpClient} from '@databricks/sdk-core/http';\nimport type {Profile} from '@databricks/sdk-core/profiles';\nimport {resolve} from '@databricks/sdk-core/profiles';\nimport type {ClientOptions} from '@databricks/sdk-options/client';\n\n/**\n * The configuration a client needs to issue requests, resolved from\n * {@link ClientOptions} and a configuration profile.\n */\nexport interface ResolvedClientConfig {\n /** Host with any trailing slash removed. */\n host: string;\n\n /**\n * Default account ID for account-level paths that contain an account_id\n * segment. A request's own accountId still wins.\n */\n accountId?: string;\n\n /**\n * Workspace ID used to route workspace-level calls on unified hosts (SPOG).\n */\n workspaceId?: string;\n\n /** HTTP client with authentication, and any configured timeout, applied. */\n httpClient: HttpClient;\n}\n\n/**\n * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.\n *\n * A configuration profile is always resolved from the config file and\n * environment variables (per options.profileOptions); it supplies host,\n * accountId, workspaceId, and credentials wherever the caller did not set them\n * explicitly. Explicit options always take precedence.\n *\n * @throws if host is neither provided nor present in the resolved profile.\n */\nexport async function resolveClientConfig(\n options: ClientOptions\n): Promise<ResolvedClientConfig> {\n const profile: Profile = await resolve(options.profileOptions);\n\n const host = normalizeHost(options.host ?? profile.host);\n if (host === undefined) {\n throw new Error('Host is required.');\n }\n\n // The provided httpClient (or the default fetch client) is the base wire;\n // authentication and the optional timeout are layered on top of it. The\n // default credential chain reuses the profile resolved above so that the\n // same profileOptions govern host and authentication alike.\n const base = options.httpClient ?? newFetchHttpClient();\n const credentials =\n options.credentials ?? defaultCredentials({profile: {...profile, host}});\n let httpClient: HttpClient = new AuthHttpClient(base, credentials);\n if (options.timeout !== undefined) {\n httpClient = new TimeoutHttpClient(httpClient, options.timeout);\n }\n\n const accountId = options.accountId ?? profile.accountId;\n const workspaceId = options.workspaceId ?? profile.workspaceId;\n\n return {\n host,\n httpClient,\n ...(accountId !== undefined && {accountId}),\n ...(workspaceId !== undefined && {workspaceId}),\n };\n}\n\nfunction normalizeHost(host: string | undefined): string | undefined {\n const trimmed = host?.trim();\n if (trimmed === undefined || trimmed === '') {\n return undefined;\n }\n const absolute = /^https?:\\/\\//i.test(trimmed)\n ? trimmed\n : `https://${trimmed}`;\n return absolute.replace(/\\/$/, '');\n}\n\n/** Wraps an HttpClient and adds authentication headers to requests. */\nclass AuthHttpClient implements HttpClient {\n constructor(\n private readonly base: HttpClient,\n private readonly credentials: Credentials\n ) {}\n\n async send(request: HttpRequest): Promise<HttpResponse> {\n const authHeaders = await this.credentials.authHeaders();\n // Do not modify the original request.\n const headers = new Headers(request.headers);\n for (const h of authHeaders) {\n headers.set(h.key, h.value);\n }\n return this.base.send({...request, headers});\n }\n}\n\n/** Wraps an HttpClient and applies a default timeout to requests. */\nclass TimeoutHttpClient implements HttpClient {\n constructor(\n private readonly base: HttpClient,\n private readonly timeout: number\n ) {}\n\n async send(request: HttpRequest): Promise<HttpResponse> {\n const timeoutSignal = AbortSignal.timeout(this.timeout);\n const signal =\n request.signal !== undefined\n ? AbortSignal.any([request.signal, timeoutSignal])\n : timeoutSignal;\n return this.base.send({...request, signal});\n }\n}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AAQ,KAAK,QAAQ;EACvD,MAAM,SACJ,QAAQ,WAAW,SACf,YAAY,IAAI,CAAC,QAAQ,QAAQ,cAAc,CAAC,GAChD;AACN,SAAO,KAAK,KAAK,KAAK;GAAC,GAAG;GAAS;GAAO,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { Logger } from "@databricks/sdk-core/logger";
2
+ import { HttpClient, HttpRequest } from "@databricks/sdk-core/http";
3
+ import { z } from "zod";
4
+ import { CallOptions } from "@databricks/sdk-options/call";
5
+
6
+ //#region src/v1/utils.d.ts
7
+ interface HttpCallOptions {
8
+ readonly request: HttpRequest;
9
+ readonly httpClient: HttpClient;
10
+ readonly logger: Logger;
11
+ }
12
+ /**
13
+ * Translates public CallOptions to the internal Options shape accepted by
14
+ * execute(). Even though the shapes match today, this isolates the public
15
+ * API from the executor's internal type so they can diverge.
16
+ */
17
+ declare function executeCall(call: (signal?: AbortSignal) => Promise<void>, options?: CallOptions): Promise<void>;
18
+ declare function executeHttpCall(opts: HttpCallOptions): Promise<Uint8Array>;
19
+ declare function buildHttpRequest(method: string, url: string, headers: Headers, signal?: AbortSignal, body?: string | ReadableStream<Uint8Array>): HttpRequest;
20
+ declare function parseResponse<T>(body: Uint8Array, schema: z.ZodType<T>): T;
21
+ declare function marshalRequest(data: unknown, schema: z.ZodType): string;
22
+ declare function flattenQueryParams(prefix: string, value: unknown, params: URLSearchParams): void;
23
+ //#endregion
24
+ export { HttpCallOptions, buildHttpRequest, executeCall, executeHttpCall, flattenQueryParams, marshalRequest, parseResponse };
25
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/v1/utils.ts"],"mappings":";;;;;;UAoBiB,eAAA;EAAA,SACN,OAAA,EAAS,WAAA;EAAA,SACT,UAAA,EAAY,UAAA;EAAA,SACZ,MAAA,EAAQ,MAAA;AAAA;;;;;;iBAQG,WAAA,CACpB,IAAA,GAAO,MAAA,GAAS,WAAA,KAAgB,OAAA,QAChC,OAAA,GAAU,WAAA,GACT,OAAA;AAAA,iBAoCmB,eAAA,CACpB,IAAA,EAAM,eAAA,GACL,OAAA,CAAQ,UAAA;AAAA,iBA6BK,gBAAA,CACd,MAAA,UACA,GAAA,UACA,OAAA,EAAS,OAAA,EACT,MAAA,GAAS,WAAA,EACT,IAAA,YAAgB,cAAA,CAAe,UAAA,IAC9B,WAAA;AAAA,iBAWa,aAAA,GAAA,CAAiB,IAAA,EAAM,UAAA,EAAY,MAAA,EAAQ,CAAA,CAAE,OAAA,CAAQ,CAAA,IAAK,CAAA;AAAA,iBAO1D,cAAA,CAAe,IAAA,WAAe,MAAA,EAAQ,CAAA,CAAE,OAAA;AAAA,iBAIxC,kBAAA,CACd,MAAA,UACA,KAAA,WACA,MAAA,EAAQ,eAAA"}
@@ -0,0 +1,87 @@
1
+ import { execute } from "@databricks/sdk-core/ops";
2
+ import { ApiError } from "@databricks/sdk-core/apierror";
3
+ import JSONBig from "json-bigint";
4
+
5
+ //#region src/v1/utils.ts
6
+ const jsonBigint = JSONBig({ useNativeBigInt: true });
7
+ /**
8
+ * Translates public CallOptions to the internal Options shape accepted by
9
+ * execute(). Even though the shapes match today, this isolates the public
10
+ * API from the executor's internal type so they can diverge.
11
+ */
12
+ async function executeCall(call, options) {
13
+ const opts = {
14
+ ...options?.retrier !== void 0 && { retrier: options.retrier },
15
+ ...options?.rateLimiter !== void 0 && { rateLimiter: options.rateLimiter },
16
+ ...options?.timeout !== void 0 && { timeout: options.timeout }
17
+ };
18
+ return execute(options?.signal, call, opts);
19
+ }
20
+ async function readAll(body) {
21
+ if (body === null) return new Uint8Array(0);
22
+ const reader = body.getReader();
23
+ const chunks = [];
24
+ for (;;) {
25
+ const { done, value } = await reader.read();
26
+ if (done) break;
27
+ chunks.push(value);
28
+ }
29
+ const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
30
+ const result = new Uint8Array(totalLength);
31
+ let offset = 0;
32
+ for (const chunk of chunks) {
33
+ result.set(chunk, offset);
34
+ offset += chunk.length;
35
+ }
36
+ return result;
37
+ }
38
+ async function executeHttpCall(opts) {
39
+ opts.logger.debug("HTTP request", {
40
+ method: opts.request.method,
41
+ url: opts.request.url
42
+ });
43
+ let resp;
44
+ try {
45
+ resp = await opts.httpClient.send(opts.request);
46
+ } catch (e) {
47
+ opts.logger.debug("HTTP request failed");
48
+ throw e;
49
+ }
50
+ const body = await readAll(resp.body);
51
+ opts.logger.debug("HTTP response", {
52
+ statusCode: resp.statusCode,
53
+ body: new TextDecoder().decode(body)
54
+ });
55
+ const apiErr = ApiError.fromHttpError(resp.statusCode, resp.headers, body);
56
+ if (apiErr !== void 0) throw apiErr;
57
+ return body;
58
+ }
59
+ function buildHttpRequest(method, url, headers, signal, body) {
60
+ const req = {
61
+ url,
62
+ method,
63
+ headers
64
+ };
65
+ if (body !== void 0) req.body = body;
66
+ if (signal !== void 0) req.signal = signal;
67
+ return req;
68
+ }
69
+ function parseResponse(body, schema) {
70
+ const text = new TextDecoder().decode(body);
71
+ const parsed = text === "" ? {} : jsonBigint.parse(text);
72
+ return schema.parse(parsed);
73
+ }
74
+ function marshalRequest(data, schema) {
75
+ return jsonBigint.stringify(schema.parse(data));
76
+ }
77
+ function flattenQueryParams(prefix, value, params) {
78
+ if (value === null || value === void 0) return;
79
+ if (Array.isArray(value)) for (const item of value) params.append(prefix, String(item));
80
+ else if (typeof value === "object") for (const [key, val] of Object.entries(value)) flattenQueryParams(`${prefix}.${key}`, val, params);
81
+ else if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") params.append(prefix, String(value));
82
+ else throw new Error(`Unsupported query parameter type: ${typeof value}`);
83
+ }
84
+
85
+ //#endregion
86
+ export { buildHttpRequest, executeCall, executeHttpCall, flattenQueryParams, marshalRequest, parseResponse };
87
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../src/v1/utils.ts"],"sourcesContent":["// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.\n\nimport type {Options} from '@databricks/sdk-core/ops';\nimport {execute} from '@databricks/sdk-core/ops';\nimport {ApiError} from '@databricks/sdk-core/apierror';\nimport type {\n HttpClient,\n HttpRequest,\n HttpResponse,\n} from '@databricks/sdk-core/http';\nimport type {Logger} from '@databricks/sdk-core/logger';\nimport type {CallOptions} from '@databricks/sdk-options/call';\nimport JSONBig from 'json-bigint';\nimport type {z} from 'zod';\n\n// JSON codec that preserves int64 precision. On the way in, large integer\n// literals come back as bigint instead of being rounded to JS Number. On the\n// way out, bigint values are emitted as raw JSON number digits.\nconst jsonBigint = JSONBig({useNativeBigInt: true});\n\nexport interface HttpCallOptions {\n readonly request: HttpRequest;\n readonly httpClient: HttpClient;\n readonly logger: Logger;\n}\n\n/**\n * Translates public CallOptions to the internal Options shape accepted by\n * execute(). Even though the shapes match today, this isolates the public\n * API from the executor's internal type so they can diverge.\n */\nexport async function executeCall(\n call: (signal?: AbortSignal) => Promise<void>,\n options?: CallOptions\n): Promise<void> {\n const opts: Options = {\n ...(options?.retrier !== undefined && {retrier: options.retrier}),\n ...(options?.rateLimiter !== undefined && {\n rateLimiter: options.rateLimiter,\n }),\n ...(options?.timeout !== undefined && {timeout: options.timeout}),\n };\n return execute(options?.signal, call, opts);\n}\n\nasync function readAll(\n body: ReadableStream<Uint8Array> | null\n): Promise<Uint8Array> {\n if (body === null) {\n return new Uint8Array(0);\n }\n const reader = body.getReader();\n const chunks: Uint8Array[] = [];\n for (;;) {\n const {done, value} = await reader.read();\n if (done) {\n break;\n }\n chunks.push(value);\n }\n const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);\n const result = new Uint8Array(totalLength);\n let offset = 0;\n for (const chunk of chunks) {\n result.set(chunk, offset);\n offset += chunk.length;\n }\n return result;\n}\n\nexport async function executeHttpCall(\n opts: HttpCallOptions\n): Promise<Uint8Array> {\n opts.logger.debug('HTTP request', {\n method: opts.request.method,\n url: opts.request.url,\n });\n\n let resp: HttpResponse;\n try {\n resp = await opts.httpClient.send(opts.request);\n } catch (e: unknown) {\n opts.logger.debug('HTTP request failed');\n throw e;\n }\n\n const body = await readAll(resp.body);\n\n opts.logger.debug('HTTP response', {\n statusCode: resp.statusCode,\n body: new TextDecoder().decode(body),\n });\n\n const apiErr = ApiError.fromHttpError(resp.statusCode, resp.headers, body);\n if (apiErr !== undefined) {\n throw apiErr;\n }\n\n return body;\n}\n\nexport function buildHttpRequest(\n method: string,\n url: string,\n headers: Headers,\n signal?: AbortSignal,\n body?: string | ReadableStream<Uint8Array>\n): HttpRequest {\n const req: HttpRequest = {url, method, headers};\n if (body !== undefined) {\n req.body = body;\n }\n if (signal !== undefined) {\n req.signal = signal;\n }\n return req;\n}\n\nexport function parseResponse<T>(body: Uint8Array, schema: z.ZodType<T>): T {\n const text = new TextDecoder().decode(body);\n // 204 responses return an empty body; treat as `{}`.\n const parsed: unknown = text === '' ? {} : jsonBigint.parse(text);\n return schema.parse(parsed);\n}\n\nexport function marshalRequest(data: unknown, schema: z.ZodType): string {\n return jsonBigint.stringify(schema.parse(data));\n}\n\nexport function flattenQueryParams(\n prefix: string,\n value: unknown,\n params: URLSearchParams\n): void {\n if (value === null || value === undefined) {\n return;\n }\n if (Array.isArray(value)) {\n // arrays of objects are not yet supported\n for (const item of value) {\n params.append(prefix, String(item));\n }\n } else if (typeof value === 'object') {\n for (const [key, val] of Object.entries(value as Record<string, unknown>)) {\n flattenQueryParams(`${prefix}.${key}`, val, params);\n }\n } else if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n typeof value === 'bigint'\n ) {\n params.append(prefix, String(value));\n } else {\n throw new Error(`Unsupported query parameter type: ${typeof value}`);\n }\n}\n"],"mappings":";;;;;AAkBA,MAAM,aAAa,QAAQ,EAAC,iBAAiB,MAAK,CAAC;;;;;;AAanD,eAAsB,YACpB,MACA,SACe;CACf,MAAM,OAAgB;EACpB,GAAI,SAAS,YAAY,UAAa,EA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C/C,KAAI,SAAS,OACX,KAAI,OAAO;AAEb,KAAI,WAAW,OACb,KAAI,SAAS;AAEf,QAAO;;AAGT,SAAgB,cAAiB,MAAkB,QAAyB;CAC1E,MAAM,OAAO,IAAI,aAAa,CAAC,OAAO,KAAK;CAE3C,MAAM,SAAkB,SAAS,KAAK,EAAE,GAAG,WAAW,MAAM,KAAK;AACjE,QAAO,OAAO,MAAM,OAAO;;AAG7B,SAAgB,eAAe,MAAe,QAA2B;AACvE,QAAO,WAAW,UAAU,OAAO,MAAM,KAAK,CAAC;;AAGjD,SAAgB,mBACd,QACA,OACA,QACM;AACN,KAAI,UAAU,QAAQ,UAAU,OAC9B;AAEF,KAAI,MAAM,QAAQ,MAAM,CAEtB,MAAK,MAAM,QAAQ,MACjB,QAAO,OAAO,QAAQ,OAAO,KAAK,CAAC;UAE5B,OAAO,UAAU,SAC1B,MAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,QAAQ,MAAiC,CACvE,oBAAmB,GAAG,OAAO,GAAG,OAAO,KAAK,OAAO;UAGrD,OAAO,UAAU,YACjB,OAAO,UAAU,YACjB,OAAO,UAAU,aACjB,OAAO,UAAU,SAEjB,QAAO,OAAO,QAAQ,OAAO,MAAM,CAAC;KAEpC,OAAM,IAAI,MAAM,qCAAqC,OAAO,QAAQ"}
package/package.json CHANGED
@@ -1,7 +1,46 @@
1
1
  {
2
2
  "name": "@databricks/sdk-workspacefiles",
3
- "version": "0.0.0-beta",
4
- "description": "Bootstrap placeholder; real contents in a later release.",
5
- "main": "index.js",
6
- "license": "Apache-2.0"
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "type": "module",
6
+ "exports": {
7
+ "./v1": {
8
+ "types": "./dist/v1/index.d.ts",
9
+ "import": "./dist/v1/index.js",
10
+ "default": "./dist/v1/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "LICENSE"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsdown",
19
+ "lint": "eslint src --ext .ts",
20
+ "lint:fix": "eslint src --ext .ts --fix",
21
+ "format": "prettier --write \"src/**/*.ts\"",
22
+ "format:check": "prettier --check \"src/**/*.ts\"",
23
+ "typecheck": "tsc --noEmit",
24
+ "clean": "rm -rf dist tsconfig.tsbuildinfo",
25
+ "test": "echo 'no tests'",
26
+ "test:browser": "echo 'no tests'"
27
+ },
28
+ "author": "Databricks",
29
+ "license": "Apache-2.0",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/databricks/sdk-js.git",
33
+ "directory": "packages/workspacefiles"
34
+ },
35
+ "dependencies": {
36
+ "@databricks/sdk-auth": ">=0.54.0 <1.0.0",
37
+ "@databricks/sdk-core": ">=0.51.2 <1.0.0",
38
+ "@databricks/sdk-options": ">=0.51.3 <1.0.0",
39
+ "@js-temporal/polyfill": "^0.5.0",
40
+ "json-bigint": "^1.0.0",
41
+ "zod": "^4.3.6"
42
+ },
43
+ "engines": {
44
+ "node": ">=22.0.0"
45
+ }
7
46
  }
package/index.js DELETED
@@ -1 +0,0 @@
1
- module.exports = {};