@harborclient/sdk 1.0.45 → 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.
Files changed (2) hide show
  1. package/dist/snippets.d.ts +45 -0
  2. package/package.json +1 -1
@@ -6,6 +6,7 @@
6
6
  * `src/renderer/src/scripting/hcCompletions.ts`.
7
7
  *
8
8
  * `hc.expect` is Chai BDD expect — see https://www.chaijs.com/api/bdd/
9
+ * `hc.response.to` provides Postman-style response matchers.
9
10
  */
10
11
 
11
12
  /// <reference types="chai" />
@@ -241,6 +242,48 @@ interface HcResponseDocument {
241
242
  querySelectorAll(selector: string): HcResponseElement[];
242
243
  }
243
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
+
244
287
  /**
245
288
  * Response snapshot available in post-request scripts as hc.response.
246
289
  */
@@ -249,6 +292,8 @@ interface HcResponseApi {
249
292
  readonly status: string;
250
293
  readonly headers: Record<string, string>;
251
294
  readonly responseTime: number;
295
+ /** Postman-style response assertions (hc.response.to.have.status(200), etc.). */
296
+ readonly to: HcResponseAssertion;
252
297
  text(): string;
253
298
  json(): unknown;
254
299
  document(): HcResponseDocument;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harborclient/sdk",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "description": "TypeScript SDK for HarborClient development.",
5
5
  "keywords": [
6
6
  "harborclient",