Skip to content

Commit

Permalink
feat: get{Script,Flow}ArgsSchema helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
invakid404 committed Nov 28, 2024
1 parent dead4c3 commit dead3c9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/generator/flows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ const preamble = dedent`
return wmill.runFlowAsync(flowPath, schema.parse(args));
};
export const getFlowArgsSchema = <Path extends keyof typeof ${mapName}>(
flowPath: Path
) => {
return ${mapName}[flowPath];
}
`;

export const generateFlows = async () => {
Expand Down
6 changes: 6 additions & 0 deletions src/generator/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ const preamble = dedent`
return wmill.runScriptAsync(scriptPath, null, schema.parse(args));
};
export const getScriptArgsSchema = <Path extends keyof typeof ${mapName}>(
scriptPath: Path
) => {
return ${mapName}[scriptPath];
}
`;

export const generateScripts = async () => {
Expand Down

0 comments on commit dead3c9

Please sign in to comment.