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,394 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { AlertChannel, AlertChannelSubscription, Check, CheckGroup, Dashboard, MaintenanceWindow, PrivateLocation, PrivateLocationCheckAssignment, PrivateLocationGroupAssignment, StatusPage, StatusPageService, StatusPageV3AutomationRule, StatusPageV3Component, } from '../../constructs/index.js';
|
|
3
|
+
import { padColumn, visWidth } from '../../formatters/render.js';
|
|
4
|
+
import { physicalIdsFromPlan } from './import-shape.js';
|
|
5
|
+
import { isPrunedRelation, onlyUnmanagedChanges, planHasNoChanges } from './plan-summary.js';
|
|
6
|
+
import { renderResourceDiff } from './render.js';
|
|
7
|
+
import { SourceIndex } from './source-index.js';
|
|
8
|
+
import { constructVariableNames } from './variable-names.js';
|
|
9
|
+
/**
|
|
10
|
+
* The text `checkly deploy` prints for a plan: what `--preview` shows, what
|
|
11
|
+
* `--output` prints after a deploy, and what a deploy refused for a stale plan
|
|
12
|
+
* prints in its place. Shaped like a plan: an overview of every touched
|
|
13
|
+
* resource with a marker per action, the construct diff of each updated
|
|
14
|
+
* resource, and the totals. The markers carry the meaning; colour is for a
|
|
15
|
+
* terminal and chalk drops it for a pipe or under `NO_COLOR`.
|
|
16
|
+
*/
|
|
17
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
18
|
+
export var ResourceDeployStatus;
|
|
19
|
+
(function (ResourceDeployStatus) {
|
|
20
|
+
ResourceDeployStatus["UPDATE"] = "UPDATE";
|
|
21
|
+
ResourceDeployStatus["CREATE"] = "CREATE";
|
|
22
|
+
ResourceDeployStatus["DELETE"] = "DELETE";
|
|
23
|
+
// Reported for a resource removed from code that is kept in the account
|
|
24
|
+
// (managed from the Checkly web app from then on) instead of deleted.
|
|
25
|
+
ResourceDeployStatus["DETACH"] = "DETACH";
|
|
26
|
+
// What the same case was called before the deploy diff landed. Still
|
|
27
|
+
// accepted so a newer CLI keeps rendering an older API's answer.
|
|
28
|
+
ResourceDeployStatus["DETACHED"] = "DETACHED";
|
|
29
|
+
// A resource the deploy leaves alone because code and account agree.
|
|
30
|
+
ResourceDeployStatus["UNCHANGED"] = "UNCHANGED";
|
|
31
|
+
})(ResourceDeployStatus || (ResourceDeployStatus = {}));
|
|
32
|
+
/** How a resource type reads when there is no construct to name it by (a deleted resource, a relation). */
|
|
33
|
+
export const PRETTY_RESOURCE_TYPES = {
|
|
34
|
+
[Check.__checklyType]: 'Check',
|
|
35
|
+
[AlertChannel.__checklyType]: 'AlertChannel',
|
|
36
|
+
[CheckGroup.__checklyType]: 'CheckGroup',
|
|
37
|
+
[MaintenanceWindow.__checklyType]: 'MaintenanceWindow',
|
|
38
|
+
[PrivateLocation.__checklyType]: 'PrivateLocation',
|
|
39
|
+
[Dashboard.__checklyType]: 'Dashboard',
|
|
40
|
+
[StatusPage.__checklyType]: 'StatusPage',
|
|
41
|
+
[StatusPageService.__checklyType]: 'StatusPageService',
|
|
42
|
+
[StatusPageV3Component.__checklyType]: 'StatusPageV3Component',
|
|
43
|
+
[StatusPageV3AutomationRule.__checklyType]: 'StatusPageV3AutomationRule',
|
|
44
|
+
};
|
|
45
|
+
// Internal resources that users don't create directly. They are reported as
|
|
46
|
+
// part of their owning check, so we exclude them from delete previews/guards.
|
|
47
|
+
export const NON_REPORTED_TYPES = [
|
|
48
|
+
AlertChannelSubscription.__checklyType,
|
|
49
|
+
PrivateLocationCheckAssignment.__checklyType,
|
|
50
|
+
PrivateLocationGroupAssignment.__checklyType,
|
|
51
|
+
];
|
|
52
|
+
const compareEntries = (a, b) => a.resourceType.localeCompare(b.resourceType) || a.logicalId.localeCompare(b.logicalId);
|
|
53
|
+
const GAP = chalk.dim('⋯');
|
|
54
|
+
export const MARKER = {
|
|
55
|
+
create: chalk.green('+'),
|
|
56
|
+
update: chalk.yellow('~'),
|
|
57
|
+
delete: chalk.red('-'),
|
|
58
|
+
detach: chalk.yellow('-'),
|
|
59
|
+
prune: chalk.red('-'),
|
|
60
|
+
warn: chalk.yellow('!'),
|
|
61
|
+
skip: chalk.dim('·'),
|
|
62
|
+
};
|
|
63
|
+
export function formatPreview(input) {
|
|
64
|
+
const { heading, diff, done = false, project, verbose = false, pruneRelations = false, rendering, planToken } = input;
|
|
65
|
+
const updating = [];
|
|
66
|
+
const creating = [];
|
|
67
|
+
const deleting = [];
|
|
68
|
+
const detaching = [];
|
|
69
|
+
const pruning = [];
|
|
70
|
+
const unmanaged = [];
|
|
71
|
+
let unchanged = 0;
|
|
72
|
+
// Updates Checkly compared with what is deployed, for want of an earlier
|
|
73
|
+
// planned deploy; the note under the overview counts them.
|
|
74
|
+
let baseline = 0;
|
|
75
|
+
for (const change of diff) {
|
|
76
|
+
const { type, logicalId, physicalId, action, changes } = change;
|
|
77
|
+
if (NON_REPORTED_TYPES.some(t => t === type)) {
|
|
78
|
+
// A relation the project manages is reported as part of the check or
|
|
79
|
+
// group it belongs to, since users do not declare these directly. One
|
|
80
|
+
// the project does NOT manage is only ever reported when --prune-relations
|
|
81
|
+
// would delete it, and that is worth its own line.
|
|
82
|
+
if (isPrunedRelation(change)) {
|
|
83
|
+
// The relation's own id says nothing to the user; the check or group
|
|
84
|
+
// it hangs off is what tells them what the prune touches.
|
|
85
|
+
const owner = change.foldedInto;
|
|
86
|
+
pruning.push({
|
|
87
|
+
resourceType: type,
|
|
88
|
+
logicalId,
|
|
89
|
+
owner: owner ? `${PRETTY_RESOURCE_TYPES[owner.type] ?? owner.type} ${owner.logicalId}` : undefined,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (change.basis === 'live') {
|
|
95
|
+
baseline++;
|
|
96
|
+
}
|
|
97
|
+
// Relations the project does not manage are reported on their owning
|
|
98
|
+
// check or group whether or not they would be deleted. Without
|
|
99
|
+
// --prune-relations the deploy leaves them — and the resource — alone, so
|
|
100
|
+
// listing it as an update would name a write that never happens.
|
|
101
|
+
// Never an update: what the deploy deletes is the relation, not the
|
|
102
|
+
// check or group it hangs off. With --prune-relations the relation's own
|
|
103
|
+
// entry is already listed as pruned, so the resource needs no line of
|
|
104
|
+
// its own — and advising the flag the user just passed would be absurd.
|
|
105
|
+
// A resource written to set the baseline is the exception: that write
|
|
106
|
+
// happens whatever was found, so it keeps its row next to the warning.
|
|
107
|
+
if (onlyUnmanagedChanges(change)) {
|
|
108
|
+
if (!pruneRelations) {
|
|
109
|
+
unmanaged.push({ resourceType: type, logicalId });
|
|
110
|
+
}
|
|
111
|
+
if (change.basis !== 'live') {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// A type this CLI version does not know (a newer CLI deployed it) has no
|
|
116
|
+
// slot in the project. Such an entry has no construct, and a created or
|
|
117
|
+
// updated one is dropped from the overview below rather than crashing it.
|
|
118
|
+
const construct = project.data[type]?.[logicalId];
|
|
119
|
+
if (action === ResourceDeployStatus.UPDATE) {
|
|
120
|
+
updating.push({ resourceType: type, logicalId, physicalId, construct });
|
|
121
|
+
}
|
|
122
|
+
else if (action === ResourceDeployStatus.UNCHANGED) {
|
|
123
|
+
// A resource whose own properties agree with the account can still have
|
|
124
|
+
// changed alert channels or private locations, which are reported on it
|
|
125
|
+
// rather than as resources of their own; only an entry with nothing at
|
|
126
|
+
// all to report counts as unchanged.
|
|
127
|
+
if ((changes?.length ?? 0) > 0) {
|
|
128
|
+
updating.push({ resourceType: type, logicalId, physicalId, construct });
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
unchanged++;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else if (action === ResourceDeployStatus.CREATE) {
|
|
135
|
+
creating.push({ resourceType: type, logicalId, physicalId, construct });
|
|
136
|
+
}
|
|
137
|
+
else if (action === ResourceDeployStatus.DELETE) {
|
|
138
|
+
// Since the resource is being deleted, the construct isn't in the project.
|
|
139
|
+
deleting.push({ resourceType: type, logicalId });
|
|
140
|
+
}
|
|
141
|
+
else if (action === ResourceDeployStatus.DETACH
|
|
142
|
+
|| action === ResourceDeployStatus.DETACHED) {
|
|
143
|
+
// Removed from code but kept in the account, so the construct is not in
|
|
144
|
+
// the project any more.
|
|
145
|
+
detaching.push({ resourceType: type, logicalId });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// testOnly checks weren't sent to the BE and won't be in the plan.
|
|
149
|
+
// We load them from the `project` instead.
|
|
150
|
+
const skipping = project
|
|
151
|
+
.getTestOnlyConstructs().map(construct => ({
|
|
152
|
+
logicalId: construct.logicalId,
|
|
153
|
+
resourceType: construct.type,
|
|
154
|
+
construct,
|
|
155
|
+
}))
|
|
156
|
+
// A check that already exists in Checkly and just gained `testOnly: true`
|
|
157
|
+
// is both deleted and skipped; it is shown once, as deleted.
|
|
158
|
+
.filter(skip => !deleting.find(deletion => deletion.logicalId === skip.logicalId && deletion.resourceType === skip.resourceType));
|
|
159
|
+
// Resources without constructs are created dynamically on the fly (a
|
|
160
|
+
// non-member private location) and have nothing to show.
|
|
161
|
+
const sortedCreating = creating.filter(({ construct }) => Boolean(construct)).sort(compareEntries);
|
|
162
|
+
const sortedUpdating = updating.filter(({ construct }) => Boolean(construct)).sort(compareEntries);
|
|
163
|
+
const sortedDeleting = deleting.sort(compareEntries);
|
|
164
|
+
const sortedDetaching = detaching.sort(compareEntries);
|
|
165
|
+
const sortedPruning = pruning.sort(compareEntries);
|
|
166
|
+
const sortedUnmanaged = unmanaged.sort(compareEntries);
|
|
167
|
+
if (!sortedCreating.length && !sortedDeleting.length && !sortedDetaching.length
|
|
168
|
+
&& !sortedUpdating.length && !sortedPruning.length && !sortedUnmanaged.length
|
|
169
|
+
&& !unchanged && !skipping.length) {
|
|
170
|
+
return '\nNo checks were detected. More information on how to set up a Checkly CLI project is available at https://checklyhq.com/docs/cli/.\n';
|
|
171
|
+
}
|
|
172
|
+
const sourceFileOf = ({ resourceType, logicalId }) => {
|
|
173
|
+
const local = rendering?.local.find(resource => resource.type === resourceType && resource.logicalId === logicalId);
|
|
174
|
+
const planned = diff.find(entry => entry.type === resourceType && entry.logicalId === logicalId);
|
|
175
|
+
return local?.sourceFile ?? planned?.sourceFile ?? undefined;
|
|
176
|
+
};
|
|
177
|
+
const subLines = ({ physicalId, construct }) => {
|
|
178
|
+
if (!verbose) {
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
181
|
+
const lines = [];
|
|
182
|
+
if (construct?.name) {
|
|
183
|
+
lines.push(chalk.dim(`name: ${construct.name}`));
|
|
184
|
+
}
|
|
185
|
+
if (physicalId) {
|
|
186
|
+
lines.push(chalk.dim(`id: ${physicalId}`));
|
|
187
|
+
}
|
|
188
|
+
return lines;
|
|
189
|
+
};
|
|
190
|
+
const withConstruct = (marker, listed) => ({
|
|
191
|
+
marker,
|
|
192
|
+
type: listed.construct.constructor.name,
|
|
193
|
+
logicalId: listed.logicalId,
|
|
194
|
+
detail: chalk.dim(sourceFileOf(listed) ?? ''),
|
|
195
|
+
sub: subLines(listed),
|
|
196
|
+
});
|
|
197
|
+
const withNote = (marker, listed, note) => ({
|
|
198
|
+
marker,
|
|
199
|
+
type: PRETTY_RESOURCE_TYPES[listed.resourceType] ?? listed.resourceType,
|
|
200
|
+
logicalId: listed.logicalId,
|
|
201
|
+
detail: note,
|
|
202
|
+
sub: [],
|
|
203
|
+
});
|
|
204
|
+
const rows = [
|
|
205
|
+
...sortedCreating.map(listed => withConstruct(MARKER.create, listed)),
|
|
206
|
+
...sortedUpdating.map(listed => withConstruct(MARKER.update, listed)),
|
|
207
|
+
...sortedDeleting.map(listed => withNote(MARKER.delete, listed, chalk.red('permanently deleted, run history lost'))),
|
|
208
|
+
...sortedDetaching.map(listed => withNote(MARKER.detach, listed, chalk.yellow('kept in your Checkly account, now managed from the Checkly web app'))),
|
|
209
|
+
...sortedPruning.map(listed => withNote(MARKER.prune, listed, chalk.red(`relation${listed.owner ? ` on ${listed.owner}` : ''} not managed by this project, `
|
|
210
|
+
+ 'deleted by --prune-relations'))),
|
|
211
|
+
...sortedUnmanaged.map(listed => withNote(MARKER.warn, listed, chalk.yellow('has alert channels or private locations this project does not manage (pass --prune-relations to delete them)'))),
|
|
212
|
+
...skipping.sort(compareEntries).map(listed => ({
|
|
213
|
+
...withConstruct(MARKER.skip, listed),
|
|
214
|
+
detail: chalk.dim('skipped (testOnly)'),
|
|
215
|
+
})),
|
|
216
|
+
];
|
|
217
|
+
// A plan that gives the deploy nothing to write is said in one sentence
|
|
218
|
+
// rather than as an overview of nothing. The rows that inform without
|
|
219
|
+
// announcing a write (relations the project does not manage, testOnly
|
|
220
|
+
// checks) are still listed above it. Decided by the rule that decides
|
|
221
|
+
// whether the deploy asks for confirmation, so the two cannot disagree.
|
|
222
|
+
const nothingToApply = !done
|
|
223
|
+
&& planHasNoChanges(diff, { prettyTypes: PRETTY_RESOURCE_TYPES, foldedTypes: NON_REPORTED_TYPES });
|
|
224
|
+
const output = [];
|
|
225
|
+
if (heading !== undefined && (!nothingToApply || rows.length > 0)) {
|
|
226
|
+
const { title, projectName, accountName } = heading;
|
|
227
|
+
const account = accountName !== undefined ? ` ${chalk.dim('→')} account ${chalk.bold(accountName)}` : '';
|
|
228
|
+
output.push(`${chalk.bold(title)} ${chalk.dim('·')} ${projectName}${account}`);
|
|
229
|
+
output.push('');
|
|
230
|
+
}
|
|
231
|
+
const typeWidth = Math.max(0, ...rows.map(row => visWidth(row.type)));
|
|
232
|
+
const idWidth = Math.max(0, ...rows.map(row => visWidth(row.logicalId)));
|
|
233
|
+
for (const row of rows) {
|
|
234
|
+
const type = padColumn(row.type, typeWidth);
|
|
235
|
+
const logicalId = padColumn(chalk.bold(row.logicalId), idWidth);
|
|
236
|
+
output.push(` ${row.marker} ${type} ${logicalId} ${row.detail}`.trimEnd());
|
|
237
|
+
for (const line of row.sub) {
|
|
238
|
+
output.push(` ${line}`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (nothingToApply) {
|
|
242
|
+
if (rows.length > 0) {
|
|
243
|
+
output.push('');
|
|
244
|
+
}
|
|
245
|
+
// A resource with relations the project does not manage matches the code
|
|
246
|
+
// in everything the project does manage.
|
|
247
|
+
const matching = unchanged + sortedUnmanaged.length;
|
|
248
|
+
const where = heading?.accountName !== undefined ? ` in account "${heading.accountName}"` : '';
|
|
249
|
+
const matches = matching === 1
|
|
250
|
+
? ` The 1 resource${where} matches your code.`
|
|
251
|
+
: matching > 1 ? ` All ${matching} resources${where} match your code.` : '';
|
|
252
|
+
output.push(`${chalk.bold('No changes.')}${matches}`);
|
|
253
|
+
// No totals and no plan token: there is no plan to pin.
|
|
254
|
+
output.push('');
|
|
255
|
+
return output.join('\n');
|
|
256
|
+
}
|
|
257
|
+
if (unchanged) {
|
|
258
|
+
output.push(` ${chalk.dim(`${unchanged} unchanged`)}`);
|
|
259
|
+
}
|
|
260
|
+
output.push('');
|
|
261
|
+
if (baseline > 0) {
|
|
262
|
+
output.push(chalk.dim(baselineNote(baseline, done)), '');
|
|
263
|
+
}
|
|
264
|
+
if (rendering !== undefined) {
|
|
265
|
+
const ids = physicalIdsFromPlan(rendering.plan, rendering.local);
|
|
266
|
+
// Reading them parses source files, so only once a diff is to be rendered.
|
|
267
|
+
const sources = new SourceIndex();
|
|
268
|
+
const variableNames = sortedUpdating.length > 0 ? constructVariableNames(project, undefined, sources) : undefined;
|
|
269
|
+
for (const listed of sortedUpdating) {
|
|
270
|
+
const { resourceType, logicalId } = listed;
|
|
271
|
+
// The entry to render is the plan's, whether this listing is the plan
|
|
272
|
+
// itself or the deploy that carried it out.
|
|
273
|
+
const planned = rendering.plan.find(entry => entry.type === resourceType && entry.logicalId === logicalId);
|
|
274
|
+
if (planned === undefined || planned.before === undefined) {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
// Listed for the write that sets its baseline, not for a change: a diff
|
|
278
|
+
// would show its unmanaged relations as removed, which the deploy does
|
|
279
|
+
// not do without --prune-relations. The `!` row says what there is to say.
|
|
280
|
+
if (onlyUnmanagedChanges(planned) && !pruneRelations) {
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
const lines = renderResourceDiff({
|
|
284
|
+
entry: planned,
|
|
285
|
+
local: rendering.local.find(resource => resource.type === resourceType && resource.logicalId === logicalId),
|
|
286
|
+
localResources: rendering.local,
|
|
287
|
+
diff: rendering.plan,
|
|
288
|
+
project,
|
|
289
|
+
ids,
|
|
290
|
+
pruneRelations,
|
|
291
|
+
variableNames,
|
|
292
|
+
spelledOut: sources.spelledOut(listed.construct),
|
|
293
|
+
});
|
|
294
|
+
if (lines.length === 0) {
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
const file = sourceFileOf(listed);
|
|
298
|
+
output.push(`${MARKER.update} ${chalk.bold(listed.construct.constructor.name)} ${chalk.bold(logicalId)}`
|
|
299
|
+
+ (file !== undefined ? ` ${chalk.dim(file)}` : ''),
|
|
300
|
+
// The legend explains `-` and `+` lines, so it is printed where
|
|
301
|
+
// there are some: a resource reported by notes alone has no sides.
|
|
302
|
+
...(lines.some(hasSide) ? diffLegend(done) : []));
|
|
303
|
+
// A hunk boundary is shown as the gap between two hunks of the same
|
|
304
|
+
// diff, so the first hunk of the construct diff, and the first of a
|
|
305
|
+
// nested text diff (which follows the note naming its property), get
|
|
306
|
+
// none.
|
|
307
|
+
let previous;
|
|
308
|
+
for (const line of lines) {
|
|
309
|
+
const hunk = line.kind === 'hunk' || (line.kind === 'nested' && line.line.kind === 'hunk');
|
|
310
|
+
const sameDiff = previous !== undefined
|
|
311
|
+
&& (line.kind === 'nested' ? previous.kind === 'nested' : previous.kind !== 'note' && previous.kind !== 'reason');
|
|
312
|
+
previous = line;
|
|
313
|
+
if (hunk && !sameDiff) {
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
output.push(` ${styled(line)}`.trimEnd());
|
|
317
|
+
}
|
|
318
|
+
output.push('');
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
const counted = (count, text, colour) => count > 0 ? [colour(`${count} ${text}`)] : [];
|
|
322
|
+
output.push([
|
|
323
|
+
...counted(sortedCreating.length, done ? 'created' : 'to create', chalk.green),
|
|
324
|
+
...counted(sortedUpdating.length, done ? 'updated' : 'to update', chalk.yellow),
|
|
325
|
+
...counted(sortedDeleting.length, done ? 'deleted' : 'to delete', chalk.red),
|
|
326
|
+
...counted(sortedDetaching.length, 'kept in your account', chalk.yellow),
|
|
327
|
+
...counted(sortedPruning.length, sortedPruning.length === 1 ? 'relation pruned' : 'relations pruned', chalk.red),
|
|
328
|
+
...counted(skipping.length, 'skipped (testOnly)', chalk.dim),
|
|
329
|
+
...counted(sortedUnmanaged.length, 'with relations this project does not manage', chalk.yellow),
|
|
330
|
+
chalk.dim(`${unchanged} unchanged`),
|
|
331
|
+
].join(', '));
|
|
332
|
+
if (planToken !== undefined) {
|
|
333
|
+
output.push(`${chalk.dim('Deploy exactly this plan:')} checkly deploy --plan-token ${planToken}`);
|
|
334
|
+
}
|
|
335
|
+
// A blank line closes the plan, whatever follows it.
|
|
336
|
+
output.push('');
|
|
337
|
+
return output.join('\n');
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Why a plan lists resources as updates in which nothing differs. Checkly
|
|
341
|
+
* compares a resource with the state its last planned deploy left; one without
|
|
342
|
+
* such a state (the project's first plan, the first after a deploy with
|
|
343
|
+
* `--no-plan`, a resource added with `checkly import`) is compared with what is
|
|
344
|
+
* deployed instead and written whatever that finds, so that the next plan has
|
|
345
|
+
* a baseline. The note counts them and names no cause: the plan does not say
|
|
346
|
+
* which of these it was, and a sentence about "the first plan" would be wrong
|
|
347
|
+
* for the others.
|
|
348
|
+
*/
|
|
349
|
+
function baselineNote(count, done) {
|
|
350
|
+
const resources = count === 1 ? '1 resource' : `${count} resources`;
|
|
351
|
+
const verb = done ? (count === 1 ? 'was' : 'were') : (count === 1 ? 'is' : 'are');
|
|
352
|
+
return `${resources} ${verb} updated to set a baseline. Later deploys show only what changed.`;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* What the two sides of a construct diff are, printed under the resource's
|
|
356
|
+
* header: a `-` line is the account's value, which the deploy replaces or,
|
|
357
|
+
* when no `+` line follows, removes; a `+` line is the code's value, which
|
|
358
|
+
* the deploy adds or, when a `-` line precedes it, changes to. Once the
|
|
359
|
+
* deploy is done the code's value is the live one, and the legend says so.
|
|
360
|
+
*/
|
|
361
|
+
function diffLegend(done) {
|
|
362
|
+
const sides = done
|
|
363
|
+
? [[MARKER.delete, 'was live in Checkly', 'replaced or removed by the deploy'],
|
|
364
|
+
[MARKER.create, 'now live in Checkly', 'added or changed by the deploy']]
|
|
365
|
+
: [[MARKER.delete, 'live in Checkly', 'replaced or removed by this deploy'],
|
|
366
|
+
[MARKER.create, 'in your code', 'added or changed by this deploy']];
|
|
367
|
+
const width = Math.max(...sides.map(([, label]) => label.length));
|
|
368
|
+
return sides.map(([marker, label, meaning]) => ` ${marker} ${chalk.dim(`${label.padEnd(width)} ${meaning}`)}`);
|
|
369
|
+
}
|
|
370
|
+
/** Whether a rendered line is one side of a diff: a `-` or a `+` line, of the construct or of a nested text. */
|
|
371
|
+
function hasSide(line) {
|
|
372
|
+
const kind = line.kind === 'nested' ? line.line.kind : line.kind;
|
|
373
|
+
return kind === 'add' || kind === 'remove';
|
|
374
|
+
}
|
|
375
|
+
/** One rendered line with its marker and colour; a nested line sits two columns further in. */
|
|
376
|
+
export function styled(line) {
|
|
377
|
+
switch (line.kind) {
|
|
378
|
+
case 'add':
|
|
379
|
+
return chalk.green(`+ ${line.text}`);
|
|
380
|
+
case 'remove':
|
|
381
|
+
return chalk.red(`- ${line.text}`);
|
|
382
|
+
case 'context':
|
|
383
|
+
return ` ${chalk.grey(line.text)}`;
|
|
384
|
+
case 'hunk':
|
|
385
|
+
return ` ${GAP}`;
|
|
386
|
+
case 'note':
|
|
387
|
+
return chalk.yellow(`~ ${line.text}`);
|
|
388
|
+
case 'reason':
|
|
389
|
+
return ` ${chalk.dim(line.text)}`;
|
|
390
|
+
case 'nested':
|
|
391
|
+
return ` ${styled(line.line)}`;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
//# sourceMappingURL=preview-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-output.js","sourceRoot":"","sources":["../../../src/services/deploy-diff/preview-output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EACL,YAAY,EAAE,wBAAwB,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EACpE,iBAAiB,EAAE,eAAe,EAAE,8BAA8B,EAAE,8BAA8B,EAC5E,UAAU,EAAE,iBAAiB,EACnD,0BAA0B,EAAE,qBAAqB,GAClD,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAC5F,OAAO,EAAE,kBAAkB,E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 @@
|
|
|
1
|
+
import type { Project } from '../../constructs/project.js';
|
|
2
|
+
import type { DiffEntry, ResourceSync } from '../../rest/projects.js';
|
|
3
|
+
import { type PhysicalIds } from './import-shape.js';
|
|
4
|
+
import { type DiffLine } from './diff-lines.js';
|
|
5
|
+
import type { VariableNames } from './variable-names.js';
|
|
6
|
+
/**
|
|
7
|
+
* The lines printed under one updated resource of a deploy preview: the
|
|
8
|
+
* construct as Checkly has it against the construct as the local code would
|
|
9
|
+
* make it, rendered by the import codegen on both sides and diffed as text
|
|
10
|
+
* (spec 8.5). Everything here is reporting: a failure falls back to a coarser
|
|
11
|
+
* listing of the reported changes, and never to a failed deploy.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* One line printed under an updated resource. A `DiffLine` is a line of the
|
|
15
|
+
* construct diff; a `note` is a fact stated in words (a change the diff
|
|
16
|
+
* cannot show, a secret's movement, a listed property); a `reason` says why
|
|
17
|
+
* the listing stands in for the diff; a `nested` line belongs to the text
|
|
18
|
+
* diff of a property kept in a file of its own, printed under its `note`.
|
|
19
|
+
*/
|
|
20
|
+
export type RenderedLine = DiffLine | {
|
|
21
|
+
kind: 'note';
|
|
22
|
+
text: string;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'reason';
|
|
25
|
+
text: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'nested';
|
|
28
|
+
line: DiffLine;
|
|
29
|
+
};
|
|
30
|
+
export interface RenderResourceInput {
|
|
31
|
+
/** The resource's preview entry, carrying `before`, `changes` and `redactions` under `detail: 'full'`. */
|
|
32
|
+
entry: DiffEntry;
|
|
33
|
+
/** The resource's own local payload, as sent in the deploy. */
|
|
34
|
+
local: ResourceSync | undefined;
|
|
35
|
+
/** Every resource of the local deploy payload (for the relations of a check or group). */
|
|
36
|
+
localResources: readonly ResourceSync[];
|
|
37
|
+
/** The whole preview (for the relation entries folded into this resource). */
|
|
38
|
+
diff: readonly DiffEntry[];
|
|
39
|
+
project: Project;
|
|
40
|
+
ids: PhysicalIds;
|
|
41
|
+
pruneRelations: boolean;
|
|
42
|
+
/** The variable each construct has in the user's code; one without an entry gets a generated name. */
|
|
43
|
+
variableNames?: VariableNames;
|
|
44
|
+
/**
|
|
45
|
+
* The properties the resource's declaration spells out (`ContextOptions.spelledOut`):
|
|
46
|
+
* rendered on both sides whatever their values, so that a value moved to or
|
|
47
|
+
* from a default reads as a change of that line and not as its removal.
|
|
48
|
+
*/
|
|
49
|
+
spelledOut?: ReadonlySet<string>;
|
|
50
|
+
/** The most lines a diff may take before the listing is printed instead. */
|
|
51
|
+
maxLines?: number;
|
|
52
|
+
}
|
|
53
|
+
export declare function renderResourceDiff(input: RenderResourceInput): RenderedLine[];
|