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.
- package/dist/ai-context/context.js +1 -0
- package/dist/ai-context/context.js.map +1 -1
- package/dist/ai-context/onboarding-boilerplate/checkly-config-template.ts +2 -0
- package/dist/ai-context/public-skills/checkly/SKILL.md +18 -5
- package/dist/ai-context/skills-command/references/communicate.md +6 -3
- package/dist/ai-context/skills-command/references/configure-api-checks.md +1 -9
- package/dist/ai-context/skills-command/references/configure-browser-checks.md +1 -8
- package/dist/ai-context/skills-command/references/configure-check-groups.md +1 -0
- package/dist/ai-context/skills-command/references/configure-dns-monitors.md +1 -9
- package/dist/ai-context/skills-command/references/configure-grpc-monitors.md +24 -0
- package/dist/ai-context/skills-command/references/configure-heartbeat-monitors.md +1 -9
- package/dist/ai-context/skills-command/references/configure-icmp-monitors.md +1 -9
- package/dist/ai-context/skills-command/references/configure-multistep-checks.md +1 -9
- package/dist/ai-context/skills-command/references/configure-playwright-checks.md +1 -1
- package/dist/ai-context/skills-command/references/configure-supporting-constructs.md +6 -2
- package/dist/ai-context/skills-command/references/configure-tcp-monitors.md +1 -10
- package/dist/ai-context/skills-command/references/configure-url-monitors.md +1 -10
- package/dist/ai-context/skills-command/references/configure.md +16 -5
- package/dist/ai-context/skills-command/references/initialize.md +11 -3
- package/dist/ai-context/skills-command/references/investigate-checks.md +1 -1
- package/dist/auth/api-key.d.ts +24 -0
- package/dist/auth/api-key.js +104 -0
- package/dist/auth/api-key.js.map +1 -0
- package/dist/auth/device-flow.d.ts +57 -0
- package/dist/auth/device-flow.js +221 -0
- package/dist/auth/device-flow.js.map +1 -0
- package/dist/auth/index.d.ts +6 -6
- package/dist/auth/index.js +64 -64
- package/dist/auth/index.js.map +1 -1
- package/dist/commands/api.js +43 -10
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/authCommand.d.ts +2 -0
- package/dist/commands/authCommand.js +77 -7
- package/dist/commands/authCommand.js.map +1 -1
- package/dist/commands/debug/parse-project.d.ts +1 -0
- package/dist/commands/debug/parse-project.js +5 -2
- package/dist/commands/debug/parse-project.js.map +1 -1
- package/dist/commands/deploy.d.ts +7 -1
- package/dist/commands/deploy.js +627 -271
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/import/plan.js +18 -4
- package/dist/commands/import/plan.js.map +1 -1
- package/dist/commands/init.js +29 -13
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.d.ts +18 -2
- package/dist/commands/login.js +681 -48
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.js +7 -1
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/pw-test.js +3 -2
- package/dist/commands/pw-test.js.map +1 -1
- package/dist/commands/switch.js +23 -10
- package/dist/commands/switch.js.map +1 -1
- package/dist/commands/test.js +16 -17
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/trigger.js +4 -3
- package/dist/commands/trigger.js.map +1 -1
- package/dist/commands/validate.js +1 -0
- package/dist/commands/validate.js.map +1 -1
- package/dist/constants.d.ts +1 -2
- package/dist/constants.js +0 -1
- package/dist/constants.js.map +1 -1
- package/dist/constructs/alert-channel-codegen.d.ts +6 -1
- package/dist/constructs/alert-channel-codegen.js +12 -6
- package/dist/constructs/alert-channel-codegen.js.map +1 -1
- package/dist/constructs/alert-escalation-policy-codegen.d.ts +7 -0
- package/dist/constructs/alert-escalation-policy-codegen.js +25 -8
- package/dist/constructs/alert-escalation-policy-codegen.js.map +1 -1
- package/dist/constructs/api-assertion.d.ts +0 -2
- package/dist/constructs/api-assertion.js +0 -4
- package/dist/constructs/api-assertion.js.map +1 -1
- package/dist/constructs/api-check-codegen.js +1 -1
- package/dist/constructs/api-check-codegen.js.map +1 -1
- package/dist/constructs/api-check.d.ts +4 -22
- package/dist/constructs/api-check.js +15 -17
- package/dist/constructs/api-check.js.map +1 -1
- package/dist/constructs/api-request-codegen.js +10 -8
- package/dist/constructs/api-request-codegen.js.map +1 -1
- package/dist/constructs/browser-check-bundle.d.ts +19 -13
- package/dist/constructs/browser-check-bundle.js +5 -1
- package/dist/constructs/browser-check-bundle.js.map +1 -1
- package/dist/constructs/browser-check.d.ts +1 -4
- package/dist/constructs/browser-check.js +1 -1
- package/dist/constructs/browser-check.js.map +1 -1
- package/dist/constructs/check-codegen.d.ts +39 -14
- package/dist/constructs/check-codegen.js +101 -23
- package/dist/constructs/check-codegen.js.map +1 -1
- package/dist/constructs/check-group-codegen.js +23 -9
- package/dist/constructs/check-group-codegen.js.map +1 -1
- package/dist/constructs/check-group-v1.d.ts +19 -14
- package/dist/constructs/check-group-v1.js +39 -14
- package/dist/constructs/check-group-v1.js.map +1 -1
- package/dist/constructs/check-group-v2.d.ts +0 -20
- package/dist/constructs/check-group-v2.js +0 -4
- package/dist/constructs/check-group-v2.js.map +1 -1
- package/dist/constructs/check.d.ts +45 -32
- package/dist/constructs/check.js +78 -17
- package/dist/constructs/check.js.map +1 -1
- package/dist/constructs/construct-codegen.d.ts +1 -2
- package/dist/constructs/construct-diagnostics.d.ts +3 -0
- package/dist/constructs/construct-diagnostics.js +11 -0
- package/dist/constructs/construct-diagnostics.js.map +1 -1
- package/dist/constructs/construct.d.ts +25 -4
- package/dist/constructs/construct.js +41 -5
- package/dist/constructs/construct.js.map +1 -1
- package/dist/constructs/dns-request-codegen.js +1 -1
- package/dist/constructs/dns-request-codegen.js.map +1 -1
- package/dist/constructs/email-alert-channel-codegen.js +1 -1
- package/dist/constructs/email-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/frequency-codegen.js +10 -2
- package/dist/constructs/frequency-codegen.js.map +1 -1
- package/dist/constructs/frequency.d.ts +8 -3
- package/dist/constructs/frequency.js +7 -2
- package/dist/constructs/frequency.js.map +1 -1
- package/dist/constructs/grpc-monitor.js +19 -0
- package/dist/constructs/grpc-monitor.js.map +1 -1
- package/dist/constructs/grpc-request-codegen.js +13 -4
- package/dist/constructs/grpc-request-codegen.js.map +1 -1
- package/dist/constructs/grpc-request.d.ts +23 -0
- package/dist/constructs/heartbeat-monitor.d.ts +2 -1
- package/dist/constructs/heartbeat-monitor.js +2 -2
- package/dist/constructs/heartbeat-monitor.js.map +1 -1
- package/dist/constructs/icmp-request-codegen.js +1 -1
- package/dist/constructs/icmp-request-codegen.js.map +1 -1
- package/dist/constructs/incidentio-alert-channel-codegen.d.ts +1 -1
- package/dist/constructs/incidentio-alert-channel-codegen.js +14 -8
- package/dist/constructs/incidentio-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/index.d.ts +1 -1
- package/dist/constructs/index.js +1 -1
- package/dist/constructs/index.js.map +1 -1
- package/dist/constructs/internal/assertion-validation.js +1 -2
- package/dist/constructs/internal/assertion-validation.js.map +1 -1
- package/dist/constructs/internal/codegen/context.d.ts +73 -6
- package/dist/constructs/internal/codegen/context.js +78 -6
- package/dist/constructs/internal/codegen/context.js.map +1 -1
- package/dist/constructs/internal/codegen/index.d.ts +3 -1
- package/dist/constructs/internal/codegen/index.js +2 -1
- package/dist/constructs/internal/codegen/index.js.map +1 -1
- package/dist/constructs/internal/codegen/render.d.ts +68 -0
- package/dist/constructs/internal/codegen/render.js +75 -0
- package/dist/constructs/internal/codegen/render.js.map +1 -0
- package/dist/constructs/internal/common-diagnostics.d.ts +1 -2
- package/dist/constructs/internal/common-diagnostics.js +6 -14
- package/dist/constructs/internal/common-diagnostics.js.map +1 -1
- package/dist/constructs/internal/declaring-file.d.ts +39 -0
- package/dist/constructs/internal/declaring-file.js +139 -0
- package/dist/constructs/internal/declaring-file.js.map +1 -0
- package/dist/constructs/internal/retry-strategy-defaults.d.ts +13 -0
- package/dist/constructs/internal/retry-strategy-defaults.js +14 -0
- package/dist/constructs/internal/retry-strategy-defaults.js.map +1 -0
- package/dist/constructs/key-value-pair-codegen.d.ts +6 -1
- package/dist/constructs/key-value-pair-codegen.js +24 -3
- package/dist/constructs/key-value-pair-codegen.js.map +1 -1
- package/dist/constructs/maintenance-window-codegen.d.ts +7 -0
- package/dist/constructs/maintenance-window-codegen.js +36 -19
- package/dist/constructs/maintenance-window-codegen.js.map +1 -1
- package/dist/constructs/maintenance-window.d.ts +35 -3
- package/dist/constructs/maintenance-window.js +35 -1
- package/dist/constructs/maintenance-window.js.map +1 -1
- package/dist/constructs/monitor.d.ts +1 -1
- package/dist/constructs/msteams-alert-channel-codegen.d.ts +1 -1
- package/dist/constructs/msteams-alert-channel-codegen.js +8 -18
- package/dist/constructs/msteams-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/opsgenie-alert-channel-codegen.js +1 -1
- package/dist/constructs/opsgenie-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/pagerduty-alert-channel-codegen.js +1 -1
- package/dist/constructs/pagerduty-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/phone-call-alert-channel-codegen.js +1 -1
- package/dist/constructs/phone-call-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/playwright-check-bundle.d.ts +7 -1
- package/dist/constructs/playwright-check-bundle.js +3 -0
- package/dist/constructs/playwright-check-bundle.js.map +1 -1
- package/dist/constructs/playwright-check-codegen.d.ts +85 -0
- package/dist/constructs/playwright-check-codegen.js +212 -0
- package/dist/constructs/playwright-check-codegen.js.map +1 -0
- package/dist/constructs/playwright-check.d.ts +14 -24
- package/dist/constructs/playwright-check.js +16 -52
- package/dist/constructs/playwright-check.js.map +1 -1
- package/dist/constructs/retry-strategy-codegen.d.ts +7 -1
- package/dist/constructs/retry-strategy-codegen.js +41 -32
- package/dist/constructs/retry-strategy-codegen.js.map +1 -1
- package/dist/constructs/retry-strategy.d.ts +0 -4
- package/dist/constructs/retry-strategy.js +5 -8
- package/dist/constructs/retry-strategy.js.map +1 -1
- package/dist/constructs/session.d.ts +26 -1
- package/dist/constructs/session.js +33 -2
- package/dist/constructs/session.js.map +1 -1
- package/dist/constructs/slack-alert-channel-codegen.js +1 -1
- package/dist/constructs/slack-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/slack-app-alert-channel-codegen.js +1 -1
- package/dist/constructs/slack-app-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/sms-alert-channel-codegen.js +1 -1
- package/dist/constructs/sms-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/ssl-request-codegen.js +4 -3
- package/dist/constructs/ssl-request-codegen.js.map +1 -1
- package/dist/constructs/status-page-v3-automation-rule-codegen.js +5 -4
- package/dist/constructs/status-page-v3-automation-rule-codegen.js.map +1 -1
- package/dist/constructs/status-page-v3-codegen.js +3 -2
- package/dist/constructs/status-page-v3-codegen.js.map +1 -1
- package/dist/constructs/status-page-v3-component-codegen.js +8 -7
- package/dist/constructs/status-page-v3-component-codegen.js.map +1 -1
- package/dist/constructs/tcp-monitor-codegen.js +3 -2
- package/dist/constructs/tcp-monitor-codegen.js.map +1 -1
- package/dist/constructs/tcp-monitor.d.ts +4 -3
- package/dist/constructs/tcp-monitor.js +3 -2
- package/dist/constructs/tcp-monitor.js.map +1 -1
- package/dist/constructs/telegram-alert-channel-codegen.d.ts +1 -1
- package/dist/constructs/telegram-alert-channel-codegen.js +14 -8
- package/dist/constructs/telegram-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/time-zone.d.ts +24 -0
- package/dist/constructs/time-zone.js +455 -0
- package/dist/constructs/time-zone.js.map +1 -0
- package/dist/constructs/traceroute-request-codegen.js +2 -2
- package/dist/constructs/traceroute-request-codegen.js.map +1 -1
- package/dist/constructs/url-monitor-codegen.js +1 -1
- package/dist/constructs/url-monitor-codegen.js.map +1 -1
- package/dist/constructs/url-monitor.d.ts +3 -2
- package/dist/constructs/url-monitor.js +3 -0
- package/dist/constructs/url-monitor.js.map +1 -1
- package/dist/constructs/url-request-codegen.js +4 -3
- package/dist/constructs/url-request-codegen.js.map +1 -1
- package/dist/constructs/webhook-alert-channel-codegen.js +3 -3
- package/dist/constructs/webhook-alert-channel-codegen.js.map +1 -1
- package/dist/formatters/check-result-detail.js +0 -185
- package/dist/formatters/check-result-detail.js.map +1 -1
- package/dist/helpers/activate-account.d.ts +14 -0
- package/dist/helpers/activate-account.js +25 -0
- package/dist/helpers/activate-account.js.map +1 -0
- package/dist/helpers/cli-mode.d.ts +18 -0
- package/dist/helpers/cli-mode.js +41 -2
- package/dist/helpers/cli-mode.js.map +1 -1
- package/dist/helpers/command-preview.d.ts +44 -0
- package/dist/helpers/command-preview.js +29 -9
- package/dist/helpers/command-preview.js.map +1 -1
- package/dist/helpers/flags.d.ts +10 -0
- package/dist/helpers/flags.js +17 -0
- package/dist/helpers/flags.js.map +1 -1
- package/dist/helpers/onboarding/boilerplate.js +13 -1
- package/dist/helpers/onboarding/boilerplate.js.map +1 -1
- package/dist/helpers/onboarding/index.d.ts +1 -1
- package/dist/helpers/onboarding/index.js +1 -1
- package/dist/helpers/onboarding/index.js.map +1 -1
- package/dist/helpers/onboarding/messages.d.ts +6 -0
- package/dist/helpers/onboarding/messages.js +14 -0
- package/dist/helpers/onboarding/messages.js.map +1 -1
- package/dist/helpers/onboarding/skill-install.js +2 -2
- package/dist/helpers/onboarding/skill-install.js.map +1 -1
- package/dist/helpers/wrap.js +1 -1
- package/dist/helpers/wrap.js.map +1 -1
- package/dist/reporters/abstract-list.js +11 -2
- package/dist/reporters/abstract-list.js.map +1 -1
- package/dist/reporters/github.js +3 -2
- package/dist/reporters/github.js.map +1 -1
- package/dist/reporters/util.d.ts +1 -0
- package/dist/reporters/util.js +5 -58
- package/dist/reporters/util.js.map +1 -1
- package/dist/rest/analytics.js +0 -4
- package/dist/rest/analytics.js.map +1 -1
- package/dist/rest/api.d.ts +8 -1
- package/dist/rest/api.js +21 -3
- package/dist/rest/api.js.map +1 -1
- package/dist/rest/check-results.d.ts +1 -50
- package/dist/rest/check-results.js.map +1 -1
- package/dist/rest/checkly-storage.d.ts +6 -1
- package/dist/rest/checkly-storage.js +13 -2
- package/dist/rest/checkly-storage.js.map +1 -1
- package/dist/rest/errors.d.ts +13 -0
- package/dist/rest/errors.js +5 -1
- package/dist/rest/errors.js.map +1 -1
- package/dist/rest/projects.d.ts +254 -4
- package/dist/rest/projects.js +184 -12
- package/dist/rest/projects.js.map +1 -1
- package/dist/services/abstract-check-runner.d.ts +11 -0
- package/dist/services/abstract-check-runner.js +98 -46
- package/dist/services/abstract-check-runner.js.map +1 -1
- package/dist/services/check-parser/bundler.d.ts +26 -0
- package/dist/services/check-parser/bundler.js +81 -7
- package/dist/services/check-parser/bundler.js.map +1 -1
- package/dist/services/check-parser/cache-hash.d.ts +1 -4
- package/dist/services/check-parser/cache-hash.js.map +1 -1
- package/dist/services/checkly-config-codegen.js +1 -4
- package/dist/services/checkly-config-codegen.js.map +1 -1
- package/dist/services/checkly-config-loader.d.ts +7 -33
- package/dist/services/checkly-config-loader.js +50 -47
- package/dist/services/checkly-config-loader.js.map +1 -1
- package/dist/services/config.d.ts +2 -0
- package/dist/services/config.js +14 -0
- package/dist/services/config.js.map +1 -1
- package/dist/services/content-hash.d.ts +14 -0
- package/dist/services/content-hash.js +22 -0
- package/dist/services/content-hash.js.map +1 -0
- package/dist/services/deploy-diff/diff-lines.d.ts +38 -0
- package/dist/services/deploy-diff/diff-lines.js +191 -0
- package/dist/services/deploy-diff/diff-lines.js.map +1 -0
- package/dist/services/deploy-diff/import-shape.d.ts +171 -0
- package/dist/services/deploy-diff/import-shape.js +633 -0
- package/dist/services/deploy-diff/import-shape.js.map +1 -0
- package/dist/services/deploy-diff/legacy-payload.d.ts +22 -0
- package/dist/services/deploy-diff/legacy-payload.js +51 -0
- package/dist/services/deploy-diff/legacy-payload.js.map +1 -0
- package/dist/services/deploy-diff/plan-summary.d.ts +37 -0
- package/dist/services/deploy-diff/plan-summary.js +154 -0
- package/dist/services/deploy-diff/plan-summary.js.map +1 -0
- package/dist/services/deploy-diff/preview-output.d.ts +61 -0
- package/dist/services/deploy-diff/preview-output.js +394 -0
- package/dist/services/deploy-diff/preview-output.js.map +1 -0
- package/dist/services/deploy-diff/render.d.ts +53 -0
- package/dist/services/deploy-diff/render.js +317 -0
- package/dist/services/deploy-diff/render.js.map +1 -0
- package/dist/services/deploy-diff/shape-changes.d.ts +2 -0
- package/dist/services/deploy-diff/shape-changes.js +35 -0
- package/dist/services/deploy-diff/shape-changes.js.map +1 -0
- package/dist/services/deploy-diff/source-index.d.ts +18 -0
- package/dist/services/deploy-diff/source-index.js +48 -0
- package/dist/services/deploy-diff/source-index.js.map +1 -0
- package/dist/services/deploy-diff/variable-names.d.ts +30 -0
- package/dist/services/deploy-diff/variable-names.js +64 -0
- package/dist/services/deploy-diff/variable-names.js.map +1 -0
- package/dist/services/project-parser.d.ts +5 -0
- package/dist/services/project-parser.js +25 -13
- package/dist/services/project-parser.js.map +1 -1
- package/dist/services/snapshot-service.d.ts +25 -8
- package/dist/services/snapshot-service.js +46 -4
- package/dist/services/snapshot-service.js.map +1 -1
- package/dist/services/test-filters.d.ts +18 -0
- package/dist/services/test-filters.js +10 -0
- package/dist/services/test-filters.js.map +1 -1
- package/dist/services/test-runner.js +7 -3
- package/dist/services/test-runner.js.map +1 -1
- package/dist/services/test-session-cancel.js +1 -1
- package/dist/services/test-session-cancel.js.map +1 -1
- package/dist/services/util.d.ts +17 -2
- package/dist/services/util.js +118 -11
- package/dist/services/util.js.map +1 -1
- package/dist/services/write-back/apply-edits.d.ts +29 -0
- package/dist/services/write-back/apply-edits.js +255 -0
- package/dist/services/write-back/apply-edits.js.map +1 -0
- package/dist/services/write-back/helper-edit.d.ts +135 -0
- package/dist/services/write-back/helper-edit.js +343 -0
- package/dist/services/write-back/helper-edit.js.map +1 -0
- package/dist/services/write-back/imports.d.ts +30 -0
- package/dist/services/write-back/imports.js +82 -0
- package/dist/services/write-back/imports.js.map +1 -0
- package/dist/services/write-back/literal-edit.d.ts +183 -0
- package/dist/services/write-back/literal-edit.js +359 -0
- package/dist/services/write-back/literal-edit.js.map +1 -0
- package/dist/services/write-back/output.d.ts +26 -0
- package/dist/services/write-back/output.js +110 -0
- package/dist/services/write-back/output.js.map +1 -0
- package/dist/services/write-back/plan.d.ts +173 -0
- package/dist/services/write-back/plan.js +968 -0
- package/dist/services/write-back/plan.js.map +1 -0
- package/dist/services/write-back/source-file.d.ts +118 -0
- package/dist/services/write-back/source-file.js +432 -0
- package/dist/services/write-back/source-file.js.map +1 -0
- package/dist/sourcegen/index.d.ts +1 -1
- package/dist/sourcegen/index.js +1 -1
- package/dist/sourcegen/index.js.map +1 -1
- package/dist/sourcegen/program.d.ts +19 -1
- package/dist/sourcegen/program.js +32 -7
- package/dist/sourcegen/program.js.map +1 -1
- package/oclif.manifest.json +676 -635
- package/package.json +13 -13
- package/dist/commands/rules.d.ts +0 -9
- package/dist/commands/rules.js +0 -13
- package/dist/commands/rules.js.map +0 -1
- package/dist/constructs/agentic-check-codegen.d.ts +0 -22
- package/dist/constructs/agentic-check-codegen.js +0 -59
- package/dist/constructs/agentic-check-codegen.js.map +0 -1
- package/dist/constructs/agentic-check.d.ts +0 -237
- package/dist/constructs/agentic-check.js +0 -100
- package/dist/constructs/agentic-check.js.map +0 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { padColumn, visWidth } from '../../formatters/render.js';
|
|
4
|
+
import { diffLines } from '../deploy-diff/diff-lines.js';
|
|
5
|
+
import { pathToPosix } from '../util.js';
|
|
6
|
+
import { pointerSegments } from '../deploy-diff/import-shape.js';
|
|
7
|
+
import { MARKER, PRETTY_RESOURCE_TYPES, styled } from '../deploy-diff/preview-output.js';
|
|
8
|
+
const counted = (count, one, many) => `${count} ${count === 1 ? one : many}`;
|
|
9
|
+
const sameResource = (a, b) => a.type === b.type && a.logicalId === b.logicalId;
|
|
10
|
+
/** The header line of a resource: marker, class, logical id, and the file when it is known. */
|
|
11
|
+
function header(marker, { type, logicalId }, file, project) {
|
|
12
|
+
const construct = project.data[type]?.[logicalId];
|
|
13
|
+
const name = construct?.constructor.name ?? PRETTY_RESOURCE_TYPES[type] ?? type;
|
|
14
|
+
// With forward slashes on every platform, as the plan names the file.
|
|
15
|
+
return `${marker} ${chalk.bold(name)} ${chalk.bold(logicalId)}`
|
|
16
|
+
+ (file !== undefined ? ` ${chalk.dim(pathToPosix(file))}` : '');
|
|
17
|
+
}
|
|
18
|
+
/** A property's old and new source on one line, for a construct whose source cannot be shown as a diff. */
|
|
19
|
+
function propertyLine({ property, previous, rendered }) {
|
|
20
|
+
const oneLine = (text) => text.replace(/\s*\r?\n\s*/g, ' ');
|
|
21
|
+
return ` ${property}: ${previous === undefined ? 'not set' : oneLine(previous)} → ${oneLine(rendered)}`;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The block for the code that was updated: per construct, the diff of its
|
|
25
|
+
* source, then what a diff cannot say (a property that replaced an edit the
|
|
26
|
+
* code had made too, a helper the file now imports).
|
|
27
|
+
*/
|
|
28
|
+
export function formatWriteBackUpdated({ writeBack, project }) {
|
|
29
|
+
const { applied, constructs, files, imports } = writeBack;
|
|
30
|
+
const output = [
|
|
31
|
+
`${chalk.bold('Updated your code')} ${chalk.dim('·')} `
|
|
32
|
+
+ `${counted(applied.length, 'property', 'properties')} in ${counted(files.length, 'file', 'files')}`,
|
|
33
|
+
'',
|
|
34
|
+
];
|
|
35
|
+
constructs.forEach((construct, index) => {
|
|
36
|
+
const lines = applied.filter(line => line.file === construct.file && sameResource(line, construct));
|
|
37
|
+
output.push(header(MARKER.update, construct, construct.file, project));
|
|
38
|
+
const diff = diffLines(construct.before, construct.after);
|
|
39
|
+
if (diff === undefined || diff.length === 0) {
|
|
40
|
+
// Too long to diff, which a construct's own source never is in
|
|
41
|
+
// practice: the properties are listed with their values instead.
|
|
42
|
+
output.push(...lines.map(propertyLine));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
// A diff opens with a hunk boundary, which is shown as the gap between
|
|
46
|
+
// two hunks, so the first one is left out.
|
|
47
|
+
output.push(...diff.slice(1).map(line => ` ${styled(line)}`.trimEnd()));
|
|
48
|
+
}
|
|
49
|
+
for (const line of lines.filter(line => line.replacesLocalEdit)) {
|
|
50
|
+
output.push(` ${styled({ kind: 'note', text: `${line.property}: replaced a local edit` })}`);
|
|
51
|
+
}
|
|
52
|
+
// The import belongs to the file, so it is said once, under the last
|
|
53
|
+
// construct of that file.
|
|
54
|
+
const lastOfFile = !constructs.slice(index + 1).some(other => other.file === construct.file);
|
|
55
|
+
const imported = imports.find(entry => entry.file === construct.file);
|
|
56
|
+
if (lastOfFile && imported !== undefined) {
|
|
57
|
+
output.push(` ${styled({ kind: 'note', text: `imported ${imported.names.join(', ')} from 'checkly/constructs'` })}`);
|
|
58
|
+
}
|
|
59
|
+
output.push('');
|
|
60
|
+
});
|
|
61
|
+
return output.join('\n');
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A skipped property as the reader's code names it. A change refused before
|
|
65
|
+
* it was matched to a construct property is known by the path Checkly reports
|
|
66
|
+
* (`/runParallel`), which is shown dotted like the others.
|
|
67
|
+
*/
|
|
68
|
+
function propertyName(property) {
|
|
69
|
+
if (!property.startsWith('/')) {
|
|
70
|
+
return property;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
return pointerSegments(property).join('.');
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return property;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The block for what was not written: per resource, each property with the
|
|
81
|
+
* reason, or the reason alone when it is about the whole resource.
|
|
82
|
+
*/
|
|
83
|
+
export function formatWriteBackSkipped({ writeBack, project, cwd }) {
|
|
84
|
+
const groups = [];
|
|
85
|
+
for (const skip of writeBack.skipped) {
|
|
86
|
+
const group = groups.find(candidate => sameResource(candidate.resource, skip));
|
|
87
|
+
if (group === undefined) {
|
|
88
|
+
groups.push({ resource: skip, skips: [skip] });
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
group.skips.push(skip);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const output = [`${chalk.bold('Not updated')} ${chalk.dim('·')} edit these by hand`, ''];
|
|
95
|
+
for (const { resource, skips } of groups) {
|
|
96
|
+
const declaredIn = project.data[resource.type]?.[resource.logicalId]?.checkFileAbsolutePath;
|
|
97
|
+
const file = declaredIn === undefined ? undefined : path.relative(cwd, declaredIn);
|
|
98
|
+
output.push(header(MARKER.warn, resource, file, project));
|
|
99
|
+
const rows = skips.map(({ property, reason }) => ({ property: property === undefined ? undefined : propertyName(property), reason }));
|
|
100
|
+
const width = Math.max(0, ...rows.map(row => visWidth(row.property ?? '')));
|
|
101
|
+
for (const { property, reason } of rows) {
|
|
102
|
+
output.push(property === undefined
|
|
103
|
+
? ` ${reason}`
|
|
104
|
+
: ` ${padColumn(property, width)} ${chalk.dim(reason)}`);
|
|
105
|
+
}
|
|
106
|
+
output.push('');
|
|
107
|
+
}
|
|
108
|
+
return output.join('\n');
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../../src/services/write-back/output.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAkBxF,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,IAAY,EAAU,EAAE,CAAC,GAAG,KAAK,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;AAE5G,MAAM,YAAY,GAAG,CAAC,CA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OAAO,CAAC,CAAC,CAAA;QACzD,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,CAC9C,CAAC,EAAE,QAAQ,EAAE,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;QACtF,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;QAC3E,KAAK,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;YACxC,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS;gBAChC,CAAC,CAAC,OAAO,MAAM,EAAE;gBACjB,CAAC,CAAC,OAAO,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QAChE,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACjB,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC1B,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { Construct } from '../../constructs/construct.js';
|
|
2
|
+
import type { Project } from '../../constructs/project.js';
|
|
3
|
+
import type { DiffEntry } from '../../rest/projects.js';
|
|
4
|
+
import type { AssertionBuilderName } from './helper-edit.js';
|
|
5
|
+
/**
|
|
6
|
+
* Turns the remote changes of a deploy plan into edits of the construct
|
|
7
|
+
* source files, and applies them: checks, groups, alert channels, private
|
|
8
|
+
* locations, dashboards, maintenance windows and status pages with their
|
|
9
|
+
* services, components and automation rules.
|
|
10
|
+
*
|
|
11
|
+
* A remote change is a property that moved in the Checkly account since the
|
|
12
|
+
* last deploy (`origin: 'remote'`, or `'both'` when the code moved too). The
|
|
13
|
+
* value written is the account's current one, read from the entry's `before`
|
|
14
|
+
* — the deployed resource in the import format, which a full-detail preview
|
|
15
|
+
* carries — at the path the change names. The change list decides *which*
|
|
16
|
+
* paths are written; `before` supplies the values, because a change can
|
|
17
|
+
* carry a hash where `before` carries the text, and a set element change
|
|
18
|
+
* names one element where the code holds the whole list.
|
|
19
|
+
*
|
|
20
|
+
* Only what can be written without guessing is written. A property has to
|
|
21
|
+
* be one this module knows the construct's spelling of (the table below): a
|
|
22
|
+
* literal of the same shape, or a helper expression — `Frequency.EVERY_*`,
|
|
23
|
+
* `RetryStrategyBuilder`, `AlertEscalationBuilder`, an assertion builder —
|
|
24
|
+
* that `helper-edit.ts` renders from the value the way `checkly import`
|
|
25
|
+
* would; a value Checkly withholds — a credential the redaction table
|
|
26
|
+
* blanks, a masked secret, a hash — is never written; and when the change's
|
|
27
|
+
* own report of the current value disagrees with `before`, neither is
|
|
28
|
+
* trusted. Everything refused is listed with its reason.
|
|
29
|
+
*/
|
|
30
|
+
export interface WriteBackOptions {
|
|
31
|
+
diff: readonly DiffEntry[];
|
|
32
|
+
project: Project;
|
|
33
|
+
/** The directory file names are shown relative to. */
|
|
34
|
+
cwd: string;
|
|
35
|
+
}
|
|
36
|
+
export interface WriteBackLine {
|
|
37
|
+
/** The edited file, relative to `cwd`. */
|
|
38
|
+
file: string;
|
|
39
|
+
type: string;
|
|
40
|
+
logicalId: string;
|
|
41
|
+
/** The construct property, dotted. */
|
|
42
|
+
property: string;
|
|
43
|
+
/** The source text replaced, or undefined when the property was added. */
|
|
44
|
+
previous?: string;
|
|
45
|
+
/** The source text written. */
|
|
46
|
+
rendered: string;
|
|
47
|
+
/** Whether the code had moved too (`origin: 'both'`), so a local edit is being replaced. */
|
|
48
|
+
replacesLocalEdit: boolean;
|
|
49
|
+
}
|
|
50
|
+
/** A remote change that was not written, or a resource none could be written for. */
|
|
51
|
+
export interface WriteBackSkip {
|
|
52
|
+
type: string;
|
|
53
|
+
logicalId: string;
|
|
54
|
+
/** The property or path the reason is about; none when it is about the whole resource. */
|
|
55
|
+
property?: string;
|
|
56
|
+
reason: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The source of one edited construct, from the line its options open on to
|
|
60
|
+
* the line they close on, before its edits and after them: what a reader
|
|
61
|
+
* needs to see the edits in place.
|
|
62
|
+
*/
|
|
63
|
+
export interface WriteBackConstruct {
|
|
64
|
+
/** The edited file, relative to `cwd`. */
|
|
65
|
+
file: string;
|
|
66
|
+
type: string;
|
|
67
|
+
logicalId: string;
|
|
68
|
+
before: string;
|
|
69
|
+
after: string;
|
|
70
|
+
}
|
|
71
|
+
export interface WriteBackPlan {
|
|
72
|
+
/** Each file's new text, with the text it was planned from. */
|
|
73
|
+
files: {
|
|
74
|
+
path: string;
|
|
75
|
+
text: string;
|
|
76
|
+
original: string;
|
|
77
|
+
}[];
|
|
78
|
+
applied: WriteBackLine[];
|
|
79
|
+
/** One entry per construct `applied` has lines for, in the order they were edited. */
|
|
80
|
+
constructs: WriteBackConstruct[];
|
|
81
|
+
skipped: WriteBackSkip[];
|
|
82
|
+
/** The helper classes added to each edited file's `checkly/constructs` import. */
|
|
83
|
+
imports: {
|
|
84
|
+
file: string;
|
|
85
|
+
names: string[];
|
|
86
|
+
}[];
|
|
87
|
+
}
|
|
88
|
+
/** How an import-format path maps onto a construct property. */
|
|
89
|
+
export interface Rule {
|
|
90
|
+
/** Segments of the import-format pointer. */
|
|
91
|
+
pointer: string[];
|
|
92
|
+
/** The construct property path the pointer maps to. */
|
|
93
|
+
target: string[];
|
|
94
|
+
/** A list the API reports per element rather than whole; the code holds the whole list. */
|
|
95
|
+
set?: boolean;
|
|
96
|
+
/** Properties that only mean something together are written together or not at all. */
|
|
97
|
+
group?: string;
|
|
98
|
+
/** The helper the construct spells the property with; the value is written as its expression. */
|
|
99
|
+
helper?: {
|
|
100
|
+
kind: 'frequency' | 'retryStrategy' | 'date';
|
|
101
|
+
} | {
|
|
102
|
+
kind: 'alertEscalation';
|
|
103
|
+
policy: AlertPolicyHolder;
|
|
104
|
+
} | {
|
|
105
|
+
kind: 'assertions';
|
|
106
|
+
builder: AssertionBuilderName;
|
|
107
|
+
};
|
|
108
|
+
/** Further pointers whose `before` values the expression needs (`frequencyOffset` beside `frequency`). */
|
|
109
|
+
reads?: string[][];
|
|
110
|
+
/** Sibling keys of the property that make the edit wrong (`doubleCheck` beside `retryStrategy`). */
|
|
111
|
+
unless?: string[];
|
|
112
|
+
/**
|
|
113
|
+
* A rule that routes the changes at its pointer onto another rule's
|
|
114
|
+
* target (the one whose `target` it shares) rather than anchoring a
|
|
115
|
+
* candidate of its own: `/frequencyOffset` belongs to `frequency`,
|
|
116
|
+
* `/useGlobalAlertSettings` to `alertEscalationPolicy`, and a code-origin
|
|
117
|
+
* `/doubleCheck` marks `retryStrategy` as locally changed.
|
|
118
|
+
*/
|
|
119
|
+
companion?: true;
|
|
120
|
+
/** For a companion, the reason its changes are refused given the deployed resource, if they are. */
|
|
121
|
+
refuse?: (before: unknown) => string | undefined;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Who holds the alert policy: a check or a v1 group spells "the global
|
|
125
|
+
* policy" by having none, which nothing is ever removed from the code for;
|
|
126
|
+
* a v2 group has the word `'global'` for it, and a group of either version
|
|
127
|
+
* can also have no policy of its own while its checks keep theirs.
|
|
128
|
+
*/
|
|
129
|
+
type AlertPolicyHolder = 'check' | 'group' | 'group-v2';
|
|
130
|
+
/**
|
|
131
|
+
* The properties this module writes, per construct class: the ones whose
|
|
132
|
+
* import-format spelling and construct spelling are both literals with the
|
|
133
|
+
* same shape, and the ones the construct spells with a helper this module
|
|
134
|
+
* can render (`frequency`, `retryStrategy`, `alertEscalationPolicy`, the
|
|
135
|
+
* `assertions` of a request), and the SSL request whose wire keys map onto
|
|
136
|
+
* the construct's (`SSL_REQUEST_RULES`). A rule may likewise map a wire
|
|
137
|
+
* pointer onto a prop spelled or nested differently in the construct (an
|
|
138
|
+
* alert channel's `config/<key>` onto its flat prop, a component's
|
|
139
|
+
* `configuration/<key>`, `coolDownWindowMinutes` onto `coolDownMinutes`),
|
|
140
|
+
* and a `refusing` rule names the reason for a leaf the construct fixes or
|
|
141
|
+
* derives. Anything else — references, scripts, a request key the
|
|
142
|
+
* construct does not take — is left to the user.
|
|
143
|
+
*
|
|
144
|
+
* Keyed by the exact class, not by `instanceof`: a class this table does not
|
|
145
|
+
* name gets nothing rather than a base class's rules, so a construct that
|
|
146
|
+
* omits one of them (`PlaywrightCheck` takes no `retryStrategy`, as its
|
|
147
|
+
* codegen's omitted props say) can never be handed it. The spec checks that every
|
|
148
|
+
* construct class `checkly/constructs` exports is listed here or excluded
|
|
149
|
+
* on purpose, and that the omitted props are absent.
|
|
150
|
+
*/
|
|
151
|
+
/** A construct class, as a map key. */
|
|
152
|
+
export type ConstructClass = abstract new (...args: any[]) => Construct;
|
|
153
|
+
export declare const RULES_BY_CLASS: ReadonlyMap<ConstructClass, readonly Rule[]>;
|
|
154
|
+
/** The top-level props keys each class's rules write, as the build-time assertion above knows them; the spec holds `RULES_BY_CLASS` to it. */
|
|
155
|
+
export declare const WRITTEN_BY_CLASS: ReadonlyMap<ConstructClass, readonly string[]>;
|
|
156
|
+
/**
|
|
157
|
+
* Whether the plan holds at least one change the planner would try to
|
|
158
|
+
* write: a remote change on a construct of a known class, at a path the
|
|
159
|
+
* class's table covers. Cheap enough to decide whether to offer the
|
|
160
|
+
* write-back at all, without reading any file.
|
|
161
|
+
*/
|
|
162
|
+
export declare function hasWritableChanges(diff: readonly DiffEntry[], project: Project): boolean;
|
|
163
|
+
export declare function planWriteBack({ diff, project, cwd }: WriteBackOptions): Promise<WriteBackPlan>;
|
|
164
|
+
/**
|
|
165
|
+
* Writes every planned file through a temporary file in the same directory,
|
|
166
|
+
* flushed to disk and then renamed over the target, so an interrupted write
|
|
167
|
+
* leaves the old file or the new one rather than a torn one. The target is
|
|
168
|
+
* the file itself, not a symlink to it, and it keeps its mode.
|
|
169
|
+
*
|
|
170
|
+
* @throws Error naming the files already rewritten when a later one fails.
|
|
171
|
+
*/
|
|
172
|
+
export declare function applyWriteBack(plan: Pick<WriteBackPlan, 'files'>): Promise<void>;
|
|
173
|
+
export {};
|