Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions alchemy/src/cloudflare/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,10 @@ const _Worker = Resource(
binding.type === "workflow" &&
(!binding.scriptName || binding.scriptName === workerName)
) {
if (!binding.workflowName) {
binding.workflowName = this.scope
.createPhysicalName(binding.id, "-", 64);
}
workflows.push(binding);
} else if (
binding.type === "durable_object_namespace" &&
Expand Down
9 changes: 4 additions & 5 deletions alchemy/src/cloudflare/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface WorkflowProps {
*
* @maxLength 64
* @minLength 1
* @default - className if provided, otherwise id
* @default - ${app}-${id}-${stage}
*/
workflowName?: string;
/**
Expand Down Expand Up @@ -56,7 +56,7 @@ export type Workflow<PARAMS = unknown> = {
*/
_PARAMS: PARAMS;
id: string;
workflowName: string;
workflowName?: string;
className: string;
scriptName?: string;
limits?: {
Expand Down Expand Up @@ -84,14 +84,13 @@ export function Workflow<PARAMS = unknown>(
id: string,
props: WorkflowProps = {},
): Workflow<PARAMS> {
const workflowName = props.workflowName ?? props.className ?? id;
const className = props.className ?? workflowName;
const className = props.className ?? props.workflowName ?? id;

return {
type: "workflow",
_PARAMS: undefined!,
id,
workflowName,
workflowName: props.workflowName,
className,
scriptName: props.scriptName,
limits: props.limits,
Expand Down
Loading