@deepbounty/sdk 1.1.0 → 1.1.2

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 CHANGED
@@ -39,12 +39,51 @@ export interface ConfigAPI {
39
39
  */
40
40
  getAllSettings(): Promise<ModuleSetting[]>;
41
41
  }
42
+ export interface StorageAPI {
43
+ /**
44
+ * Execute a raw SQL query (SELECT)
45
+ * @param sql The SQL query to execute
46
+ * @param params Optional parameters for the query
47
+ * @returns All matching rows
48
+ */
49
+ query<T = any>(sql: string, params?: any[]): T[];
50
+ /**
51
+ * Execute a raw SQL query and return the first row
52
+ * @param sql The SQL query to execute
53
+ * @param params Optional parameters for the query
54
+ * @returns The first matching row or undefined
55
+ */
56
+ queryOne<T = any>(sql: string, params?: any[]): T | undefined;
57
+ /**
58
+ * Execute a raw SQL statement (INSERT, UPDATE, DELETE)
59
+ * @param sql The SQL statement to execute
60
+ * @param params Optional parameters for the statement
61
+ * @returns Information about the execution (changes, lastInsertRowid)
62
+ */
63
+ execute(sql: string, params?: any[]): {
64
+ changes: number | bigint;
65
+ lastInsertRowid: number | bigint;
66
+ };
67
+ /**
68
+ * Helper method to create a table if it doesn't exist
69
+ * @param tableName The name of the table to create
70
+ * @param schema The schema definition for the table
71
+ */
72
+ createTable(tableName: string, schema: string): void;
73
+ /**
74
+ * Helper method to drop a table
75
+ * @param tableName The name of the table to drop
76
+ */
77
+ dropTable(tableName: string): void;
78
+ }
42
79
  export interface ServerAPI {
43
80
  version: string;
44
81
  logger: Logger;
45
82
  config: ConfigAPI;
83
+ storage: StorageAPI;
46
84
  /**
47
85
  * Register a task template that can be scheduled for all targets
86
+ * @param uniqueKey Unique identifier for this task within the module (e.g., "subdomain-scan")
48
87
  * @param name Friendly name for the task
49
88
  * @param description Task description
50
89
  * @param taskContent The task content including commands and tools
@@ -52,7 +91,7 @@ export interface ServerAPI {
52
91
  * @param onComplete Optional callback executed when the task completes
53
92
  * @returns The ID of the registered task template
54
93
  */
55
- registerTaskTemplate(name: string, description: string, taskContent: TaskContent, interval: number, onComplete?: (result: TaskResult) => void): Promise<number>;
94
+ registerTaskTemplate(uniqueKey: string, name: string, description: string, taskContent: TaskContent, interval: number, onComplete?: (result: TaskResult) => void): Promise<number>;
56
95
  /**
57
96
  * Unregister a task template
58
97
  * @param templateId The ID of the task template to unregister
@@ -16,4 +16,5 @@ export interface ModuleSetting {
16
16
  }
17
17
  export interface LoadedModule extends Module {
18
18
  run: () => Promise<any>;
19
+ stop?: () => void;
19
20
  }
@@ -7,12 +7,12 @@ export interface TaskContent {
7
7
  export interface TaskTemplate {
8
8
  id: number;
9
9
  moduleId: string;
10
+ uniqueKey: string;
10
11
  name: string;
11
12
  description?: string;
12
13
  content: TaskContent;
13
14
  interval: number;
14
15
  active: boolean;
15
- createdAt: Date;
16
16
  }
17
17
  export interface ScheduledTask {
18
18
  id: number;
@@ -47,5 +47,4 @@ export interface TargetTaskOverride {
47
47
  targetId: number;
48
48
  taskTemplateId: number;
49
49
  active: boolean;
50
- createdAt: Date;
51
50
  }
@@ -4,5 +4,4 @@ export interface Worker {
4
4
  id: number;
5
5
  currentTasks: TaskExecution[];
6
6
  availableTools: Tool[];
7
- loadFactor: number;
8
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepbounty/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "DeepBounty SDK for module development",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",