@databricks/sdk-uc-rfa 0.1.0-dev.3 → 0.1.0-dev.5

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.
@@ -1,24 +1,41 @@
1
1
  // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
2
  import { defaultCredentials } from '@databricks/sdk-auth/credentials';
3
3
  import { newFetchHttpClient } from '@databricks/sdk-core/http';
4
- /** Creates a new HTTP client with the given options. */
5
- export function newHttpClient(options) {
6
- const opts = options ?? {};
7
- // If an HTTP client is provided, use it as-is. Throw if other options are
8
- // also set, since they would be silently ignored.
9
- if (opts.httpClient !== undefined) {
10
- if (opts.credentials !== undefined || opts.timeout !== undefined) {
11
- throw new Error('httpClient cannot be combined with credentials or timeout');
12
- }
13
- return opts.httpClient;
4
+ import { resolve } from '@databricks/sdk-core/profiles';
5
+ /**
6
+ * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
7
+ *
8
+ * A configuration profile is always resolved from the config file and
9
+ * environment variables (per options.profileOptions); it supplies host,
10
+ * accountId, workspaceId, and credentials wherever the caller did not set them
11
+ * explicitly. Explicit options always take precedence.
12
+ *
13
+ * @throws if host is neither provided nor present in the resolved profile.
14
+ */
15
+ export async function resolveClientConfig(options) {
16
+ const profile = await resolve(options.profileOptions);
17
+ const host = options.host ?? profile.host;
18
+ if (host === undefined) {
19
+ throw new Error('Host is required.');
14
20
  }
15
- const credentials = opts.credentials ?? defaultCredentials();
16
- const base = newFetchHttpClient();
17
- let client = new AuthHttpClient(base, credentials);
18
- if (opts.timeout !== undefined) {
19
- client = new TimeoutHttpClient(client, opts.timeout);
21
+ // The provided httpClient (or the default fetch client) is the base wire;
22
+ // authentication and the optional timeout are layered on top of it. The
23
+ // default credential chain reuses the profile resolved above so that the
24
+ // same profileOptions govern host and authentication alike.
25
+ const base = options.httpClient ?? newFetchHttpClient();
26
+ const credentials = options.credentials ?? defaultCredentials({ profile });
27
+ let httpClient = new AuthHttpClient(base, credentials);
28
+ if (options.timeout !== undefined) {
29
+ httpClient = new TimeoutHttpClient(httpClient, options.timeout);
20
30
  }
21
- return client;
31
+ const accountId = options.accountId ?? profile.accountId;
32
+ const workspaceId = options.workspaceId ?? profile.workspaceId;
33
+ return {
34
+ host: host.replace(/\/$/, ''),
35
+ httpClient,
36
+ ...(accountId !== undefined && { accountId }),
37
+ ...(workspaceId !== undefined && { workspaceId }),
38
+ };
22
39
  }
23
40
  /** Wraps an HttpClient and adds authentication headers to requests. */
24
41
  class AuthHttpClient {
@@ -1 +1 @@
1
- {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/v1/transport.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAG/E,OAAO,EAAC,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AAMpE,OAAO,EAAC,kBAAkB,EAAC,MAAM,2BAA2B,CAAC;AAG7D,wDAAwD;AACxD,MAAM,UAAU,aAAa,CAAC,OAAuB;IACnD,MAAM,IAAI,GAAG,OAAO,IAAI,EAAE,CAAC;IAE3B,0EAA0E;IAC1E,kDAAkD;IAClD,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QAClC,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YACjE,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,kBAAkB,EAAE,CAAC;IAE7D,MAAM,IAAI,GAAG,kBAAkB,EAAE,CAAC;IAClC,IAAI,MAAM,GAAe,IAAI,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAE/D,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,GAAG,IAAI,iBAAiB,CAAC,MAAM,EAAE,IAAI,CA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;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,MAAM,CAEvE;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,eAAe,GACtB,IAAI,CAuBN"}
package/dist/v1/utils.js CHANGED
@@ -79,7 +79,8 @@ export function buildHttpRequest(method, url, headers, signal, body) {
79
79
  }
80
80
  export function parseResponse(body, schema) {
81
81
  const text = new TextDecoder().decode(body);
82
- const parsed = jsonBigint.parse(text);
82
+ // 204 responses return an empty body; treat as `{}`.
83
+ const parsed = text === '' ? {} : jsonBigint.parse(text);
83
84
  return schema.parse(parsed);
84
85
  }
85
86
  export function marshalRequest(data, schema) {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/v1/utils.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAG/E,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAC,QAAQ,EAAC,MAAM,+BAA+B,CAAC;AAQvD,OAAO,OAAO,MAAM,aAAa,CAAC;AAGlC,0EAA0E;AAC1E,6EAA6E;AAC7E,gEAAgE;AAChE,MAAM,UAAU,GAAG,OAAO,CAAC,EAAC,eAAe,EAAE,IAAI,EAAC,CAAC,CAAC;AAQpD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAA6C,EAC7C,OAAqB;IAErB,MAAM,IAAI,GAAY;QACpB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,IAAI,EAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAC,CAAC;QACjE,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,SAAS,IAAI;YACxC,WAAW,EAAE,OAAO,CAAC,WAAW;SACjC,CAAC;QACF,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,IAAI,EAAC,OAAO,EAAE,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AEvB,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAC1C,OAAO;IACT,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,0CAA0C;QAC1C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrC,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;YAC1E,kBAAkB,CAAC,GAAG,MAAM,IAAI,GAAG,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;SAAM,IACL,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,OAAO,KAAK,KAAK,QAAQ,EACzB,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACvC,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,qCAAqC,OAAO,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databricks/sdk-uc-rfa",
3
- "version": "0.1.0-dev.3",
3
+ "version": "0.1.0-dev.5",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {
@@ -12,7 +12,6 @@
12
12
  },
13
13
  "files": [
14
14
  "dist",
15
- "src",
16
15
  "LICENSE"
17
16
  ],
18
17
  "scripts": {
@@ -28,10 +27,15 @@
28
27
  },
29
28
  "author": "Databricks",
30
29
  "license": "Apache-2.0",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/databricks/sdk-js.git",
33
+ "directory": "packages/uc/rfa"
34
+ },
31
35
  "dependencies": {
32
- "@databricks/sdk-auth": ">=0.1.0-dev.4 <1.0.0",
33
- "@databricks/sdk-core": ">=0.1.0-dev.5 <1.0.0",
34
- "@databricks/sdk-options": ">=0.1.0-dev.4 <1.0.0",
36
+ "@databricks/sdk-auth": ">=0.1.0-dev.6 <1.0.0",
37
+ "@databricks/sdk-core": ">=0.1.0-dev.7 <1.0.0",
38
+ "@databricks/sdk-options": ">=0.1.0-dev.6 <1.0.0",
35
39
  "@js-temporal/polyfill": "^0.5.0",
36
40
  "json-bigint": "^1.0.0",
37
41
  "zod": "^4.3.6"
package/src/v1/client.ts DELETED
@@ -1,197 +0,0 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
-
3
- import {VERSION as AUTH_VERSION} from '@databricks/sdk-auth';
4
- import {createDefault} from '@databricks/sdk-core/clientinfo';
5
- import type {Logger} from '@databricks/sdk-core/logger';
6
- import {NoOpLogger} from '@databricks/sdk-core/logger';
7
- import type {CallOptions} from '@databricks/sdk-options/call';
8
- import type {ClientOptions} from '@databricks/sdk-options/client';
9
- import type {HttpClient} from '@databricks/sdk-core/http';
10
- import {newHttpClient} from './transport';
11
- import {
12
- buildHttpRequest,
13
- executeCall,
14
- executeHttpCall,
15
- marshalRequest,
16
- parseResponse,
17
- } from './utils';
18
- import pkgJson from '../../package.json' with {type: 'json'};
19
- import type {
20
- AccessRequestDestinations,
21
- BatchCreateAccessRequestsRequest,
22
- BatchCreateAccessRequestsResponse,
23
- GetAccessRequestDestinationsRequest,
24
- UpdateAccessRequestDestinationsRequest,
25
- } from './model';
26
- import {
27
- marshalAccessRequestDestinationsSchema,
28
- marshalBatchCreateAccessRequestsRequestSchema,
29
- unmarshalAccessRequestDestinationsSchema,
30
- unmarshalBatchCreateAccessRequestsResponseSchema,
31
- } from './model';
32
-
33
- // Package identity segment for this client to be used in the User-Agent header.
34
- const PACKAGE_SEGMENT = {
35
- key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
36
- value: pkgJson.version,
37
- };
38
-
39
- export class RfaClient {
40
- private readonly host: string;
41
- // Workspace ID used to route workspace-level calls on unified hosts (SPOG).
42
- // When set, workspace-level methods send X-Databricks-Org-Id on every
43
- // request.
44
- private readonly workspaceId: string | undefined;
45
- private readonly httpClient: HttpClient;
46
- private readonly logger: Logger;
47
- // User-Agent header value. Composed once at construction from
48
- // createDefault() merged with this package's identity and the active
49
- // credential's name.
50
- private readonly userAgent: string;
51
-
52
- constructor(options: ClientOptions) {
53
- if (options.host === undefined) {
54
- throw new Error('Host is required.');
55
- }
56
- this.host = options.host.replace(/\/$/, '');
57
- this.workspaceId = options.workspaceId;
58
- this.logger = options.logger ?? new NoOpLogger();
59
- const info = createDefault()
60
- .with(PACKAGE_SEGMENT)
61
- .with({key: 'sdk-js-auth', value: AUTH_VERSION})
62
- .with({key: 'auth', value: options.credentials?.name() ?? 'default'});
63
- this.userAgent = info.toString();
64
- this.httpClient = newHttpClient(options);
65
- }
66
-
67
- /**
68
- * Creates access requests for Unity Catalog permissions for a specified principal on a securable object.
69
- * This Batch API can take in multiple principals, securable objects,
70
- * and permissions as the input and returns the access request destinations for each.
71
- * Principals must be unique across the API call.
72
- *
73
- * The supported securable types are: "metastore", "catalog", "schema", "table",
74
- * "external_location", "connection", "credential", "function", "registered_model", and "volume".
75
- */
76
- async batchCreateAccessRequests(
77
- req: BatchCreateAccessRequestsRequest,
78
- options?: CallOptions
79
- ): Promise<BatchCreateAccessRequestsResponse> {
80
- const url = `${this.host}/api/3.0/rfa/requests`;
81
- const body = marshalRequest(
82
- req,
83
- marshalBatchCreateAccessRequestsRequestSchema
84
- );
85
- let resp: BatchCreateAccessRequestsResponse | undefined;
86
- const call = async (callSignal?: AbortSignal): Promise<void> => {
87
- const headers = new Headers({'Content-Type': 'application/json'});
88
- if (this.workspaceId !== undefined) {
89
- headers.set('X-Databricks-Org-Id', this.workspaceId);
90
- }
91
- headers.set('User-Agent', this.userAgent);
92
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
93
- const respBody = await executeHttpCall({
94
- request: httpReq,
95
- httpClient: this.httpClient,
96
- logger: this.logger,
97
- });
98
- resp = parseResponse(
99
- respBody,
100
- unmarshalBatchCreateAccessRequestsResponseSchema
101
- );
102
- };
103
- await executeCall(call, options);
104
- if (resp === undefined) {
105
- throw new Error('operation completed without a result.');
106
- }
107
- return resp;
108
- }
109
-
110
- /**
111
- * Gets an array of access request destinations for the specified securable.
112
- * Any caller can see URL destinations or the destinations on the metastore.
113
- * Otherwise, only those with **BROWSE** permissions on the securable can see destinations.
114
- *
115
- * The supported securable types are: "metastore", "catalog", "schema", "table",
116
- * "external_location", "connection", "credential", "function", "registered_model", and "volume".
117
- */
118
- async getAccessRequestDestinations(
119
- req: GetAccessRequestDestinationsRequest,
120
- options?: CallOptions
121
- ): Promise<AccessRequestDestinations> {
122
- const url = `${this.host}/api/3.0/rfa/destinations/${req.securableType ?? ''}/${req.fullName ?? ''}`;
123
- let resp: AccessRequestDestinations | undefined;
124
- const call = async (callSignal?: AbortSignal): Promise<void> => {
125
- const headers = new Headers();
126
- if (this.workspaceId !== undefined) {
127
- headers.set('X-Databricks-Org-Id', this.workspaceId);
128
- }
129
- headers.set('User-Agent', this.userAgent);
130
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
131
- const respBody = await executeHttpCall({
132
- request: httpReq,
133
- httpClient: this.httpClient,
134
- logger: this.logger,
135
- });
136
- resp = parseResponse(respBody, unmarshalAccessRequestDestinationsSchema);
137
- };
138
- await executeCall(call, options);
139
- if (resp === undefined) {
140
- throw new Error('operation completed without a result.');
141
- }
142
- return resp;
143
- }
144
-
145
- /**
146
- * Updates the access request destinations for the given securable.
147
- * The caller must be a metastore admin, the owner of the securable, or a user that has the **MANAGE** privilege on the securable in order to assign destinations.
148
- * Destinations cannot be updated for securables underneath schemas (tables, volumes, functions, and models). For these securable types, destinations are inherited from the parent securable.
149
- * A maximum of 5 emails and 5 external notification destinations (Slack, Microsoft Teams, and Generic Webhook destinations) can be assigned to a securable.
150
- * If a URL destination is assigned, no other destinations can be set.
151
- *
152
- * The supported securable types are: "metastore", "catalog", "schema", "table",
153
- * "external_location", "connection", "credential", "function", "registered_model", and "volume".
154
- */
155
- async updateAccessRequestDestinations(
156
- req: UpdateAccessRequestDestinationsRequest,
157
- options?: CallOptions
158
- ): Promise<AccessRequestDestinations> {
159
- const url = `${this.host}/api/3.0/rfa/destinations`;
160
- const params = new URLSearchParams();
161
- if (req.updateMask !== undefined) {
162
- params.append('update_mask', req.updateMask.toString());
163
- }
164
- const query = params.toString();
165
- const fullUrl = query !== '' ? `${url}?${query}` : url;
166
- const body = marshalRequest(
167
- req.accessRequestDestinations,
168
- marshalAccessRequestDestinationsSchema
169
- );
170
- let resp: AccessRequestDestinations | undefined;
171
- const call = async (callSignal?: AbortSignal): Promise<void> => {
172
- const headers = new Headers({'Content-Type': 'application/json'});
173
- if (this.workspaceId !== undefined) {
174
- headers.set('X-Databricks-Org-Id', this.workspaceId);
175
- }
176
- headers.set('User-Agent', this.userAgent);
177
- const httpReq = buildHttpRequest(
178
- 'PATCH',
179
- fullUrl,
180
- headers,
181
- callSignal,
182
- body
183
- );
184
- const respBody = await executeHttpCall({
185
- request: httpReq,
186
- httpClient: this.httpClient,
187
- logger: this.logger,
188
- });
189
- resp = parseResponse(respBody, unmarshalAccessRequestDestinationsSchema);
190
- };
191
- await executeCall(call, options);
192
- if (resp === undefined) {
193
- throw new Error('operation completed without a result.');
194
- }
195
- return resp;
196
- }
197
- }
package/src/v1/index.ts DELETED
@@ -1,26 +0,0 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
-
3
- export {RfaClient} from './client';
4
-
5
- export {
6
- DestinationType,
7
- PrincipalType,
8
- SecurableType,
9
- SpecialDestination,
10
- } from './model';
11
-
12
- export type {
13
- AccessRequestDestinations,
14
- BatchCreateAccessRequestsRequest,
15
- BatchCreateAccessRequestsResponse,
16
- CreateAccessRequest,
17
- CreateAccessRequestResponse,
18
- GetAccessRequestDestinationsRequest,
19
- NotificationDestination,
20
- Principal,
21
- Securable,
22
- SecurablePermissions,
23
- UpdateAccessRequestDestinationsRequest,
24
- } from './model';
25
-
26
- export {accessRequestDestinationsFieldMask} from './model';