UNPKG

2.25 kBTypeScriptView Raw
1import { FolderNest } from "../nest/folderNest";
2import { Nest } from "../nest/nest";
3import { Job } from "../job/job";
4import { Environment } from "../environment/environment";
5import { WebhookNest } from "../nest/webhookNest";
6import { FtpNest } from "../nest/ftpNest";
7/**
8 * Tunnels are runnable work flow units that can watch nests.
9 */
10export declare class Tunnel {
11 protected name: string;
12 protected nests: Nest[];
13 protected run_list: any[];
14 protected run_sync_list: any[];
15 protected run_fail: any;
16 protected e: Environment;
17 protected job_counter: number;
18 protected match_obj: {
19 queue: any[];
20 run: any;
21 pattern: any;
22 orphan_minutes: any;
23 };
24 constructor(e: Environment, theName: string);
25 toString(): string;
26 getName(): string;
27 getNests(): Nest[];
28 getRunList(): any[];
29 getRunSyncList(): any[];
30 /**
31 * Instructs the tunnel to watch a nest for new jobs.
32 * @param nest
33 */
34 watch(nest: FolderNest | WebhookNest | FtpNest): void;
35 arrive(job: Job, nest?: Nest): void;
36 /**
37 * Run program logic asynchronously.
38 * @param callback
39 */
40 run(callback: any): void;
41 /**
42 * Run program logic synchronously.
43 * @param callback
44 */
45 runSync(callback: any): void;
46 /**
47 * Failed jobs runner.
48 * @param callback
49 */
50 fail(callback: any): void;
51 /**
52 * Asynchronous run event.
53 * @param job
54 * @param nest
55 */
56 protected executeRun(job: Job, nest: Nest): void;
57 /**
58 * Synchronous run event.
59 * @param job
60 * @param nest
61 */
62 protected executeRunSync(job: Job, nest: Nest): void;
63 /**
64 * Fail run event.
65 * @param job
66 * @param nest
67 * @param reason
68 */
69 executeFail(job: Job, nest: Nest, reason: string): void;
70 /**
71 * Interface for matching two or more files together based on an array of glob filename patterns.
72 * @param pattern
73 * @param orphanMinutes
74 * @param callback
75 */
76 match(pattern: string[] | string, orphanMinutes: number, callback: any): void;
77 /**
78 * Match execution
79 * @param job
80 * @param nest
81 */
82 protected executeMatch(job: Job, nest: Nest): void;
83}