@caido/sdk-backend 0.40.1-beta.1 → 0.40.1-beta.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/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/typing.d.ts +17 -9
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
package/src/typing.d.ts
CHANGED
|
@@ -10,7 +10,15 @@ declare module "caido:plugin" {
|
|
|
10
10
|
/**
|
|
11
11
|
* The SDK for the API RPC service.
|
|
12
12
|
*/
|
|
13
|
-
export type APISDK = {
|
|
13
|
+
export type APISDK<API = {}, Events = {}> = {
|
|
14
|
+
/**
|
|
15
|
+
* Sends an event to the frontend plugin.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* sdk.api.send("myEvent", 5, "hello");
|
|
19
|
+
*/
|
|
20
|
+
send(event: keyof Events, ...args: any[]): void;
|
|
21
|
+
|
|
14
22
|
/**
|
|
15
23
|
* Registers a new backend function for the RPC.
|
|
16
24
|
*
|
|
@@ -20,7 +28,7 @@ declare module "caido:plugin" {
|
|
|
20
28
|
* });
|
|
21
29
|
*/
|
|
22
30
|
register(
|
|
23
|
-
name:
|
|
31
|
+
name: keyof API,
|
|
24
32
|
callback: (sdk: SDK, ...args: any[]) => MaybePromise<any>,
|
|
25
33
|
): void;
|
|
26
34
|
};
|
|
@@ -28,7 +36,7 @@ declare module "caido:plugin" {
|
|
|
28
36
|
/**
|
|
29
37
|
* The SDK for the API RPC service.
|
|
30
38
|
*/
|
|
31
|
-
export type EventsSDK = {
|
|
39
|
+
export type EventsSDK<API = {}, Events = {}> = {
|
|
32
40
|
/**
|
|
33
41
|
* Registers an callback on new intercepted requests.
|
|
34
42
|
*
|
|
@@ -40,7 +48,7 @@ declare module "caido:plugin" {
|
|
|
40
48
|
* });
|
|
41
49
|
*/
|
|
42
50
|
onInterceptRequest(
|
|
43
|
-
callback: (sdk: SDK, request: Request) => MaybePromise<void>,
|
|
51
|
+
callback: (sdk: SDK<API, Events>, request: Request) => MaybePromise<void>,
|
|
44
52
|
): void;
|
|
45
53
|
|
|
46
54
|
/**
|
|
@@ -55,7 +63,7 @@ declare module "caido:plugin" {
|
|
|
55
63
|
*/
|
|
56
64
|
onInterceptResponse(
|
|
57
65
|
callback: (
|
|
58
|
-
sdk: SDK,
|
|
66
|
+
sdk: SDK<API, Events>,
|
|
59
67
|
request: Request,
|
|
60
68
|
response: Response,
|
|
61
69
|
) => MaybePromise<void>,
|
|
@@ -65,7 +73,7 @@ declare module "caido:plugin" {
|
|
|
65
73
|
/**
|
|
66
74
|
* The SDK object available to all scripts.
|
|
67
75
|
*/
|
|
68
|
-
export
|
|
76
|
+
export interface SDK<API = {}, Events = {}> {
|
|
69
77
|
/**
|
|
70
78
|
* The console.
|
|
71
79
|
*
|
|
@@ -83,10 +91,10 @@ declare module "caido:plugin" {
|
|
|
83
91
|
/**
|
|
84
92
|
* The SDK for the API RPC service.
|
|
85
93
|
*/
|
|
86
|
-
api: APISDK
|
|
94
|
+
api: APISDK<API, Events>;
|
|
87
95
|
/**
|
|
88
96
|
* The SDK for the Events service.
|
|
89
97
|
*/
|
|
90
|
-
events: EventsSDK
|
|
91
|
-
}
|
|
98
|
+
events: EventsSDK<API, Events>;
|
|
99
|
+
}
|
|
92
100
|
}
|