| 149 | } |
| 150 | |
| 151 | async function runWorkflow( |
| 152 | client: Client, |
| 153 | definition: WorkflowDefinition, |
| 154 | workflowRecordId: string, |
| 155 | fileId: string, |
| 156 | ): Promise<{ runId: string; result: unknown }> { |
| 157 | const temporalWorkflowId = `shipsec-run-${randomUUID()}`; |
| 158 | const taskQueue = process.env.TEMPORAL_TASK_QUEUE ?? 'shipsec-default'; |
| 159 | |
| 160 | const handle = await client.workflow.start(shipsecWorkflowRun, { |
| 161 | workflowId: temporalWorkflowId, |
| 162 | taskQueue, |
| 163 | args: [ |
| 164 | { |
| 165 | runId: temporalWorkflowId, |
| 166 | workflowId: workflowRecordId, |
| 167 | definition, |
| 168 | inputs: { |
| 169 | input1: fileId, |
| 170 | }, |
| 171 | }, |
| 172 | ], |
| 173 | }); |
| 174 | |
| 175 | const result = await handle.result(); |
| 176 | return { runId: temporalWorkflowId, result }; |
| 177 | } |
| 178 | |
| 179 | async function main() { |
| 180 | const { workflowRecordId, fileId, limit, shouldRun, list } = parseArgs(); |