0.1.1 • Published 2 years ago
@norvento/taskmaster_client v0.1.1
TaskMaster client
This library is intended to use with TaskMaster app.
How to use the library
- Create a class that extends the
Task
class. - Call the super() constuctor with the TaskMaster task id and taskmaster url
- Implement your task logic in the
performTask
method. - You can send your logs and parameters to TaskMaster using the context provided in the performTask method.
- Implement a REST endpoint and call your class.
Example
import { Injectable } from "@nestjs/common";
import { Task } from "@norvento/taskmaster_client";
import { TaskLogger } from "@norvento/taskmaster_client/dist/TaskLogger";
import { TaskParamsHandler } from "@norvento/taskmaster_client/dist/TaskParamsHandler";
@Injectable()
export class ExampleTask extends Task<{ "parameter1": string }> {
constructor() {
super("1", "https://localhost:8443");
}
protected async performTask(taskContext: { logger: TaskLogger; paramsHandler: TaskParamsHandler; }): Promise<void> {
await taskContext.logger.info("test log");
await taskContext.logger.warn("test log warn");
console.log(taskContext.paramsHandler.getParam("a"));
console.log(taskContext.paramsHandler.getParam("b"));
}
}
0.1.0
2 years ago
0.1.1
2 years ago
0.1.0-alpha.2
2 years ago
0.1.0-alpha.1
2 years ago
0.1.0-alpha.0
2 years ago