(
workflows: Workflows,
options?: {
readonly prefix?: Prefix | undefined
}
)
| 43 | * @category Constructors |
| 44 | */ |
| 45 | export const toRpcGroup = < |
| 46 | const Workflows extends NonEmptyReadonlyArray<Workflow.Any>, |
| 47 | const Prefix extends string = "" |
| 48 | >( |
| 49 | workflows: Workflows, |
| 50 | options?: { |
| 51 | readonly prefix?: Prefix | undefined |
| 52 | } |
| 53 | ): RpcGroup.RpcGroup<ConvertRpcs<Workflows[number], Prefix>> => { |
| 54 | const prefix = options?.prefix ?? "" |
| 55 | const rpcs: Array<Rpc.Any> = [] |
| 56 | for (const workflow of workflows) { |
| 57 | rpcs.push( |
| 58 | Rpc.make(`${prefix}${workflow.name}`, { |
| 59 | payload: workflow.payloadSchema, |
| 60 | error: workflow.errorSchema, |
| 61 | success: workflow.successSchema |
| 62 | }).annotateContext(workflow.annotations), |
| 63 | Rpc.make(`${prefix}${workflow.name}Discard`, { |
| 64 | payload: workflow.payloadSchema |
| 65 | }).annotateContext(workflow.annotations), |
| 66 | Rpc.make(`${prefix}${workflow.name}Resume`, { payload: ResumePayload }) |
| 67 | .annotateContext(workflow.annotations) |
| 68 | ) |
| 69 | } |
| 70 | return RpcGroup.make(...rpcs) as any |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * @since 1.0.0 |
nothing calls this directly
no test coverage detected