checkly 6.0.1 → 6.1.0-prerelease-d4c1886

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 (176) hide show
  1. package/dist/commands/import/plan.d.ts +1 -0
  2. package/dist/commands/import/plan.js +92 -43
  3. package/dist/commands/import/plan.js.map +1 -1
  4. package/dist/commands/pw-test.d.ts +27 -0
  5. package/dist/commands/pw-test.js +316 -0
  6. package/dist/commands/pw-test.js.map +1 -0
  7. package/dist/commands/rules.d.ts +9 -0
  8. package/dist/commands/rules.js +126 -0
  9. package/dist/commands/rules.js.map +1 -0
  10. package/dist/commands/sync-playwright.d.ts +0 -3
  11. package/dist/commands/sync-playwright.js +5 -29
  12. package/dist/commands/sync-playwright.js.map +1 -1
  13. package/dist/commands/test.d.ts +0 -12
  14. package/dist/commands/test.js +15 -62
  15. package/dist/commands/test.js.map +1 -1
  16. package/dist/commands/trigger.js +2 -2
  17. package/dist/commands/trigger.js.map +1 -1
  18. package/dist/constructs/alert-channel.d.ts +67 -12
  19. package/dist/constructs/alert-channel.js +30 -3
  20. package/dist/constructs/alert-channel.js.map +1 -1
  21. package/dist/constructs/alert-escalation-policy.d.ts +80 -0
  22. package/dist/constructs/alert-escalation-policy.js +20 -0
  23. package/dist/constructs/alert-escalation-policy.js.map +1 -1
  24. package/dist/constructs/api-assertion-codegen.d.ts +3 -0
  25. package/dist/constructs/api-assertion-codegen.js +23 -0
  26. package/dist/constructs/api-assertion-codegen.js.map +1 -0
  27. package/dist/constructs/api-assertion.d.ts +74 -0
  28. package/dist/constructs/api-assertion.js +85 -0
  29. package/dist/constructs/api-assertion.js.map +1 -0
  30. package/dist/constructs/api-check-bundle.d.ts +4 -4
  31. package/dist/constructs/api-check-codegen.d.ts +3 -5
  32. package/dist/constructs/api-check-codegen.js +4 -80
  33. package/dist/constructs/api-check-codegen.js.map +1 -1
  34. package/dist/constructs/api-check.d.ts +147 -46
  35. package/dist/constructs/api-check.js +114 -28
  36. package/dist/constructs/api-check.js.map +1 -1
  37. package/dist/constructs/api-request-codegen.d.ts +4 -0
  38. package/dist/constructs/api-request-codegen.js +68 -0
  39. package/dist/constructs/api-request-codegen.js.map +1 -0
  40. package/dist/constructs/api-request.d.ts +67 -0
  41. package/dist/constructs/api-request.js +3 -0
  42. package/dist/constructs/api-request.js.map +1 -0
  43. package/dist/constructs/browser-check-bundle.d.ts +3 -3
  44. package/dist/constructs/browser-check-codegen.d.ts +2 -2
  45. package/dist/constructs/browser-check-codegen.js +1 -1
  46. package/dist/constructs/browser-check-codegen.js.map +1 -1
  47. package/dist/constructs/browser-check.d.ts +50 -11
  48. package/dist/constructs/browser-check.js +47 -25
  49. package/dist/constructs/browser-check.js.map +1 -1
  50. package/dist/constructs/check-codegen.d.ts +11 -6
  51. package/dist/constructs/check-codegen.js +36 -24
  52. package/dist/constructs/check-codegen.js.map +1 -1
  53. package/dist/constructs/check-config.d.ts +3 -0
  54. package/dist/constructs/check-config.js +21 -0
  55. package/dist/constructs/check-config.js.map +1 -0
  56. package/dist/constructs/check-group-codegen.js +2 -2
  57. package/dist/constructs/check-group-codegen.js.map +1 -1
  58. package/dist/constructs/check-group-v1.js +2 -22
  59. package/dist/constructs/check-group-v1.js.map +1 -1
  60. package/dist/constructs/check-group-v2.js +2 -20
  61. package/dist/constructs/check-group-v2.js.map +1 -1
  62. package/dist/constructs/check.d.ts +190 -30
  63. package/dist/constructs/check.js +94 -48
  64. package/dist/constructs/check.js.map +1 -1
  65. package/dist/constructs/construct.d.ts +86 -0
  66. package/dist/constructs/construct.js +51 -0
  67. package/dist/constructs/construct.js.map +1 -1
  68. package/dist/constructs/dashboard.d.ts +98 -16
  69. package/dist/constructs/dashboard.js.map +1 -1
  70. package/dist/constructs/diagnostics.d.ts +23 -0
  71. package/dist/constructs/diagnostics.js +10 -0
  72. package/dist/constructs/diagnostics.js.map +1 -1
  73. package/dist/constructs/environment-variable.d.ts +19 -0
  74. package/dist/constructs/frequency.d.ts +42 -0
  75. package/dist/constructs/frequency.js +42 -0
  76. package/dist/constructs/frequency.js.map +1 -1
  77. package/dist/constructs/heartbeat-monitor-codegen.d.ts +11 -0
  78. package/dist/constructs/{heartbeat-check-codegen.js → heartbeat-monitor-codegen.js} +10 -10
  79. package/dist/constructs/heartbeat-monitor-codegen.js.map +1 -0
  80. package/dist/constructs/{heartbeat-check.d.ts → heartbeat-monitor.d.ts} +9 -13
  81. package/dist/constructs/{heartbeat-check.js → heartbeat-monitor.js} +10 -13
  82. package/dist/constructs/heartbeat-monitor.js.map +1 -0
  83. package/dist/constructs/http-header.d.ts +16 -0
  84. package/dist/constructs/http-request.d.ts +2 -0
  85. package/dist/constructs/http-request.js +3 -0
  86. package/dist/constructs/http-request.js.map +1 -0
  87. package/dist/constructs/index.d.ts +10 -2
  88. package/dist/constructs/index.js +10 -2
  89. package/dist/constructs/index.js.map +1 -1
  90. package/dist/constructs/internal/common-diagnostics.d.ts +9 -0
  91. package/dist/constructs/internal/common-diagnostics.js +39 -0
  92. package/dist/constructs/internal/common-diagnostics.js.map +1 -0
  93. package/dist/constructs/ip.d.ts +2 -0
  94. package/dist/constructs/ip.js +3 -0
  95. package/dist/constructs/ip.js.map +1 -0
  96. package/dist/constructs/key-value-pair.d.ts +35 -0
  97. package/dist/constructs/monitor-codegen.d.ts +1 -0
  98. package/dist/constructs/monitor-codegen.js +6 -0
  99. package/dist/constructs/monitor-codegen.js.map +1 -0
  100. package/dist/constructs/monitor.d.ts +113 -0
  101. package/dist/constructs/monitor.js +21 -0
  102. package/dist/constructs/monitor.js.map +1 -0
  103. package/dist/constructs/multi-step-check-bundle.d.ts +3 -3
  104. package/dist/constructs/multi-step-check-codegen.d.ts +2 -2
  105. package/dist/constructs/multi-step-check-codegen.js +1 -1
  106. package/dist/constructs/multi-step-check-codegen.js.map +1 -1
  107. package/dist/constructs/multi-step-check.d.ts +8 -8
  108. package/dist/constructs/multi-step-check.js +4 -21
  109. package/dist/constructs/multi-step-check.js.map +1 -1
  110. package/dist/constructs/playwright-check-bundle.d.ts +2 -2
  111. package/dist/constructs/playwright-check.d.ts +6 -6
  112. package/dist/constructs/playwright-check.js +1 -1
  113. package/dist/constructs/playwright-check.js.map +1 -1
  114. package/dist/constructs/project.js +1 -1
  115. package/dist/constructs/project.js.map +1 -1
  116. package/dist/constructs/query-param.d.ts +16 -0
  117. package/dist/constructs/ref.d.ts +44 -0
  118. package/dist/constructs/ref.js +44 -0
  119. package/dist/constructs/ref.js.map +1 -1
  120. package/dist/constructs/retry-strategy.d.ts +78 -8
  121. package/dist/constructs/retry-strategy.js +33 -0
  122. package/dist/constructs/retry-strategy.js.map +1 -1
  123. package/dist/constructs/tcp-monitor-codegen.d.ts +15 -0
  124. package/dist/constructs/{tcp-check-codegen.js → tcp-monitor-codegen.js} +9 -9
  125. package/dist/constructs/tcp-monitor-codegen.js.map +1 -0
  126. package/dist/constructs/{tcp-check.d.ts → tcp-monitor.d.ts} +70 -21
  127. package/dist/constructs/{tcp-check.js → tcp-monitor.js} +34 -13
  128. package/dist/constructs/tcp-monitor.js.map +1 -0
  129. package/dist/constructs/url-assertion-codegen.d.ts +3 -0
  130. package/dist/constructs/url-assertion-codegen.js +15 -0
  131. package/dist/constructs/url-assertion-codegen.js.map +1 -0
  132. package/dist/constructs/url-assertion.d.ts +60 -0
  133. package/dist/constructs/url-assertion.js +56 -0
  134. package/dist/constructs/url-assertion.js.map +1 -0
  135. package/dist/constructs/url-monitor-codegen.d.ts +13 -0
  136. package/dist/constructs/url-monitor-codegen.js +38 -0
  137. package/dist/constructs/url-monitor-codegen.js.map +1 -0
  138. package/dist/constructs/url-monitor.d.ts +146 -0
  139. package/dist/constructs/url-monitor.js +99 -0
  140. package/dist/constructs/url-monitor.js.map +1 -0
  141. package/dist/constructs/url-request-codegen.d.ts +4 -0
  142. package/dist/constructs/url-request-codegen.js +31 -0
  143. package/dist/constructs/url-request-codegen.js.map +1 -0
  144. package/dist/constructs/url-request.d.ts +65 -0
  145. package/dist/constructs/url-request.js +3 -0
  146. package/dist/constructs/url-request.js.map +1 -0
  147. package/dist/constructs/webhook-alert-channel.d.ts +1 -1
  148. package/dist/helpers/constants.d.ts +1 -0
  149. package/dist/helpers/constants.js +5 -0
  150. package/dist/helpers/constants.js.map +1 -0
  151. package/dist/helpers/test-helper.d.ts +16 -0
  152. package/dist/helpers/test-helper.js +72 -0
  153. package/dist/helpers/test-helper.js.map +1 -0
  154. package/dist/helpers/write-config-helpers.d.ts +5 -0
  155. package/dist/helpers/write-config-helpers.js +88 -0
  156. package/dist/helpers/write-config-helpers.js.map +1 -0
  157. package/dist/reporters/util.js +2 -2
  158. package/dist/reporters/util.js.map +1 -1
  159. package/dist/rest/api.js +6 -0
  160. package/dist/rest/api.js.map +1 -1
  161. package/dist/rules/checkly.rules.md +491 -0
  162. package/dist/services/checkly-config-loader.d.ts +3 -3
  163. package/dist/services/checkly-config-loader.js +6 -4
  164. package/dist/services/checkly-config-loader.js.map +1 -1
  165. package/dist/services/util.d.ts +2 -2
  166. package/dist/services/util.js +14 -14
  167. package/dist/services/util.js.map +1 -1
  168. package/dist/tsconfig.tsbuildinfo +1 -1
  169. package/oclif.manifest.json +150 -1
  170. package/package.json +7 -3
  171. package/dist/constructs/heartbeat-check-codegen.d.ts +0 -11
  172. package/dist/constructs/heartbeat-check-codegen.js.map +0 -1
  173. package/dist/constructs/heartbeat-check.js.map +0 -1
  174. package/dist/constructs/tcp-check-codegen.d.ts +0 -15
  175. package/dist/constructs/tcp-check-codegen.js.map +0 -1
  176. package/dist/constructs/tcp-check.js.map +0 -1
@@ -0,0 +1,74 @@
1
+ import { Assertion as CoreAssertion, NumericAssertionBuilder, GeneralAssertionBuilder } from './internal/assertion';
2
+ /** Sources that can be used for API check assertions */
3
+ type ApiAssertionSource = 'STATUS_CODE' | 'JSON_BODY' | 'HEADERS' | 'TEXT_BODY' | 'RESPONSE_TIME';
4
+ /**
5
+ * Assertion configuration for API checks.
6
+ * Allows validation of different aspects of HTTP responses.
7
+ */
8
+ export type Assertion = CoreAssertion<ApiAssertionSource>;
9
+ /**
10
+ * Builder class for creating API check assertions.
11
+ * Provides convenient methods to create assertions for different parts of HTTP responses.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * // Status code assertions
16
+ * AssertionBuilder.statusCode().equals(200)
17
+ * AssertionBuilder.statusCode().greaterThan(199)
18
+ * AssertionBuilder.statusCode().lessThan(300)
19
+ *
20
+ * // JSON body assertions using JSONPath
21
+ * AssertionBuilder.jsonBody('$.user.name').equals('John')
22
+ * AssertionBuilder.jsonBody('$.users.length').equals(5)
23
+ * AssertionBuilder.jsonBody('$.data[0].id').isNotNull()
24
+ *
25
+ * // Header assertions
26
+ * AssertionBuilder.headers('content-type').contains('application/json')
27
+ * AssertionBuilder.headers('x-rate-limit-remaining').greaterThan(0)
28
+ *
29
+ * // Text body assertions
30
+ * AssertionBuilder.textBody().contains('Welcome to our API')
31
+ * AssertionBuilder.textBody().notContains('error')
32
+ *
33
+ * // Response time assertions
34
+ * AssertionBuilder.responseTime().lessThan(1000)
35
+ * AssertionBuilder.responseTime().greaterThan(100)
36
+ * ```
37
+ *
38
+ * @see {@link https://jsonpath.com/ | JSONPath Online Evaluator}
39
+ * @see {@link https://www.checklyhq.com/docs/api-checks/assertions/ | API Check Assertions}
40
+ */
41
+ export declare class AssertionBuilder {
42
+ /**
43
+ * Creates an assertion builder for HTTP status codes.
44
+ * @returns A numeric assertion builder for status codes
45
+ */
46
+ static statusCode(): NumericAssertionBuilder<ApiAssertionSource>;
47
+ /**
48
+ * Creates an assertion builder for JSON response body.
49
+ * @param property Optional JSON path to specific property (e.g., '$.user.name')
50
+ * @returns A general assertion builder for JSON body content
51
+ */
52
+ static jsonBody(property?: string): GeneralAssertionBuilder<ApiAssertionSource>;
53
+ /**
54
+ * Creates an assertion builder for HTTP headers.
55
+ * @param property Optional header name to target specific header
56
+ * @param regex Optional regex pattern for header matching
57
+ * @returns A general assertion builder for headers
58
+ */
59
+ static headers(property?: string, regex?: string): GeneralAssertionBuilder<ApiAssertionSource>;
60
+ /**
61
+ * Creates an assertion builder for text response body.
62
+ * @param property Optional property path for text content
63
+ * @returns A general assertion builder for text body content
64
+ */
65
+ static textBody(property?: string): GeneralAssertionBuilder<ApiAssertionSource>;
66
+ /**
67
+ * Creates an assertion builder for response time.
68
+ * @returns A numeric assertion builder for response time in milliseconds
69
+ */
70
+ static responseTime(): NumericAssertionBuilder<ApiAssertionSource>;
71
+ /** @deprecated Use {@link responseTime()} instead */
72
+ static responseTme(): NumericAssertionBuilder<ApiAssertionSource>;
73
+ }
74
+ export {};
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AssertionBuilder = void 0;
4
+ const assertion_1 = require("./internal/assertion");
5
+ /**
6
+ * Builder class for creating API check assertions.
7
+ * Provides convenient methods to create assertions for different parts of HTTP responses.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * // Status code assertions
12
+ * AssertionBuilder.statusCode().equals(200)
13
+ * AssertionBuilder.statusCode().greaterThan(199)
14
+ * AssertionBuilder.statusCode().lessThan(300)
15
+ *
16
+ * // JSON body assertions using JSONPath
17
+ * AssertionBuilder.jsonBody('$.user.name').equals('John')
18
+ * AssertionBuilder.jsonBody('$.users.length').equals(5)
19
+ * AssertionBuilder.jsonBody('$.data[0].id').isNotNull()
20
+ *
21
+ * // Header assertions
22
+ * AssertionBuilder.headers('content-type').contains('application/json')
23
+ * AssertionBuilder.headers('x-rate-limit-remaining').greaterThan(0)
24
+ *
25
+ * // Text body assertions
26
+ * AssertionBuilder.textBody().contains('Welcome to our API')
27
+ * AssertionBuilder.textBody().notContains('error')
28
+ *
29
+ * // Response time assertions
30
+ * AssertionBuilder.responseTime().lessThan(1000)
31
+ * AssertionBuilder.responseTime().greaterThan(100)
32
+ * ```
33
+ *
34
+ * @see {@link https://jsonpath.com/ | JSONPath Online Evaluator}
35
+ * @see {@link https://www.checklyhq.com/docs/api-checks/assertions/ | API Check Assertions}
36
+ */
37
+ // Called AssertionBuilder instead of ApiAssertionBuilder for historical
38
+ // reasons.
39
+ class AssertionBuilder {
40
+ /**
41
+ * Creates an assertion builder for HTTP status codes.
42
+ * @returns A numeric assertion builder for status codes
43
+ */
44
+ static statusCode() {
45
+ return new assertion_1.NumericAssertionBuilder('STATUS_CODE');
46
+ }
47
+ /**
48
+ * Creates an assertion builder for JSON response body.
49
+ * @param property Optional JSON path to specific property (e.g., '$.user.name')
50
+ * @returns A general assertion builder for JSON body content
51
+ */
52
+ static jsonBody(property) {
53
+ return new assertion_1.GeneralAssertionBuilder('JSON_BODY', property);
54
+ }
55
+ /**
56
+ * Creates an assertion builder for HTTP headers.
57
+ * @param property Optional header name to target specific header
58
+ * @param regex Optional regex pattern for header matching
59
+ * @returns A general assertion builder for headers
60
+ */
61
+ static headers(property, regex) {
62
+ return new assertion_1.GeneralAssertionBuilder('HEADERS', property, regex);
63
+ }
64
+ /**
65
+ * Creates an assertion builder for text response body.
66
+ * @param property Optional property path for text content
67
+ * @returns A general assertion builder for text body content
68
+ */
69
+ static textBody(property) {
70
+ return new assertion_1.GeneralAssertionBuilder('TEXT_BODY', property);
71
+ }
72
+ /**
73
+ * Creates an assertion builder for response time.
74
+ * @returns A numeric assertion builder for response time in milliseconds
75
+ */
76
+ static responseTime() {
77
+ return new assertion_1.NumericAssertionBuilder('RESPONSE_TIME');
78
+ }
79
+ /** @deprecated Use {@link responseTime()} instead */
80
+ static responseTme() {
81
+ return AssertionBuilder.responseTime();
82
+ }
83
+ }
84
+ exports.AssertionBuilder = AssertionBuilder;
85
+ //# sourceMappingURL=api-assertion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-assertion.js","sourceRoot":"","sources":["../../src/constructs/api-assertion.ts"],"names":[],"mappings":";;;AAAA,oDAI6B;AAiB7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wEAAwE;AACxE,WAAW;AACX,MAAa,gBAAgB;IAC3B;;;OAGG;IACH,MAAM,CAAC,UAAU;QACf,OAAO,IAAI,mCAAuB,CAAqB,aAAa,CAAC,CAAA;IACvE,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAE,QAAiB;QAChC,OAAO,IAAI,mCAAuB,CAAqB,WAAW,EAAE,QAAQ,CAAC,CAAA;IAC/E,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAE,QAAiB,EAAE,KAAc;QAC/C,OAAO,IAAI,mCAAuB,CAAqB,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAA;IACpF,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAE,QAAiB;QAChC,OAAO,IAAI,mCAAuB,CAAqB,WAAW,EAAE,QAAQ,CAAC,CAAA;IAC/E,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,YAAY;QACjB,OAAO,IAAI,mCAAuB,CAAqB,eAAe,CAAC,CAAA;IACzE,CAAC;IAED,qDAAqD;IACrD,MAAM,CAAC,WAAW;QAChB,OAAO,gBAAgB,CAAC,YAAY,EAAE,CAAA;IACxC,CAAC;CACF;AAjDD,4CAiDC"}
@@ -26,21 +26,21 @@ export declare class ApiCheckBundle implements Bundle {
26
26
  tearDownScriptPath: string | undefined;
27
27
  tearDownScriptDependencies: number[] | undefined;
28
28
  checkType: string;
29
- request: import("./api-check").Request;
29
+ request: import("./api-request").Request;
30
30
  degradedResponseTime: number | undefined;
31
31
  maxResponseTime: number | undefined;
32
+ runtimeId: string | undefined;
33
+ environmentVariables: import("./key-value-pair").default[] | undefined;
32
34
  name: string;
33
35
  activated: boolean | undefined;
34
36
  muted: boolean | undefined;
35
37
  shouldFail: boolean | undefined;
36
- runtimeId: string | undefined;
37
38
  locations: (keyof import("..").Region)[] | undefined;
38
39
  privateLocations: undefined;
39
40
  tags: string[] | undefined;
40
41
  frequency: number | undefined;
41
42
  frequencyOffset: number | undefined;
42
- groupId: import("./ref").Ref | undefined;
43
- environmentVariables: import("./key-value-pair").default[] | undefined;
43
+ groupId: import("./ref").Ref | null;
44
44
  retryStrategy: import("./retry-strategy").RetryStrategy | null | undefined;
45
45
  doubleCheck: boolean | undefined;
46
46
  alertSettings: import("./alert-escalation-policy").AlertEscalation | undefined;
@@ -1,8 +1,7 @@
1
1
  import { Codegen, Context } from './internal/codegen';
2
- import { GeneratedFile, Value } from '../sourcegen';
3
- import { Assertion, Request } from './api-check';
4
- import { CheckResource } from './check-codegen';
5
- export interface ApiCheckResource extends CheckResource {
2
+ import { RuntimeCheckResource } from './check-codegen';
3
+ import { Request } from './api-request';
4
+ export interface ApiCheckResource extends RuntimeCheckResource {
6
5
  checkType: 'API';
7
6
  request: Request;
8
7
  localSetupScript?: string;
@@ -14,7 +13,6 @@ export interface ApiCheckResource extends CheckResource {
14
13
  degradedResponseTime?: number;
15
14
  maxResponseTime?: number;
16
15
  }
17
- export declare function valueForAssertion(genfile: GeneratedFile, assertion: Assertion): Value;
18
16
  export declare class ApiCheckCodegen extends Codegen<ApiCheckResource> {
19
17
  describe(resource: ApiCheckResource): string;
20
18
  gencode(logicalId: string, resource: ApiCheckResource, context: Context): void;
@@ -1,29 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApiCheckCodegen = exports.valueForAssertion = void 0;
3
+ exports.ApiCheckCodegen = void 0;
4
4
  const codegen_1 = require("./internal/codegen");
5
5
  const sourcegen_1 = require("../sourcegen");
6
6
  const check_codegen_1 = require("./check-codegen");
7
- const assertion_codegen_1 = require("./internal/assertion-codegen");
8
- const key_value_pair_codegen_1 = require("./key-value-pair-codegen");
9
- function valueForAssertion(genfile, assertion) {
10
- genfile.namedImport('AssertionBuilder', 'checkly/constructs');
11
- switch (assertion.source) {
12
- case 'STATUS_CODE':
13
- return (0, assertion_codegen_1.valueForNumericAssertion)('AssertionBuilder', 'statusCode', assertion);
14
- case 'JSON_BODY':
15
- return (0, assertion_codegen_1.valueForGeneralAssertion)('AssertionBuilder', 'jsonBody', assertion);
16
- case 'HEADERS':
17
- return (0, assertion_codegen_1.valueForGeneralAssertion)('AssertionBuilder', 'headers', assertion);
18
- case 'TEXT_BODY':
19
- return (0, assertion_codegen_1.valueForGeneralAssertion)('AssertionBuilder', 'textBody', assertion);
20
- case 'RESPONSE_TIME':
21
- return (0, assertion_codegen_1.valueForNumericAssertion)('AssertionBuilder', 'responseTime', assertion);
22
- default:
23
- throw new Error(`Unsupported assertion source ${assertion.source}`);
24
- }
25
- }
26
- exports.valueForAssertion = valueForAssertion;
7
+ const api_request_codegen_1 = require("./api-request-codegen");
27
8
  const construct = 'ApiCheck';
28
9
  class ApiCheckCodegen extends codegen_1.Codegen {
29
10
  describe(resource) {
@@ -41,64 +22,7 @@ class ApiCheckCodegen extends codegen_1.Codegen {
41
22
  builder.new(builder => {
42
23
  builder.string(logicalId);
43
24
  builder.object(builder => {
44
- builder.object('request', builder => {
45
- builder.string('url', resource.request.url);
46
- builder.string('method', resource.request.method);
47
- if (resource.request.ipFamily) {
48
- builder.string('ipFamily', resource.request.ipFamily);
49
- }
50
- if (resource.request.followRedirects === false) {
51
- builder.boolean('followRedirects', resource.request.followRedirects);
52
- }
53
- if (resource.request.skipSSL === true) {
54
- builder.boolean('skipSSL', resource.request.skipSSL);
55
- }
56
- if (resource.request.body !== undefined && resource.request.body !== '') {
57
- builder.string('body', resource.request.body);
58
- }
59
- if (resource.request.bodyType && resource.request.bodyType !== 'NONE') {
60
- builder.string('bodyType', resource.request.bodyType);
61
- }
62
- if (resource.request.headers) {
63
- const headers = resource.request.headers;
64
- if (headers.length > 0) {
65
- builder.array('headers', builder => {
66
- for (const header of headers) {
67
- builder.value((0, key_value_pair_codegen_1.valueForKeyValuePair)(this.program, file, context, header));
68
- }
69
- });
70
- }
71
- }
72
- if (resource.request.queryParameters) {
73
- const queryParameters = resource.request.queryParameters;
74
- if (queryParameters.length > 0) {
75
- builder.array('queryParameters', builder => {
76
- for (const param of queryParameters) {
77
- builder.value((0, key_value_pair_codegen_1.valueForKeyValuePair)(this.program, file, context, param));
78
- }
79
- });
80
- }
81
- }
82
- if (resource.request.basicAuth) {
83
- const basicAuth = resource.request.basicAuth;
84
- if (basicAuth.username !== '' && basicAuth.password !== '') {
85
- builder.object('basicAuth', builder => {
86
- builder.string('username', basicAuth.username);
87
- builder.string('password', basicAuth.password);
88
- });
89
- }
90
- }
91
- if (resource.request.assertions) {
92
- const assertions = resource.request.assertions;
93
- if (assertions.length > 0) {
94
- builder.array('assertions', builder => {
95
- for (const assertion of assertions) {
96
- builder.value(valueForAssertion(file, assertion));
97
- }
98
- });
99
- }
100
- }
101
- });
25
+ builder.value('request', (0, api_request_codegen_1.valueForRequest)(this.program, file, context, resource.request));
102
26
  if (resource.localSetupScript) {
103
27
  const content = resource.localSetupScript;
104
28
  (0, codegen_1.validateScript)(content);
@@ -153,7 +77,7 @@ class ApiCheckCodegen extends codegen_1.Codegen {
153
77
  if (resource.maxResponseTime !== undefined) {
154
78
  builder.number('maxResponseTime', resource.maxResponseTime);
155
79
  }
156
- (0, check_codegen_1.buildCheckProps)(this.program, file, builder, resource, context);
80
+ (0, check_codegen_1.buildRuntimeCheckProps)(this.program, file, builder, resource, context);
157
81
  });
158
82
  });
159
83
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"api-check-codegen.js","sourceRoot":"","sources":["../../src/constructs/api-check-codegen.ts"],"names":[],"mappings":";;;AAAA,gDAAqE;AACrE,4CAAgE;AAEhE,mDAAgE;AAChE,oEAAiG;AACjG,qEAA+D;AAe/D,SAAgB,iBAAiB,CAAE,OAAsB,EAAE,SAAoB;IAC7E,OAAO,CAAC,WAAW,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAA;IAE7D,QAAQ,SAAS,CAAC,MAAM,EAAE,CAAC;QACzB,KAAK,aAAa;YAChB,OAAO,IAAA,4CAAwB,EAAC,kBAAkB,EAAE,YAAY,EAAE,SAAS,CAAC,CAAA;QAC9E,KAAK,WAAW;YACd,OAAO,IA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ntimeCheck, RuntimeCheckProps } from './check';
2
2
  import { HttpHeader } from './http-header';
3
+ import { BasicAuth, Request } from './api-request';
3
4
  import { QueryParam } from './query-param';
4
5
  import { Content, Entrypoint } from './construct';
5
- import { Assertion as CoreAssertion, NumericAssertionBuilder, GeneralAssertionBuilder } from './internal/assertion';
6
6
  import { Diagnostics } from './diagnostics';
7
7
  import { ApiCheckBundle } from './api-check-bundle';
8
- type AssertionSource = 'STATUS_CODE' | 'JSON_BODY' | 'HEADERS' | 'TEXT_BODY' | 'RESPONSE_TIME';
9
- export type Assertion = CoreAssertion<AssertionSource>;
10
- export declare class AssertionBuilder {
11
- static statusCode(): NumericAssertionBuilder<AssertionSource>;
12
- static jsonBody(property?: string): GeneralAssertionBuilder<AssertionSource>;
13
- static headers(property?: string, regex?: string): GeneralAssertionBuilder<AssertionSource>;
14
- static textBody(property?: string): GeneralAssertionBuilder<AssertionSource>;
15
- /** @deprecated Use responseTime() instead */
16
- static responseTme(): NumericAssertionBuilder<AssertionSource>;
17
- static responseTime(): NumericAssertionBuilder<AssertionSource>;
18
- }
19
- export type BodyType = 'JSON' | 'FORM' | 'RAW' | 'GRAPHQL' | 'NONE';
20
- export type HttpRequestMethod = 'get' | 'GET' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'head' | 'HEAD' | 'delete' | 'DELETE' | 'options' | 'OPTIONS';
21
- export type IPFamily = 'IPv4' | 'IPv6';
22
- export interface BasicAuth {
23
- username: string;
24
- password: string;
25
- }
8
+ import { Assertion } from './api-assertion';
9
+ /**
10
+ * Default configuration that can be applied to API checks.
11
+ * Used for setting common defaults across multiple checks.
12
+ */
26
13
  export type ApiCheckDefaultConfig = {
14
+ /** Default URL for API requests */
27
15
  url?: string;
16
+ /** Default HTTP headers to include */
28
17
  headers?: Array<HttpHeader>;
18
+ /** Default query parameters to include */
29
19
  queryParameters?: Array<QueryParam>;
20
+ /** Default basic authentication credentials */
30
21
  basicAuth?: BasicAuth;
22
+ /** Default assertions to apply */
31
23
  assertions?: Array<Assertion>;
32
24
  };
33
- export interface Request {
34
- url: string;
35
- method: HttpRequestMethod;
36
- ipFamily?: IPFamily;
37
- followRedirects?: boolean;
38
- skipSSL?: boolean;
39
- /**
40
- * Check the main Checkly documentation on assertions for specific values like regular expressions
41
- * and JSON path descriptors you can use in the "property" field.
42
- */
43
- assertions?: Array<Assertion>;
44
- body?: string;
45
- bodyType?: BodyType;
46
- headers?: Array<HttpHeader>;
47
- queryParameters?: Array<QueryParam>;
48
- basicAuth?: BasicAuth;
49
- }
50
- export interface ApiCheckProps extends CheckProps {
25
+ export interface ApiCheckProps extends RuntimeCheckProps {
51
26
  /**
52
27
  * Determines the request that the check is going to run.
53
28
  */
@@ -72,21 +47,148 @@ export interface ApiCheckProps extends CheckProps {
72
47
  tearDownScript?: Content | Entrypoint;
73
48
  /**
74
49
  * The response time in milliseconds where a check should be considered degraded.
50
+ * Used for performance monitoring and alerting on slow responses.
51
+ *
52
+ * @defaultValue 10000
53
+ * @minimum 0
54
+ * @maximum 30000
55
+ * @example
56
+ * ```typescript
57
+ * degradedResponseTime: 2000 // Alert when API responds slower than 2 seconds
58
+ * ```
75
59
  */
76
60
  degradedResponseTime?: number;
77
61
  /**
78
62
  * The response time in milliseconds where a check should be considered failing.
63
+ * The check fails if the response takes longer than this threshold.
64
+ *
65
+ * @defaultValue 20000
66
+ * @minimum 0
67
+ * @maximum 30000
68
+ * @example
69
+ * ```typescript
70
+ * maxResponseTime: 5000 // Fail check if API takes longer than 5 seconds
71
+ * ```
79
72
  */
80
73
  maxResponseTime?: number;
81
74
  }
82
75
  /**
83
- * Creates an API Check
76
+ * Creates an API Check to monitor HTTP endpoints and APIs.
77
+ *
78
+ * API checks allow you to monitor REST APIs, GraphQL endpoints, and any HTTP-based service.
79
+ * You can validate response status codes, response times, headers, and response body content.
84
80
  *
85
- * @remarks
81
+ * @example
82
+ * ```typescript
83
+ * // Basic API check
84
+ * new ApiCheck('hello-api', {
85
+ * name: 'Hello API',
86
+ * request: {
87
+ * method: 'GET',
88
+ * url: 'https://api.example.com/hello',
89
+ * assertions: [
90
+ * AssertionBuilder.statusCode().equals(200)
91
+ * ]
92
+ * }
93
+ * })
86
94
  *
87
- * This class make use of the API Checks endpoints.
95
+ * // Advanced API check with POST request
96
+ * new ApiCheck('user-api', {
97
+ * name: 'User API Check',
98
+ * frequency: Frequency.EVERY_5M,
99
+ * locations: ['us-east-1', 'eu-west-1'],
100
+ * request: {
101
+ * method: 'POST',
102
+ * url: 'https://api.example.com/users',
103
+ * headers: [{ key: 'Content-Type', value: 'application/json' }],
104
+ * body: JSON.stringify({ name: 'test-user' }),
105
+ * bodyType: 'JSON',
106
+ * assertions: [
107
+ * AssertionBuilder.statusCode().equals(201),
108
+ * AssertionBuilder.jsonBody('$.id').isNotNull(),
109
+ * AssertionBuilder.responseTime().lessThan(1000)
110
+ * ]
111
+ * },
112
+ * maxResponseTime: 5000,
113
+ * degradedResponseTime: 2000
114
+ * })
115
+ *
116
+ * // Error validation check (shouldFail required for error status checks)
117
+ * new ApiCheck('not-found-check', {
118
+ * name: 'Not Found Check',
119
+ * shouldFail: true,
120
+ * request: {
121
+ * method: 'GET',
122
+ * url: 'https://api.example.com/nonexistent',
123
+ * assertions: [
124
+ * AssertionBuilder.statusCode().equals(404)
125
+ * ]
126
+ * }
127
+ * })
128
+ * ```
129
+ *
130
+ * @see {@link https://www.checklyhq.com/docs/cli/constructs-reference/#apicheck | ApiCheck API Reference}
131
+ * @see {@link https://www.checklyhq.com/docs/monitoring/api-checks/ | API Checks Documentation}
88
132
  */
89
- export declare class ApiCheck extends Check {
133
+ /**
134
+ * Creates an API Check to monitor HTTP endpoints and APIs.
135
+ *
136
+ * API checks allow you to monitor REST APIs, GraphQL endpoints, and any HTTP-based service.
137
+ * You can validate response status codes, response times, headers, and response body content.
138
+ *
139
+ * @example
140
+ * ```typescript
141
+ * // Basic API check
142
+ * new ApiCheck('hello-api', {
143
+ * name: 'Hello API',
144
+ * request: {
145
+ * method: 'GET',
146
+ * url: 'https://api.example.com/hello',
147
+ * assertions: [
148
+ * AssertionBuilder.statusCode().equals(200)
149
+ * ]
150
+ * }
151
+ * })
152
+ *
153
+ * // Advanced API check with POST request
154
+ * new ApiCheck('user-api', {
155
+ * name: 'User API Check',
156
+ * frequency: Frequency.EVERY_5M,
157
+ * locations: ['us-east-1', 'eu-west-1'],
158
+ * request: {
159
+ * method: 'POST',
160
+ * url: 'https://api.example.com/users',
161
+ * headers: [{ key: 'Content-Type', value: 'application/json' }],
162
+ * body: JSON.stringify({ name: 'test-user' }),
163
+ * bodyType: 'JSON',
164
+ * assertions: [
165
+ * AssertionBuilder.statusCode().equals(201),
166
+ * AssertionBuilder.jsonBody('$.id').isNotNull(),
167
+ * AssertionBuilder.responseTime().lessThan(1000)
168
+ * ]
169
+ * },
170
+ * maxResponseTime: 5000,
171
+ * degradedResponseTime: 2000
172
+ * })
173
+ *
174
+ * // Error validation check (shouldFail required for error status checks)
175
+ * new ApiCheck('not-found-check', {
176
+ * name: 'Not Found Check',
177
+ * shouldFail: true,
178
+ * request: {
179
+ * method: 'GET',
180
+ * url: 'https://api.example.com/nonexistent',
181
+ * assertions: [
182
+ * AssertionBuilder.statusCode().equals(404)
183
+ * ]
184
+ * }
185
+ * })
186
+ * ```
187
+ *
188
+ * @see {@link https://www.checklyhq.com/docs/cli/constructs-reference/#apicheck | ApiCheck API Reference}
189
+ * @see {@link https://www.checklyhq.com/docs/monitoring/api-checks/ | API Checks Documentation}
190
+ */
191
+ export declare class ApiCheck extends RuntimeCheck {
90
192
  readonly request: Request;
91
193
  readonly localSetupScript?: string;
92
194
  readonly setupScript?: Content | Entrypoint;
@@ -117,18 +219,18 @@ export declare class ApiCheck extends Check {
117
219
  localTearDownScript: string | undefined;
118
220
  degradedResponseTime: number | undefined;
119
221
  maxResponseTime: number | undefined;
222
+ runtimeId: string | undefined;
223
+ environmentVariables: import("./key-value-pair").default[] | undefined;
120
224
  name: string;
121
225
  activated: boolean | undefined;
122
226
  muted: boolean | undefined;
123
227
  shouldFail: boolean | undefined;
124
- runtimeId: string | undefined;
125
228
  locations: (keyof import("..").Region)[] | undefined;
126
229
  privateLocations: undefined;
127
230
  tags: string[] | undefined;
128
231
  frequency: number | undefined;
129
232
  frequencyOffset: number | undefined;
130
- groupId: import("./ref").Ref | undefined;
131
- environmentVariables: import("./key-value-pair").default[] | undefined;
233
+ groupId: import("./ref").Ref | null;
132
234
  retryStrategy: import("./retry-strategy").RetryStrategy | null | undefined;
133
235
  doubleCheck: boolean | undefined;
134
236
  alertSettings: import("./alert-escalation-policy").AlertEscalation | undefined;
@@ -143,4 +245,3 @@ export declare class ApiCheck extends Check {
143
245
  } | undefined;
144
246
  };
145
247
  }
146
- export {};