checkly 9.5.0 → 10.0.0-rc.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.
Files changed (372) hide show
  1. package/dist/ai-context/context.js +1 -0
  2. package/dist/ai-context/context.js.map +1 -1
  3. package/dist/ai-context/onboarding-boilerplate/checkly-config-template.ts +2 -0
  4. package/dist/ai-context/public-skills/checkly/SKILL.md +18 -5
  5. package/dist/ai-context/skills-command/references/communicate.md +6 -3
  6. package/dist/ai-context/skills-command/references/configure-api-checks.md +1 -9
  7. package/dist/ai-context/skills-command/references/configure-browser-checks.md +1 -8
  8. package/dist/ai-context/skills-command/references/configure-check-groups.md +1 -0
  9. package/dist/ai-context/skills-command/references/configure-dns-monitors.md +1 -9
  10. package/dist/ai-context/skills-command/references/configure-grpc-monitors.md +24 -0
  11. package/dist/ai-context/skills-command/references/configure-heartbeat-monitors.md +1 -9
  12. package/dist/ai-context/skills-command/references/configure-icmp-monitors.md +1 -9
  13. package/dist/ai-context/skills-command/references/configure-multistep-checks.md +1 -9
  14. package/dist/ai-context/skills-command/references/configure-playwright-checks.md +1 -1
  15. package/dist/ai-context/skills-command/references/configure-supporting-constructs.md +6 -2
  16. package/dist/ai-context/skills-command/references/configure-tcp-monitors.md +1 -10
  17. package/dist/ai-context/skills-command/references/configure-url-monitors.md +1 -10
  18. package/dist/ai-context/skills-command/references/configure.md +16 -5
  19. package/dist/ai-context/skills-command/references/initialize.md +11 -3
  20. package/dist/ai-context/skills-command/references/investigate-checks.md +1 -1
  21. package/dist/auth/api-key.d.ts +24 -0
  22. package/dist/auth/api-key.js +104 -0
  23. package/dist/auth/api-key.js.map +1 -0
  24. package/dist/auth/device-flow.d.ts +57 -0
  25. package/dist/auth/device-flow.js +221 -0
  26. package/dist/auth/device-flow.js.map +1 -0
  27. package/dist/auth/index.d.ts +6 -6
  28. package/dist/auth/index.js +64 -64
  29. package/dist/auth/index.js.map +1 -1
  30. package/dist/commands/api.js +43 -10
  31. package/dist/commands/api.js.map +1 -1
  32. package/dist/commands/authCommand.d.ts +2 -0
  33. package/dist/commands/authCommand.js +77 -7
  34. package/dist/commands/authCommand.js.map +1 -1
  35. package/dist/commands/debug/parse-project.d.ts +1 -0
  36. package/dist/commands/debug/parse-project.js +5 -2
  37. package/dist/commands/debug/parse-project.js.map +1 -1
  38. package/dist/commands/deploy.d.ts +7 -1
  39. package/dist/commands/deploy.js +627 -271
  40. package/dist/commands/deploy.js.map +1 -1
  41. package/dist/commands/import/plan.js +18 -4
  42. package/dist/commands/import/plan.js.map +1 -1
  43. package/dist/commands/init.js +29 -13
  44. package/dist/commands/init.js.map +1 -1
  45. package/dist/commands/login.d.ts +18 -2
  46. package/dist/commands/login.js +681 -48
  47. package/dist/commands/login.js.map +1 -1
  48. package/dist/commands/logout.js +7 -1
  49. package/dist/commands/logout.js.map +1 -1
  50. package/dist/commands/pw-test.js +3 -2
  51. package/dist/commands/pw-test.js.map +1 -1
  52. package/dist/commands/switch.js +23 -10
  53. package/dist/commands/switch.js.map +1 -1
  54. package/dist/commands/test.js +16 -17
  55. package/dist/commands/test.js.map +1 -1
  56. package/dist/commands/trigger.js +4 -3
  57. package/dist/commands/trigger.js.map +1 -1
  58. package/dist/commands/validate.js +1 -0
  59. package/dist/commands/validate.js.map +1 -1
  60. package/dist/constants.d.ts +1 -2
  61. package/dist/constants.js +0 -1
  62. package/dist/constants.js.map +1 -1
  63. package/dist/constructs/alert-channel-codegen.d.ts +6 -1
  64. package/dist/constructs/alert-channel-codegen.js +12 -6
  65. package/dist/constructs/alert-channel-codegen.js.map +1 -1
  66. package/dist/constructs/alert-escalation-policy-codegen.d.ts +7 -0
  67. package/dist/constructs/alert-escalation-policy-codegen.js +25 -8
  68. package/dist/constructs/alert-escalation-policy-codegen.js.map +1 -1
  69. package/dist/constructs/api-assertion.d.ts +0 -2
  70. package/dist/constructs/api-assertion.js +0 -4
  71. package/dist/constructs/api-assertion.js.map +1 -1
  72. package/dist/constructs/api-check-codegen.js +1 -1
  73. package/dist/constructs/api-check-codegen.js.map +1 -1
  74. package/dist/constructs/api-check.d.ts +4 -22
  75. package/dist/constructs/api-check.js +15 -17
  76. package/dist/constructs/api-check.js.map +1 -1
  77. package/dist/constructs/api-request-codegen.js +10 -8
  78. package/dist/constructs/api-request-codegen.js.map +1 -1
  79. package/dist/constructs/browser-check-bundle.d.ts +19 -13
  80. package/dist/constructs/browser-check-bundle.js +5 -1
  81. package/dist/constructs/browser-check-bundle.js.map +1 -1
  82. package/dist/constructs/browser-check.d.ts +1 -4
  83. package/dist/constructs/browser-check.js +1 -1
  84. package/dist/constructs/browser-check.js.map +1 -1
  85. package/dist/constructs/check-codegen.d.ts +39 -14
  86. package/dist/constructs/check-codegen.js +101 -23
  87. package/dist/constructs/check-codegen.js.map +1 -1
  88. package/dist/constructs/check-group-codegen.js +23 -9
  89. package/dist/constructs/check-group-codegen.js.map +1 -1
  90. package/dist/constructs/check-group-v1.d.ts +19 -14
  91. package/dist/constructs/check-group-v1.js +39 -14
  92. package/dist/constructs/check-group-v1.js.map +1 -1
  93. package/dist/constructs/check-group-v2.d.ts +0 -20
  94. package/dist/constructs/check-group-v2.js +0 -4
  95. package/dist/constructs/check-group-v2.js.map +1 -1
  96. package/dist/constructs/check.d.ts +45 -32
  97. package/dist/constructs/check.js +78 -17
  98. package/dist/constructs/check.js.map +1 -1
  99. package/dist/constructs/construct-codegen.d.ts +1 -2
  100. package/dist/constructs/construct-diagnostics.d.ts +3 -0
  101. package/dist/constructs/construct-diagnostics.js +11 -0
  102. package/dist/constructs/construct-diagnostics.js.map +1 -1
  103. package/dist/constructs/construct.d.ts +25 -4
  104. package/dist/constructs/construct.js +41 -5
  105. package/dist/constructs/construct.js.map +1 -1
  106. package/dist/constructs/dns-request-codegen.js +1 -1
  107. package/dist/constructs/dns-request-codegen.js.map +1 -1
  108. package/dist/constructs/email-alert-channel-codegen.js +1 -1
  109. package/dist/constructs/email-alert-channel-codegen.js.map +1 -1
  110. package/dist/constructs/frequency-codegen.js +10 -2
  111. package/dist/constructs/frequency-codegen.js.map +1 -1
  112. package/dist/constructs/frequency.d.ts +8 -3
  113. package/dist/constructs/frequency.js +7 -2
  114. package/dist/constructs/frequency.js.map +1 -1
  115. package/dist/constructs/grpc-monitor.js +19 -0
  116. package/dist/constructs/grpc-monitor.js.map +1 -1
  117. package/dist/constructs/grpc-request-codegen.js +13 -4
  118. package/dist/constructs/grpc-request-codegen.js.map +1 -1
  119. package/dist/constructs/grpc-request.d.ts +23 -0
  120. package/dist/constructs/heartbeat-monitor.d.ts +2 -1
  121. package/dist/constructs/heartbeat-monitor.js +2 -2
  122. package/dist/constructs/heartbeat-monitor.js.map +1 -1
  123. package/dist/constructs/icmp-request-codegen.js +1 -1
  124. package/dist/constructs/icmp-request-codegen.js.map +1 -1
  125. package/dist/constructs/incidentio-alert-channel-codegen.d.ts +1 -1
  126. package/dist/constructs/incidentio-alert-channel-codegen.js +14 -8
  127. package/dist/constructs/incidentio-alert-channel-codegen.js.map +1 -1
  128. package/dist/constructs/index.d.ts +1 -1
  129. package/dist/constructs/index.js +1 -1
  130. package/dist/constructs/index.js.map +1 -1
  131. package/dist/constructs/internal/assertion-validation.js +1 -2
  132. package/dist/constructs/internal/assertion-validation.js.map +1 -1
  133. package/dist/constructs/internal/codegen/context.d.ts +73 -6
  134. package/dist/constructs/internal/codegen/context.js +78 -6
  135. package/dist/constructs/internal/codegen/context.js.map +1 -1
  136. package/dist/constructs/internal/codegen/index.d.ts +3 -1
  137. package/dist/constructs/internal/codegen/index.js +2 -1
  138. package/dist/constructs/internal/codegen/index.js.map +1 -1
  139. package/dist/constructs/internal/codegen/render.d.ts +68 -0
  140. package/dist/constructs/internal/codegen/render.js +75 -0
  141. package/dist/constructs/internal/codegen/render.js.map +1 -0
  142. package/dist/constructs/internal/common-diagnostics.d.ts +1 -2
  143. package/dist/constructs/internal/common-diagnostics.js +6 -14
  144. package/dist/constructs/internal/common-diagnostics.js.map +1 -1
  145. package/dist/constructs/internal/declaring-file.d.ts +39 -0
  146. package/dist/constructs/internal/declaring-file.js +139 -0
  147. package/dist/constructs/internal/declaring-file.js.map +1 -0
  148. package/dist/constructs/internal/retry-strategy-defaults.d.ts +13 -0
  149. package/dist/constructs/internal/retry-strategy-defaults.js +14 -0
  150. package/dist/constructs/internal/retry-strategy-defaults.js.map +1 -0
  151. package/dist/constructs/key-value-pair-codegen.d.ts +6 -1
  152. package/dist/constructs/key-value-pair-codegen.js +24 -3
  153. package/dist/constructs/key-value-pair-codegen.js.map +1 -1
  154. package/dist/constructs/maintenance-window-codegen.d.ts +7 -0
  155. package/dist/constructs/maintenance-window-codegen.js +36 -19
  156. package/dist/constructs/maintenance-window-codegen.js.map +1 -1
  157. package/dist/constructs/maintenance-window.d.ts +35 -3
  158. package/dist/constructs/maintenance-window.js +35 -1
  159. package/dist/constructs/maintenance-window.js.map +1 -1
  160. package/dist/constructs/monitor.d.ts +1 -1
  161. package/dist/constructs/msteams-alert-channel-codegen.d.ts +1 -1
  162. package/dist/constructs/msteams-alert-channel-codegen.js +8 -18
  163. package/dist/constructs/msteams-alert-channel-codegen.js.map +1 -1
  164. package/dist/constructs/opsgenie-alert-channel-codegen.js +1 -1
  165. package/dist/constructs/opsgenie-alert-channel-codegen.js.map +1 -1
  166. package/dist/constructs/pagerduty-alert-channel-codegen.js +1 -1
  167. package/dist/constructs/pagerduty-alert-channel-codegen.js.map +1 -1
  168. package/dist/constructs/phone-call-alert-channel-codegen.js +1 -1
  169. package/dist/constructs/phone-call-alert-channel-codegen.js.map +1 -1
  170. package/dist/constructs/playwright-check-bundle.d.ts +7 -1
  171. package/dist/constructs/playwright-check-bundle.js +3 -0
  172. package/dist/constructs/playwright-check-bundle.js.map +1 -1
  173. package/dist/constructs/playwright-check-codegen.d.ts +85 -0
  174. package/dist/constructs/playwright-check-codegen.js +212 -0
  175. package/dist/constructs/playwright-check-codegen.js.map +1 -0
  176. package/dist/constructs/playwright-check.d.ts +14 -24
  177. package/dist/constructs/playwright-check.js +16 -52
  178. package/dist/constructs/playwright-check.js.map +1 -1
  179. package/dist/constructs/retry-strategy-codegen.d.ts +7 -1
  180. package/dist/constructs/retry-strategy-codegen.js +41 -32
  181. package/dist/constructs/retry-strategy-codegen.js.map +1 -1
  182. package/dist/constructs/retry-strategy.d.ts +0 -4
  183. package/dist/constructs/retry-strategy.js +5 -8
  184. package/dist/constructs/retry-strategy.js.map +1 -1
  185. package/dist/constructs/session.d.ts +26 -1
  186. package/dist/constructs/session.js +33 -2
  187. package/dist/constructs/session.js.map +1 -1
  188. package/dist/constructs/slack-alert-channel-codegen.js +1 -1
  189. package/dist/constructs/slack-alert-channel-codegen.js.map +1 -1
  190. package/dist/constructs/slack-app-alert-channel-codegen.js +1 -1
  191. package/dist/constructs/slack-app-alert-channel-codegen.js.map +1 -1
  192. package/dist/constructs/sms-alert-channel-codegen.js +1 -1
  193. package/dist/constructs/sms-alert-channel-codegen.js.map +1 -1
  194. package/dist/constructs/ssl-request-codegen.js +4 -3
  195. package/dist/constructs/ssl-request-codegen.js.map +1 -1
  196. package/dist/constructs/status-page-v3-automation-rule-codegen.js +5 -4
  197. package/dist/constructs/status-page-v3-automation-rule-codegen.js.map +1 -1
  198. package/dist/constructs/status-page-v3-codegen.js +3 -2
  199. package/dist/constructs/status-page-v3-codegen.js.map +1 -1
  200. package/dist/constructs/status-page-v3-component-codegen.js +8 -7
  201. package/dist/constructs/status-page-v3-component-codegen.js.map +1 -1
  202. package/dist/constructs/tcp-monitor-codegen.js +3 -2
  203. package/dist/constructs/tcp-monitor-codegen.js.map +1 -1
  204. package/dist/constructs/tcp-monitor.d.ts +4 -3
  205. package/dist/constructs/tcp-monitor.js +3 -2
  206. package/dist/constructs/tcp-monitor.js.map +1 -1
  207. package/dist/constructs/telegram-alert-channel-codegen.d.ts +1 -1
  208. package/dist/constructs/telegram-alert-channel-codegen.js +14 -8
  209. package/dist/constructs/telegram-alert-channel-codegen.js.map +1 -1
  210. package/dist/constructs/time-zone.d.ts +24 -0
  211. package/dist/constructs/time-zone.js +455 -0
  212. package/dist/constructs/time-zone.js.map +1 -0
  213. package/dist/constructs/traceroute-request-codegen.js +2 -2
  214. package/dist/constructs/traceroute-request-codegen.js.map +1 -1
  215. package/dist/constructs/url-monitor-codegen.js +1 -1
  216. package/dist/constructs/url-monitor-codegen.js.map +1 -1
  217. package/dist/constructs/url-monitor.d.ts +3 -2
  218. package/dist/constructs/url-monitor.js +3 -0
  219. package/dist/constructs/url-monitor.js.map +1 -1
  220. package/dist/constructs/url-request-codegen.js +4 -3
  221. package/dist/constructs/url-request-codegen.js.map +1 -1
  222. package/dist/constructs/webhook-alert-channel-codegen.js +3 -3
  223. package/dist/constructs/webhook-alert-channel-codegen.js.map +1 -1
  224. package/dist/formatters/check-result-detail.js +0 -185
  225. package/dist/formatters/check-result-detail.js.map +1 -1
  226. package/dist/helpers/activate-account.d.ts +14 -0
  227. package/dist/helpers/activate-account.js +25 -0
  228. package/dist/helpers/activate-account.js.map +1 -0
  229. package/dist/helpers/cli-mode.d.ts +18 -0
  230. package/dist/helpers/cli-mode.js +41 -2
  231. package/dist/helpers/cli-mode.js.map +1 -1
  232. package/dist/helpers/command-preview.d.ts +44 -0
  233. package/dist/helpers/command-preview.js +29 -9
  234. package/dist/helpers/command-preview.js.map +1 -1
  235. package/dist/helpers/flags.d.ts +10 -0
  236. package/dist/helpers/flags.js +17 -0
  237. package/dist/helpers/flags.js.map +1 -1
  238. package/dist/helpers/onboarding/boilerplate.js +13 -1
  239. package/dist/helpers/onboarding/boilerplate.js.map +1 -1
  240. package/dist/helpers/onboarding/index.d.ts +1 -1
  241. package/dist/helpers/onboarding/index.js +1 -1
  242. package/dist/helpers/onboarding/index.js.map +1 -1
  243. package/dist/helpers/onboarding/messages.d.ts +6 -0
  244. package/dist/helpers/onboarding/messages.js +14 -0
  245. package/dist/helpers/onboarding/messages.js.map +1 -1
  246. package/dist/helpers/onboarding/skill-install.js +2 -2
  247. package/dist/helpers/onboarding/skill-install.js.map +1 -1
  248. package/dist/helpers/wrap.js +1 -1
  249. package/dist/helpers/wrap.js.map +1 -1
  250. package/dist/reporters/abstract-list.js +11 -2
  251. package/dist/reporters/abstract-list.js.map +1 -1
  252. package/dist/reporters/github.js +3 -2
  253. package/dist/reporters/github.js.map +1 -1
  254. package/dist/reporters/util.d.ts +1 -0
  255. package/dist/reporters/util.js +5 -58
  256. package/dist/reporters/util.js.map +1 -1
  257. package/dist/rest/analytics.js +0 -4
  258. package/dist/rest/analytics.js.map +1 -1
  259. package/dist/rest/api.d.ts +8 -1
  260. package/dist/rest/api.js +21 -3
  261. package/dist/rest/api.js.map +1 -1
  262. package/dist/rest/check-results.d.ts +1 -50
  263. package/dist/rest/check-results.js.map +1 -1
  264. package/dist/rest/checkly-storage.d.ts +6 -1
  265. package/dist/rest/checkly-storage.js +13 -2
  266. package/dist/rest/checkly-storage.js.map +1 -1
  267. package/dist/rest/errors.d.ts +13 -0
  268. package/dist/rest/errors.js +5 -1
  269. package/dist/rest/errors.js.map +1 -1
  270. package/dist/rest/projects.d.ts +254 -4
  271. package/dist/rest/projects.js +184 -12
  272. package/dist/rest/projects.js.map +1 -1
  273. package/dist/services/abstract-check-runner.d.ts +11 -0
  274. package/dist/services/abstract-check-runner.js +98 -46
  275. package/dist/services/abstract-check-runner.js.map +1 -1
  276. package/dist/services/check-parser/bundler.d.ts +26 -0
  277. package/dist/services/check-parser/bundler.js +81 -7
  278. package/dist/services/check-parser/bundler.js.map +1 -1
  279. package/dist/services/check-parser/cache-hash.d.ts +1 -4
  280. package/dist/services/check-parser/cache-hash.js.map +1 -1
  281. package/dist/services/checkly-config-codegen.js +1 -4
  282. package/dist/services/checkly-config-codegen.js.map +1 -1
  283. package/dist/services/checkly-config-loader.d.ts +7 -33
  284. package/dist/services/checkly-config-loader.js +50 -47
  285. package/dist/services/checkly-config-loader.js.map +1 -1
  286. package/dist/services/config.d.ts +2 -0
  287. package/dist/services/config.js +14 -0
  288. package/dist/services/config.js.map +1 -1
  289. package/dist/services/content-hash.d.ts +14 -0
  290. package/dist/services/content-hash.js +22 -0
  291. package/dist/services/content-hash.js.map +1 -0
  292. package/dist/services/deploy-diff/diff-lines.d.ts +38 -0
  293. package/dist/services/deploy-diff/diff-lines.js +191 -0
  294. package/dist/services/deploy-diff/diff-lines.js.map +1 -0
  295. package/dist/services/deploy-diff/import-shape.d.ts +171 -0
  296. package/dist/services/deploy-diff/import-shape.js +633 -0
  297. package/dist/services/deploy-diff/import-shape.js.map +1 -0
  298. package/dist/services/deploy-diff/legacy-payload.d.ts +22 -0
  299. package/dist/services/deploy-diff/legacy-payload.js +51 -0
  300. package/dist/services/deploy-diff/legacy-payload.js.map +1 -0
  301. package/dist/services/deploy-diff/plan-summary.d.ts +37 -0
  302. package/dist/services/deploy-diff/plan-summary.js +154 -0
  303. package/dist/services/deploy-diff/plan-summary.js.map +1 -0
  304. package/dist/services/deploy-diff/preview-output.d.ts +61 -0
  305. package/dist/services/deploy-diff/preview-output.js +394 -0
  306. package/dist/services/deploy-diff/preview-output.js.map +1 -0
  307. package/dist/services/deploy-diff/render.d.ts +53 -0
  308. package/dist/services/deploy-diff/render.js +317 -0
  309. package/dist/services/deploy-diff/render.js.map +1 -0
  310. package/dist/services/deploy-diff/shape-changes.d.ts +2 -0
  311. package/dist/services/deploy-diff/shape-changes.js +35 -0
  312. package/dist/services/deploy-diff/shape-changes.js.map +1 -0
  313. package/dist/services/deploy-diff/source-index.d.ts +18 -0
  314. package/dist/services/deploy-diff/source-index.js +48 -0
  315. package/dist/services/deploy-diff/source-index.js.map +1 -0
  316. package/dist/services/deploy-diff/variable-names.d.ts +30 -0
  317. package/dist/services/deploy-diff/variable-names.js +64 -0
  318. package/dist/services/deploy-diff/variable-names.js.map +1 -0
  319. package/dist/services/project-parser.d.ts +5 -0
  320. package/dist/services/project-parser.js +25 -13
  321. package/dist/services/project-parser.js.map +1 -1
  322. package/dist/services/snapshot-service.d.ts +25 -8
  323. package/dist/services/snapshot-service.js +46 -4
  324. package/dist/services/snapshot-service.js.map +1 -1
  325. package/dist/services/test-filters.d.ts +18 -0
  326. package/dist/services/test-filters.js +10 -0
  327. package/dist/services/test-filters.js.map +1 -1
  328. package/dist/services/test-runner.js +7 -3
  329. package/dist/services/test-runner.js.map +1 -1
  330. package/dist/services/test-session-cancel.js +1 -1
  331. package/dist/services/test-session-cancel.js.map +1 -1
  332. package/dist/services/util.d.ts +17 -2
  333. package/dist/services/util.js +118 -11
  334. package/dist/services/util.js.map +1 -1
  335. package/dist/services/write-back/apply-edits.d.ts +29 -0
  336. package/dist/services/write-back/apply-edits.js +255 -0
  337. package/dist/services/write-back/apply-edits.js.map +1 -0
  338. package/dist/services/write-back/helper-edit.d.ts +135 -0
  339. package/dist/services/write-back/helper-edit.js +343 -0
  340. package/dist/services/write-back/helper-edit.js.map +1 -0
  341. package/dist/services/write-back/imports.d.ts +30 -0
  342. package/dist/services/write-back/imports.js +82 -0
  343. package/dist/services/write-back/imports.js.map +1 -0
  344. package/dist/services/write-back/literal-edit.d.ts +183 -0
  345. package/dist/services/write-back/literal-edit.js +359 -0
  346. package/dist/services/write-back/literal-edit.js.map +1 -0
  347. package/dist/services/write-back/output.d.ts +26 -0
  348. package/dist/services/write-back/output.js +110 -0
  349. package/dist/services/write-back/output.js.map +1 -0
  350. package/dist/services/write-back/plan.d.ts +173 -0
  351. package/dist/services/write-back/plan.js +968 -0
  352. package/dist/services/write-back/plan.js.map +1 -0
  353. package/dist/services/write-back/source-file.d.ts +118 -0
  354. package/dist/services/write-back/source-file.js +432 -0
  355. package/dist/services/write-back/source-file.js.map +1 -0
  356. package/dist/sourcegen/index.d.ts +1 -1
  357. package/dist/sourcegen/index.js +1 -1
  358. package/dist/sourcegen/index.js.map +1 -1
  359. package/dist/sourcegen/program.d.ts +19 -1
  360. package/dist/sourcegen/program.js +32 -7
  361. package/dist/sourcegen/program.js.map +1 -1
  362. package/oclif.manifest.json +676 -635
  363. package/package.json +13 -13
  364. package/dist/commands/rules.d.ts +0 -9
  365. package/dist/commands/rules.js +0 -13
  366. package/dist/commands/rules.js.map +0 -1
  367. package/dist/constructs/agentic-check-codegen.d.ts +0 -22
  368. package/dist/constructs/agentic-check-codegen.js +0 -59
  369. package/dist/constructs/agentic-check-codegen.js.map +0 -1
  370. package/dist/constructs/agentic-check.d.ts +0 -237
  371. package/dist/constructs/agentic-check.js +0 -100
  372. package/dist/constructs/agentic-check.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/services/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,MAAM,MAAM,IAAI,CAAA;AAC5B,OAAO,WAAW,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAkC/B,SAAS,sBAAsB;IAC7B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAA;IACxD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,oBAAoB,CAAA;IAC/E,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,UAAU,EAAE,CAAA;AACxD,CAAC;AAED,SAAS,wBAAwB;IAC/B,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;IAC5E,OAAO,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,GAAG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AAC,4BAA4B,CAAA;IAEvI,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAA;AACtE,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,oBAA2C,EAC3C,oBAAwC,EACxC,GAAW;IAEX,IAAI,oBAAoB,CAAC,oBAAoB,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,oBAAoB,CAAC,oBAAoB,CAAC,CAAA;IACrE,CAAC;SAAM,IAAI,oBAAoB,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAA;IAChD,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;IACxD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAE,GAAW;IACnD,OAAO,CAAC,sBAAsB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,uBAAuB,CAAC;SACtG,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;SACpC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAA;AAC3C,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { TSESTree } from '@typescript-eslint/typescript-estree';
2
+ import { type HelperEdit, type SourceEdit } from './helper-edit.js';
3
+ import { type AppliedEdit, type EditResult } from './literal-edit.js';
4
+ import { type ParsedSource } from './source-file.js';
5
+ export type { HelperEdit, SourceEdit };
6
+ /**
7
+ * Applies literal and helper edits to the text of `source` inside `options`,
8
+ * one of its nodes. Edits are resolved against the original ranges and
9
+ * spliced from the end of the file backwards, so no edit shifts another.
10
+ * Two edits that touch the same bytes cannot both be right: a replacement
11
+ * wins over an insertion into the object it replaces, and otherwise the
12
+ * first listed wins; the loser is skipped. Replacements are reported before
13
+ * insertions. An edit whose text equals what the code already holds is
14
+ * neither applied nor skipped: there is nothing to do.
15
+ *
16
+ * A helper edit that references a class the file does not import gets it
17
+ * added to the file's `checkly/constructs` import in the same pass; when
18
+ * that is not possible, the edit is skipped with the reason. The result is
19
+ * text only: to edit it again, parse it again.
20
+ */
21
+ export declare function applyEdits(source: ParsedSource, options: TSESTree.ObjectExpression, edits: readonly SourceEdit[]): EditResult;
22
+ /**
23
+ * Whether a re-parse of the edited text holds, at the edit's path, what the
24
+ * edit meant: the value a literal evaluates to, or the expression a helper
25
+ * edit was rendered from (its classes under the names it was rendered with).
26
+ * A splice that produced anything else is a bug, and the user's source is
27
+ * not the place to find out.
28
+ */
29
+ export declare function readsBack(options: TSESTree.ObjectExpression, edit: AppliedEdit): boolean;
@@ -0,0 +1,255 @@
1
+ import { ASSERTION_BUILDERS, buildHelperValue, helperClass, isGlobalHelper, isHelperEdit, isReplaceableByHelper, matchesValue, renderExpression, } from './helper-edit.js';
2
+ import { appendImports, resolveImports } from './imports.js';
3
+ import { pathsUnder } from '../../constructs/internal/codegen/index.js';
4
+ import { isDeepStrictEqual } from 'node:util';
5
+ import { detectStyle, evaluateLiteral, indentationAt, insertionSplice, isMultiLine, isPlainLiteral, memberColumn, renderValue, templateLiteral, resolvePath, trailingCommaOf, } from './literal-edit.js';
6
+ import { checklyBindings, declaresName, localBinding, memberName, spelledOutPaths, walk, WriteBackSkipped, } from './source-file.js';
7
+ /**
8
+ * Applies literal and helper edits to the text of `source` inside `options`,
9
+ * one of its nodes. Edits are resolved against the original ranges and
10
+ * spliced from the end of the file backwards, so no edit shifts another.
11
+ * Two edits that touch the same bytes cannot both be right: a replacement
12
+ * wins over an insertion into the object it replaces, and otherwise the
13
+ * first listed wins; the loser is skipped. Replacements are reported before
14
+ * insertions. An edit whose text equals what the code already holds is
15
+ * neither applied nor skipped: there is nothing to do.
16
+ *
17
+ * A helper edit that references a class the file does not import gets it
18
+ * added to the file's `checkly/constructs` import in the same pass; when
19
+ * that is not possible, the edit is skipped with the reason. The result is
20
+ * text only: to edit it again, parse it again.
21
+ */
22
+ export function applyEdits(source, options, edits) {
23
+ const { text, program } = source;
24
+ const style = detectStyle(source, options);
25
+ // The properties the construct spells out stay spelled out, whatever
26
+ // value they get: an option its author wrote down must not vanish because
27
+ // Checkly's value for it is the builder's default.
28
+ const spelledOut = spelledOutPaths(options);
29
+ const applied = [];
30
+ // Skips are found in two passes (resolution, then range claims) and are
31
+ // reported in the order the edits were given.
32
+ const skips = [];
33
+ const skip = (edit, reason) => skips.push({ index: edits.indexOf(edit), skipped: { ...edit, reason } });
34
+ const replacements = [];
35
+ const insertions = new Map();
36
+ for (const edit of edits) {
37
+ try {
38
+ const helper = isHelperEdit(edit) ? edit : undefined;
39
+ // Any assertion builder spells the property; the other kinds have one class each.
40
+ const classes = helper === undefined ? [] : helper.helper === 'assertions' ? ASSERTION_BUILDERS : [helperClass(helper)];
41
+ // A global such as `Date` is bound in every file under its own name,
42
+ // unless the file binds the name to something of its own.
43
+ const global = helper !== undefined && isGlobalHelper(helper);
44
+ if (global && classes.some(name => declaresName(program, name))) {
45
+ skip(edit, `${classes.join(', ')} is bound to something else in this file`);
46
+ continue;
47
+ }
48
+ const locals = global ? new Set(classes) : checklyBindings(program, new Set(classes));
49
+ const resolution = helper === undefined
50
+ ? resolvePath(options, edit.path)
51
+ : resolvePath(options, edit.path, {
52
+ replaceable: node => isReplaceableByHelper(node, locals),
53
+ expected: `a literal or a ${helperClass(helper)} expression`,
54
+ replaceNull: true,
55
+ });
56
+ if (resolution.kind === 'unsupported') {
57
+ skip(edit, resolution.reason);
58
+ continue;
59
+ }
60
+ // A sibling the helper's property replaces (`doubleCheck` beside a
61
+ // retry strategy) means the code says something else about it; a
62
+ // spread could carry one too.
63
+ const unless = helper?.unless ?? [];
64
+ const siblings = resolution.parent.type === 'ObjectExpression' ? resolution.parent.properties : [];
65
+ const conflict = unless.length === 0
66
+ ? undefined
67
+ : siblings.find(property => property.type === 'SpreadElement' || unless.includes(memberName(property) ?? ''));
68
+ if (conflict !== undefined) {
69
+ const name = conflict.type === 'SpreadElement' ? 'a spread' : memberName(conflict);
70
+ skip(edit, `${name} is set in the code; replace it with ${edit.path.join('.')} by hand`);
71
+ continue;
72
+ }
73
+ if (resolution.kind === 'found') {
74
+ const { node } = resolution;
75
+ const previous = text.slice(node.range[0], node.range[1]);
76
+ // The lists in the new text are laid out like the lists the replaced
77
+ // node holds; a node without one (a number, a constant, null) is laid
78
+ // out like the object holding it, as an inserted member would be.
79
+ const model = firstList(node) ?? resolution.parent;
80
+ const rendered = render(program, style, edit, helper, spelledOut, {
81
+ column: indentationAt(text, node.range[0]),
82
+ inline: !isMultiLine(text, model),
83
+ trailingComma: trailingCommaOf(source, model) !== undefined,
84
+ }, node);
85
+ // Nothing to do when the code already holds the value: the same
86
+ // text, or for an expression the same structure however spelled.
87
+ const unchanged = rendered.text === previous
88
+ || (rendered.expression !== undefined
89
+ && matchesValue(node, rendered.expression.value, rendered.expression.locals));
90
+ if (!unchanged) {
91
+ const splice = { start: node.range[0], end: node.range[1], text: rendered.text };
92
+ replacements.push({ ...rendered, splice, previous });
93
+ }
94
+ continue;
95
+ }
96
+ const { parent, key } = resolution;
97
+ const rendered = render(program, style, edit, helper, spelledOut, {
98
+ column: memberColumn(text, parent, style),
99
+ inline: !isMultiLine(text, parent),
100
+ trailingComma: trailingCommaOf(source, parent) !== undefined,
101
+ });
102
+ const pending = insertions.get(parent) ?? [];
103
+ if (pending.some(other => other.key === key)) {
104
+ skip(edit, 'overlaps another edit');
105
+ continue;
106
+ }
107
+ pending.push({ ...rendered, key });
108
+ insertions.set(parent, pending);
109
+ }
110
+ catch (err) {
111
+ if (err instanceof WriteBackSkipped) {
112
+ skip(edit, err.message);
113
+ continue;
114
+ }
115
+ throw err;
116
+ }
117
+ }
118
+ // The classes the rendered expressions reference and the file lacks: an
119
+ // edit whose class cannot be added is dropped before any range is claimed.
120
+ const pendingAll = [...replacements, ...[...insertions.values()].flat()];
121
+ const imports = resolveImports(source, pendingAll.flatMap(entry => entry.needs));
122
+ const refusal = (entry) => {
123
+ for (const name of entry.needs) {
124
+ const reason = imports.refused.get(name);
125
+ if (reason !== undefined) {
126
+ return reason;
127
+ }
128
+ }
129
+ return undefined;
130
+ };
131
+ const splices = [];
132
+ const claim = (splice) => {
133
+ const clash = splices.some(other => splice.start < other.end && other.start < splice.end);
134
+ if (!clash) {
135
+ splices.push(splice);
136
+ }
137
+ return !clash;
138
+ };
139
+ const used = new Set();
140
+ const accept = (entry, previous) => {
141
+ const { edit, text: rendered, form, expected, expression } = entry;
142
+ applied.push({ path: edit.path, value: edit.value, previous, rendered, form, expected, expression });
143
+ entry.needs.forEach(name => used.add(name));
144
+ };
145
+ for (const entry of replacements) {
146
+ const reason = refusal(entry);
147
+ if (reason !== undefined) {
148
+ skip(entry.edit, reason);
149
+ }
150
+ else if (!claim(entry.splice)) {
151
+ skip(entry.edit, 'overlaps another edit');
152
+ }
153
+ else {
154
+ accept(entry, entry.previous);
155
+ }
156
+ }
157
+ for (const [parent, pending] of insertions) {
158
+ const allowed = pending.filter(entry => {
159
+ const reason = refusal(entry);
160
+ if (reason !== undefined) {
161
+ skip(entry.edit, reason);
162
+ }
163
+ return reason === undefined;
164
+ });
165
+ if (allowed.length === 0) {
166
+ continue;
167
+ }
168
+ const members = allowed.map(entry => ({ key: entry.key, rendered: entry.text }));
169
+ const splice = insertionSplice(text, source, parent, members, style);
170
+ if (!claim(splice)) {
171
+ for (const { edit } of allowed) {
172
+ skip(edit, 'overlaps another edit');
173
+ }
174
+ continue;
175
+ }
176
+ allowed.forEach(entry => accept(entry));
177
+ }
178
+ // Only the classes an applied edit references are imported; an edit
179
+ // dropped above may have been the only one wanting a name. The import
180
+ // lies outside the options object, so it cannot clash with an edit.
181
+ const names = imports.missing.filter(name => used.has(name));
182
+ const importSplice = appendImports(source, names);
183
+ if (importSplice !== undefined) {
184
+ claim(importSplice);
185
+ }
186
+ splices.sort((a, b) => b.start - a.start);
187
+ let result = text;
188
+ for (const splice of splices) {
189
+ result = result.slice(0, splice.start) + splice.text + result.slice(splice.end);
190
+ }
191
+ const skipped = skips.sort((a, b) => a.index - b.index).map(entry => entry.skipped);
192
+ return { text: result, applied, skipped, imports: names };
193
+ }
194
+ /**
195
+ * Whether a re-parse of the edited text holds, at the edit's path, what the
196
+ * edit meant: the value a literal evaluates to, or the expression a helper
197
+ * edit was rendered from (its classes under the names it was rendered with).
198
+ * A splice that produced anything else is a bug, and the user's source is
199
+ * not the place to find out.
200
+ */
201
+ export function readsBack(options, edit) {
202
+ if (edit.expression === undefined) {
203
+ const resolution = resolvePath(options, edit.path);
204
+ return resolution.kind === 'found' && isDeepStrictEqual(evaluateLiteral(resolution.node), edit.expected);
205
+ }
206
+ const resolution = resolvePath(options, edit.path, { replaceable: () => true, replaceNull: true });
207
+ return resolution.kind === 'found' && matchesValue(resolution.node, edit.expression.value, edit.expression.locals);
208
+ }
209
+ /**
210
+ * The text for one edit: a literal for a literal edit, or for a helper edit
211
+ * whose target is a plain literal and which offers a literal alternative;
212
+ * otherwise the helper expression, with the classes it references under the
213
+ * names the file binds them to, and the rest listed as needed.
214
+ */
215
+ function render(program, style, edit, helper, spelledOut, layout, node) {
216
+ const at = edit.path.join('.');
217
+ if (helper === undefined) {
218
+ // A multi-line string over a template literal stays one; anything else
219
+ // is quoted the way the file quotes.
220
+ const template = node?.type === 'TemplateLiteral' && typeof edit.value === 'string' && edit.value.includes('\n')
221
+ ? templateLiteral(edit.value)
222
+ : undefined;
223
+ const text = template ?? renderValue(edit.value, style, { ...layout, at });
224
+ return { edit, text, form: 'literal', expected: edit.value, needs: [] };
225
+ }
226
+ if (node !== undefined && helper.literalAlternative !== undefined && isPlainLiteral(node)) {
227
+ const expected = helper.literalAlternative;
228
+ return { edit, text: renderValue(expected, style, { ...layout, at }), form: 'literal', expected, needs: [] };
229
+ }
230
+ // The options the replaced expression spells out, by name: of the helpers,
231
+ // only the retry strategy's codegen leaves an option out for holding the
232
+ // builder's default, so only it reads the list.
233
+ const built = buildHelperValue(helper, pathsUnder(spelledOut, at));
234
+ const locals = new Map();
235
+ const needs = [];
236
+ for (const name of built.imports) {
237
+ const bound = localBinding(program, name);
238
+ locals.set(name, bound ?? name);
239
+ if (bound === undefined) {
240
+ needs.push(name);
241
+ }
242
+ }
243
+ const rendered = renderExpression(built.value, style, { ...layout, locals });
244
+ return { edit, text: rendered, form: 'helper', expression: { value: built.value, locals }, needs };
245
+ }
246
+ /** The first array or object literal in `node`, itself included, in source order. */
247
+ function firstList(node) {
248
+ for (const inner of walk(node)) {
249
+ if (inner.type === 'ArrayExpression' || inner.type === 'ObjectExpression') {
250
+ return inner;
251
+ }
252
+ }
253
+ return undefined;
254
+ }
255
+ //# sourceMappingURL=apply-edits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-edits.js","sourceRoot":"","sources":["../../../src/services/write-back/apply-edits.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAEhB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,GAEjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAA;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE7C,OAAO,EAEL,WAAW,EAEX,eAAe,EACf,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,WAAW,EAGX,eAAe,GAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,UAAU,EAGV,eAAe,EAEf,IAAI,EACJ,gBAAgB,GACjB,MAAM,kBAAkB,CAAA;AAIzB;;;;;;;;;;;;;;GAcG;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1,135 @@
1
+ import { valueForAssertion } from '../../constructs/api-assertion-codegen.js';
2
+ import { valueForDnsAssertion } from '../../constructs/dns-assertion-codegen.js';
3
+ import { valueForGrpcAssertion } from '../../constructs/grpc-assertion-codegen.js';
4
+ import { valueForIcmpAssertion } from '../../constructs/icmp-assertion-codegen.js';
5
+ import { valueForSslAssertion } from '../../constructs/ssl-assertion-codegen.js';
6
+ import { valueForTcpAssertion } from '../../constructs/tcp-monitor-codegen.js';
7
+ import { valueForTracerouteAssertion } from '../../constructs/traceroute-assertion-codegen.js';
8
+ import { valueForUrlAssertion } from '../../constructs/url-assertion-codegen.js';
9
+ import { Value } from '../../sourcegen/index.js';
10
+ import { type LiteralEdit, type SourceStyle } from './literal-edit.js';
11
+ import { type Node } from './source-file.js';
12
+ /**
13
+ * Edits of the properties a construct spells with a helper expression rather
14
+ * than a literal: `frequency: Frequency.EVERY_5M`,
15
+ * `retryStrategy: RetryStrategyBuilder.fixedStrategy({ … })`,
16
+ * `alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(…)`,
17
+ * `assertions: [AssertionBuilder.statusCode().equals(200)]`, and a date
18
+ * the account reports as an ISO string: `startsAt: new Date('…')`.
19
+ *
20
+ * The expression is built by the same codegen `checkly import` uses for the
21
+ * property, so the text written is the one an import would have generated;
22
+ * only the rendering differs, following the file's quotes, indentation and
23
+ * line ending the way `renderValue` does for literals (`sourcegen`'s own
24
+ * printer fixes all three). The classes the expression references are
25
+ * looked up under the names the file binds them to, and added to its
26
+ * `checkly/constructs` import when it lacks them (`imports.ts`).
27
+ *
28
+ * An existing value is replaced only when it is a plain literal or an
29
+ * expression on the same helper whose arguments are literals: a variable
30
+ * inside `fixedStrategy({ maxRetries: retries })` is something the user
31
+ * meant, and a rewrite must not throw it away.
32
+ */
33
+ export type HelperKind = 'frequency' | 'retryStrategy' | 'alertEscalation' | 'assertions' | 'date';
34
+ /** The codegen for each assertion builder a monitor class spells its assertions with. */
35
+ declare const ASSERTION_CODEGENS: {
36
+ AssertionBuilder: typeof valueForAssertion;
37
+ UrlAssertionBuilder: typeof valueForUrlAssertion;
38
+ TcpAssertionBuilder: typeof valueForTcpAssertion;
39
+ DnsAssertionBuilder: typeof valueForDnsAssertion;
40
+ GrpcAssertionBuilder: typeof valueForGrpcAssertion;
41
+ SslAssertionBuilder: typeof valueForSslAssertion;
42
+ IcmpAssertionBuilder: typeof valueForIcmpAssertion;
43
+ TracerouteAssertionBuilder: typeof valueForTracerouteAssertion;
44
+ };
45
+ export type AssertionBuilderName = keyof typeof ASSERTION_CODEGENS;
46
+ /** The names of every assertion builder: each spells the same property, so a file may hold any of them. */
47
+ export declare const ASSERTION_BUILDERS: readonly string[];
48
+ interface HelperEditBase extends Omit<LiteralEdit, 'helper'> {
49
+ /** Sibling keys of the property that make the edit wrong (`doubleCheck` beside `retryStrategy`). */
50
+ unless?: string[];
51
+ /**
52
+ * A plain value to write instead of the expression when the node being
53
+ * replaced is itself a plain literal: a whole-minute `frequency` stays a
54
+ * number in a file that spells it as one. The choice is made where the
55
+ * node is known, in `apply-edits.ts`; the planner never sees the file.
56
+ */
57
+ literalAlternative?: unknown;
58
+ }
59
+ /**
60
+ * An edit of a helper-spelled property. The class the expression is built
61
+ * on follows from the kind, except for assertions, where each monitor class
62
+ * has its own builder.
63
+ */
64
+ export type HelperEdit = HelperEditBase & ({
65
+ helper: 'frequency' | 'retryStrategy' | 'alertEscalation' | 'date';
66
+ builder?: undefined;
67
+ } | {
68
+ helper: 'assertions';
69
+ builder: AssertionBuilderName;
70
+ });
71
+ export type SourceEdit = LiteralEdit | HelperEdit;
72
+ export declare function isHelperEdit(edit: SourceEdit): edit is HelperEdit;
73
+ /** The class the edit's expression is built on, as `checkly/constructs` exports it, or the global `Date`. */
74
+ export declare function helperClass(edit: HelperEdit): string;
75
+ /** Whether the edit's class is a global every file binds, rather than one imported from `checkly/constructs`. */
76
+ export declare function isGlobalHelper(edit: HelperEdit): boolean;
77
+ /**
78
+ * The expression the codegen builds for the edit's value, and the classes
79
+ * it references (those the codegen asked to import and the expression
80
+ * names: a gRPC assertion the builder cannot spell comes back as a plain
81
+ * object, which needs no import). The value is what the account holds, in
82
+ * the import format `entry.before` carries.
83
+ *
84
+ * @throws WriteBackSkipped for a value the codegen cannot spell (an
85
+ * assertion source or retry type this CLI does not know, a malformed row)
86
+ * or one that means "unset", which is never written because nothing is
87
+ * ever removed from the code.
88
+ */
89
+ export declare function buildHelperValue(edit: HelperEdit, spelledOut?: readonly string[]): {
90
+ value: Value;
91
+ imports: string[];
92
+ };
93
+ /**
94
+ * Whether `node` is an expression built on one of `locals` (the names the
95
+ * file binds the helper class to): a member, call or `new` chain rooted at
96
+ * such a name, with every argument a literal (see `isReplaceableByHelper`),
97
+ * `undefined`, or such a chain. Replacing it loses nothing the user wrote
98
+ * by hand.
99
+ */
100
+ export declare function isHelperExpression(node: Node, locals: ReadonlySet<string>): boolean;
101
+ /**
102
+ * Whether `node` can be replaced by a helper edit without losing anything
103
+ * written by hand: a plain literal, `null` (the edit writes an expression,
104
+ * not null, and the codegen spells an assertion it has no builder method
105
+ * for as an object holding `regex: null`), a helper expression, or an
106
+ * array or object built only of those.
107
+ */
108
+ export declare function isReplaceableByHelper(node: Node, locals: ReadonlySet<string>): boolean;
109
+ export interface ExpressionLayout {
110
+ /** The indentation of the line the expression starts on. */
111
+ column: string;
112
+ /** Whether objects and lists inside stay on one line, as the replaced node did. */
113
+ inline: boolean;
114
+ /** Whether a multi-line object or list ends its last member with a comma. */
115
+ trailingComma: boolean;
116
+ /** The local name of each class the expression references, where the file binds it under another. */
117
+ locals: ReadonlyMap<string, string>;
118
+ }
119
+ /**
120
+ * The source text of a sourcegen expression in the file's style. Objects
121
+ * keep the order the codegen gave them (its own sorter), so the text is
122
+ * the one `checkly import` would print, reindented and requoted.
123
+ *
124
+ * @throws WriteBackSkipped for a value class the codegen never produces for
125
+ * these properties and this renderer does not spell.
126
+ */
127
+ export declare function renderExpression(value: Value, style: SourceStyle, layout: ExpressionLayout): string;
128
+ /**
129
+ * Whether a parsed node is the expression `value` renders to: the same
130
+ * names, members, arguments and literals. The check the read-back of a
131
+ * written file makes; it says nothing about what the expression means,
132
+ * which the codegen's own tests cover.
133
+ */
134
+ export declare function matchesValue(node: Node, value: Value, locals: ReadonlyMap<string, string>): boolean;
135
+ export {};