@harborclient/sdk 1.0.44 → 1.0.46
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/snippets.d.ts +54 -15
- package/package.json +2 -1
package/dist/snippets.d.ts
CHANGED
|
@@ -4,8 +4,16 @@
|
|
|
4
4
|
* Keep in sync with the runtime hc sandbox in harborclient
|
|
5
5
|
* `src/main/scripting/scriptApi.ts` and editor completions in
|
|
6
6
|
* `src/renderer/src/scripting/hcCompletions.ts`.
|
|
7
|
+
*
|
|
8
|
+
* `hc.expect` is Chai BDD expect — see https://www.chaijs.com/api/bdd/
|
|
9
|
+
* `hc.response.to` provides Postman-style response matchers.
|
|
7
10
|
*/
|
|
8
11
|
|
|
12
|
+
/// <reference types="chai" />
|
|
13
|
+
|
|
14
|
+
/** Chai BDD expect factory type for hc.expect. */
|
|
15
|
+
type HcExpectStatic = typeof import('chai').expect;
|
|
16
|
+
|
|
9
17
|
/**
|
|
10
18
|
* Header helpers on hc.request.headers and hc.collection.headers.
|
|
11
19
|
*/
|
|
@@ -217,20 +225,6 @@ interface HcSendRequestResponse {
|
|
|
217
225
|
json(): unknown;
|
|
218
226
|
}
|
|
219
227
|
|
|
220
|
-
/**
|
|
221
|
-
* Chai-lite matcher returned by hc.expect(actual).
|
|
222
|
-
*/
|
|
223
|
-
interface HcExpectMatcher {
|
|
224
|
-
to: {
|
|
225
|
-
equal(expected: unknown): void;
|
|
226
|
-
eql(expected: unknown): void;
|
|
227
|
-
include(substr: string): void;
|
|
228
|
-
be: {
|
|
229
|
-
ok(): void;
|
|
230
|
-
};
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
|
|
234
228
|
/**
|
|
235
229
|
* Element surface exposed by hc.response.document() for HTML bodies.
|
|
236
230
|
*/
|
|
@@ -248,6 +242,48 @@ interface HcResponseDocument {
|
|
|
248
242
|
querySelectorAll(selector: string): HcResponseElement[];
|
|
249
243
|
}
|
|
250
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Response snapshot available in post-request scripts as hc.response.
|
|
247
|
+
*/
|
|
248
|
+
interface HcResponseAssertionHave {
|
|
249
|
+
status(codeOrText: number | string): void;
|
|
250
|
+
header(name: string): void;
|
|
251
|
+
header(name: string, value: string): void;
|
|
252
|
+
body(): void;
|
|
253
|
+
body(expected: string | RegExp): void;
|
|
254
|
+
jsonBody(): void;
|
|
255
|
+
jsonBody(expected: object): void;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Status-class and body shortcuts on hc.response.to.be.*.
|
|
260
|
+
*/
|
|
261
|
+
interface HcResponseAssertionBe {
|
|
262
|
+
readonly success: void;
|
|
263
|
+
readonly redirection: void;
|
|
264
|
+
readonly clientError: void;
|
|
265
|
+
readonly serverError: void;
|
|
266
|
+
readonly error: void;
|
|
267
|
+
readonly ok: void;
|
|
268
|
+
readonly accepted: void;
|
|
269
|
+
readonly badRequest: void;
|
|
270
|
+
readonly unauthorized: void;
|
|
271
|
+
readonly forbidden: void;
|
|
272
|
+
readonly notFound: void;
|
|
273
|
+
readonly rateLimited: void;
|
|
274
|
+
readonly json: void;
|
|
275
|
+
readonly withBody: void;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Chai assertion chain for Postman-style hc.response.to.* matchers.
|
|
280
|
+
*/
|
|
281
|
+
interface HcResponseAssertion {
|
|
282
|
+
readonly have: HcResponseAssertionHave;
|
|
283
|
+
readonly be: HcResponseAssertionBe;
|
|
284
|
+
readonly not: HcResponseAssertion;
|
|
285
|
+
}
|
|
286
|
+
|
|
251
287
|
/**
|
|
252
288
|
* Response snapshot available in post-request scripts as hc.response.
|
|
253
289
|
*/
|
|
@@ -256,6 +292,8 @@ interface HcResponseApi {
|
|
|
256
292
|
readonly status: string;
|
|
257
293
|
readonly headers: Record<string, string>;
|
|
258
294
|
readonly responseTime: number;
|
|
295
|
+
/** Postman-style response assertions (hc.response.to.have.status(200), etc.). */
|
|
296
|
+
readonly to: HcResponseAssertion;
|
|
259
297
|
text(): string;
|
|
260
298
|
json(): unknown;
|
|
261
299
|
document(): HcResponseDocument;
|
|
@@ -297,7 +335,8 @@ interface HcScriptApi {
|
|
|
297
335
|
*/
|
|
298
336
|
sendRequest(req: HcSendRequestInput): Promise<HcSendRequestResponse>;
|
|
299
337
|
test(name: string, fn: () => void): void;
|
|
300
|
-
expect
|
|
338
|
+
/** Chai BDD expect; see https://www.chaijs.com/api/bdd/ */
|
|
339
|
+
expect: HcExpectStatic;
|
|
301
340
|
/**
|
|
302
341
|
* Available in post-request scripts after the primary request completes.
|
|
303
342
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@harborclient/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.46",
|
|
4
4
|
"description": "TypeScript SDK for HarborClient development.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"harborclient",
|
|
@@ -200,6 +200,7 @@
|
|
|
200
200
|
"@storybook/react-vite": "^10.4.6",
|
|
201
201
|
"@tailwindcss/vite": "^4.3.1",
|
|
202
202
|
"@trivago/prettier-plugin-sort-imports": "^6.0.2",
|
|
203
|
+
"@types/chai": "^4.3.20",
|
|
203
204
|
"@types/node": "^26.0.1",
|
|
204
205
|
"@types/react": "^19.1.2",
|
|
205
206
|
"@types/react-dom": "^19.1.2",
|