@databricks/sdk-knowledge 0.0.0-stage → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +203 -0
- package/README.md +22 -2
- package/dist/package.js +7 -0
- package/dist/package.js.map +1 -0
- package/dist/v1/client.d.ts +83 -0
- package/dist/v1/client.d.ts.map +1 -0
- package/dist/v1/client.js +260 -0
- package/dist/v1/client.js.map +1 -0
- package/dist/v1/index.d.ts +3 -0
- package/dist/v1/index.js +4 -0
- package/dist/v1/model.d.ts +289 -0
- package/dist/v1/model.d.ts.map +1 -0
- package/dist/v1/model.js +122 -0
- package/dist/v1/model.js.map +1 -0
- package/dist/v1/transport.d.ts +37 -0
- package/dist/v1/transport.d.ts.map +1 -0
- package/dist/v1/transport.js +73 -0
- package/dist/v1/transport.js.map +1 -0
- package/dist/v1/utils.d.ts +25 -0
- package/dist/v1/utils.d.ts.map +1 -0
- package/dist/v1/utils.js +87 -0
- package/dist/v1/utils.js.map +1 -0
- package/package.json +44 -4
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { FieldMask } from "@databricks/sdk-core/wkt";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/v1/model.d.ts
|
|
6
|
+
/** Kind of asset an AssetLink points to. */
|
|
7
|
+
declare const AssetType: {
|
|
8
|
+
/** Default value. Returned when the asset type is unset or unknown. */readonly ASSET_TYPE_UNSPECIFIED: "ASSET_TYPE_UNSPECIFIED";
|
|
9
|
+
/**
|
|
10
|
+
* UC table, metric view, or materialized view. Create accepts a table UUID
|
|
11
|
+
* or fully qualified name (FQN, `catalog.schema.table`). Create and Get return
|
|
12
|
+
* the table's current FQN. `asset_scope_id` is the metastore UUID.
|
|
13
|
+
*/
|
|
14
|
+
readonly ASSET_TYPE_UC_TABLE: "ASSET_TYPE_UC_TABLE";
|
|
15
|
+
/**
|
|
16
|
+
* Workspace dashboard. Create accepts a numeric tree ID or a Lakeview UUID
|
|
17
|
+
* (32 hex digits or hyphenated). Create and Get return the tree ID.
|
|
18
|
+
* `asset_scope_id` is the decimal workspace ID string.
|
|
19
|
+
*/
|
|
20
|
+
readonly ASSET_TYPE_WORKSPACE_DASHBOARD: "ASSET_TYPE_WORKSPACE_DASHBOARD";
|
|
21
|
+
/**
|
|
22
|
+
* Genie agent (space). `asset_id` is the native space ID: 32 lowercase
|
|
23
|
+
* hexadecimal characters without hyphens. `asset_scope_id` is the decimal
|
|
24
|
+
* workspace ID string.
|
|
25
|
+
*/
|
|
26
|
+
readonly ASSET_TYPE_WORKSPACE_GENIE_AGENT: "ASSET_TYPE_WORKSPACE_GENIE_AGENT";
|
|
27
|
+
/**
|
|
28
|
+
* Workspace notebook. `asset_id` is its numeric workspace tree ID.
|
|
29
|
+
* `asset_scope_id` is the decimal workspace ID string.
|
|
30
|
+
*/
|
|
31
|
+
readonly ASSET_TYPE_WORKSPACE_NOTEBOOK: "ASSET_TYPE_WORKSPACE_NOTEBOOK";
|
|
32
|
+
/**
|
|
33
|
+
* Databricks app. Create accepts its UUID or app name; Create and Get return
|
|
34
|
+
* the stable app UUID, including when Create receives a name.
|
|
35
|
+
* `asset_scope_id` is the decimal workspace ID string.
|
|
36
|
+
*/
|
|
37
|
+
readonly ASSET_TYPE_WORKSPACE_APP: "ASSET_TYPE_WORKSPACE_APP";
|
|
38
|
+
/**
|
|
39
|
+
* Saved DBSQL query. `asset_id` is the saved-query UUID in hyphenated form.
|
|
40
|
+
* `asset_scope_id` is the decimal workspace ID string.
|
|
41
|
+
*/
|
|
42
|
+
readonly ASSET_TYPE_WORKSPACE_DBSQL_QUERY: "ASSET_TYPE_WORKSPACE_DBSQL_QUERY";
|
|
43
|
+
/**
|
|
44
|
+
* Another knowledge page in the same account. `asset_id` is the bare page
|
|
45
|
+
* UUID, without the `pages/` prefix. `asset_scope_id` is the calling account UUID.
|
|
46
|
+
*/
|
|
47
|
+
readonly ASSET_TYPE_ACCOUNT_PAGE: "ASSET_TYPE_ACCOUNT_PAGE"; /** Deprecated. Account-user links are not supported by the public API. */
|
|
48
|
+
readonly ASSET_TYPE_ACCOUNT_USER: "ASSET_TYPE_ACCOUNT_USER";
|
|
49
|
+
/**
|
|
50
|
+
* External resource. `asset_id` is an absolute HTTP or HTTPS URL with a host,
|
|
51
|
+
* up to 2,048 characters. `asset_scope_id` is the calling account UUID.
|
|
52
|
+
*/
|
|
53
|
+
readonly ASSET_TYPE_EXTERNAL_URL: "ASSET_TYPE_EXTERNAL_URL";
|
|
54
|
+
};
|
|
55
|
+
type AssetType = (typeof AssetType)[keyof typeof AssetType] | (string & {});
|
|
56
|
+
/** Lifecycle state of a Page. */
|
|
57
|
+
declare const State: {
|
|
58
|
+
/** Default value. Returned when the lifecycle state is unset or unknown. */readonly STATE_UNSPECIFIED: "STATE_UNSPECIFIED"; /** The page is a work-in-progress draft. */
|
|
59
|
+
readonly DRAFT: "DRAFT"; /** The page is published and discoverable. */
|
|
60
|
+
readonly PUBLISHED: "PUBLISHED";
|
|
61
|
+
};
|
|
62
|
+
type State = (typeof State)[keyof typeof State] | (string & {});
|
|
63
|
+
/**
|
|
64
|
+
* A reference or provenance link from a page to an asset.
|
|
65
|
+
* Links are immutable; to change the target, delete and re-create the link.
|
|
66
|
+
*/
|
|
67
|
+
interface AssetLink {
|
|
68
|
+
/**
|
|
69
|
+
* Resource name of the link. Server-assigned on create, immutable thereafter.
|
|
70
|
+
* Format: `pages/{page_id}/asset-link-categories/{category}/asset-links/{link_id}`,
|
|
71
|
+
* where `category` is `SOURCE` or `RELATED_ASSETS` and `link_id` is a
|
|
72
|
+
* server-generated UUID. Omit on create; use the returned name for Get/Delete.
|
|
73
|
+
*/
|
|
74
|
+
name?: string | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Kind of asset this link points to. Required on create;
|
|
77
|
+
* `ASSET_TYPE_UNSPECIFIED` is not a valid target type.
|
|
78
|
+
*/
|
|
79
|
+
assetType?: AssetType | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Containing scope of the asset. Required on create for every asset type:
|
|
82
|
+
* - UC table: metastore UUID.
|
|
83
|
+
* - Workspace asset: decimal workspace ID string.
|
|
84
|
+
* - Account page or external URL: the calling account UUID.
|
|
85
|
+
* Pass the bare ID, without a resource-name prefix. Query and Genie links,
|
|
86
|
+
* dashboard UUID inputs, and app-name inputs require this scope to match the
|
|
87
|
+
* caller's workspace.
|
|
88
|
+
*/
|
|
89
|
+
assetScopeId?: string | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Target identifier within `asset_scope_id`. Required on create. The accepted
|
|
92
|
+
* format depends on `asset_type`; see the identifier rules on each AssetType.
|
|
93
|
+
* For Databricks assets, pass the bare identifier rather than a resource name
|
|
94
|
+
* such as `pages/{page_id}` or `queries/{query_id}`. External assets use the
|
|
95
|
+
* full URL. Create and Get return table FQNs, app UUIDs,
|
|
96
|
+
* query UUIDs, and native Genie space IDs.
|
|
97
|
+
*/
|
|
98
|
+
assetId?: string | undefined;
|
|
99
|
+
/** Server-assigned creation time, formatted as an RFC 3339 timestamp in JSON. */
|
|
100
|
+
createTime?: Temporal.Instant | undefined;
|
|
101
|
+
}
|
|
102
|
+
/** Request for CreateAssetLink. */
|
|
103
|
+
interface CreateAssetLinkRequest {
|
|
104
|
+
/**
|
|
105
|
+
* Category collection on the page in which to create the link.
|
|
106
|
+
* Format: `pages/{page_id}/asset-link-categories/{category}`, where
|
|
107
|
+
* `{category}` is a `LinkCategory` value (`SOURCE` or `RELATED_ASSETS`).
|
|
108
|
+
*/
|
|
109
|
+
parent?: string | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* The link to create. `asset_type`, `asset_scope_id`, and `asset_id` are
|
|
112
|
+
* required. The server assigns `name` and `create_time`; the path supplies
|
|
113
|
+
* the page and category. A duplicate target in that category returns the
|
|
114
|
+
* existing link.
|
|
115
|
+
*/
|
|
116
|
+
assetLink?: AssetLink | undefined;
|
|
117
|
+
}
|
|
118
|
+
/** Request for CreatePage. */
|
|
119
|
+
interface CreatePageRequest {
|
|
120
|
+
/**
|
|
121
|
+
* The page to create. `domain` and `display_name` are required; the server
|
|
122
|
+
* assigns `name`, `create_time`, and `update_time`. Other fields follow the
|
|
123
|
+
* defaults and format requirements documented on Page.
|
|
124
|
+
*/
|
|
125
|
+
page?: Page | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* Optional UUIDv4 scoped to the account and caller. Retries return the current
|
|
128
|
+
* page without applying retry payload changes. Every retry must pass request
|
|
129
|
+
* validation and current create permissions, plus view permission on the returned
|
|
130
|
+
* page. Deletion releases the token; later retries may create a new page.
|
|
131
|
+
*/
|
|
132
|
+
requestId?: string | undefined;
|
|
133
|
+
}
|
|
134
|
+
/** Request for DeleteAssetLink. */
|
|
135
|
+
interface DeleteAssetLinkRequest {
|
|
136
|
+
/**
|
|
137
|
+
* Resource name of the link to delete.
|
|
138
|
+
* Format:
|
|
139
|
+
* `pages/{page_id}/asset-link-categories/{category}/asset-links/{link_id}`
|
|
140
|
+
*/
|
|
141
|
+
name?: string | undefined;
|
|
142
|
+
}
|
|
143
|
+
/** Request for DeletePage. */
|
|
144
|
+
interface DeletePageRequest {
|
|
145
|
+
/**
|
|
146
|
+
* Resource name of the page to delete.
|
|
147
|
+
* Format: `pages/{page_id}`
|
|
148
|
+
*/
|
|
149
|
+
name?: string | undefined;
|
|
150
|
+
}
|
|
151
|
+
/** Request for GetAssetLink. */
|
|
152
|
+
interface GetAssetLinkRequest {
|
|
153
|
+
/**
|
|
154
|
+
* Resource name of the link to retrieve.
|
|
155
|
+
* Format:
|
|
156
|
+
* `pages/{page_id}/asset-link-categories/{category}/asset-links/{link_id}`
|
|
157
|
+
*/
|
|
158
|
+
name?: string | undefined;
|
|
159
|
+
}
|
|
160
|
+
/** Request for GetPage. */
|
|
161
|
+
interface GetPageRequest {
|
|
162
|
+
/**
|
|
163
|
+
* Resource name of the page to retrieve.
|
|
164
|
+
* Format: `pages/{page_id}`
|
|
165
|
+
*/
|
|
166
|
+
name?: string | undefined;
|
|
167
|
+
}
|
|
168
|
+
/** Request for ListPages. */
|
|
169
|
+
interface ListPagesRequest {
|
|
170
|
+
/**
|
|
171
|
+
* Maximum number of pages to return, from 1 to 100. Defaults to 50 when omitted.
|
|
172
|
+
* The server may return fewer.
|
|
173
|
+
*/
|
|
174
|
+
pageSize?: number | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* Opaque `next_page_token` from a previous ListPages response. Omit on the
|
|
177
|
+
* first request; pass it unchanged and keep the same filter when continuing.
|
|
178
|
+
*/
|
|
179
|
+
pageToken?: string | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* Filter clauses with double-quoted values, joined by uppercase `AND`.
|
|
182
|
+
* Each field may appear once:
|
|
183
|
+
* - `domain = "domains/{domain_id}"` includes that domain and its subdomains.
|
|
184
|
+
* - `state = "DRAFT"` or `state = "PUBLISHED"` matches that state exactly.
|
|
185
|
+
* For example: `domain = "domains/{domain_id}" AND state = "PUBLISHED"`.
|
|
186
|
+
* Other fields and operators are not supported. An omitted or blank filter
|
|
187
|
+
* lists visible pages across the account, subject to ListPages permissions.
|
|
188
|
+
*/
|
|
189
|
+
filter?: string | undefined;
|
|
190
|
+
}
|
|
191
|
+
/** Response for ListPages. */
|
|
192
|
+
interface ListPagesResponse {
|
|
193
|
+
/**
|
|
194
|
+
* The requested pages. Each page includes only `name`, `display_name`,
|
|
195
|
+
* `domain`, `state`, and `update_time`. Use GetPage for the full resource.
|
|
196
|
+
* The list can be empty even when `next_page_token` is present.
|
|
197
|
+
*/
|
|
198
|
+
pages?: Page[] | undefined;
|
|
199
|
+
/**
|
|
200
|
+
* Opaque continuation token. Pass as `page_token` to continue, even if this
|
|
201
|
+
* response contains fewer than `page_size` pages or no pages. An absent or
|
|
202
|
+
* empty token means there are no more results.
|
|
203
|
+
*/
|
|
204
|
+
nextPageToken?: string | undefined;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* A knowledge page: a domain-scoped governance document describing a concept
|
|
208
|
+
* or term in the account.
|
|
209
|
+
*/
|
|
210
|
+
interface Page {
|
|
211
|
+
/**
|
|
212
|
+
* Resource name in the form `pages/{page_id}`, where `page_id` is a
|
|
213
|
+
* server-generated UUID. Omit on create; required to identify the page on
|
|
214
|
+
* update. Get and Delete also address pages by this full resource name.
|
|
215
|
+
*/
|
|
216
|
+
name?: string | undefined;
|
|
217
|
+
/**
|
|
218
|
+
* Resource name of the domain this page belongs to; format `domains/{domain_id}`.
|
|
219
|
+
* Required on create and when selected by `update_mask`.
|
|
220
|
+
* Use the full resource name rather than a bare domain ID.
|
|
221
|
+
*/
|
|
222
|
+
domain?: string | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* Human-readable title, 1 to 200 characters.
|
|
225
|
+
* Required on create and when selected by `update_mask`.
|
|
226
|
+
* Published titles must be unique within the domain.
|
|
227
|
+
*/
|
|
228
|
+
displayName?: string | undefined;
|
|
229
|
+
/**
|
|
230
|
+
* Page body as Markdown text. An update replaces the entire body when
|
|
231
|
+
* `body` is selected by `update_mask`.
|
|
232
|
+
*/
|
|
233
|
+
body?: string | undefined;
|
|
234
|
+
/**
|
|
235
|
+
* Alternate names or abbreviations. Accepts at most 50 entries, each 1 to
|
|
236
|
+
* 200 characters. Values are trimmed, deduplicated, and sorted.
|
|
237
|
+
* An update replaces the entire list when `synonyms` is selected by
|
|
238
|
+
* `update_mask`; an empty list clears it.
|
|
239
|
+
*/
|
|
240
|
+
synonyms?: string[] | undefined;
|
|
241
|
+
/**
|
|
242
|
+
* Short description of the page. An update replaces the description when
|
|
243
|
+
* `description` is selected by `update_mask`.
|
|
244
|
+
*/
|
|
245
|
+
description?: string | undefined;
|
|
246
|
+
/**
|
|
247
|
+
* Lifecycle state. Omitting it on create defaults to `DRAFT`. Set `PUBLISHED`
|
|
248
|
+
* to publish or `DRAFT` to unpublish. An update selecting `state` in
|
|
249
|
+
* `update_mask` must explicitly supply `DRAFT` or `PUBLISHED`.
|
|
250
|
+
*/
|
|
251
|
+
state?: State | undefined;
|
|
252
|
+
/** Server-assigned creation time, formatted as an RFC 3339 timestamp in JSON. */
|
|
253
|
+
createTime?: Temporal.Instant | undefined;
|
|
254
|
+
/** Server-assigned last-update time, formatted as an RFC 3339 timestamp in JSON. */
|
|
255
|
+
updateTime?: Temporal.Instant | undefined;
|
|
256
|
+
/**
|
|
257
|
+
* Decimal principal ID strings for the page's single owner: a user, group,
|
|
258
|
+
* or service principal. Use principal IDs rather than email addresses or
|
|
259
|
+
* service-principal application UUIDs. On create, an omitted or empty list
|
|
260
|
+
* defaults to the caller; at most one ID may be supplied. An update selecting
|
|
261
|
+
* `owner_ids` in `update_mask` must supply exactly one ID to replace the owner.
|
|
262
|
+
*/
|
|
263
|
+
ownerIds?: string[] | undefined;
|
|
264
|
+
}
|
|
265
|
+
/** Request for UpdatePage. */
|
|
266
|
+
interface UpdatePageRequest {
|
|
267
|
+
/**
|
|
268
|
+
* The page to update. `name` is required in the form `pages/{page_id}`.
|
|
269
|
+
* Only fields selected by `update_mask` are written.
|
|
270
|
+
*/
|
|
271
|
+
page?: Page | undefined;
|
|
272
|
+
/**
|
|
273
|
+
* Nonempty set of Page fields to update. Supported paths are `domain`, `display_name`,
|
|
274
|
+
* `body`, `synonyms`, `description`, `state`, and `owner_ids`, without a `page.`
|
|
275
|
+
* prefix. Wildcards and server-assigned fields are not supported.
|
|
276
|
+
* In REST requests, pass a comma-separated query parameter, for example
|
|
277
|
+
* `update_mask=display_name,body`. There is no implicit update of all fields.
|
|
278
|
+
*/
|
|
279
|
+
updateMask?: FieldMask<Page> | undefined;
|
|
280
|
+
}
|
|
281
|
+
declare const unmarshalAssetLinkSchema: z.ZodType<AssetLink>;
|
|
282
|
+
declare const unmarshalListPagesResponseSchema: z.ZodType<ListPagesResponse>;
|
|
283
|
+
declare const unmarshalPageSchema: z.ZodType<Page>;
|
|
284
|
+
declare const marshalAssetLinkSchema: z.ZodType;
|
|
285
|
+
declare const marshalPageSchema: z.ZodType;
|
|
286
|
+
declare function pageFieldMask(...paths: string[]): FieldMask<Page>;
|
|
287
|
+
//#endregion
|
|
288
|
+
export { AssetLink, AssetType, CreateAssetLinkRequest, CreatePageRequest, DeleteAssetLinkRequest, DeletePageRequest, GetAssetLinkRequest, GetPageRequest, ListPagesRequest, ListPagesResponse, Page, State, UpdatePageRequest, marshalAssetLinkSchema, marshalPageSchema, pageFieldMask, unmarshalAssetLinkSchema, unmarshalListPagesResponseSchema, unmarshalPageSchema };
|
|
289
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","names":[],"sources":["../../src/v1/model.ts"],"mappings":";;;;;;cASa,SAAA;EAAA;;;;;;;;;;;;;;;AAkDb;;;;EAC6C;AAK7C;;;EAL6C;;;;;;;EAa5B;;;;EAAA;EAMS;;;;EAAA,6DAYZ;EAAA;EAmBZ;;;;EAAA;;KAnDU,SAAA,WACA,SAAA,eAAwB,SAAA;;cAKvB,KAAA;EAgEU,6HAArB;EAAA,yBAAqB;EAAA;;KAxDX,KAAA,WAAgB,KAAA,eAAoB,KAAA;;;;;UAM/B,SAAA;EAmEN;;AAIX;;;;EAhEE,IAAA;EA0Ee;;;;EArEf,SAAA,GAAY,SAAA;EA8EG;;;;;AAUjB;;;;EA9EE,YAAA;EAuFe;;;;;;;;EA9Ef,OAAA;EAsGe;EApGf,UAAA,GAAa,QAAA,CAAS,OAAA;AAAA;;UAIP,sBAAA;EAsGP;;;;AAaV;EA7GE,MAAA;;;;;;;EAOA,SAAA,GAAY,SAAA;AAAA;;UAIG,iBAAA;EAgIf;;;;;EA1HA,IAAA,GAAO,IAAA;EAuIe;;;;;;EAhItB,SAAA;AAAA;;UAIe,sBAAA;EA+IR;;;;;EAzIP,IAAA;AAAA;;UAIe,iBAAA;EA6IQ;;;AAGzB;EA3IE,IAAA;AAAA;;UAIe,mBAAA;EAuIwB;;;;AAmBzC;EApJE,IAAA;AAAA;;UAIe,cAAA;EAgJgC;;;;EA3I/C,IAAA;AAAA;;UAIe,gBAAA;EAiJiB;;;;EA5IhC,QAAA;EA4KW;;;;EAvKX,SAAA;EA0LW;;;;;AA6Cb;;;;EA7NE,MAAA;AAAA;;UAIe,iBAAA;EAyNgD;;;;;EAnN/D,KAAA,GAAQ,IAAA;;;;;;EAMR,aAAA;AAAA;;;;;UAOe,IAAA;;;;;;EAMf,IAAA;;;;;;EAMA,MAAA;;;;;;EAMA,WAAA;;;;;EAKA,IAAA;;;;;;;EAOA,QAAA;;;;;EAKA,WAAA;;;;;;EAMA,KAAA,GAAQ,KAAA;;EAER,UAAA,GAAa,QAAA,CAAS,OAAA;;EAEtB,UAAA,GAAa,QAAA,CAAS,OAAA;;;;;;;;EAQtB,QAAA;AAAA;;UAIe,iBAAA;;;;;EAKf,IAAA,GAAO,IAAA;;;;;;;;EAQP,UAAA,GAAa,SAAA,CAAU,IAAA;AAAA;AAAA,cAGZ,wBAAA,EAA0B,CAAA,CAAE,OAAA,CAAQ,SAAA;AAAA,cAmBpC,gCAAA,EAAkC,CAAA,CAAE,OAAA,CAAQ,iBAAA;AAAA,cAU5C,mBAAA,EAAqB,CAAA,CAAE,OAAA,CAAQ,IAAA;AAAA,cAgC/B,sBAAA,EAAwB,CAAA,CAAE,OAAA;AAAA,cAmB1B,iBAAA,EAAmB,CAAA,CAAE,OAAA;AAAA,iBA6ClB,aAAA,CAAA,GAAiB,KAAA,aAAkB,SAAA,CAAU,IAAA"}
|
package/dist/v1/model.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { FieldMask } from "@databricks/sdk-core/wkt";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/v1/model.ts
|
|
6
|
+
/** Kind of asset an AssetLink points to. */
|
|
7
|
+
const AssetType = {
|
|
8
|
+
ASSET_TYPE_UNSPECIFIED: "ASSET_TYPE_UNSPECIFIED",
|
|
9
|
+
ASSET_TYPE_UC_TABLE: "ASSET_TYPE_UC_TABLE",
|
|
10
|
+
ASSET_TYPE_WORKSPACE_DASHBOARD: "ASSET_TYPE_WORKSPACE_DASHBOARD",
|
|
11
|
+
ASSET_TYPE_WORKSPACE_GENIE_AGENT: "ASSET_TYPE_WORKSPACE_GENIE_AGENT",
|
|
12
|
+
ASSET_TYPE_WORKSPACE_NOTEBOOK: "ASSET_TYPE_WORKSPACE_NOTEBOOK",
|
|
13
|
+
ASSET_TYPE_WORKSPACE_APP: "ASSET_TYPE_WORKSPACE_APP",
|
|
14
|
+
ASSET_TYPE_WORKSPACE_DBSQL_QUERY: "ASSET_TYPE_WORKSPACE_DBSQL_QUERY",
|
|
15
|
+
ASSET_TYPE_ACCOUNT_PAGE: "ASSET_TYPE_ACCOUNT_PAGE",
|
|
16
|
+
ASSET_TYPE_ACCOUNT_USER: "ASSET_TYPE_ACCOUNT_USER",
|
|
17
|
+
ASSET_TYPE_EXTERNAL_URL: "ASSET_TYPE_EXTERNAL_URL"
|
|
18
|
+
};
|
|
19
|
+
/** Lifecycle state of a Page. */
|
|
20
|
+
const State = {
|
|
21
|
+
STATE_UNSPECIFIED: "STATE_UNSPECIFIED",
|
|
22
|
+
DRAFT: "DRAFT",
|
|
23
|
+
PUBLISHED: "PUBLISHED"
|
|
24
|
+
};
|
|
25
|
+
const unmarshalAssetLinkSchema = z.object({
|
|
26
|
+
name: z.string().optional(),
|
|
27
|
+
asset_type: z.string().optional(),
|
|
28
|
+
asset_scope_id: z.string().optional(),
|
|
29
|
+
asset_id: z.string().optional(),
|
|
30
|
+
create_time: z.string().transform((s) => Temporal.Instant.from(s)).optional()
|
|
31
|
+
}).transform((d) => ({
|
|
32
|
+
name: d.name,
|
|
33
|
+
assetType: d.asset_type,
|
|
34
|
+
assetScopeId: d.asset_scope_id,
|
|
35
|
+
assetId: d.asset_id,
|
|
36
|
+
createTime: d.create_time
|
|
37
|
+
}));
|
|
38
|
+
const unmarshalListPagesResponseSchema = z.object({
|
|
39
|
+
pages: z.array(z.lazy(() => unmarshalPageSchema)).optional(),
|
|
40
|
+
next_page_token: z.string().optional()
|
|
41
|
+
}).transform((d) => ({
|
|
42
|
+
pages: d.pages,
|
|
43
|
+
nextPageToken: d.next_page_token
|
|
44
|
+
}));
|
|
45
|
+
const unmarshalPageSchema = z.object({
|
|
46
|
+
name: z.string().optional(),
|
|
47
|
+
domain: z.string().optional(),
|
|
48
|
+
display_name: z.string().optional(),
|
|
49
|
+
body: z.string().optional(),
|
|
50
|
+
synonyms: z.array(z.string()).optional(),
|
|
51
|
+
description: z.string().optional(),
|
|
52
|
+
state: z.string().optional(),
|
|
53
|
+
create_time: z.string().transform((s) => Temporal.Instant.from(s)).optional(),
|
|
54
|
+
update_time: z.string().transform((s) => Temporal.Instant.from(s)).optional(),
|
|
55
|
+
owner_ids: z.array(z.string()).optional()
|
|
56
|
+
}).transform((d) => ({
|
|
57
|
+
name: d.name,
|
|
58
|
+
domain: d.domain,
|
|
59
|
+
displayName: d.display_name,
|
|
60
|
+
body: d.body,
|
|
61
|
+
synonyms: d.synonyms,
|
|
62
|
+
description: d.description,
|
|
63
|
+
state: d.state,
|
|
64
|
+
createTime: d.create_time,
|
|
65
|
+
updateTime: d.update_time,
|
|
66
|
+
ownerIds: d.owner_ids
|
|
67
|
+
}));
|
|
68
|
+
const marshalAssetLinkSchema = z.object({
|
|
69
|
+
name: z.string().optional(),
|
|
70
|
+
assetType: z.string().optional(),
|
|
71
|
+
assetScopeId: z.string().optional(),
|
|
72
|
+
assetId: z.string().optional(),
|
|
73
|
+
createTime: z.any().transform((d) => d.toString()).optional()
|
|
74
|
+
}).transform((d) => ({
|
|
75
|
+
name: d.name,
|
|
76
|
+
asset_type: d.assetType,
|
|
77
|
+
asset_scope_id: d.assetScopeId,
|
|
78
|
+
asset_id: d.assetId,
|
|
79
|
+
create_time: d.createTime
|
|
80
|
+
}));
|
|
81
|
+
const marshalPageSchema = z.object({
|
|
82
|
+
name: z.string().optional(),
|
|
83
|
+
domain: z.string().optional(),
|
|
84
|
+
displayName: z.string().optional(),
|
|
85
|
+
body: z.string().optional(),
|
|
86
|
+
synonyms: z.array(z.string()).optional(),
|
|
87
|
+
description: z.string().optional(),
|
|
88
|
+
state: z.string().optional(),
|
|
89
|
+
createTime: z.any().transform((d) => d.toString()).optional(),
|
|
90
|
+
updateTime: z.any().transform((d) => d.toString()).optional(),
|
|
91
|
+
ownerIds: z.array(z.string()).optional()
|
|
92
|
+
}).transform((d) => ({
|
|
93
|
+
name: d.name,
|
|
94
|
+
domain: d.domain,
|
|
95
|
+
display_name: d.displayName,
|
|
96
|
+
body: d.body,
|
|
97
|
+
synonyms: d.synonyms,
|
|
98
|
+
description: d.description,
|
|
99
|
+
state: d.state,
|
|
100
|
+
create_time: d.createTime,
|
|
101
|
+
update_time: d.updateTime,
|
|
102
|
+
owner_ids: d.ownerIds
|
|
103
|
+
}));
|
|
104
|
+
const pageFieldMaskSchema = {
|
|
105
|
+
body: { wire: "body" },
|
|
106
|
+
createTime: { wire: "create_time" },
|
|
107
|
+
description: { wire: "description" },
|
|
108
|
+
displayName: { wire: "display_name" },
|
|
109
|
+
domain: { wire: "domain" },
|
|
110
|
+
name: { wire: "name" },
|
|
111
|
+
ownerIds: { wire: "owner_ids" },
|
|
112
|
+
state: { wire: "state" },
|
|
113
|
+
synonyms: { wire: "synonyms" },
|
|
114
|
+
updateTime: { wire: "update_time" }
|
|
115
|
+
};
|
|
116
|
+
function pageFieldMask(...paths) {
|
|
117
|
+
return FieldMask.build(paths, pageFieldMaskSchema);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
//#endregion
|
|
121
|
+
export { AssetType, State, marshalAssetLinkSchema, marshalPageSchema, pageFieldMask, unmarshalAssetLinkSchema, unmarshalListPagesResponseSchema, unmarshalPageSchema };
|
|
122
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","names":[],"sources":["../../src/v1/model.ts"],"sourcesContent":["// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.\n\nimport {Temporal} from '@js-temporal/polyfill';\nimport {FieldMask} from '@databricks/sdk-core/wkt';\nimport type {FieldMaskSchema} from '@databricks/sdk-core/wkt';\nimport {z} from 'zod';\n\n/** Kind of asset an AssetLink points to. */\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.\nexport const AssetType = {\n /** Default value. Returned when the asset type is unset or unknown. */\n ASSET_TYPE_UNSPECIFIED: 'ASSET_TYPE_UNSPECIFIED',\n /**\n * UC table, metric view, or materialized view. Create accepts a table UUID\n * or fully qualified name (FQN, `catalog.schema.table`). Create and Get return\n * the table's current FQN. `asset_scope_id` is the metastore UUID.\n */\n ASSET_TYPE_UC_TABLE: 'ASSET_TYPE_UC_TABLE',\n /**\n * Workspace dashboard. Create accepts a numeric tree ID or a Lakeview UUID\n * (32 hex digits or hyphenated). Create and Get return the tree ID.\n * `asset_scope_id` is the decimal workspace ID string.\n */\n ASSET_TYPE_WORKSPACE_DASHBOARD: 'ASSET_TYPE_WORKSPACE_DASHBOARD',\n /**\n * Genie agent (space). `asset_id` is the native space ID: 32 lowercase\n * hexadecimal characters without hyphens. `asset_scope_id` is the decimal\n * workspace ID string.\n */\n ASSET_TYPE_WORKSPACE_GENIE_AGENT: 'ASSET_TYPE_WORKSPACE_GENIE_AGENT',\n /**\n * Workspace notebook. `asset_id` is its numeric workspace tree ID.\n * `asset_scope_id` is the decimal workspace ID string.\n */\n ASSET_TYPE_WORKSPACE_NOTEBOOK: 'ASSET_TYPE_WORKSPACE_NOTEBOOK',\n /**\n * Databricks app. Create accepts its UUID or app name; Create and Get return\n * the stable app UUID, including when Create receives a name.\n * `asset_scope_id` is the decimal workspace ID string.\n */\n ASSET_TYPE_WORKSPACE_APP: 'ASSET_TYPE_WORKSPACE_APP',\n /**\n * Saved DBSQL query. `asset_id` is the saved-query UUID in hyphenated form.\n * `asset_scope_id` is the decimal workspace ID string.\n */\n ASSET_TYPE_WORKSPACE_DBSQL_QUERY: 'ASSET_TYPE_WORKSPACE_DBSQL_QUERY',\n /**\n * Another knowledge page in the same account. `asset_id` is the bare page\n * UUID, without the `pages/` prefix. `asset_scope_id` is the calling account UUID.\n */\n ASSET_TYPE_ACCOUNT_PAGE: 'ASSET_TYPE_ACCOUNT_PAGE',\n /** Deprecated. Account-user links are not supported by the public API. */\n ASSET_TYPE_ACCOUNT_USER: 'ASSET_TYPE_ACCOUNT_USER',\n /**\n * External resource. `asset_id` is an absolute HTTP or HTTPS URL with a host,\n * up to 2,048 characters. `asset_scope_id` is the calling account UUID.\n */\n ASSET_TYPE_EXTERNAL_URL: 'ASSET_TYPE_EXTERNAL_URL',\n} as const;\nexport type AssetType =\n | (typeof AssetType)[keyof typeof AssetType]\n | (string & {});\n\n/** Lifecycle state of a Page. */\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.\nexport const State = {\n /** Default value. Returned when the lifecycle state is unset or unknown. */\n STATE_UNSPECIFIED: 'STATE_UNSPECIFIED',\n /** The page is a work-in-progress draft. */\n DRAFT: 'DRAFT',\n /** The page is published and discoverable. */\n PUBLISHED: 'PUBLISHED',\n} as const;\nexport type State = (typeof State)[keyof typeof State] | (string & {});\n\n/**\n * A reference or provenance link from a page to an asset.\n * Links are immutable; to change the target, delete and re-create the link.\n */\nexport interface AssetLink {\n /**\n * Resource name of the link. Server-assigned on create, immutable thereafter.\n * Format: `pages/{page_id}/asset-link-categories/{category}/asset-links/{link_id}`,\n * where `category` is `SOURCE` or `RELATED_ASSETS` and `link_id` is a\n * server-generated UUID. Omit on create; use the returned name for Get/Delete.\n */\n name?: string | undefined;\n /**\n * Kind of asset this link points to. Required on create;\n * `ASSET_TYPE_UNSPECIFIED` is not a valid target type.\n */\n assetType?: AssetType | undefined;\n /**\n * Containing scope of the asset. Required on create for every asset type:\n * - UC table: metastore UUID.\n * - Workspace asset: decimal workspace ID string.\n * - Account page or external URL: the calling account UUID.\n * Pass the bare ID, without a resource-name prefix. Query and Genie links,\n * dashboard UUID inputs, and app-name inputs require this scope to match the\n * caller's workspace.\n */\n assetScopeId?: string | undefined;\n /**\n * Target identifier within `asset_scope_id`. Required on create. The accepted\n * format depends on `asset_type`; see the identifier rules on each AssetType.\n * For Databricks assets, pass the bare identifier rather than a resource name\n * such as `pages/{page_id}` or `queries/{query_id}`. External assets use the\n * full URL. Create and Get return table FQNs, app UUIDs,\n * query UUIDs, and native Genie space IDs.\n */\n assetId?: string | undefined;\n /** Server-assigned creation time, formatted as an RFC 3339 timestamp in JSON. */\n createTime?: Temporal.Instant | undefined;\n}\n\n/** Request for CreateAssetLink. */\nexport interface CreateAssetLinkRequest {\n /**\n * Category collection on the page in which to create the link.\n * Format: `pages/{page_id}/asset-link-categories/{category}`, where\n * `{category}` is a `LinkCategory` value (`SOURCE` or `RELATED_ASSETS`).\n */\n parent?: string | undefined;\n /**\n * The link to create. `asset_type`, `asset_scope_id`, and `asset_id` are\n * required. The server assigns `name` and `create_time`; the path supplies\n * the page and category. A duplicate target in that category returns the\n * existing link.\n */\n assetLink?: AssetLink | undefined;\n}\n\n/** Request for CreatePage. */\nexport interface CreatePageRequest {\n /**\n * The page to create. `domain` and `display_name` are required; the server\n * assigns `name`, `create_time`, and `update_time`. Other fields follow the\n * defaults and format requirements documented on Page.\n */\n page?: Page | undefined;\n /**\n * Optional UUIDv4 scoped to the account and caller. Retries return the current\n * page without applying retry payload changes. Every retry must pass request\n * validation and current create permissions, plus view permission on the returned\n * page. Deletion releases the token; later retries may create a new page.\n */\n requestId?: string | undefined;\n}\n\n/** Request for DeleteAssetLink. */\nexport interface DeleteAssetLinkRequest {\n /**\n * Resource name of the link to delete.\n * Format:\n * `pages/{page_id}/asset-link-categories/{category}/asset-links/{link_id}`\n */\n name?: string | undefined;\n}\n\n/** Request for DeletePage. */\nexport interface DeletePageRequest {\n /**\n * Resource name of the page to delete.\n * Format: `pages/{page_id}`\n */\n name?: string | undefined;\n}\n\n/** Request for GetAssetLink. */\nexport interface GetAssetLinkRequest {\n /**\n * Resource name of the link to retrieve.\n * Format:\n * `pages/{page_id}/asset-link-categories/{category}/asset-links/{link_id}`\n */\n name?: string | undefined;\n}\n\n/** Request for GetPage. */\nexport interface GetPageRequest {\n /**\n * Resource name of the page to retrieve.\n * Format: `pages/{page_id}`\n */\n name?: string | undefined;\n}\n\n/** Request for ListPages. */\nexport interface ListPagesRequest {\n /**\n * Maximum number of pages to return, from 1 to 100. Defaults to 50 when omitted.\n * The server may return fewer.\n */\n pageSize?: number | undefined;\n /**\n * Opaque `next_page_token` from a previous ListPages response. Omit on the\n * first request; pass it unchanged and keep the same filter when continuing.\n */\n pageToken?: string | undefined;\n /**\n * Filter clauses with double-quoted values, joined by uppercase `AND`.\n * Each field may appear once:\n * - `domain = \"domains/{domain_id}\"` includes that domain and its subdomains.\n * - `state = \"DRAFT\"` or `state = \"PUBLISHED\"` matches that state exactly.\n * For example: `domain = \"domains/{domain_id}\" AND state = \"PUBLISHED\"`.\n * Other fields and operators are not supported. An omitted or blank filter\n * lists visible pages across the account, subject to ListPages permissions.\n */\n filter?: string | undefined;\n}\n\n/** Response for ListPages. */\nexport interface ListPagesResponse {\n /**\n * The requested pages. Each page includes only `name`, `display_name`,\n * `domain`, `state`, and `update_time`. Use GetPage for the full resource.\n * The list can be empty even when `next_page_token` is present.\n */\n pages?: Page[] | undefined;\n /**\n * Opaque continuation token. Pass as `page_token` to continue, even if this\n * response contains fewer than `page_size` pages or no pages. An absent or\n * empty token means there are no more results.\n */\n nextPageToken?: string | undefined;\n}\n\n/**\n * A knowledge page: a domain-scoped governance document describing a concept\n * or term in the account.\n */\nexport interface Page {\n /**\n * Resource name in the form `pages/{page_id}`, where `page_id` is a\n * server-generated UUID. Omit on create; required to identify the page on\n * update. Get and Delete also address pages by this full resource name.\n */\n name?: string | undefined;\n /**\n * Resource name of the domain this page belongs to; format `domains/{domain_id}`.\n * Required on create and when selected by `update_mask`.\n * Use the full resource name rather than a bare domain ID.\n */\n domain?: string | undefined;\n /**\n * Human-readable title, 1 to 200 characters.\n * Required on create and when selected by `update_mask`.\n * Published titles must be unique within the domain.\n */\n displayName?: string | undefined;\n /**\n * Page body as Markdown text. An update replaces the entire body when\n * `body` is selected by `update_mask`.\n */\n body?: string | undefined;\n /**\n * Alternate names or abbreviations. Accepts at most 50 entries, each 1 to\n * 200 characters. Values are trimmed, deduplicated, and sorted.\n * An update replaces the entire list when `synonyms` is selected by\n * `update_mask`; an empty list clears it.\n */\n synonyms?: string[] | undefined;\n /**\n * Short description of the page. An update replaces the description when\n * `description` is selected by `update_mask`.\n */\n description?: string | undefined;\n /**\n * Lifecycle state. Omitting it on create defaults to `DRAFT`. Set `PUBLISHED`\n * to publish or `DRAFT` to unpublish. An update selecting `state` in\n * `update_mask` must explicitly supply `DRAFT` or `PUBLISHED`.\n */\n state?: State | undefined;\n /** Server-assigned creation time, formatted as an RFC 3339 timestamp in JSON. */\n createTime?: Temporal.Instant | undefined;\n /** Server-assigned last-update time, formatted as an RFC 3339 timestamp in JSON. */\n updateTime?: Temporal.Instant | undefined;\n /**\n * Decimal principal ID strings for the page's single owner: a user, group,\n * or service principal. Use principal IDs rather than email addresses or\n * service-principal application UUIDs. On create, an omitted or empty list\n * defaults to the caller; at most one ID may be supplied. An update selecting\n * `owner_ids` in `update_mask` must supply exactly one ID to replace the owner.\n */\n ownerIds?: string[] | undefined;\n}\n\n/** Request for UpdatePage. */\nexport interface UpdatePageRequest {\n /**\n * The page to update. `name` is required in the form `pages/{page_id}`.\n * Only fields selected by `update_mask` are written.\n */\n page?: Page | undefined;\n /**\n * Nonempty set of Page fields to update. Supported paths are `domain`, `display_name`,\n * `body`, `synonyms`, `description`, `state`, and `owner_ids`, without a `page.`\n * prefix. Wildcards and server-assigned fields are not supported.\n * In REST requests, pass a comma-separated query parameter, for example\n * `update_mask=display_name,body`. There is no implicit update of all fields.\n */\n updateMask?: FieldMask<Page> | undefined;\n}\n\nexport const unmarshalAssetLinkSchema: z.ZodType<AssetLink> = z\n .object({\n name: z.string().optional(),\n asset_type: z.string().optional(),\n asset_scope_id: z.string().optional(),\n asset_id: z.string().optional(),\n create_time: z\n .string()\n .transform(s => Temporal.Instant.from(s))\n .optional(),\n })\n .transform(d => ({\n name: d.name,\n assetType: d.asset_type,\n assetScopeId: d.asset_scope_id,\n assetId: d.asset_id,\n createTime: d.create_time,\n }));\n\nexport const unmarshalListPagesResponseSchema: z.ZodType<ListPagesResponse> = z\n .object({\n pages: z.array(z.lazy(() => unmarshalPageSchema)).optional(),\n next_page_token: z.string().optional(),\n })\n .transform(d => ({\n pages: d.pages,\n nextPageToken: d.next_page_token,\n }));\n\nexport const unmarshalPageSchema: z.ZodType<Page> = z\n .object({\n name: z.string().optional(),\n domain: z.string().optional(),\n display_name: z.string().optional(),\n body: z.string().optional(),\n synonyms: z.array(z.string()).optional(),\n description: z.string().optional(),\n state: z.string().optional(),\n create_time: z\n .string()\n .transform(s => Temporal.Instant.from(s))\n .optional(),\n update_time: z\n .string()\n .transform(s => Temporal.Instant.from(s))\n .optional(),\n owner_ids: z.array(z.string()).optional(),\n })\n .transform(d => ({\n name: d.name,\n domain: d.domain,\n displayName: d.display_name,\n body: d.body,\n synonyms: d.synonyms,\n description: d.description,\n state: d.state,\n createTime: d.create_time,\n updateTime: d.update_time,\n ownerIds: d.owner_ids,\n }));\n\nexport const marshalAssetLinkSchema: z.ZodType = z\n .object({\n name: z.string().optional(),\n assetType: z.string().optional(),\n assetScopeId: z.string().optional(),\n assetId: z.string().optional(),\n createTime: z\n .any()\n .transform((d: Temporal.Instant) => d.toString())\n .optional(),\n })\n .transform(d => ({\n name: d.name,\n asset_type: d.assetType,\n asset_scope_id: d.assetScopeId,\n asset_id: d.assetId,\n create_time: d.createTime,\n }));\n\nexport const marshalPageSchema: z.ZodType = z\n .object({\n name: z.string().optional(),\n domain: z.string().optional(),\n displayName: z.string().optional(),\n body: z.string().optional(),\n synonyms: z.array(z.string()).optional(),\n description: z.string().optional(),\n state: z.string().optional(),\n createTime: z\n .any()\n .transform((d: Temporal.Instant) => d.toString())\n .optional(),\n updateTime: z\n .any()\n .transform((d: Temporal.Instant) => d.toString())\n .optional(),\n ownerIds: z.array(z.string()).optional(),\n })\n .transform(d => ({\n name: d.name,\n domain: d.domain,\n display_name: d.displayName,\n body: d.body,\n synonyms: d.synonyms,\n description: d.description,\n state: d.state,\n create_time: d.createTime,\n update_time: d.updateTime,\n owner_ids: d.ownerIds,\n }));\n\nconst pageFieldMaskSchema: FieldMaskSchema = {\n body: {wire: 'body'},\n createTime: {wire: 'create_time'},\n description: {wire: 'description'},\n displayName: {wire: 'display_name'},\n domain: {wire: 'domain'},\n name: {wire: 'name'},\n ownerIds: {wire: 'owner_ids'},\n state: {wire: 'state'},\n synonyms: {wire: 'synonyms'},\n updateTime: {wire: 'update_time'},\n};\n\nexport function pageFieldMask(...paths: string[]): FieldMask<Page> {\n return FieldMask.build<Page>(paths, pageFieldMaskSchema);\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { HttpClient } from "@databricks/sdk-core/http";
|
|
2
|
+
import { ClientOptions } from "@databricks/sdk-options/client";
|
|
3
|
+
|
|
4
|
+
//#region src/v1/transport.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The configuration a client needs to issue requests, resolved from
|
|
7
|
+
* {@link ClientOptions} and a configuration profile.
|
|
8
|
+
*/
|
|
9
|
+
interface ResolvedClientConfig {
|
|
10
|
+
/** Host with any trailing slash removed. */
|
|
11
|
+
host: string;
|
|
12
|
+
/**
|
|
13
|
+
* Default account ID for account-level paths that contain an account_id
|
|
14
|
+
* segment. A request's own accountId still wins.
|
|
15
|
+
*/
|
|
16
|
+
accountId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
19
|
+
*/
|
|
20
|
+
workspaceId?: string;
|
|
21
|
+
/** HTTP client with authentication, and any configured timeout, applied. */
|
|
22
|
+
httpClient: HttpClient;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
|
|
26
|
+
*
|
|
27
|
+
* A configuration profile is always resolved from the config file and
|
|
28
|
+
* environment variables (per options.profileOptions); it supplies host,
|
|
29
|
+
* accountId, workspaceId, and credentials wherever the caller did not set them
|
|
30
|
+
* explicitly. Explicit options always take precedence.
|
|
31
|
+
*
|
|
32
|
+
* @throws if host is neither provided nor present in the resolved profile.
|
|
33
|
+
*/
|
|
34
|
+
declare function resolveClientConfig(options: ClientOptions): Promise<ResolvedClientConfig>;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { ResolvedClientConfig, resolveClientConfig };
|
|
37
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","names":[],"sources":["../../src/v1/transport.ts"],"mappings":";;;;;;AAkBA;;UAAiB,oBAAA;EAgBO;EAdtB,IAAA;EAMA;;;;EAAA,SAAA;EAQsB;AAaxB;;EAhBE,WAAA;EAiBS;EAdT,UAAA,EAAY,UAAA;AAAA;;;;;;;;;;;iBAaQ,mBAAA,CACpB,OAAA,EAAS,aAAA,GACR,OAAA,CAAQ,oBAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { defaultCredentials } from "@databricks/sdk-auth/credentials";
|
|
2
|
+
import { newFetchHttpClient } from "@databricks/sdk-core/http";
|
|
3
|
+
import { resolve } from "@databricks/sdk-core/profiles";
|
|
4
|
+
|
|
5
|
+
//#region src/v1/transport.ts
|
|
6
|
+
/**
|
|
7
|
+
* Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
|
|
8
|
+
*
|
|
9
|
+
* A configuration profile is always resolved from the config file and
|
|
10
|
+
* environment variables (per options.profileOptions); it supplies host,
|
|
11
|
+
* accountId, workspaceId, and credentials wherever the caller did not set them
|
|
12
|
+
* explicitly. Explicit options always take precedence.
|
|
13
|
+
*
|
|
14
|
+
* @throws if host is neither provided nor present in the resolved profile.
|
|
15
|
+
*/
|
|
16
|
+
async function resolveClientConfig(options) {
|
|
17
|
+
const profile = await resolve(options.profileOptions);
|
|
18
|
+
const host = normalizeHost(options.host ?? profile.host);
|
|
19
|
+
if (host === void 0) throw new Error("Host is required.");
|
|
20
|
+
let httpClient = new AuthHttpClient(options.httpClient ?? newFetchHttpClient(), options.credentials ?? defaultCredentials({ profile: {
|
|
21
|
+
...profile,
|
|
22
|
+
host
|
|
23
|
+
} }));
|
|
24
|
+
if (options.timeout !== void 0) httpClient = new TimeoutHttpClient(httpClient, options.timeout);
|
|
25
|
+
const accountId = options.accountId ?? profile.accountId;
|
|
26
|
+
const workspaceId = options.workspaceId ?? profile.workspaceId;
|
|
27
|
+
return {
|
|
28
|
+
host,
|
|
29
|
+
httpClient,
|
|
30
|
+
...accountId !== void 0 && { accountId },
|
|
31
|
+
...workspaceId !== void 0 && { workspaceId }
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function normalizeHost(host) {
|
|
35
|
+
const trimmed = host?.trim();
|
|
36
|
+
if (trimmed === void 0 || trimmed === "") return;
|
|
37
|
+
return (/^https?:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`).replace(/\/$/, "");
|
|
38
|
+
}
|
|
39
|
+
/** Wraps an HttpClient and adds authentication headers to requests. */
|
|
40
|
+
var AuthHttpClient = class {
|
|
41
|
+
constructor(base, credentials) {
|
|
42
|
+
this.base = base;
|
|
43
|
+
this.credentials = credentials;
|
|
44
|
+
}
|
|
45
|
+
async send(request) {
|
|
46
|
+
const authHeaders = await this.credentials.authHeaders();
|
|
47
|
+
const headers = new Headers(request.headers);
|
|
48
|
+
for (const h of authHeaders) headers.set(h.key, h.value);
|
|
49
|
+
return this.base.send({
|
|
50
|
+
...request,
|
|
51
|
+
headers
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
/** Wraps an HttpClient and applies a default timeout to requests. */
|
|
56
|
+
var TimeoutHttpClient = class {
|
|
57
|
+
constructor(base, timeout) {
|
|
58
|
+
this.base = base;
|
|
59
|
+
this.timeout = timeout;
|
|
60
|
+
}
|
|
61
|
+
async send(request) {
|
|
62
|
+
const timeoutSignal = AbortSignal.timeout(this.timeout);
|
|
63
|
+
const signal = request.signal !== void 0 ? AbortSignal.any([request.signal, timeoutSignal]) : timeoutSignal;
|
|
64
|
+
return this.base.send({
|
|
65
|
+
...request,
|
|
66
|
+
signal
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
export { resolveClientConfig };
|
|
73
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","names":[],"sources":["../../src/v1/transport.ts"],"sourcesContent":["// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.\n\nimport type {Credentials} from '@databricks/sdk-auth';\nimport {defaultCredentials} from '@databricks/sdk-auth/credentials';\nimport type {\n HttpClient,\n HttpRequest,\n HttpResponse,\n} from '@databricks/sdk-core/http';\nimport {newFetchHttpClient} from '@databricks/sdk-core/http';\nimport type {Profile} from '@databricks/sdk-core/profiles';\nimport {resolve} from '@databricks/sdk-core/profiles';\nimport type {ClientOptions} from '@databricks/sdk-options/client';\n\n/**\n * The configuration a client needs to issue requests, resolved from\n * {@link ClientOptions} and a configuration profile.\n */\nexport interface ResolvedClientConfig {\n /** Host with any trailing slash removed. */\n host: string;\n\n /**\n * Default account ID for account-level paths that contain an account_id\n * segment. A request's own accountId still wins.\n */\n accountId?: string;\n\n /**\n * Workspace ID used to route workspace-level calls on unified hosts (SPOG).\n */\n workspaceId?: string;\n\n /** HTTP client with authentication, and any configured timeout, applied. */\n httpClient: HttpClient;\n}\n\n/**\n * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.\n *\n * A configuration profile is always resolved from the config file and\n * environment variables (per options.profileOptions); it supplies host,\n * accountId, workspaceId, and credentials wherever the caller did not set them\n * explicitly. Explicit options always take precedence.\n *\n * @throws if host is neither provided nor present in the resolved profile.\n */\nexport async function resolveClientConfig(\n options: ClientOptions\n): Promise<ResolvedClientConfig> {\n const profile: Profile = await resolve(options.profileOptions);\n\n const host = normalizeHost(options.host ?? profile.host);\n if (host === undefined) {\n throw new Error('Host is required.');\n }\n\n // The provided httpClient (or the default fetch client) is the base wire;\n // authentication and the optional timeout are layered on top of it. The\n // default credential chain reuses the profile resolved above so that the\n // same profileOptions govern host and authentication alike.\n const base = options.httpClient ?? newFetchHttpClient();\n const credentials =\n options.credentials ?? defaultCredentials({profile: {...profile, host}});\n let httpClient: HttpClient = new AuthHttpClient(base, credentials);\n if (options.timeout !== undefined) {\n httpClient = new TimeoutHttpClient(httpClient, options.timeout);\n }\n\n const accountId = options.accountId ?? profile.accountId;\n const workspaceId = options.workspaceId ?? profile.workspaceId;\n\n return {\n host,\n httpClient,\n ...(accountId !== undefined && {accountId}),\n ...(workspaceId !== undefined && {workspaceId}),\n };\n}\n\nfunction normalizeHost(host: string | undefined): string | undefined {\n const trimmed = host?.trim();\n if (trimmed === undefined || trimmed === '') {\n return undefined;\n }\n const absolute = /^https?:\\/\\//i.test(trimmed)\n ? trimmed\n : `https://${trimmed}`;\n return absolute.replace(/\\/$/, '');\n}\n\n/** Wraps an HttpClient and adds authentication headers to requests. */\nclass AuthHttpClient implements HttpClient {\n constructor(\n private readonly base: HttpClient,\n private readonly credentials: Credentials\n ) {}\n\n async send(request: HttpRequest): Promise<HttpResponse> {\n const authHeaders = await this.credentials.authHeaders();\n // Do not modify the original request.\n const headers = new Headers(request.headers);\n for (const h of authHeaders) {\n headers.set(h.key, h.value);\n }\n return this.base.send({...request, headers});\n }\n}\n\n/** Wraps an HttpClient and applies a default timeout to requests. */\nclass TimeoutHttpClient implements HttpClient {\n constructor(\n private readonly base: HttpClient,\n private readonly timeout: number\n ) {}\n\n async send(request: HttpRequest): Promise<HttpResponse> {\n const timeoutSignal = AbortSignal.timeout(this.timeout);\n const signal =\n request.signal !== undefined\n ? AbortSignal.any([request.signal, timeoutSignal])\n : timeoutSignal;\n return this.base.send({...request, signal});\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+CA,eAAsB,oBACpB,SAC+B;CAC/B,MAAM,UAAmB,MAAM,QAAQ,QAAQ,eAAe;CAE9D,MAAM,OAAO,cAAc,QAAQ,QAAQ,QAAQ,KAAK;AACxD,KAAI,SAAS,OACX,OAAM,IAAI,MAAM,oBAAoB;CAUtC,IAAI,aAAyB,IAAI,eAHpB,QAAQ,cAAc,oBAAoB,EAErD,QAAQ,eAAe,mBAAmB,EAAC,SAAS;EAAC,GAAG;EAAS;EAAK,EAAC,CAAC,CACR;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;EACA;EACA,GAAI,cAAc,UAAa,EAAC,WAAU;EAC1C,GAAI,gBAAgB,UAAa,EAAC,aAAY;EAC/C;;AAGH,SAAS,cAAc,MAA8C;CACnE,MAAM,UAAU,MAAM,MAAM;AAC5B,KAAI,YAAY,UAAa,YAAY,GACvC;AAKF,SAHiB,gBAAgB,KAAK,QAAQ,GAC1C,UACA,WAAW,WACC,QAAQ,OAAO,GAAG;;;AAIpC,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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Logger } from "@databricks/sdk-core/logger";
|
|
2
|
+
import { HttpClient, HttpRequest } from "@databricks/sdk-core/http";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { CallOptions } from "@databricks/sdk-options/call";
|
|
5
|
+
|
|
6
|
+
//#region src/v1/utils.d.ts
|
|
7
|
+
interface HttpCallOptions {
|
|
8
|
+
readonly request: HttpRequest;
|
|
9
|
+
readonly httpClient: HttpClient;
|
|
10
|
+
readonly logger: Logger;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Translates public CallOptions to the internal Options shape accepted by
|
|
14
|
+
* execute(). Even though the shapes match today, this isolates the public
|
|
15
|
+
* API from the executor's internal type so they can diverge.
|
|
16
|
+
*/
|
|
17
|
+
declare function executeCall(call: (signal?: AbortSignal) => Promise<void>, options?: CallOptions): Promise<void>;
|
|
18
|
+
declare function executeHttpCall(opts: HttpCallOptions): Promise<Uint8Array>;
|
|
19
|
+
declare function buildHttpRequest(method: string, url: string, headers: Headers, signal?: AbortSignal, body?: string | ReadableStream<Uint8Array>): HttpRequest;
|
|
20
|
+
declare function parseResponse<T>(body: Uint8Array, schema: z.ZodType<T>): T;
|
|
21
|
+
declare function marshalRequest(data: unknown, schema: z.ZodType): string;
|
|
22
|
+
declare function flattenQueryParams(prefix: string, value: unknown, params: URLSearchParams): void;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { HttpCallOptions, buildHttpRequest, executeCall, executeHttpCall, flattenQueryParams, marshalRequest, parseResponse };
|
|
25
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/v1/utils.ts"],"mappings":";;;;;;UAoBiB,eAAA;EAAA,SACN,OAAA,EAAS,WAAA;EAAA,SACT,UAAA,EAAY,UAAA;EAAA,SACZ,MAAA,EAAQ,MAAA;AAAA;;;;;;iBAQG,WAAA,CACpB,IAAA,GAAO,MAAA,GAAS,WAAA,KAAgB,OAAA,QAChC,OAAA,GAAU,WAAA,GACT,OAAA;AAAA,iBAoCmB,eAAA,CACpB,IAAA,EAAM,eAAA,GACL,OAAA,CAAQ,UAAA;AAAA,iBA6BK,gBAAA,CACd,MAAA,UACA,GAAA,UACA,OAAA,EAAS,OAAA,EACT,MAAA,GAAS,WAAA,EACT,IAAA,YAAgB,cAAA,CAAe,UAAA,IAC9B,WAAA;AAAA,iBAWa,aAAA,GAAA,CAAiB,IAAA,EAAM,UAAA,EAAY,MAAA,EAAQ,CAAA,CAAE,OAAA,CAAQ,CAAA,IAAK,CAAA;AAAA,iBAO1D,cAAA,CAAe,IAAA,WAAe,MAAA,EAAQ,CAAA,CAAE,OAAA;AAAA,iBAIxC,kBAAA,CACd,MAAA,UACA,KAAA,WACA,MAAA,EAAQ,eAAA"}
|