Skip to content

Latest commit

 

History

History
112 lines (82 loc) · 4.76 KB

nested-stepfunctions.md

File metadata and controls

112 lines (82 loc) · 4.76 KB

call state machine with await

Open in playground

export const main = asl.deploy.asStateMachine(async () => {
  const name = await childStateMachine({
    firstName: "Santa",
    lastName: "Claus",
  });
  return name;
});

export const childStateMachine = asl.deploy.asStateMachine(
  async (input: Arguments) => {
    return `${input.firstName} ${input.lastName}`;
  }
);

interface Arguments {
  firstName: string;
  lastName: string;
}

call state machine pass reference

Open in playground

export const main = asl.deploy.asStateMachine(async () => {
  const args = { firstName: "Santa", lastName: "Claus" };
  const name = await childStateMachine(args);
  return name;
});

export const childStateMachine = asl.deploy.asStateMachine(
  async (input: Arguments) => {
    return `${input.firstName} ${input.lastName}`;
  }
);

interface Arguments {
  firstName: string;
  lastName: string;
}

call state machine no await

Open in playground

export const main = asl.deploy.asStateMachine(async () => {
  childStateMachine({ firstName: "Santa", lastName: "Claus" });
});

export const childStateMachine = asl.deploy.asStateMachine(
  async (input: Arguments) => {
    return `${input.firstName} ${input.lastName}`;
  }
);

interface Arguments {
  firstName: string;
  lastName: string;
}

call lambda with await

Open in playground

export const main = asl.deploy.asStateMachine(async () => {
  const name = await childLambda({ firstName: "Santa", lastName: "Claus" });
  return name;
});

interface Arguments {
  firstName: string;
  lastName: string;
}

not awaited void expression

Open in playground

export const main = asl.deploy.asStateMachine(async () => {
  void childStateMachine({ firstName: "Santa", lastName: "Claus" });
});

export const childStateMachine = asl.deploy.asStateMachine(
  async (input: Arguments) => {
    return `${input.firstName} ${input.lastName}`;
  }
);

interface Arguments {
  firstName: string;
  lastName: string;
}