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
package/dist/rest/projects.d.ts
CHANGED
|
@@ -16,6 +16,135 @@ export interface Change {
|
|
|
16
16
|
type: string;
|
|
17
17
|
action: string;
|
|
18
18
|
}
|
|
19
|
+
/** The API's stand-in for a sensitive value in a reported change. */
|
|
20
|
+
export interface DiffMaskedMarker {
|
|
21
|
+
$masked: 'same' | 'changed';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* One property of one resource that a deploy would change, or has changed.
|
|
25
|
+
*
|
|
26
|
+
* `origin` says which side moved since the last deploy: `code` for a local
|
|
27
|
+
* edit, `remote` for one made outside the CLI (the web app, the API), `both`
|
|
28
|
+
* when the property moved on both sides — in which case `remote` carries the
|
|
29
|
+
* movement the deploy is about to overwrite. A value too large to inline is
|
|
30
|
+
* reported as a `{ $hash }` object rather than in the clear; under
|
|
31
|
+
* `detail: 'full'` the deployed text is in the entry's `before`, at the path
|
|
32
|
+
* the import format gives it (the same one for a script or a request body).
|
|
33
|
+
* A secret change (`secret: true`) carries its values with every sensitive
|
|
34
|
+
* position replaced by a `DiffMaskedMarker`, `changed` on the element whose
|
|
35
|
+
* secret moved on that side; never a value or a hash. A list holding an
|
|
36
|
+
* unmoved secret carries `same` markers without the flag.
|
|
37
|
+
* `cause` names the reason for a change with no user-facing property behind
|
|
38
|
+
* it, such as a new code bundle.
|
|
39
|
+
*/
|
|
40
|
+
export interface DiffChange {
|
|
41
|
+
path: string;
|
|
42
|
+
/**
|
|
43
|
+
* `unmanaged` marks an alert channel or private location attached to this
|
|
44
|
+
* project's check or group from outside the project: reported on the resource
|
|
45
|
+
* it belongs to, and only deleted with `--prune-relations`.
|
|
46
|
+
*/
|
|
47
|
+
origin: 'code' | 'remote' | 'both' | 'unmanaged';
|
|
48
|
+
before?: unknown;
|
|
49
|
+
after?: unknown;
|
|
50
|
+
remote?: {
|
|
51
|
+
before?: unknown;
|
|
52
|
+
after?: unknown;
|
|
53
|
+
};
|
|
54
|
+
cause?: string;
|
|
55
|
+
/** Set when a sensitive value moved or a sensitive list element could not be matched; see `DiffMaskedMarker`. */
|
|
56
|
+
secret?: true;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* One rule of the redaction table the API applies to an entry's `before`, as
|
|
60
|
+
* a JSON Pointer pattern (`*` for every list position) and the flag test on
|
|
61
|
+
* the holding element that decides it. The API reports the resource type's
|
|
62
|
+
* whole table, whatever the deployed row held, so the local side blanks by
|
|
63
|
+
* the same rules — a credential the code adds included.
|
|
64
|
+
*/
|
|
65
|
+
export interface DiffRedaction {
|
|
66
|
+
path: string;
|
|
67
|
+
/** What the rule blanks to: a `value` becomes the empty string, an `object` becomes null. */
|
|
68
|
+
kind: 'value' | 'object';
|
|
69
|
+
when?: 'locked' | 'lockedOrSecret';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A resource in a deploy plan or an applied deploy. `action` is CREATE,
|
|
73
|
+
* UPDATE, DELETE, DETACH (removed from code but kept in the account) or
|
|
74
|
+
* UNCHANGED.
|
|
75
|
+
*/
|
|
76
|
+
export interface DiffEntry extends Change {
|
|
77
|
+
origin?: 'code' | 'remote' | 'unmanaged';
|
|
78
|
+
/** Absent under `detail: 'summary'`. */
|
|
79
|
+
changes?: DiffChange[];
|
|
80
|
+
/**
|
|
81
|
+
* The resource as currently deployed, in the import format: the payload the
|
|
82
|
+
* import plan returns for it, references as physical ids, a check's or
|
|
83
|
+
* group's subscription and assignment rows on it, credential values blanked.
|
|
84
|
+
* Only under `detail: 'full'`, and only for a retained resource with a
|
|
85
|
+
* change to show.
|
|
86
|
+
*/
|
|
87
|
+
before?: Record<string, unknown>;
|
|
88
|
+
/** With `before`: the type's redaction rule table, applied to it. */
|
|
89
|
+
redactions?: DiffRedaction[];
|
|
90
|
+
/**
|
|
91
|
+
* Set on a relation (an alert channel subscription, a private location
|
|
92
|
+
* assignment) whose change is reported as part of the check or group it
|
|
93
|
+
* belongs to, so a renderer can fold it into that resource instead of
|
|
94
|
+
* listing it separately.
|
|
95
|
+
*/
|
|
96
|
+
foldedInto?: {
|
|
97
|
+
type: string;
|
|
98
|
+
logicalId: string;
|
|
99
|
+
};
|
|
100
|
+
/** The file Checkly has recorded for the resource, or null if none. */
|
|
101
|
+
sourceFile?: string | null;
|
|
102
|
+
/**
|
|
103
|
+
* `live` when Checkly had no usable state from an earlier planned deploy to
|
|
104
|
+
* compare the resource with (the project's first plan, the first after a
|
|
105
|
+
* deploy without one, a resource added with `checkly import`, or a stored
|
|
106
|
+
* state a Checkly update made unusable) and compared the code with the
|
|
107
|
+
* deployed resource instead. The deploy
|
|
108
|
+
* writes such a resource whatever the comparison found, to set the baseline
|
|
109
|
+
* for later plans, and `changes` is not exhaustive: a value the deployed
|
|
110
|
+
* resource holds on a property the code does not set is left out, although
|
|
111
|
+
* the write may reset it.
|
|
112
|
+
*/
|
|
113
|
+
basis?: 'live';
|
|
114
|
+
/**
|
|
115
|
+
* On a check the deploy created, updated or kept, other than a heartbeat
|
|
116
|
+
* monitor: whether Checkly selected it to run right after the deploy. Only on
|
|
117
|
+
* a deploy's result, never on a preview or a dry run, and absent from an API
|
|
118
|
+
* that predates it.
|
|
119
|
+
*/
|
|
120
|
+
scheduled?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Why `scheduled` is false: the deploy did not ask for scheduling, it had
|
|
123
|
+
* more checks than the scheduling threshold allows, it left the check
|
|
124
|
+
* unchanged while scheduling changed checks only, or the check runs more
|
|
125
|
+
* often than the minimum frequency for scheduling on deploy.
|
|
126
|
+
*/
|
|
127
|
+
scheduleSkippedReason?: 'NOT_REQUESTED' | 'THRESHOLD' | 'UNCHANGED' | 'MIN_FREQUENCY';
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Which checks a deploy schedules: the ones it created or updated, or every
|
|
131
|
+
* check it deployed, the unchanged ones included.
|
|
132
|
+
*/
|
|
133
|
+
export type ScheduleOnDeployScope = 'changed' | 'all';
|
|
134
|
+
/** How much of each change a preview reports. */
|
|
135
|
+
export type ProjectPreviewDetail = 'summary' | 'changes' | 'full';
|
|
136
|
+
export interface ProjectPreviewResponse {
|
|
137
|
+
/** The project as currently deployed; absent before its first deploy. */
|
|
138
|
+
project?: DeployedProject | null;
|
|
139
|
+
/**
|
|
140
|
+
* Opaque fingerprint of the Checkly-side state this plan was computed
|
|
141
|
+
* against. Passing it to a deploy makes that deploy refuse, rather than
|
|
142
|
+
* apply a different plan than the one that was reviewed, if anything moved
|
|
143
|
+
* in between.
|
|
144
|
+
*/
|
|
145
|
+
planToken: string;
|
|
146
|
+
diff: DiffEntry[];
|
|
147
|
+
}
|
|
19
148
|
export interface ResourceSync {
|
|
20
149
|
logicalId: string;
|
|
21
150
|
physicalId?: string | number;
|
|
@@ -86,7 +215,14 @@ export interface DeployedProject extends Project {
|
|
|
86
215
|
}
|
|
87
216
|
export interface ProjectDeployResponse {
|
|
88
217
|
project: DeployedProject;
|
|
89
|
-
diff: Array<
|
|
218
|
+
diff: Array<DiffEntry>;
|
|
219
|
+
/**
|
|
220
|
+
* Whether Checkly scheduled the deployed checks to run. Set by `deploy()`
|
|
221
|
+
* from the deployment; false when it was asked not to, and when the deploy
|
|
222
|
+
* had more checks than the scheduling threshold allows. Absent from an API
|
|
223
|
+
* that predates the threshold.
|
|
224
|
+
*/
|
|
225
|
+
scheduled?: boolean;
|
|
90
226
|
}
|
|
91
227
|
export type ProjectDeploymentStatus = 'PENDING' | 'RUNNING' | 'SUCCEEDED' | 'FAILED' | 'CANCELLED';
|
|
92
228
|
export interface ProjectDeployment {
|
|
@@ -102,6 +238,14 @@ export interface ProjectDeployment {
|
|
|
102
238
|
} | null;
|
|
103
239
|
/** The applied { project, diff }; present once the deployment has succeeded. */
|
|
104
240
|
result: ProjectDeployResponse | null;
|
|
241
|
+
/**
|
|
242
|
+
* Whether the deploy schedules its checks. False when it was sent with
|
|
243
|
+
* scheduleOnDeploy=false, and when it had more checks than the scheduling
|
|
244
|
+
* threshold allows, which is decided from the applied diff: until the
|
|
245
|
+
* deployment has finished it is the request. Absent from an API that
|
|
246
|
+
* predates the threshold.
|
|
247
|
+
*/
|
|
248
|
+
scheduleOnDeploy?: boolean;
|
|
105
249
|
createdAt: string;
|
|
106
250
|
startedAt: string | null;
|
|
107
251
|
endedAt: string | null;
|
|
@@ -154,6 +298,57 @@ export declare class ProjectAlreadyExistsError extends Error {
|
|
|
154
298
|
export declare class NoImportableResourcesFoundError extends Error {
|
|
155
299
|
constructor(options?: ErrorOptions);
|
|
156
300
|
}
|
|
301
|
+
/**
|
|
302
|
+
* The plan a deploy was pinned to no longer describes Checkly's state: a
|
|
303
|
+
* change landed between the preview and the deploy, so the deploy applied
|
|
304
|
+
* nothing. `diff` is the plan as it looks now.
|
|
305
|
+
*/
|
|
306
|
+
export declare class ProjectPlanStaleError extends Error {
|
|
307
|
+
readonly diff: DiffEntry[];
|
|
308
|
+
constructor(message: string, diff: DiffEntry[], options?: ErrorOptions);
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* A deployment that was already running finished while this one waited for it.
|
|
312
|
+
* Whatever it wrote, it moved the state the plan was computed against, so the
|
|
313
|
+
* plan is stale before the deploy is even attempted — reported here rather
|
|
314
|
+
* than after re-sending the whole payload for a refusal that is certain.
|
|
315
|
+
*
|
|
316
|
+
* A subtype of {@link ProjectPlanStaleError}: callers recover from both the
|
|
317
|
+
* same way, by planning again. It carries no diff, because no new plan has
|
|
318
|
+
* been computed yet.
|
|
319
|
+
*/
|
|
320
|
+
export declare class ProjectPlanSupersededError extends ProjectPlanStaleError {
|
|
321
|
+
constructor(options?: ErrorOptions);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* The preview could not be computed because another operation is holding the
|
|
325
|
+
* project. Transient: the operation holding it finishes.
|
|
326
|
+
*/
|
|
327
|
+
export declare class ProjectPreviewUnavailableError extends Error {
|
|
328
|
+
constructor(message: string, options?: ErrorOptions);
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* The account's Checkly API does not have the preview endpoint yet (a
|
|
332
|
+
* self-hosted or not-yet-updated backend). Callers fall back to the older,
|
|
333
|
+
* coarser deploy preview.
|
|
334
|
+
*/
|
|
335
|
+
export declare class ProjectPreviewNotSupportedError extends Error {
|
|
336
|
+
constructor(options?: ErrorOptions);
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* The account's Checkly API has deploy plans switched off at the moment. Unlike
|
|
340
|
+
* an API without the preview endpoint, it knows every payload field a planned
|
|
341
|
+
* deploy sends, so callers fall back to a deploy without a plan and leave the
|
|
342
|
+
* payload as it is.
|
|
343
|
+
*/
|
|
344
|
+
export declare class ProjectPlanDisabledError extends Error {
|
|
345
|
+
constructor(options?: ErrorOptions);
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* `code` of what the API answers with while plans are switched off: the 404 of
|
|
349
|
+
* the preview endpoint, and the 400 a deploy that needs a plan is refused with.
|
|
350
|
+
*/
|
|
351
|
+
export declare const DEPLOY_PLAN_DISABLED = "DEPLOY_PLAN_DISABLED";
|
|
157
352
|
export declare class ImportPlanNotFoundError extends Error {
|
|
158
353
|
constructor(options?: ErrorOptions);
|
|
159
354
|
}
|
|
@@ -197,6 +392,26 @@ declare class Projects {
|
|
|
197
392
|
* (the project does not exist) — a plain result with no deployment to follow.
|
|
198
393
|
*/
|
|
199
394
|
private submitDeletion;
|
|
395
|
+
/**
|
|
396
|
+
* What deploying this payload would change, per resource and per property,
|
|
397
|
+
* without writing anything.
|
|
398
|
+
*
|
|
399
|
+
* The returned `planToken` pins the plan: pass it to {@link deploy} and the
|
|
400
|
+
* deploy refuses if Checkly's state moved in between. A code-side edit
|
|
401
|
+
* between the two is not such a move — the token describes Checkly's state,
|
|
402
|
+
* not the payload — so previewing, editing and deploying still works.
|
|
403
|
+
*
|
|
404
|
+
* @throws {ProjectPreviewNotSupportedError} If the API has no preview endpoint.
|
|
405
|
+
* @throws {ProjectPlanDisabledError} If the API has deploy plans switched off.
|
|
406
|
+
* @throws {ProjectPreviewUnavailableError} If the project stayed busy.
|
|
407
|
+
*/
|
|
408
|
+
preview(resources: ProjectSync, { detail, preserveResources, pruneRelations, onStatus, }?: {
|
|
409
|
+
detail?: ProjectPreviewDetail;
|
|
410
|
+
preserveResources?: boolean;
|
|
411
|
+
pruneRelations?: boolean;
|
|
412
|
+
/** Human-readable status updates (e.g. while retrying behind another operation). */
|
|
413
|
+
onStatus?: (message: string) => void;
|
|
414
|
+
}): Promise<ProjectPreviewResponse>;
|
|
200
415
|
/**
|
|
201
416
|
* Deploy a project. The deployment runs asynchronously on the backend: this
|
|
202
417
|
* submits it, then follows its progress stream to completion, so large projects
|
|
@@ -205,14 +420,45 @@ declare class Projects {
|
|
|
205
420
|
*
|
|
206
421
|
* @throws {ProjectDeployFailedError} If the deployment finishes unsuccessfully.
|
|
207
422
|
*/
|
|
208
|
-
deploy(resources: ProjectSync, { dryRun, scheduleOnDeploy, preserveResources, cancelInProgress, onProgress, onStatus, }?: {
|
|
423
|
+
deploy(resources: ProjectSync, { dryRun, scheduleOnDeploy, scheduleOnDeployScope, scheduleOnDeployThreshold, scheduleOnDeployMinFrequency, preserveResources, plan, pruneRelations, planToken, cancelInProgress, onProgress, onStatus, }?: {
|
|
209
424
|
dryRun?: boolean;
|
|
210
425
|
scheduleOnDeploy?: boolean;
|
|
426
|
+
/** Which checks to schedule: the changed ones, or every deployed check. */
|
|
427
|
+
scheduleOnDeployScope?: ScheduleOnDeployScope;
|
|
428
|
+
/**
|
|
429
|
+
* Schedule no checks if the deploy would schedule more than this many,
|
|
430
|
+
* not counting the ones the scope and the minimum frequency leave out.
|
|
431
|
+
* Without it Checkly applies its own threshold.
|
|
432
|
+
*/
|
|
433
|
+
scheduleOnDeployThreshold?: number;
|
|
434
|
+
/**
|
|
435
|
+
* Leave out of scheduling the checks that run more often than every this
|
|
436
|
+
* many minutes. Without it Checkly applies its own minimum.
|
|
437
|
+
*/
|
|
438
|
+
scheduleOnDeployMinFrequency?: number;
|
|
211
439
|
/**
|
|
212
440
|
* Keep resources removed from code (and their run history) in the account
|
|
213
441
|
* instead of deleting them.
|
|
214
442
|
*/
|
|
215
443
|
preserveResources?: boolean;
|
|
444
|
+
/**
|
|
445
|
+
* Apply a plan: compare every resource with what was last deployed and
|
|
446
|
+
* with its current state, and write only the ones that differ. Without
|
|
447
|
+
* it the deploy writes every resource. `pruneRelations` and `planToken`
|
|
448
|
+
* are refused by the API unless this is set.
|
|
449
|
+
*/
|
|
450
|
+
plan?: boolean;
|
|
451
|
+
/**
|
|
452
|
+
* Delete the alert channel subscriptions and private location assignments
|
|
453
|
+
* on this project's checks and groups that the project does not manage.
|
|
454
|
+
*/
|
|
455
|
+
pruneRelations?: boolean;
|
|
456
|
+
/**
|
|
457
|
+
* The `planToken` of the preview this deploy was reviewed against. The
|
|
458
|
+
* deploy is refused with {@link ProjectPlanStaleError}, having written
|
|
459
|
+
* nothing, if Checkly's state moved since that preview.
|
|
460
|
+
*/
|
|
461
|
+
planToken?: string;
|
|
216
462
|
/**
|
|
217
463
|
* On a 409 (another deployment is already in progress), cancel that
|
|
218
464
|
* deployment instead of waiting for it to finish, then retry.
|
|
@@ -230,8 +476,12 @@ declare class Projects {
|
|
|
230
476
|
* optionally cancel it, then wait until it reaches a final state (or is gone)
|
|
231
477
|
* before returning — so the caller re-POSTs only when the slot is actually
|
|
232
478
|
* free, never re-uploading the payload while the predecessor is still running.
|
|
233
|
-
*
|
|
234
|
-
*
|
|
479
|
+
*
|
|
480
|
+
* @returns Whether the predecessor was observed to reach a final state.
|
|
481
|
+
* `false` means the wait hit its deadline with the predecessor still running,
|
|
482
|
+
* which is a different situation for the caller: nothing has changed, so a
|
|
483
|
+
* plan computed before the wait still stands, and re-POSTing surfaces the
|
|
484
|
+
* conflict the caller needs to hear about.
|
|
235
485
|
*/
|
|
236
486
|
private resolveInProgressDeployment;
|
|
237
487
|
getDeployment(logicalId: string, deploymentId: string): Promise<import("axios").AxiosResponse<ProjectDeployment, any, {}, any>>;
|
package/dist/rest/projects.js
CHANGED
|
@@ -2,6 +2,7 @@ import { isAxiosError } from 'axios';
|
|
|
2
2
|
import { Readable } from 'node:stream';
|
|
3
3
|
import { compressJSONPayload } from './util.js';
|
|
4
4
|
import { ConflictError, ForbiddenError, handleErrorResponse, NotFoundError, RequestTimeoutError } from './errors.js';
|
|
5
|
+
import { parseRetryAfter } from './retry.js';
|
|
5
6
|
export class ProjectDeployFailedError extends Error {
|
|
6
7
|
constructor(message, options) {
|
|
7
8
|
super(message, options);
|
|
@@ -78,6 +79,74 @@ export class NoImportableResourcesFoundError extends Error {
|
|
|
78
79
|
this.name = 'NoImportableResourcesFoundError';
|
|
79
80
|
}
|
|
80
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* The plan a deploy was pinned to no longer describes Checkly's state: a
|
|
84
|
+
* change landed between the preview and the deploy, so the deploy applied
|
|
85
|
+
* nothing. `diff` is the plan as it looks now.
|
|
86
|
+
*/
|
|
87
|
+
export class ProjectPlanStaleError extends Error {
|
|
88
|
+
diff;
|
|
89
|
+
constructor(message, diff, options) {
|
|
90
|
+
super(message, options);
|
|
91
|
+
this.name = 'ProjectPlanStaleError';
|
|
92
|
+
this.diff = diff;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* A deployment that was already running finished while this one waited for it.
|
|
97
|
+
* Whatever it wrote, it moved the state the plan was computed against, so the
|
|
98
|
+
* plan is stale before the deploy is even attempted — reported here rather
|
|
99
|
+
* than after re-sending the whole payload for a refusal that is certain.
|
|
100
|
+
*
|
|
101
|
+
* A subtype of {@link ProjectPlanStaleError}: callers recover from both the
|
|
102
|
+
* same way, by planning again. It carries no diff, because no new plan has
|
|
103
|
+
* been computed yet.
|
|
104
|
+
*/
|
|
105
|
+
export class ProjectPlanSupersededError extends ProjectPlanStaleError {
|
|
106
|
+
constructor(options) {
|
|
107
|
+
super('Another deployment of this project finished while this one was waiting for it, '
|
|
108
|
+
+ 'so the plan this deploy was pinned to no longer describes your Checkly account.', [], options);
|
|
109
|
+
this.name = 'ProjectPlanSupersededError';
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The preview could not be computed because another operation is holding the
|
|
114
|
+
* project. Transient: the operation holding it finishes.
|
|
115
|
+
*/
|
|
116
|
+
export class ProjectPreviewUnavailableError extends Error {
|
|
117
|
+
constructor(message, options) {
|
|
118
|
+
super(message, options);
|
|
119
|
+
this.name = 'ProjectPreviewUnavailableError';
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The account's Checkly API does not have the preview endpoint yet (a
|
|
124
|
+
* self-hosted or not-yet-updated backend). Callers fall back to the older,
|
|
125
|
+
* coarser deploy preview.
|
|
126
|
+
*/
|
|
127
|
+
export class ProjectPreviewNotSupportedError extends Error {
|
|
128
|
+
constructor(options) {
|
|
129
|
+
super('This Checkly API does not support deploy previews.', options);
|
|
130
|
+
this.name = 'ProjectPreviewNotSupportedError';
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The account's Checkly API has deploy plans switched off at the moment. Unlike
|
|
135
|
+
* an API without the preview endpoint, it knows every payload field a planned
|
|
136
|
+
* deploy sends, so callers fall back to a deploy without a plan and leave the
|
|
137
|
+
* payload as it is.
|
|
138
|
+
*/
|
|
139
|
+
export class ProjectPlanDisabledError extends Error {
|
|
140
|
+
constructor(options) {
|
|
141
|
+
super('Checkly has deploy plans switched off at the moment.', options);
|
|
142
|
+
this.name = 'ProjectPlanDisabledError';
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* `code` of what the API answers with while plans are switched off: the 404 of
|
|
147
|
+
* the preview endpoint, and the 400 a deploy that needs a plan is refused with.
|
|
148
|
+
*/
|
|
149
|
+
export const DEPLOY_PLAN_DISABLED = 'DEPLOY_PLAN_DISABLED';
|
|
81
150
|
export class ImportPlanNotFoundError extends Error {
|
|
82
151
|
constructor(options) {
|
|
83
152
|
super(`Import plan does not exist.`, options);
|
|
@@ -94,6 +163,13 @@ export class InvalidImportPlanStateError extends Error {
|
|
|
94
163
|
// in-progress operation before giving up and surfacing the 409. Generous, since a
|
|
95
164
|
// large predecessor deploy or delete can legitimately run for many minutes.
|
|
96
165
|
const DEPLOY_CONFLICT_WAIT_DEADLINE_MS = 30 * 60_000;
|
|
166
|
+
// A preview conflicts only while something else holds the project, which is
|
|
167
|
+
// measured in seconds, so it is retried a few times rather than waited out
|
|
168
|
+
// like a deploy's predecessor. The cap keeps a server asking for an
|
|
169
|
+
// unreasonable wait from stalling the command instead of failing it.
|
|
170
|
+
const PREVIEW_CONFLICT_ATTEMPTS = 3;
|
|
171
|
+
const PREVIEW_RETRY_AFTER_DEFAULT_MS = 2_000;
|
|
172
|
+
const PREVIEW_RETRY_AFTER_MAX_MS = 10_000;
|
|
97
173
|
class Projects {
|
|
98
174
|
api;
|
|
99
175
|
constructor(api) {
|
|
@@ -185,6 +261,54 @@ class Projects {
|
|
|
185
261
|
throw new ProjectDeployFailedError(completed.error?.message ?? 'The deletion did not complete successfully.');
|
|
186
262
|
}
|
|
187
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* What deploying this payload would change, per resource and per property,
|
|
266
|
+
* without writing anything.
|
|
267
|
+
*
|
|
268
|
+
* The returned `planToken` pins the plan: pass it to {@link deploy} and the
|
|
269
|
+
* deploy refuses if Checkly's state moved in between. A code-side edit
|
|
270
|
+
* between the two is not such a move — the token describes Checkly's state,
|
|
271
|
+
* not the payload — so previewing, editing and deploying still works.
|
|
272
|
+
*
|
|
273
|
+
* @throws {ProjectPreviewNotSupportedError} If the API has no preview endpoint.
|
|
274
|
+
* @throws {ProjectPlanDisabledError} If the API has deploy plans switched off.
|
|
275
|
+
* @throws {ProjectPreviewUnavailableError} If the project stayed busy.
|
|
276
|
+
*/
|
|
277
|
+
async preview(resources, { detail = 'changes', preserveResources = false, pruneRelations = false, onStatus, } = {}) {
|
|
278
|
+
const query = new URLSearchParams({ detail });
|
|
279
|
+
// Only sent when opted in, like deploy's: false is the default and the
|
|
280
|
+
// endpoint's contract is easier to keep stable if the CLI omits defaults.
|
|
281
|
+
if (preserveResources) {
|
|
282
|
+
query.set('preserveResources', 'true');
|
|
283
|
+
}
|
|
284
|
+
if (pruneRelations) {
|
|
285
|
+
query.set('pruneRelations', 'true');
|
|
286
|
+
}
|
|
287
|
+
for (let attempt = 1;; attempt++) {
|
|
288
|
+
try {
|
|
289
|
+
const { data } = await this.api.post(`/v1/projects/preview?${query.toString()}`, resources, { transformRequest: compressJSONPayload });
|
|
290
|
+
return data;
|
|
291
|
+
}
|
|
292
|
+
catch (err) {
|
|
293
|
+
if (err instanceof NotFoundError) {
|
|
294
|
+
// Both are a 404: only the body tells an API that has plans switched
|
|
295
|
+
// off from one that never had the endpoint.
|
|
296
|
+
throw err.data.code === DEPLOY_PLAN_DISABLED
|
|
297
|
+
? new ProjectPlanDisabledError({ cause: err })
|
|
298
|
+
: new ProjectPreviewNotSupportedError({ cause: err });
|
|
299
|
+
}
|
|
300
|
+
if (!(err instanceof ConflictError)) {
|
|
301
|
+
throw err;
|
|
302
|
+
}
|
|
303
|
+
if (attempt >= PREVIEW_CONFLICT_ATTEMPTS) {
|
|
304
|
+
throw new ProjectPreviewUnavailableError(err.data.message, { cause: err });
|
|
305
|
+
}
|
|
306
|
+
const retryAfterMs = Math.min(parseRetryAfter(err.data.retryAfter) ?? PREVIEW_RETRY_AFTER_DEFAULT_MS, PREVIEW_RETRY_AFTER_MAX_MS);
|
|
307
|
+
onStatus?.('Another operation is holding the project, retrying...');
|
|
308
|
+
await new Promise(resolve => setTimeout(resolve, retryAfterMs));
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
188
312
|
/**
|
|
189
313
|
* Deploy a project. The deployment runs asynchronously on the backend: this
|
|
190
314
|
* submits it, then follows its progress stream to completion, so large projects
|
|
@@ -193,7 +317,7 @@ class Projects {
|
|
|
193
317
|
*
|
|
194
318
|
* @throws {ProjectDeployFailedError} If the deployment finishes unsuccessfully.
|
|
195
319
|
*/
|
|
196
|
-
async deploy(resources, { dryRun = false, scheduleOnDeploy =
|
|
320
|
+
async deploy(resources, { dryRun = false, scheduleOnDeploy = false, scheduleOnDeployScope = 'changed', scheduleOnDeployThreshold, scheduleOnDeployMinFrequency, preserveResources = false, plan = false, pruneRelations = false, planToken, cancelInProgress = false, onProgress, onStatus, } = {}) {
|
|
197
321
|
const logicalId = resources.project.logicalId;
|
|
198
322
|
// On a 409 the project already has a deployment in progress. By default we
|
|
199
323
|
// wait for it to finish then retry; with cancelInProgress we cancel it first.
|
|
@@ -204,7 +328,18 @@ class Projects {
|
|
|
204
328
|
const deadlineAt = Date.now() + DEPLOY_CONFLICT_WAIT_DEADLINE_MS;
|
|
205
329
|
for (;;) {
|
|
206
330
|
try {
|
|
207
|
-
return await this.submitDeployment(resources, {
|
|
331
|
+
return await this.submitDeployment(resources, {
|
|
332
|
+
dryRun,
|
|
333
|
+
scheduleOnDeploy,
|
|
334
|
+
scheduleOnDeployScope,
|
|
335
|
+
scheduleOnDeployThreshold,
|
|
336
|
+
scheduleOnDeployMinFrequency,
|
|
337
|
+
preserveResources,
|
|
338
|
+
plan,
|
|
339
|
+
pruneRelations,
|
|
340
|
+
planToken,
|
|
341
|
+
onProgress,
|
|
342
|
+
});
|
|
208
343
|
}
|
|
209
344
|
catch (err) {
|
|
210
345
|
if (dryRun
|
|
@@ -213,21 +348,46 @@ class Projects {
|
|
|
213
348
|
|| Date.now() >= deadlineAt) {
|
|
214
349
|
throw err;
|
|
215
350
|
}
|
|
216
|
-
await this.resolveInProgressDeployment(logicalId, err.data.deploymentId, {
|
|
351
|
+
const finished = await this.resolveInProgressDeployment(logicalId, err.data.deploymentId, {
|
|
217
352
|
cancel: cancelInProgress,
|
|
218
353
|
onStatus,
|
|
219
354
|
deadlineAt,
|
|
220
355
|
});
|
|
356
|
+
// A predecessor that ran to completion is what invalidates a plan
|
|
357
|
+
// token, so re-POSTing with this one would spend the whole payload on a
|
|
358
|
+
// refusal nobody can act on. Two cases are not that: one we cancelled
|
|
359
|
+
// ourselves (the caller asked to deploy instead of it, and it may well
|
|
360
|
+
// have written nothing), and one still running when the wait gave up —
|
|
361
|
+
// nothing has changed, and the re-POST surfaces the conflict the caller
|
|
362
|
+
// needs to hear about.
|
|
363
|
+
if (planToken !== undefined && !cancelInProgress && finished) {
|
|
364
|
+
throw new ProjectPlanSupersededError({ cause: err });
|
|
365
|
+
}
|
|
221
366
|
// loop → re-POST, now that the predecessor has reached a final state
|
|
222
367
|
}
|
|
223
368
|
}
|
|
224
369
|
}
|
|
225
|
-
async submitDeployment(resources, { dryRun, scheduleOnDeploy, preserveResources, onProgress }) {
|
|
370
|
+
async submitDeployment(resources, { dryRun, scheduleOnDeploy, scheduleOnDeployScope, scheduleOnDeployThreshold, scheduleOnDeployMinFrequency, preserveResources, plan, pruneRelations, planToken, onProgress, }) {
|
|
226
371
|
// Only send preserveResources when the user opted in. The endpoint rejects
|
|
227
372
|
// unknown query params, and preserveResources=false is the default (delete)
|
|
228
373
|
// behavior, so omitting it keeps default deploys backwards compatible.
|
|
374
|
+
// plan, pruneRelations, planToken, scheduleOnDeployThreshold and
|
|
375
|
+
// scheduleOnDeployMinFrequency are omitted for the same reason: an older
|
|
376
|
+
// API knows none of them. The scope is always sent: it decides which
|
|
377
|
+
// checks run after the deploy, whatever the API's own default.
|
|
378
|
+
const scopeParam = `&scheduleOnDeployScope=${scheduleOnDeployScope}`;
|
|
379
|
+
const thresholdParam = scheduleOnDeployThreshold === undefined
|
|
380
|
+
? ''
|
|
381
|
+
: `&scheduleOnDeployThreshold=${scheduleOnDeployThreshold}`;
|
|
382
|
+
const minFrequencyParam = scheduleOnDeployMinFrequency === undefined
|
|
383
|
+
? ''
|
|
384
|
+
: `&scheduleOnDeployMinFrequency=${scheduleOnDeployMinFrequency}`;
|
|
229
385
|
const preserveParam = preserveResources ? '&preserveResources=true' : '';
|
|
230
|
-
const
|
|
386
|
+
const planParam = plan ? '&plan=true' : '';
|
|
387
|
+
const pruneParam = pruneRelations ? '&pruneRelations=true' : '';
|
|
388
|
+
const tokenParam = planToken ? `&planToken=${encodeURIComponent(planToken)}` : '';
|
|
389
|
+
const { data } = await this.api.post(`/v1/projects/deploy?dryRun=${dryRun}&scheduleOnDeploy=${scheduleOnDeploy}`
|
|
390
|
+
+ `${scopeParam}${thresholdParam}${minFrequencyParam}${preserveParam}${planParam}${pruneParam}${tokenParam}`, resources, { transformRequest: compressJSONPayload });
|
|
231
391
|
// A dry run responds synchronously with the preview diff.
|
|
232
392
|
if (dryRun) {
|
|
233
393
|
return { data: data };
|
|
@@ -238,18 +398,30 @@ class Projects {
|
|
|
238
398
|
if (completed.status === 'CANCELLED') {
|
|
239
399
|
throw new ProjectDeployCancelledError('A newer deployment may have cancelled yours. Try deploying again if you still need to apply your changes.');
|
|
240
400
|
}
|
|
401
|
+
// A refused plan is not a failed deploy: nothing was written, and the
|
|
402
|
+
// deployment carries the plan as it looks now so the caller can show what
|
|
403
|
+
// moved instead of a bare error.
|
|
404
|
+
if (completed.error?.code === 'PLAN_STALE') {
|
|
405
|
+
throw new ProjectPlanStaleError(completed.error.message, completed.result?.diff ?? []);
|
|
406
|
+
}
|
|
241
407
|
if (completed.status !== 'SUCCEEDED' || completed.result === null) {
|
|
242
408
|
throw new ProjectDeployFailedError(completed.error?.message ?? 'The deployment did not complete successfully.');
|
|
243
409
|
}
|
|
244
|
-
|
|
410
|
+
// An API from before the scheduling threshold does not report the outcome;
|
|
411
|
+
// it scheduled as asked.
|
|
412
|
+
return { data: { ...completed.result, scheduled: completed.scheduleOnDeploy ?? scheduleOnDeploy } };
|
|
245
413
|
}
|
|
246
414
|
/**
|
|
247
415
|
* Resolve a collision with an in-progress deployment so the caller can retry:
|
|
248
416
|
* optionally cancel it, then wait until it reaches a final state (or is gone)
|
|
249
417
|
* before returning — so the caller re-POSTs only when the slot is actually
|
|
250
418
|
* free, never re-uploading the payload while the predecessor is still running.
|
|
251
|
-
*
|
|
252
|
-
*
|
|
419
|
+
*
|
|
420
|
+
* @returns Whether the predecessor was observed to reach a final state.
|
|
421
|
+
* `false` means the wait hit its deadline with the predecessor still running,
|
|
422
|
+
* which is a different situation for the caller: nothing has changed, so a
|
|
423
|
+
* plan computed before the wait still stands, and re-POSTing surfaces the
|
|
424
|
+
* conflict the caller needs to hear about.
|
|
253
425
|
*/
|
|
254
426
|
async resolveInProgressDeployment(logicalId, deploymentId, { cancel, onStatus, deadlineAt }) {
|
|
255
427
|
if (cancel) {
|
|
@@ -262,7 +434,7 @@ class Projects {
|
|
|
262
434
|
if (!(err instanceof NotFoundError)) {
|
|
263
435
|
throw err;
|
|
264
436
|
}
|
|
265
|
-
return;
|
|
437
|
+
return true;
|
|
266
438
|
}
|
|
267
439
|
}
|
|
268
440
|
else {
|
|
@@ -274,18 +446,18 @@ class Projects {
|
|
|
274
446
|
for (;;) {
|
|
275
447
|
try {
|
|
276
448
|
await this.awaitDeploymentCompletion(logicalId, deploymentId);
|
|
277
|
-
return; // reached a final state → slot free
|
|
449
|
+
return true; // reached a final state → slot free
|
|
278
450
|
}
|
|
279
451
|
catch (err) {
|
|
280
452
|
if (err instanceof NotFoundError) {
|
|
281
|
-
return; // gone → slot free
|
|
453
|
+
return true; // gone → slot free
|
|
282
454
|
}
|
|
283
455
|
// 408 = still running after the long-poll window. Keep waiting unless the
|
|
284
456
|
// overall deadline has passed, in which case return and let the caller
|
|
285
457
|
// re-POST once and surface the conflict.
|
|
286
458
|
if (err instanceof RequestTimeoutError) {
|
|
287
459
|
if (Date.now() >= deadlineAt) {
|
|
288
|
-
return;
|
|
460
|
+
return false;
|
|
289
461
|
}
|
|
290
462
|
continue;
|
|
291
463
|
}
|