Skip to content

Commit 6749319

Browse files
committed
fix deprecation warnings
1 parent 4c41fb6 commit 6749319

16 files changed

Lines changed: 50 additions & 56 deletions

examples/blueprint-with-build-context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export async function recipe(ctx: RecipeContext): Promise<RecipeOutput> {
7070
dockerfile: 'FROM ubuntu:22.04\nWORKDIR /app\nCOPY . .',
7171
build_context: storageObject,
7272
},
73-
{ polling: { timeoutMs: BLUEPRINT_POLL_TIMEOUT_MS } },
73+
{ longPoll: { timeoutMs: BLUEPRINT_POLL_TIMEOUT_MS } },
7474
);
7575
cleanup.add(`blueprint:${blueprint.id}`, () => sdk.blueprint.fromId(blueprint.id).delete());
7676

examples/devbox-from-blueprint-lifecycle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export async function recipe(ctx: RecipeContext): Promise<RecipeOutput> {
4949
name: uniqueName('example-blueprint'),
5050
dockerfile: 'FROM ubuntu:22.04\nRUN echo "Hello from your blueprint"',
5151
},
52-
{ polling: { timeoutMs: BLUEPRINT_POLL_TIMEOUT_MS } },
52+
{ longPoll: { timeoutMs: BLUEPRINT_POLL_TIMEOUT_MS } },
5353
);
5454
cleanup.add(`blueprint:${blueprint.id}`, () => sdk.blueprint.fromId(blueprint.id).delete());
5555

src/resources/scenarios/scenarios.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
ScenariosCursorIDPage,
2424
type ScenariosCursorIDPageParams,
2525
} from '../../pagination';
26-
import { PollingOptions } from '@runloop/api-client/lib/polling';
26+
import { LongPollRequestOptions } from '@runloop/api-client/lib/polling';
2727
import { DevboxView } from '../devboxes';
2828

2929
export class Scenarios extends APIResource {
@@ -132,7 +132,7 @@ export class Scenarios extends APIResource {
132132
*/
133133
async startRunAndAwaitEnvReady(
134134
body: ScenarioStartRunParams,
135-
options?: Core.RequestOptions & { polling?: Partial<PollingOptions<DevboxView>> },
135+
options?: LongPollRequestOptions<DevboxView>,
136136
): Promise<ScenarioRunView> {
137137
const run = await this.startRun(body, options);
138138
await this._client.devboxes.awaitRunning(run.devbox_id, options);

src/sdk.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -726,14 +726,12 @@ export class BlueprintOps {
726726
/**
727727
* Create a new blueprint.
728728
* @param {BlueprintCreateParams} params - Parameters for creating the blueprint.
729-
* @param {Core.RequestOptions & { polling?: Partial<PollingOptions<RunloopAPI.Blueprints.BlueprintView>> }} [options] - Request options including polling configuration.
729+
* @param {LongPollRequestOptions<RunloopAPI.Blueprints.BlueprintView>} [options] - Request options with optional long-poll configuration.
730730
* @returns {Promise<Blueprint>} A {@link Blueprint} instance.
731731
*/
732732
async create(
733733
params: BlueprintCreateParams,
734-
options?: Core.RequestOptions & {
735-
polling?: Partial<PollingOptions<RunloopAPI.Blueprints.BlueprintView>>;
736-
},
734+
options?: LongPollRequestOptions<RunloopAPI.Blueprints.BlueprintView>,
737735
): Promise<Blueprint> {
738736
return Blueprint.create(this.client, params, options);
739737
}

src/sdk/blueprint.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type {
66
BlueprintBuildLogsListView,
77
} from '../resources/blueprints';
88
import type { DevboxCreateParams, DevboxView } from '../resources/devboxes/devboxes';
9-
import type { PollingOptions } from '../lib/polling';
9+
import type { LongPollRequestOptions } from '../lib/polling';
1010
import type { IgnoreMatcher } from '../lib/ignore-matcher';
1111
import { Devbox } from './devbox';
1212
import { StorageObject } from './storage-object';
@@ -80,15 +80,13 @@ export class Blueprint {
8080
*
8181
* @param {Runloop} client - The Runloop client instance
8282
* @param {CreateParams} params - Parameters for creating the blueprint
83-
* @param {Core.RequestOptions & { polling?: Partial<PollingOptions<BlueprintView>> }} [options] - Request options with optional polling configuration
83+
* @param {LongPollRequestOptions<BlueprintView>} [options] - Request options with optional long-poll configuration
8484
* @returns {Promise<Blueprint>} A {@link Blueprint} instance with completed build
8585
*/
8686
static async create(
8787
client: Runloop,
8888
params: CreateParams,
89-
options?: Core.RequestOptions & {
90-
polling?: Partial<PollingOptions<BlueprintView>>;
91-
},
89+
options?: LongPollRequestOptions<BlueprintView>,
9290
): Promise<Blueprint> {
9391
const { build_context, build_context_dir, ...other } = params as any;
9492
let rawParams: BlueprintCreateParams;
@@ -214,14 +212,12 @@ export class Blueprint {
214212
* @private
215213
*
216214
* @param {Omit<DevboxCreateParams, 'blueprint_id' | 'snapshot_id' | 'blueprint_name'>} [params] - Additional devbox creation parameters (optional)
217-
* @param {Core.RequestOptions & { polling?: Partial<PollingOptions<DevboxView>> }} [options] - Request options with optional polling configuration
215+
* @param {LongPollRequestOptions<DevboxView>} [options] - Request options with optional long-poll configuration
218216
* @returns {Promise<Devbox>} A new {@link Devbox} instance created from this blueprint
219217
*/
220218
async createDevbox(
221219
params?: Omit<DevboxCreateParams, 'blueprint_id' | 'snapshot_id' | 'blueprint_name'>,
222-
options?: Core.RequestOptions & {
223-
polling?: Partial<PollingOptions<DevboxView>>;
224-
},
220+
options?: LongPollRequestOptions<DevboxView>,
225221
): Promise<Devbox> {
226222
const createParams: DevboxCreateParams = {
227223
...params,

src/sdk/scenario.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type {
66
ScenarioStartRunParams,
77
} from '../resources/scenarios/scenarios';
88
import type { DevboxView } from '../resources/devboxes/devboxes';
9-
import { PollingOptions } from '../lib/polling';
9+
import { LongPollRequestOptions } from '../lib/polling';
1010
import { ScenarioRun } from './scenario-run';
1111

1212
/**
@@ -177,12 +177,12 @@ export class Scenario {
177177
* ```
178178
*
179179
* @param {ScenarioRunParams} [params] - Run parameters
180-
* @param {Core.RequestOptions & { polling?: Partial<PollingOptions<DevboxView>> }} [options] - Request options with optional polling config
180+
* @param {LongPollRequestOptions<DevboxView>} [options] - Request options with optional long-poll config
181181
* @returns {Promise<ScenarioRun>} ScenarioRun instance with ready devbox
182182
*/
183183
async run(
184184
params?: ScenarioRunParams,
185-
options?: Core.RequestOptions & { polling?: Partial<PollingOptions<DevboxView>> },
185+
options?: LongPollRequestOptions<DevboxView>,
186186
): Promise<ScenarioRun> {
187187
const runView = await this.client.scenarios.startRunAndAwaitEnvReady(
188188
{ scenario_id: this._id, ...params },

tests/smoketests/blueprints.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('smoketest: blueprints', () => {
2424
name: blueprintName,
2525
},
2626
{
27-
polling: { maxAttempts: 180, pollingIntervalMs: 5_000, timeoutMs: 30 * 60 * 1000 },
27+
longPoll: { timeoutMs: 30 * 60 * 1000 },
2828
},
2929
);
3030
expect(created.status).toBe('build_complete');
@@ -101,7 +101,7 @@ describe('smoketest: blueprints', () => {
101101
},
102102
},
103103
{
104-
polling: { maxAttempts: 180, pollingIntervalMs: 5_000, timeoutMs: 30 * 60 * 1000 },
104+
longPoll: { timeoutMs: 30 * 60 * 1000 },
105105
},
106106
);
107107

tests/smoketests/devboxes.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('smoketest: devboxes', () => {
4040
);
4141

4242
test.concurrent(
43-
'create devbox with authenticated tunnel in create params (deprecated polling path)',
43+
'create devbox with authenticated tunnel in create params',
4444
async () => {
4545
let devbox: DevboxView | undefined;
4646
try {
@@ -51,7 +51,7 @@ describe('smoketest: devboxes', () => {
5151
tunnel: { auth_mode: 'authenticated' },
5252
},
5353
{
54-
polling: { timeoutMs: 20 * 60 * 1000 },
54+
longPoll: { timeoutMs: 20 * 60 * 1000 },
5555
},
5656
);
5757

@@ -177,14 +177,14 @@ describe('smoketest: devboxes', () => {
177177
SHORT_TIMEOUT,
178178
);
179179

180-
test('await running (createAndAwaitRunning, deprecated polling path)', async () => {
180+
test('await running (createAndAwaitRunning)', async () => {
181181
const created = await client.devboxes.createAndAwaitRunning(
182182
{
183183
name: uniqueName('smoketest-devbox2'),
184184
launch_parameters: { resource_size_request: 'X_SMALL', keep_alive_time_seconds: 60 * 5 }, // 5 minutes
185185
},
186186
{
187-
polling: { timeoutMs: 20 * 60 * 1000 },
187+
longPoll: { timeoutMs: 20 * 60 * 1000 },
188188
},
189189
);
190190
expect(created.status).toBe('running');
@@ -230,7 +230,7 @@ describe('smoketest: devboxes', () => {
230230
);
231231

232232
test.concurrent(
233-
'createAndAwaitRunning timeout (deprecated polling path)',
233+
'createAndAwaitRunning timeout',
234234
async () => {
235235
await expect(
236236
client.devboxes.createAndAwaitRunning(
@@ -239,7 +239,7 @@ describe('smoketest: devboxes', () => {
239239
launch_parameters: { launch_commands: ['sleep 70'], keep_alive_time_seconds: 30 },
240240
},
241241
{
242-
polling: { timeoutMs: 100 },
242+
longPoll: { timeoutMs: 100 },
243243
},
244244
),
245245
).rejects.toThrow();

tests/smoketests/executions.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ describe('smoketest: executions', () => {
2929
SHORT_TIMEOUT,
3030
);
3131

32-
test('execute async and await completion (deprecated polling path)', async () => {
32+
test('execute async and await completion (long-poll path)', async () => {
3333
const started = await client.devboxes.executions.executeAsync(devboxId!, {
3434
command: 'echo hello && sleep 1',
3535
});
3636
execId = started.execution_id;
3737
const completed = await client.devboxes.executions.awaitCompleted(devboxId!, execId!, {
38-
polling: { timeoutMs: 10 * 60 * 1000 },
38+
longPoll: { timeoutMs: 10 * 60 * 1000 },
3939
});
4040
expect(completed.status).toBe('completed');
4141
});

tests/smoketests/object-oriented/blueprint.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('smoketest: object-oriented blueprint', () => {
1616
dockerfile: 'FROM ubuntu:22.04\nRUN apt-get update && apt-get install -y curl',
1717
system_setup_commands: ['echo "Blueprint setup complete"'],
1818
},
19-
{ polling: { timeoutMs: 10 * 60 * 1000 } },
19+
{ longPoll: { timeoutMs: 10 * 60 * 1000 } },
2020
);
2121
blueprintId = blueprint.id;
2222
}, LONG_TIMEOUT);
@@ -144,7 +144,7 @@ WORKDIR /app
144144
COPY . .`,
145145
build_context: storageObject,
146146
},
147-
{ polling: { timeoutMs: 10 * 60 * 1000 } },
147+
{ longPoll: { timeoutMs: 10 * 60 * 1000 } },
148148
);
149149

150150
expect(blueprint).toBeDefined();
@@ -226,7 +226,7 @@ WORKDIR /app
226226
COPY . .`,
227227
build_context_dir: contextDir,
228228
},
229-
{ polling: { timeoutMs: 10 * 60 * 1000 } },
229+
{ longPoll: { timeoutMs: 10 * 60 * 1000 } },
230230
);
231231

232232
expect(blueprint).toBeDefined();
@@ -288,7 +288,7 @@ COPY . .`,
288288
name: uniqueName('sdk-blueprint-retrieve'),
289289
dockerfile: 'FROM ubuntu:22.04',
290290
},
291-
{ polling: { timeoutMs: 10 * 60 * 1000 } },
291+
{ longPoll: { timeoutMs: 10 * 60 * 1000 } },
292292
);
293293
expect(blueprint?.id).toBeTruthy();
294294

@@ -326,7 +326,7 @@ COPY . .`,
326326
dockerfile: 'FROM ubuntu:22.04\nRUN apt-get update',
327327
network_policy_id: policy.id,
328328
},
329-
{ polling: { timeoutMs: 10 * 60 * 1000 } },
329+
{ longPoll: { timeoutMs: 10 * 60 * 1000 } },
330330
);
331331

332332
expect(blueprint).toBeDefined();
@@ -371,7 +371,7 @@ COPY . .`,
371371
network_policy_id: policy.id,
372372
},
373373
},
374-
{ polling: { timeoutMs: 10 * 60 * 1000 } },
374+
{ longPoll: { timeoutMs: 10 * 60 * 1000 } },
375375
);
376376

377377
expect(blueprint).toBeDefined();

0 commit comments

Comments
 (0)