Skip to content

Commit d21003c

Browse files
committed
machinePreset -> machine
1 parent 60e12cb commit d21003c

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

.changeset/gold-melons-fetch.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ Add support for specifying machine preset at trigger time. Works with any trigge
1010
await childTask.trigger({ message: "Hello, world!" });
1111

1212
// This will override the task's machine preset and any defaults. Works with all trigger functions.
13-
await childTask.trigger({ message: "Hello, world!" }, { machinePreset: "small-2x" });
14-
await childTask.triggerAndWait({ message: "Hello, world!" }, { machinePreset: "small-2x" });
13+
await childTask.trigger({ message: "Hello, world!" }, { machine: "small-2x" });
14+
await childTask.triggerAndWait({ message: "Hello, world!" }, { machine: "small-2x" });
1515

1616
await childTask.batchTrigger([
17-
{ payload: { message: "Hello, world!" }, options: { machinePreset: "micro" } },
18-
{ payload: { message: "Hello, world!" }, options: { machinePreset: "large-1x" } },
17+
{ payload: { message: "Hello, world!" }, options: { machine: "micro" } },
18+
{ payload: { message: "Hello, world!" }, options: { machine: "large-1x" } },
1919
]);
2020
await childTask.batchTriggerAndWait([
21-
{ payload: { message: "Hello, world!" }, options: { machinePreset: "micro" } },
22-
{ payload: { message: "Hello, world!" }, options: { machinePreset: "large-1x" } },
21+
{ payload: { message: "Hello, world!" }, options: { machine: "micro" } },
22+
{ payload: { message: "Hello, world!" }, options: { machine: "large-1x" } },
2323
]);
2424

2525
await tasks.trigger<typeof childTask>(
2626
"child",
2727
{ message: "Hello, world!" },
28-
{ machinePreset: "small-2x" }
28+
{ machine: "small-2x" }
2929
);
3030
await tasks.batchTrigger<typeof childTask>("child", [
31-
{ payload: { message: "Hello, world!" }, options: { machinePreset: "micro" } },
32-
{ payload: { message: "Hello, world!" }, options: { machinePreset: "large-1x" } },
31+
{ payload: { message: "Hello, world!" }, options: { machine: "micro" } },
32+
{ payload: { message: "Hello, world!" }, options: { machine: "large-1x" } },
3333
]);
3434
```

apps/webapp/app/v3/services/triggerTask.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ export class TriggerTaskService extends BaseService {
415415
: undefined,
416416
runTags: bodyTags,
417417
oneTimeUseToken: options.oneTimeUseToken,
418-
machinePreset: body.options?.machinePreset,
418+
machinePreset: body.options?.machine,
419419
},
420420
});
421421

packages/core/src/v3/schemas/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export const TriggerTaskRequestBody = z.object({
9292
metadata: z.any(),
9393
metadataType: z.string().optional(),
9494
maxDuration: z.number().optional(),
95-
machinePreset: MachinePresetName.optional(),
95+
machine: MachinePresetName.optional(),
9696
})
9797
.optional(),
9898
});
@@ -133,7 +133,7 @@ export const BatchTriggerTaskItem = z.object({
133133
metadataType: z.string().optional(),
134134
maxDuration: z.number().optional(),
135135
parentAttempt: z.string().optional(),
136-
machinePreset: MachinePresetName.optional(),
136+
machine: MachinePresetName.optional(),
137137
})
138138
.optional(),
139139
});

packages/core/src/v3/types/tasks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ export type TriggerOptions = {
780780
/**
781781
* The machine preset to use for this run. This will override the task's machine preset and any defaults.
782782
*/
783-
machinePreset?: MachinePresetName;
783+
machine?: MachinePresetName;
784784
};
785785

786786
export type TriggerAndWaitOptions = Omit<TriggerOptions, "idempotencyKey" | "idempotencyKeyTTL">;

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ import type {
6363
TaskOutputHandle,
6464
TaskPayload,
6565
TaskRunResult,
66-
TaskRunResultFromTask,
6766
TaskSchema,
6867
TaskWithSchema,
6968
TaskWithSchemaOptions,
@@ -75,6 +74,7 @@ import type {
7574
TriggerOptions,
7675
AnyTaskRunResult,
7776
BatchTriggerAndWaitOptions,
77+
BatchTriggerTaskV2RequestBody,
7878
} from "@trigger.dev/core/v3";
7979

8080
export type {
@@ -613,9 +613,9 @@ export async function batchTriggerById<TTask extends AnyTask>(
613613
parentAttempt: taskContext.ctx?.attempt.id,
614614
metadata: item.options?.metadata,
615615
maxDuration: item.options?.maxDuration,
616-
machinePreset: item.options?.machinePreset,
616+
machine: item.options?.machine,
617617
},
618-
};
618+
} satisfies BatchTriggerTaskV2RequestBody["items"][0];
619619
})
620620
),
621621
},
@@ -787,9 +787,9 @@ export async function batchTriggerByIdAndWait<TTask extends AnyTask>(
787787
maxAttempts: item.options?.maxAttempts,
788788
metadata: item.options?.metadata,
789789
maxDuration: item.options?.maxDuration,
790-
machinePreset: item.options?.machinePreset,
790+
machine: item.options?.machine,
791791
},
792-
};
792+
} satisfies BatchTriggerTaskV2RequestBody["items"][0];
793793
})
794794
),
795795
dependentAttempt: ctx.attempt.id,
@@ -949,9 +949,9 @@ export async function batchTriggerTasks<TTasks extends readonly AnyTask[]>(
949949
parentAttempt: taskContext.ctx?.attempt.id,
950950
metadata: item.options?.metadata,
951951
maxDuration: item.options?.maxDuration,
952-
machinePreset: item.options?.machinePreset,
952+
machine: item.options?.machine,
953953
},
954-
};
954+
} satisfies BatchTriggerTaskV2RequestBody["items"][0];
955955
})
956956
),
957957
},
@@ -1125,9 +1125,9 @@ export async function batchTriggerAndWaitTasks<TTasks extends readonly AnyTask[]
11251125
maxAttempts: item.options?.maxAttempts,
11261126
metadata: item.options?.metadata,
11271127
maxDuration: item.options?.maxDuration,
1128-
machinePreset: item.options?.machinePreset,
1128+
machine: item.options?.machine,
11291129
},
1130-
};
1130+
} satisfies BatchTriggerTaskV2RequestBody["items"][0];
11311131
})
11321132
),
11331133
dependentAttempt: ctx.attempt.id,
@@ -1204,7 +1204,7 @@ async function trigger_internal<TRunTypes extends AnyRunTypes>(
12041204
parentAttempt: taskContext.ctx?.attempt.id,
12051205
metadata: options?.metadata,
12061206
maxDuration: options?.maxDuration,
1207-
machinePreset: options?.machinePreset,
1207+
machine: options?.machine,
12081208
},
12091209
},
12101210
{
@@ -1264,9 +1264,9 @@ async function batchTrigger_internal<TRunTypes extends AnyRunTypes>(
12641264
parentAttempt: taskContext.ctx?.attempt.id,
12651265
metadata: item.options?.metadata,
12661266
maxDuration: item.options?.maxDuration,
1267-
machinePreset: item.options?.machinePreset,
1267+
machine: item.options?.machine,
12681268
},
1269-
};
1269+
} satisfies BatchTriggerTaskV2RequestBody["items"][0];
12701270
})
12711271
),
12721272
},
@@ -1358,7 +1358,7 @@ async function triggerAndWait_internal<TIdentifier extends string, TPayload, TOu
13581358
maxAttempts: options?.maxAttempts,
13591359
metadata: options?.metadata,
13601360
maxDuration: options?.maxDuration,
1361-
machinePreset: options?.machinePreset,
1361+
machine: options?.machine,
13621362
},
13631363
},
13641364
{},
@@ -1435,9 +1435,9 @@ async function batchTriggerAndWait_internal<TIdentifier extends string, TPayload
14351435
maxAttempts: item.options?.maxAttempts,
14361436
metadata: item.options?.metadata,
14371437
maxDuration: item.options?.maxDuration,
1438-
machinePreset: item.options?.machinePreset,
1438+
machine: item.options?.machine,
14391439
},
1440-
};
1440+
} satisfies BatchTriggerTaskV2RequestBody["items"][0];
14411441
})
14421442
),
14431443
dependentAttempt: ctx.attempt.id,

0 commit comments

Comments
 (0)