implement TaskManager
This commit is contained in:
parent
cf1b31d635
commit
e1424ea0fb
1
dist/index.d.ts
vendored
1
dist/index.d.ts
vendored
@ -1,5 +1,4 @@
|
|||||||
export { Task, ITaskFunction } from './taskbuffer.classes.task';
|
export { Task, ITaskFunction } from './taskbuffer.classes.task';
|
||||||
export { Taskchain } from './taskbuffer.classes.taskchain';
|
export { Taskchain } from './taskbuffer.classes.taskchain';
|
||||||
export { Taskparallel } from './taskbuffer.classes.taskparallel';
|
export { Taskparallel } from './taskbuffer.classes.taskparallel';
|
||||||
export { Taskspace } from './taskbuffer.classes.taskspace';
|
|
||||||
import './taskbuffer.classes.helpers';
|
import './taskbuffer.classes.helpers';
|
||||||
|
4
dist/index.js
vendored
4
dist/index.js
vendored
@ -6,8 +6,6 @@ var taskbuffer_classes_taskchain_1 = require("./taskbuffer.classes.taskchain");
|
|||||||
exports.Taskchain = taskbuffer_classes_taskchain_1.Taskchain;
|
exports.Taskchain = taskbuffer_classes_taskchain_1.Taskchain;
|
||||||
var taskbuffer_classes_taskparallel_1 = require("./taskbuffer.classes.taskparallel");
|
var taskbuffer_classes_taskparallel_1 = require("./taskbuffer.classes.taskparallel");
|
||||||
exports.Taskparallel = taskbuffer_classes_taskparallel_1.Taskparallel;
|
exports.Taskparallel = taskbuffer_classes_taskparallel_1.Taskparallel;
|
||||||
var taskbuffer_classes_taskspace_1 = require("./taskbuffer.classes.taskspace");
|
|
||||||
exports.Taskspace = taskbuffer_classes_taskspace_1.Taskspace;
|
|
||||||
// import for naming only
|
// import for naming only
|
||||||
require("./taskbuffer.classes.helpers");
|
require("./taskbuffer.classes.helpers");
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHFFQUE0RDtBQUFwRCx5Q0FBQSxJQUFJLENBQUE7QUFDWiwrRUFBd0Q7QUFBaEQsbURBQUEsU0FBUyxDQUFBO0FBQ2pCLHFGQUE4RDtBQUF0RCx5REFBQSxZQUFZLENBQUE7QUFDcEIsK0VBQXdEO0FBQWhELG1EQUFBLFNBQVMsQ0FBQTtBQUVqQix5QkFBeUI7QUFDekIsd0NBQXFDIn0=
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHFFQUE0RDtBQUFwRCx5Q0FBQSxJQUFJLENBQUE7QUFDWiwrRUFBd0Q7QUFBaEQsbURBQUEsU0FBUyxDQUFBO0FBQ2pCLHFGQUE4RDtBQUF0RCx5REFBQSxZQUFZLENBQUE7QUFFcEIseUJBQXlCO0FBQ3pCLHdDQUFxQyJ9
|
2
dist/taskbuffer.classes.task.js
vendored
2
dist/taskbuffer.classes.task.js
vendored
@ -55,4 +55,4 @@ class Task {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.Task = Task;
|
exports.Task = Task;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFza2J1ZmZlci5jbGFzc2VzLnRhc2suanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90YXNrYnVmZmVyLmNsYXNzZXMudGFzay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGdEQUErQztBQUMvQyx3REFBdUQ7QUFNdkQ7SUFjRSxZQUFZLFVBT1g7UUFkRCx3QkFBd0I7UUFDeEIsWUFBTyxHQUFZLEtBQUssQ0FBQTtRQUN4QixpQkFBWSxHQUFHLElBQUksT0FBTyxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsQ0FBQTtRQUM3QyxpQkFBWSxHQUFHLElBQ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xFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxDQUFBO0lBQ3hDLENBQUM7SUFFRDs7T0FFRztJQUNILGVBQWUsQ0FBRSxDQUFFO1FBQ2pCLE1BQU0sQ0FBQyxJQUFJLENBQUMsWUFBWSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQTtJQUNyQyxDQUFDO0lBRUQsSUFBSSxLQUFLO1FBQ1AsTUFBTSxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUE7SUFDcEIsQ0FBQztJQUNELElBQUksS0FBSyxDQUFFLFFBQWdCO1FBQ3pCLEVBQUUsQ0FBQyxDQUFDLFFBQVEsS0FBSyxRQUFRLENBQUMsQ0FBQyxDQUFDO1lBQzFCLElBQUksQ0FBQyxNQUFNLEdBQUcsUUFBUSxDQUFBO1FBQ3hCLENBQUM7UUFBQyxJQUFJLENBQUMsQ0FBQztZQUNOLE9BQU8sQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLGFBQWEsR0FBRyxRQUFRLEdBQUcsbUJBQW1CLENBQUMsQ0FBQTtRQUN6RSxDQUFDO0lBQ0gsQ0FBQztDQUNGO0FBbkVELG9CQW1FQyJ9
|
4
dist/taskbuffer.classes.taskchain.js
vendored
4
dist/taskbuffer.classes.taskchain.js
vendored
@ -1,4 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
// TaskChain chains tasks
|
||||||
|
// and extends Task
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const plugins = require("./taskbuffer.plugins");
|
const plugins = require("./taskbuffer.plugins");
|
||||||
const taskbuffer_classes_task_1 = require("./taskbuffer.classes.task");
|
const taskbuffer_classes_task_1 = require("./taskbuffer.classes.task");
|
||||||
@ -48,4 +50,4 @@ class Taskchain extends taskbuffer_classes_task_1.Task {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.Taskchain = Taskchain;
|
exports.Task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LEtBQUssSUFBSSxDQUFDLENBQUMsQ0FBQztZQUM1QixJQUFJLENBQUMsVUFBVSxDQUFDLEtBQUssRUFBRSxDQUFBO1FBQ3pCLENBQUM7SUFDSCxDQUFDO0lBQ0QsT0FBTyxDQUFFLE9BQWE7UUFDcEIsSUFBSSxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUE7SUFDOUIsQ0FBQztJQUNELFVBQVUsQ0FBRSxPQUFhO1FBQ3ZCLFFBQVE7SUFDVixDQUFDO0lBQ0QsU0FBUztRQUNQLFFBQVE7SUFDVixDQUFDO0NBQ0Y7QUF2REQsOEJBdURDIn0=
|
43
dist/taskbuffer.classes.taskmanager.d.ts
vendored
43
dist/taskbuffer.classes.taskmanager.d.ts
vendored
@ -0,0 +1,43 @@
|
|||||||
|
import { Task } from './taskbuffer.classes.task';
|
||||||
|
import { Objectmap } from 'lik';
|
||||||
|
export declare class TaskManager {
|
||||||
|
taskMap: Objectmap<Task>;
|
||||||
|
private cronJobArray;
|
||||||
|
constructor();
|
||||||
|
/**
|
||||||
|
* checks if a task is already present
|
||||||
|
* @param taskNameArg
|
||||||
|
*/
|
||||||
|
getTaskByName(taskNameArg: any): Task;
|
||||||
|
/**
|
||||||
|
* adds a Task to the TaskManager
|
||||||
|
* @param taskArg
|
||||||
|
*/
|
||||||
|
addTask(taskArg: Task): void;
|
||||||
|
/**
|
||||||
|
* adds and schedules a task at once
|
||||||
|
* @param taskArg
|
||||||
|
* @param cronStringArg
|
||||||
|
*/
|
||||||
|
addAndScheduleTask(taskArg: Task, cronStringArg: string): void;
|
||||||
|
/**
|
||||||
|
* triggers a task in the TaskManagerByName
|
||||||
|
* @param taskNameArg
|
||||||
|
*/
|
||||||
|
triggerTaskByName(taskNameArg: string): void;
|
||||||
|
/**
|
||||||
|
* schedules the task by name
|
||||||
|
* @param taskNameArg
|
||||||
|
*/
|
||||||
|
scheduleTaskByName(taskNameArg: string, cronStringArg: string): void;
|
||||||
|
/**
|
||||||
|
* returns all schedules of a specific task
|
||||||
|
* @param taskNameArg
|
||||||
|
*/
|
||||||
|
getSchedulesForTaskName(taskNameArg: string): void;
|
||||||
|
}
|
||||||
|
export interface ICronJob {
|
||||||
|
cronString: string;
|
||||||
|
taskNameArg: string;
|
||||||
|
job: any;
|
||||||
|
}
|
74
dist/taskbuffer.classes.taskmanager.js
vendored
74
dist/taskbuffer.classes.taskmanager.js
vendored
@ -1,3 +1,75 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFza2J1ZmZlci5jbGFzc2VzLnRhc2ttYW5hZ2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvdGFza2J1ZmZlci5jbGFzc2VzLnRhc2ttYW5hZ2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
|
const plugins = require("./taskbuffer.plugins");
|
||||||
|
class TaskManager {
|
||||||
|
constructor() {
|
||||||
|
this.taskMap = new plugins.lik.Objectmap();
|
||||||
|
this.cronJobArray = [];
|
||||||
|
// nothing here
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* checks if a task is already present
|
||||||
|
* @param taskNameArg
|
||||||
|
*/
|
||||||
|
getTaskByName(taskNameArg) {
|
||||||
|
return this.taskMap.find((itemArg) => {
|
||||||
|
return itemArg.name === taskNameArg;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* adds a Task to the TaskManager
|
||||||
|
* @param taskArg
|
||||||
|
*/
|
||||||
|
addTask(taskArg) {
|
||||||
|
if (!taskArg.name) {
|
||||||
|
throw new Error('taskArg needs a name to be added to taskManager');
|
||||||
|
}
|
||||||
|
this.taskMap.add(taskArg);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* adds and schedules a task at once
|
||||||
|
* @param taskArg
|
||||||
|
* @param cronStringArg
|
||||||
|
*/
|
||||||
|
addAndScheduleTask(taskArg, cronStringArg) {
|
||||||
|
this.addTask(taskArg);
|
||||||
|
let taskName = taskArg.name;
|
||||||
|
this.scheduleTaskByName(taskName, cronStringArg);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* triggers a task in the TaskManagerByName
|
||||||
|
* @param taskNameArg
|
||||||
|
*/
|
||||||
|
triggerTaskByName(taskNameArg) {
|
||||||
|
let taskToTrigger = this.getTaskByName(taskNameArg);
|
||||||
|
if (!taskToTrigger) {
|
||||||
|
throw new Error(`There is no task with the name of ${taskNameArg}`);
|
||||||
|
}
|
||||||
|
taskToTrigger.trigger();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* schedules the task by name
|
||||||
|
* @param taskNameArg
|
||||||
|
*/
|
||||||
|
scheduleTaskByName(taskNameArg, cronStringArg) {
|
||||||
|
let taskToSchedule = this.getTaskByName(taskNameArg);
|
||||||
|
let job = new plugins.cron.CronJob({
|
||||||
|
cronTime: cronStringArg,
|
||||||
|
onTick: taskToSchedule.trigger,
|
||||||
|
start: true
|
||||||
|
});
|
||||||
|
this.cronJobArray.push({
|
||||||
|
taskNameArg: taskToSchedule.name,
|
||||||
|
cronString: cronStringArg,
|
||||||
|
job: job
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* returns all schedules of a specific task
|
||||||
|
* @param taskNameArg
|
||||||
|
*/
|
||||||
|
getSchedulesForTaskName(taskNameArg) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.TaskManager = TaskManager;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFza2J1ZmZlci5jbGFzc2VzLnRhc2ttYW5hZ2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvdGFza2J1ZmZlci5jbGFzc2VzLnRhc2ttYW5hZ2VyLnRz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xDQUFDLGFBQWEsQ0FBQyxXQUFXLENBQUMsQ0FBQTtRQUNuRCxFQUFFLENBQUMsQ0FBQyxDQUFDLGFBQWEsQ0FBQyxDQUFDLENBQUM7WUFDbkIsTUFBTSxJQUFJLEtBQUssQ0FBQyxxQ0FBcUMsV0FBVyxFQUFFLENBQUMsQ0FBQTtRQUNyRSxDQUFDO1FBQ0QsYUFBYSxDQUFDLE9BQU8sRUFBRSxDQUFBO0lBQ3pCLENBQUM7SUFFRDs7O09BR0c7SUFDSCxrQkFBa0IsQ0FBRSxXQUFtQixFQUFFLGFBQXFCO1FBQzVELElBQUksY0FBYyxHQUFHLElBQUksQ0FBQyxhQUFhLENBQUMsV0FBVyxDQUFDLENBQUE7UUFDcEQsSUFBSSxHQUFHLEdBQUcsSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztZQUNqQyxRQUFRLEVBQUUsYUFBYTtZQUN2QixNQUFNLEVBQUUsY0FBYyxDQUFDLE9BQU87WUFDOUIsS0FBSyxFQUFFLElBQUk7U0FDWixDQUFDLENBQUE7UUFDRixJQUFJLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQztZQUNyQixXQUFXLEVBQUUsY0FBYyxDQUFDLElBQUk7WUFDaEMsVUFBVSxFQUFFLGFBQWE7WUFDekIsR0FBRyxFQUFFLEdBQUc7U0FDVCxDQUFDLENBQUE7SUFDSixDQUFDO0lBRUQ7OztPQUdHO0lBQ0gsdUJBQXVCLENBQUUsV0FBbUI7SUFFNUMsQ0FBQztDQUNGO0FBNUVELGtDQTRFQyJ9
|
2
dist/taskbuffer.classes.taskparallel.d.ts
vendored
2
dist/taskbuffer.classes.taskparallel.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
import { Task } from "./taskbuffer.classes.task";
|
import { Task } from './taskbuffer.classes.task';
|
||||||
export declare class Taskparallel extends Task {
|
export declare class Taskparallel extends Task {
|
||||||
taskArray: Task[];
|
taskArray: Task[];
|
||||||
constructor(optionsArg: {
|
constructor(optionsArg: {
|
||||||
|
2
dist/taskbuffer.classes.taskparallel.js
vendored
2
dist/taskbuffer.classes.taskparallel.js
vendored
@ -21,4 +21,4 @@ class Taskparallel extends taskbuffer_classes_task_1.Task {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.Taskparallel = Taskparallel;
|
exports.Taskparallel = Taskparallel;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFza2J1ZmZlci5jbGFzc2VzLnRhc2twYXJhbGxlbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Rhc2tidWZmZXIuY2xhc3Nlcy50YXNrcGFyYWxsZWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxnREFBK0M7QUFFL0MsdUVBQWdEO0FBRWhELGtCQUEwQixTQUFRLDhCQUFJO0lBRWxDLFlBQVksVUFFWDtRQUNHLElBQUksT0FBTyxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUM5QixVQUFVLEVBQ1Y7WUFDSSxZQUFZLEVBQUU7Z0JBQ1YsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztnQkFDN0IsSUFBSSxZQUFZLEdBQW1CLEVBQUUsQ0FBQyxDQUFDLDJEQUEyRDtnQkFDbEcsSUFBSSxDQUFDLFNBQVMsQ0FBQyxPQUFPLENBQUMsVUFBVSxPQUFPO29CQUNwQyxZQUFZLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxPQUFPLEVBQUUsQ0FBQyxDQUFDO2dCQUN6QyxDQUFDLENBQUMsQ0FBQTtnQkFDRixPQUFPLENBQUMsR0FBRyxDQUFDLFlBQVksQ0FBQztxQkFDcEIsSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQztnQkFDeEIsTUFBTSxDQU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FBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7WUFDckIsQ0FBQztTQUNGLENBQ0YsQ0FBQTtRQUNELEtBQUssQ0FBQyxPQUFPLENBQUMsQ0FBQTtRQUNkLElBQUksQ0FBQyxTQUFTLEdBQUcsVUFBVSxDQUFDLFNBQVMsQ0FBQTtJQUN2QyxDQUFDO0NBQ0Y7QUF2QkQsb0NBdUJDIn0=
|
2
dist/taskbuffer.classes.taskspace.d.ts
vendored
2
dist/taskbuffer.classes.taskspace.d.ts
vendored
@ -1,2 +0,0 @@
|
|||||||
export declare class Taskspace {
|
|
||||||
}
|
|
6
dist/taskbuffer.classes.taskspace.js
vendored
6
dist/taskbuffer.classes.taskspace.js
vendored
@ -1,6 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
class Taskspace {
|
|
||||||
}
|
|
||||||
exports.Taskspace = Taskspace;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFza2J1ZmZlci5jbGFzc2VzLnRhc2tzcGFjZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Rhc2tidWZmZXIuY2xhc3Nlcy50YXNrc3BhY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFHQTtDQUVDO0FBRkQsOEJBRUMifQ==
|
|
5
dist/taskbuffer.plugins.d.ts
vendored
5
dist/taskbuffer.plugins.d.ts
vendored
@ -1,6 +1,9 @@
|
|||||||
import 'typings-global';
|
import 'typings-global';
|
||||||
import * as beautylog from 'beautylog';
|
import * as beautylog from 'beautylog';
|
||||||
|
declare let cron: any;
|
||||||
|
import * as lik from 'lik';
|
||||||
import * as lodash from 'lodash';
|
import * as lodash from 'lodash';
|
||||||
import * as rxjs from 'rxjs';
|
import * as rxjs from 'rxjs';
|
||||||
import * as q from 'smartq';
|
import * as q from 'smartq';
|
||||||
export { beautylog, lodash, rxjs, q };
|
import * as smartdelay from 'smartdelay';
|
||||||
|
export { beautylog, cron, lik, lodash, rxjs, q, smartdelay };
|
||||||
|
8
dist/taskbuffer.plugins.js
vendored
8
dist/taskbuffer.plugins.js
vendored
@ -3,10 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
require("typings-global");
|
require("typings-global");
|
||||||
const beautylog = require("beautylog");
|
const beautylog = require("beautylog");
|
||||||
exports.beautylog = beautylog;
|
exports.beautylog = beautylog;
|
||||||
|
let cron = require('cron');
|
||||||
|
exports.cron = cron;
|
||||||
|
const lik = require("lik");
|
||||||
|
exports.lik = lik;
|
||||||
const lodash = require("lodash");
|
const lodash = require("lodash");
|
||||||
exports.lodash = lodash;
|
exports.lodash = lodash;
|
||||||
const rxjs = require("rxjs");
|
const rxjs = require("rxjs");
|
||||||
exports.rxjs = rxjs;
|
exports.rxjs = rxjs;
|
||||||
const q = require("smartq");
|
const q = require("smartq");
|
||||||
exports.q = q;
|
exports.q = q;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFza2J1ZmZlci5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvdGFza2J1ZmZlci5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMEJBQXVCO0FBQ3ZCLHVDQUFzQztBQU1sQyw4QkFBUztBQUxiLGlDQUFnQztBQU01Qix3QkFBTTtBQUxWLDZCQUE0QjtBQU14QixvQkFBSTtBQUxSLDRCQUEyQjtBQU12QixjQUFDIn0=
|
const smartdelay = require("smartdelay");
|
||||||
|
exports.smartdelay = smartdelay;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFza2J1ZmZlci5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvdGFza2J1ZmZlci5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMEJBQXVCO0FBQ3ZCLHVDQUFzQztBQVNsQyw4QkFBUztBQVJiLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQTtBQVN0QixvQkFBSTtBQVJSLDJCQUEwQjtBQVN0QixrQkFBRztBQVJQLGlDQUFnQztBQVM1Qix3QkFBTTtBQVJWLDZCQUE0QjtBQVN4QixvQkFBSTtBQVJSLDRCQUEyQjtBQVN2QixjQUFDO0FBUkwseUNBQXdDO0FBU3BDLGdDQUFVIn0=
|
@ -1,6 +1,9 @@
|
|||||||
{
|
{
|
||||||
"npmts":{
|
"npmts":{
|
||||||
"mode":"default"
|
"mode":"default",
|
||||||
|
"testConfig": {
|
||||||
|
"parallel": false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"globalNpmTools": [
|
"globalNpmTools": [
|
||||||
|
@ -25,10 +25,14 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/taskbuffer#readme",
|
"homepage": "https://gitlab.com/pushrocks/taskbuffer#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@types/cron": "^1.2.1",
|
||||||
"@types/lodash": "4.x.x",
|
"@types/lodash": "4.x.x",
|
||||||
"beautylog": "^6.1.10",
|
"beautylog": "^6.1.10",
|
||||||
|
"cron": "^1.2.1",
|
||||||
|
"lik": "^1.0.31",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"rxjs": "^5.4.0",
|
"rxjs": "^5.4.1",
|
||||||
|
"smartdelay": "^1.0.3",
|
||||||
"smartq": "^1.1.1",
|
"smartq": "^1.1.1",
|
||||||
"typings-global": "^1.0.17"
|
"typings-global": "^1.0.17"
|
||||||
},
|
},
|
||||||
|
108
test/test.1.task.ts
Normal file
108
test/test.1.task.ts
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
import { expect, tap } from 'tapbundle'
|
||||||
|
import taskbuffer = require('../dist/index')
|
||||||
|
|
||||||
|
import * as q from 'smartq'
|
||||||
|
import * as smartdelay from 'smartdelay'
|
||||||
|
|
||||||
|
// setup some testData to work with
|
||||||
|
let testTask: taskbuffer.Task
|
||||||
|
|
||||||
|
let testPreTask = new taskbuffer.Task({
|
||||||
|
taskFunction: function () {
|
||||||
|
let done = q.defer()
|
||||||
|
console.log('preTask executed')
|
||||||
|
done.resolve()
|
||||||
|
return done.promise
|
||||||
|
},
|
||||||
|
preTask: testTask
|
||||||
|
})
|
||||||
|
|
||||||
|
// some more tasks to test with
|
||||||
|
let task1Counter = 0 // how often task 1 is being executed
|
||||||
|
let task1 = new taskbuffer.Task({
|
||||||
|
name: 'Task 1',
|
||||||
|
taskFunction: () => {
|
||||||
|
let done = q.defer()
|
||||||
|
console.log('Task1 started')
|
||||||
|
setTimeout(() => {
|
||||||
|
task1Counter++
|
||||||
|
console.log('Task1 executed')
|
||||||
|
done.resolve()
|
||||||
|
}, 5000)
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
let task2 = new taskbuffer.Task({
|
||||||
|
name: 'Task 1',
|
||||||
|
taskFunction: () => {
|
||||||
|
let done = q.defer()
|
||||||
|
console.log('Task2 started')
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log('Task2 executed')
|
||||||
|
done.resolve()
|
||||||
|
}, 5000)
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
let task3 = new taskbuffer.Task({
|
||||||
|
name: 'Task 3',
|
||||||
|
taskFunction: () => {
|
||||||
|
let done = q.defer()
|
||||||
|
console.log('Task3 started')
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log('Task3 executed')
|
||||||
|
done.resolve()
|
||||||
|
}, 5000)
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('new Task() should return a new task', async () => {
|
||||||
|
testTask = new taskbuffer.Task({ taskFunction: async () => { console.log('executed twice') }, preTask: testPreTask })
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('testTask should be and instance of Task', async () => {
|
||||||
|
expect(testTask).to.be.instanceof(taskbuffer.Task)
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('testTask.idle is true', async () => {
|
||||||
|
if (!testTask.idle) {
|
||||||
|
throw new Error('testTask.idle is not true')
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('testTask.running is type boolean and initially false', async () => {
|
||||||
|
expect(testTask.running).to.be.a('boolean')
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(testTask.running).to.be.false
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('testTask.trigger() expect return Promise', async () => {
|
||||||
|
expect(testTask.trigger()).to.be.instanceof(Promise)
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('testTask.trigger() returned Promise expect be fullfilled', async () => {
|
||||||
|
await testTask.trigger()
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('expect run a task without pre and afterTask', async () => {
|
||||||
|
let localTestTask = new taskbuffer.Task({ taskFunction: async () => { console.log('only once') } })
|
||||||
|
await localTestTask.trigger()
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('expect run buffered', async () => {
|
||||||
|
let localTestTask = new taskbuffer.Task({
|
||||||
|
taskFunction: async () => { await smartdelay.delayFor(3000) },
|
||||||
|
buffered: true,
|
||||||
|
bufferMax: 2
|
||||||
|
})
|
||||||
|
localTestTask.trigger()
|
||||||
|
localTestTask.trigger()
|
||||||
|
localTestTask.trigger()
|
||||||
|
await localTestTask.trigger()
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.start()
|
48
test/test.2.taskchain.ts
Normal file
48
test/test.2.taskchain.ts
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import { expect, tap } from 'tapbundle'
|
||||||
|
import taskbuffer = require('../dist/index')
|
||||||
|
|
||||||
|
import * as smartq from 'smartq'
|
||||||
|
import * as smartdelay from 'smartdelay'
|
||||||
|
|
||||||
|
let task1Executed = false
|
||||||
|
let task1 = new taskbuffer.Task({
|
||||||
|
taskFunction: async () => {
|
||||||
|
await smartdelay.delayFor(2000)
|
||||||
|
task1Executed = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
let task2Executed = false
|
||||||
|
let task2 = new taskbuffer.Task({
|
||||||
|
taskFunction: async () => {
|
||||||
|
await smartdelay.delayFor(2000)
|
||||||
|
task2Executed = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
let task3Executed = false
|
||||||
|
let task3 = new taskbuffer.Task({
|
||||||
|
taskFunction: async () => {
|
||||||
|
await smartdelay.delayFor(2000)
|
||||||
|
task3Executed = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('expect run tasks in sequence', async () => {
|
||||||
|
let testTaskchain = new taskbuffer.Taskchain({
|
||||||
|
name: 'Taskchain1',
|
||||||
|
taskArray: [ task1, task2, task3 ]
|
||||||
|
})
|
||||||
|
let testPromise = testTaskchain.trigger()
|
||||||
|
await smartdelay.delayFor(2100)
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(task1Executed).to.be.true
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(task2Executed).to.be.false
|
||||||
|
await smartdelay.delayFor(2100)
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(task2Executed).to.be.true
|
||||||
|
await testPromise
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.start()
|
38
test/test.3.taskparallel.ts
Normal file
38
test/test.3.taskparallel.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import { expect, tap } from 'tapbundle'
|
||||||
|
import taskbuffer = require('../dist/index')
|
||||||
|
|
||||||
|
import * as smartq from 'smartq'
|
||||||
|
import * as smartdelay from 'smartdelay'
|
||||||
|
|
||||||
|
let task1Executed = false
|
||||||
|
let task1 = new taskbuffer.Task({
|
||||||
|
taskFunction: async () => {
|
||||||
|
await smartdelay.delayFor(2000)
|
||||||
|
task1Executed = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
let task2Executed = false
|
||||||
|
let task2 = new taskbuffer.Task({
|
||||||
|
taskFunction: async () => {
|
||||||
|
await smartdelay.delayFor(2000)
|
||||||
|
task2Executed = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
let task3Executed = false
|
||||||
|
let task3 = new taskbuffer.Task({
|
||||||
|
taskFunction: async () => {
|
||||||
|
await smartdelay.delayFor(2000)
|
||||||
|
task3Executed = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('expect run in Parallel', async () => {
|
||||||
|
let testTaskparallel = new taskbuffer.Taskparallel({
|
||||||
|
taskArray: [ task1, task2, task3 ]
|
||||||
|
})
|
||||||
|
await testTaskparallel.trigger()
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.start()
|
0
test/test.4.taskmanager.ts
Normal file
0
test/test.4.taskmanager.ts
Normal file
64
test/test.5.task.paramflow.ts
Normal file
64
test/test.5.task.paramflow.ts
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import { expect, tap } from 'tapbundle'
|
||||||
|
import taskbuffer = require('../dist/index')
|
||||||
|
|
||||||
|
import * as q from 'smartq'
|
||||||
|
import * as smartdelay from 'smartdelay'
|
||||||
|
|
||||||
|
let flowTask1 = new taskbuffer.Task({
|
||||||
|
taskFunction: (x: number) => {
|
||||||
|
let done = q.defer()
|
||||||
|
console.log('flowTask1')
|
||||||
|
console.log(x)
|
||||||
|
done.resolve(x)
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
let flowTaskBuffered = new taskbuffer.Task({
|
||||||
|
taskFunction: (x: number) => {
|
||||||
|
let done = q.defer()
|
||||||
|
console.log('flowTask1')
|
||||||
|
console.log(x)
|
||||||
|
done.resolve(x)
|
||||||
|
return done.promise
|
||||||
|
},
|
||||||
|
buffered: true,
|
||||||
|
bufferMax: 1
|
||||||
|
})
|
||||||
|
|
||||||
|
let flowTask2 = new taskbuffer.Task({
|
||||||
|
taskFunction: (x: number) => {
|
||||||
|
let done = q.defer()
|
||||||
|
console.log('flowTask2')
|
||||||
|
console.log(x)
|
||||||
|
done.resolve(x)
|
||||||
|
return done.promise
|
||||||
|
},
|
||||||
|
preTask: flowTask1
|
||||||
|
})
|
||||||
|
|
||||||
|
let flowTask3 = new taskbuffer.Taskchain({
|
||||||
|
taskArray: [ flowTask1, flowTask2 ]
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('should let a value flow through a task', async () => {
|
||||||
|
let result = await flowTask1.trigger(12)
|
||||||
|
expect(result).to.equal(12)
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('should let a values flow between tasks', async () => {
|
||||||
|
let result = await flowTask2.trigger(12)
|
||||||
|
expect(result).to.equal(12)
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('expect let a values flow between tasks when buffered', async () => {
|
||||||
|
let result = await flowTaskBuffered.trigger(12)
|
||||||
|
expect(result).to.equal(12)
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('should let a values flow between tasks in Taskchain', async () => {
|
||||||
|
let result = await flowTask3.trigger(12)
|
||||||
|
expect(result).to.equal(12)
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.start()
|
208
test/test.ts
208
test/test.ts
@ -1,208 +0,0 @@
|
|||||||
import { expect, tap } from 'tapbundle'
|
|
||||||
import taskbuffer = require('../dist/index')
|
|
||||||
|
|
||||||
import * as q from 'smartq'
|
|
||||||
|
|
||||||
// setup some testData to work with
|
|
||||||
let testTask: taskbuffer.Task
|
|
||||||
let testTaskFunction = function () {
|
|
||||||
let done = q.defer()
|
|
||||||
console.log('main function executed!')
|
|
||||||
done.resolve()
|
|
||||||
return done.promise
|
|
||||||
}
|
|
||||||
|
|
||||||
let testTaskFunctionTimeout = function () {
|
|
||||||
let done = q.defer()
|
|
||||||
console.log('main function started!')
|
|
||||||
setTimeout(() => {
|
|
||||||
console.log('main function ended!')
|
|
||||||
done.resolve()
|
|
||||||
}, 2000)
|
|
||||||
return done.promise
|
|
||||||
}
|
|
||||||
|
|
||||||
let testPreTask = new taskbuffer.Task({
|
|
||||||
taskFunction: function () {
|
|
||||||
let done = q.defer()
|
|
||||||
console.log('preTask executed')
|
|
||||||
done.resolve()
|
|
||||||
return done.promise
|
|
||||||
},
|
|
||||||
preTask: testTask
|
|
||||||
})
|
|
||||||
|
|
||||||
// some more tasks to wirj with
|
|
||||||
let task1 = new taskbuffer.Task({
|
|
||||||
name: 'Task 1',
|
|
||||||
taskFunction: () => {
|
|
||||||
let done = q.defer()
|
|
||||||
console.log('Task1 started')
|
|
||||||
setTimeout(() => {
|
|
||||||
console.log('Task1 executed')
|
|
||||||
done.resolve()
|
|
||||||
}, 5000)
|
|
||||||
return done.promise
|
|
||||||
}
|
|
||||||
})
|
|
||||||
let task2 = new taskbuffer.Task({
|
|
||||||
name: 'Task 1',
|
|
||||||
taskFunction: () => {
|
|
||||||
let done = q.defer()
|
|
||||||
console.log('Task2 started')
|
|
||||||
setTimeout(() => {
|
|
||||||
console.log('Task2 executed')
|
|
||||||
done.resolve()
|
|
||||||
}, 5000)
|
|
||||||
return done.promise
|
|
||||||
}
|
|
||||||
})
|
|
||||||
let task3 = new taskbuffer.Task({
|
|
||||||
name: 'Task 3',
|
|
||||||
taskFunction: () => {
|
|
||||||
let done = q.defer()
|
|
||||||
console.log('Task3 started')
|
|
||||||
setTimeout(() => {
|
|
||||||
console.log('Task3 executed')
|
|
||||||
done.resolve()
|
|
||||||
}, 5000)
|
|
||||||
return done.promise
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.test('new Task() should return a new task', async () => {
|
|
||||||
testTask = new taskbuffer.Task({ taskFunction: testTaskFunction, preTask: testPreTask })
|
|
||||||
})
|
|
||||||
tap.test('testTask should be and instance of Task', async () => {
|
|
||||||
expect(testTask).to.be.instanceof(taskbuffer.Task)
|
|
||||||
})
|
|
||||||
tap.test('testTask.idle is true', async () => {
|
|
||||||
if (!testTask.idle) {
|
|
||||||
throw new Error('testTask.idle is not true')
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
tap.test('testTask.running is type boolean and initially false', async () => {
|
|
||||||
expect(testTask.running).to.be.a('boolean')
|
|
||||||
// tslint:disable-next-line:no-unused-expression
|
|
||||||
expect(testTask.running).to.be.false
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.test('testTask.trigger() expect return Promise', async () => {
|
|
||||||
expect(testTask.trigger()).to.be.instanceof(Promise)
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.test('testTask.trigger() returned Promise expect be fullfilled', async () => {
|
|
||||||
await testTask.trigger()
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.test('expect run a task without pre and afterTask', async () => {
|
|
||||||
let localTestTask = new taskbuffer.Task({ taskFunction: testTaskFunction })
|
|
||||||
await localTestTask.trigger()
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.test('expect run buffered', async () => {
|
|
||||||
let localTestTask = new taskbuffer.Task({
|
|
||||||
taskFunction: testTaskFunctionTimeout,
|
|
||||||
buffered: true,
|
|
||||||
bufferMax: 2
|
|
||||||
})
|
|
||||||
localTestTask.trigger()
|
|
||||||
localTestTask.trigger()
|
|
||||||
localTestTask.trigger()
|
|
||||||
await localTestTask.trigger()
|
|
||||||
})
|
|
||||||
|
|
||||||
let testTaskchain
|
|
||||||
let testTaskArray = [
|
|
||||||
new taskbuffer.Task({
|
|
||||||
name: 'task1',
|
|
||||||
taskFunction: function () {
|
|
||||||
let done = q.defer()
|
|
||||||
setTimeout(done.resolve, 2000)
|
|
||||||
return done.promise
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
new taskbuffer.Task({
|
|
||||||
name: 'task2',
|
|
||||||
taskFunction: function () {
|
|
||||||
let done = q.defer()
|
|
||||||
setTimeout(done.resolve, 2000)
|
|
||||||
return done.promise
|
|
||||||
}
|
|
||||||
})
|
|
||||||
]
|
|
||||||
|
|
||||||
tap.test('expect run tasks in sequence', async () => {
|
|
||||||
testTaskchain = new taskbuffer.Taskchain({
|
|
||||||
name: 'Taskchain1',
|
|
||||||
taskArray: testTaskArray
|
|
||||||
})
|
|
||||||
await testTaskchain.trigger()
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.test('expect run in Parallel', async () => {
|
|
||||||
let testTaskparallel = new taskbuffer.Taskparallel({
|
|
||||||
taskArray: [ task1, task2, task3 ]
|
|
||||||
})
|
|
||||||
await testTaskparallel.trigger()
|
|
||||||
})
|
|
||||||
|
|
||||||
let flowTask1 = new taskbuffer.Task({
|
|
||||||
taskFunction: (x: number) => {
|
|
||||||
let done = q.defer()
|
|
||||||
console.log('flowTask1')
|
|
||||||
console.log(x)
|
|
||||||
done.resolve(x)
|
|
||||||
return done.promise
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
let flowTaskBuffered = new taskbuffer.Task({
|
|
||||||
taskFunction: (x: number) => {
|
|
||||||
let done = q.defer()
|
|
||||||
console.log('flowTask1')
|
|
||||||
console.log(x)
|
|
||||||
done.resolve(x)
|
|
||||||
return done.promise
|
|
||||||
},
|
|
||||||
buffered: true,
|
|
||||||
bufferMax: 1
|
|
||||||
})
|
|
||||||
|
|
||||||
let flowTask2 = new taskbuffer.Task({
|
|
||||||
taskFunction: (x: number) => {
|
|
||||||
let done = q.defer()
|
|
||||||
console.log('flowTask2')
|
|
||||||
console.log(x)
|
|
||||||
done.resolve(x)
|
|
||||||
return done.promise
|
|
||||||
},
|
|
||||||
preTask: flowTask1
|
|
||||||
})
|
|
||||||
|
|
||||||
let flowTask3 = new taskbuffer.Taskchain({
|
|
||||||
taskArray: [ flowTask1, flowTask2 ]
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.test('should let a value flow through a task', async () => {
|
|
||||||
let result = await flowTask1.trigger(12)
|
|
||||||
expect(result).to.equal(12)
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.test('should let a values flow between tasks', async () => {
|
|
||||||
let result = await flowTask2.trigger(12)
|
|
||||||
expect(result).to.equal(12)
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.test('expect let a values flow between tasks when buffered', async () => {
|
|
||||||
let result = await flowTaskBuffered.trigger(12)
|
|
||||||
expect(result).to.equal(12)
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.test('should let a values flow between tasks in Taskchain', async () => {
|
|
||||||
let result = await flowTask3.trigger(12)
|
|
||||||
expect(result).to.equal(12)
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.start()
|
|
@ -1,7 +1,6 @@
|
|||||||
export {Task,ITaskFunction} from './taskbuffer.classes.task'
|
export {Task,ITaskFunction} from './taskbuffer.classes.task'
|
||||||
export {Taskchain} from './taskbuffer.classes.taskchain'
|
export {Taskchain} from './taskbuffer.classes.taskchain'
|
||||||
export {Taskparallel} from './taskbuffer.classes.taskparallel'
|
export {Taskparallel} from './taskbuffer.classes.taskparallel'
|
||||||
export {Taskspace} from './taskbuffer.classes.taskspace'
|
|
||||||
|
|
||||||
// import for naming only
|
// import for naming only
|
||||||
import './taskbuffer.classes.helpers'
|
import './taskbuffer.classes.helpers'
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
// TaskChain chains tasks
|
||||||
|
// and extends Task
|
||||||
|
|
||||||
import * as plugins from './taskbuffer.plugins'
|
import * as plugins from './taskbuffer.plugins'
|
||||||
import { Task } from './taskbuffer.classes.task'
|
import { Task } from './taskbuffer.classes.task'
|
||||||
import helpers = require('./taskbuffer.classes.helpers')
|
import helpers = require('./taskbuffer.classes.helpers')
|
||||||
|
@ -1 +1,89 @@
|
|||||||
import * as plugins from './taskbuffer.plugins'
|
import * as plugins from './taskbuffer.plugins'
|
||||||
|
import { Task } from './taskbuffer.classes.task'
|
||||||
|
|
||||||
|
// interfaces
|
||||||
|
import { Objectmap } from 'lik'
|
||||||
|
|
||||||
|
export class TaskManager {
|
||||||
|
taskMap = new plugins.lik.Objectmap<Task>()
|
||||||
|
private cronJobArray: ICronJob[] = []
|
||||||
|
constructor () {
|
||||||
|
// nothing here
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks if a task is already present
|
||||||
|
* @param taskNameArg
|
||||||
|
*/
|
||||||
|
getTaskByName (taskNameArg): Task {
|
||||||
|
return this.taskMap.find((itemArg) => {
|
||||||
|
return itemArg.name === taskNameArg
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adds a Task to the TaskManager
|
||||||
|
* @param taskArg
|
||||||
|
*/
|
||||||
|
addTask (taskArg: Task): void {
|
||||||
|
if (!taskArg.name) {
|
||||||
|
throw new Error('taskArg needs a name to be added to taskManager')
|
||||||
|
}
|
||||||
|
this.taskMap.add(taskArg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adds and schedules a task at once
|
||||||
|
* @param taskArg
|
||||||
|
* @param cronStringArg
|
||||||
|
*/
|
||||||
|
addAndScheduleTask (taskArg: Task, cronStringArg: string) {
|
||||||
|
this.addTask(taskArg)
|
||||||
|
let taskName = taskArg.name
|
||||||
|
this.scheduleTaskByName(taskName, cronStringArg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* triggers a task in the TaskManagerByName
|
||||||
|
* @param taskNameArg
|
||||||
|
*/
|
||||||
|
triggerTaskByName (taskNameArg: string) {
|
||||||
|
let taskToTrigger = this.getTaskByName(taskNameArg)
|
||||||
|
if (!taskToTrigger) {
|
||||||
|
throw new Error(`There is no task with the name of ${taskNameArg}`)
|
||||||
|
}
|
||||||
|
taskToTrigger.trigger()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* schedules the task by name
|
||||||
|
* @param taskNameArg
|
||||||
|
*/
|
||||||
|
scheduleTaskByName (taskNameArg: string, cronStringArg: string) {
|
||||||
|
let taskToSchedule = this.getTaskByName(taskNameArg)
|
||||||
|
let job = new plugins.cron.CronJob({
|
||||||
|
cronTime: cronStringArg,
|
||||||
|
onTick: taskToSchedule.trigger,
|
||||||
|
start: true
|
||||||
|
})
|
||||||
|
this.cronJobArray.push({
|
||||||
|
taskNameArg: taskToSchedule.name,
|
||||||
|
cronString: cronStringArg,
|
||||||
|
job: job
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns all schedules of a specific task
|
||||||
|
* @param taskNameArg
|
||||||
|
*/
|
||||||
|
getSchedulesForTaskName (taskNameArg: string) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ICronJob {
|
||||||
|
cronString: string
|
||||||
|
taskNameArg: string
|
||||||
|
job: any
|
||||||
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import * as plugins from "./taskbuffer.plugins"
|
import * as plugins from './taskbuffer.plugins'
|
||||||
import * as helpers from "./taskbuffer.classes.helpers"
|
import * as helpers from './taskbuffer.classes.helpers'
|
||||||
import { Task } from "./taskbuffer.classes.task"
|
import { Task } from './taskbuffer.classes.task'
|
||||||
|
|
||||||
export class Taskparallel extends Task {
|
export class Taskparallel extends Task {
|
||||||
taskArray: Task[];
|
taskArray: Task[]
|
||||||
constructor (optionsArg: {
|
constructor (optionsArg: {
|
||||||
taskArray: Task[]
|
taskArray: Task[]
|
||||||
}) {
|
}) {
|
||||||
@ -11,19 +11,18 @@ export class Taskparallel extends Task {
|
|||||||
optionsArg,
|
optionsArg,
|
||||||
{
|
{
|
||||||
taskFunction: () => {
|
taskFunction: () => {
|
||||||
let done = plugins.q.defer();
|
let done = plugins.q.defer()
|
||||||
let promiseArray: Promise<any>[] = []; // stores promises of all tasks, since they run in parallel
|
let promiseArray: Promise<any>[] = [] // stores promises of all tasks, since they run in parallel
|
||||||
this.taskArray.forEach(function (taskArg) {
|
this.taskArray.forEach(function (taskArg) {
|
||||||
promiseArray.push(taskArg.trigger());
|
promiseArray.push(taskArg.trigger())
|
||||||
})
|
})
|
||||||
Promise.all(promiseArray)
|
Promise.all(promiseArray)
|
||||||
.then(done.resolve);
|
.then(done.resolve)
|
||||||
return done.promise;
|
return done.promise
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
super(options);
|
super(options)
|
||||||
this.taskArray = optionsArg.taskArray;
|
this.taskArray = optionsArg.taskArray
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
import * as plugins from "./taskbuffer.plugins"
|
|
||||||
import * as helpers from "./taskbuffer.classes.helpers"
|
|
||||||
|
|
||||||
export class Taskspace {
|
|
||||||
|
|
||||||
}
|
|
@ -1,12 +1,18 @@
|
|||||||
import 'typings-global'
|
import 'typings-global'
|
||||||
import * as beautylog from 'beautylog'
|
import * as beautylog from 'beautylog'
|
||||||
|
let cron = require('cron')
|
||||||
|
import * as lik from 'lik'
|
||||||
import * as lodash from 'lodash'
|
import * as lodash from 'lodash'
|
||||||
import * as rxjs from 'rxjs'
|
import * as rxjs from 'rxjs'
|
||||||
import * as q from 'smartq'
|
import * as q from 'smartq'
|
||||||
|
import * as smartdelay from 'smartdelay'
|
||||||
|
|
||||||
export {
|
export {
|
||||||
beautylog,
|
beautylog,
|
||||||
|
cron,
|
||||||
|
lik,
|
||||||
lodash,
|
lodash,
|
||||||
rxjs,
|
rxjs,
|
||||||
q
|
q,
|
||||||
|
smartdelay
|
||||||
}
|
}
|
85
yarn.lock
85
yarn.lock
@ -19,18 +19,30 @@
|
|||||||
version "3.5.2"
|
version "3.5.2"
|
||||||
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.5.2.tgz#c11cd2817d3a401b7ba0f5a420f35c56139b1c1e"
|
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.5.2.tgz#c11cd2817d3a401b7ba0f5a420f35c56139b1c1e"
|
||||||
|
|
||||||
"@types/lodash@4.x.x", "@types/lodash@^4.14.55":
|
"@types/cron@^1.2.1":
|
||||||
version "4.14.65"
|
version "1.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.65.tgz#a0f78d71ffcd3c02628d5f616410c98c424326d5"
|
resolved "https://registry.yarnpkg.com/@types/cron/-/cron-1.2.1.tgz#95c1e432d6106ca34c92f0743638bc786c073faa"
|
||||||
|
|
||||||
|
"@types/lodash@4.x.x", "@types/lodash@^4.14.55", "@types/lodash@^4.14.62":
|
||||||
|
version "4.14.66"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.66.tgz#3dbb83477becf130611f8fac82a8fdb199805981"
|
||||||
|
|
||||||
|
"@types/minimatch@2.x.x":
|
||||||
|
version "2.0.29"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-2.0.29.tgz#5002e14f75e2d71e564281df0431c8c1b4a2a36a"
|
||||||
|
|
||||||
"@types/node@*", "@types/node@^7.0.29":
|
"@types/node@*", "@types/node@^7.0.29":
|
||||||
version "7.0.29"
|
version "7.0.31"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.29.tgz#ccfcec5b7135c7caf6c4ffb8c7f33102340d99df"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.31.tgz#80ea4d175599b2a00149c29a10a4eb2dff592e86"
|
||||||
|
|
||||||
"@types/promises-a-plus@*":
|
"@types/promises-a-plus@*":
|
||||||
version "0.0.27"
|
version "0.0.27"
|
||||||
resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780"
|
resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780"
|
||||||
|
|
||||||
|
"@types/q@1.x.x":
|
||||||
|
version "1.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.0.1.tgz#dbccb01bd8f0f801a12a4604c7d7af59bb02ae2f"
|
||||||
|
|
||||||
"@types/shelljs@^0.6.0":
|
"@types/shelljs@^0.6.0":
|
||||||
version "0.6.0"
|
version "0.6.0"
|
||||||
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.6.0.tgz#090b705c102ce7fc5c0c5ea9b524418ff15840df"
|
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.6.0.tgz#090b705c102ce7fc5c0c5ea9b524418ff15840df"
|
||||||
@ -57,9 +69,9 @@ assertion-error@^1.0.1:
|
|||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c"
|
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c"
|
||||||
|
|
||||||
balanced-match@^0.4.1:
|
balanced-match@^1.0.0:
|
||||||
version "0.4.2"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838"
|
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
||||||
|
|
||||||
beautycolor@^1.0.7:
|
beautycolor@^1.0.7:
|
||||||
version "1.0.7"
|
version "1.0.7"
|
||||||
@ -86,10 +98,10 @@ bindings@^1.2.1:
|
|||||||
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11"
|
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11"
|
||||||
|
|
||||||
brace-expansion@^1.1.7:
|
brace-expansion@^1.1.7:
|
||||||
version "1.1.7"
|
version "1.1.8"
|
||||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.7.tgz#3effc3c50e000531fb720eaff80f0ae8ef23cf59"
|
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292"
|
||||||
dependencies:
|
dependencies:
|
||||||
balanced-match "^0.4.1"
|
balanced-match "^1.0.0"
|
||||||
concat-map "0.0.1"
|
concat-map "0.0.1"
|
||||||
|
|
||||||
chai-as-promised@^6.0.0:
|
chai-as-promised@^6.0.0:
|
||||||
@ -99,8 +111,8 @@ chai-as-promised@^6.0.0:
|
|||||||
check-error "^1.0.2"
|
check-error "^1.0.2"
|
||||||
|
|
||||||
chai-string@^1.3.0:
|
chai-string@^1.3.0:
|
||||||
version "1.3.0"
|
version "1.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.3.0.tgz#df6139f294391b1035be5606f60a843b3a5041e7"
|
resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.4.0.tgz#359140c051d36a4e4b1a5fc6b910152f438a8d49"
|
||||||
|
|
||||||
chai@^3.5.0:
|
chai@^3.5.0:
|
||||||
version "3.5.0"
|
version "3.5.0"
|
||||||
@ -138,6 +150,12 @@ concat-map@0.0.1:
|
|||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||||
|
|
||||||
|
cron@^1.2.1:
|
||||||
|
version "1.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/cron/-/cron-1.2.1.tgz#3a86c09b41b8f261ac863a7cc85ea4735857eab2"
|
||||||
|
dependencies:
|
||||||
|
moment-timezone "^0.5.x"
|
||||||
|
|
||||||
deep-eql@^0.1.3:
|
deep-eql@^0.1.3:
|
||||||
version "0.1.3"
|
version "0.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2"
|
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2"
|
||||||
@ -218,6 +236,21 @@ left-pad@^1.1.3:
|
|||||||
version "1.1.3"
|
version "1.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a"
|
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a"
|
||||||
|
|
||||||
|
lik@^1.0.31:
|
||||||
|
version "1.0.31"
|
||||||
|
resolved "https://registry.yarnpkg.com/lik/-/lik-1.0.31.tgz#5c7635d880cdbb28aeb1259223fd948797616bcd"
|
||||||
|
dependencies:
|
||||||
|
"@types/lodash" "^4.14.62"
|
||||||
|
"@types/minimatch" "2.x.x"
|
||||||
|
"@types/q" "1.x.x"
|
||||||
|
lodash "^4.17.4"
|
||||||
|
minimatch "^3.0.3"
|
||||||
|
q "^1.5.0"
|
||||||
|
rxjs "^5.3.0"
|
||||||
|
smartq "^1.1.1"
|
||||||
|
tapbundle "^1.0.14"
|
||||||
|
typings-global "^1.0.14"
|
||||||
|
|
||||||
lodash@^4.17.4:
|
lodash@^4.17.4:
|
||||||
version "4.17.4"
|
version "4.17.4"
|
||||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
|
||||||
@ -239,7 +272,7 @@ mimic-fn@^1.0.0:
|
|||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18"
|
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18"
|
||||||
|
|
||||||
minimatch@^3.0.4:
|
minimatch@^3.0.3, minimatch@^3.0.4:
|
||||||
version "3.0.4"
|
version "3.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -249,6 +282,16 @@ minimist@^1.2.0:
|
|||||||
version "1.2.0"
|
version "1.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
|
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
|
||||||
|
|
||||||
|
moment-timezone@^0.5.x:
|
||||||
|
version "0.5.13"
|
||||||
|
resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.13.tgz#99ce5c7d827262eb0f1f702044177f60745d7b90"
|
||||||
|
dependencies:
|
||||||
|
moment ">= 2.9.0"
|
||||||
|
|
||||||
|
"moment@>= 2.9.0":
|
||||||
|
version "2.18.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/moment/-/moment-2.18.1.tgz#c36193dd3ce1c2eed2adb7c802dbbc77a81b1c0f"
|
||||||
|
|
||||||
nan@^2.3.2:
|
nan@^2.3.2:
|
||||||
version "2.6.2"
|
version "2.6.2"
|
||||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45"
|
resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45"
|
||||||
@ -266,8 +309,8 @@ onetime@^2.0.0:
|
|||||||
mimic-fn "^1.0.0"
|
mimic-fn "^1.0.0"
|
||||||
|
|
||||||
ora@^1.1.0:
|
ora@^1.1.0:
|
||||||
version "1.2.0"
|
version "1.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/ora/-/ora-1.2.0.tgz#32fb3183500efe83f5ea89101785f0ee6060fec9"
|
resolved "https://registry.yarnpkg.com/ora/-/ora-1.3.0.tgz#80078dd2b92a934af66a3ad72a5b910694ede51a"
|
||||||
dependencies:
|
dependencies:
|
||||||
chalk "^1.1.1"
|
chalk "^1.1.1"
|
||||||
cli-cursor "^2.1.0"
|
cli-cursor "^2.1.0"
|
||||||
@ -286,6 +329,10 @@ pretty-bytes@^4.0.2:
|
|||||||
version "4.0.2"
|
version "4.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
|
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
|
||||||
|
|
||||||
|
q@^1.5.0:
|
||||||
|
version "1.5.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/q/-/q-1.5.0.tgz#dd01bac9d06d30e6f219aecb8253ee9ebdc308f1"
|
||||||
|
|
||||||
rechoir@^0.6.2:
|
rechoir@^0.6.2:
|
||||||
version "0.6.2"
|
version "0.6.2"
|
||||||
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
|
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
|
||||||
@ -305,9 +352,9 @@ restore-cursor@^2.0.0:
|
|||||||
onetime "^2.0.0"
|
onetime "^2.0.0"
|
||||||
signal-exit "^3.0.2"
|
signal-exit "^3.0.2"
|
||||||
|
|
||||||
rxjs@^5.4.0:
|
rxjs@^5.3.0, rxjs@^5.4.1:
|
||||||
version "5.4.0"
|
version "5.4.1"
|
||||||
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.0.tgz#a7db14ab157f9d7aac6a56e655e7a3860d39bf26"
|
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.1.tgz#b62f757f279445d265a18a58fb0a70dc90e91626"
|
||||||
dependencies:
|
dependencies:
|
||||||
symbol-observable "^1.0.1"
|
symbol-observable "^1.0.1"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user