@theholocron/checkly-client 1.41.0 → 1.42.1
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 +16 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.mjs +21 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -45,6 +45,22 @@ await checkly.checks.update(check.id, {
|
|
|
45
45
|
request: check.request,
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
+
// A second check with a request body -- e.g. to verify the endpoint's own
|
|
49
|
+
// signature checking, not just that it's reachable. request.body is sent
|
|
50
|
+
// as-is; the client sets Checkly's own bodyType to "RAW" whenever a body
|
|
51
|
+
// is given.
|
|
52
|
+
const signatureCheck = await checkly.checks.create({
|
|
53
|
+
name: "Sentinel webhook signature verification",
|
|
54
|
+
locations: ["us-east-1"],
|
|
55
|
+
shouldFail: true,
|
|
56
|
+
request: {
|
|
57
|
+
url: "https://sentinel.theholocron.dev/api/webhook",
|
|
58
|
+
method: "POST",
|
|
59
|
+
body: "{}",
|
|
60
|
+
assertions: [{ source: "STATUS_CODE", comparison: "EQUALS", target: "401" }],
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
48
64
|
// Delete it
|
|
49
65
|
await checkly.checks.delete(check.id);
|
|
50
66
|
```
|
package/dist/index.d.mts
CHANGED
|
@@ -32,6 +32,14 @@ interface ApiCheckRequest {
|
|
|
32
32
|
url: string;
|
|
33
33
|
method: HttpMethod;
|
|
34
34
|
assertions?: Assertion[];
|
|
35
|
+
/**
|
|
36
|
+
* Raw request body to send with the check — e.g. simulating a webhook
|
|
37
|
+
* delivery to verify signature checking is wired correctly end-to-end,
|
|
38
|
+
* as opposed to just the endpoint being reachable. Omitted entirely by
|
|
39
|
+
* default, leaving Checkly's own `bodyType` at `"NONE"`; `create()`/
|
|
40
|
+
* `update()` set it to `"RAW"` whenever a body is given.
|
|
41
|
+
*/
|
|
42
|
+
body?: string;
|
|
35
43
|
}
|
|
36
44
|
interface ApiCheckInput {
|
|
37
45
|
name: string;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import { createRestClient } from "@theholocron/http-client";
|
|
2
2
|
//#region ../../../../../src/checks/checks.ts
|
|
3
|
+
/**
|
|
4
|
+
* `ApiCheckInput.request.body` is holocron's simplified shape (just the raw
|
|
5
|
+
* string); Checkly's wire format pairs it with a `bodyType` discriminator.
|
|
6
|
+
* `"RAW"` whenever a body is given — the only body shape this client
|
|
7
|
+
* exposes today — otherwise left unset, so Checkly's own `"NONE"` default
|
|
8
|
+
* stands.
|
|
9
|
+
*/
|
|
10
|
+
function toWirePayload(input) {
|
|
11
|
+
return {
|
|
12
|
+
...input,
|
|
13
|
+
request: {
|
|
14
|
+
...input.request,
|
|
15
|
+
...input.request.body !== void 0 ? {
|
|
16
|
+
body: input.request.body,
|
|
17
|
+
bodyType: "RAW"
|
|
18
|
+
} : {}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
3
22
|
function checks(rest) {
|
|
4
23
|
return {
|
|
5
24
|
/** List checks, optionally filtered by a case-insensitive partial name match. */
|
|
@@ -13,12 +32,12 @@ function checks(rest) {
|
|
|
13
32
|
/** Create a new API check. */
|
|
14
33
|
create: (input) => rest.request("/checks/api", {
|
|
15
34
|
method: "POST",
|
|
16
|
-
body: input
|
|
35
|
+
body: toWirePayload(input)
|
|
17
36
|
}),
|
|
18
37
|
/** Update an existing API check. */
|
|
19
38
|
update: (id, input) => rest.request(`/checks/api/${id}`, {
|
|
20
39
|
method: "PUT",
|
|
21
|
-
body: input
|
|
40
|
+
body: toWirePayload(input)
|
|
22
41
|
}),
|
|
23
42
|
/** Delete a check (any type) by id. */
|
|
24
43
|
delete: (id) => rest.request(`/checks/${id}`, { method: "DELETE" })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/checkly-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.42.1",
|
|
4
4
|
"description": "A TypeScript client for the Checkly monitoring API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"checkly",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@theholocron/observability": "^0.3.0",
|
|
37
|
-
"@theholocron/http-client": "^1.
|
|
37
|
+
"@theholocron/http-client": "^1.42.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@theholocron/cli": "5.0.0-alpha.79",
|