@databricks/sdk-knowledge 0.0.3 → 0.0.4
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/dist/package.js +1 -1
- package/dist/v1/client.d.ts +1 -1
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +12 -23
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/transport.d.ts +4 -2
- package/dist/v1/transport.d.ts.map +1 -1
- package/dist/v1/transport.js +15 -5
- package/dist/v1/transport.js.map +1 -1
- package/package.json +2 -2
package/dist/package.js
CHANGED
package/dist/v1/client.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ClientOptions } from "@databricks/sdk-options/client";
|
|
|
6
6
|
declare class KnowledgeClient {
|
|
7
7
|
private readonly options;
|
|
8
8
|
private readonly logger;
|
|
9
|
-
private readonly
|
|
9
|
+
private readonly clientInfo;
|
|
10
10
|
private config;
|
|
11
11
|
constructor(options: ClientOptions);
|
|
12
12
|
private resolveConfig;
|
package/dist/v1/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/v1/client.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/v1/client.ts"],"mappings":";;;;;cA8Ca,eAAA;EAAA,iBACM,OAAA;EAAA,iBACA,MAAA;EAAA,iBAIA,UAAA;EAAA,QAIT,MAAA;cAEI,OAAA,EAAS,aAAA;EAAA,QAQb,aAAA;EAaI;;;;;;EAFN,eAAA,CACJ,GAAA,EAAK,sBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,SAAA;EAoFJ;;;;;;;;;;;;;;EA7CD,UAAA,CACJ,GAAA,EAAK,iBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,IAAA;EAgKC;;;;EAvHN,eAAA,CACJ,GAAA,EAAK,sBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA;EA4Je;;;;;EArIZ,UAAA,CACJ,GAAA,EAAK,iBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA;EA6JO;;;;;;;EApIJ,YAAA,CACJ,GAAA,EAAK,mBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,SAAA;EAlKC;;;;;EA+LN,OAAA,CAAQ,GAAA,EAAK,cAAA,EAAgB,OAAA,GAAU,WAAA,GAAc,OAAA,CAAQ,IAAA;EA1KjE;;;;;;;EAyMI,SAAA,CACJ,GAAA,EAAK,gBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,iBAAA;EAoCJ,aAAA,CACL,GAAA,EAAK,gBAAA,EACL,OAAA,GAAU,WAAA,GACT,cAAA,CAAe,IAAA;EAxMP;;;;;;;;;;EAgOL,UAAA,CACJ,GAAA,EAAK,iBAAA,EACL,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,IAAA;AAAA"}
|
package/dist/v1/client.js
CHANGED
|
@@ -14,21 +14,18 @@ const PACKAGE_SEGMENT = {
|
|
|
14
14
|
var KnowledgeClient = class {
|
|
15
15
|
options;
|
|
16
16
|
logger;
|
|
17
|
-
|
|
17
|
+
clientInfo;
|
|
18
18
|
config;
|
|
19
19
|
constructor(options) {
|
|
20
20
|
this.options = options;
|
|
21
21
|
this.logger = options.logger ?? new NoOpLogger();
|
|
22
|
-
this.
|
|
22
|
+
this.clientInfo = createDefault().with(PACKAGE_SEGMENT).with({
|
|
23
23
|
key: "sdk-js-auth",
|
|
24
24
|
value: VERSION
|
|
25
|
-
})
|
|
26
|
-
key: "auth",
|
|
27
|
-
value: options.credentials?.name() ?? "default"
|
|
28
|
-
}).toString();
|
|
25
|
+
});
|
|
29
26
|
}
|
|
30
27
|
resolveConfig() {
|
|
31
|
-
this.config ??= resolveClientConfig(this.options);
|
|
28
|
+
this.config ??= resolveClientConfig(this.options, this.clientInfo);
|
|
32
29
|
return this.config;
|
|
33
30
|
}
|
|
34
31
|
/**
|
|
@@ -44,8 +41,7 @@ var KnowledgeClient = class {
|
|
|
44
41
|
let resp;
|
|
45
42
|
const call = async (callSignal) => {
|
|
46
43
|
const headers = new Headers({ "Content-Type": "application/json" });
|
|
47
|
-
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
48
|
-
headers.set("User-Agent", this.userAgent);
|
|
44
|
+
if (workspaceId !== void 0 && workspaceId !== "") headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
49
45
|
resp = parseResponse(await executeHttpCall({
|
|
50
46
|
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
51
47
|
httpClient,
|
|
@@ -81,8 +77,7 @@ var KnowledgeClient = class {
|
|
|
81
77
|
let resp;
|
|
82
78
|
const call = async (callSignal) => {
|
|
83
79
|
const headers = new Headers({ "Content-Type": "application/json" });
|
|
84
|
-
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
85
|
-
headers.set("User-Agent", this.userAgent);
|
|
80
|
+
if (workspaceId !== void 0 && workspaceId !== "") headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
86
81
|
resp = parseResponse(await executeHttpCall({
|
|
87
82
|
request: buildHttpRequest("POST", fullUrl, headers, callSignal, body),
|
|
88
83
|
httpClient,
|
|
@@ -102,8 +97,7 @@ var KnowledgeClient = class {
|
|
|
102
97
|
const url = `${host}/api/2.0/knowledge/${req.name ?? ""}`;
|
|
103
98
|
const call = async (callSignal) => {
|
|
104
99
|
const headers = new Headers();
|
|
105
|
-
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
106
|
-
headers.set("User-Agent", this.userAgent);
|
|
100
|
+
if (workspaceId !== void 0 && workspaceId !== "") headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
107
101
|
await executeHttpCall({
|
|
108
102
|
request: buildHttpRequest("DELETE", url, headers, callSignal),
|
|
109
103
|
httpClient,
|
|
@@ -122,8 +116,7 @@ var KnowledgeClient = class {
|
|
|
122
116
|
const url = `${host}/api/2.0/knowledge/${req.name ?? ""}`;
|
|
123
117
|
const call = async (callSignal) => {
|
|
124
118
|
const headers = new Headers();
|
|
125
|
-
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
126
|
-
headers.set("User-Agent", this.userAgent);
|
|
119
|
+
if (workspaceId !== void 0 && workspaceId !== "") headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
127
120
|
await executeHttpCall({
|
|
128
121
|
request: buildHttpRequest("DELETE", url, headers, callSignal),
|
|
129
122
|
httpClient,
|
|
@@ -145,8 +138,7 @@ var KnowledgeClient = class {
|
|
|
145
138
|
let resp;
|
|
146
139
|
const call = async (callSignal) => {
|
|
147
140
|
const headers = new Headers();
|
|
148
|
-
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
149
|
-
headers.set("User-Agent", this.userAgent);
|
|
141
|
+
if (workspaceId !== void 0 && workspaceId !== "") headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
150
142
|
resp = parseResponse(await executeHttpCall({
|
|
151
143
|
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
152
144
|
httpClient,
|
|
@@ -168,8 +160,7 @@ var KnowledgeClient = class {
|
|
|
168
160
|
let resp;
|
|
169
161
|
const call = async (callSignal) => {
|
|
170
162
|
const headers = new Headers();
|
|
171
|
-
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
172
|
-
headers.set("User-Agent", this.userAgent);
|
|
163
|
+
if (workspaceId !== void 0 && workspaceId !== "") headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
173
164
|
resp = parseResponse(await executeHttpCall({
|
|
174
165
|
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
175
166
|
httpClient,
|
|
@@ -199,8 +190,7 @@ var KnowledgeClient = class {
|
|
|
199
190
|
let resp;
|
|
200
191
|
const call = async (callSignal) => {
|
|
201
192
|
const headers = new Headers();
|
|
202
|
-
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
203
|
-
headers.set("User-Agent", this.userAgent);
|
|
193
|
+
if (workspaceId !== void 0 && workspaceId !== "") headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
204
194
|
resp = parseResponse(await executeHttpCall({
|
|
205
195
|
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
206
196
|
httpClient,
|
|
@@ -241,8 +231,7 @@ var KnowledgeClient = class {
|
|
|
241
231
|
let resp;
|
|
242
232
|
const call = async (callSignal) => {
|
|
243
233
|
const headers = new Headers({ "Content-Type": "application/json" });
|
|
244
|
-
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
245
|
-
headers.set("User-Agent", this.userAgent);
|
|
234
|
+
if (workspaceId !== void 0 && workspaceId !== "") headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
246
235
|
resp = parseResponse(await executeHttpCall({
|
|
247
236
|
request: buildHttpRequest("PATCH", fullUrl, headers, callSignal, body),
|
|
248
237
|
httpClient,
|
package/dist/v1/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["pkgJson.version","AUTH_VERSION"],"sources":["../../src/v1/client.ts"],"sourcesContent":["// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.\n\nimport {VERSION as AUTH_VERSION} from '@databricks/sdk-auth';\nimport {createDefault} from '@databricks/sdk-core/clientinfo';\nimport type {Logger} from '@databricks/sdk-core/logger';\nimport {NoOpLogger} from '@databricks/sdk-core/logger';\nimport type {CallOptions} from '@databricks/sdk-options/call';\nimport type {ClientOptions} from '@databricks/sdk-options/client';\nimport type {ResolvedClientConfig} from './transport';\nimport {resolveClientConfig} from './transport';\nimport {\n buildHttpRequest,\n executeCall,\n executeHttpCall,\n marshalRequest,\n parseResponse,\n} from './utils';\nimport pkgJson from '../../package.json' with {type: 'json'};\nimport type {\n AssetLink,\n CreateAssetLinkRequest,\n CreatePageRequest,\n DeleteAssetLinkRequest,\n DeletePageRequest,\n GetAssetLinkRequest,\n GetPageRequest,\n ListPagesRequest,\n ListPagesResponse,\n Page,\n UpdatePageRequest,\n} from './model';\nimport {\n marshalAssetLinkSchema,\n marshalPageSchema,\n unmarshalAssetLinkSchema,\n unmarshalListPagesResponseSchema,\n unmarshalPageSchema,\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 KnowledgeClient {\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 * Create an asset link on a page. For REST, send AssetLink fields directly\n * as the JSON request body; the parent path supplies the page and category.\n * An existing target with the same asset type, scope, and resolved asset ID\n * in that page/category returns the original link and creation time.\n */\n async createAssetLink(\n req: CreateAssetLinkRequest,\n options?: CallOptions\n ): Promise<AssetLink> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/knowledge/${req.parent ?? ''}/asset-links`;\n const body = marshalRequest(req.assetLink, marshalAssetLinkSchema);\n let resp: AssetLink | undefined;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers({'Content-Type': 'application/json'});\n if (workspaceId !== undefined) {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\n headers.set('User-Agent', this.userAgent);\n const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);\n const respBody = await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n resp = parseResponse(respBody, unmarshalAssetLinkSchema);\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 * Create a knowledge page. Optional `request_id` makes retries idempotent while\n * the page exists; without it, retries can create duplicate drafts.\n * For REST, send Page fields as the JSON body and `request_id` as a query parameter.\n * When page permissions are enforced, creating a published page or assigning\n * another owner requires Page Manager or Domain Admin permissions on the domain,\n * including inherited grants. Creating your own draft requires neither grant.\n *\n * Errors: `INVALID_PARAMETER_VALUE` (missing `page`/`domain` or field validation),\n * `NOT_FOUND` (the referenced `domain` does not exist), `ALREADY_EXISTS` (a\n * published page with the same `domain` and `display_name` already exists),\n * `PERMISSION_DENIED` (insufficient permissions), `RESOURCE_EXHAUSTED`\n * (rate limited), `INTERNAL_ERROR` (unexpected failure).\n */\n async createPage(\n req: CreatePageRequest,\n options?: CallOptions\n ): Promise<Page> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/knowledge/pages`;\n const params = new URLSearchParams();\n if (req.requestId !== undefined) {\n params.append('request_id', req.requestId);\n }\n const query = params.toString();\n const fullUrl = query !== '' ? `${url}?${query}` : url;\n const body = marshalRequest(req.page, marshalPageSchema);\n let resp: Page | undefined;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers({'Content-Type': 'application/json'});\n if (workspaceId !== undefined) {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\n headers.set('User-Agent', this.userAgent);\n const httpReq = buildHttpRequest(\n 'POST',\n fullUrl,\n headers,\n callSignal,\n body\n );\n const respBody = await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n resp = parseResponse(respBody, unmarshalPageSchema);\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 * Delete an asset link by its full resource name. Returns NOT_FOUND if the\n * link does not exist, including when it has already been deleted.\n */\n async deleteAssetLink(\n req: DeleteAssetLinkRequest,\n options?: CallOptions\n ): Promise<void> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/knowledge/${req.name ?? ''}`;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers();\n if (workspaceId !== undefined) {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\n headers.set('User-Agent', this.userAgent);\n const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);\n await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n };\n await executeCall(call, options);\n }\n\n /**\n * Delete a knowledge page by resource name.\n *\n * Returns `NOT_FOUND` if no page with the given `name` exists.\n */\n async deletePage(\n req: DeletePageRequest,\n options?: CallOptions\n ): Promise<void> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/knowledge/${req.name ?? ''}`;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers();\n if (workspaceId !== undefined) {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\n headers.set('User-Agent', this.userAgent);\n const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);\n await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n };\n await executeCall(call, options);\n }\n\n /**\n * Get an asset link by its full resource name. Table links return the table's\n * current FQN and require access to that table. Query and Genie\n * links return native UUIDs and require access in the caller's workspace.\n * Returns NOT_FOUND if the link is missing or its target identifier cannot be\n * resolved.\n */\n async getAssetLink(\n req: GetAssetLinkRequest,\n options?: CallOptions\n ): Promise<AssetLink> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/knowledge/${req.name ?? ''}`;\n let resp: AssetLink | 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, unmarshalAssetLinkSchema);\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 * Get a knowledge page by resource name.\n *\n * Returns `NOT_FOUND` if no page with the given `name` exists.\n */\n async getPage(req: GetPageRequest, options?: CallOptions): Promise<Page> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/knowledge/${req.name ?? ''}`;\n let resp: Page | 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, unmarshalPageSchema);\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 * List visible knowledge pages in the account, optionally narrowed by\n * `domain` and `state`. With a domain filter, the caller must administer that\n * domain, including through inherited grants. Without a domain filter,\n * including when filtering only by state, account-wide Manage Discover or\n * Account Admin permission is required. List returns page metadata.\n */\n async listPages(\n req: ListPagesRequest,\n options?: CallOptions\n ): Promise<ListPagesResponse> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/knowledge/pages`;\n const params = new URLSearchParams();\n if (req.pageSize !== undefined) {\n params.append('page_size', String(req.pageSize));\n }\n if (req.pageToken !== undefined) {\n params.append('page_token', req.pageToken);\n }\n if (req.filter !== undefined) {\n params.append('filter', req.filter);\n }\n const query = params.toString();\n const fullUrl = query !== '' ? `${url}?${query}` : url;\n let resp: ListPagesResponse | 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, unmarshalListPagesResponseSchema);\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 *listPagesIter(\n req: ListPagesRequest,\n options?: CallOptions\n ): AsyncGenerator<Page> {\n const pageReq: ListPagesRequest = {...req};\n for (;;) {\n const resp = await this.listPages(pageReq, options);\n for (const item of resp.pages ?? []) {\n yield item;\n }\n if (resp.nextPageToken === undefined || resp.nextPageToken === '') {\n return;\n }\n pageReq.pageToken = resp.nextPageToken;\n }\n }\n\n /**\n * Update an existing knowledge page. For REST, send Page fields directly as\n * the JSON body and supply `update_mask` as a query parameter. The resource\n * `name` identifies the page; omitted mask fields retain their stored values.\n *\n * Errors: `INVALID_PARAMETER_VALUE` (field validation or a nonexistent target domain),\n * `NOT_FOUND` (the page does not exist), `ALREADY_EXISTS` (a rename or domain change\n * would collide with another published page), `PERMISSION_DENIED` (insufficient permissions),\n * `RESOURCE_EXHAUSTED`, `ABORTED`, `INTERNAL_ERROR`.\n */\n async updatePage(\n req: UpdatePageRequest,\n options?: CallOptions\n ): Promise<Page> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/knowledge/${req.page?.name ?? ''}`;\n const params = new URLSearchParams();\n if (req.updateMask !== undefined) {\n params.append('update_mask', req.updateMask.toString());\n }\n const query = params.toString();\n const fullUrl = query !== '' ? `${url}?${query}` : url;\n const body = marshalRequest(req.page, marshalPageSchema);\n let resp: Page | undefined;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers({'Content-Type': 'application/json'});\n if (workspaceId !== undefined) {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\n headers.set('User-Agent', this.userAgent);\n const httpReq = buildHttpRequest(\n 'PATCH',\n fullUrl,\n headers,\n callSignal,\n body\n );\n const respBody = await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n resp = parseResponse(respBody, unmarshalPageSchema);\n };\n await executeCall(call, options);\n if (resp === undefined) {\n throw new Error('operation completed without a result.');\n }\n return resp;\n }\n}\n"],"mappings":";;;;;;;;;AAwCA,MAAM,kBAAkB;CACtB,KAAK,iBAAyB,QAAQ,iBAAiB,GAAG;CAC1D,OAAOA;CACR;AAED,IAAa,kBAAb,MAA6B;CAC3B,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;;;;;;;;CASd,MAAM,gBACJ,KACA,SACoB;EACpB,MAAM,EAAC,MAAM,aAAa,eAAc,MAAM,KAAK,eAAe;EAClE,MAAM,MAAM,GAAG,KAAK,qBAAqB,IAAI,UAAU,GAAG;EAC1D,MAAM,OAAO,eAAe,IAAI,WAAW,uBAAuB;EAClE,IAAI;EACJ,MAAM,OAAO,OAAO,eAA4C;GAC9D,MAAM,UAAU,IAAI,QAAQ,EAAC,gBAAgB,oBAAmB,CAAC;AACjE,OAA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
|
|
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 type {ClientInfo} from '@databricks/sdk-core/clientinfo';\nimport {createDefault} from '@databricks/sdk-core/clientinfo';\nimport type {Logger} from '@databricks/sdk-core/logger';\nimport {NoOpLogger} from '@databricks/sdk-core/logger';\nimport type {CallOptions} from '@databricks/sdk-options/call';\nimport type {ClientOptions} from '@databricks/sdk-options/client';\nimport type {ResolvedClientConfig} from './transport';\nimport {resolveClientConfig} from './transport';\nimport {\n buildHttpRequest,\n executeCall,\n executeHttpCall,\n marshalRequest,\n parseResponse,\n} from './utils';\nimport pkgJson from '../../package.json' with {type: 'json'};\nimport type {\n AssetLink,\n CreateAssetLinkRequest,\n CreatePageRequest,\n DeleteAssetLinkRequest,\n DeletePageRequest,\n GetAssetLinkRequest,\n GetPageRequest,\n ListPagesRequest,\n ListPagesResponse,\n Page,\n UpdatePageRequest,\n} from './model';\nimport {\n marshalAssetLinkSchema,\n marshalPageSchema,\n unmarshalAssetLinkSchema,\n unmarshalListPagesResponseSchema,\n unmarshalPageSchema,\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 KnowledgeClient {\n private readonly options: ClientOptions;\n private readonly logger: Logger;\n // User-Agent segments, composed once at construction from createDefault()\n // merged with this package's identity. Each request adds the auth method,\n // which default credentials choose only when they first sign a request.\n private readonly clientInfo: ClientInfo;\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 this.clientInfo = createDefault()\n .with(PACKAGE_SEGMENT)\n .with({key: 'sdk-js-auth', value: AUTH_VERSION});\n }\n\n private resolveConfig(): Promise<ResolvedClientConfig> {\n this.config ??= resolveClientConfig(this.options, this.clientInfo);\n return this.config;\n }\n\n /**\n * Create an asset link on a page. For REST, send AssetLink fields directly\n * as the JSON request body; the parent path supplies the page and category.\n * An existing target with the same asset type, scope, and resolved asset ID\n * in that page/category returns the original link and creation time.\n */\n async createAssetLink(\n req: CreateAssetLinkRequest,\n options?: CallOptions\n ): Promise<AssetLink> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/knowledge/${req.parent ?? ''}/asset-links`;\n const body = marshalRequest(req.assetLink, marshalAssetLinkSchema);\n let resp: AssetLink | undefined;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers({'Content-Type': 'application/json'});\n if (workspaceId !== undefined && workspaceId !== '') {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\n const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);\n const respBody = await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n resp = parseResponse(respBody, unmarshalAssetLinkSchema);\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 * Create a knowledge page. Optional `request_id` makes retries idempotent while\n * the page exists; without it, retries can create duplicate drafts.\n * For REST, send Page fields as the JSON body and `request_id` as a query parameter.\n * When page permissions are enforced, creating a published page or assigning\n * another owner requires Page Manager or Domain Admin permissions on the domain,\n * including inherited grants. Creating your own draft requires neither grant.\n *\n * Errors: `INVALID_PARAMETER_VALUE` (missing `page`/`domain` or field validation),\n * `NOT_FOUND` (the referenced `domain` does not exist), `ALREADY_EXISTS` (a\n * published page with the same `domain` and `display_name` already exists),\n * `PERMISSION_DENIED` (insufficient permissions), `RESOURCE_EXHAUSTED`\n * (rate limited), `INTERNAL_ERROR` (unexpected failure).\n */\n async createPage(\n req: CreatePageRequest,\n options?: CallOptions\n ): Promise<Page> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/knowledge/pages`;\n const params = new URLSearchParams();\n if (req.requestId !== undefined) {\n params.append('request_id', req.requestId);\n }\n const query = params.toString();\n const fullUrl = query !== '' ? `${url}?${query}` : url;\n const body = marshalRequest(req.page, marshalPageSchema);\n let resp: Page | undefined;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers({'Content-Type': 'application/json'});\n if (workspaceId !== undefined && workspaceId !== '') {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\n const httpReq = buildHttpRequest(\n 'POST',\n fullUrl,\n headers,\n callSignal,\n body\n );\n const respBody = await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n resp = parseResponse(respBody, unmarshalPageSchema);\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 * Delete an asset link by its full resource name. Returns NOT_FOUND if the\n * link does not exist, including when it has already been deleted.\n */\n async deleteAssetLink(\n req: DeleteAssetLinkRequest,\n options?: CallOptions\n ): Promise<void> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/knowledge/${req.name ?? ''}`;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers();\n if (workspaceId !== undefined && workspaceId !== '') {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\n const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);\n await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n };\n await executeCall(call, options);\n }\n\n /**\n * Delete a knowledge page by resource name.\n *\n * Returns `NOT_FOUND` if no page with the given `name` exists.\n */\n async deletePage(\n req: DeletePageRequest,\n options?: CallOptions\n ): Promise<void> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/knowledge/${req.name ?? ''}`;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers();\n if (workspaceId !== undefined && workspaceId !== '') {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\n const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);\n await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n };\n await executeCall(call, options);\n }\n\n /**\n * Get an asset link by its full resource name. Table links return the table's\n * current FQN and require access to that table. Query and Genie\n * links return native UUIDs and require access in the caller's workspace.\n * Returns NOT_FOUND if the link is missing or its target identifier cannot be\n * resolved.\n */\n async getAssetLink(\n req: GetAssetLinkRequest,\n options?: CallOptions\n ): Promise<AssetLink> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/knowledge/${req.name ?? ''}`;\n let resp: AssetLink | undefined;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers();\n if (workspaceId !== undefined && workspaceId !== '') {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\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, unmarshalAssetLinkSchema);\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 * Get a knowledge page by resource name.\n *\n * Returns `NOT_FOUND` if no page with the given `name` exists.\n */\n async getPage(req: GetPageRequest, options?: CallOptions): Promise<Page> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/knowledge/${req.name ?? ''}`;\n let resp: Page | undefined;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers();\n if (workspaceId !== undefined && workspaceId !== '') {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\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, unmarshalPageSchema);\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 * List visible knowledge pages in the account, optionally narrowed by\n * `domain` and `state`. With a domain filter, the caller must administer that\n * domain, including through inherited grants. Without a domain filter,\n * including when filtering only by state, account-wide Manage Discover or\n * Account Admin permission is required. List returns page metadata.\n */\n async listPages(\n req: ListPagesRequest,\n options?: CallOptions\n ): Promise<ListPagesResponse> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/knowledge/pages`;\n const params = new URLSearchParams();\n if (req.pageSize !== undefined) {\n params.append('page_size', String(req.pageSize));\n }\n if (req.pageToken !== undefined) {\n params.append('page_token', req.pageToken);\n }\n if (req.filter !== undefined) {\n params.append('filter', req.filter);\n }\n const query = params.toString();\n const fullUrl = query !== '' ? `${url}?${query}` : url;\n let resp: ListPagesResponse | undefined;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers();\n if (workspaceId !== undefined && workspaceId !== '') {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\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, unmarshalListPagesResponseSchema);\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 *listPagesIter(\n req: ListPagesRequest,\n options?: CallOptions\n ): AsyncGenerator<Page> {\n const pageReq: ListPagesRequest = {...req};\n for (;;) {\n const resp = await this.listPages(pageReq, options);\n for (const item of resp.pages ?? []) {\n yield item;\n }\n if (resp.nextPageToken === undefined || resp.nextPageToken === '') {\n return;\n }\n pageReq.pageToken = resp.nextPageToken;\n }\n }\n\n /**\n * Update an existing knowledge page. For REST, send Page fields directly as\n * the JSON body and supply `update_mask` as a query parameter. The resource\n * `name` identifies the page; omitted mask fields retain their stored values.\n *\n * Errors: `INVALID_PARAMETER_VALUE` (field validation or a nonexistent target domain),\n * `NOT_FOUND` (the page does not exist), `ALREADY_EXISTS` (a rename or domain change\n * would collide with another published page), `PERMISSION_DENIED` (insufficient permissions),\n * `RESOURCE_EXHAUSTED`, `ABORTED`, `INTERNAL_ERROR`.\n */\n async updatePage(\n req: UpdatePageRequest,\n options?: CallOptions\n ): Promise<Page> {\n const {host, workspaceId, httpClient} = await this.resolveConfig();\n const url = `${host}/api/2.0/knowledge/${req.page?.name ?? ''}`;\n const params = new URLSearchParams();\n if (req.updateMask !== undefined) {\n params.append('update_mask', req.updateMask.toString());\n }\n const query = params.toString();\n const fullUrl = query !== '' ? `${url}?${query}` : url;\n const body = marshalRequest(req.page, marshalPageSchema);\n let resp: Page | undefined;\n const call = async (callSignal?: AbortSignal): Promise<void> => {\n const headers = new Headers({'Content-Type': 'application/json'});\n if (workspaceId !== undefined && workspaceId !== '') {\n headers.set('X-Databricks-Workspace-Id', workspaceId);\n }\n const httpReq = buildHttpRequest(\n 'PATCH',\n fullUrl,\n headers,\n callSignal,\n body\n );\n const respBody = await executeHttpCall({\n request: httpReq,\n httpClient,\n logger: this.logger,\n });\n resp = parseResponse(respBody, unmarshalPageSchema);\n };\n await executeCall(call, options);\n if (resp === undefined) {\n throw new Error('operation completed without a result.');\n }\n return resp;\n }\n}\n"],"mappings":";;;;;;;;;AAyCA,MAAM,kBAAkB;CACtB,KAAK,iBAAyB,QAAQ,iBAAiB,GAAG;CAC1D,OAAOA;CACR;AAED,IAAa,kBAAb,MAA6B;CAC3B,AAAiB;CACjB,AAAiB;CAIjB,AAAiB;CAIjB,AAAQ;CAER,YAAY,SAAwB;AAClC,OAAK,UAAU;AACf,OAAK,SAAS,QAAQ,UAAU,IAAI,YAAY;AAChD,OAAK,aAAa,eAAe,CAC9B,KAAK,gBAAgB,CACrB,KAAK;GAAC,KAAK;GAAe,OAAOC;GAAa,CAAC;;CAGpD,AAAQ,gBAA+C;AACrD,OAA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ACrC,SARc,iBACd,SACA,SACA,SACA,YACA,KACD;IAGC;IACA,QAAQ,KAAK;IACd,CAAC,EAC6B,oBAAoB;;AAErD,QAAM,YAAY,MAAM,QAAQ;AAChC,MAAI,SAAS,OACX,OAAM,IAAI,MAAM,wCAAwC;AAE1D,SAAO"}
|
package/dist/v1/transport.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ClientInfo } from "@databricks/sdk-core/clientinfo";
|
|
1
2
|
import { HttpClient } from "@databricks/sdk-core/http";
|
|
2
3
|
import { ClientOptions } from "@databricks/sdk-options/client";
|
|
3
4
|
|
|
@@ -27,11 +28,12 @@ interface ResolvedClientConfig {
|
|
|
27
28
|
* A configuration profile is always resolved from the config file and
|
|
28
29
|
* environment variables (per options.profileOptions); it supplies host,
|
|
29
30
|
* accountId, workspaceId, and credentials wherever the caller did not set them
|
|
30
|
-
* explicitly. Explicit options always take precedence.
|
|
31
|
+
* explicitly. Explicit options always take precedence. Each request's
|
|
32
|
+
* User-Agent is clientInfo with the auth method of the credentials.
|
|
31
33
|
*
|
|
32
34
|
* @throws if host is neither provided nor present in the resolved profile.
|
|
33
35
|
*/
|
|
34
|
-
declare function resolveClientConfig(options: ClientOptions): Promise<ResolvedClientConfig>;
|
|
36
|
+
declare function resolveClientConfig(options: ClientOptions, clientInfo: ClientInfo): Promise<ResolvedClientConfig>;
|
|
35
37
|
//#endregion
|
|
36
38
|
export { ResolvedClientConfig, resolveClientConfig };
|
|
37
39
|
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","names":[],"sources":["../../src/v1/transport.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"transport.d.ts","names":[],"sources":["../../src/v1/transport.ts"],"mappings":";;;;;;;AAmBA;;UAAiB,oBAAA;EAgBO;EAdtB,IAAA;EAMA;;;;EAAA,SAAA;EAQsB;AAcxB;;EAjBE,WAAA;EAkBS;EAfT,UAAA,EAAY,UAAA;AAAA;;;;;;;;;;;;iBAcQ,mBAAA,CACpB,OAAA,EAAS,aAAA,EACT,UAAA,EAAY,UAAA,GACX,OAAA,CAAQ,oBAAA"}
|
package/dist/v1/transport.js
CHANGED
|
@@ -9,18 +9,19 @@ import { resolve } from "@databricks/sdk-core/profiles";
|
|
|
9
9
|
* A configuration profile is always resolved from the config file and
|
|
10
10
|
* environment variables (per options.profileOptions); it supplies host,
|
|
11
11
|
* accountId, workspaceId, and credentials wherever the caller did not set them
|
|
12
|
-
* explicitly. Explicit options always take precedence.
|
|
12
|
+
* explicitly. Explicit options always take precedence. Each request's
|
|
13
|
+
* User-Agent is clientInfo with the auth method of the credentials.
|
|
13
14
|
*
|
|
14
15
|
* @throws if host is neither provided nor present in the resolved profile.
|
|
15
16
|
*/
|
|
16
|
-
async function resolveClientConfig(options) {
|
|
17
|
+
async function resolveClientConfig(options, clientInfo) {
|
|
17
18
|
const profile = await resolve(options.profileOptions);
|
|
18
19
|
const host = normalizeHost(options.host ?? profile.host);
|
|
19
20
|
if (host === void 0) throw new Error("Host is required.");
|
|
20
21
|
let httpClient = new AuthHttpClient(options.httpClient ?? newFetchHttpClient(), options.credentials ?? defaultCredentials({ profile: {
|
|
21
22
|
...profile,
|
|
22
23
|
host
|
|
23
|
-
} }));
|
|
24
|
+
} }), clientInfo);
|
|
24
25
|
if (options.timeout !== void 0) httpClient = new TimeoutHttpClient(httpClient, options.timeout);
|
|
25
26
|
const accountId = options.accountId ?? profile.accountId;
|
|
26
27
|
const workspaceId = options.workspaceId ?? profile.workspaceId;
|
|
@@ -36,16 +37,25 @@ function normalizeHost(host) {
|
|
|
36
37
|
if (trimmed === void 0 || trimmed === "") return;
|
|
37
38
|
return (/^https?:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`).replace(/\/$/, "");
|
|
38
39
|
}
|
|
39
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Wraps an HttpClient and adds authentication headers and the User-Agent to
|
|
42
|
+
* requests.
|
|
43
|
+
*/
|
|
40
44
|
var AuthHttpClient = class {
|
|
41
|
-
constructor(base, credentials) {
|
|
45
|
+
constructor(base, credentials, clientInfo) {
|
|
42
46
|
this.base = base;
|
|
43
47
|
this.credentials = credentials;
|
|
48
|
+
this.clientInfo = clientInfo;
|
|
44
49
|
}
|
|
45
50
|
async send(request) {
|
|
46
51
|
const authHeaders = await this.credentials.authHeaders();
|
|
47
52
|
const headers = new Headers(request.headers);
|
|
48
53
|
for (const h of authHeaders) headers.set(h.key, h.value);
|
|
54
|
+
const info = this.clientInfo.with({
|
|
55
|
+
key: "auth",
|
|
56
|
+
value: this.credentials.name()
|
|
57
|
+
});
|
|
58
|
+
headers.set("User-Agent", info.toString());
|
|
49
59
|
return this.base.send({
|
|
50
60
|
...request,
|
|
51
61
|
headers
|
package/dist/v1/transport.js.map
CHANGED
|
@@ -1 +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
|
|
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 {ClientInfo} from '@databricks/sdk-core/clientinfo';\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. Each request's\n * User-Agent is clientInfo with the auth method of the credentials.\n *\n * @throws if host is neither provided nor present in the resolved profile.\n */\nexport async function resolveClientConfig(\n options: ClientOptions,\n clientInfo: ClientInfo\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(\n base,\n credentials,\n clientInfo\n );\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/**\n * Wraps an HttpClient and adds authentication headers and the User-Agent to\n * requests.\n */\nclass AuthHttpClient implements HttpClient {\n constructor(\n private readonly base: HttpClient,\n private readonly credentials: Credentials,\n private readonly clientInfo: ClientInfo\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 // Default credentials choose their auth method when they first sign a\n // request, so the method is read after signing.\n const info = this.clientInfo.with({\n key: 'auth',\n value: this.credentials.name(),\n });\n headers.set('User-Agent', info.toString());\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":";;;;;;;;;;;;;;;;AAiDA,eAAsB,oBACpB,SACA,YAC+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,EAIxE,WACD;AACD,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;;;;;;AAOpC,IAAM,iBAAN,MAA2C;CACzC,YACE,AAAiB,MACjB,AAAiB,aACjB,AAAiB,YACjB;EAHiB;EACA;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;EAI7B,MAAM,OAAO,KAAK,WAAW,KAAK;GAChC,KAAK;GACL,OAAO,KAAK,YAAY,MAAM;GAC/B,CAAC;AACF,UAAQ,IAAI,cAAc,KAAK,UAAU,CAAC;AAC1C,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@databricks/sdk-knowledge",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@databricks/sdk-auth": ">=0.56.0 <1.0.0",
|
|
37
37
|
"@databricks/sdk-core": ">=0.52.0 <1.0.0",
|
|
38
|
-
"@databricks/sdk-options": ">=0.52.
|
|
38
|
+
"@databricks/sdk-options": ">=0.52.1 <1.0.0",
|
|
39
39
|
"@js-temporal/polyfill": "^0.5.0",
|
|
40
40
|
"json-bigint": "^1.0.0",
|
|
41
41
|
"zod": "^4.3.6"
|