@databricks/sdk-forecasting 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/package.js +7 -0
- package/dist/package.js.map +1 -0
- package/dist/v1/client.d.ts +33 -29
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +121 -155
- 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 +73 -74
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +57 -69
- 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 +21 -18
- package/dist/v1/utils.d.ts.map +1 -1
- package/dist/v1/utils.js +90 -118
- 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
CHANGED
|
@@ -1,73 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
SUCCEEDED: 'SUCCEEDED',
|
|
11
|
-
/** The forecasting experiment has failed. */
|
|
12
|
-
FAILED: 'FAILED',
|
|
13
|
-
/** The forecasting experiment has been cancelled. */
|
|
14
|
-
CANCELLED: 'CANCELLED',
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/v1/model.ts
|
|
4
|
+
const ForecastingExperiment_State = {
|
|
5
|
+
PENDING: "PENDING",
|
|
6
|
+
RUNNING: "RUNNING",
|
|
7
|
+
SUCCEEDED: "SUCCEEDED",
|
|
8
|
+
FAILED: "FAILED",
|
|
9
|
+
CANCELLED: "CANCELLED"
|
|
15
10
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
const unmarshalCreateForecastingExperimentResponseSchema = z.object({ experiment_id: z.string().optional() }).transform((d) => ({ experimentId: d.experiment_id }));
|
|
12
|
+
const unmarshalForecastingExperimentSchema = z.object({
|
|
13
|
+
experiment_id: z.string().optional(),
|
|
14
|
+
experiment_page_url: z.string().optional(),
|
|
15
|
+
state: z.string().optional()
|
|
16
|
+
}).transform((d) => ({
|
|
17
|
+
experimentId: d.experiment_id,
|
|
18
|
+
experimentPageUrl: d.experiment_page_url,
|
|
19
|
+
state: d.state
|
|
22
20
|
}));
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
forecast_horizon: d.forecastHorizon,
|
|
60
|
-
primary_metric: d.primaryMetric,
|
|
61
|
-
training_frameworks: d.trainingFrameworks,
|
|
62
|
-
experiment_path: d.experimentPath,
|
|
63
|
-
max_runtime: d.maxRuntime,
|
|
64
|
-
split_column: d.splitColumn,
|
|
65
|
-
custom_weights_column: d.customWeightsColumn,
|
|
66
|
-
register_to: d.registerTo,
|
|
67
|
-
holiday_regions: d.holidayRegions,
|
|
68
|
-
timeseries_identifier_columns: d.timeseriesIdentifierColumns,
|
|
69
|
-
prediction_data_path: d.predictionDataPath,
|
|
70
|
-
include_features: d.includeFeatures,
|
|
71
|
-
future_feature_data_path: d.futureFeatureDataPath,
|
|
21
|
+
const marshalCreateForecastingExperimentRequestSchema = z.object({
|
|
22
|
+
trainDataPath: z.string().optional(),
|
|
23
|
+
targetColumn: z.string().optional(),
|
|
24
|
+
timeColumn: z.string().optional(),
|
|
25
|
+
forecastGranularity: z.string().optional(),
|
|
26
|
+
forecastHorizon: z.bigint().optional(),
|
|
27
|
+
primaryMetric: z.string().optional(),
|
|
28
|
+
trainingFrameworks: z.array(z.string()).optional(),
|
|
29
|
+
experimentPath: z.string().optional(),
|
|
30
|
+
maxRuntime: z.bigint().optional(),
|
|
31
|
+
splitColumn: z.string().optional(),
|
|
32
|
+
customWeightsColumn: z.string().optional(),
|
|
33
|
+
registerTo: z.string().optional(),
|
|
34
|
+
holidayRegions: z.array(z.string()).optional(),
|
|
35
|
+
timeseriesIdentifierColumns: z.array(z.string()).optional(),
|
|
36
|
+
predictionDataPath: z.string().optional(),
|
|
37
|
+
includeFeatures: z.array(z.string()).optional(),
|
|
38
|
+
futureFeatureDataPath: z.string().optional()
|
|
39
|
+
}).transform((d) => ({
|
|
40
|
+
train_data_path: d.trainDataPath,
|
|
41
|
+
target_column: d.targetColumn,
|
|
42
|
+
time_column: d.timeColumn,
|
|
43
|
+
forecast_granularity: d.forecastGranularity,
|
|
44
|
+
forecast_horizon: d.forecastHorizon,
|
|
45
|
+
primary_metric: d.primaryMetric,
|
|
46
|
+
training_frameworks: d.trainingFrameworks,
|
|
47
|
+
experiment_path: d.experimentPath,
|
|
48
|
+
max_runtime: d.maxRuntime,
|
|
49
|
+
split_column: d.splitColumn,
|
|
50
|
+
custom_weights_column: d.customWeightsColumn,
|
|
51
|
+
register_to: d.registerTo,
|
|
52
|
+
holiday_regions: d.holidayRegions,
|
|
53
|
+
timeseries_identifier_columns: d.timeseriesIdentifierColumns,
|
|
54
|
+
prediction_data_path: d.predictionDataPath,
|
|
55
|
+
include_features: d.includeFeatures,
|
|
56
|
+
future_feature_data_path: d.futureFeatureDataPath
|
|
72
57
|
}));
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { ForecastingExperiment_State, marshalCreateForecastingExperimentRequestSchema, unmarshalCreateForecastingExperimentResponseSchema, unmarshalForecastingExperimentSchema };
|
|
73
61
|
//# sourceMappingURL=model.js.map
|
package/dist/v1/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","
|
|
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 {z} from 'zod';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.\nexport const ForecastingExperiment_State = {\n /** The forecasting experiment is pending and has not started yet. */\n PENDING: 'PENDING',\n /** The forecasting experiment is currently running. */\n RUNNING: 'RUNNING',\n /** The forecasting experiment has completed successfully. */\n SUCCEEDED: 'SUCCEEDED',\n /** The forecasting experiment has failed. */\n FAILED: 'FAILED',\n /** The forecasting experiment has been cancelled. */\n CANCELLED: 'CANCELLED',\n} as const;\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested enum name.\nexport type ForecastingExperiment_State =\n | (typeof ForecastingExperiment_State)[keyof typeof ForecastingExperiment_State]\n | (string & {});\n\nexport interface CreateForecastingExperimentRequest {\n /** The fully qualified path of a Unity Catalog table, formatted as catalog_name.schema_name.table_name, used as training data for the forecasting model. */\n trainDataPath?: string | undefined;\n /** The column in the input training table used as the prediction target for model training. The values in this column are used as the ground truth for model training. */\n targetColumn?: string | undefined;\n /** The column in the input training table that represents each row's timestamp. */\n timeColumn?: string | undefined;\n /**\n * The time interval between consecutive rows in the time series data.\n * Possible values include: '1 second', '1 minute', '5 minutes', '10 minutes', '15 minutes', '30 minutes', 'Hourly', 'Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly'.\n */\n forecastGranularity?: string | undefined;\n /** The number of time steps into the future to make predictions, calculated as a multiple of forecast_granularity. This value represents how far ahead the model should forecast. */\n forecastHorizon?: bigint | undefined;\n /** The evaluation metric used to optimize the forecasting model. */\n primaryMetric?: string | undefined;\n /** List of frameworks to include for model tuning. Possible values are 'Prophet', 'ARIMA', 'DeepAR'. An empty list includes all supported frameworks. */\n trainingFrameworks?: string[] | undefined;\n /** The path in the workspace to store the created experiment. */\n experimentPath?: string | undefined;\n /** The maximum duration for the experiment in minutes. The experiment stops automatically if it exceeds this limit. */\n maxRuntime?: bigint | undefined;\n /** // The column in the training table used for custom data splits. Values must be 'train', 'validate', or 'test'. */\n splitColumn?: string | undefined;\n /** The column in the training table used to customize weights for each time series. */\n customWeightsColumn?: string | undefined;\n /** The fully qualified path of a Unity Catalog model, formatted as catalog_name.schema_name.model_name, used to store the best model. */\n registerTo?: string | undefined;\n /** The region code(s) to automatically add holiday features. Currently supports only one region. */\n holidayRegions?: string[] | undefined;\n /** The column in the training table used to group the dataset for predicting individual time series. */\n timeseriesIdentifierColumns?: string[] | undefined;\n /** The fully qualified path of a Unity Catalog table, formatted as catalog_name.schema_name.table_name, used to store predictions. */\n predictionDataPath?: string | undefined;\n /**\n * Specifies the list of feature columns to include in model training. These columns must exist\n * in the training data and be of type string, numerical, or boolean. If not specified, no additional\n * features will be included.\n * Note: Certain columns are automatically handled:\n * - Automatically excluded: split_column, target_column, custom_weights_column.\n * - Automatically included: time_column.\n */\n includeFeatures?: string[] | undefined;\n /** The fully qualified path of a Unity Catalog table, formatted as catalog_name.schema_name.table_name, used to store future feature data for predictions. */\n futureFeatureDataPath?: string | undefined;\n}\n\nexport interface CreateForecastingExperimentResponse {\n /** The unique ID of the created forecasting experiment */\n experimentId?: string | undefined;\n}\n\n/** Represents a forecasting experiment with its unique identifier, URL, and state. */\nexport interface ForecastingExperiment {\n /** The unique ID for the forecasting experiment. */\n experimentId?: string | undefined;\n /** The URL to the forecasting experiment page. */\n experimentPageUrl?: string | undefined;\n /** The current state of the forecasting experiment. */\n state?: ForecastingExperiment_State | undefined;\n}\n\nexport interface GetForecastingExperimentRequest {\n /** The unique ID of a forecasting experiment */\n experimentId?: string | undefined;\n}\n\nexport const unmarshalCreateForecastingExperimentResponseSchema: z.ZodType<CreateForecastingExperimentResponse> =\n z\n .object({\n experiment_id: z.string().optional(),\n })\n .transform(d => ({\n experimentId: d.experiment_id,\n }));\n\nexport const unmarshalForecastingExperimentSchema: z.ZodType<ForecastingExperiment> =\n z\n .object({\n experiment_id: z.string().optional(),\n experiment_page_url: z.string().optional(),\n state: z.string().optional(),\n })\n .transform(d => ({\n experimentId: d.experiment_id,\n experimentPageUrl: d.experiment_page_url,\n state: d.state,\n }));\n\nexport const marshalCreateForecastingExperimentRequestSchema: z.ZodType = z\n .object({\n trainDataPath: z.string().optional(),\n targetColumn: z.string().optional(),\n timeColumn: z.string().optional(),\n forecastGranularity: z.string().optional(),\n forecastHorizon: z.bigint().optional(),\n primaryMetric: z.string().optional(),\n trainingFrameworks: z.array(z.string()).optional(),\n experimentPath: z.string().optional(),\n maxRuntime: z.bigint().optional(),\n splitColumn: z.string().optional(),\n customWeightsColumn: z.string().optional(),\n registerTo: z.string().optional(),\n holidayRegions: z.array(z.string()).optional(),\n timeseriesIdentifierColumns: z.array(z.string()).optional(),\n predictionDataPath: z.string().optional(),\n includeFeatures: z.array(z.string()).optional(),\n futureFeatureDataPath: z.string().optional(),\n })\n .transform(d => ({\n train_data_path: d.trainDataPath,\n target_column: d.targetColumn,\n time_column: d.timeColumn,\n forecast_granularity: d.forecastGranularity,\n forecast_horizon: d.forecastHorizon,\n primary_metric: d.primaryMetric,\n training_frameworks: d.trainingFrameworks,\n experiment_path: d.experimentPath,\n max_runtime: d.maxRuntime,\n split_column: d.splitColumn,\n custom_weights_column: d.customWeightsColumn,\n register_to: d.registerTo,\n holiday_regions: d.holidayRegions,\n timeseries_identifier_columns: d.timeseriesIdentifierColumns,\n prediction_data_path: d.predictionDataPath,\n include_features: d.includeFeatures,\n future_feature_data_path: d.futureFeatureDataPath,\n }));\n"],"mappings":";;;AAKA,MAAa,8BAA8B;CAEzC,SAAS;CAET,SAAS;CAET,WAAW;CAEX,QAAQ;CAER,WAAW;CACZ;AAyED,MAAa,qDACX,EACG,OAAO,EACN,eAAe,EAAE,QAAQ,CAAC,UAAU,EACrC,CAAC,CACD,WAAU,OAAM,EACf,cAAc,EAAE,eACjB,EAAE;AAEP,MAAa,uCACX,EACG,OAAO;CACN,eAAe,EAAE,QAAQ,CAAC,UAAU;CACpC,qBAAqB,EAAE,QAAQ,CAAC,UAAU;CAC1C,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC7B,CAAC,CACD,WAAU,OAAM;CACf,cAAc,EAAE;CAChB,mBAAmB,EAAE;CACrB,OAAO,EAAE;CACV,EAAE;AAEP,MAAa,kDAA6D,EACvE,OAAO;CACN,eAAe,EAAE,QAAQ,CAAC,UAAU;CACpC,cAAc,EAAE,QAAQ,CAAC,UAAU;CACnC,YAAY,EAAE,QAAQ,CAAC,UAAU;CACjC,qBAAqB,EAAE,QAAQ,CAAC,UAAU;CAC1C,iBAAiB,EAAE,QAAQ,CAAC,UAAU;CACtC,eAAe,EAAE,QAAQ,CAAC,UAAU;CACpC,oBAAoB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CAClD,gBAAgB,EAAE,QAAQ,CAAC,UAAU;CACrC,YAAY,EAAE,QAAQ,CAAC,UAAU;CACjC,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,qBAAqB,EAAE,QAAQ,CAAC,UAAU;CAC1C,YAAY,EAAE,QAAQ,CAAC,UAAU;CACjC,gBAAgB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CAC9C,6BAA6B,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CAC3D,oBAAoB,EAAE,QAAQ,CAAC,UAAU;CACzC,iBAAiB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CAC/C,uBAAuB,EAAE,QAAQ,CAAC,UAAU;CAC7C,CAAC,CACD,WAAU,OAAM;CACf,iBAAiB,EAAE;CACnB,eAAe,EAAE;CACjB,aAAa,EAAE;CACf,sBAAsB,EAAE;CACxB,kBAAkB,EAAE;CACpB,gBAAgB,EAAE;CAClB,qBAAqB,EAAE;CACvB,iBAAiB,EAAE;CACnB,aAAa,EAAE;CACf,cAAc,EAAE;CAChB,uBAAuB,EAAE;CACzB,aAAa,EAAE;CACf,iBAAiB,EAAE;CACnB,+BAA+B,EAAE;CACjC,sBAAsB,EAAE;CACxB,kBAAkB,EAAE;CACpB,0BAA0B,EAAE;CAC7B,EAAE"}
|
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,34 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
+
import { LroOptions } from "@databricks/sdk-options/lro";
|
|
6
|
+
|
|
7
|
+
//#region src/v1/utils.d.ts
|
|
8
|
+
interface HttpCallOptions {
|
|
9
|
+
readonly request: HttpRequest;
|
|
10
|
+
readonly httpClient: HttpClient;
|
|
11
|
+
readonly logger: Logger;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* Translates public CallOptions to the internal Options shape accepted by
|
|
13
15
|
* execute(). Even though the shapes match today, this isolates the public
|
|
14
16
|
* API from the executor's internal type so they can diverge.
|
|
15
17
|
*/
|
|
16
|
-
|
|
18
|
+
declare function executeCall(call: (signal?: AbortSignal) => Promise<void>, options?: CallOptions): Promise<void>;
|
|
17
19
|
/**
|
|
18
20
|
* Sentinel thrown by a polling call to signal that the operation has not
|
|
19
21
|
* yet reached a terminal state. {@link executeWait} treats this error as
|
|
20
22
|
* retriable; any other error aborts the wait.
|
|
21
23
|
*/
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
+
declare class StillRunningError extends Error {}
|
|
24
25
|
/**
|
|
25
26
|
* Polls until the call returns without throwing {@link StillRunningError}.
|
|
26
27
|
* Abort and overall-deadline behavior come from the supplied LroOptions.
|
|
27
28
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
declare function executeWait(call: (signal?: AbortSignal) => Promise<void>, options?: LroOptions): Promise<void>;
|
|
30
|
+
declare function executeHttpCall(opts: HttpCallOptions): Promise<Uint8Array>;
|
|
31
|
+
declare function buildHttpRequest(method: string, url: string, headers: Headers, signal?: AbortSignal, body?: string | ReadableStream<Uint8Array>): HttpRequest;
|
|
32
|
+
declare function parseResponse<T>(body: Uint8Array, schema: z.ZodType<T>): T;
|
|
33
|
+
declare function marshalRequest(data: unknown, schema: z.ZodType): string;
|
|
34
|
+
declare function flattenQueryParams(prefix: string, value: unknown, params: URLSearchParams): void;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { HttpCallOptions, StillRunningError, buildHttpRequest, executeCall, executeHttpCall, executeWait, flattenQueryParams, marshalRequest, parseResponse };
|
|
34
37
|
//# 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":";;;;;;;UAqBiB,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;;;;;;cAgBU,iBAAA,SAA0B,KAAA;AAnBvC;;;;AAAA,iBAyBsB,WAAA,CACpB,IAAA,GAAO,MAAA,GAAS,WAAA,KAAgB,OAAA,QAChC,OAAA,GAAU,UAAA,GACT,OAAA;AAAA,iBAkCmB,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"}
|