@caido/sdk-workflow 0.35.0 → 0.36.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/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
  <hr />
19
19
  </div>
20
20
 
21
- ## 👋 Frontend SDK
21
+ ## 👋 Workflow SDK
22
22
 
23
23
  [![NPM Version](https://img.shields.io/npm/v/@caido/sdk-workflow?style=for-the-badge)](https://www.npmjs.com/package/@caido/sdk-workflow)
24
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caido/sdk-workflow",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Typing for the Caido Workflow SDK",
5
5
  "author": "Caido Labs Inc. <dev@caido.io>",
6
6
  "license": "MIT",
package/src/typing.d.ts CHANGED
@@ -49,11 +49,21 @@ export declare type Request = {
49
49
  getMethod(): string;
50
50
  getPath(): string;
51
51
  getQuery(): string;
52
+ getHeaders(): Record<string, Array<string>>;
52
53
  getHeader(name: string): Array<string> | undefined;
53
54
  getBody(): Body | undefined;
54
55
  toSpec(): RequestSpec;
55
56
  };
56
57
 
58
+ type SetBodyOptions = {
59
+ /**
60
+ * Should update the Content-Type header.
61
+ *
62
+ * @default true
63
+ */
64
+ updateContentLength: boolean;
65
+ };
66
+
57
67
  /**
58
68
  * A mutable Request not yet sent.
59
69
  */
@@ -71,10 +81,12 @@ export declare class RequestSpec {
71
81
  setPath(path: string): void;
72
82
  getQuery(): string;
73
83
  setQuery(query: string): void;
84
+ getHeaders(): Record<string, Array<string>>;
74
85
  getHeader(name: string): Array<string> | undefined;
75
86
  setHeader(name: string, value: string): void;
87
+ removeHeader(name: string): void;
76
88
  getBody(): Body | undefined;
77
- setBody(body: Body | Bytes): void;
89
+ setBody(body: Body | Bytes, options?: SetBodyOptions): void;
78
90
  }
79
91
 
80
92
  /**
@@ -83,6 +95,7 @@ export declare class RequestSpec {
83
95
  export declare type Response = {
84
96
  getId(): ID;
85
97
  getCode(): number;
98
+ getHeaders(): Record<string, Array<string>>;
86
99
  getHeader(name: string): Array<string> | undefined;
87
100
  getBody(): Body | undefined;
88
101
  };
@@ -90,7 +103,7 @@ export declare type Response = {
90
103
  /**
91
104
  * An immutable saved Request and Response pair.
92
105
  */
93
- export declare type RequestReponse = {
106
+ export declare type RequestResponse = {
94
107
  request: Request;
95
108
  response: Response;
96
109
  };
@@ -108,7 +121,7 @@ export declare type RequestsSDK = {
108
121
  *
109
122
  * @example
110
123
  * const spec = new RequestSpec("https://example.com");
111
- * sdk.send(request)
124
+ * sdk.requests.send(request)
112
125
  * .then((res) => {
113
126
  * console.log(res.request.getId());
114
127
  * console.log(res.response.getCode());
@@ -117,7 +130,17 @@ export declare type RequestsSDK = {
117
130
  * console.error(err);
118
131
  * });
119
132
  */
120
- send(request: RequestSpec): Promise<RequestReponse>;
133
+ send(request: RequestSpec): Promise<RequestResponse>;
134
+
135
+ /**
136
+ * Checks if a request is in scope.
137
+ *
138
+ * @example
139
+ * if (sdk.requests.inScope(request)) {
140
+ * console.log("In scope");
141
+ * }
142
+ */
143
+ inScope(request: Request | RequestSpec): boolean;
121
144
  };
122
145
 
123
146
  /**
@@ -162,11 +185,19 @@ export declare type FindingsSDK = {
162
185
  create(spec: FindingSpec): Promise<Finding>;
163
186
  };
164
187
 
165
- export declare type PassiveInput = {
188
+ export declare type HttpInput = {
166
189
  request: Request | undefined;
167
190
  response: Response | undefined;
168
191
  };
169
- export declare type ConvertInput = Array<number>;
192
+ /**
193
+ * @deprecated Use HttpInput instead.
194
+ */
195
+ export declare type PassiveInput = HttpInput;
196
+ export declare type BytesInput = Array<number>;
197
+ /**
198
+ * @deprecated Use BytesInput instead.
199
+ */
200
+ export declare type ConvertInput = BytesInput;
170
201
 
171
202
  export declare type ID = string;
172
203
  export declare type Data = Bytes;