( name: Name, workflows: Workflows )
| 139 | * @since 4.0.0 |
| 140 | */ |
| 141 | export const toHttpApiGroup = <const Name extends string, const Workflows extends NonEmptyReadonlyArray<Workflow.Any>>( |
| 142 | name: Name, |
| 143 | workflows: Workflows |
| 144 | ): HttpApiGroup.HttpApiGroup<Name, ConvertHttpApi<Workflows[number]>> => { |
| 145 | let group = HttpApiGroup.make(name) |
| 146 | for (const workflow_ of workflows) { |
| 147 | const workflow = workflow_ as Workflow.AnyWithProps |
| 148 | const path = `/${tagToPath(workflow._tag)}` as const |
| 149 | group = group.add( |
| 150 | HttpApiEndpoint.post(workflow._tag, path, { |
| 151 | payload: workflow.payloadSchema, |
| 152 | success: workflow.successSchema, |
| 153 | error: workflow.errorSchema |
| 154 | }).annotateMerge(workflow.annotations), |
| 155 | HttpApiEndpoint.post(workflow._tag + "Discard", `${path}/discard`, { |
| 156 | payload: workflow.payloadSchema |
| 157 | }).annotateMerge(workflow.annotations), |
| 158 | HttpApiEndpoint.post(workflow._tag + "Resume", `${path}/resume`, { |
| 159 | payload: ResumePayload |
| 160 | }).annotateMerge(workflow.annotations) |
| 161 | ) as any |
| 162 | } |
| 163 | return group as any |
| 164 | } |
| 165 | |
| 166 | const tagToPath = (tag: string): string => |
| 167 | tag |
nothing calls this directly
no test coverage detected