@databricks/sdk-uc-resourcequotas 0.27.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-resourcequotas";
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,27 +1,31 @@
1
- import type { CallOptions } from '@databricks/sdk-options/call';
2
- import type { ClientOptions } from '@databricks/sdk-options/client';
3
- import type { GetQuotaRequest, GetQuotaResponse, ListQuotasRequest, ListQuotasResponse, QuotaInfo } from './model';
4
- export declare class ResourceQuotasClient {
5
- private readonly options;
6
- private readonly logger;
7
- private readonly userAgent;
8
- private config;
9
- constructor(options: ClientOptions);
10
- private resolveConfig;
11
- /**
12
- * The GetQuota API returns usage information for a single resource quota, defined as a
13
- * child-parent pair. This API also refreshes the quota count if it is out of date.
14
- * Refreshes are triggered asynchronously. The updated count might not be returned in the first call.
15
- */
16
- getQuota(req: GetQuotaRequest, options?: CallOptions): Promise<GetQuotaResponse>;
17
- /**
18
- * ListQuotas returns all quota values under the metastore. There are no SLAs on the freshness of the counts
19
- * returned. This API does not trigger a refresh of quota counts.
20
- *
21
- * PAGINATION BEHAVIOR: The API is by default paginated, a page may contain zero results while still providing a next_page_token.
22
- * Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
23
- */
24
- listQuotas(req: ListQuotasRequest, options?: CallOptions): Promise<ListQuotasResponse>;
25
- listQuotasIter(req: ListQuotasRequest, options?: CallOptions): AsyncGenerator<QuotaInfo>;
1
+ import { GetQuotaRequest, GetQuotaResponse, ListQuotasRequest, ListQuotasResponse, QuotaInfo } 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 ResourceQuotasClient {
7
+ private readonly options;
8
+ private readonly logger;
9
+ private readonly userAgent;
10
+ private config;
11
+ constructor(options: ClientOptions);
12
+ private resolveConfig;
13
+ /**
14
+ * The GetQuota API returns usage information for a single resource quota, defined as a
15
+ * child-parent pair. This API also refreshes the quota count if it is out of date.
16
+ * Refreshes are triggered asynchronously. The updated count might not be returned in the first call.
17
+ */
18
+ getQuota(req: GetQuotaRequest, options?: CallOptions): Promise<GetQuotaResponse>;
19
+ /**
20
+ * ListQuotas returns all quota values under the metastore. There are no SLAs on the freshness of the counts
21
+ * returned. This API does not trigger a refresh of quota counts.
22
+ *
23
+ * PAGINATION BEHAVIOR: The API is by default paginated, a page may contain zero results while still providing a next_page_token.
24
+ * Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
25
+ */
26
+ listQuotas(req: ListQuotasRequest, options?: CallOptions): Promise<ListQuotasResponse>;
27
+ listQuotasIter(req: ListQuotasRequest, options?: CallOptions): AsyncGenerator<QuotaInfo>;
26
28
  }
29
+ //#endregion
30
+ export { ResourceQuotasClient };
27
31
  //# 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;AAUlE,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACV,MAAM,SAAS,CAAC;AAYjB,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAIhC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IAInC,OAAO,CAAC,MAAM,CAA4C;gBAE9C,OAAO,EAAE,aAAa;IAUlC,OAAO,CAAC,aAAa;IAKrB;;;;OAIG;IACG,QAAQ,CACZ,GAAG,EAAE,eAAe,EACpB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,gBAAgB,CAAC;IAyB5B;;;;;;OAMG;IACG,UAAU,CACd,GAAG,EAAE,iBAAiB,EACtB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,kBAAkB,CAAC;IAkCvB,cAAc,CACnB,GAAG,EAAE,iBAAiB,EACtB,OAAO,CAAC,EAAE,WAAW,GACpB,cAAc,CAAC,SAAS,CAAC;CAa7B"}
1
+ {"version":3,"file":"client.d.ts","names":[],"sources":["../../src/v1/client.ts"],"mappings":";;;;;cAmCa,oBAAA;EAAA,iBACM,OAAA;EAAA,iBACA,MAAA;EAAA,iBAIA,SAAA;EAAA,QAIT,MAAA;cAEI,OAAA,EAAS,aAAA;EAAA,QAUb,aAAA;EAYI;;;;;EAFN,QAAA,CACJ,GAAA,EAAK,eAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,gBAAA;EAmCR;;;;;;;EAHG,UAAA,CACJ,GAAA,EAAK,iBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,kBAAA;EAkCJ,cAAA,CACL,GAAA,EAAK,iBAAA,EACL,OAAA,GAAU,WAAA,GACT,cAAA,CAAe,SAAA;AAAA"}
package/dist/v1/client.js CHANGED
@@ -1,121 +1,100 @@
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, parseResponse, } from './utils';
7
- import pkgJson from '../../package.json' with { type: 'json' };
8
- import { unmarshalGetQuotaResponseSchema, unmarshalListQuotasResponseSchema, } 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, parseResponse } from "./utils.js";
3
+ import { name, version } from "../package.js";
4
+ import { unmarshalGetQuotaResponseSchema, unmarshalListQuotasResponseSchema } 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 ResourceQuotasClient {
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
- * The GetQuota API returns usage information for a single resource quota, defined as a
40
- * child-parent pair. This API also refreshes the quota count if it is out of date.
41
- * Refreshes are triggered asynchronously. The updated count might not be returned in the first call.
42
- */
43
- async getQuota(req, options) {
44
- const { host, workspaceId, httpClient } = await this.resolveConfig();
45
- const url = `${host}/api/2.1/unity-catalog/resource-quotas/${req.parentSecurableType ?? ''}/${req.parentFullName ?? ''}/${req.quotaName ?? ''}`;
46
- let resp;
47
- const call = async (callSignal) => {
48
- const headers = new Headers();
49
- if (workspaceId !== undefined) {
50
- headers.set('X-Databricks-Workspace-Id', workspaceId);
51
- }
52
- headers.set('User-Agent', this.userAgent);
53
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
54
- const respBody = await executeHttpCall({
55
- request: httpReq,
56
- httpClient,
57
- logger: this.logger,
58
- });
59
- resp = parseResponse(respBody, unmarshalGetQuotaResponseSchema);
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
- * ListQuotas returns all quota values under the metastore. There are no SLAs on the freshness of the counts
69
- * returned. This API does not trigger a refresh of quota counts.
70
- *
71
- * PAGINATION BEHAVIOR: The API is by default paginated, a page may contain zero results while still providing a next_page_token.
72
- * Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
73
- */
74
- async listQuotas(req, options) {
75
- const { host, workspaceId, httpClient } = await this.resolveConfig();
76
- const url = `${host}/api/2.1/unity-catalog/resource-quotas/all-resource-quotas`;
77
- const params = new URLSearchParams();
78
- if (req.maxResults !== undefined) {
79
- params.append('max_results', String(req.maxResults));
80
- }
81
- if (req.pageToken !== undefined) {
82
- params.append('page_token', req.pageToken);
83
- }
84
- const query = params.toString();
85
- const fullUrl = query !== '' ? `${url}?${query}` : url;
86
- let resp;
87
- const call = async (callSignal) => {
88
- const headers = new Headers();
89
- if (workspaceId !== undefined) {
90
- headers.set('X-Databricks-Workspace-Id', workspaceId);
91
- }
92
- headers.set('User-Agent', this.userAgent);
93
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
94
- const respBody = await executeHttpCall({
95
- request: httpReq,
96
- httpClient,
97
- logger: this.logger,
98
- });
99
- resp = parseResponse(respBody, unmarshalListQuotasResponseSchema);
100
- };
101
- await executeCall(call, options);
102
- if (resp === undefined) {
103
- throw new Error('operation completed without a result.');
104
- }
105
- return resp;
106
- }
107
- async *listQuotasIter(req, options) {
108
- const pageReq = { ...req };
109
- for (;;) {
110
- const resp = await this.listQuotas(pageReq, options);
111
- for (const item of resp.quotas ?? []) {
112
- yield item;
113
- }
114
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
115
- return;
116
- }
117
- pageReq.pageToken = resp.nextPageToken;
118
- }
119
- }
120
- }
14
+ var ResourceQuotasClient = 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
+ * The GetQuota API returns usage information for a single resource quota, defined as a
36
+ * child-parent pair. This API also refreshes the quota count if it is out of date.
37
+ * Refreshes are triggered asynchronously. The updated count might not be returned in the first call.
38
+ */
39
+ async getQuota(req, options) {
40
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
41
+ const url = `${host}/api/2.1/unity-catalog/resource-quotas/${req.parentSecurableType ?? ""}/${req.parentFullName ?? ""}/${req.quotaName ?? ""}`;
42
+ let resp;
43
+ const call = async (callSignal) => {
44
+ const headers = new Headers();
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("GET", url, headers, callSignal),
49
+ httpClient,
50
+ logger: this.logger
51
+ }), unmarshalGetQuotaResponseSchema);
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
+ * ListQuotas returns all quota values under the metastore. There are no SLAs on the freshness of the counts
59
+ * returned. This API does not trigger a refresh of quota counts.
60
+ *
61
+ * PAGINATION BEHAVIOR: The API is by default paginated, a page may contain zero results while still providing a next_page_token.
62
+ * Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
63
+ */
64
+ async listQuotas(req, options) {
65
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
66
+ const url = `${host}/api/2.1/unity-catalog/resource-quotas/all-resource-quotas`;
67
+ const params = new URLSearchParams();
68
+ if (req.maxResults !== void 0) params.append("max_results", String(req.maxResults));
69
+ if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
70
+ const query = params.toString();
71
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
72
+ let resp;
73
+ const call = async (callSignal) => {
74
+ const headers = new Headers();
75
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
76
+ headers.set("User-Agent", this.userAgent);
77
+ resp = parseResponse(await executeHttpCall({
78
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
79
+ httpClient,
80
+ logger: this.logger
81
+ }), unmarshalListQuotasResponseSchema);
82
+ };
83
+ await executeCall(call, options);
84
+ if (resp === void 0) throw new Error("operation completed without a result.");
85
+ return resp;
86
+ }
87
+ async *listQuotasIter(req, options) {
88
+ const pageReq = { ...req };
89
+ for (;;) {
90
+ const resp = await this.listQuotas(pageReq, options);
91
+ for (const item of resp.quotas ?? []) yield item;
92
+ if (resp.nextPageToken === void 0 || resp.nextPageToken === "") return;
93
+ pageReq.pageToken = resp.nextPageToken;
94
+ }
95
+ }
96
+ };
97
+
98
+ //#endregion
99
+ export { ResourceQuotasClient };
121
100
  //# 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,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,EAAE,IAAI,CAAC,MAAM;aACpB,CAAC,CAAC;YACH,IAAI,GAAG,aAAa,CAAC,QAAQ,EAAE,iCAAiC,CAAC,CAAC;QACpE,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;IAED,KAAK,CAAC,CAAC,cAAc,CACnB,GAAsB,EACtB,OAAqB;QAErB,MAAM,OAAO,GAAsB,EAAC,GAAG,GAAG,EAAC,CAAC;QAC5C,SAAS,CAAC;YACR,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACrD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;gBACrC,MAAM,IAAI,CAAC;YACb,CAAC;YACD,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,aAAa,KAAK,EAAE,EAAE,CAAC;gBAClE,OAAO;YACT,CAAC;YACD,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC;QACzC,CAAC;IACH,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 parseResponse,\n} from './utils';\nimport pkgJson from '../../package.json' with {type: 'json'};\nimport type {\n GetQuotaRequest,\n GetQuotaResponse,\n ListQuotasRequest,\n ListQuotasResponse,\n QuotaInfo,\n} from './model';\nimport {\n unmarshalGetQuotaResponseSchema,\n unmarshalListQuotasResponseSchema,\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 ResourceQuotasClient {\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 * The GetQuota API returns usage information for a single resource quota, defined as a\n * child-parent pair. This API also refreshes the quota count if it is out of date.\n * Refreshes are triggered asynchronously. The updated count might not be returned in the first call.\n */\n async getQuota(\n req: GetQuotaRequest,\n options?: CallOptions\n ): Promise<GetQuotaResponse> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.1/unity-catalog/resource-quotas/${req.parentSecurableType ?? ''}/${req.parentFullName ?? ''}/${req.quotaName ?? ''}`;\n let resp: GetQuotaResponse | 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', url, headers, callSignal);\n const respBody = await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n resp = parseResponse(respBody, unmarshalGetQuotaResponseSchema);\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 * ListQuotas returns all quota values under the metastore. There are no SLAs on the freshness of the counts\n * returned. This API does not trigger a refresh of quota counts.\n *\n * PAGINATION BEHAVIOR: The API is by default paginated, 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 listQuotas(\n req: ListQuotasRequest,\n options?: CallOptions\n ): Promise<ListQuotasResponse> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.1/unity-catalog/resource-quotas/all-resource-quotas`;\n const params = new URLSearchParams();\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 const query = params.toString();\n const fullUrl = query !== '' ? `${url}?${query}` : url;\n let resp: ListQuotasResponse | 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, unmarshalListQuotasResponseSchema);\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 *listQuotasIter(\n req: ListQuotasRequest,\n options?: CallOptions\n ): AsyncGenerator<QuotaInfo> {\n const pageReq: ListQuotasRequest = {...req};\n for (;;) {\n const resp = await this.listQuotas(pageReq, options);\n for (const item of resp.quotas ?? []) {\n yield item;\n }\n if (resp.nextPageToken === undefined || resp.nextPageToken === '') {\n return;\n }\n pageReq.pageToken = resp.nextPageToken;\n }\n }\n}\n"],"mappings":";;;;;;;;;AA8BA,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;AACrD,OAAK,WAAW,oBAAoB,KAAK,QAAQ;AACjD,SAAO,KAAK;;;;;;;CAQd,MAAM,SACJ,KACA,SAC2B;EAC3B,MAAM,EAAC,MAAM,aAAa,eAAc,MAAM,KAAK,eAAe;EAClE,MAAM,MAAM,GAAG,KAAK,yCAAyC,IAAI,uBAAuB,GAAG,GAAG,IAAI,kBAAkB,GAAG,GAAG,IAAI,aAAa;EAC3I,IAAI;EACJ,MAAM,OAAO,OAAO,eAA4C;GAC9D,MAAM,UAAU,IAAI,SAAS;AAC7B,OAAI,gBAAgB,OAClB,SAAQ,IAAI,6BAA6B,YAAY;AAEvD,WAAQ,IAAI,cAAc,KAAK,UAAU;AAOzC,UAAO,cALU,MAAM,gBAAgB;IACrC,SAFc,iBAAiB,OAAO,KAAK,SAAS,WAAW;IAG/D;IACA,QAAQ,KAAK;IACd,CAAC,EAC6B,gCAAgC;;AAEjE,QAAM,YAAY,MAAM,QAAQ;AAChC,MAAI,SAAS,OACX,OAAM,IAAI,MAAM,wCAAwC;AAE1D,SAAO;;;;;;;;;CAUT,MAAM,WACJ,KACA,SAC6B;EAC7B,MAAM,EAAC,MAAM,aAAa,eAAc,MAAM,KAAK,eAAe;EAClE,MAAM,MAAM,GAAG,KAAK;EACpB,MAAM,SAAS,IAAI,iBAAiB;AACpC,MAAI,IAAI,eAAe,OACrB,QAAO,OAAO,eAAe,OAAO,IAAI,WAAW,CAAC;AAEtD,MAAI,IAAI,cAAc,OACpB,QAAO,OAAO,cAAc,IAAI,UAAU;EAE5C,MAAM,QAAQ,OAAO,UAAU;EAC/B,MAAM,UAAU,UAAU,KAAK,GAAG,IAAI,GAAG,UAAU;EACnD,IAAI;EACJ,MAAM,OAAO,OAAO,eAA4C;GAC9D,MAAM,UAAU,IAAI,SAAS;AAC7B,OAAI,gBAAgB,OAClB,SAAQ,IAAI,6BAA6B,YAAY;AAEvD,WAAQ,IAAI,cAAc,KAAK,UAAU;AAOzC,UAAO,cALU,MAAM,gBAAgB;IACrC,SAFc,iBAAiB,OAAO,SAAS,SAAS,WAAW;IAGnE;IACA,QAAQ,KAAK;IACd,CAAC,EAC6B,kCAAkC;;AAEnE,QAAM,YAAY,MAAM,QAAQ;AAChC,MAAI,SAAS,OACX,OAAM,IAAI,MAAM,wCAAwC;AAE1D,SAAO;;CAGT,OAAO,eACL,KACA,SAC2B;EAC3B,MAAM,UAA6B,EAAC,GAAG,KAAI;AAC3C,WAAS;GACP,MAAM,OAAO,MAAM,KAAK,WAAW,SAAS,QAAQ;AACpD,QAAK,MAAM,QAAQ,KAAK,UAAU,EAAE,CAClC,OAAM;AAER,OAAI,KAAK,kBAAkB,UAAa,KAAK,kBAAkB,GAC7D;AAEF,WAAQ,YAAY,KAAK"}
@@ -1,7 +1,3 @@
1
- /**
2
- * @module v1
3
- */
4
- export { ResourceQuotasClient } from './client';
5
- export { SecurableType } from './model';
6
- export type { GetQuotaRequest, GetQuotaResponse, ListQuotasRequest, ListQuotasResponse, QuotaInfo, } from './model';
7
- //# sourceMappingURL=index.d.ts.map
1
+ import { GetQuotaRequest, GetQuotaResponse, ListQuotasRequest, ListQuotasResponse, QuotaInfo, SecurableType } from "./model.js";
2
+ import { ResourceQuotasClient } from "./client.js";
3
+ export { type GetQuotaRequest, type GetQuotaResponse, type ListQuotasRequest, type ListQuotasResponse, type QuotaInfo, ResourceQuotasClient, SecurableType };
package/dist/v1/index.js CHANGED
@@ -1,7 +1,4 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
- /**
3
- * @module v1
4
- */
5
- export { ResourceQuotasClient } from './client';
6
- export { SecurableType } from './model';
7
- //# sourceMappingURL=index.js.map
1
+ import { SecurableType } from "./model.js";
2
+ import { ResourceQuotasClient } from "./client.js";
3
+
4
+ export { ResourceQuotasClient, SecurableType };
@@ -1,68 +1,71 @@
1
- import { z } from 'zod';
1
+ import { z } from "zod";
2
+
3
+ //#region src/v1/model.d.ts
2
4
  /** The type of Unity Catalog securable. */
3
- export declare const SecurableType: {
4
- readonly CATALOG: "CATALOG";
5
- readonly SCHEMA: "SCHEMA";
6
- readonly TABLE: "TABLE";
7
- readonly STORAGE_CREDENTIAL: "STORAGE_CREDENTIAL";
8
- readonly EXTERNAL_LOCATION: "EXTERNAL_LOCATION";
9
- readonly FUNCTION: "FUNCTION";
10
- readonly SHARE: "SHARE";
11
- readonly PROVIDER: "PROVIDER";
12
- readonly RECIPIENT: "RECIPIENT";
13
- readonly CLEAN_ROOM: "CLEAN_ROOM";
14
- readonly METASTORE: "METASTORE";
15
- readonly PIPELINE: "PIPELINE";
16
- readonly VOLUME: "VOLUME";
17
- readonly CONNECTION: "CONNECTION";
18
- readonly CREDENTIAL: "CREDENTIAL";
19
- readonly EXTERNAL_METADATA: "EXTERNAL_METADATA";
20
- /** TODO: [UC-2980] Staging tables aren't full-fleged securables yet. */
21
- readonly STAGING_TABLE: "STAGING_TABLE";
5
+ declare const SecurableType: {
6
+ readonly CATALOG: "CATALOG";
7
+ readonly SCHEMA: "SCHEMA";
8
+ readonly TABLE: "TABLE";
9
+ readonly STORAGE_CREDENTIAL: "STORAGE_CREDENTIAL";
10
+ readonly EXTERNAL_LOCATION: "EXTERNAL_LOCATION";
11
+ readonly FUNCTION: "FUNCTION";
12
+ readonly SHARE: "SHARE";
13
+ readonly PROVIDER: "PROVIDER";
14
+ readonly RECIPIENT: "RECIPIENT";
15
+ readonly CLEAN_ROOM: "CLEAN_ROOM";
16
+ readonly METASTORE: "METASTORE";
17
+ readonly PIPELINE: "PIPELINE";
18
+ readonly VOLUME: "VOLUME";
19
+ readonly CONNECTION: "CONNECTION";
20
+ readonly CREDENTIAL: "CREDENTIAL";
21
+ readonly EXTERNAL_METADATA: "EXTERNAL_METADATA"; /** TODO: [UC-2980] Staging tables aren't full-fleged securables yet. */
22
+ readonly STAGING_TABLE: "STAGING_TABLE";
22
23
  };
23
- export type SecurableType = (typeof SecurableType)[keyof typeof SecurableType] | (string & {});
24
- export interface GetQuotaRequest {
25
- /** Securable type of the quota parent. */
26
- parentSecurableType?: string | undefined;
27
- /** Full name of the parent resource. Provide the metastore ID if the parent is a metastore. */
28
- parentFullName?: string | undefined;
29
- /** Name of the quota. Follows the pattern of the quota type, with "-quota" added as a suffix. */
30
- quotaName?: string | undefined;
24
+ type SecurableType = (typeof SecurableType)[keyof typeof SecurableType] | (string & {});
25
+ interface GetQuotaRequest {
26
+ /** Securable type of the quota parent. */
27
+ parentSecurableType?: string | undefined;
28
+ /** Full name of the parent resource. Provide the metastore ID if the parent is a metastore. */
29
+ parentFullName?: string | undefined;
30
+ /** Name of the quota. Follows the pattern of the quota type, with "-quota" added as a suffix. */
31
+ quotaName?: string | undefined;
31
32
  }
32
- export interface GetQuotaResponse {
33
- /** The returned QuotaInfo. */
34
- quotaInfo?: QuotaInfo | undefined;
33
+ interface GetQuotaResponse {
34
+ /** The returned QuotaInfo. */
35
+ quotaInfo?: QuotaInfo | undefined;
35
36
  }
36
- export interface ListQuotasRequest {
37
- /** The number of quotas to return. */
38
- maxResults?: number | undefined;
39
- /** Opaque token for the next page of results. */
40
- pageToken?: string | undefined;
37
+ interface ListQuotasRequest {
38
+ /** The number of quotas to return. */
39
+ maxResults?: number | undefined;
40
+ /** Opaque token for the next page of results. */
41
+ pageToken?: string | undefined;
41
42
  }
42
- export interface ListQuotasResponse {
43
- /** An array of returned QuotaInfos. */
44
- quotas?: QuotaInfo[] | undefined;
45
- /**
46
- * Opaque token to retrieve the next page of results. Absent if there are no more pages.
47
- * __page_token__ should be set to this value for the next request.
48
- */
49
- nextPageToken?: string | undefined;
43
+ interface ListQuotasResponse {
44
+ /** An array of returned QuotaInfos. */
45
+ quotas?: QuotaInfo[] | undefined;
46
+ /**
47
+ * Opaque token to retrieve the next page of results. Absent if there are no more pages.
48
+ * __page_token__ should be set to this value for the next request.
49
+ */
50
+ nextPageToken?: string | undefined;
50
51
  }
51
- export interface QuotaInfo {
52
- /** The quota parent securable type. */
53
- parentSecurableType?: SecurableType | undefined;
54
- /** Name of the parent resource. Returns metastore ID if the parent is a metastore. */
55
- parentFullName?: string | undefined;
56
- /** The name of the quota. */
57
- quotaName?: string | undefined;
58
- /** The current usage of the resource quota. */
59
- quotaCount?: number | undefined;
60
- /** The current limit of the resource quota. */
61
- quotaLimit?: number | undefined;
62
- /** The timestamp that indicates when the quota count was last updated. */
63
- lastRefreshedAt?: bigint | undefined;
52
+ interface QuotaInfo {
53
+ /** The quota parent securable type. */
54
+ parentSecurableType?: SecurableType | undefined;
55
+ /** Name of the parent resource. Returns metastore ID if the parent is a metastore. */
56
+ parentFullName?: string | undefined;
57
+ /** The name of the quota. */
58
+ quotaName?: string | undefined;
59
+ /** The current usage of the resource quota. */
60
+ quotaCount?: number | undefined;
61
+ /** The current limit of the resource quota. */
62
+ quotaLimit?: number | undefined;
63
+ /** The timestamp that indicates when the quota count was last updated. */
64
+ lastRefreshedAt?: bigint | undefined;
64
65
  }
65
- export declare const unmarshalGetQuotaResponseSchema: z.ZodType<GetQuotaResponse>;
66
- export declare const unmarshalListQuotasResponseSchema: z.ZodType<ListQuotasResponse>;
67
- export declare const unmarshalQuotaInfoSchema: z.ZodType<QuotaInfo>;
66
+ declare const unmarshalGetQuotaResponseSchema: z.ZodType<GetQuotaResponse>;
67
+ declare const unmarshalListQuotasResponseSchema: z.ZodType<ListQuotasResponse>;
68
+ declare const unmarshalQuotaInfoSchema: z.ZodType<QuotaInfo>;
69
+ //#endregion
70
+ export { GetQuotaRequest, GetQuotaResponse, ListQuotasRequest, ListQuotasResponse, QuotaInfo, SecurableType, unmarshalGetQuotaResponseSchema, unmarshalListQuotasResponseSchema, unmarshalQuotaInfoSchema };
68
71
  //# sourceMappingURL=model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/v1/model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,2CAA2C;AAE3C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;IAiBxB,wEAAwE;;CAEhE,CAAC;AACX,MAAM,MAAM,aAAa,GACrB,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,GAClD,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,+FAA+F;IAC/F,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,iGAAiG;IACjG,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC/B,8BAA8B;IAC9B,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED,M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jC,mBAAA,GAAsB,aAAA;EAVJ;EAYlB,cAAA;EAZS;EAcT,SAAA;EATa;EAWb,UAAA;EARe;EAUf,UAAA;;EAEA,eAAA;AAAA;AAAA,cAGW,+BAAA,EAAiC,CAAA,CAAE,OAAA,CAAQ,gBAAA;AAAA,cAQ3C,iCAAA,EAAmC,CAAA,CAAE,OAAA,CAAQ,kBAAA;AAAA,cAW7C,wBAAA,EAA0B,CAAA,CAAE,OAAA,CAAQ,SAAA"}
package/dist/v1/model.js CHANGED
@@ -1,61 +1,50 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
- import { z } from 'zod';
1
+ import { z } from "zod";
2
+
3
+ //#region src/v1/model.ts
3
4
  /** The type of Unity Catalog securable. */
4
- // eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.
5
- export const SecurableType = {
6
- CATALOG: 'CATALOG',
7
- SCHEMA: 'SCHEMA',
8
- TABLE: 'TABLE',
9
- STORAGE_CREDENTIAL: 'STORAGE_CREDENTIAL',
10
- EXTERNAL_LOCATION: 'EXTERNAL_LOCATION',
11
- FUNCTION: 'FUNCTION',
12
- SHARE: 'SHARE',
13
- PROVIDER: 'PROVIDER',
14
- RECIPIENT: 'RECIPIENT',
15
- CLEAN_ROOM: 'CLEAN_ROOM',
16
- METASTORE: 'METASTORE',
17
- PIPELINE: 'PIPELINE',
18
- VOLUME: 'VOLUME',
19
- CONNECTION: 'CONNECTION',
20
- CREDENTIAL: 'CREDENTIAL',
21
- EXTERNAL_METADATA: 'EXTERNAL_METADATA',
22
- /** TODO: [UC-2980] Staging tables aren't full-fleged securables yet. */
23
- STAGING_TABLE: 'STAGING_TABLE',
5
+ const SecurableType = {
6
+ CATALOG: "CATALOG",
7
+ SCHEMA: "SCHEMA",
8
+ TABLE: "TABLE",
9
+ STORAGE_CREDENTIAL: "STORAGE_CREDENTIAL",
10
+ EXTERNAL_LOCATION: "EXTERNAL_LOCATION",
11
+ FUNCTION: "FUNCTION",
12
+ SHARE: "SHARE",
13
+ PROVIDER: "PROVIDER",
14
+ RECIPIENT: "RECIPIENT",
15
+ CLEAN_ROOM: "CLEAN_ROOM",
16
+ METASTORE: "METASTORE",
17
+ PIPELINE: "PIPELINE",
18
+ VOLUME: "VOLUME",
19
+ CONNECTION: "CONNECTION",
20
+ CREDENTIAL: "CREDENTIAL",
21
+ EXTERNAL_METADATA: "EXTERNAL_METADATA",
22
+ STAGING_TABLE: "STAGING_TABLE"
24
23
  };
25
- export const unmarshalGetQuotaResponseSchema = z
26
- .object({
27
- quota_info: z.lazy(() => unmarshalQuotaInfoSchema).optional(),
28
- })
29
- .transform(d => ({
30
- quotaInfo: d.quota_info,
24
+ const unmarshalGetQuotaResponseSchema = z.object({ quota_info: z.lazy(() => unmarshalQuotaInfoSchema).optional() }).transform((d) => ({ quotaInfo: d.quota_info }));
25
+ const unmarshalListQuotasResponseSchema = z.object({
26
+ quotas: z.array(z.lazy(() => unmarshalQuotaInfoSchema)).optional(),
27
+ next_page_token: z.string().optional()
28
+ }).transform((d) => ({
29
+ quotas: d.quotas,
30
+ nextPageToken: d.next_page_token
31
31
  }));
32
- export const unmarshalListQuotasResponseSchema = z
33
- .object({
34
- quotas: z.array(z.lazy(() => unmarshalQuotaInfoSchema)).optional(),
35
- next_page_token: z.string().optional(),
36
- })
37
- .transform(d => ({
38
- quotas: d.quotas,
39
- nextPageToken: d.next_page_token,
40
- }));
41
- export const unmarshalQuotaInfoSchema = z
42
- .object({
43
- parent_securable_type: z.string().optional(),
44
- parent_full_name: z.string().optional(),
45
- quota_name: z.string().optional(),
46
- quota_count: z.number().optional(),
47
- quota_limit: z.number().optional(),
48
- last_refreshed_at: z
49
- .union([z.number(), z.bigint()])
50
- .transform(v => BigInt(v))
51
- .optional(),
52
- })
53
- .transform(d => ({
54
- parentSecurableType: d.parent_securable_type,
55
- parentFullName: d.parent_full_name,
56
- quotaName: d.quota_name,
57
- quotaCount: d.quota_count,
58
- quotaLimit: d.quota_limit,
59
- lastRefreshedAt: d.last_refreshed_at,
32
+ const unmarshalQuotaInfoSchema = z.object({
33
+ parent_securable_type: z.string().optional(),
34
+ parent_full_name: z.string().optional(),
35
+ quota_name: z.string().optional(),
36
+ quota_count: z.number().optional(),
37
+ quota_limit: z.number().optional(),
38
+ last_refreshed_at: z.union([z.number(), z.bigint()]).transform((v) => BigInt(v)).optional()
39
+ }).transform((d) => ({
40
+ parentSecurableType: d.parent_securable_type,
41
+ parentFullName: d.parent_full_name,
42
+ quotaName: d.quota_name,
43
+ quotaCount: d.quota_count,
44
+ quotaLimit: d.quota_limit,
45
+ lastRefreshedAt: d.last_refreshed_at
60
46
  }));
47
+
48
+ //#endregion
49
+ export { SecurableType, unmarshalGetQuotaResponseSchema, unmarshalListQuotasResponseSchema, unmarshalQuotaInfoSchema };
61
50
  //# sourceMappingURL=model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/v1/model.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,2CAA2C;AAC3C,4FAA4F;AAC5F,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,kBAAkB,EAAE,oBAAoB;IACxC,iBAAiB,EAAE,mBAAmB;IACtC,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,YAAY;IACxB,iBAAiB,EAAE,mBAAmB;IACtC,wEAAwE;IACxE,aAAa,EAAE,eAAe;CACtB,CAAC;AAmDX,MAAM,CAAC,MAAM,+BAA+B,GAAgC,CA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ACD,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACf,mBAAmB,EAAE,CAAC,CAAC,qBAAqB;IAC5C,cAAc,EAAE,CAAC,CAAC,gBAAgB;IAClC,SAAS,EAAE,CAAC,CAAC,UAAU;IACvB,UAAU,EAAE,CAAC,CAAC,WAAW;IACzB,UAAU,EAAE,CAAC,CAAC,WAAW;IACzB,eAAe,EAAE,CAAC,CAAC,iBAAiB;CACrC,CAAC,CAAC,CAAC"}
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 type of Unity Catalog securable. */\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.\nexport const SecurableType = {\n CATALOG: 'CATALOG',\n SCHEMA: 'SCHEMA',\n TABLE: 'TABLE',\n STORAGE_CREDENTIAL: 'STORAGE_CREDENTIAL',\n EXTERNAL_LOCATION: 'EXTERNAL_LOCATION',\n FUNCTION: 'FUNCTION',\n SHARE: 'SHARE',\n PROVIDER: 'PROVIDER',\n RECIPIENT: 'RECIPIENT',\n CLEAN_ROOM: 'CLEAN_ROOM',\n METASTORE: 'METASTORE',\n PIPELINE: 'PIPELINE',\n VOLUME: 'VOLUME',\n CONNECTION: 'CONNECTION',\n CREDENTIAL: 'CREDENTIAL',\n EXTERNAL_METADATA: 'EXTERNAL_METADATA',\n /** TODO: [UC-2980] Staging tables aren't full-fleged securables yet. */\n STAGING_TABLE: 'STAGING_TABLE',\n} as const;\nexport type SecurableType =\n | (typeof SecurableType)[keyof typeof SecurableType]\n | (string & {});\n\nexport interface GetQuotaRequest {\n /** Securable type of the quota parent. */\n parentSecurableType?: string | undefined;\n /** Full name of the parent resource. Provide the metastore ID if the parent is a metastore. */\n parentFullName?: string | undefined;\n /** Name of the quota. Follows the pattern of the quota type, with \"-quota\" added as a suffix. */\n quotaName?: string | undefined;\n}\n\nexport interface GetQuotaResponse {\n /** The returned QuotaInfo. */\n quotaInfo?: QuotaInfo | undefined;\n}\n\nexport interface ListQuotasRequest {\n /** The number of quotas to return. */\n maxResults?: number | undefined;\n /** Opaque token for the next page of results. */\n pageToken?: string | undefined;\n}\n\nexport interface ListQuotasResponse {\n /** An array of returned QuotaInfos. */\n quotas?: QuotaInfo[] | undefined;\n /**\n * Opaque token to retrieve the next page of results. Absent if there are no more pages.\n * __page_token__ should be set to this value for the next request.\n */\n nextPageToken?: string | undefined;\n}\n\nexport interface QuotaInfo {\n /** The quota parent securable type. */\n parentSecurableType?: SecurableType | undefined;\n /** Name of the parent resource. Returns metastore ID if the parent is a metastore. */\n parentFullName?: string | undefined;\n /** The name of the quota. */\n quotaName?: string | undefined;\n /** The current usage of the resource quota. */\n quotaCount?: number | undefined;\n /** The current limit of the resource quota. */\n quotaLimit?: number | undefined;\n /** The timestamp that indicates when the quota count was last updated. */\n lastRefreshedAt?: bigint | undefined;\n}\n\nexport const unmarshalGetQuotaResponseSchema: z.ZodType<GetQuotaResponse> = z\n .object({\n quota_info: z.lazy(() => unmarshalQuotaInfoSchema).optional(),\n })\n .transform(d => ({\n quotaInfo: d.quota_info,\n }));\n\nexport const unmarshalListQuotasResponseSchema: z.ZodType<ListQuotasResponse> =\n z\n .object({\n quotas: z.array(z.lazy(() => unmarshalQuotaInfoSchema)).optional(),\n next_page_token: z.string().optional(),\n })\n .transform(d => ({\n quotas: d.quotas,\n nextPageToken: d.next_page_token,\n }));\n\nexport const unmarshalQuotaInfoSchema: z.ZodType<QuotaInfo> = z\n .object({\n parent_securable_type: z.string().optional(),\n parent_full_name: z.string().optional(),\n quota_name: z.string().optional(),\n quota_count: z.number().optional(),\n quota_limit: z.number().optional(),\n last_refreshed_at: z\n .union([z.number(), z.bigint()])\n .transform(v => BigInt(v))\n .optional(),\n })\n .transform(d => ({\n parentSecurableType: d.parent_securable_type,\n parentFullName: d.parent_full_name,\n quotaName: d.quota_name,\n quotaCount: d.quota_count,\n quotaLimit: d.quota_limit,\n lastRefreshedAt: d.last_refreshed_at,\n }));\n"],"mappings":";;;;AAMA,MAAa,gBAAgB;CAC3B,SAAS;CACT,QAAQ;CACR,OAAO;CACP,oBAAoB;CACpB,mBAAmB;CACnB,UAAU;CACV,OAAO;CACP,UAAU;CACV,WAAW;CACX,YAAY;CACZ,WAAW;CACX,UAAU;CACV,QAAQ;CACR,YAAY;CACZ,YAAY;CACZ,mBAAmB;CAEnB,eAAe;CAChB;AAmDD,MAAa,kCAA+D,EACzE,OAAO,EACN,YAAY,EAAE,WAAW,yBAAyB,CAAC,UAAU,EAC9D,CAAC,CACD,WAAU,OAAM,EACf,WAAW,EAAE,YACd,EAAE;AAEL,MAAa,oCACX,EACG,OAAO;CACN,QAAQ,EAAE,MAAM,EAAE,WAAW,yBAAyB,CAAC,CAAC,UAAU;CAClE,iBAAiB,EAAE,QAAQ,CAAC,UAAU;CACvC,CAAC,CACD,WAAU,OAAM;CACf,QAAQ,EAAE;CACV,eAAe,EAAE;CAClB,EAAE;AAEP,MAAa,2BAAiD,EAC3D,OAAO;CACN,uBAAuB,EAAE,QAAQ,CAAC,UAAU;CAC5C,kBAAkB,EAAE,QAAQ,CAAC,UAAU;CACvC,YAAY,EAAE,QAAQ,CAAC,UAAU;CACjC,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,mBAAmB,EAChB,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC,CAC/B,WAAU,MAAK,OAAO,EAAE,CAAC,CACzB,UAAU;CACd,CAAC,CACD,WAAU,OAAM;CACf,qBAAqB,EAAE;CACvB,gBAAgB,EAAE;CAClB,WAAW,EAAE;CACb,YAAY,EAAE;CACd,YAAY,EAAE;CACd,iBAAiB,EAAE;CACpB,EAAE"}
@@ -1,23 +1,25 @@
1
- import type { HttpClient } from '@databricks/sdk-core/http';
2
- import type { ClientOptions } from '@databricks/sdk-options/client';
1
+ import { HttpClient } from "@databricks/sdk-core/http";
2
+ import { ClientOptions } from "@databricks/sdk-options/client";
3
+
4
+ //#region src/v1/transport.d.ts
3
5
  /**
4
6
  * The configuration a client needs to issue requests, resolved from
5
7
  * {@link ClientOptions} and a configuration profile.
6
8
  */
7
- export interface ResolvedClientConfig {
8
- /** Host with any trailing slash removed. */
9
- host: string;
10
- /**
11
- * Default account ID for account-level paths that contain an account_id
12
- * segment. A request's own accountId still wins.
13
- */
14
- accountId?: string;
15
- /**
16
- * Workspace ID used to route workspace-level calls on unified hosts (SPOG).
17
- */
18
- workspaceId?: string;
19
- /** HTTP client with authentication, and any configured timeout, applied. */
20
- httpClient: HttpClient;
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;
21
23
  }
22
24
  /**
23
25
  * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
@@ -29,5 +31,7 @@ export interface ResolvedClientConfig {
29
31
  *
30
32
  * @throws if host is neither provided nor present in the resolved profile.
31
33
  */
32
- export declare function resolveClientConfig(options: ClientOptions): Promise<ResolvedClientConfig>;
34
+ declare function resolveClientConfig(options: ClientOptions): Promise<ResolvedClientConfig>;
35
+ //#endregion
36
+ export { ResolvedClientConfig, resolveClientConfig };
33
37
  //# sourceMappingURL=transport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/v1/transport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,UAAU,EAGX,MAAM,2BAA2B,CAAC;AAInC,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,4EAA4E;IAC5E,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,oBAAoB,CAAC,CA4B/B"}
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"}
@@ -1,74 +1,65 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
- import { defaultCredentials } from '@databricks/sdk-auth/credentials';
3
- import { newFetchHttpClient } from '@databricks/sdk-core/http';
4
- import { resolve } from '@databricks/sdk-core/profiles';
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
5
6
  /**
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.');
20
- }
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);
30
- }
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
- };
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 = 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
+ if (options.timeout !== void 0) httpClient = new TimeoutHttpClient(httpClient, options.timeout);
22
+ const accountId = options.accountId ?? profile.accountId;
23
+ const workspaceId = options.workspaceId ?? profile.workspaceId;
24
+ return {
25
+ host: host.replace(/\/$/, ""),
26
+ httpClient,
27
+ ...accountId !== void 0 && { accountId },
28
+ ...workspaceId !== void 0 && { workspaceId }
29
+ };
39
30
  }
40
31
  /** Wraps an HttpClient and adds authentication headers to requests. */
41
- class AuthHttpClient {
42
- base;
43
- credentials;
44
- constructor(base, credentials) {
45
- this.base = base;
46
- this.credentials = credentials;
47
- }
48
- async send(request) {
49
- const authHeaders = await this.credentials.authHeaders();
50
- // Do not modify the original request.
51
- const headers = new Headers(request.headers);
52
- for (const h of authHeaders) {
53
- headers.set(h.key, h.value);
54
- }
55
- return this.base.send({ ...request, headers });
56
- }
57
- }
32
+ var AuthHttpClient = class {
33
+ constructor(base, credentials) {
34
+ this.base = base;
35
+ this.credentials = credentials;
36
+ }
37
+ async send(request) {
38
+ const authHeaders = await this.credentials.authHeaders();
39
+ const headers = new Headers(request.headers);
40
+ for (const h of authHeaders) headers.set(h.key, h.value);
41
+ return this.base.send({
42
+ ...request,
43
+ headers
44
+ });
45
+ }
46
+ };
58
47
  /** Wraps an HttpClient and applies a default timeout to requests. */
59
- class TimeoutHttpClient {
60
- base;
61
- timeout;
62
- constructor(base, timeout) {
63
- this.base = base;
64
- this.timeout = timeout;
65
- }
66
- async send(request) {
67
- const timeoutSignal = AbortSignal.timeout(this.timeout);
68
- const signal = request.signal !== undefined
69
- ? AbortSignal.any([request.signal, timeoutSignal])
70
- : timeoutSignal;
71
- return this.base.send({ ...request, signal });
72
- }
73
- }
48
+ var TimeoutHttpClient = class {
49
+ constructor(base, timeout) {
50
+ this.base = base;
51
+ this.timeout = timeout;
52
+ }
53
+ async send(request) {
54
+ const timeoutSignal = AbortSignal.timeout(this.timeout);
55
+ const signal = request.signal !== void 0 ? AbortSignal.any([request.signal, timeoutSignal]) : timeoutSignal;
56
+ return this.base.send({
57
+ ...request,
58
+ signal
59
+ });
60
+ }
61
+ };
62
+
63
+ //#endregion
64
+ export { resolveClientConfig };
74
65
  //# sourceMappingURL=transport.js.map
@@ -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;AAE7D,OAAO,EAAC,OAAO,EAAC,MAAM,+BAA+B,CAAC;AA0B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,SAAI,GAAJ,IAAI,CAAY;QAChB,gBAAW,GAAX,WAAW,CAAa;IACxC,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,OAAoB;QAC7B,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;QACzD,sCAAsC;QACtC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC7C,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAC,GAAG,OAAO,EAAE,OAAO,EAAC,CAAC,CAAC;IAC/C,CAAC;CACF;AAED,qEAAqE;AACrE,MAAM,iBAAiB;IAEF;IACA;IAFnB,YACmB,IAAgB,EAChB,OAAe;QADf,SAAI,GAAJ,IAAI,CAAY;QAChB,YAAO,GAAP,OAAO,CAAQ;IAC/B,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,OAAoB;QAC7B,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxD,MAAM,MAAM,GACV,OAAO,CAAC,MAAM,KAAK,SAAS;YAC1B,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;YAClD,CAAC,CAAC,aAAa,CAAC;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAC,GAAG,OAAO,EAAE,MAAM,EAAC,CAAC,CAAC;IAC9C,CAAC;CACF"}
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 = 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 = options.credentials ?? defaultCredentials({profile});\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: host.replace(/\\/$/, ''),\n httpClient,\n ...(accountId !== undefined && {accountId}),\n ...(workspaceId !== undefined && {workspaceId}),\n };\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}\n"],"mappings":";;;;;;;;;;;;;;;AA+CA,eAAsB,oBACpB,SAC+B;CAC/B,MAAM,UAAmB,MAAM,QAAQ,QAAQ,eAAe;CAE9D,MAAM,OAAO,QAAQ,QAAQ,QAAQ;AACrC,KAAI,SAAS,OACX,OAAM,IAAI,MAAM,oBAAoB;CAStC,IAAI,aAAyB,IAAI,eAFpB,QAAQ,cAAc,oBAAoB,EACnC,QAAQ,eAAe,mBAAmB,EAAC,SAAQ,CAAC,CACN;AAClE,KAAI,QAAQ,YAAY,OACtB,cAAa,IAAI,kBAAkB,YAAY,QAAQ,QAAQ;CAGjE,MAAM,YAAY,QAAQ,aAAa,QAAQ;CAC/C,MAAM,cAAc,QAAQ,eAAe,QAAQ;AAEnD,QAAO;EACL,MAAM,KAAK,QAAQ,OAAO,GAAG;EAC7B;EACA,GAAI,cAAc,UAAa,EAAC,WAAU;EAC1C,GAAI,gBAAgB,UAAa,EAAC,aAAY;EAC/C;;;AAIH,IAAM,iBAAN,MAA2C;CACzC,YACE,AAAiB,MACjB,AAAiB,aACjB;EAFiB;EACA;;CAGnB,MAAM,KAAK,SAA6C;EACtD,MAAM,cAAc,MAAM,KAAK,YAAY,aAAa;EAExD,MAAM,UAAU,IAAI,QAAQ,QAAQ,QAAQ;AAC5C,OAAK,MAAM,KAAK,YACd,SAAQ,IAAI,EAAE,KAAK,EAAE,MAAM;AAE7B,SAAO,KAAK,KAAK,KAAK;GAAC,GAAG;GAAS;GAAQ,CAAC;;;;AAKhD,IAAM,oBAAN,MAA8C;CAC5C,YACE,AAAiB,MACjB,AAAiB,SACjB;EAFiB;EACA;;CAGnB,MAAM,KAAK,SAA6C;EACtD,MAAM,gBAAgB,YAAY,QAAQ,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"}
@@ -1,21 +1,25 @@
1
- import type { HttpClient, HttpRequest } from '@databricks/sdk-core/http';
2
- import type { Logger } from '@databricks/sdk-core/logger';
3
- import type { CallOptions } from '@databricks/sdk-options/call';
4
- import type { z } from 'zod';
5
- export interface HttpCallOptions {
6
- readonly request: HttpRequest;
7
- readonly httpClient: HttpClient;
8
- readonly logger: Logger;
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;
9
11
  }
10
12
  /**
11
13
  * Translates public CallOptions to the internal Options shape accepted by
12
14
  * execute(). Even though the shapes match today, this isolates the public
13
15
  * API from the executor's internal type so they can diverge.
14
16
  */
15
- export declare function executeCall(call: (signal?: AbortSignal) => Promise<void>, options?: CallOptions): Promise<void>;
16
- export declare function executeHttpCall(opts: HttpCallOptions): Promise<Uint8Array>;
17
- export declare function buildHttpRequest(method: string, url: string, headers: Headers, signal?: AbortSignal, body?: string | ReadableStream<Uint8Array>): HttpRequest;
18
- export declare function parseResponse<T>(body: Uint8Array, schema: z.ZodType<T>): T;
19
- export declare function marshalRequest(data: unknown, schema: z.ZodType): string;
20
- export declare function flattenQueryParams(prefix: string, value: unknown, params: URLSearchParams): void;
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 };
21
25
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/v1/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EAEZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAO3B,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,CAAC,MAAM,CAAC,EAA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AAA,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"}
package/dist/v1/utils.js CHANGED
@@ -1,114 +1,87 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
- import { execute } from '@databricks/sdk-core/ops';
3
- import { ApiError } from '@databricks/sdk-core/apierror';
4
- import JSONBig from 'json-bigint';
5
- // JSON codec that preserves int64 precision. On the way in, large integer
6
- // literals come back as bigint instead of being rounded to JS Number. On the
7
- // way out, bigint values are emitted as raw JSON number digits.
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
8
6
  const jsonBigint = JSONBig({ useNativeBigInt: true });
9
7
  /**
10
- * Translates public CallOptions to the internal Options shape accepted by
11
- * execute(). Even though the shapes match today, this isolates the public
12
- * API from the executor's internal type so they can diverge.
13
- */
14
- export async function executeCall(call, options) {
15
- const opts = {
16
- ...(options?.retrier !== undefined && { retrier: options.retrier }),
17
- ...(options?.rateLimiter !== undefined && {
18
- rateLimiter: options.rateLimiter,
19
- }),
20
- ...(options?.timeout !== undefined && { timeout: options.timeout }),
21
- };
22
- return execute(options?.signal, call, opts);
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);
23
19
  }
24
20
  async function readAll(body) {
25
- if (body === null) {
26
- return new Uint8Array(0);
27
- }
28
- const reader = body.getReader();
29
- const chunks = [];
30
- for (;;) {
31
- const { done, value } = await reader.read();
32
- if (done) {
33
- break;
34
- }
35
- chunks.push(value);
36
- }
37
- const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
38
- const result = new Uint8Array(totalLength);
39
- let offset = 0;
40
- for (const chunk of chunks) {
41
- result.set(chunk, offset);
42
- offset += chunk.length;
43
- }
44
- return result;
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;
45
37
  }
46
- export async function executeHttpCall(opts) {
47
- opts.logger.debug('HTTP request', {
48
- method: opts.request.method,
49
- url: opts.request.url,
50
- });
51
- let resp;
52
- try {
53
- resp = await opts.httpClient.send(opts.request);
54
- }
55
- catch (e) {
56
- opts.logger.debug('HTTP request failed');
57
- throw e;
58
- }
59
- const body = await readAll(resp.body);
60
- opts.logger.debug('HTTP response', {
61
- statusCode: resp.statusCode,
62
- body: new TextDecoder().decode(body),
63
- });
64
- const apiErr = ApiError.fromHttpError(resp.statusCode, resp.headers, body);
65
- if (apiErr !== undefined) {
66
- throw apiErr;
67
- }
68
- return body;
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;
69
58
  }
70
- export function buildHttpRequest(method, url, headers, signal, body) {
71
- const req = { url, method, headers };
72
- if (body !== undefined) {
73
- req.body = body;
74
- }
75
- if (signal !== undefined) {
76
- req.signal = signal;
77
- }
78
- return req;
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;
79
68
  }
80
- export function parseResponse(body, schema) {
81
- const text = new TextDecoder().decode(body);
82
- // 204 responses return an empty body; treat as `{}`.
83
- const parsed = text === '' ? {} : jsonBigint.parse(text);
84
- return schema.parse(parsed);
69
+ function parseResponse(body, schema) {
70
+ const text = new TextDecoder().decode(body);
71
+ const parsed = text === "" ? {} : jsonBigint.parse(text);
72
+ return schema.parse(parsed);
85
73
  }
86
- export function marshalRequest(data, schema) {
87
- return jsonBigint.stringify(schema.parse(data));
74
+ function marshalRequest(data, schema) {
75
+ return jsonBigint.stringify(schema.parse(data));
88
76
  }
89
- export function flattenQueryParams(prefix, value, params) {
90
- if (value === null || value === undefined) {
91
- return;
92
- }
93
- if (Array.isArray(value)) {
94
- // arrays of objects are not yet supported
95
- for (const item of value) {
96
- params.append(prefix, String(item));
97
- }
98
- }
99
- else if (typeof value === 'object') {
100
- for (const [key, val] of Object.entries(value)) {
101
- flattenQueryParams(`${prefix}.${key}`, val, params);
102
- }
103
- }
104
- else if (typeof value === 'string' ||
105
- typeof value === 'number' ||
106
- typeof value === 'boolean' ||
107
- typeof value === 'bigint') {
108
- params.append(prefix, String(value));
109
- }
110
- else {
111
- throw new Error(`Unsupported query parameter type: ${typeof value}`);
112
- }
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}`);
113
83
  }
84
+
85
+ //#endregion
86
+ export { buildHttpRequest, executeCall, executeHttpCall, flattenQueryParams, marshalRequest, parseResponse };
114
87
  //# sourceMappingURL=utils.js.map
@@ -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,OAAO,CAAC,OAAO,EAAC,CAAC;KAClE,CAAC;IACF,OAAO,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,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":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,S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A,MACa;CACb,MAAM,MAAmB;EAAC;EAAK;EAAQ;EAAQ;AAC/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,6 +1,6 @@
1
1
  {
2
2
  "name": "@databricks/sdk-uc-resourcequotas",
3
- "version": "0.27.0",
3
+ "version": "0.35.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {
@@ -15,7 +15,7 @@
15
15
  "LICENSE"
16
16
  ],
17
17
  "scripts": {
18
- "build": "tsc -b",
18
+ "build": "tsdown",
19
19
  "lint": "eslint src --ext .ts",
20
20
  "lint:fix": "eslint src --ext .ts --fix",
21
21
  "format": "prettier --write \"src/**/*.ts\"",
@@ -33,9 +33,9 @@
33
33
  "directory": "packages/uc/resourcequotas"
34
34
  },
35
35
  "dependencies": {
36
- "@databricks/sdk-auth": ">=0.27.0 <1.0.0",
37
- "@databricks/sdk-core": ">=0.27.0 <1.0.0",
38
- "@databricks/sdk-options": ">=0.27.0 <1.0.0",
36
+ "@databricks/sdk-auth": ">=0.35.0 <1.0.0",
37
+ "@databricks/sdk-core": ">=0.35.0 <1.0.0",
38
+ "@databricks/sdk-options": ">=0.35.0 <1.0.0",
39
39
  "@js-temporal/polyfill": "^0.5.0",
40
40
  "json-bigint": "^1.0.0",
41
41
  "zod": "^4.3.6"
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,EAAC,oBAAoB,EAAC,MAAM,UAAU,CAAC;AAE9C,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AAEtC,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,GACV,MAAM,SAAS,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E;;GAEG;AAEH,OAAO,EAAC,oBAAoB,EAAC,MAAM,UAAU,CAAC;AAE9C,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC"}