Skip to content

Instantly share code, notes, and snippets.

@jwulf
Last active February 27, 2020 23:23
Show Gist options
  • Save jwulf/5ffa03d23baa993635a69dd62ebe1e0f to your computer and use it in GitHub Desktop.
Save jwulf/5ffa03d23baa993635a69dd62ebe1e0f to your computer and use it in GitHub Desktop.
public async deployWorkflow(
workflow: ZB.DeployWorkflowFiles | ZB.DeployWorkflowBuffer
): Promise<ZB.DeployWorkflowResponse> {
const deploy = (workflows: ZB.WorkflowRequestObject[]) =>
this.executeOperation('deployWorkflow', () =>
this.gRPCClient.deployWorkflowSync({
workflows,
})
)
const error = (e: NEA.NonEmptyArray<string>) =>
Promise.reject(
`Deployment failed. The following files were not found: ${e.join(
', '
)}.`
)
return pipe(
bufferOrFiles(workflow),
E.fold(deploy, files =>
pipe(
mapThese(files, readDefinitionFromFile),
E.fold(error, deploy)
)
)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment