@deepbounty/sdk 1.0.1 → 1.0.3
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/README.md +4 -9
- package/dist/index.d.ts +31 -0
- package/dist/index.js +1 -0
- package/dist/types/alerts.d.ts +12 -0
- package/dist/types/alerts.js +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.js +7 -0
- package/dist/types/modules.d.ts +22 -0
- package/dist/types/modules.js +1 -0
- package/dist/types/targets.d.ts +11 -0
- package/dist/types/targets.js +1 -0
- package/dist/types/tasks.d.ts +19 -0
- package/dist/types/tasks.js +1 -0
- package/dist/types/tools.d.ts +8 -0
- package/dist/types/tools.js +1 -0
- package/dist/types/websockets.d.ts +4 -0
- package/dist/types/websockets.js +1 -0
- package/dist/types/workers.d.ts +8 -0
- package/dist/types/workers.js +1 -0
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -8,13 +8,8 @@ The official SDK for developing modules for the DeepBounty project.
|
|
|
8
8
|
npm install @deepbounty/sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## 📤 Publish
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
2. Publish to npm:
|
|
18
|
-
```bash
|
|
19
|
-
npm publish --access public
|
|
20
|
-
```
|
|
13
|
+
```bash
|
|
14
|
+
npm publish --access public
|
|
15
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ModuleSetting, TaskContent, TaskResult } from "./types";
|
|
2
|
+
export interface Logger {
|
|
3
|
+
info: (...args: any[]) => void;
|
|
4
|
+
warn: (...args: any[]) => void;
|
|
5
|
+
error: (...args: any[]) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface ConfigAPI {
|
|
8
|
+
get<T = any>(key: string, defaultValue?: T): Promise<T>;
|
|
9
|
+
set<T = any>(key: string, value: T): Promise<void>;
|
|
10
|
+
remove(key: string): Promise<void>;
|
|
11
|
+
getAll(): Promise<Record<string, any>>;
|
|
12
|
+
getSetting(name: string): Promise<ModuleSetting>;
|
|
13
|
+
setSetting(name: string, value: any): Promise<void>;
|
|
14
|
+
getAllSettings(): Promise<ModuleSetting[]>;
|
|
15
|
+
}
|
|
16
|
+
export interface TasksAPI {
|
|
17
|
+
submit(taskContent: TaskContent): Promise<TaskResult>;
|
|
18
|
+
}
|
|
19
|
+
export interface ServerAPI {
|
|
20
|
+
version: string;
|
|
21
|
+
logger: Logger;
|
|
22
|
+
config: ConfigAPI;
|
|
23
|
+
tasks: TasksAPI;
|
|
24
|
+
}
|
|
25
|
+
export interface PluginLifecycle {
|
|
26
|
+
run?(api: ServerAPI): Promise<void> | void;
|
|
27
|
+
stop?(): Promise<void> | void;
|
|
28
|
+
}
|
|
29
|
+
export type PluginFactory = (api: ServerAPI) => PluginLifecycle | Promise<PluginLifecycle>;
|
|
30
|
+
declare const _default: any;
|
|
31
|
+
export default _default;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {}; // Type-only module for plugins to import types during compile
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Tool } from "./tools";
|
|
2
|
+
export interface Module {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
version: string;
|
|
6
|
+
entry: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
settings?: ModuleSetting[];
|
|
9
|
+
tools?: Tool[];
|
|
10
|
+
}
|
|
11
|
+
export interface ModuleSetting {
|
|
12
|
+
name: string;
|
|
13
|
+
type: "checkbox" | "text" | "select" | "info";
|
|
14
|
+
default: string | boolean;
|
|
15
|
+
label: string;
|
|
16
|
+
value?: string | boolean;
|
|
17
|
+
options?: string[];
|
|
18
|
+
}
|
|
19
|
+
export interface LoadedModule extends Module {
|
|
20
|
+
run: () => Promise<any>;
|
|
21
|
+
tools?: Tool[];
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Tool } from "./tools";
|
|
2
|
+
export interface TaskContent {
|
|
3
|
+
commands: string[];
|
|
4
|
+
requiredTools?: Tool[];
|
|
5
|
+
}
|
|
6
|
+
export interface Task extends TaskContent {
|
|
7
|
+
id: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ServerTask extends Task {
|
|
10
|
+
workerId?: number;
|
|
11
|
+
status: "pending" | "running" | "completed" | "failed";
|
|
12
|
+
createdAt: Date;
|
|
13
|
+
}
|
|
14
|
+
export interface TaskResult {
|
|
15
|
+
taskId: number;
|
|
16
|
+
success: boolean;
|
|
17
|
+
output?: any;
|
|
18
|
+
error?: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepbounty/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "DeepBounty SDK for module development",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,8 +24,7 @@
|
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "tsc",
|
|
27
|
-
"prepublishOnly": "npm run build"
|
|
28
|
-
"publish": "npm publish --access public"
|
|
27
|
+
"prepublishOnly": "npm run build"
|
|
29
28
|
},
|
|
30
29
|
"keywords": [
|
|
31
30
|
"deepbounty",
|