Skip to content

Commit d4b7135

Browse files
committed
Some type fixes for the retrieve
1 parent 0a97f3a commit d4b7135

File tree

2 files changed

+7
-24
lines changed

2 files changed

+7
-24
lines changed

packages/core/src/v3/apiClient/index.ts

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@ import {
1212
CreateEnvironmentVariableRequestBody,
1313
CreateScheduleOptions,
1414
CreateUploadPayloadUrlResponseBody,
15-
CreateWaitpointHttpCallbackResponseBody,
1615
CreateWaitpointTokenRequestBody,
1716
CreateWaitpointTokenResponseBody,
1817
DeletedScheduleObject,
1918
EnvironmentVariableResponseBody,
20-
EnvironmentVariableValue,
2119
EnvironmentVariableWithSecret,
22-
EnvironmentVariables,
2320
ListQueueOptions,
2421
ListRunResponseItem,
2522
ListScheduleOptions,
@@ -43,8 +40,10 @@ import {
4340
WaitpointRetrieveTokenResponse,
4441
WaitpointTokenItem,
4542
} from "../schemas/index.js";
43+
import { AsyncIterableStream } from "../streams/asyncIterableStream.js";
4644
import { taskContext } from "../task-context-api.js";
4745
import { AnyRunTypes, TriggerJwtOptions } from "../types/tasks.js";
46+
import { Prettify } from "../types/utils.js";
4847
import {
4948
AnyZodFetchOptions,
5049
ApiPromise,
@@ -64,9 +63,9 @@ import {
6463
RunShape,
6564
RunStreamCallback,
6665
RunSubscription,
66+
SSEStreamSubscriptionFactory,
6767
TaskRunShape,
6868
runShapeStream,
69-
SSEStreamSubscriptionFactory,
7069
} from "./runStream.js";
7170
import {
7271
CreateEnvironmentVariableParams,
@@ -77,8 +76,6 @@ import {
7776
SubscribeToRunsQueryParams,
7877
UpdateEnvironmentVariableParams,
7978
} from "./types.js";
80-
import { AsyncIterableStream } from "../streams/asyncIterableStream.js";
81-
import { Prettify } from "../types/utils.js";
8279

8380
export type CreateWaitpointTokenResponse = Prettify<
8481
CreateWaitpointTokenResponseBody & {
@@ -791,24 +788,6 @@ export class ApiClient {
791788
);
792789
}
793790

794-
createWaitpointHttpCallback(
795-
options: CreateWaitpointTokenRequestBody,
796-
requestOptions?: ZodFetchOptions
797-
) {
798-
return zodfetch(
799-
CreateWaitpointHttpCallbackResponseBody,
800-
`${this.baseUrl}/engine/v1/waitpoints/http-callback`,
801-
{
802-
method: "POST",
803-
headers: this.#getHeaders(false),
804-
body: JSON.stringify(options),
805-
},
806-
{
807-
...mergeRequestOptions(this.defaultRequestOptions, requestOptions),
808-
}
809-
) as ApiPromise<CreateWaitpointHttpCallbackResponseBody>;
810-
}
811-
812791
async waitForDuration(
813792
runId: string,
814793
body: WaitForDurationRequestBody,

packages/trigger-sdk/src/v3/wait.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ function listTokens(
176176
*/
177177
export type WaitpointRetrievedToken<T> = {
178178
id: string;
179+
/** A URL that you can make a POST request to in order to complete the waitpoint. */
180+
url: string;
179181
status: WaitpointTokenStatus;
180182
completedAt?: Date;
181183
timeoutAt?: Date;
@@ -229,6 +231,7 @@ async function retrieveToken<T>(
229231
},
230232
onResponseBody: (body: WaitpointRetrieveTokenResponse, span) => {
231233
span.setAttribute("id", body.id);
234+
span.setAttribute("url", body.url);
232235
span.setAttribute("status", body.status);
233236
if (body.completedAt) {
234237
span.setAttribute("completedAt", body.completedAt.toISOString());
@@ -269,6 +272,7 @@ async function retrieveToken<T>(
269272

270273
return {
271274
id: result.id,
275+
url: result.url,
272276
status: result.status,
273277
completedAt: result.completedAt,
274278
timeoutAt: result.timeoutAt,

0 commit comments

Comments
 (0)