@hasna/loops 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +17 -0
- package/README.md +127 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +1586 -0
- package/dist/daemon/control.d.ts +41 -0
- package/dist/daemon/daemon.d.ts +23 -0
- package/dist/daemon/index.d.ts +2 -0
- package/dist/daemon/index.js +1331 -0
- package/dist/daemon/install.d.ts +6 -0
- package/dist/daemon/loop.d.ts +10 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1067 -0
- package/dist/lib/executor.d.ts +7 -0
- package/dist/lib/format.d.ts +4 -0
- package/dist/lib/ids.d.ts +2 -0
- package/dist/lib/paths.d.ts +7 -0
- package/dist/lib/schedule.d.ts +21 -0
- package/dist/lib/scheduler.d.ts +18 -0
- package/dist/lib/store.d.ts +56 -0
- package/dist/lib/store.js +685 -0
- package/dist/sdk/index.d.ts +25 -0
- package/dist/sdk/index.js +1059 -0
- package/dist/types.d.ts +109 -0
- package/docs/USAGE.md +127 -0
- package/package.json +77 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Store } from "../lib/store.js";
|
|
2
|
+
export declare function readPid(path?: string): number | undefined;
|
|
3
|
+
export declare function writePid(pid?: number, path?: string): void;
|
|
4
|
+
export declare function removePid(path?: string): void;
|
|
5
|
+
export declare function isAlive(pid: number): boolean;
|
|
6
|
+
export interface DaemonProcessState {
|
|
7
|
+
running: boolean;
|
|
8
|
+
stale: boolean;
|
|
9
|
+
pid?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function isDaemonRunning(path?: string): DaemonProcessState;
|
|
12
|
+
export interface DaemonStatus extends DaemonProcessState {
|
|
13
|
+
lease?: ReturnType<Store["getDaemonLease"]>;
|
|
14
|
+
host: string;
|
|
15
|
+
loops: {
|
|
16
|
+
total: number;
|
|
17
|
+
active: number;
|
|
18
|
+
paused: number;
|
|
19
|
+
stopped: number;
|
|
20
|
+
expired: number;
|
|
21
|
+
};
|
|
22
|
+
runs: {
|
|
23
|
+
total: number;
|
|
24
|
+
running: number;
|
|
25
|
+
failed: number;
|
|
26
|
+
succeeded: number;
|
|
27
|
+
abandoned: number;
|
|
28
|
+
};
|
|
29
|
+
logPath: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function daemonStatus(store: Store, path?: string): DaemonStatus;
|
|
32
|
+
export declare function stopDaemon(opts?: {
|
|
33
|
+
path?: string;
|
|
34
|
+
timeoutMs?: number;
|
|
35
|
+
sleep?: (ms: number) => Promise<void>;
|
|
36
|
+
}): Promise<{
|
|
37
|
+
wasRunning: boolean;
|
|
38
|
+
stopped: boolean;
|
|
39
|
+
forced: boolean;
|
|
40
|
+
pid?: number;
|
|
41
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Store } from "../lib/store.js";
|
|
2
|
+
export interface RunDaemonOptions {
|
|
3
|
+
intervalMs?: number;
|
|
4
|
+
leaseTtlMs?: number;
|
|
5
|
+
store?: Store;
|
|
6
|
+
pidPath?: string;
|
|
7
|
+
shouldStop?: () => boolean;
|
|
8
|
+
sleep?: (ms: number) => Promise<void>;
|
|
9
|
+
log?: (message: string) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function runDaemon(opts?: RunDaemonOptions): Promise<void>;
|
|
12
|
+
export interface StartDaemonResult {
|
|
13
|
+
started: boolean;
|
|
14
|
+
alreadyRunning: boolean;
|
|
15
|
+
pid?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function startDaemon(opts: {
|
|
18
|
+
cliEntry: string;
|
|
19
|
+
execPath?: string;
|
|
20
|
+
args?: string[];
|
|
21
|
+
waitMs?: number;
|
|
22
|
+
sleep?: (ms: number) => Promise<void>;
|
|
23
|
+
}): Promise<StartDaemonResult>;
|