@databricks/sdk-uc-schemas 0.34.0 → 0.35.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.
@@ -0,0 +1,7 @@
1
+ //#region package.json
2
+ var name = "@databricks/sdk-uc-schemas";
3
+ var version = "0.35.0";
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":""}
@@ -1,46 +1,50 @@
1
- import type { CallOptions } from '@databricks/sdk-options/call';
2
- import type { ClientOptions } from '@databricks/sdk-options/client';
3
- import type { CreateSchemaRequest, DeleteSchemaRequest, DeleteSchemaResponse, GetSchemaRequest, ListSchemasRequest, ListSchemasResponse, SchemaInfo, UpdateSchemaRequest } from './model';
4
- export declare class SchemasClient {
5
- private readonly options;
6
- private readonly logger;
7
- private readonly userAgent;
8
- private config;
9
- constructor(options: ClientOptions);
10
- private resolveConfig;
11
- /**
12
- * Creates a new schema for catalog in the Metastore.
13
- * The caller must be a metastore admin, or have the **CREATE_SCHEMA** privilege in the parent catalog.
14
- */
15
- createSchema(req: CreateSchemaRequest, options?: CallOptions): Promise<SchemaInfo>;
16
- /**
17
- * Deletes the specified schema from the parent catalog.
18
- * The caller must be the owner of the schema or an owner of the parent catalog.
19
- */
20
- deleteSchema(req: DeleteSchemaRequest, options?: CallOptions): Promise<DeleteSchemaResponse>;
21
- /**
22
- * Gets the specified schema within the metastore.
23
- * The caller must be a metastore admin, the owner of the schema, or a user that has the **USE_SCHEMA** privilege on the schema.
24
- */
25
- getSchema(req: GetSchemaRequest, options?: CallOptions): Promise<SchemaInfo>;
26
- /**
27
- * Gets an array of schemas for a catalog in the metastore.
28
- * If the caller is the metastore admin or the owner of the parent catalog, all schemas for the catalog will be retrieved.
29
- * Otherwise, only schemas owned by the caller (or for which the caller has the **USE_SCHEMA** privilege) will be retrieved.
30
- * There is no guarantee of a specific ordering of the elements in the array.
31
- *
32
- * NOTE: we recommend using max_results=0 to use the paginated version of this API. Unpaginated calls will be deprecated soon.
33
- *
34
- * PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may contain zero results while still providing a next_page_token.
35
- * Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
36
- */
37
- listSchemas(req: ListSchemasRequest, options?: CallOptions): Promise<ListSchemasResponse>;
38
- listSchemasIter(req: ListSchemasRequest, options?: CallOptions): AsyncGenerator<SchemaInfo>;
39
- /**
40
- * Updates a schema for a catalog. The caller must be the owner of the schema or a metastore admin.
41
- * If the caller is a metastore admin, only the __owner__ field can be changed in the update.
42
- * If the __name__ field must be updated, the caller must be a metastore admin or have the **CREATE_SCHEMA** privilege on the parent catalog.
43
- */
44
- updateSchema(req: UpdateSchemaRequest, options?: CallOptions): Promise<SchemaInfo>;
1
+ import { CreateSchemaRequest, DeleteSchemaRequest, DeleteSchemaResponse, GetSchemaRequest, ListSchemasRequest, ListSchemasResponse, SchemaInfo, UpdateSchemaRequest } 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 SchemasClient {
7
+ private readonly options;
8
+ private readonly logger;
9
+ private readonly userAgent;
10
+ private config;
11
+ constructor(options: ClientOptions);
12
+ private resolveConfig;
13
+ /**
14
+ * Creates a new schema for catalog in the Metastore.
15
+ * The caller must be a metastore admin, or have the **CREATE_SCHEMA** privilege in the parent catalog.
16
+ */
17
+ createSchema(req: CreateSchemaRequest, options?: CallOptions): Promise<SchemaInfo>;
18
+ /**
19
+ * Deletes the specified schema from the parent catalog.
20
+ * The caller must be the owner of the schema or an owner of the parent catalog.
21
+ */
22
+ deleteSchema(req: DeleteSchemaRequest, options?: CallOptions): Promise<DeleteSchemaResponse>;
23
+ /**
24
+ * Gets the specified schema within the metastore.
25
+ * The caller must be a metastore admin, the owner of the schema, or a user that has the **USE_SCHEMA** privilege on the schema.
26
+ */
27
+ getSchema(req: GetSchemaRequest, options?: CallOptions): Promise<SchemaInfo>;
28
+ /**
29
+ * Gets an array of schemas for a catalog in the metastore.
30
+ * If the caller is the metastore admin or the owner of the parent catalog, all schemas for the catalog will be retrieved.
31
+ * Otherwise, only schemas owned by the caller (or for which the caller has the **USE_SCHEMA** privilege) will be retrieved.
32
+ * There is no guarantee of a specific ordering of the elements in the array.
33
+ *
34
+ * NOTE: we recommend using max_results=0 to use the paginated version of this API. Unpaginated calls will be deprecated soon.
35
+ *
36
+ * PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may contain zero results while still providing a next_page_token.
37
+ * Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
38
+ */
39
+ listSchemas(req: ListSchemasRequest, options?: CallOptions): Promise<ListSchemasResponse>;
40
+ listSchemasIter(req: ListSchemasRequest, options?: CallOptions): AsyncGenerator<SchemaInfo>;
41
+ /**
42
+ * Updates a schema for a catalog. The caller must be the owner of the schema or a metastore admin.
43
+ * If the caller is a metastore admin, only the __owner__ field can be changed in the update.
44
+ * If the __name__ field must be updated, the caller must be a metastore admin or have the **CREATE_SCHEMA** privilege on the parent catalog.
45
+ */
46
+ updateSchema(req: UpdateSchemaRequest, options?: CallOptions): Promise<SchemaInfo>;
45
47
  }
48
+ //#endregion
49
+ export { SchemasClient };
46
50
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/v1/client.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAWlE,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,UAAU,EACV,mBAAmB,EACpB,MAAM,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A;;;;EAHL,YAAA,CACJ,GAAA,EAAK,mBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,oBAAA;EAsCR;;;;EAHG,SAAA,CACJ,GAAA,EAAK,gBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,UAAA;EAsFJ;;;;;;;;;;;EA5CD,WAAA,CACJ,GAAA,EAAK,kBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,mBAAA;EAwCJ,eAAA,CACL,GAAA,EAAK,kBAAA,EACL,OAAA,GAAU,WAAA,GACT,cAAA,CAAe,UAAA;EAvLV;;;;;EA0MF,YAAA,CACJ,GAAA,EAAK,mBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,UAAA;AAAA"}
package/dist/v1/client.js CHANGED
@@ -1,229 +1,182 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
- import { VERSION as AUTH_VERSION } from '@databricks/sdk-auth';
3
- import { createDefault } from '@databricks/sdk-core/clientinfo';
4
- import { NoOpLogger } from '@databricks/sdk-core/logger';
5
- import { resolveClientConfig } from './transport';
6
- import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse, } from './utils';
7
- import pkgJson from '../../package.json' with { type: 'json' };
8
- import { marshalCreateSchemaRequestSchema, marshalUpdateSchemaRequestSchema, unmarshalDeleteSchemaResponseSchema, unmarshalListSchemasResponseSchema, unmarshalSchemaInfoSchema, } from './model';
9
- // Package identity segment for this client to be used in the User-Agent header.
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 { marshalCreateSchemaRequestSchema, marshalUpdateSchemaRequestSchema, unmarshalDeleteSchemaResponseSchema, unmarshalListSchemasResponseSchema, unmarshalSchemaInfoSchema } 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
10
  const PACKAGE_SEGMENT = {
11
- key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
12
- value: pkgJson.version,
11
+ key: "sdk-js-" + name.replace(/^@[^/]+\/sdk-/, ""),
12
+ value: version
13
13
  };
14
- export class SchemasClient {
15
- options;
16
- logger;
17
- // User-Agent header value. Composed once at construction from
18
- // createDefault() merged with this package's identity and the active
19
- // credential's name.
20
- userAgent;
21
- // Memoized configuration. The profile is resolved once, lazily, on the first
22
- // request, then reused; host, workspaceId/accountId, and credentials are
23
- // filled from it when not set explicitly on the options.
24
- config;
25
- constructor(options) {
26
- this.options = options;
27
- this.logger = options.logger ?? new NoOpLogger();
28
- const info = createDefault()
29
- .with(PACKAGE_SEGMENT)
30
- .with({ key: 'sdk-js-auth', value: AUTH_VERSION })
31
- .with({ key: 'auth', value: options.credentials?.name() ?? 'default' });
32
- this.userAgent = info.toString();
33
- }
34
- resolveConfig() {
35
- this.config ??= resolveClientConfig(this.options);
36
- return this.config;
37
- }
38
- /**
39
- * Creates a new schema for catalog in the Metastore.
40
- * The caller must be a metastore admin, or have the **CREATE_SCHEMA** privilege in the parent catalog.
41
- */
42
- async createSchema(req, options) {
43
- const { host, workspaceId, httpClient } = await this.resolveConfig();
44
- const url = `${host}/api/2.1/unity-catalog/schemas`;
45
- const body = marshalRequest(req, marshalCreateSchemaRequestSchema);
46
- let resp;
47
- const call = async (callSignal) => {
48
- const headers = new Headers({ 'Content-Type': 'application/json' });
49
- if (workspaceId !== undefined) {
50
- headers.set('X-Databricks-Workspace-Id', workspaceId);
51
- }
52
- headers.set('User-Agent', this.userAgent);
53
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
54
- const respBody = await executeHttpCall({
55
- request: httpReq,
56
- httpClient,
57
- logger: this.logger,
58
- });
59
- resp = parseResponse(respBody, unmarshalSchemaInfoSchema);
60
- };
61
- await executeCall(call, options);
62
- if (resp === undefined) {
63
- throw new Error('operation completed without a result.');
64
- }
65
- return resp;
66
- }
67
- /**
68
- * Deletes the specified schema from the parent catalog.
69
- * The caller must be the owner of the schema or an owner of the parent catalog.
70
- */
71
- async deleteSchema(req, options) {
72
- const { host, workspaceId, httpClient } = await this.resolveConfig();
73
- const url = `${host}/api/2.1/unity-catalog/schemas/${req.fullNameArg ?? ''}`;
74
- const params = new URLSearchParams();
75
- if (req.force !== undefined) {
76
- params.append('force', String(req.force));
77
- }
78
- const query = params.toString();
79
- const fullUrl = query !== '' ? `${url}?${query}` : url;
80
- let resp;
81
- const call = async (callSignal) => {
82
- const headers = new Headers();
83
- if (workspaceId !== undefined) {
84
- headers.set('X-Databricks-Workspace-Id', workspaceId);
85
- }
86
- headers.set('User-Agent', this.userAgent);
87
- const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
88
- const respBody = await executeHttpCall({
89
- request: httpReq,
90
- httpClient,
91
- logger: this.logger,
92
- });
93
- resp = parseResponse(respBody, unmarshalDeleteSchemaResponseSchema);
94
- };
95
- await executeCall(call, options);
96
- if (resp === undefined) {
97
- throw new Error('operation completed without a result.');
98
- }
99
- return resp;
100
- }
101
- /**
102
- * Gets the specified schema within the metastore.
103
- * The caller must be a metastore admin, the owner of the schema, or a user that has the **USE_SCHEMA** privilege on the schema.
104
- */
105
- async getSchema(req, options) {
106
- const { host, workspaceId, httpClient } = await this.resolveConfig();
107
- const url = `${host}/api/2.1/unity-catalog/schemas/${req.fullNameArg ?? ''}`;
108
- const params = new URLSearchParams();
109
- if (req.includeBrowse !== undefined) {
110
- params.append('include_browse', String(req.includeBrowse));
111
- }
112
- const query = params.toString();
113
- const fullUrl = query !== '' ? `${url}?${query}` : url;
114
- let resp;
115
- const call = async (callSignal) => {
116
- const headers = new Headers();
117
- if (workspaceId !== undefined) {
118
- headers.set('X-Databricks-Workspace-Id', workspaceId);
119
- }
120
- headers.set('User-Agent', this.userAgent);
121
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
122
- const respBody = await executeHttpCall({
123
- request: httpReq,
124
- httpClient,
125
- logger: this.logger,
126
- });
127
- resp = parseResponse(respBody, unmarshalSchemaInfoSchema);
128
- };
129
- await executeCall(call, options);
130
- if (resp === undefined) {
131
- throw new Error('operation completed without a result.');
132
- }
133
- return resp;
134
- }
135
- /**
136
- * Gets an array of schemas for a catalog in the metastore.
137
- * If the caller is the metastore admin or the owner of the parent catalog, all schemas for the catalog will be retrieved.
138
- * Otherwise, only schemas owned by the caller (or for which the caller has the **USE_SCHEMA** privilege) will be retrieved.
139
- * There is no guarantee of a specific ordering of the elements in the array.
140
- *
141
- * NOTE: we recommend using max_results=0 to use the paginated version of this API. Unpaginated calls will be deprecated soon.
142
- *
143
- * PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may contain zero results while still providing a next_page_token.
144
- * Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
145
- */
146
- async listSchemas(req, options) {
147
- const { host, workspaceId, httpClient } = await this.resolveConfig();
148
- const url = `${host}/api/2.1/unity-catalog/schemas`;
149
- const params = new URLSearchParams();
150
- if (req.catalogName !== undefined) {
151
- params.append('catalog_name', req.catalogName);
152
- }
153
- if (req.maxResults !== undefined) {
154
- params.append('max_results', String(req.maxResults));
155
- }
156
- if (req.pageToken !== undefined) {
157
- params.append('page_token', req.pageToken);
158
- }
159
- if (req.includeBrowse !== undefined) {
160
- params.append('include_browse', String(req.includeBrowse));
161
- }
162
- const query = params.toString();
163
- const fullUrl = query !== '' ? `${url}?${query}` : url;
164
- let resp;
165
- const call = async (callSignal) => {
166
- const headers = new Headers();
167
- if (workspaceId !== undefined) {
168
- headers.set('X-Databricks-Workspace-Id', workspaceId);
169
- }
170
- headers.set('User-Agent', this.userAgent);
171
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
172
- const respBody = await executeHttpCall({
173
- request: httpReq,
174
- httpClient,
175
- logger: this.logger,
176
- });
177
- resp = parseResponse(respBody, unmarshalListSchemasResponseSchema);
178
- };
179
- await executeCall(call, options);
180
- if (resp === undefined) {
181
- throw new Error('operation completed without a result.');
182
- }
183
- return resp;
184
- }
185
- async *listSchemasIter(req, options) {
186
- const pageReq = { ...req };
187
- for (;;) {
188
- const resp = await this.listSchemas(pageReq, options);
189
- for (const item of resp.schemas ?? []) {
190
- yield item;
191
- }
192
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
193
- return;
194
- }
195
- pageReq.pageToken = resp.nextPageToken;
196
- }
197
- }
198
- /**
199
- * Updates a schema for a catalog. The caller must be the owner of the schema or a metastore admin.
200
- * If the caller is a metastore admin, only the __owner__ field can be changed in the update.
201
- * If the __name__ field must be updated, the caller must be a metastore admin or have the **CREATE_SCHEMA** privilege on the parent catalog.
202
- */
203
- async updateSchema(req, options) {
204
- const { host, workspaceId, httpClient } = await this.resolveConfig();
205
- const url = `${host}/api/2.1/unity-catalog/schemas/${req.fullNameArg ?? ''}`;
206
- const body = marshalRequest(req, marshalUpdateSchemaRequestSchema);
207
- let resp;
208
- const call = async (callSignal) => {
209
- const headers = new Headers({ 'Content-Type': 'application/json' });
210
- if (workspaceId !== undefined) {
211
- headers.set('X-Databricks-Workspace-Id', workspaceId);
212
- }
213
- headers.set('User-Agent', this.userAgent);
214
- const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
215
- const respBody = await executeHttpCall({
216
- request: httpReq,
217
- httpClient,
218
- logger: this.logger,
219
- });
220
- resp = parseResponse(respBody, unmarshalSchemaInfoSchema);
221
- };
222
- await executeCall(call, options);
223
- if (resp === undefined) {
224
- throw new Error('operation completed without a result.');
225
- }
226
- return resp;
227
- }
228
- }
14
+ var SchemasClient = 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
+ * Creates a new schema for catalog in the Metastore.
36
+ * The caller must be a metastore admin, or have the **CREATE_SCHEMA** privilege in the parent catalog.
37
+ */
38
+ async createSchema(req, options) {
39
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
40
+ const url = `${host}/api/2.1/unity-catalog/schemas`;
41
+ const body = marshalRequest(req, marshalCreateSchemaRequestSchema);
42
+ let resp;
43
+ const call = async (callSignal) => {
44
+ const headers = new Headers({ "Content-Type": "application/json" });
45
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
46
+ headers.set("User-Agent", this.userAgent);
47
+ resp = parseResponse(await executeHttpCall({
48
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
49
+ httpClient,
50
+ logger: this.logger
51
+ }), unmarshalSchemaInfoSchema);
52
+ };
53
+ await executeCall(call, options);
54
+ if (resp === void 0) throw new Error("operation completed without a result.");
55
+ return resp;
56
+ }
57
+ /**
58
+ * Deletes the specified schema from the parent catalog.
59
+ * The caller must be the owner of the schema or an owner of the parent catalog.
60
+ */
61
+ async deleteSchema(req, options) {
62
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
63
+ const url = `${host}/api/2.1/unity-catalog/schemas/${req.fullNameArg ?? ""}`;
64
+ const params = new URLSearchParams();
65
+ if (req.force !== void 0) params.append("force", String(req.force));
66
+ const query = params.toString();
67
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
68
+ let resp;
69
+ const call = async (callSignal) => {
70
+ const headers = new Headers();
71
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
72
+ headers.set("User-Agent", this.userAgent);
73
+ resp = parseResponse(await executeHttpCall({
74
+ request: buildHttpRequest("DELETE", fullUrl, headers, callSignal),
75
+ httpClient,
76
+ logger: this.logger
77
+ }), unmarshalDeleteSchemaResponseSchema);
78
+ };
79
+ await executeCall(call, options);
80
+ if (resp === void 0) throw new Error("operation completed without a result.");
81
+ return resp;
82
+ }
83
+ /**
84
+ * Gets the specified schema within the metastore.
85
+ * The caller must be a metastore admin, the owner of the schema, or a user that has the **USE_SCHEMA** privilege on the schema.
86
+ */
87
+ async getSchema(req, options) {
88
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
89
+ const url = `${host}/api/2.1/unity-catalog/schemas/${req.fullNameArg ?? ""}`;
90
+ const params = new URLSearchParams();
91
+ if (req.includeBrowse !== void 0) params.append("include_browse", String(req.includeBrowse));
92
+ const query = params.toString();
93
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
94
+ let resp;
95
+ const call = async (callSignal) => {
96
+ const headers = new Headers();
97
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
98
+ headers.set("User-Agent", this.userAgent);
99
+ resp = parseResponse(await executeHttpCall({
100
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
101
+ httpClient,
102
+ logger: this.logger
103
+ }), unmarshalSchemaInfoSchema);
104
+ };
105
+ await executeCall(call, options);
106
+ if (resp === void 0) throw new Error("operation completed without a result.");
107
+ return resp;
108
+ }
109
+ /**
110
+ * Gets an array of schemas for a catalog in the metastore.
111
+ * If the caller is the metastore admin or the owner of the parent catalog, all schemas for the catalog will be retrieved.
112
+ * Otherwise, only schemas owned by the caller (or for which the caller has the **USE_SCHEMA** privilege) will be retrieved.
113
+ * There is no guarantee of a specific ordering of the elements in the array.
114
+ *
115
+ * NOTE: we recommend using max_results=0 to use the paginated version of this API. Unpaginated calls will be deprecated soon.
116
+ *
117
+ * PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may contain zero results while still providing a next_page_token.
118
+ * Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
119
+ */
120
+ async listSchemas(req, options) {
121
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
122
+ const url = `${host}/api/2.1/unity-catalog/schemas`;
123
+ const params = new URLSearchParams();
124
+ if (req.catalogName !== void 0) params.append("catalog_name", req.catalogName);
125
+ if (req.maxResults !== void 0) params.append("max_results", String(req.maxResults));
126
+ if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
127
+ if (req.includeBrowse !== void 0) params.append("include_browse", String(req.includeBrowse));
128
+ const query = params.toString();
129
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
130
+ let resp;
131
+ const call = async (callSignal) => {
132
+ const headers = new Headers();
133
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
134
+ headers.set("User-Agent", this.userAgent);
135
+ resp = parseResponse(await executeHttpCall({
136
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
137
+ httpClient,
138
+ logger: this.logger
139
+ }), unmarshalListSchemasResponseSchema);
140
+ };
141
+ await executeCall(call, options);
142
+ if (resp === void 0) throw new Error("operation completed without a result.");
143
+ return resp;
144
+ }
145
+ async *listSchemasIter(req, options) {
146
+ const pageReq = { ...req };
147
+ for (;;) {
148
+ const resp = await this.listSchemas(pageReq, options);
149
+ for (const item of resp.schemas ?? []) yield item;
150
+ if (resp.nextPageToken === void 0 || resp.nextPageToken === "") return;
151
+ pageReq.pageToken = resp.nextPageToken;
152
+ }
153
+ }
154
+ /**
155
+ * Updates a schema for a catalog. The caller must be the owner of the schema or a metastore admin.
156
+ * If the caller is a metastore admin, only the __owner__ field can be changed in the update.
157
+ * If the __name__ field must be updated, the caller must be a metastore admin or have the **CREATE_SCHEMA** privilege on the parent catalog.
158
+ */
159
+ async updateSchema(req, options) {
160
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
161
+ const url = `${host}/api/2.1/unity-catalog/schemas/${req.fullNameArg ?? ""}`;
162
+ const body = marshalRequest(req, marshalUpdateSchemaRequestSchema);
163
+ let resp;
164
+ const call = async (callSignal) => {
165
+ const headers = new Headers({ "Content-Type": "application/json" });
166
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
167
+ headers.set("User-Agent", this.userAgent);
168
+ resp = parseResponse(await executeHttpCall({
169
+ request: buildHttpRequest("PATCH", url, headers, callSignal, body),
170
+ httpClient,
171
+ logger: this.logger
172
+ }), unmarshalSchemaInfoSchema);
173
+ };
174
+ await executeCall(call, options);
175
+ if (resp === void 0) throw new Error("operation completed without a result.");
176
+ return resp;
177
+ }
178
+ };
179
+
180
+ //#endregion
181
+ export { SchemasClient };
229
182
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/v1/client.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAC,aAAa,EAAC,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAC;AAIvD,OAAO,EAAC,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,cAAc,EACd,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,OAAO,MAAM,oBAAoB,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AAW7D,OAAO,EACL,gCAAgC,EAChC,gCAAgC,EAChC,mCAAmC,EACnC,kCAAkC,EAClC,yBAAyB,GAC1B,MAAM,SAAS,CAAC;AAEjB,gFAAgF;AAChF,MAAM,eAAe,GAAG;IACtB,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;IAC1D,KAAK,EAAE,OAAO,CAAC,OAAO;CACvB,CAAC;AAEF,MAAM,OAAO,aAAa;IACP,OAAO,CAAgB;IACvB,MAAM,CAAS;IAChC,8DAA8D;IAC9D,qEAAqE;IACrE,qBAAqB;IACJ,SAAS,CAAS;IACnC,6E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AAG,EAAE,gCAAgC,CAAC,CAAC;QACnE,IAAI,IAA4B,CAAC;QACjC,MAAM,IAAI,GAAG,KAAK,EAAE,UAAwB,EAAiB,EAAE;YAC7D,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,EAAC,cAAc,EAAE,kBAAkB,EAAC,CAAC,CAAC;YAClE,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC9B,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,WAAW,CAAC,CAAC;YACxD,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAC1C,MAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;YAC1E,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC;gBACrC,OAAO,EAAE,OAAO;gBAChB,UAAU;gBACV,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB,CAAC,CAAC;YACH,IAAI,GAAG,aAAa,CAAC,QAAQ,EAAE,yBAAyB,CAAC,CAAC;QAC5D,CAAC,CAAC;QACF,MAAM,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACjC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
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 CreateSchemaRequest,\n DeleteSchemaRequest,\n DeleteSchemaResponse,\n GetSchemaRequest,\n ListSchemasRequest,\n ListSchemasResponse,\n SchemaInfo,\n UpdateSchemaRequest,\n} from './model';\nimport {\n marshalCreateSchemaRequestSchema,\n marshalUpdateSchemaRequestSchema,\n unmarshalDeleteSchemaResponseSchema,\n unmarshalListSchemasResponseSchema,\n unmarshalSchemaInfoSchema,\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 SchemasClient {\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 * Creates a new schema for catalog in the Metastore.\n * The caller must be a metastore admin, or have the **CREATE_SCHEMA** privilege in the parent catalog.\n */\n async createSchema(\n req: CreateSchemaRequest,\n options?: CallOptions\n ): Promise<SchemaInfo> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.1/unity-catalog/schemas`;\n const body = marshalRequest(req, marshalCreateSchemaRequestSchema);\n let resp: SchemaInfo | 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, unmarshalSchemaInfoSchema);\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 * Deletes the specified schema from the parent catalog.\n * The caller must be the owner of the schema or an owner of the parent catalog.\n */\n async deleteSchema(\n req: DeleteSchemaRequest,\n options?: CallOptions\n ): Promise<DeleteSchemaResponse> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.1/unity-catalog/schemas/${req.fullNameArg ?? ''}`;\n const params = new URLSearchParams();\n if (req.force !== undefined) {\n params.append('force', String(req.force));\n }\n const query = params.toString();\n const fullUrl = query !== '' ? `${url}?${query}` : url;\n let resp: DeleteSchemaResponse | 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('DELETE', fullUrl, headers, callSignal);\n const respBody = await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n resp = parseResponse(respBody, unmarshalDeleteSchemaResponseSchema);\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 specified schema within the metastore.\n * The caller must be a metastore admin, the owner of the schema, or a user that has the **USE_SCHEMA** privilege on the schema.\n */\n async getSchema(\n req: GetSchemaRequest,\n options?: CallOptions\n ): Promise<SchemaInfo> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.1/unity-catalog/schemas/${req.fullNameArg ?? ''}`;\n const params = new URLSearchParams();\n if (req.includeBrowse !== undefined) {\n params.append('include_browse', String(req.includeBrowse));\n }\n const query = params.toString();\n const fullUrl = query !== '' ? `${url}?${query}` : url;\n let resp: SchemaInfo | 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, unmarshalSchemaInfoSchema);\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 an array of schemas for a catalog in the metastore.\n * If the caller is the metastore admin or the owner of the parent catalog, all schemas for the catalog will be retrieved.\n * Otherwise, only schemas owned by the caller (or for which the caller has the **USE_SCHEMA** privilege) will be retrieved.\n * There is no guarantee of a specific ordering of the elements in the array.\n *\n * NOTE: we recommend using max_results=0 to use the paginated version of this API. Unpaginated calls will be deprecated soon.\n *\n * PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may contain zero results while still providing a next_page_token.\n * Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.\n */\n async listSchemas(\n req: ListSchemasRequest,\n options?: CallOptions\n ): Promise<ListSchemasResponse> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.1/unity-catalog/schemas`;\n const params = new URLSearchParams();\n if (req.catalogName !== undefined) {\n params.append('catalog_name', req.catalogName);\n }\n if (req.maxResults !== undefined) {\n params.append('max_results', String(req.maxResults));\n }\n if (req.pageToken !== undefined) {\n params.append('page_token', req.pageToken);\n }\n if (req.includeBrowse !== undefined) {\n params.append('include_browse', String(req.includeBrowse));\n }\n const query = params.toString();\n const fullUrl = query !== '' ? `${url}?${query}` : url;\n let resp: ListSchemasResponse | 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, unmarshalListSchemasResponseSchema);\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 async *listSchemasIter(\n req: ListSchemasRequest,\n options?: CallOptions\n ): AsyncGenerator<SchemaInfo> {\n const pageReq: ListSchemasRequest = {...req};\n for (;;) {\n const resp = await this.listSchemas(pageReq, options);\n for (const item of resp.schemas ?? []) {\n yield item;\n }\n if (resp.nextPageToken === undefined || resp.nextPageToken === '') {\n return;\n }\n pageReq.pageToken = resp.nextPageToken;\n }\n }\n\n /**\n * Updates a schema for a catalog. The caller must be the owner of the schema or a metastore admin.\n * If the caller is a metastore admin, only the __owner__ field can be changed in the update.\n * If the __name__ field must be updated, the caller must be a metastore admin or have the **CREATE_SCHEMA** privilege on the parent catalog.\n */\n async updateSchema(\n req: UpdateSchemaRequest,\n options?: CallOptions\n ): Promise<SchemaInfo> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.1/unity-catalog/schemas/${req.fullNameArg ?? ''}`;\n const body = marshalRequest(req, marshalUpdateSchemaRequestSchema);\n let resp: SchemaInfo | 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('PATCH', url, headers, callSignal, body);\n const respBody = await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n resp = parseResponse(respBody, unmarshalSchemaInfoSchema);\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":";;;;;;;;;AAqCA,MAAM,kBAAkB;CACtB,KAAK,iBAAyB,QAAQ,iBAAiB,GAAG;CAC1D,OAAOA;CACR;AAED,IAAa,gBAAb,MAA2B;CACzB,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;AACrD,OAAK,WAAW,oBAAoB,KAAK,QAAQ;AACjD,SAAO,KAAK;;;;;;CAOd,MAAM,aACJ,KACA,SACqB;EACrB,MAAM,EAAC,MAAM,aAAa,eAAc,MAAM,KAAK,eAAe;EAClE,MAAM,MAAM,GAAG,KAAK;EACpB,MAAM,OAAO,eAAe,KAAK,iCAAiC;EAClE,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,0BAA0B;;AAE3D,QAAM,YAAY,MAAM,QAAQ;AAChC,M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;EAC5B,MAAM,UAA8B,EAAC,GAAG,KAAI;AAC5C,WAAS;GACP,MAAM,OAAO,MAAM,KAAK,YAAY,SAAS,QAAQ;AACrD,QAAK,MAAM,QAAQ,KAAK,WAAW,EAAE,CACnC,OAAM;AAER,OAAI,KAAK,kBAAkB,UAAa,KAAK,kBAAkB,GAC7D;AAEF,WAAQ,YAAY,KAAK;;;;;;;;CAS7B,MAAM,aACJ,KACA,SACqB;EACrB,MAAM,EAAC,MAAM,aAAa,eAAc,MAAM,KAAK,eAAe;EAClE,MAAM,MAAM,GAAG,KAAK,iCAAiC,IAAI,eAAe;EACxE,MAAM,OAAO,eAAe,KAAK,iCAAiC;EAClE,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,SAAS,KAAK,SAAS,YAAY,KAAK;IAGvE;IACA,QAAQ,KAAK;IACd,CAAC,EAC6B,0BAA0B;;AAE3D,QAAM,YAAY,MAAM,QAAQ;AAChC,MAAI,SAAS,OACX,OAAM,IAAI,MAAM,wCAAwC;AAE1D,SAAO"}
@@ -1,7 +1,3 @@
1
- /**
2
- * @module v1
3
- */
4
- export { SchemasClient } from './client';
5
- export { CatalogType } from './model';
6
- export type { CreateSchemaRequest, DeleteSchemaRequest, DeleteSchemaResponse, EffectivePredictiveOptimizationFlag, GetSchemaRequest, ListSchemasRequest, ListSchemasResponse, SchemaInfo, UpdateSchemaRequest, } from './model';
7
- //# sourceMappingURL=index.d.ts.map
1
+ import { CatalogType, CreateSchemaRequest, DeleteSchemaRequest, DeleteSchemaResponse, EffectivePredictiveOptimizationFlag, GetSchemaRequest, ListSchemasRequest, ListSchemasResponse, SchemaInfo, UpdateSchemaRequest } from "./model.js";
2
+ import { SchemasClient } from "./client.js";
3
+ export { CatalogType, type CreateSchemaRequest, type DeleteSchemaRequest, type DeleteSchemaResponse, type EffectivePredictiveOptimizationFlag, type GetSchemaRequest, type ListSchemasRequest, type ListSchemasResponse, type SchemaInfo, SchemasClient, type UpdateSchemaRequest };