@databricks/sdk-tokens 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 +34 -30
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +126 -151
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/index.d.ts +3 -8
- package/dist/v1/index.js +4 -8
- package/dist/v1/model.d.ts +78 -77
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +94 -124
- 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.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","
|
|
1
|
+
{"version":3,"file":"model.d.ts","names":[],"sources":["../../src/v1/model.ts"],"mappings":";;;;;;AAaA;;;;cAAa,cAAA;EAAA;;;;;;;;KASD,cAAA,WACA,cAAA,eAA6B,cAAA;AAAA,UAGxB,kBAAA;;;;AAAjB;;EAME,eAAA;EANiC;EAQjC,OAAA;EAAA;EAEA,MAAA;EAKA;;;AAGF;EAHE,gBAAA;AAAA;AAAA,UAGe,mBAAA;EAEf;EAAA,UAAA;EAEY;EAAZ,SAAA,GAAY,eAAA;AAAA;AAAA,UAIG,iBAAA;AAAA,UAEA,kBAAA;EAFiB;EAIhC,UAAA,GAAa,eAAA;AAAA;AAAA,UAGE,eAAA;;EAEf,OAAA;EAL4B;EAO5B,YAAA;EAJ8B;EAM9B,UAA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
-
|
|
18
|
-
AUTOSCOPE_STATE_API_NOT_COVERED: 'AUTOSCOPE_STATE_API_NOT_COVERED',
|
|
6
|
+
* State of inferred scope collection (autoscope) for an external PAT.
|
|
7
|
+
* Mirrored in databricks.identity.AutoscopeState in common/principal-context/api/proto/tokendetails.proto.
|
|
8
|
+
* Token store and token management proto can depend on this.
|
|
9
|
+
* Principal context proto should NOT depend on this proto definitions because too many services depend on the principal context proto.
|
|
10
|
+
*/
|
|
11
|
+
const AutoscopeState = {
|
|
12
|
+
AUTOSCOPE_STATE_UNSPECIFIED: "AUTOSCOPE_STATE_UNSPECIFIED",
|
|
13
|
+
AUTOSCOPE_STATE_DISABLED: "AUTOSCOPE_STATE_DISABLED",
|
|
14
|
+
AUTOSCOPE_STATE_RUNNING: "AUTOSCOPE_STATE_RUNNING",
|
|
15
|
+
AUTOSCOPE_STATE_COMPLETED: "AUTOSCOPE_STATE_COMPLETED",
|
|
16
|
+
AUTOSCOPE_STATE_BACKFILLED: "AUTOSCOPE_STATE_BACKFILLED",
|
|
17
|
+
AUTOSCOPE_STATE_USER_SELECTED: "AUTOSCOPE_STATE_USER_SELECTED",
|
|
18
|
+
AUTOSCOPE_STATE_API_NOT_COVERED: "AUTOSCOPE_STATE_API_NOT_COVERED"
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
tokenValue: d.token_value,
|
|
27
|
-
tokenInfo: d.token_info,
|
|
20
|
+
const unmarshalCreateTokenResponseSchema = z.object({
|
|
21
|
+
token_value: z.string().optional(),
|
|
22
|
+
token_info: z.lazy(() => unmarshalPublicTokenInfoSchema).optional()
|
|
23
|
+
}).transform((d) => ({
|
|
24
|
+
tokenValue: d.token_value,
|
|
25
|
+
tokenInfo: d.token_info
|
|
28
26
|
}));
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
const unmarshalListTokensResponseSchema = z.object({ token_infos: z.array(z.lazy(() => unmarshalPublicTokenInfoSchema)).optional() }).transform((d) => ({ tokenInfos: d.token_infos }));
|
|
28
|
+
const unmarshalPublicTokenInfoSchema = z.object({
|
|
29
|
+
token_id: z.string().optional(),
|
|
30
|
+
creation_time: z.union([z.number(), z.bigint()]).transform((v) => BigInt(v)).optional(),
|
|
31
|
+
expiry_time: z.union([z.number(), z.bigint()]).transform((v) => BigInt(v)).optional(),
|
|
32
|
+
comment: z.string().optional(),
|
|
33
|
+
scopes: z.array(z.string()).optional(),
|
|
34
|
+
autoscope_state: z.string().optional(),
|
|
35
|
+
inferred_scopes: z.array(z.string()).optional(),
|
|
36
|
+
backfill_scopes: z.array(z.string()).optional()
|
|
37
|
+
}).transform((d) => ({
|
|
38
|
+
tokenId: d.token_id,
|
|
39
|
+
creationTime: d.creation_time,
|
|
40
|
+
expiryTime: d.expiry_time,
|
|
41
|
+
comment: d.comment,
|
|
42
|
+
scopes: d.scopes,
|
|
43
|
+
autoscopeState: d.autoscope_state,
|
|
44
|
+
inferredScopes: d.inferred_scopes,
|
|
45
|
+
backfillScopes: d.backfill_scopes
|
|
37
46
|
}));
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
scopes: z.array(z.string()).optional(),
|
|
51
|
-
autoscope_state: z.string().optional(),
|
|
52
|
-
inferred_scopes: z.array(z.string()).optional(),
|
|
53
|
-
backfill_scopes: z.array(z.string()).optional(),
|
|
54
|
-
})
|
|
55
|
-
.transform(d => ({
|
|
56
|
-
tokenId: d.token_id,
|
|
57
|
-
creationTime: d.creation_time,
|
|
58
|
-
expiryTime: d.expiry_time,
|
|
59
|
-
comment: d.comment,
|
|
60
|
-
scopes: d.scopes,
|
|
61
|
-
autoscopeState: d.autoscope_state,
|
|
62
|
-
inferredScopes: d.inferred_scopes,
|
|
63
|
-
backfillScopes: d.backfill_scopes,
|
|
47
|
+
const unmarshalRevokeTokenResponseSchema = z.object({});
|
|
48
|
+
const unmarshalUpdateTokenResponseSchema = z.object({});
|
|
49
|
+
const marshalCreateTokenRequestSchema = z.object({
|
|
50
|
+
lifetimeSeconds: z.bigint().optional(),
|
|
51
|
+
comment: z.string().optional(),
|
|
52
|
+
scopes: z.array(z.string()).optional(),
|
|
53
|
+
autoscopeEnabled: z.boolean().optional()
|
|
54
|
+
}).transform((d) => ({
|
|
55
|
+
lifetime_seconds: d.lifetimeSeconds,
|
|
56
|
+
comment: d.comment,
|
|
57
|
+
scopes: d.scopes,
|
|
58
|
+
autoscope_enabled: d.autoscopeEnabled
|
|
64
59
|
}));
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
60
|
+
const marshalPublicTokenInfoSchema = z.object({
|
|
61
|
+
tokenId: z.string().optional(),
|
|
62
|
+
creationTime: z.bigint().optional(),
|
|
63
|
+
expiryTime: z.bigint().optional(),
|
|
64
|
+
comment: z.string().optional(),
|
|
65
|
+
scopes: z.array(z.string()).optional(),
|
|
66
|
+
autoscopeState: z.string().optional(),
|
|
67
|
+
inferredScopes: z.array(z.string()).optional(),
|
|
68
|
+
backfillScopes: z.array(z.string()).optional()
|
|
69
|
+
}).transform((d) => ({
|
|
70
|
+
token_id: d.tokenId,
|
|
71
|
+
creation_time: d.creationTime,
|
|
72
|
+
expiry_time: d.expiryTime,
|
|
73
|
+
comment: d.comment,
|
|
74
|
+
scopes: d.scopes,
|
|
75
|
+
autoscope_state: d.autoscopeState,
|
|
76
|
+
inferred_scopes: d.inferredScopes,
|
|
77
|
+
backfill_scopes: d.backfillScopes
|
|
79
78
|
}));
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
backfillScopes: z.array(z.string()).optional(),
|
|
90
|
-
})
|
|
91
|
-
.transform(d => ({
|
|
92
|
-
token_id: d.tokenId,
|
|
93
|
-
creation_time: d.creationTime,
|
|
94
|
-
expiry_time: d.expiryTime,
|
|
95
|
-
comment: d.comment,
|
|
96
|
-
scopes: d.scopes,
|
|
97
|
-
autoscope_state: d.autoscopeState,
|
|
98
|
-
inferred_scopes: d.inferredScopes,
|
|
99
|
-
backfill_scopes: d.backfillScopes,
|
|
100
|
-
}));
|
|
101
|
-
export const marshalRevokeTokenRequestSchema = z
|
|
102
|
-
.object({
|
|
103
|
-
tokenId: z.string().optional(),
|
|
104
|
-
})
|
|
105
|
-
.transform(d => ({
|
|
106
|
-
token_id: d.tokenId,
|
|
107
|
-
}));
|
|
108
|
-
export const marshalUpdateTokenRequestSchema = z
|
|
109
|
-
.object({
|
|
110
|
-
tokenId: z.string().optional(),
|
|
111
|
-
token: z.lazy(() => marshalPublicTokenInfoSchema).optional(),
|
|
112
|
-
updateMask: z
|
|
113
|
-
.any()
|
|
114
|
-
.transform((m) => m.toString())
|
|
115
|
-
.optional(),
|
|
116
|
-
})
|
|
117
|
-
.transform(d => ({
|
|
118
|
-
token_id: d.tokenId,
|
|
119
|
-
token: d.token,
|
|
120
|
-
update_mask: d.updateMask,
|
|
79
|
+
const marshalRevokeTokenRequestSchema = z.object({ tokenId: z.string().optional() }).transform((d) => ({ token_id: d.tokenId }));
|
|
80
|
+
const marshalUpdateTokenRequestSchema = z.object({
|
|
81
|
+
tokenId: z.string().optional(),
|
|
82
|
+
token: z.lazy(() => marshalPublicTokenInfoSchema).optional(),
|
|
83
|
+
updateMask: z.any().transform((m) => m.toString()).optional()
|
|
84
|
+
}).transform((d) => ({
|
|
85
|
+
token_id: d.tokenId,
|
|
86
|
+
token: d.token,
|
|
87
|
+
update_mask: d.updateMask
|
|
121
88
|
}));
|
|
122
89
|
const publicTokenInfoFieldMaskSchema = {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
90
|
+
autoscopeState: { wire: "autoscope_state" },
|
|
91
|
+
backfillScopes: { wire: "backfill_scopes" },
|
|
92
|
+
comment: { wire: "comment" },
|
|
93
|
+
creationTime: { wire: "creation_time" },
|
|
94
|
+
expiryTime: { wire: "expiry_time" },
|
|
95
|
+
inferredScopes: { wire: "inferred_scopes" },
|
|
96
|
+
scopes: { wire: "scopes" },
|
|
97
|
+
tokenId: { wire: "token_id" }
|
|
131
98
|
};
|
|
132
|
-
|
|
133
|
-
|
|
99
|
+
function publicTokenInfoFieldMask(...paths) {
|
|
100
|
+
return FieldMask.build(paths, publicTokenInfoFieldMaskSchema);
|
|
134
101
|
}
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
export { AutoscopeState, marshalCreateTokenRequestSchema, marshalPublicTokenInfoSchema, marshalRevokeTokenRequestSchema, marshalUpdateTokenRequestSchema, publicTokenInfoFieldMask, unmarshalCreateTokenResponseSchema, unmarshalListTokensResponseSchema, unmarshalPublicTokenInfoSchema, unmarshalRevokeTokenResponseSchema, unmarshalUpdateTokenResponseSchema };
|
|
135
105
|
//# sourceMappingURL=model.js.map
|
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,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB;;;;;GAKG;AACH,4FAA4F;AAC5F,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,2BAA2B,EAAE,6BAA6B;IA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eAAe,EAAC;IACrC,UAAU,EAAE,EAAC,IAAI,EAAE,aAAa,EAAC;IACjC,cAAc,EAAE,EAAC,IAAI,EAAE,iBAAiB,EAAC;IACzC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;IACxB,OAAO,EAAE,EAAC,IAAI,EAAE,UAAU,EAAC;CAC5B,CAAC;AAEF,MAAM,UAAU,wBAAwB,CACtC,GAAG,KAAe;IAElB,OAAO,SAAS,CAAC,KAAK,CACpB,KAAK,EACL,8BAA8B,CAC/B,CAAC;AACJ,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 {FieldMask} from '@databricks/sdk-core/wkt';\nimport type {FieldMaskSchema} from '@databricks/sdk-core/wkt';\nimport {z} from 'zod';\n\n/**\n * State of inferred scope collection (autoscope) for an external PAT.\n * Mirrored in databricks.identity.AutoscopeState in common/principal-context/api/proto/tokendetails.proto.\n * Token store and token management proto can depend on this.\n * Principal context proto should NOT depend on this proto definitions because too many services depend on the principal context proto.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.\nexport const AutoscopeState = {\n AUTOSCOPE_STATE_UNSPECIFIED: 'AUTOSCOPE_STATE_UNSPECIFIED',\n AUTOSCOPE_STATE_DISABLED: 'AUTOSCOPE_STATE_DISABLED',\n AUTOSCOPE_STATE_RUNNING: 'AUTOSCOPE_STATE_RUNNING',\n AUTOSCOPE_STATE_COMPLETED: 'AUTOSCOPE_STATE_COMPLETED',\n AUTOSCOPE_STATE_BACKFILLED: 'AUTOSCOPE_STATE_BACKFILLED',\n AUTOSCOPE_STATE_USER_SELECTED: 'AUTOSCOPE_STATE_USER_SELECTED',\n AUTOSCOPE_STATE_API_NOT_COVERED: 'AUTOSCOPE_STATE_API_NOT_COVERED',\n} as const;\nexport type AutoscopeState =\n | (typeof AutoscopeState)[keyof typeof AutoscopeState]\n | (string & {});\n\nexport interface CreateTokenRequest {\n /**\n * The lifetime of the token, in seconds.\n *\n * If the lifetime is not specified, this token remains valid for 2 years.\n */\n lifetimeSeconds?: bigint | undefined;\n /** Optional description to attach to the token. */\n comment?: string | undefined;\n /** Optional scopes of the token. */\n scopes?: string[] | undefined;\n /**\n * Whether to enable autoscoping for this token. When true, the token will\n * automatically collect inferred API path scopes as it is used.\n */\n autoscopeEnabled?: boolean | undefined;\n}\n\nexport interface CreateTokenResponse {\n /** The value of the new token. */\n tokenValue?: string | undefined;\n /** The information for the new token. */\n tokenInfo?: PublicTokenInfo | undefined;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface ListTokensRequest {}\n\nexport interface ListTokensResponse {\n /** The information for each token. */\n tokenInfos?: PublicTokenInfo[] | undefined;\n}\n\nexport interface PublicTokenInfo {\n /** The ID of this token. */\n tokenId?: string | undefined;\n /** Server time (in epoch milliseconds) when the token was created. */\n creationTime?: bigint | undefined;\n /** Server time (in epoch milliseconds) when the token will expire, or -1 if not applicable. */\n expiryTime?: bigint | undefined;\n /** Comment the token was created with, if applicable. */\n comment?: string | undefined;\n /** Scope of the token was created with, if applicable. */\n scopes?: string[] | undefined;\n /** Output only. The autoscope state of this token. */\n autoscopeState?: AutoscopeState | undefined;\n /** Output only. Inferred API path scopes collected for this token when autoscope is enabled. */\n inferredScopes?: string[] | undefined;\n /** Output only. Scopes inferred from offline backfill processing. */\n backfillScopes?: string[] | undefined;\n}\n\nexport interface RevokeTokenRequest {\n /** The ID of the token to be revoked. */\n tokenId?: string | undefined;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface RevokeTokenResponse {}\n\n/**\n * For the list of supported token scopes, see\n * https://docs.databricks.com/api/workspace/api/scopes.\n */\nexport interface UpdateTokenRequest {\n /** The SHA-256 hash of the token to be updated. */\n tokenId?: string | undefined;\n token?: PublicTokenInfo | undefined;\n /** A list of field name under token, For example, {\"update_mask\": \"comment,scopes\"} */\n updateMask?: FieldMask<PublicTokenInfo> | undefined;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface UpdateTokenResponse {}\n\nexport const unmarshalCreateTokenResponseSchema: z.ZodType<CreateTokenResponse> =\n z\n .object({\n token_value: z.string().optional(),\n token_info: z.lazy(() => unmarshalPublicTokenInfoSchema).optional(),\n })\n .transform(d => ({\n tokenValue: d.token_value,\n tokenInfo: d.token_info,\n }));\n\nexport const unmarshalListTokensResponseSchema: z.ZodType<ListTokensResponse> =\n z\n .object({\n token_infos: z\n .array(z.lazy(() => unmarshalPublicTokenInfoSchema))\n .optional(),\n })\n .transform(d => ({\n tokenInfos: d.token_infos,\n }));\n\nexport const unmarshalPublicTokenInfoSchema: z.ZodType<PublicTokenInfo> = z\n .object({\n token_id: z.string().optional(),\n creation_time: z\n .union([z.number(), z.bigint()])\n .transform(v => BigInt(v))\n .optional(),\n expiry_time: z\n .union([z.number(), z.bigint()])\n .transform(v => BigInt(v))\n .optional(),\n comment: z.string().optional(),\n scopes: z.array(z.string()).optional(),\n autoscope_state: z.string().optional(),\n inferred_scopes: z.array(z.string()).optional(),\n backfill_scopes: z.array(z.string()).optional(),\n })\n .transform(d => ({\n tokenId: d.token_id,\n creationTime: d.creation_time,\n expiryTime: d.expiry_time,\n comment: d.comment,\n scopes: d.scopes,\n autoscopeState: d.autoscope_state,\n inferredScopes: d.inferred_scopes,\n backfillScopes: d.backfill_scopes,\n }));\n\nexport const unmarshalRevokeTokenResponseSchema: z.ZodType<RevokeTokenResponse> =\n z.object({});\n\nexport const unmarshalUpdateTokenResponseSchema: z.ZodType<UpdateTokenResponse> =\n z.object({});\n\nexport const marshalCreateTokenRequestSchema: z.ZodType = z\n .object({\n lifetimeSeconds: z.bigint().optional(),\n comment: z.string().optional(),\n scopes: z.array(z.string()).optional(),\n autoscopeEnabled: z.boolean().optional(),\n })\n .transform(d => ({\n lifetime_seconds: d.lifetimeSeconds,\n comment: d.comment,\n scopes: d.scopes,\n autoscope_enabled: d.autoscopeEnabled,\n }));\n\nexport const marshalPublicTokenInfoSchema: z.ZodType = z\n .object({\n tokenId: z.string().optional(),\n creationTime: z.bigint().optional(),\n expiryTime: z.bigint().optional(),\n comment: z.string().optional(),\n scopes: z.array(z.string()).optional(),\n autoscopeState: z.string().optional(),\n inferredScopes: z.array(z.string()).optional(),\n backfillScopes: z.array(z.string()).optional(),\n })\n .transform(d => ({\n token_id: d.tokenId,\n creation_time: d.creationTime,\n expiry_time: d.expiryTime,\n comment: d.comment,\n scopes: d.scopes,\n autoscope_state: d.autoscopeState,\n inferred_scopes: d.inferredScopes,\n backfill_scopes: d.backfillScopes,\n }));\n\nexport const marshalRevokeTokenRequestSchema: z.ZodType = z\n .object({\n tokenId: z.string().optional(),\n })\n .transform(d => ({\n token_id: d.tokenId,\n }));\n\nexport const marshalUpdateTokenRequestSchema: z.ZodType = z\n .object({\n tokenId: z.string().optional(),\n token: z.lazy(() => marshalPublicTokenInfoSchema).optional(),\n updateMask: z\n .any()\n .transform((m: FieldMask) => m.toString())\n .optional(),\n })\n .transform(d => ({\n token_id: d.tokenId,\n token: d.token,\n update_mask: d.updateMask,\n }));\n\nconst publicTokenInfoFieldMaskSchema: FieldMaskSchema = {\n autoscopeState: {wire: 'autoscope_state'},\n backfillScopes: {wire: 'backfill_scopes'},\n comment: {wire: 'comment'},\n creationTime: {wire: 'creation_time'},\n expiryTime: {wire: 'expiry_time'},\n inferredScopes: {wire: 'inferred_scopes'},\n scopes: {wire: 'scopes'},\n tokenId: {wire: 'token_id'},\n};\n\nexport function publicTokenInfoFieldMask(\n ...paths: string[]\n): FieldMask<PublicTokenInfo> {\n return FieldMask.build<PublicTokenInfo>(\n paths,\n publicTokenInfoFieldMaskSchema\n );\n}\n"],"mappings":";;;;;;;;;;AAaA,MAAa,iBAAiB;CAC5B,6BAA6B;CAC7B,0BAA0B;CAC1B,yBAAyB;CACzB,2BAA2B;CAC3B,4BAA4B;CAC5B,+BAA+B;CAC/B,iCAA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Aa,EAAE;CAChB,EAAE;AAEL,MAAM,iCAAkD;CACtD,gBAAgB,EAAC,MAAM,mBAAkB;CACzC,gBAAgB,EAAC,MAAM,mBAAkB;CACzC,SAAS,EAAC,MAAM,WAAU;CAC1B,cAAc,EAAC,MAAM,iBAAgB;CACrC,YAAY,EAAC,MAAM,eAAc;CACjC,gBAAgB,EAAC,MAAM,mBAAkB;CACzC,QAAQ,EAAC,MAAM,UAAS;CACxB,SAAS,EAAC,MAAM,YAAW;CAC5B;AAED,SAAgB,yBACd,GAAG,OACyB;AAC5B,QAAO,UAAU,MACf,OACA,+BACD"}
|
package/dist/v1/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"}
|