@databricks/sdk-uc-secrets 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.js +7 -0
- package/dist/package.js.map +1 -0
- package/dist/v1/client.d.ts +62 -58
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +190 -234
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/index.d.ts +3 -7
- package/dist/v1/index.js +4 -7
- package/dist/v1/model.d.ts +136 -132
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +95 -115
- package/dist/v1/model.js.map +1 -1
- package/dist/v1/transport.d.ts +21 -17
- package/dist/v1/transport.d.ts.map +1 -1
- package/dist/v1/transport.js +60 -69
- package/dist/v1/transport.js.map +1 -1
- package/dist/v1/utils.d.ts +18 -14
- package/dist/v1/utils.d.ts.map +1 -1
- package/dist/v1/utils.js +76 -103
- package/dist/v1/utils.js.map +1 -1
- package/package.json +5 -5
- package/dist/v1/index.d.ts.map +0 -1
- package/dist/v1/index.js.map +0 -1
package/dist/v1/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/v1/model.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAwJtB,MAAM,CAAC,MAAM,kCAAkC,GAC7C,CAAC;KACE,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC,QAAQ,EAAE;IAChE,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC;KACD,SAAS,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WAAW;IAC3B,WAAW,EAAE,CAAC,CAAC,UAAU;IACzB,KAAK,EAAE,CAAC,CAAC,KAAK;IACd,eAAe,EAAE,CAAC,CAAC,cAAc;IACjC,WAAW,EAAE,CAAC,CAAC,UAAU;CAC1B,CAAC,CAAC,CAAC;AAEN,MAAM,qBAAqB,GAAoB;IAC7C,WAAW,EAAE,EAAC,IAAI,EAAE,cAAc,EAAC;IACnC,OAAO,EAAE,EAAC,IAAI,EAAE,SAAS,EAAC;IAC1B,UAAU,EAAE,EAAC,IAAI,EAAE,aAAa,EAAC;IACjC,SAAS,EAAE,EAAC,IAAI,EAAE,YAAY,EAAC;IAC/B,cAAc,EAAE,EAAC,IAAI,EAAE,iBAAiB,EAAC;IACzC,cAAc,EAAE,EAAC,IAAI,EAAE,iBAAiB,EAAC;IACzC,UAAU,EAAE,EAAC,IAAI,EAAE,aAAa,EAAC;IACjC,QAAQ,EAAE,EAAC,IAAI,EAAE,WAAW,EAAC;IAC7B,WAAW,EAAE,EAAC,IAAI,EAAE,cAAc,EAAC;IACnC,IAAI,EAAE,EAAC,IAAI,EAAE,MAAM,EAAC;IACpB,KAAK,EAAE,EAAC,IAAI,EAAE,OAAO,EAAC;IACtB,UAAU,EAAE,EAAC,IAAI,EAAE,aAAa,EAAC;IACjC,UAAU,EAAE,EAAC,IAAI,EAAE,aAAa,EAAC;IACjC,SAAS,EAAE,EAAC,IAAI,EAAE,YAAY,EAAC;IAC/B,KAAK,EAAE,EAAC,IAAI,EAAE,OAAO,EAAC;CACvB,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,GAAG,KAAe;IAChD,OAAO,SAAS,CAAC,KAAK,CAAS,KAAK,EAAE,qBAAqB,CAAC,CAAC;AAC/D,CAAC"}
|
|
1
|
+
{"version":3,"file":"model.js","names":[],"sources":["../../src/v1/model.ts"],"sourcesContent":["// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.\n\nimport {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/** Request message for CreateSecret. */\nexport interface CreateSecretRequest {\n /**\n * The secret object to create. The **name**, **catalog_name**, **schema_name**, and **value**\n * fields are required.\n */\n secret?: Secret | undefined;\n}\n\n/** Request message for DeleteSecret. */\nexport interface DeleteSecretRequest {\n /**\n * The three-level (fully qualified) name of the secret\n * (for example, **catalog_name.schema_name.secret_name**).\n */\n fullName?: string | undefined;\n}\n\n/** Request message for GetSecret. */\nexport interface GetSecretRequest {\n /**\n * The three-level (fully qualified) name of the secret\n * (for example, **catalog_name.schema_name.secret_name**).\n */\n fullName?: string | undefined;\n /**\n * Whether to include the secret value in the response. Defaults to false. Requires the\n * **READ_SECRET** privilege.\n */\n includeValue?: boolean | undefined;\n}\n\n/** Request message for ListSecrets. */\nexport interface ListSecretsRequest {\n /**\n * The name of the catalog under which to list secrets. Both **catalog_name** and\n * **schema_name** must be specified together.\n */\n catalogName?: string | undefined;\n /**\n * The name of the schema under which to list secrets. Both **catalog_name** and\n * **schema_name** must be specified together.\n */\n schemaName?: string | undefined;\n /**\n * Opaque pagination token to go to the next page based on previous query. The maximum page length\n * is determined by a server configured value.\n */\n pageToken?: string | undefined;\n /**\n * Maximum number of secrets to return.\n *\n * - If not specified, at most 1000 secrets are returned.\n * - If set to a value greater than 0, the page length is the minimum of this value and 1000.\n * - If set to 0, the page length is set to 1000.\n * - If set to a value less than 0, an invalid parameter error is returned.\n */\n pageSize?: number | undefined;\n}\n\n/** Response message for ListSecrets. */\nexport interface ListSecretsResponse {\n /** An array of secret objects. */\n secrets?: Secret[] | undefined;\n /**\n * Opaque token to retrieve the next page of results. Absent if there are no more pages.\n * **page_token** should be set to this value for the next request.\n */\n nextPageToken?: string | undefined;\n}\n\n/**\n * A secret stored in Unity Catalog. Secrets are three-level namespace objects\n * (catalog.schema.secret) that securely store sensitive credential data such as\n * passwords, tokens, and keys.\n */\nexport interface Secret {\n /** The name of the secret, relative to its parent schema. */\n name?: string | undefined;\n /**\n * The owner of the secret. Defaults to the creating principal on creation. Can be updated to\n * transfer ownership of the secret to another principal.\n */\n owner?: string | undefined;\n /**\n * The effective owner of the secret, which may differ from the directly-set **owner** due to\n * inheritance.\n */\n effectiveOwner?: string | undefined;\n /** Unique identifier of the metastore hosting the secret. */\n metastoreId?: string | undefined;\n /** The time at which this secret was created. */\n createTime?: Temporal.Instant | undefined;\n /** The principal that created the secret. */\n createdBy?: string | undefined;\n /** The time at which this secret was last updated. */\n updateTime?: Temporal.Instant | undefined;\n /** The principal that last updated the secret. */\n updatedBy?: string | undefined;\n /** User-provided free-form text description of the secret. */\n comment?: string | undefined;\n /** The three-level (fully qualified) name of the secret, in the form of **catalog_name.schema_name.secret_name**. */\n fullName?: string | undefined;\n /** The name of the catalog where the schema and the secret reside. */\n catalogName?: string | undefined;\n /** The name of the schema where the secret resides. */\n schemaName?: string | undefined;\n /**\n * The secret value to store. This field is input-only and is not returned in responses — use\n * the **effective_value** field (via GetSecret with **include_value** set to true) to read the\n * secret value. The maximum size is 60 KiB (pre-encryption). Accepted content includes\n * passwords, tokens, keys, and other sensitive credential data.\n */\n value?: string | undefined;\n /**\n * The secret value. Only populated in responses when you have the **READ_SECRET**\n * privilege and **include_value** is set to true in the request. The maximum size is 60 KiB.\n */\n effectiveValue?: string | undefined;\n /**\n * User-provided expiration time of the secret. This field indicates when the secret should no\n * longer be used and may be displayed as a warning in the UI. It is purely informational and\n * does not trigger any automatic actions or affect the secret's lifecycle.\n */\n expireTime?: Temporal.Instant | undefined;\n}\n\n/** Request message for UpdateSecret. */\nexport interface UpdateSecretRequest {\n /**\n * The three-level (fully qualified) name of the secret\n * (for example, **catalog_name.schema_name.secret_name**).\n */\n fullName?: string | undefined;\n /**\n * The secret object containing the fields to update. Only fields specified in **update_mask**\n * will be updated.\n */\n secret?: Secret | undefined;\n /**\n * The field mask specifying which fields of the secret to update.\n * - If **update_mask** is **\"*\"**, all fields specified in **secret** are updated.\n * - If **update_mask** specifies one or more fields, only those fields are updated.\n * Each specified field must be set in **secret**.\n * Supported fields: **value**, **comment**, **owner**, **expire_time**. To change the secret\n * name, delete and recreate the secret.\n */\n updateMask?: FieldMask<Secret> | undefined;\n}\n\nexport const unmarshalListSecretsResponseSchema: z.ZodType<ListSecretsResponse> =\n z\n .object({\n secrets: z.array(z.lazy(() => unmarshalSecretSchema)).optional(),\n next_page_token: z.string().optional(),\n })\n .transform(d => ({\n secrets: d.secrets,\n nextPageToken: d.next_page_token,\n }));\n\nexport const unmarshalSecretSchema: z.ZodType<Secret> = z\n .object({\n name: z.string().optional(),\n owner: z.string().optional(),\n effective_owner: z.string().optional(),\n metastore_id: z.string().optional(),\n create_time: z\n .string()\n .transform(s => Temporal.Instant.from(s))\n .optional(),\n created_by: z.string().optional(),\n update_time: z\n .string()\n .transform(s => Temporal.Instant.from(s))\n .optional(),\n updated_by: z.string().optional(),\n comment: z.string().optional(),\n full_name: z.string().optional(),\n catalog_name: z.string().optional(),\n schema_name: z.string().optional(),\n value: z.string().optional(),\n effective_value: z.string().optional(),\n expire_time: z\n .string()\n .transform(s => Temporal.Instant.from(s))\n .optional(),\n })\n .transform(d => ({\n name: d.name,\n owner: d.owner,\n effectiveOwner: d.effective_owner,\n metastoreId: d.metastore_id,\n createTime: d.create_time,\n createdBy: d.created_by,\n updateTime: d.update_time,\n updatedBy: d.updated_by,\n comment: d.comment,\n fullName: d.full_name,\n catalogName: d.catalog_name,\n schemaName: d.schema_name,\n value: d.value,\n effectiveValue: d.effective_value,\n expireTime: d.expire_time,\n }));\n\nexport const marshalSecretSchema: z.ZodType = z\n .object({\n name: z.string().optional(),\n owner: z.string().optional(),\n effectiveOwner: z.string().optional(),\n metastoreId: z.string().optional(),\n createTime: z\n .any()\n .transform((d: Temporal.Instant) => d.toString())\n .optional(),\n createdBy: z.string().optional(),\n updateTime: z\n .any()\n .transform((d: Temporal.Instant) => d.toString())\n .optional(),\n updatedBy: z.string().optional(),\n comment: z.string().optional(),\n fullName: z.string().optional(),\n catalogName: z.string().optional(),\n schemaName: z.string().optional(),\n value: z.string().optional(),\n effectiveValue: z.string().optional(),\n expireTime: z\n .any()\n .transform((d: Temporal.Instant) => d.toString())\n .optional(),\n })\n .transform(d => ({\n name: d.name,\n owner: d.owner,\n effective_owner: d.effectiveOwner,\n metastore_id: d.metastoreId,\n create_time: d.createTime,\n created_by: d.createdBy,\n update_time: d.updateTime,\n updated_by: d.updatedBy,\n comment: d.comment,\n full_name: d.fullName,\n catalog_name: d.catalogName,\n schema_name: d.schemaName,\n value: d.value,\n effective_value: d.effectiveValue,\n expire_time: d.expireTime,\n }));\n\nconst secretFieldMaskSchema: FieldMaskSchema = {\n catalogName: {wire: 'catalog_name'},\n comment: {wire: 'comment'},\n createTime: {wire: 'create_time'},\n createdBy: {wire: 'created_by'},\n effectiveOwner: {wire: 'effective_owner'},\n effectiveValue: {wire: 'effective_value'},\n expireTime: {wire: 'expire_time'},\n fullName: {wire: 'full_name'},\n metastoreId: {wire: 'metastore_id'},\n name: {wire: 'name'},\n owner: {wire: 'owner'},\n schemaName: {wire: 'schema_name'},\n updateTime: {wire: 'update_time'},\n updatedBy: {wire: 'updated_by'},\n value: {wire: 'value'},\n};\n\nexport function secretFieldMask(...paths: string[]): FieldMask<Secret> {\n return FieldMask.build<Secret>(paths, secretFieldMaskSchema);\n}\n"],"mappings":";;;;;AA6JA,MAAa,qCACX,EACG,OAAO;CACN,SAAS,EAAE,MAAM,EAAE,WAAW,sBAAsB,CAAC,CAAC,UAAU;CAChE,iBAAiB,EAAE,QAAQ,CAAC,UAAU;CACvC,CAAC,CACD,WAAU,OAAM;CACf,SAAS,EAAE;CACX,eAAe,EAAE;CAClB,EAAE;AAEP,MAAa,wBAA2C,EACrD,OAAO;CACN,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,iBAAiB,EAAE,QAAQ,CAAC,UAAU;CACtC,cAAc,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1/transport.d.ts
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { HttpClient } from "@databricks/sdk-core/http";
|
|
2
|
+
import { ClientOptions } from "@databricks/sdk-options/client";
|
|
3
|
+
|
|
4
|
+
//#region src/v1/transport.d.ts
|
|
3
5
|
/**
|
|
4
6
|
* The configuration a client needs to issue requests, resolved from
|
|
5
7
|
* {@link ClientOptions} and a configuration profile.
|
|
6
8
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
interface ResolvedClientConfig {
|
|
10
|
+
/** Host with any trailing slash removed. */
|
|
11
|
+
host: string;
|
|
12
|
+
/**
|
|
13
|
+
* Default account ID for account-level paths that contain an account_id
|
|
14
|
+
* segment. A request's own accountId still wins.
|
|
15
|
+
*/
|
|
16
|
+
accountId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
19
|
+
*/
|
|
20
|
+
workspaceId?: string;
|
|
21
|
+
/** HTTP client with authentication, and any configured timeout, applied. */
|
|
22
|
+
httpClient: HttpClient;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
|
|
@@ -29,5 +31,7 @@ export interface ResolvedClientConfig {
|
|
|
29
31
|
*
|
|
30
32
|
* @throws if host is neither provided nor present in the resolved profile.
|
|
31
33
|
*/
|
|
32
|
-
|
|
34
|
+
declare function resolveClientConfig(options: ClientOptions): Promise<ResolvedClientConfig>;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { ResolvedClientConfig, resolveClientConfig };
|
|
33
37
|
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","
|
|
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"}
|
package/dist/v1/transport.js
CHANGED
|
@@ -1,74 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { defaultCredentials } from "@databricks/sdk-auth/credentials";
|
|
2
|
+
import { newFetchHttpClient } from "@databricks/sdk-core/http";
|
|
3
|
+
import { resolve } from "@databricks/sdk-core/profiles";
|
|
4
|
+
|
|
5
|
+
//#region src/v1/transport.ts
|
|
5
6
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
httpClient = new TimeoutHttpClient(httpClient, options.timeout);
|
|
30
|
-
}
|
|
31
|
-
const accountId = options.accountId ?? profile.accountId;
|
|
32
|
-
const workspaceId = options.workspaceId ?? profile.workspaceId;
|
|
33
|
-
return {
|
|
34
|
-
host: host.replace(/\/$/, ''),
|
|
35
|
-
httpClient,
|
|
36
|
-
...(accountId !== undefined && { accountId }),
|
|
37
|
-
...(workspaceId !== undefined && { workspaceId }),
|
|
38
|
-
};
|
|
7
|
+
* Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
|
|
8
|
+
*
|
|
9
|
+
* A configuration profile is always resolved from the config file and
|
|
10
|
+
* environment variables (per options.profileOptions); it supplies host,
|
|
11
|
+
* accountId, workspaceId, and credentials wherever the caller did not set them
|
|
12
|
+
* explicitly. Explicit options always take precedence.
|
|
13
|
+
*
|
|
14
|
+
* @throws if host is neither provided nor present in the resolved profile.
|
|
15
|
+
*/
|
|
16
|
+
async function resolveClientConfig(options) {
|
|
17
|
+
const profile = await resolve(options.profileOptions);
|
|
18
|
+
const host = options.host ?? profile.host;
|
|
19
|
+
if (host === void 0) throw new Error("Host is required.");
|
|
20
|
+
let httpClient = new AuthHttpClient(options.httpClient ?? newFetchHttpClient(), options.credentials ?? defaultCredentials({ profile }));
|
|
21
|
+
if (options.timeout !== void 0) httpClient = new TimeoutHttpClient(httpClient, options.timeout);
|
|
22
|
+
const accountId = options.accountId ?? profile.accountId;
|
|
23
|
+
const workspaceId = options.workspaceId ?? profile.workspaceId;
|
|
24
|
+
return {
|
|
25
|
+
host: host.replace(/\/$/, ""),
|
|
26
|
+
httpClient,
|
|
27
|
+
...accountId !== void 0 && { accountId },
|
|
28
|
+
...workspaceId !== void 0 && { workspaceId }
|
|
29
|
+
};
|
|
39
30
|
}
|
|
40
31
|
/** Wraps an HttpClient and adds authentication headers to requests. */
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
}
|
|
32
|
+
var AuthHttpClient = class {
|
|
33
|
+
constructor(base, credentials) {
|
|
34
|
+
this.base = base;
|
|
35
|
+
this.credentials = credentials;
|
|
36
|
+
}
|
|
37
|
+
async send(request) {
|
|
38
|
+
const authHeaders = await this.credentials.authHeaders();
|
|
39
|
+
const headers = new Headers(request.headers);
|
|
40
|
+
for (const h of authHeaders) headers.set(h.key, h.value);
|
|
41
|
+
return this.base.send({
|
|
42
|
+
...request,
|
|
43
|
+
headers
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
58
47
|
/** Wraps an HttpClient and applies a default timeout to requests. */
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
48
|
+
var TimeoutHttpClient = class {
|
|
49
|
+
constructor(base, timeout) {
|
|
50
|
+
this.base = base;
|
|
51
|
+
this.timeout = timeout;
|
|
52
|
+
}
|
|
53
|
+
async send(request) {
|
|
54
|
+
const timeoutSignal = AbortSignal.timeout(this.timeout);
|
|
55
|
+
const signal = request.signal !== void 0 ? AbortSignal.any([request.signal, timeoutSignal]) : timeoutSignal;
|
|
56
|
+
return this.base.send({
|
|
57
|
+
...request,
|
|
58
|
+
signal
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { resolveClientConfig };
|
|
74
65
|
//# sourceMappingURL=transport.js.map
|
package/dist/v1/transport.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","
|
|
1
|
+
{"version":3,"file":"transport.js","names":[],"sources":["../../src/v1/transport.ts"],"sourcesContent":["// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.\n\nimport type {Credentials} from '@databricks/sdk-auth';\nimport {defaultCredentials} from '@databricks/sdk-auth/credentials';\nimport type {\n HttpClient,\n HttpRequest,\n HttpResponse,\n} from '@databricks/sdk-core/http';\nimport {newFetchHttpClient} from '@databricks/sdk-core/http';\nimport type {Profile} from '@databricks/sdk-core/profiles';\nimport {resolve} from '@databricks/sdk-core/profiles';\nimport type {ClientOptions} from '@databricks/sdk-options/client';\n\n/**\n * The configuration a client needs to issue requests, resolved from\n * {@link ClientOptions} and a configuration profile.\n */\nexport interface ResolvedClientConfig {\n /** Host with any trailing slash removed. */\n host: string;\n\n /**\n * Default account ID for account-level paths that contain an account_id\n * segment. A request's own accountId still wins.\n */\n accountId?: string;\n\n /**\n * Workspace ID used to route workspace-level calls on unified hosts (SPOG).\n */\n workspaceId?: string;\n\n /** HTTP client with authentication, and any configured timeout, applied. */\n httpClient: HttpClient;\n}\n\n/**\n * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.\n *\n * A configuration profile is always resolved from the config file and\n * environment variables (per options.profileOptions); it supplies host,\n * accountId, workspaceId, and credentials wherever the caller did not set them\n * explicitly. Explicit options always take precedence.\n *\n * @throws if host is neither provided nor present in the resolved profile.\n */\nexport async function resolveClientConfig(\n options: ClientOptions\n): Promise<ResolvedClientConfig> {\n const profile: Profile = await resolve(options.profileOptions);\n\n const host = options.host ?? profile.host;\n if (host === undefined) {\n throw new Error('Host is required.');\n }\n\n // The provided httpClient (or the default fetch client) is the base wire;\n // authentication and the optional timeout are layered on top of it. The\n // default credential chain reuses the profile resolved above so that the\n // same profileOptions govern host and authentication alike.\n const base = options.httpClient ?? newFetchHttpClient();\n const credentials = options.credentials ?? defaultCredentials({profile});\n let httpClient: HttpClient = new AuthHttpClient(base, credentials);\n if (options.timeout !== undefined) {\n httpClient = new TimeoutHttpClient(httpClient, options.timeout);\n }\n\n const accountId = options.accountId ?? profile.accountId;\n const workspaceId = options.workspaceId ?? profile.workspaceId;\n\n return {\n host: host.replace(/\\/$/, ''),\n httpClient,\n ...(accountId !== undefined && {accountId}),\n ...(workspaceId !== undefined && {workspaceId}),\n };\n}\n\n/** Wraps an HttpClient and adds authentication headers to requests. */\nclass AuthHttpClient implements HttpClient {\n constructor(\n private readonly base: HttpClient,\n private readonly credentials: Credentials\n ) {}\n\n async send(request: HttpRequest): Promise<HttpResponse> {\n const authHeaders = await this.credentials.authHeaders();\n // Do not modify the original request.\n const headers = new Headers(request.headers);\n for (const h of authHeaders) {\n headers.set(h.key, h.value);\n }\n return this.base.send({...request, headers});\n }\n}\n\n/** Wraps an HttpClient and applies a default timeout to requests. */\nclass TimeoutHttpClient implements HttpClient {\n constructor(\n private readonly base: HttpClient,\n private readonly timeout: number\n ) {}\n\n async send(request: HttpRequest): Promise<HttpResponse> {\n const timeoutSignal = AbortSignal.timeout(this.timeout);\n const signal =\n request.signal !== undefined\n ? AbortSignal.any([request.signal, timeoutSignal])\n : timeoutSignal;\n return this.base.send({...request, signal});\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+CA,eAAsB,oBACpB,SAC+B;CAC/B,MAAM,UAAmB,MAAM,QAAQ,QAAQ,eAAe;CAE9D,MAAM,OAAO,QAAQ,QAAQ,QAAQ;AACrC,KAAI,SAAS,OACX,OAAM,IAAI,MAAM,oBAAoB;CAStC,IAAI,aAAyB,IAAI,eAFpB,QAAQ,cAAc,oBAAoB,EACnC,QAAQ,eAAe,mBAAmB,EAAC,SAAQ,CAAC,CACN;AAClE,KAAI,QAAQ,YAAY,OACtB,cAAa,IAAI,kBAAkB,YAAY,QAAQ,QAAQ;CAGjE,MAAM,YAAY,QAAQ,aAAa,QAAQ;CAC/C,MAAM,cAAc,QAAQ,eAAe,QAAQ;AAEnD,QAAO;EACL,MAAM,KAAK,QAAQ,OAAO,GAAG;EAC7B;EACA,GAAI,cAAc,UAAa,EAAC,WAAU;EAC1C,GAAI,gBAAgB,UAAa,EAAC,aAAY;EAC/C;;;AAIH,IAAM,iBAAN,MAA2C;CACzC,YACE,AAAiB,MACjB,AAAiB,aACjB;EAFiB;EACA;;CAGnB,MAAM,KAAK,SAA6C;EACtD,MAAM,cAAc,MAAM,KAAK,YAAY,aAAa;EAExD,MAAM,UAAU,IAAI,QAAQ,QAAQ,QAAQ;AAC5C,OAAK,MAAM,KAAK,YACd,SAAQ,IAAI,EAAE,KAAK,EAAE,MAAM;AAE7B,SAAO,KAAK,KAAK,KAAK;GAAC,GAAG;GAAS;GAAQ,CAAC;;;;AAKhD,IAAM,oBAAN,MAA8C;CAC5C,YACE,AAAiB,MACjB,AAAiB,SACjB;EAFiB;EACA;;CAGnB,MAAM,KAAK,SAA6C;EACtD,MAAM,gBAAgB,YAAY,QAAQ,KAAK,QAAQ;EACvD,MAAM,SACJ,QAAQ,WAAW,SACf,YAAY,IAAI,CAAC,QAAQ,QAAQ,cAAc,CAAC,GAChD;AACN,SAAO,KAAK,KAAK,KAAK;GAAC,GAAG;GAAS;GAAO,CAAC"}
|
package/dist/v1/utils.d.ts
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { Logger } from "@databricks/sdk-core/logger";
|
|
2
|
+
import { HttpClient, HttpRequest } from "@databricks/sdk-core/http";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { CallOptions } from "@databricks/sdk-options/call";
|
|
5
|
+
|
|
6
|
+
//#region src/v1/utils.d.ts
|
|
7
|
+
interface HttpCallOptions {
|
|
8
|
+
readonly request: HttpRequest;
|
|
9
|
+
readonly httpClient: HttpClient;
|
|
10
|
+
readonly logger: Logger;
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* Translates public CallOptions to the internal Options shape accepted by
|
|
12
14
|
* execute(). Even though the shapes match today, this isolates the public
|
|
13
15
|
* API from the executor's internal type so they can diverge.
|
|
14
16
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
declare function executeCall(call: (signal?: AbortSignal) => Promise<void>, options?: CallOptions): Promise<void>;
|
|
18
|
+
declare function executeHttpCall(opts: HttpCallOptions): Promise<Uint8Array>;
|
|
19
|
+
declare function buildHttpRequest(method: string, url: string, headers: Headers, signal?: AbortSignal, body?: string | ReadableStream<Uint8Array>): HttpRequest;
|
|
20
|
+
declare function parseResponse<T>(body: Uint8Array, schema: z.ZodType<T>): T;
|
|
21
|
+
declare function marshalRequest(data: unknown, schema: z.ZodType): string;
|
|
22
|
+
declare function flattenQueryParams(prefix: string, value: unknown, params: URLSearchParams): void;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { HttpCallOptions, buildHttpRequest, executeCall, executeHttpCall, flattenQueryParams, marshalRequest, parseResponse };
|
|
21
25
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/v1/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","
|
|
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"}
|
package/dist/v1/utils.js
CHANGED
|
@@ -1,114 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// literals come back as bigint instead of being rounded to JS Number. On the
|
|
7
|
-
// way out, bigint values are emitted as raw JSON number digits.
|
|
1
|
+
import { execute } from "@databricks/sdk-core/ops";
|
|
2
|
+
import { ApiError } from "@databricks/sdk-core/apierror";
|
|
3
|
+
import JSONBig from "json-bigint";
|
|
4
|
+
|
|
5
|
+
//#region src/v1/utils.ts
|
|
8
6
|
const jsonBigint = JSONBig({ useNativeBigInt: true });
|
|
9
7
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
return execute(options?.signal, call, opts);
|
|
8
|
+
* Translates public CallOptions to the internal Options shape accepted by
|
|
9
|
+
* execute(). Even though the shapes match today, this isolates the public
|
|
10
|
+
* API from the executor's internal type so they can diverge.
|
|
11
|
+
*/
|
|
12
|
+
async function executeCall(call, options) {
|
|
13
|
+
const opts = {
|
|
14
|
+
...options?.retrier !== void 0 && { retrier: options.retrier },
|
|
15
|
+
...options?.rateLimiter !== void 0 && { rateLimiter: options.rateLimiter },
|
|
16
|
+
...options?.timeout !== void 0 && { timeout: options.timeout }
|
|
17
|
+
};
|
|
18
|
+
return execute(options?.signal, call, opts);
|
|
23
19
|
}
|
|
24
20
|
async function readAll(body) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
result.set(chunk, offset);
|
|
42
|
-
offset += chunk.length;
|
|
43
|
-
}
|
|
44
|
-
return result;
|
|
21
|
+
if (body === null) return new Uint8Array(0);
|
|
22
|
+
const reader = body.getReader();
|
|
23
|
+
const chunks = [];
|
|
24
|
+
for (;;) {
|
|
25
|
+
const { done, value } = await reader.read();
|
|
26
|
+
if (done) break;
|
|
27
|
+
chunks.push(value);
|
|
28
|
+
}
|
|
29
|
+
const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
|
|
30
|
+
const result = new Uint8Array(totalLength);
|
|
31
|
+
let offset = 0;
|
|
32
|
+
for (const chunk of chunks) {
|
|
33
|
+
result.set(chunk, offset);
|
|
34
|
+
offset += chunk.length;
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
45
37
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
throw apiErr;
|
|
67
|
-
}
|
|
68
|
-
return body;
|
|
38
|
+
async function executeHttpCall(opts) {
|
|
39
|
+
opts.logger.debug("HTTP request", {
|
|
40
|
+
method: opts.request.method,
|
|
41
|
+
url: opts.request.url
|
|
42
|
+
});
|
|
43
|
+
let resp;
|
|
44
|
+
try {
|
|
45
|
+
resp = await opts.httpClient.send(opts.request);
|
|
46
|
+
} catch (e) {
|
|
47
|
+
opts.logger.debug("HTTP request failed");
|
|
48
|
+
throw e;
|
|
49
|
+
}
|
|
50
|
+
const body = await readAll(resp.body);
|
|
51
|
+
opts.logger.debug("HTTP response", {
|
|
52
|
+
statusCode: resp.statusCode,
|
|
53
|
+
body: new TextDecoder().decode(body)
|
|
54
|
+
});
|
|
55
|
+
const apiErr = ApiError.fromHttpError(resp.statusCode, resp.headers, body);
|
|
56
|
+
if (apiErr !== void 0) throw apiErr;
|
|
57
|
+
return body;
|
|
69
58
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
59
|
+
function buildHttpRequest(method, url, headers, signal, body) {
|
|
60
|
+
const req = {
|
|
61
|
+
url,
|
|
62
|
+
method,
|
|
63
|
+
headers
|
|
64
|
+
};
|
|
65
|
+
if (body !== void 0) req.body = body;
|
|
66
|
+
if (signal !== void 0) req.signal = signal;
|
|
67
|
+
return req;
|
|
79
68
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return schema.parse(parsed);
|
|
69
|
+
function parseResponse(body, schema) {
|
|
70
|
+
const text = new TextDecoder().decode(body);
|
|
71
|
+
const parsed = text === "" ? {} : jsonBigint.parse(text);
|
|
72
|
+
return schema.parse(parsed);
|
|
85
73
|
}
|
|
86
|
-
|
|
87
|
-
|
|
74
|
+
function marshalRequest(data, schema) {
|
|
75
|
+
return jsonBigint.stringify(schema.parse(data));
|
|
88
76
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
for (const item of value) {
|
|
96
|
-
params.append(prefix, String(item));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
else if (typeof value === 'object') {
|
|
100
|
-
for (const [key, val] of Object.entries(value)) {
|
|
101
|
-
flattenQueryParams(`${prefix}.${key}`, val, params);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
else if (typeof value === 'string' ||
|
|
105
|
-
typeof value === 'number' ||
|
|
106
|
-
typeof value === 'boolean' ||
|
|
107
|
-
typeof value === 'bigint') {
|
|
108
|
-
params.append(prefix, String(value));
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
throw new Error(`Unsupported query parameter type: ${typeof value}`);
|
|
112
|
-
}
|
|
77
|
+
function flattenQueryParams(prefix, value, params) {
|
|
78
|
+
if (value === null || value === void 0) return;
|
|
79
|
+
if (Array.isArray(value)) for (const item of value) params.append(prefix, String(item));
|
|
80
|
+
else if (typeof value === "object") for (const [key, val] of Object.entries(value)) flattenQueryParams(`${prefix}.${key}`, val, params);
|
|
81
|
+
else if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") params.append(prefix, String(value));
|
|
82
|
+
else throw new Error(`Unsupported query parameter type: ${typeof value}`);
|
|
113
83
|
}
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
export { buildHttpRequest, executeCall, executeHttpCall, flattenQueryParams, marshalRequest, parseResponse };
|
|
114
87
|
//# sourceMappingURL=utils.js.map
|
package/dist/v1/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../src/v1/utils.ts"],"sourcesContent":["// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.\n\nimport type {Options} from '@databricks/sdk-core/ops';\nimport {execute} from '@databricks/sdk-core/ops';\nimport {ApiError} from '@databricks/sdk-core/apierror';\nimport type {\n HttpClient,\n HttpRequest,\n HttpResponse,\n} from '@databricks/sdk-core/http';\nimport type {Logger} from '@databricks/sdk-core/logger';\nimport type {CallOptions} from '@databricks/sdk-options/call';\nimport JSONBig from 'json-bigint';\nimport type {z} from 'zod';\n\n// JSON codec that preserves int64 precision. On the way in, large integer\n// literals come back as bigint instead of being rounded to JS Number. On the\n// way out, bigint values are emitted as raw JSON number digits.\nconst jsonBigint = JSONBig({useNativeBigInt: true});\n\nexport interface HttpCallOptions {\n readonly request: HttpRequest;\n readonly httpClient: HttpClient;\n readonly logger: Logger;\n}\n\n/**\n * Translates public CallOptions to the internal Options shape accepted by\n * execute(). Even though the shapes match today, this isolates the public\n * API from the executor's internal type so they can diverge.\n */\nexport async function executeCall(\n call: (signal?: AbortSignal) => Promise<void>,\n options?: CallOptions\n): Promise<void> {\n const opts: Options = {\n ...(options?.retrier !== undefined && {retrier: options.retrier}),\n ...(options?.rateLimiter !== undefined && {\n rateLimiter: options.rateLimiter,\n }),\n ...(options?.timeout !== undefined && {timeout: options.timeout}),\n };\n return execute(options?.signal, call, opts);\n}\n\nasync function readAll(\n body: ReadableStream<Uint8Array> | null\n): Promise<Uint8Array> {\n if (body === null) {\n return new Uint8Array(0);\n }\n const reader = body.getReader();\n const chunks: Uint8Array[] = [];\n for (;;) {\n const {done, value} = await reader.read();\n if (done) {\n break;\n }\n chunks.push(value);\n }\n const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);\n const result = new Uint8Array(totalLength);\n let offset = 0;\n for (const chunk of chunks) {\n result.set(chunk, offset);\n offset += chunk.length;\n }\n return result;\n}\n\nexport async function executeHttpCall(\n opts: HttpCallOptions\n): Promise<Uint8Array> {\n opts.logger.debug('HTTP request', {\n method: opts.request.method,\n url: opts.request.url,\n });\n\n let resp: HttpResponse;\n try {\n resp = await opts.httpClient.send(opts.request);\n } catch (e: unknown) {\n opts.logger.debug('HTTP request failed');\n throw e;\n }\n\n const body = await readAll(resp.body);\n\n opts.logger.debug('HTTP response', {\n statusCode: resp.statusCode,\n body: new TextDecoder().decode(body),\n });\n\n const apiErr = ApiError.fromHttpError(resp.statusCode, resp.headers, body);\n if (apiErr !== undefined) {\n throw apiErr;\n }\n\n return body;\n}\n\nexport function buildHttpRequest(\n method: string,\n url: string,\n headers: Headers,\n signal?: AbortSignal,\n body?: string | ReadableStream<Uint8Array>\n): HttpRequest {\n const req: HttpRequest = {url, method, headers};\n if (body !== undefined) {\n req.body = body;\n }\n if (signal !== undefined) {\n req.signal = signal;\n }\n return req;\n}\n\nexport function parseResponse<T>(body: Uint8Array, schema: z.ZodType<T>): T {\n const text = new TextDecoder().decode(body);\n // 204 responses return an empty body; treat as `{}`.\n const parsed: unknown = text === '' ? {} : jsonBigint.parse(text);\n return schema.parse(parsed);\n}\n\nexport function marshalRequest(data: unknown, schema: z.ZodType): string {\n return jsonBigint.stringify(schema.parse(data));\n}\n\nexport function flattenQueryParams(\n prefix: string,\n value: unknown,\n params: URLSearchParams\n): void {\n if (value === null || value === undefined) {\n return;\n }\n if (Array.isArray(value)) {\n // arrays of objects are not yet supported\n for (const item of value) {\n params.append(prefix, String(item));\n }\n } else if (typeof value === 'object') {\n for (const [key, val] of Object.entries(value as Record<string, unknown>)) {\n flattenQueryParams(`${prefix}.${key}`, val, params);\n }\n } else if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n typeof value === 'bigint'\n ) {\n params.append(prefix, String(value));\n } else {\n throw new Error(`Unsupported query parameter type: ${typeof value}`);\n }\n}\n"],"mappings":";;;;;AAkBA,MAAM,aAAa,QAAQ,EAAC,iBAAiB,MAAK,CAAC;;;;;;AAanD,eAAsB,YACpB,MACA,SACe;CACf,MAAM,OAAgB;EACpB,GAAI,SAAS,YAAY,UAAa,EAAC,SAAS,QAAQ,SAAQ;EAChE,GAAI,SAAS,gBAAgB,UAAa,EACxC,aAAa,QAAQ,aACtB;EACD,GAAI,SAAS,YAAY,UAAa,EAAC,SAAS,QAAQ,SAAQ;EACjE;AACD,QAAO,QAAQ,SAAS,QAAQ,MAAM,KAAK;;AAG7C,eAAe,QACb,MACqB;AACrB,KAAI,SAAS,KACX,QAAO,IAAI,WAAW,EAAE;CAE1B,MAAM,SAAS,KAAK,WAAW;CAC/B,MAAM,SAAuB,EAAE;AAC/B,UAAS;EACP,MAAM,EAAC,MAAM,UAAS,MAAM,OAAO,MAAM;AACzC,MAAI,KACF;AAEF,SAAO,KAAK,MAAM;;CAEpB,MAAM,cAAc,OAAO,QAAQ,KAAK,UAAU,MAAM,MAAM,QAAQ,EAAE;CACxE,MAAM,SAAS,IAAI,WAAW,YAAY;CAC1C,IAAI,SAAS;AACb,MAAK,MAAM,SAAS,QAAQ;AAC1B,SAAO,IAAI,OAAO,OAAO;AACzB,YAAU,MAAM;;AAElB,QAAO;;AAGT,eAAsB,gBACpB,MACqB;AACrB,MAAK,OAAO,MAAM,gBAAgB;EAChC,QAAQ,KAAK,QAAQ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EjB,QAAO,OAAO,QAAQ,OAAO,MAAM,CAAC;KAEpC,OAAM,IAAI,MAAM,qCAAqC,OAAO,QAAQ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@databricks/sdk-uc-secrets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"LICENSE"
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build": "
|
|
18
|
+
"build": "tsdown",
|
|
19
19
|
"lint": "eslint src --ext .ts",
|
|
20
20
|
"lint:fix": "eslint src --ext .ts --fix",
|
|
21
21
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"directory": "packages/uc/secrets"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@databricks/sdk-auth": ">=0.
|
|
37
|
-
"@databricks/sdk-core": ">=0.
|
|
38
|
-
"@databricks/sdk-options": ">=0.
|
|
36
|
+
"@databricks/sdk-auth": ">=0.35.0 <1.0.0",
|
|
37
|
+
"@databricks/sdk-core": ">=0.35.0 <1.0.0",
|
|
38
|
+
"@databricks/sdk-options": ">=0.35.0 <1.0.0",
|
|
39
39
|
"@js-temporal/polyfill": "^0.5.0",
|
|
40
40
|
"json-bigint": "^1.0.0",
|
|
41
41
|
"zod": "^4.3.6"
|
package/dist/v1/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,MAAM,EACN,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC"}
|
package/dist/v1/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E;;GAEG;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAYvC,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC"}
|