( name: Name, workflows: Workflows )
| 120 | * @category Constructors |
| 121 | */ |
| 122 | export const toHttpApiGroup = <const Name extends string, const Workflows extends NonEmptyReadonlyArray<Workflow.Any>>( |
| 123 | name: Name, |
| 124 | workflows: Workflows |
| 125 | ): HttpApiGroup.HttpApiGroup<Name, ConvertHttpApi<Workflows[number]>> => { |
| 126 | let group = HttpApiGroup.make(name) |
| 127 | for (const workflow of workflows) { |
| 128 | const path = `/${tagToPath(workflow.name)}` as const |
| 129 | group = group.add( |
| 130 | HttpApiEndpoint.post(workflow.name, path) |
| 131 | .setPayload(workflow.payloadSchema) |
| 132 | .addSuccess(workflow.successSchema) |
| 133 | .addError(workflow.errorSchema as any) |
| 134 | .annotateContext(workflow.annotations) |
| 135 | ).add( |
| 136 | HttpApiEndpoint.post(workflow.name + "Discard", `${path}/discard`) |
| 137 | .setPayload(workflow.payloadSchema) |
| 138 | .annotateContext(workflow.annotations) |
| 139 | ).add( |
| 140 | HttpApiEndpoint.post(workflow.name + "Resume", `${path}/resume`) |
| 141 | .setPayload(ResumePayload) |
| 142 | .annotateContext(workflow.annotations) |
| 143 | ) as any |
| 144 | } |
| 145 | return group as any |
| 146 | } |
| 147 | |
| 148 | const tagToPath = (tag: string): string => |
| 149 | tag |
nothing calls this directly
no test coverage detected
searching dependent graphs…