@databricks/sdk-forecasting 0.1.0-dev.1 → 0.1.0-dev.3
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/client.d.ts +4 -3
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +6 -15
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/utils.d.ts +14 -2
- package/dist/v1/utils.d.ts.map +1 -1
- package/dist/v1/utils.js +19 -1
- package/dist/v1/utils.js.map +1 -1
- package/package.json +6 -5
- package/src/v1/client.ts +13 -21
- package/src/v1/utils.ts +27 -3
package/dist/v1/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CallOptions } from '@databricks/sdk-options/call';
|
|
2
2
|
import type { ClientOptions } from '@databricks/sdk-options/client';
|
|
3
|
-
import type {
|
|
3
|
+
import type { LroOptions } from '@databricks/sdk-options/lro';
|
|
4
|
+
import type { CreateForecastingExperimentRequest, ForecastingExperiment, GetForecastingExperimentRequest } from './model';
|
|
4
5
|
export declare class ForecastingClient {
|
|
5
6
|
private readonly host;
|
|
6
7
|
private readonly workspaceId;
|
|
@@ -9,7 +10,7 @@ export declare class ForecastingClient {
|
|
|
9
10
|
private readonly userAgent;
|
|
10
11
|
constructor(options: ClientOptions);
|
|
11
12
|
/** Creates a serverless forecasting experiment. Returns the experiment ID. */
|
|
12
|
-
createForecastingExperiment
|
|
13
|
+
private createForecastingExperiment;
|
|
13
14
|
createForecastingExperimentWaiter(req: CreateForecastingExperimentRequest, options?: CallOptions): Promise<CreateForecastingExperimentWaiter>;
|
|
14
15
|
/** Public RPC to get forecasting experiment */
|
|
15
16
|
getForecastingExperiment(req: GetForecastingExperimentRequest, options?: CallOptions): Promise<ForecastingExperiment>;
|
|
@@ -23,7 +24,7 @@ export declare class CreateForecastingExperimentWaiter {
|
|
|
23
24
|
*
|
|
24
25
|
* Throws if a failure state is reached.
|
|
25
26
|
*/
|
|
26
|
-
wait(options?:
|
|
27
|
+
wait(options?: LroOptions): Promise<ForecastingExperiment>;
|
|
27
28
|
/** Checks whether the operation has reached a terminal state. */
|
|
28
29
|
done(options?: CallOptions): Promise<boolean>;
|
|
29
30
|
}
|
package/dist/v1/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/v1/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/v1/client.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAC;AAa5D,OAAO,KAAK,EACV,kCAAkC,EAElC,qBAAqB,EACrB,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAcjB,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAI9B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACjD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAIhC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,OAAO,EAAE,aAAa;IAelC,8EAA8E;YAChE,2BAA2B;IAkCnC,iCAAiC,CACrC,GAAG,EAAE,kCAAkC,EACvC,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,iCAAiC,CAAC;IAU7C,+CAA+C;IACzC,wBAAwB,CAC5B,GAAG,EAAE,+BAA+B,EACpC,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC;CAuBlC;AAED,qBAAa,iCAAiC;IAE1C,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM;gBADZ,MAAM,EAAE,iBAAiB,EACjC,YAAY,EAAE,MAAM;IAG/B;;;;OAIG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAqChE,iEAAiE;IAC3D,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;CAsBpD"}
|
package/dist/v1/client.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
2
|
import { VERSION as AUTH_VERSION } from '@databricks/sdk-auth';
|
|
3
|
-
import { retryOn } from '@databricks/sdk-core/api';
|
|
4
3
|
import { createDefault } from '@databricks/sdk-core/clientinfo';
|
|
5
4
|
import { NoOpLogger } from '@databricks/sdk-core/logger';
|
|
6
5
|
import { newHttpClient } from './transport';
|
|
7
|
-
import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse, } from './utils';
|
|
6
|
+
import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse, executeWait, StillRunningError, } from './utils';
|
|
8
7
|
import pkgJson from '../../package.json' with { type: 'json' };
|
|
9
8
|
import { ForecastingExperiment_State, marshalCreateForecastingExperimentRequestSchema, unmarshalCreateForecastingExperimentResponseSchema, unmarshalForecastingExperimentSchema, } from './model';
|
|
10
9
|
// Package identity segment for this client to be used in the User-Agent header.
|
|
@@ -12,8 +11,6 @@ const PACKAGE_SEGMENT = {
|
|
|
12
11
|
key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
|
|
13
12
|
value: pkgJson.version,
|
|
14
13
|
};
|
|
15
|
-
class StillRunningError extends Error {
|
|
16
|
-
}
|
|
17
14
|
export class ForecastingClient {
|
|
18
15
|
host;
|
|
19
16
|
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
@@ -61,7 +58,7 @@ export class ForecastingClient {
|
|
|
61
58
|
};
|
|
62
59
|
await executeCall(call, options);
|
|
63
60
|
if (resp === undefined) {
|
|
64
|
-
throw new Error('
|
|
61
|
+
throw new Error('operation completed without a result.');
|
|
65
62
|
}
|
|
66
63
|
return resp;
|
|
67
64
|
}
|
|
@@ -92,7 +89,7 @@ export class ForecastingClient {
|
|
|
92
89
|
};
|
|
93
90
|
await executeCall(call, options);
|
|
94
91
|
if (resp === undefined) {
|
|
95
|
-
throw new Error('
|
|
92
|
+
throw new Error('operation completed without a result.');
|
|
96
93
|
}
|
|
97
94
|
return resp;
|
|
98
95
|
}
|
|
@@ -114,7 +111,7 @@ export class CreateForecastingExperimentWaiter {
|
|
|
114
111
|
const call = async (callSignal) => {
|
|
115
112
|
const pollResp = await this.client.getForecastingExperiment({
|
|
116
113
|
experimentId: this.experimentId,
|
|
117
|
-
},
|
|
114
|
+
}, callSignal !== undefined ? { signal: callSignal } : undefined);
|
|
118
115
|
const status = pollResp.state;
|
|
119
116
|
if (status === undefined) {
|
|
120
117
|
throw new Error('response missing required status field');
|
|
@@ -132,15 +129,9 @@ export class CreateForecastingExperimentWaiter {
|
|
|
132
129
|
throw new StillRunningError();
|
|
133
130
|
}
|
|
134
131
|
};
|
|
135
|
-
|
|
136
|
-
...(options?.signal !== undefined && { signal: options.signal }),
|
|
137
|
-
retrier: () => retryOn({}, (err) => {
|
|
138
|
-
return err instanceof StillRunningError;
|
|
139
|
-
}),
|
|
140
|
-
};
|
|
141
|
-
await executeCall(call, retryOptions);
|
|
132
|
+
await executeWait(call, options);
|
|
142
133
|
if (result === undefined) {
|
|
143
|
-
throw new Error('
|
|
134
|
+
throw new Error('operation completed without a result.');
|
|
144
135
|
}
|
|
145
136
|
return result;
|
|
146
137
|
}
|
package/dist/v1/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/v1/client.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,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|
1
|
-
import type { Call } from '@databricks/sdk-core/api';
|
|
2
1
|
import type { HttpClient, HttpRequest } from '@databricks/sdk-core/http';
|
|
3
2
|
import type { Logger } from '@databricks/sdk-core/logger';
|
|
4
3
|
import type { CallOptions } from '@databricks/sdk-options/call';
|
|
4
|
+
import type { LroOptions } from '@databricks/sdk-options/lro';
|
|
5
5
|
import type { z } from 'zod';
|
|
6
6
|
export interface HttpCallOptions {
|
|
7
7
|
readonly request: HttpRequest;
|
|
@@ -13,7 +13,19 @@ export interface HttpCallOptions {
|
|
|
13
13
|
* execute(). Even though the shapes match today, this isolates the public
|
|
14
14
|
* API from the executor's internal type so they can diverge.
|
|
15
15
|
*/
|
|
16
|
-
export declare function executeCall(call:
|
|
16
|
+
export declare function executeCall(call: (signal?: AbortSignal) => Promise<void>, options?: CallOptions): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Sentinel thrown by a polling call to signal that the operation has not
|
|
19
|
+
* yet reached a terminal state. {@link executeWait} treats this error as
|
|
20
|
+
* retriable; any other error aborts the wait.
|
|
21
|
+
*/
|
|
22
|
+
export declare class StillRunningError extends Error {
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Polls until the call returns without throwing {@link StillRunningError}.
|
|
26
|
+
* Abort and overall-deadline behavior come from the supplied LroOptions.
|
|
27
|
+
*/
|
|
28
|
+
export declare function executeWait(call: (signal?: AbortSignal) => Promise<void>, options?: LroOptions): Promise<void>;
|
|
17
29
|
export declare function executeHttpCall(opts: HttpCallOptions): Promise<Uint8Array>;
|
|
18
30
|
export declare function buildHttpRequest(method: string, url: string, headers: Headers, signal?: AbortSignal, body?: string | ReadableStream<Uint8Array>): HttpRequest;
|
|
19
31
|
export declare function parseResponse<T>(body: Uint8Array, schema: z.ZodType<T>): T;
|
package/dist/v1/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/v1/utils.ts"],"names":[],"m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AAW,CASb;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAI1E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,MAAM,CAEvE;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,eAAe,GACtB,IAAI,CAuBN"}
|
package/dist/v1/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
import { execute } from '@databricks/sdk-core/
|
|
2
|
+
import { execute, retryOn } from '@databricks/sdk-core/ops';
|
|
3
3
|
import { ApiError } from '@databricks/sdk-core/apierror';
|
|
4
4
|
import JSONBig from 'json-bigint';
|
|
5
5
|
// JSON codec that preserves int64 precision. On the way in, large integer
|
|
@@ -21,6 +21,24 @@ export async function executeCall(call, options) {
|
|
|
21
21
|
};
|
|
22
22
|
return execute(options?.signal, call, opts);
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Sentinel thrown by a polling call to signal that the operation has not
|
|
26
|
+
* yet reached a terminal state. {@link executeWait} treats this error as
|
|
27
|
+
* retriable; any other error aborts the wait.
|
|
28
|
+
*/
|
|
29
|
+
export class StillRunningError extends Error {
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Polls until the call returns without throwing {@link StillRunningError}.
|
|
33
|
+
* Abort and overall-deadline behavior come from the supplied LroOptions.
|
|
34
|
+
*/
|
|
35
|
+
export async function executeWait(call, options) {
|
|
36
|
+
const opts = {
|
|
37
|
+
...(options?.timeout !== undefined && { timeout: options.timeout }),
|
|
38
|
+
retrier: () => retryOn({}, (err) => err instanceof StillRunningError),
|
|
39
|
+
};
|
|
40
|
+
return execute(options?.signal, call, opts);
|
|
41
|
+
}
|
|
24
42
|
async function readAll(body) {
|
|
25
43
|
if (body === null) {
|
|
26
44
|
return new Uint8Array(0);
|
package/dist/v1/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/v1/utils.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAG/E,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/v1/utils.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAG/E,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAC,QAAQ,EAAC,MAAM,+BAA+B,CAAC;AASvD,OAAO,OAAO,MAAM,aAAa,CAAC;AAGlC,0EAA0E;AAC1E,6EAA6E;AAC7E,gEAAgE;AAChE,MAAM,UAAU,GAAG,OAAO,CAAC,EAAC,eAAe,EAAE,IAAI,EAAC,CAAC,CAAC;AAQpD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAA6C,EAC7C,OAAqB;IAErB,MAAM,IAAI,GAAY;QACpB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,IAAI,EAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAC,CAAC;QACjE,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,SAAS,IAAI;YACxC,WAAW,EAAE,OAAO,CAAC,WAAW;SACjC,CAAC;QACF,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,IAAI,EAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAC,CAAC;KAClE,CAAC;IACF,OAAO,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;CAAG;AAE/C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,CAAC;SAAM,IACL,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,OAAO,KAAK,KAAK,QAAQ,EACzB,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACvC,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,qCAAqC,OAAO,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@databricks/sdk-forecasting",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./v1": {
|
|
8
8
|
"types": "./dist/v1/index.d.ts",
|
|
9
|
-
"import": "./dist/v1/index.js"
|
|
9
|
+
"import": "./dist/v1/index.js",
|
|
10
|
+
"default": "./dist/v1/index.js"
|
|
10
11
|
}
|
|
11
12
|
},
|
|
12
13
|
"files": [
|
|
@@ -28,9 +29,9 @@
|
|
|
28
29
|
"author": "Databricks",
|
|
29
30
|
"license": "Apache-2.0",
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@databricks/sdk-auth": ">=0.1.0-dev.
|
|
32
|
-
"@databricks/sdk-core": ">=0.1.0-dev.
|
|
33
|
-
"@databricks/sdk-options": ">=0.1.0-dev.
|
|
32
|
+
"@databricks/sdk-auth": ">=0.1.0-dev.4 <1.0.0",
|
|
33
|
+
"@databricks/sdk-core": ">=0.1.0-dev.5 <1.0.0",
|
|
34
|
+
"@databricks/sdk-options": ">=0.1.0-dev.4 <1.0.0",
|
|
34
35
|
"@js-temporal/polyfill": "^0.5.0",
|
|
35
36
|
"json-bigint": "^1.0.0",
|
|
36
37
|
"zod": "^4.3.6"
|
package/src/v1/client.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import {VERSION as AUTH_VERSION} from '@databricks/sdk-auth';
|
|
4
|
-
import type {Call} from '@databricks/sdk-core/api';
|
|
5
|
-
import {retryOn} from '@databricks/sdk-core/api';
|
|
6
4
|
import {createDefault} from '@databricks/sdk-core/clientinfo';
|
|
7
5
|
import type {Logger} from '@databricks/sdk-core/logger';
|
|
8
6
|
import {NoOpLogger} from '@databricks/sdk-core/logger';
|
|
9
7
|
import type {CallOptions} from '@databricks/sdk-options/call';
|
|
10
8
|
import type {ClientOptions} from '@databricks/sdk-options/client';
|
|
9
|
+
import type {LroOptions} from '@databricks/sdk-options/lro';
|
|
11
10
|
import type {HttpClient} from '@databricks/sdk-core/http';
|
|
12
11
|
import {newHttpClient} from './transport';
|
|
13
12
|
import {
|
|
@@ -16,6 +15,8 @@ import {
|
|
|
16
15
|
executeHttpCall,
|
|
17
16
|
marshalRequest,
|
|
18
17
|
parseResponse,
|
|
18
|
+
executeWait,
|
|
19
|
+
StillRunningError,
|
|
19
20
|
} from './utils';
|
|
20
21
|
import pkgJson from '../../package.json' with {type: 'json'};
|
|
21
22
|
import type {
|
|
@@ -37,8 +38,6 @@ const PACKAGE_SEGMENT = {
|
|
|
37
38
|
value: pkgJson.version,
|
|
38
39
|
};
|
|
39
40
|
|
|
40
|
-
class StillRunningError extends Error {}
|
|
41
|
-
|
|
42
41
|
export class ForecastingClient {
|
|
43
42
|
private readonly host: string;
|
|
44
43
|
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
@@ -68,7 +67,7 @@ export class ForecastingClient {
|
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
/** Creates a serverless forecasting experiment. Returns the experiment ID. */
|
|
71
|
-
async createForecastingExperiment(
|
|
70
|
+
private async createForecastingExperiment(
|
|
72
71
|
req: CreateForecastingExperimentRequest,
|
|
73
72
|
options?: CallOptions
|
|
74
73
|
): Promise<CreateForecastingExperimentResponse> {
|
|
@@ -78,7 +77,7 @@ export class ForecastingClient {
|
|
|
78
77
|
marshalCreateForecastingExperimentRequestSchema
|
|
79
78
|
);
|
|
80
79
|
let resp: CreateForecastingExperimentResponse | undefined;
|
|
81
|
-
const call
|
|
80
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
82
81
|
const headers = new Headers({'Content-Type': 'application/json'});
|
|
83
82
|
if (this.workspaceId !== undefined) {
|
|
84
83
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -97,7 +96,7 @@ export class ForecastingClient {
|
|
|
97
96
|
};
|
|
98
97
|
await executeCall(call, options);
|
|
99
98
|
if (resp === undefined) {
|
|
100
|
-
throw new Error('
|
|
99
|
+
throw new Error('operation completed without a result.');
|
|
101
100
|
}
|
|
102
101
|
return resp;
|
|
103
102
|
}
|
|
@@ -122,7 +121,7 @@ export class ForecastingClient {
|
|
|
122
121
|
): Promise<ForecastingExperiment> {
|
|
123
122
|
const url = `${this.host}/api/2.0/automl/get-forecasting-experiment/${req.experimentId ?? ''}`;
|
|
124
123
|
let resp: ForecastingExperiment | undefined;
|
|
125
|
-
const call
|
|
124
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
126
125
|
const headers = new Headers();
|
|
127
126
|
if (this.workspaceId !== undefined) {
|
|
128
127
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -138,7 +137,7 @@ export class ForecastingClient {
|
|
|
138
137
|
};
|
|
139
138
|
await executeCall(call, options);
|
|
140
139
|
if (resp === undefined) {
|
|
141
|
-
throw new Error('
|
|
140
|
+
throw new Error('operation completed without a result.');
|
|
142
141
|
}
|
|
143
142
|
return resp;
|
|
144
143
|
}
|
|
@@ -155,15 +154,15 @@ export class CreateForecastingExperimentWaiter {
|
|
|
155
154
|
*
|
|
156
155
|
* Throws if a failure state is reached.
|
|
157
156
|
*/
|
|
158
|
-
async wait(options?:
|
|
157
|
+
async wait(options?: LroOptions): Promise<ForecastingExperiment> {
|
|
159
158
|
let result: ForecastingExperiment | undefined;
|
|
160
159
|
|
|
161
|
-
const call
|
|
160
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
162
161
|
const pollResp = await this.client.getForecastingExperiment(
|
|
163
162
|
{
|
|
164
163
|
experimentId: this.experimentId,
|
|
165
164
|
},
|
|
166
|
-
|
|
165
|
+
callSignal !== undefined ? {signal: callSignal} : undefined
|
|
167
166
|
);
|
|
168
167
|
|
|
169
168
|
const status = pollResp.state;
|
|
@@ -185,16 +184,9 @@ export class CreateForecastingExperimentWaiter {
|
|
|
185
184
|
}
|
|
186
185
|
};
|
|
187
186
|
|
|
188
|
-
|
|
189
|
-
...(options?.signal !== undefined && {signal: options.signal}),
|
|
190
|
-
retrier: () =>
|
|
191
|
-
retryOn({}, (err: Error) => {
|
|
192
|
-
return err instanceof StillRunningError;
|
|
193
|
-
}),
|
|
194
|
-
};
|
|
195
|
-
await executeCall(call, retryOptions);
|
|
187
|
+
await executeWait(call, options);
|
|
196
188
|
if (result === undefined) {
|
|
197
|
-
throw new Error('
|
|
189
|
+
throw new Error('operation completed without a result.');
|
|
198
190
|
}
|
|
199
191
|
return result;
|
|
200
192
|
}
|
package/src/v1/utils.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
import {execute} from '@databricks/sdk-core/
|
|
3
|
+
import type {Options} from '@databricks/sdk-core/ops';
|
|
4
|
+
import {execute, retryOn} from '@databricks/sdk-core/ops';
|
|
5
5
|
import {ApiError} from '@databricks/sdk-core/apierror';
|
|
6
6
|
import type {
|
|
7
7
|
HttpClient,
|
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
} from '@databricks/sdk-core/http';
|
|
11
11
|
import type {Logger} from '@databricks/sdk-core/logger';
|
|
12
12
|
import type {CallOptions} from '@databricks/sdk-options/call';
|
|
13
|
+
import type {LroOptions} from '@databricks/sdk-options/lro';
|
|
13
14
|
import JSONBig from 'json-bigint';
|
|
14
15
|
import type {z} from 'zod';
|
|
15
16
|
|
|
@@ -30,7 +31,7 @@ export interface HttpCallOptions {
|
|
|
30
31
|
* API from the executor's internal type so they can diverge.
|
|
31
32
|
*/
|
|
32
33
|
export async function executeCall(
|
|
33
|
-
call:
|
|
34
|
+
call: (signal?: AbortSignal) => Promise<void>,
|
|
34
35
|
options?: CallOptions
|
|
35
36
|
): Promise<void> {
|
|
36
37
|
const opts: Options = {
|
|
@@ -43,6 +44,29 @@ export async function executeCall(
|
|
|
43
44
|
return execute(options?.signal, call, opts);
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Sentinel thrown by a polling call to signal that the operation has not
|
|
49
|
+
* yet reached a terminal state. {@link executeWait} treats this error as
|
|
50
|
+
* retriable; any other error aborts the wait.
|
|
51
|
+
*/
|
|
52
|
+
export class StillRunningError extends Error {}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Polls until the call returns without throwing {@link StillRunningError}.
|
|
56
|
+
* Abort and overall-deadline behavior come from the supplied LroOptions.
|
|
57
|
+
*/
|
|
58
|
+
export async function executeWait(
|
|
59
|
+
call: (signal?: AbortSignal) => Promise<void>,
|
|
60
|
+
options?: LroOptions
|
|
61
|
+
): Promise<void> {
|
|
62
|
+
const opts: Options = {
|
|
63
|
+
...(options?.timeout !== undefined && {timeout: options.timeout}),
|
|
64
|
+
retrier: () =>
|
|
65
|
+
retryOn({}, (err: Error) => err instanceof StillRunningError),
|
|
66
|
+
};
|
|
67
|
+
return execute(options?.signal, call, opts);
|
|
68
|
+
}
|
|
69
|
+
|
|
46
70
|
async function readAll(
|
|
47
71
|
body: ReadableStream<Uint8Array> | null
|
|
48
72
|
): Promise<Uint8Array> {
|