@databricks/sdk-modelservingquery 0.33.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/v1/model.js CHANGED
@@ -1,171 +1,149 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
- import { z } from 'zod';
1
+ import { z } from "zod";
2
+
3
+ //#region src/v1/model.ts
3
4
  const jsonValueSchema = z.lazy(() => z.union([
4
- z.null(),
5
- z.number(),
6
- z.string(),
7
- z.boolean(),
8
- z.record(z.string(), jsonValueSchema),
9
- z.array(jsonValueSchema),
5
+ z.null(),
6
+ z.number(),
7
+ z.string(),
8
+ z.boolean(),
9
+ z.record(z.string(), jsonValueSchema),
10
+ z.array(jsonValueSchema)
10
11
  ]));
11
12
  /** The role of the message. One of [system, user, assistant]. */
12
- // eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.
13
- export const ChatMessageRole = {
14
- CHAT_MESSAGE_ROLE_UNSPECIFIED: 'CHAT_MESSAGE_ROLE_UNSPECIFIED',
15
- SYSTEM: 'system',
16
- USER: 'user',
17
- ASSISTANT: 'assistant',
13
+ const ChatMessageRole = {
14
+ CHAT_MESSAGE_ROLE_UNSPECIFIED: "CHAT_MESSAGE_ROLE_UNSPECIFIED",
15
+ SYSTEM: "system",
16
+ USER: "user",
17
+ ASSISTANT: "assistant"
18
18
  };
19
19
  /** This will always be 'embedding'. */
20
- // eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.
21
- export const EmbeddingsV1ResponseEmbeddingElementObject = {
22
- EMBEDDINGS_V1_RESPONSE_EMBEDDING_ELEMENT_OBJECT_UNSPECIFIED: 'EMBEDDINGS_V1_RESPONSE_EMBEDDING_ELEMENT_OBJECT_UNSPECIFIED',
23
- EMBEDDING: 'embedding',
20
+ const EmbeddingsV1ResponseEmbeddingElementObject = {
21
+ EMBEDDINGS_V1_RESPONSE_EMBEDDING_ELEMENT_OBJECT_UNSPECIFIED: "EMBEDDINGS_V1_RESPONSE_EMBEDDING_ELEMENT_OBJECT_UNSPECIFIED",
22
+ EMBEDDING: "embedding"
24
23
  };
25
24
  /**
26
- * The type of object returned by the __external/foundation model__ serving endpoint, one of
27
- * [text_completion, chat.completion, list (of embeddings)].
28
- */
29
- // eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.
30
- export const QueryEndpointResponseObject = {
31
- QUERY_ENDPOINT_RESPONSE_OBJECT_UNSPECIFIED: 'QUERY_ENDPOINT_RESPONSE_OBJECT_UNSPECIFIED',
32
- TEXT_COMPLETION: 'text_completion',
33
- CHAT_COMPLETION: 'chat.completion',
34
- LIST: 'list',
25
+ * The type of object returned by the __external/foundation model__ serving endpoint, one of
26
+ * [text_completion, chat.completion, list (of embeddings)].
27
+ */
28
+ const QueryEndpointResponseObject = {
29
+ QUERY_ENDPOINT_RESPONSE_OBJECT_UNSPECIFIED: "QUERY_ENDPOINT_RESPONSE_OBJECT_UNSPECIFIED",
30
+ TEXT_COMPLETION: "text_completion",
31
+ CHAT_COMPLETION: "chat.completion",
32
+ LIST: "list"
35
33
  };
36
- export const unmarshalChatMessageSchema = z
37
- .object({
38
- role: z.string().optional(),
39
- content: z.string().optional(),
40
- })
41
- .transform(d => ({
42
- role: d.role,
43
- content: d.content,
34
+ const unmarshalChatMessageSchema = z.object({
35
+ role: z.string().optional(),
36
+ content: z.string().optional()
37
+ }).transform((d) => ({
38
+ role: d.role,
39
+ content: d.content
44
40
  }));
45
- export const unmarshalEmbeddingsV1ResponseEmbeddingElementSchema = z
46
- .object({
47
- embedding: z.array(z.number()).optional(),
48
- index: z.number().optional(),
49
- object: z.string().optional(),
50
- })
51
- .transform(d => ({
52
- embedding: d.embedding,
53
- index: d.index,
54
- object: d.object,
41
+ const unmarshalEmbeddingsV1ResponseEmbeddingElementSchema = z.object({
42
+ embedding: z.array(z.number()).optional(),
43
+ index: z.number().optional(),
44
+ object: z.string().optional()
45
+ }).transform((d) => ({
46
+ embedding: d.embedding,
47
+ index: d.index,
48
+ object: d.object
55
49
  }));
56
- export const unmarshalExternalModelUsageElementSchema = z
57
- .object({
58
- prompt_tokens: z.number().optional(),
59
- completion_tokens: z.number().optional(),
60
- total_tokens: z.number().optional(),
61
- })
62
- .transform(d => ({
63
- promptTokens: d.prompt_tokens,
64
- completionTokens: d.completion_tokens,
65
- totalTokens: d.total_tokens,
50
+ const unmarshalExternalModelUsageElementSchema = z.object({
51
+ prompt_tokens: z.number().optional(),
52
+ completion_tokens: z.number().optional(),
53
+ total_tokens: z.number().optional()
54
+ }).transform((d) => ({
55
+ promptTokens: d.prompt_tokens,
56
+ completionTokens: d.completion_tokens,
57
+ totalTokens: d.total_tokens
66
58
  }));
67
- export const unmarshalQueryEndpointResponseSchema = z
68
- .object({
69
- choices: z
70
- .array(z.lazy(() => unmarshalV1ResponseChoiceElementSchema))
71
- .optional(),
72
- data: z
73
- .array(z.lazy(() => unmarshalEmbeddingsV1ResponseEmbeddingElementSchema))
74
- .optional(),
75
- model: z.string().optional(),
76
- usage: z.lazy(() => unmarshalExternalModelUsageElementSchema).optional(),
77
- id: z.string().optional(),
78
- created: z
79
- .union([z.number(), z.bigint()])
80
- .transform(v => BigInt(v))
81
- .optional(),
82
- object: z.string().optional(),
83
- predictions: z.array(jsonValueSchema).optional(),
84
- outputs: z.array(jsonValueSchema).optional(),
85
- 'served-model-name': z.string().optional(),
86
- })
87
- .transform(d => ({
88
- choices: d.choices,
89
- data: d.data,
90
- model: d.model,
91
- usage: d.usage,
92
- id: d.id,
93
- created: d.created,
94
- object: d.object,
95
- predictions: d.predictions,
96
- outputs: d.outputs,
97
- servedModelName: d['served-model-name'],
59
+ const unmarshalQueryEndpointResponseSchema = z.object({
60
+ choices: z.array(z.lazy(() => unmarshalV1ResponseChoiceElementSchema)).optional(),
61
+ data: z.array(z.lazy(() => unmarshalEmbeddingsV1ResponseEmbeddingElementSchema)).optional(),
62
+ model: z.string().optional(),
63
+ usage: z.lazy(() => unmarshalExternalModelUsageElementSchema).optional(),
64
+ id: z.string().optional(),
65
+ created: z.union([z.number(), z.bigint()]).transform((v) => BigInt(v)).optional(),
66
+ object: z.string().optional(),
67
+ predictions: z.array(jsonValueSchema).optional(),
68
+ outputs: z.array(jsonValueSchema).optional(),
69
+ "served-model-name": z.string().optional()
70
+ }).transform((d) => ({
71
+ choices: d.choices,
72
+ data: d.data,
73
+ model: d.model,
74
+ usage: d.usage,
75
+ id: d.id,
76
+ created: d.created,
77
+ object: d.object,
78
+ predictions: d.predictions,
79
+ outputs: d.outputs,
80
+ servedModelName: d["served-model-name"]
98
81
  }));
99
- export const unmarshalV1ResponseChoiceElementSchema = z
100
- .object({
101
- text: z.string().optional(),
102
- message: z.lazy(() => unmarshalChatMessageSchema).optional(),
103
- index: z.number().optional(),
104
- finishReason: z.string().optional(),
105
- logprobs: z.number().optional(),
106
- })
107
- .transform(d => ({
108
- text: d.text,
109
- message: d.message,
110
- index: d.index,
111
- finishReason: d.finishReason,
112
- logprobs: d.logprobs,
82
+ const unmarshalV1ResponseChoiceElementSchema = z.object({
83
+ text: z.string().optional(),
84
+ message: z.lazy(() => unmarshalChatMessageSchema).optional(),
85
+ index: z.number().optional(),
86
+ finishReason: z.string().optional(),
87
+ logprobs: z.number().optional()
88
+ }).transform((d) => ({
89
+ text: d.text,
90
+ message: d.message,
91
+ index: d.index,
92
+ finishReason: d.finishReason,
93
+ logprobs: d.logprobs
113
94
  }));
114
- export const marshalChatMessageSchema = z
115
- .object({
116
- role: z.string().optional(),
117
- content: z.string().optional(),
118
- })
119
- .transform(d => ({
120
- role: d.role,
121
- content: d.content,
95
+ const marshalChatMessageSchema = z.object({
96
+ role: z.string().optional(),
97
+ content: z.string().optional()
98
+ }).transform((d) => ({
99
+ role: d.role,
100
+ content: d.content
122
101
  }));
123
- export const marshalDataframeSplitInputSchema = z
124
- .object({
125
- index: z.array(z.number()).optional(),
126
- columns: z.array(jsonValueSchema).optional(),
127
- data: z.array(jsonValueSchema).optional(),
128
- })
129
- .transform(d => ({
130
- index: d.index,
131
- columns: d.columns,
132
- data: d.data,
102
+ const marshalDataframeSplitInputSchema = z.object({
103
+ index: z.array(z.number()).optional(),
104
+ columns: z.array(jsonValueSchema).optional(),
105
+ data: z.array(jsonValueSchema).optional()
106
+ }).transform((d) => ({
107
+ index: d.index,
108
+ columns: d.columns,
109
+ data: d.data
133
110
  }));
134
- export const marshalQueryEndpointRequestSchema = z
135
- .object({
136
- name: z.string().optional(),
137
- prompt: jsonValueSchema.optional(),
138
- input: jsonValueSchema.optional(),
139
- messages: z.array(z.lazy(() => marshalChatMessageSchema)).optional(),
140
- temperature: z.number().optional(),
141
- stop: z.array(z.string()).optional(),
142
- maxTokens: z.number().optional(),
143
- n: z.number().optional(),
144
- stream: z.boolean().optional(),
145
- extraParams: z.record(z.string(), z.string()).optional(),
146
- dataframeRecords: z.array(jsonValueSchema).optional(),
147
- dataframeSplit: z.lazy(() => marshalDataframeSplitInputSchema).optional(),
148
- instances: z.array(jsonValueSchema).optional(),
149
- inputs: jsonValueSchema.optional(),
150
- clientRequestId: z.string().optional(),
151
- usageContext: z.record(z.string(), z.string()).optional(),
152
- })
153
- .transform(d => ({
154
- name: d.name,
155
- prompt: d.prompt,
156
- input: d.input,
157
- messages: d.messages,
158
- temperature: d.temperature,
159
- stop: d.stop,
160
- max_tokens: d.maxTokens,
161
- n: d.n,
162
- stream: d.stream,
163
- extra_params: d.extraParams,
164
- dataframe_records: d.dataframeRecords,
165
- dataframe_split: d.dataframeSplit,
166
- instances: d.instances,
167
- inputs: d.inputs,
168
- client_request_id: d.clientRequestId,
169
- usage_context: d.usageContext,
111
+ const marshalQueryEndpointRequestSchema = z.object({
112
+ name: z.string().optional(),
113
+ prompt: jsonValueSchema.optional(),
114
+ input: jsonValueSchema.optional(),
115
+ messages: z.array(z.lazy(() => marshalChatMessageSchema)).optional(),
116
+ temperature: z.number().optional(),
117
+ stop: z.array(z.string()).optional(),
118
+ maxTokens: z.number().optional(),
119
+ n: z.number().optional(),
120
+ stream: z.boolean().optional(),
121
+ extraParams: z.record(z.string(), z.string()).optional(),
122
+ dataframeRecords: z.array(jsonValueSchema).optional(),
123
+ dataframeSplit: z.lazy(() => marshalDataframeSplitInputSchema).optional(),
124
+ instances: z.array(jsonValueSchema).optional(),
125
+ inputs: jsonValueSchema.optional(),
126
+ clientRequestId: z.string().optional(),
127
+ usageContext: z.record(z.string(), z.string()).optional()
128
+ }).transform((d) => ({
129
+ name: d.name,
130
+ prompt: d.prompt,
131
+ input: d.input,
132
+ messages: d.messages,
133
+ temperature: d.temperature,
134
+ stop: d.stop,
135
+ max_tokens: d.maxTokens,
136
+ n: d.n,
137
+ stream: d.stream,
138
+ extra_params: d.extraParams,
139
+ dataframe_records: d.dataframeRecords,
140
+ dataframe_split: d.dataframeSplit,
141
+ instances: d.instances,
142
+ inputs: d.inputs,
143
+ client_request_id: d.clientRequestId,
144
+ usage_context: d.usageContext
170
145
  }));
146
+
147
+ //#endregion
148
+ export { ChatMessageRole, EmbeddingsV1ResponseEmbeddingElementObject, QueryEndpointResponseObject, marshalChatMessageSchema, marshalDataframeSplitInputSchema, marshalQueryEndpointRequestSchema, unmarshalChatMessageSchema, unmarshalEmbeddingsV1ResponseEmbeddingElementSchema, unmarshalExternalModelUsageElementSchema, unmarshalQueryEndpointResponseSchema, unmarshalV1ResponseChoiceElementSchema };
171
149
  //# sourceMappingURL=model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/v1/model.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAG/E,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,MAAM,eAAe,GAAyB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACxD,CAAC,CAAC,KAAK,CAAC;IACN,CAAC,CAAC,IAAI,EAAE;IACR,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,OAAO,EAAE;IACX,CAA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,IAAI,EAAE,CAAC,CAAC,IAAI;IACZ,MAAM,EAAE,CAAC,CAAC,MAAM;IAChB,KAAK,EAAE,CAAC,CAAC,KAAK;IACd,QAAQ,EAAE,CAAC,CAAC,QAAQ;IACpB,WAAW,EAAE,CAAC,CAAC,WAAW;IAC1B,IAAI,EAAE,CAAC,CAAC,IAAI;IACZ,UAAU,EAAE,CAAC,CAAC,SAAS;IACvB,CAAC,EAAE,CAAC,CAAC,CAAC;IACN,MAAM,EAAE,CAAC,CAAC,MAAM;IAChB,YAAY,EAAE,CAAC,CAAC,WAAW;IAC3B,iBAAiB,EAAE,CAAC,CAAC,gBAAgB;IACrC,eAAe,EAAE,CAAC,CAAC,cAAc;IACjC,SAAS,EAAE,CAAC,CAAC,SAAS;IACtB,MAAM,EAAE,CAAC,CAAC,MAAM;IAChB,iBAAiB,EAAE,CAAC,CAAC,eAAe;IACpC,aAAa,EAAE,CAAC,CAAC,YAAY;CAC9B,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"model.js","names":[],"sources":["../../src/v1/model.ts"],"sourcesContent":["// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.\n\nimport type {JsonValue} from '@databricks/sdk-core/wkt';\nimport {z} from 'zod';\n\nconst jsonValueSchema: z.ZodType<JsonValue> = z.lazy(() =>\n z.union([\n z.null(),\n z.number(),\n z.string(),\n z.boolean(),\n z.record(z.string(), jsonValueSchema),\n z.array(jsonValueSchema),\n ])\n);\n\n/** The role of the message. One of [system, user, assistant]. */\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.\nexport const ChatMessageRole = {\n CHAT_MESSAGE_ROLE_UNSPECIFIED: 'CHAT_MESSAGE_ROLE_UNSPECIFIED',\n SYSTEM: 'system',\n USER: 'user',\n ASSISTANT: 'assistant',\n} as const;\nexport type ChatMessageRole =\n | (typeof ChatMessageRole)[keyof typeof ChatMessageRole]\n | (string & {});\n\n/** This will always be 'embedding'. */\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.\nexport const EmbeddingsV1ResponseEmbeddingElementObject = {\n EMBEDDINGS_V1_RESPONSE_EMBEDDING_ELEMENT_OBJECT_UNSPECIFIED:\n 'EMBEDDINGS_V1_RESPONSE_EMBEDDING_ELEMENT_OBJECT_UNSPECIFIED',\n EMBEDDING: 'embedding',\n} as const;\nexport type EmbeddingsV1ResponseEmbeddingElementObject =\n | (typeof EmbeddingsV1ResponseEmbeddingElementObject)[keyof typeof EmbeddingsV1ResponseEmbeddingElementObject]\n | (string & {});\n\n/**\n * The type of object returned by the __external/foundation model__ serving endpoint, one of\n * [text_completion, chat.completion, list (of embeddings)].\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.\nexport const QueryEndpointResponseObject = {\n QUERY_ENDPOINT_RESPONSE_OBJECT_UNSPECIFIED:\n 'QUERY_ENDPOINT_RESPONSE_OBJECT_UNSPECIFIED',\n TEXT_COMPLETION: 'text_completion',\n CHAT_COMPLETION: 'chat.completion',\n LIST: 'list',\n} as const;\nexport type QueryEndpointResponseObject =\n | (typeof QueryEndpointResponseObject)[keyof typeof QueryEndpointResponseObject]\n | (string & {});\n\nexport interface ChatMessage {\n /** The role of the message. One of [system, user, assistant]. */\n role?: ChatMessageRole | undefined;\n /** The content of the message. */\n content?: string | undefined;\n}\n\nexport interface DataframeSplitInput {\n /** Index array for the dataframe */\n index?: number[] | undefined;\n /** Columns array for the dataframe */\n columns?: JsonValue[] | undefined;\n /** Data array for the dataframe */\n data?: JsonValue[] | undefined;\n}\n\nexport interface EmbeddingsV1ResponseEmbeddingElement {\n /** The embedding vector */\n embedding?: number[] | undefined;\n /** The index of the embedding in the response. */\n index?: number | undefined;\n /** This will always be 'embedding'. */\n object?: EmbeddingsV1ResponseEmbeddingElementObject | undefined;\n}\n\nexport interface ExternalModelUsageElement {\n /** The number of tokens in the prompt. */\n promptTokens?: number | undefined;\n /** The number of tokens in the chat/completions response. */\n completionTokens?: number | undefined;\n /** The total number of tokens in the prompt and response. */\n totalTokens?: number | undefined;\n}\n\nexport interface QueryEndpointRequest {\n /** The name of the serving endpoint. This field is required and is provided via the path parameter. */\n name?: string | undefined;\n /**\n * The prompt string (or array of strings) field used ONLY for __completions external & foundation model__\n * serving endpoints and should only be used with other completions query fields.\n */\n prompt?: JsonValue | undefined;\n /**\n * The input string (or array of strings) field used ONLY for __embeddings external & foundation model__\n * serving endpoints and is the only field (along with extra_params if needed) used by embeddings queries.\n */\n input?: JsonValue | undefined;\n /**\n * The messages field used ONLY for __chat external & foundation model__ serving endpoints.\n * This is an array of ChatMessage objects and should only be used with other chat query fields.\n */\n messages?: ChatMessage[] | undefined;\n /**\n * The temperature field used ONLY for __completions__ and __chat external & foundation model__ serving\n * endpoints. This is a float between 0.0 and 2.0 with a default of 1.0 and should only be used with other\n * chat/completions query fields.\n */\n temperature?: number | undefined;\n /**\n * The stop sequences field used ONLY for __completions__ and __chat external & foundation model__ serving\n * endpoints. This is a list of strings and should only be used with other chat/completions query fields.\n */\n stop?: string[] | undefined;\n /**\n * The max tokens field used ONLY for __completions__ and __chat external & foundation model__ serving\n * endpoints. This is an integer and should only be used with other chat/completions query fields.\n */\n maxTokens?: number | undefined;\n /**\n * The n (number of candidates) field used ONLY for __completions__ and __chat external & foundation model__\n * serving endpoints. This is an integer between 1 and 5 with a default of 1 and should only be used with\n * other chat/completions query fields.\n */\n n?: number | undefined;\n /**\n * The stream field used ONLY for __completions__ and __chat external & foundation model__ serving endpoints.\n * This is a boolean defaulting to false and should only be used with other chat/completions query fields.\n */\n stream?: boolean | undefined;\n /**\n * The extra parameters field used ONLY for __completions, chat,__ and __embeddings external & foundation\n * model__ serving endpoints. This is a map of strings and should only be used with other external/foundation\n * model query fields.\n */\n extraParams?: Record<string, string> | undefined;\n /** Pandas Dataframe input in the records orientation. */\n dataframeRecords?: JsonValue[] | undefined;\n /** Pandas Dataframe input in the split orientation. */\n dataframeSplit?: DataframeSplitInput | undefined;\n /** Tensor-based input in row format. */\n instances?: JsonValue[] | undefined;\n /** Tensor-based input in columnar format. */\n inputs?: JsonValue | undefined;\n /** Optional user-provided request identifier that will be recorded in the inference table and the usage tracking table. */\n clientRequestId?: string | undefined;\n /** Optional user-provided context that will be recorded in the usage tracking table. */\n usageContext?: Record<string, string> | undefined;\n}\n\nexport interface QueryEndpointResponse {\n /** The list of choices returned by the __chat or completions external/foundation model__ serving endpoint. */\n choices?: V1ResponseChoiceElement[] | undefined;\n /** The list of the embeddings returned by the __embeddings external/foundation model__ serving endpoint. */\n data?: EmbeddingsV1ResponseEmbeddingElement[] | undefined;\n /**\n * The name of the __external/foundation model__ used for querying. This is the name of the model that was\n * specified in the endpoint config.\n */\n model?: string | undefined;\n /**\n * The usage object that may be returned by the __external/foundation model__ serving endpoint. This\n * contains information about the number of tokens used in the prompt and response.\n */\n usage?: ExternalModelUsageElement | undefined;\n /** The ID of the query that may be returned by a __completions or chat external/foundation model__ serving endpoint. */\n id?: string | undefined;\n /** The timestamp in seconds when the query was created in Unix time returned by a __completions or chat external/foundation model__ serving endpoint. */\n created?: bigint | undefined;\n /**\n * The type of object returned by the __external/foundation model__ serving endpoint, one of\n * [text_completion, chat.completion, list (of embeddings)].\n */\n object?: QueryEndpointResponseObject | undefined;\n /** The predictions returned by the serving endpoint. */\n predictions?: JsonValue[] | undefined;\n /** The outputs of the feature serving endpoint. */\n outputs?: JsonValue[] | undefined;\n /** The name of the served model that served the request. This is useful when there are multiple models behind the same endpoint with traffic split. */\n servedModelName?: string | undefined;\n}\n\nexport interface V1ResponseChoiceElement {\n /** The text response from the __completions__ endpoint. */\n text?: string | undefined;\n /** The message response from the __chat__ endpoint. */\n message?: ChatMessage | undefined;\n /** The index of the choice in the __chat or completions__ response. */\n index?: number | undefined;\n /** The finish reason returned by the endpoint. */\n finishReason?: string | undefined;\n /** The logprobs returned only by the __completions__ endpoint. */\n logprobs?: number | undefined;\n}\n\nexport const unmarshalChatMessageSchema: z.ZodType<ChatMessage> = z\n .object({\n role: z.string().optional(),\n content: z.string().optional(),\n })\n .transform(d => ({\n role: d.role,\n content: d.content,\n }));\n\nexport const unmarshalEmbeddingsV1ResponseEmbeddingElementSchema: z.ZodType<EmbeddingsV1ResponseEmbeddingElement> =\n z\n .object({\n embedding: z.array(z.number()).optional(),\n index: z.number().optional(),\n object: z.string().optional(),\n })\n .transform(d => ({\n embedding: d.embedding,\n index: d.index,\n object: d.object,\n }));\n\nexport const unmarshalExternalModelUsageElementSchema: z.ZodType<ExternalModelUsageElement> =\n z\n .object({\n prompt_tokens: z.number().optional(),\n completion_tokens: z.number().optional(),\n total_tokens: z.number().optional(),\n })\n .transform(d => ({\n promptTokens: d.prompt_tokens,\n completionTokens: d.completion_tokens,\n totalTokens: d.total_tokens,\n }));\n\nexport const unmarshalQueryEndpointResponseSchema: z.ZodType<QueryEndpointResponse> =\n z\n .object({\n choices: z\n .array(z.lazy(() => unmarshalV1ResponseChoiceElementSchema))\n .optional(),\n data: z\n .array(\n z.lazy(() => unmarshalEmbeddingsV1ResponseEmbeddingElementSchema)\n )\n .optional(),\n model: z.string().optional(),\n usage: z.lazy(() => unmarshalExternalModelUsageElementSchema).optional(),\n id: z.string().optional(),\n created: z\n .union([z.number(), z.bigint()])\n .transform(v => BigInt(v))\n .optional(),\n object: z.string().optional(),\n predictions: z.array(jsonValueSchema).optional(),\n outputs: z.array(jsonValueSchema).optional(),\n 'served-model-name': z.string().optional(),\n })\n .transform(d => ({\n choices: d.choices,\n data: d.data,\n model: d.model,\n usage: d.usage,\n id: d.id,\n created: d.created,\n object: d.object,\n predictions: d.predictions,\n outputs: d.outputs,\n servedModelName: d['served-model-name'],\n }));\n\nexport const unmarshalV1ResponseChoiceElementSchema: z.ZodType<V1ResponseChoiceElement> =\n z\n .object({\n text: z.string().optional(),\n message: z.lazy(() => unmarshalChatMessageSchema).optional(),\n index: z.number().optional(),\n finishReason: z.string().optional(),\n logprobs: z.number().optional(),\n })\n .transform(d => ({\n text: d.text,\n message: d.message,\n index: d.index,\n finishReason: d.finishReason,\n logprobs: d.logprobs,\n }));\n\nexport const marshalChatMessageSchema: z.ZodType = z\n .object({\n role: z.string().optional(),\n content: z.string().optional(),\n })\n .transform(d => ({\n role: d.role,\n content: d.content,\n }));\n\nexport const marshalDataframeSplitInputSchema: z.ZodType = z\n .object({\n index: z.array(z.number()).optional(),\n columns: z.array(jsonValueSchema).optional(),\n data: z.array(jsonValueSchema).optional(),\n })\n .transform(d => ({\n index: d.index,\n columns: d.columns,\n data: d.data,\n }));\n\nexport const marshalQueryEndpointRequestSchema: z.ZodType = z\n .object({\n name: z.string().optional(),\n prompt: jsonValueSchema.optional(),\n input: jsonValueSchema.optional(),\n messages: z.array(z.lazy(() => marshalChatMessageSchema)).optional(),\n temperature: z.number().optional(),\n stop: z.array(z.string()).optional(),\n maxTokens: z.number().optional(),\n n: z.number().optional(),\n stream: z.boolean().optional(),\n extraParams: z.record(z.string(), z.string()).optional(),\n dataframeRecords: z.array(jsonValueSchema).optional(),\n dataframeSplit: z.lazy(() => marshalDataframeSplitInputSchema).optional(),\n instances: z.array(jsonValueSchema).optional(),\n inputs: jsonValueSchema.optional(),\n clientRequestId: z.string().optional(),\n usageContext: z.record(z.string(), z.string()).optional(),\n })\n .transform(d => ({\n name: d.name,\n prompt: d.prompt,\n input: d.input,\n messages: d.messages,\n temperature: d.temperature,\n stop: d.stop,\n max_tokens: d.maxTokens,\n n: d.n,\n stream: d.stream,\n extra_params: d.extraParams,\n dataframe_records: d.dataframeRecords,\n dataframe_split: d.dataframeSplit,\n instances: d.instances,\n inputs: d.inputs,\n client_request_id: d.clientRequestId,\n usage_context: d.usageContext,\n }));\n"],"mappings":";;;AAKA,MAAM,kBAAwC,EAAE,WAC9C,EAAE,MAAM;CACN,EAAE,MAAM;CACR,EAAE,QAAQ;CACV,EAAE,QAAQ;CACV,EAAE,SAAS;CACX,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB;CACrC,EAAE,MAAM,gBAAgB;CACzB,CAAC,CACH;;AAID,MAAa,kBA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,EACzD,OAAO;CACN,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,QAAQ,gBAAgB,UAAU;CAClC,OAAO,gBAAgB,UAAU;CACjC,UAAU,EAAE,MAAM,EAAE,WAAW,yBAAyB,CAAC,CAAC,UAAU;CACpE,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CACpC,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,GAAG,EAAE,QAAQ,CAAC,UAAU;CACxB,QAAQ,EAAE,SAAS,CAAC,UAAU;CAC9B,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC,UAAU;CACxD,kBAAkB,EAAE,MAAM,gBAAgB,CAAC,UAAU;CACrD,gBAAgB,EAAE,WAAW,iCAAiC,CAAC,UAAU;CACzE,WAAW,EAAE,MAAM,gBAAgB,CAAC,UAAU;CAC9C,QAAQ,gBAAgB,UAAU;CAClC,iBAAiB,EAAE,QAAQ,CAAC,UAAU;CACtC,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC,UAAU;CAC1D,CAAC,CACD,WAAU,OAAM;CACf,MAAM,EAAE;CACR,QAAQ,EAAE;CACV,OAAO,EAAE;CACT,UAAU,EAAE;CACZ,aAAa,EAAE;CACf,MAAM,EAAE;CACR,YAAY,EAAE;CACd,GAAG,EAAE;CACL,QAAQ,EAAE;CACV,cAAc,EAAE;CAChB,mBAAmB,EAAE;CACrB,iBAAiB,EAAE;CACnB,WAAW,EAAE;CACb,QAAQ,EAAE;CACV,mBAAmB,EAAE;CACrB,eAAe,EAAE;CAClB,EAAE"}
@@ -1,23 +1,25 @@
1
- import type { HttpClient } from '@databricks/sdk-core/http';
2
- import type { ClientOptions } from '@databricks/sdk-options/client';
1
+ import { HttpClient } from "@databricks/sdk-core/http";
2
+ import { ClientOptions } from "@databricks/sdk-options/client";
3
+
4
+ //#region src/v1/transport.d.ts
3
5
  /**
4
6
  * The configuration a client needs to issue requests, resolved from
5
7
  * {@link ClientOptions} and a configuration profile.
6
8
  */
7
- export interface ResolvedClientConfig {
8
- /** Host with any trailing slash removed. */
9
- host: string;
10
- /**
11
- * Default account ID for account-level paths that contain an account_id
12
- * segment. A request's own accountId still wins.
13
- */
14
- accountId?: string;
15
- /**
16
- * Workspace ID used to route workspace-level calls on unified hosts (SPOG).
17
- */
18
- workspaceId?: string;
19
- /** HTTP client with authentication, and any configured timeout, applied. */
20
- httpClient: HttpClient;
9
+ interface ResolvedClientConfig {
10
+ /** Host with any trailing slash removed. */
11
+ host: string;
12
+ /**
13
+ * Default account ID for account-level paths that contain an account_id
14
+ * segment. A request's own accountId still wins.
15
+ */
16
+ accountId?: string;
17
+ /**
18
+ * Workspace ID used to route workspace-level calls on unified hosts (SPOG).
19
+ */
20
+ workspaceId?: string;
21
+ /** HTTP client with authentication, and any configured timeout, applied. */
22
+ httpClient: HttpClient;
21
23
  }
22
24
  /**
23
25
  * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
@@ -29,5 +31,7 @@ export interface ResolvedClientConfig {
29
31
  *
30
32
  * @throws if host is neither provided nor present in the resolved profile.
31
33
  */
32
- export declare function resolveClientConfig(options: ClientOptions): Promise<ResolvedClientConfig>;
34
+ declare function resolveClientConfig(options: ClientOptions): Promise<ResolvedClientConfig>;
35
+ //#endregion
36
+ export { ResolvedClientConfig, resolveClientConfig };
33
37
  //# sourceMappingURL=transport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/v1/transport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,UAAU,EAGX,MAAM,2BAA2B,CAAC;AAInC,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,4EAA4E;IAC5E,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,oBAAoB,CAAC,CA4B/B"}
1
+ {"version":3,"file":"transport.d.ts","names":[],"sources":["../../src/v1/transport.ts"],"mappings":";;;;;;AAkBA;;UAAiB,oBAAA;EAgBO;EAdtB,IAAA;EAMA;;;;EAAA,SAAA;EAQsB;AAaxB;;EAhBE,WAAA;EAiBS;EAdT,UAAA,EAAY,UAAA;AAAA;;;;;;;;;;;iBAaQ,mBAAA,CACpB,OAAA,EAAS,aAAA,GACR,OAAA,CAAQ,oBAAA"}
@@ -1,74 +1,65 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
- import { defaultCredentials } from '@databricks/sdk-auth/credentials';
3
- import { newFetchHttpClient } from '@databricks/sdk-core/http';
4
- import { resolve } from '@databricks/sdk-core/profiles';
1
+ import { defaultCredentials } from "@databricks/sdk-auth/credentials";
2
+ import { newFetchHttpClient } from "@databricks/sdk-core/http";
3
+ import { resolve } from "@databricks/sdk-core/profiles";
4
+
5
+ //#region src/v1/transport.ts
5
6
  /**
6
- * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
7
- *
8
- * A configuration profile is always resolved from the config file and
9
- * environment variables (per options.profileOptions); it supplies host,
10
- * accountId, workspaceId, and credentials wherever the caller did not set them
11
- * explicitly. Explicit options always take precedence.
12
- *
13
- * @throws if host is neither provided nor present in the resolved profile.
14
- */
15
- export async function resolveClientConfig(options) {
16
- const profile = await resolve(options.profileOptions);
17
- const host = options.host ?? profile.host;
18
- if (host === undefined) {
19
- throw new Error('Host is required.');
20
- }
21
- // The provided httpClient (or the default fetch client) is the base wire;
22
- // authentication and the optional timeout are layered on top of it. The
23
- // default credential chain reuses the profile resolved above so that the
24
- // same profileOptions govern host and authentication alike.
25
- const base = options.httpClient ?? newFetchHttpClient();
26
- const credentials = options.credentials ?? defaultCredentials({ profile });
27
- let httpClient = new AuthHttpClient(base, credentials);
28
- if (options.timeout !== undefined) {
29
- httpClient = new TimeoutHttpClient(httpClient, options.timeout);
30
- }
31
- const accountId = options.accountId ?? profile.accountId;
32
- const workspaceId = options.workspaceId ?? profile.workspaceId;
33
- return {
34
- host: host.replace(/\/$/, ''),
35
- httpClient,
36
- ...(accountId !== undefined && { accountId }),
37
- ...(workspaceId !== undefined && { workspaceId }),
38
- };
7
+ * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
8
+ *
9
+ * A configuration profile is always resolved from the config file and
10
+ * environment variables (per options.profileOptions); it supplies host,
11
+ * accountId, workspaceId, and credentials wherever the caller did not set them
12
+ * explicitly. Explicit options always take precedence.
13
+ *
14
+ * @throws if host is neither provided nor present in the resolved profile.
15
+ */
16
+ async function resolveClientConfig(options) {
17
+ const profile = await resolve(options.profileOptions);
18
+ const host = options.host ?? profile.host;
19
+ if (host === void 0) throw new Error("Host is required.");
20
+ let httpClient = new AuthHttpClient(options.httpClient ?? newFetchHttpClient(), options.credentials ?? defaultCredentials({ profile }));
21
+ if (options.timeout !== void 0) httpClient = new TimeoutHttpClient(httpClient, options.timeout);
22
+ const accountId = options.accountId ?? profile.accountId;
23
+ const workspaceId = options.workspaceId ?? profile.workspaceId;
24
+ return {
25
+ host: host.replace(/\/$/, ""),
26
+ httpClient,
27
+ ...accountId !== void 0 && { accountId },
28
+ ...workspaceId !== void 0 && { workspaceId }
29
+ };
39
30
  }
40
31
  /** Wraps an HttpClient and adds authentication headers to requests. */
41
- class AuthHttpClient {
42
- base;
43
- credentials;
44
- constructor(base, credentials) {
45
- this.base = base;
46
- this.credentials = credentials;
47
- }
48
- async send(request) {
49
- const authHeaders = await this.credentials.authHeaders();
50
- // Do not modify the original request.
51
- const headers = new Headers(request.headers);
52
- for (const h of authHeaders) {
53
- headers.set(h.key, h.value);
54
- }
55
- return this.base.send({ ...request, headers });
56
- }
57
- }
32
+ var AuthHttpClient = class {
33
+ constructor(base, credentials) {
34
+ this.base = base;
35
+ this.credentials = credentials;
36
+ }
37
+ async send(request) {
38
+ const authHeaders = await this.credentials.authHeaders();
39
+ const headers = new Headers(request.headers);
40
+ for (const h of authHeaders) headers.set(h.key, h.value);
41
+ return this.base.send({
42
+ ...request,
43
+ headers
44
+ });
45
+ }
46
+ };
58
47
  /** Wraps an HttpClient and applies a default timeout to requests. */
59
- class TimeoutHttpClient {
60
- base;
61
- timeout;
62
- constructor(base, timeout) {
63
- this.base = base;
64
- this.timeout = timeout;
65
- }
66
- async send(request) {
67
- const timeoutSignal = AbortSignal.timeout(this.timeout);
68
- const signal = request.signal !== undefined
69
- ? AbortSignal.any([request.signal, timeoutSignal])
70
- : timeoutSignal;
71
- return this.base.send({ ...request, signal });
72
- }
73
- }
48
+ var TimeoutHttpClient = class {
49
+ constructor(base, timeout) {
50
+ this.base = base;
51
+ this.timeout = timeout;
52
+ }
53
+ async send(request) {
54
+ const timeoutSignal = AbortSignal.timeout(this.timeout);
55
+ const signal = request.signal !== void 0 ? AbortSignal.any([request.signal, timeoutSignal]) : timeoutSignal;
56
+ return this.base.send({
57
+ ...request,
58
+ signal
59
+ });
60
+ }
61
+ };
62
+
63
+ //#endregion
64
+ export { resolveClientConfig };
74
65
  //# sourceMappingURL=transport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/v1/transport.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAG/E,OAAO,EAAC,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AAMpE,OAAO,EAAC,kBAAkB,EAAC,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAC,OAAO,EAAC,MAAM,+BAA+B,CAAC;AA0BtD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAAsB;IAEtB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,KAAK,CAAC,IAAI,CAAC,OAAoB;QAC7B,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;QACzD,sCAAsC;QACtC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC7C,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAC,GAAG,OAAO,EAAE,OAAO,EAAC,CAAC,CAAC;IAC/C,CAAC;CACF;AAED,qEAAqE;AACrE,MAAM,iBAAiB;IAEF;IACA;IAFnB,YACmB,IAAgB,EAChB,OAAe;QADf,SAAI,GAAJ,IAAI,CAAY;QAChB,YAAO,GAAP,OAAO,CAAQ;IAC/B,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,OAAoB;QAC7B,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxD,MAAM,MAAM,GACV,OAAO,CAAC,MAAM,KAAK,SAAS;YAC1B,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;YAClD,CAAC,CAAC,aAAa,CAAC;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAC,GAAG,OAAO,EAAE,MAAM,EAAC,CAAC,CAAC;IAC9C,CAAC;CACF"}
1
+ {"version":3,"file":"transport.js","names":[],"sources":["../../src/v1/transport.ts"],"sourcesContent":["// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.\n\nimport type {Credentials} from '@databricks/sdk-auth';\nimport {defaultCredentials} from '@databricks/sdk-auth/credentials';\nimport type {\n HttpClient,\n HttpRequest,\n HttpResponse,\n} from '@databricks/sdk-core/http';\nimport {newFetchHttpClient} from '@databricks/sdk-core/http';\nimport type {Profile} from '@databricks/sdk-core/profiles';\nimport {resolve} from '@databricks/sdk-core/profiles';\nimport type {ClientOptions} from '@databricks/sdk-options/client';\n\n/**\n * The configuration a client needs to issue requests, resolved from\n * {@link ClientOptions} and a configuration profile.\n */\nexport interface ResolvedClientConfig {\n /** Host with any trailing slash removed. */\n host: string;\n\n /**\n * Default account ID for account-level paths that contain an account_id\n * segment. A request's own accountId still wins.\n */\n accountId?: string;\n\n /**\n * Workspace ID used to route workspace-level calls on unified hosts (SPOG).\n */\n workspaceId?: string;\n\n /** HTTP client with authentication, and any configured timeout, applied. */\n httpClient: HttpClient;\n}\n\n/**\n * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.\n *\n * A configuration profile is always resolved from the config file and\n * environment variables (per options.profileOptions); it supplies host,\n * accountId, workspaceId, and credentials wherever the caller did not set them\n * explicitly. Explicit options always take precedence.\n *\n * @throws if host is neither provided nor present in the resolved profile.\n */\nexport async function resolveClientConfig(\n options: ClientOptions\n): Promise<ResolvedClientConfig> {\n const profile: Profile = await resolve(options.profileOptions);\n\n const host = options.host ?? profile.host;\n if (host === undefined) {\n throw new Error('Host is required.');\n }\n\n // The provided httpClient (or the default fetch client) is the base wire;\n // authentication and the optional timeout are layered on top of it. The\n // default credential chain reuses the profile resolved above so that the\n // same profileOptions govern host and authentication alike.\n const base = options.httpClient ?? newFetchHttpClient();\n const credentials = options.credentials ?? defaultCredentials({profile});\n let httpClient: HttpClient = new AuthHttpClient(base, credentials);\n if (options.timeout !== undefined) {\n httpClient = new TimeoutHttpClient(httpClient, options.timeout);\n }\n\n const accountId = options.accountId ?? profile.accountId;\n const workspaceId = options.workspaceId ?? profile.workspaceId;\n\n return {\n host: host.replace(/\\/$/, ''),\n httpClient,\n ...(accountId !== undefined && {accountId}),\n ...(workspaceId !== undefined && {workspaceId}),\n };\n}\n\n/** Wraps an HttpClient and adds authentication headers to requests. */\nclass AuthHttpClient implements HttpClient {\n constructor(\n private readonly base: HttpClient,\n private readonly credentials: Credentials\n ) {}\n\n async send(request: HttpRequest): Promise<HttpResponse> {\n const authHeaders = await this.credentials.authHeaders();\n // Do not modify the original request.\n const headers = new Headers(request.headers);\n for (const h of authHeaders) {\n headers.set(h.key, h.value);\n }\n return this.base.send({...request, headers});\n }\n}\n\n/** Wraps an HttpClient and applies a default timeout to requests. */\nclass TimeoutHttpClient implements HttpClient {\n constructor(\n private readonly base: HttpClient,\n private readonly timeout: number\n ) {}\n\n async send(request: HttpRequest): Promise<HttpResponse> {\n const timeoutSignal = AbortSignal.timeout(this.timeout);\n const signal =\n request.signal !== undefined\n ? AbortSignal.any([request.signal, timeoutSignal])\n : timeoutSignal;\n return this.base.send({...request, signal});\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+CA,eAAsB,oBACpB,SAC+B;CAC/B,MAAM,UAAmB,MAAM,QAAQ,QAAQ,eAAe;CAE9D,MAAM,OAAO,QAAQ,QAAQ,QAAQ;AACrC,KAAI,SAAS,OACX,OAAM,IAAI,MAAM,oBAAoB;CAStC,IAAI,aAAyB,IAAI,eAFpB,QAAQ,cAAc,oBAAoB,EACnC,QAAQ,eAAe,mBAAmB,EAAC,SAAQ,CAAC,CACN;AAClE,KAAI,QAAQ,YAAY,OACtB,cAAa,IAAI,kBAAkB,YAAY,QAAQ,QAAQ;CAGjE,MAAM,YAAY,QAAQ,aAAa,QAAQ;CAC/C,MAAM,cAAc,QAAQ,eAAe,QAAQ;AAEnD,QAAO;EACL,MAAM,KAAK,QAAQ,OAAO,GAAG;EAC7B;EACA,GAAI,cAAc,UAAa,EAAC,WAAU;EAC1C,GAAI,gBAAgB,UAAa,EAAC,aAAY;EAC/C;;;AAIH,IAAM,iBAAN,MAA2C;CACzC,YACE,AAAiB,MACjB,AAAiB,aACjB;EAFiB;EACA;;CAGnB,MAAM,KAAK,SAA6C;EACtD,MAAM,cAAc,MAAM,KAAK,YAAY,aAAa;EAExD,MAAM,UAAU,IAAI,QAAQ,QAAQ,QAAQ;AAC5C,OAAK,MAAM,KAAK,YACd,SAAQ,IAAI,EAAE,KAAK,EAAE,MAAM;AAE7B,SAAO,KAAK,KAAK,KAAK;GAAC,GAAG;GAAS;GAAQ,CAAC;;;;AAKhD,IAAM,oBAAN,MAA8C;CAC5C,YACE,AAAiB,MACjB,AAAiB,SACjB;EAFiB;EACA;;CAGnB,MAAM,KAAK,SAA6C;EACtD,MAAM,gBAAgB,YAAY,QAAQ,KAAK,QAAQ;EACvD,MAAM,SACJ,QAAQ,WAAW,SACf,YAAY,IAAI,CAAC,QAAQ,QAAQ,cAAc,CAAC,GAChD;AACN,SAAO,KAAK,KAAK,KAAK;GAAC,GAAG;GAAS;GAAO,CAAC"}
@@ -1,21 +1,25 @@
1
- import type { HttpClient, HttpRequest } from '@databricks/sdk-core/http';
2
- import type { Logger } from '@databricks/sdk-core/logger';
3
- import type { CallOptions } from '@databricks/sdk-options/call';
4
- import type { z } from 'zod';
5
- export interface HttpCallOptions {
6
- readonly request: HttpRequest;
7
- readonly httpClient: HttpClient;
8
- readonly logger: Logger;
1
+ import { Logger } from "@databricks/sdk-core/logger";
2
+ import { HttpClient, HttpRequest } from "@databricks/sdk-core/http";
3
+ import { z } from "zod";
4
+ import { CallOptions } from "@databricks/sdk-options/call";
5
+
6
+ //#region src/v1/utils.d.ts
7
+ interface HttpCallOptions {
8
+ readonly request: HttpRequest;
9
+ readonly httpClient: HttpClient;
10
+ readonly logger: Logger;
9
11
  }
10
12
  /**
11
13
  * Translates public CallOptions to the internal Options shape accepted by
12
14
  * execute(). Even though the shapes match today, this isolates the public
13
15
  * API from the executor's internal type so they can diverge.
14
16
  */
15
- export declare function executeCall(call: (signal?: AbortSignal) => Promise<void>, options?: CallOptions): Promise<void>;
16
- export declare function executeHttpCall(opts: HttpCallOptions): Promise<Uint8Array>;
17
- export declare function buildHttpRequest(method: string, url: string, headers: Headers, signal?: AbortSignal, body?: string | ReadableStream<Uint8Array>): HttpRequest;
18
- export declare function parseResponse<T>(body: Uint8Array, schema: z.ZodType<T>): T;
19
- export declare function marshalRequest(data: unknown, schema: z.ZodType): string;
20
- export declare function flattenQueryParams(prefix: string, value: unknown, params: URLSearchParams): void;
17
+ declare function executeCall(call: (signal?: AbortSignal) => Promise<void>, options?: CallOptions): Promise<void>;
18
+ declare function executeHttpCall(opts: HttpCallOptions): Promise<Uint8Array>;
19
+ declare function buildHttpRequest(method: string, url: string, headers: Headers, signal?: AbortSignal, body?: string | ReadableStream<Uint8Array>): HttpRequest;
20
+ declare function parseResponse<T>(body: Uint8Array, schema: z.ZodType<T>): T;
21
+ declare function marshalRequest(data: unknown, schema: z.ZodType): string;
22
+ declare function flattenQueryParams(prefix: string, value: unknown, params: URLSearchParams): void;
23
+ //#endregion
24
+ export { HttpCallOptions, buildHttpRequest, executeCall, executeHttpCall, flattenQueryParams, marshalRequest, parseResponse };
21
25
  //# sourceMappingURL=utils.d.ts.map