@deepbounty/sdk 1.0.5 → 1.0.7
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/dist/index.d.ts +41 -2
- package/dist/types/modules.d.ts +0 -3
- package/dist/types/tasks.d.ts +12 -3
- package/dist/types/workers.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,59 @@
|
|
|
1
|
-
import { ModuleSetting, TaskContent
|
|
1
|
+
import { ModuleSetting, TaskContent } from "./types";
|
|
2
2
|
export interface Logger {
|
|
3
3
|
info: (...args: any[]) => void;
|
|
4
4
|
warn: (...args: any[]) => void;
|
|
5
5
|
error: (...args: any[]) => void;
|
|
6
6
|
}
|
|
7
7
|
export interface ConfigAPI {
|
|
8
|
+
/** Get a configuration value by key
|
|
9
|
+
* @param key The configuration key
|
|
10
|
+
* @param defaultValue The default value to return if the key does not exist
|
|
11
|
+
* @returns The configuration value
|
|
12
|
+
*/
|
|
8
13
|
get<T = any>(key: string, defaultValue?: T): Promise<T>;
|
|
14
|
+
/** Set a configuration value by key
|
|
15
|
+
* @param key The configuration key
|
|
16
|
+
* @param value The configuration value
|
|
17
|
+
* @returns A promise that resolves when the value is set
|
|
18
|
+
*/
|
|
9
19
|
set<T = any>(key: string, value: T): Promise<void>;
|
|
20
|
+
/** Remove a configuration value by key
|
|
21
|
+
* @param key The configuration key
|
|
22
|
+
* @returns A promise that resolves when the value is removed
|
|
23
|
+
*/
|
|
10
24
|
remove(key: string): Promise<void>;
|
|
11
25
|
getAll(): Promise<Record<string, any>>;
|
|
26
|
+
/** Get a specific module setting by name
|
|
27
|
+
* @param name The setting name
|
|
28
|
+
* @returns The module setting
|
|
29
|
+
*/
|
|
12
30
|
getSetting(name: string): Promise<ModuleSetting>;
|
|
31
|
+
/** Set a specific module setting by name
|
|
32
|
+
* @param name The setting name
|
|
33
|
+
* @param value The setting value
|
|
34
|
+
* @returns A promise that resolves when the value is set
|
|
35
|
+
*/
|
|
13
36
|
setSetting(name: string, value: any): Promise<void>;
|
|
37
|
+
/** Get all module settings
|
|
38
|
+
* @returns An array of all module settings
|
|
39
|
+
*/
|
|
14
40
|
getAllSettings(): Promise<ModuleSetting[]>;
|
|
15
41
|
}
|
|
16
42
|
export interface TasksAPI {
|
|
17
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Register a scheduled task that runs at a specific interval
|
|
45
|
+
* @param taskContent The task content including commands and required tools
|
|
46
|
+
* @param interval Interval in seconds between task executions
|
|
47
|
+
* @returns The ID of the registered scheduled task
|
|
48
|
+
*/
|
|
49
|
+
registerScheduledTask(taskContent: TaskContent, interval: number): number;
|
|
50
|
+
/**
|
|
51
|
+
* Unregister a scheduled task
|
|
52
|
+
* @param taskId The ID of the scheduled task to unregister
|
|
53
|
+
* @returns true if the task was unregistered, false if it didn't exist
|
|
54
|
+
*/
|
|
55
|
+
unregisterScheduledTask(taskId: number): boolean;
|
|
56
|
+
getModuleTasks(): any[];
|
|
18
57
|
}
|
|
19
58
|
export interface ServerAPI {
|
|
20
59
|
version: string;
|
package/dist/types/modules.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Tool } from "./tools";
|
|
2
1
|
export interface Module {
|
|
3
2
|
id: string;
|
|
4
3
|
name: string;
|
|
@@ -6,7 +5,6 @@ export interface Module {
|
|
|
6
5
|
entry: string;
|
|
7
6
|
description?: string;
|
|
8
7
|
settings?: ModuleSetting[];
|
|
9
|
-
tools?: Tool[];
|
|
10
8
|
}
|
|
11
9
|
export interface ModuleSetting {
|
|
12
10
|
name: string;
|
|
@@ -18,5 +16,4 @@ export interface ModuleSetting {
|
|
|
18
16
|
}
|
|
19
17
|
export interface LoadedModule extends Module {
|
|
20
18
|
run: () => Promise<any>;
|
|
21
|
-
tools?: Tool[];
|
|
22
19
|
}
|
package/dist/types/tasks.d.ts
CHANGED
|
@@ -3,16 +3,25 @@ export interface TaskContent {
|
|
|
3
3
|
commands: string[];
|
|
4
4
|
requiredTools?: Tool[];
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
6
|
+
export interface ScheduledTask {
|
|
7
7
|
id: number;
|
|
8
|
+
content: TaskContent;
|
|
9
|
+
interval: number;
|
|
10
|
+
moduleId: string;
|
|
11
|
+
lastExecutedAt?: Date;
|
|
12
|
+
nextExecutionAt: Date;
|
|
8
13
|
}
|
|
9
|
-
export interface
|
|
14
|
+
export interface TaskExecution {
|
|
15
|
+
executionId: number;
|
|
16
|
+
scheduledTaskId: number;
|
|
10
17
|
workerId?: number;
|
|
11
18
|
status: "pending" | "running" | "completed" | "failed";
|
|
12
19
|
createdAt: Date;
|
|
20
|
+
content: TaskContent;
|
|
13
21
|
}
|
|
14
22
|
export interface TaskResult {
|
|
15
|
-
|
|
23
|
+
executionId: number;
|
|
24
|
+
scheduledTaskId: number;
|
|
16
25
|
success: boolean;
|
|
17
26
|
output?: any;
|
|
18
27
|
error?: string;
|
package/dist/types/workers.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TaskExecution } from "./tasks";
|
|
2
2
|
import { Tool } from "./tools";
|
|
3
3
|
export interface Worker {
|
|
4
4
|
id: number;
|
|
5
|
-
currentTasks:
|
|
5
|
+
currentTasks: TaskExecution[];
|
|
6
6
|
availableTools: Tool[];
|
|
7
7
|
loadFactor: number;
|
|
8
8
|
}
|