checkly 0.0.0-canary.7166ed8
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/LICENSE +201 -0
- package/README.md +117 -0
- package/assets/runtimes/snapshots/20260130/runtimes.json +349 -0
- package/bin/run +8 -0
- package/bin/run.cmd +3 -0
- package/constructs.d.ts +1 -0
- package/constructs.js +2 -0
- package/dist/ai-context/checkly.rules.md +916 -0
- package/dist/ai-context/context.d.ts +150 -0
- package/dist/ai-context/context.js +263 -0
- package/dist/ai-context/context.js.map +1 -0
- package/dist/ai-context/onboarding-boilerplate/__checks__/api.check.ts +22 -0
- package/dist/ai-context/onboarding-boilerplate/__checks__/heartbeat.check.ts +16 -0
- package/dist/ai-context/onboarding-boilerplate/__checks__/homepage.spec.ts +12 -0
- package/dist/ai-context/onboarding-boilerplate/__checks__/url.check.ts +18 -0
- package/dist/ai-context/onboarding-boilerplate/checkly-config-template.ts +50 -0
- package/dist/ai-context/onboarding-prompts/base.md +1 -0
- package/dist/ai-context/onboarding-prompts/playwright.md +1 -0
- package/dist/ai-context/public-skills/checkly/README.md +43 -0
- package/dist/ai-context/public-skills/checkly/SKILL.md +112 -0
- package/dist/ai-context/skills-command/references/communicate-incidents.md +79 -0
- package/dist/ai-context/skills-command/references/communicate.md +33 -0
- package/dist/ai-context/skills-command/references/configure-agentic-checks.md +65 -0
- package/dist/ai-context/skills-command/references/configure-alert-channels.md +54 -0
- package/dist/ai-context/skills-command/references/configure-api-checks.md +73 -0
- package/dist/ai-context/skills-command/references/configure-browser-checks.md +36 -0
- package/dist/ai-context/skills-command/references/configure-check-groups.md +16 -0
- package/dist/ai-context/skills-command/references/configure-dns-monitors.md +39 -0
- package/dist/ai-context/skills-command/references/configure-environment.md +92 -0
- package/dist/ai-context/skills-command/references/configure-heartbeat-monitors.md +28 -0
- package/dist/ai-context/skills-command/references/configure-icmp-monitors.md +42 -0
- package/dist/ai-context/skills-command/references/configure-multistep-checks.md +34 -0
- package/dist/ai-context/skills-command/references/configure-playwright-checks.md +70 -0
- package/dist/ai-context/skills-command/references/configure-supporting-constructs.md +120 -0
- package/dist/ai-context/skills-command/references/configure-tcp-monitors.md +41 -0
- package/dist/ai-context/skills-command/references/configure-url-monitors.md +40 -0
- package/dist/ai-context/skills-command/references/configure.md +152 -0
- package/dist/ai-context/skills-command/references/initialize.md +134 -0
- package/dist/ai-context/skills-command/references/investigate-checks.md +156 -0
- package/dist/ai-context/skills-command/references/investigate-test-sessions.md +165 -0
- package/dist/ai-context/skills-command/references/investigate.md +15 -0
- package/dist/ai-context/skills-command/references/manage-account-members.md +82 -0
- package/dist/ai-context/skills-command/references/manage-plan.md +49 -0
- package/dist/ai-context/skills-command/references/manage.md +53 -0
- package/dist/auth/index.d.ts +15 -0
- package/dist/auth/index.js +226 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/commands/account/plan.d.ts +18 -0
- package/dist/commands/account/plan.js +113 -0
- package/dist/commands/account/plan.js.map +1 -0
- package/dist/commands/alert-channels/get.d.ts +14 -0
- package/dist/commands/alert-channels/get.js +50 -0
- package/dist/commands/alert-channels/get.js.map +1 -0
- package/dist/commands/alert-channels/list.d.ts +13 -0
- package/dist/commands/alert-channels/list.js +64 -0
- package/dist/commands/alert-channels/list.js.map +1 -0
- package/dist/commands/alert-channels/logs.d.ts +19 -0
- package/dist/commands/alert-channels/logs.js +91 -0
- package/dist/commands/alert-channels/logs.js.map +1 -0
- package/dist/commands/api.d.ts +23 -0
- package/dist/commands/api.js +205 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/assets/download.d.ts +19 -0
- package/dist/commands/assets/download.js +170 -0
- package/dist/commands/assets/download.js.map +1 -0
- package/dist/commands/assets/list.d.ts +17 -0
- package/dist/commands/assets/list.js +107 -0
- package/dist/commands/assets/list.js.map +1 -0
- package/dist/commands/authCommand.d.ts +14 -0
- package/dist/commands/authCommand.js +49 -0
- package/dist/commands/authCommand.js.map +1 -0
- package/dist/commands/baseCommand.d.ts +23 -0
- package/dist/commands/baseCommand.js +93 -0
- package/dist/commands/baseCommand.js.map +1 -0
- package/dist/commands/checks/delete.d.ts +15 -0
- package/dist/commands/checks/delete.js +65 -0
- package/dist/commands/checks/delete.js.map +1 -0
- package/dist/commands/checks/get.d.ts +30 -0
- package/dist/commands/checks/get.js +361 -0
- package/dist/commands/checks/get.js.map +1 -0
- package/dist/commands/checks/list.d.ts +18 -0
- package/dist/commands/checks/list.js +124 -0
- package/dist/commands/checks/list.js.map +1 -0
- package/dist/commands/checks/stats.d.ts +22 -0
- package/dist/commands/checks/stats.js +181 -0
- package/dist/commands/checks/stats.js.map +1 -0
- package/dist/commands/debug/parse-file.d.ts +13 -0
- package/dist/commands/debug/parse-file.js +74 -0
- package/dist/commands/debug/parse-file.js.map +1 -0
- package/dist/commands/debug/parse-playwright-config.d.ts +9 -0
- package/dist/commands/debug/parse-playwright-config.js +27 -0
- package/dist/commands/debug/parse-playwright-config.js.map +1 -0
- package/dist/commands/debug/parse-project.d.ts +43 -0
- package/dist/commands/debug/parse-project.js +187 -0
- package/dist/commands/debug/parse-project.js.map +1 -0
- package/dist/commands/deploy.d.ts +20 -0
- package/dist/commands/deploy.js +341 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/destroy.d.ts +12 -0
- package/dist/commands/destroy.js +76 -0
- package/dist/commands/destroy.js.map +1 -0
- package/dist/commands/env/add.d.ts +14 -0
- package/dist/commands/env/add.js +54 -0
- package/dist/commands/env/add.js.map +1 -0
- package/dist/commands/env/ls.d.ts +8 -0
- package/dist/commands/env/ls.js +20 -0
- package/dist/commands/env/ls.js.map +1 -0
- package/dist/commands/env/pull.d.ts +14 -0
- package/dist/commands/env/pull.js +72 -0
- package/dist/commands/env/pull.js.map +1 -0
- package/dist/commands/env/rm.d.ts +13 -0
- package/dist/commands/env/rm.js +46 -0
- package/dist/commands/env/rm.js.map +1 -0
- package/dist/commands/env/update.d.ts +15 -0
- package/dist/commands/env/update.js +55 -0
- package/dist/commands/env/update.js.map +1 -0
- package/dist/commands/help.d.ts +6 -0
- package/dist/commands/help.js +11 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/import/apply.d.ts +14 -0
- package/dist/commands/import/apply.js +125 -0
- package/dist/commands/import/apply.js.map +1 -0
- package/dist/commands/import/cancel.d.ts +12 -0
- package/dist/commands/import/cancel.js +91 -0
- package/dist/commands/import/cancel.js.map +1 -0
- package/dist/commands/import/commit.d.ts +14 -0
- package/dist/commands/import/commit.js +109 -0
- package/dist/commands/import/commit.js.map +1 -0
- package/dist/commands/import/plan.d.ts +23 -0
- package/dist/commands/import/plan.js +1273 -0
- package/dist/commands/import/plan.js.map +1 -0
- package/dist/commands/incidents/create.d.ts +17 -0
- package/dist/commands/incidents/create.js +102 -0
- package/dist/commands/incidents/create.js.map +1 -0
- package/dist/commands/incidents/list.d.ts +14 -0
- package/dist/commands/incidents/list.js +80 -0
- package/dist/commands/incidents/list.js.map +1 -0
- package/dist/commands/incidents/resolve.d.ts +16 -0
- package/dist/commands/incidents/resolve.js +78 -0
- package/dist/commands/incidents/resolve.js.map +1 -0
- package/dist/commands/incidents/update.d.ts +18 -0
- package/dist/commands/incidents/update.js +105 -0
- package/dist/commands/incidents/update.js.map +1 -0
- package/dist/commands/init.d.ts +23 -0
- package/dist/commands/init.js +273 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/login.d.ts +14 -0
- package/dist/commands/login.js +96 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +10 -0
- package/dist/commands/logout.js +38 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/members/delete.d.ts +18 -0
- package/dist/commands/members/delete.js +73 -0
- package/dist/commands/members/delete.js.map +1 -0
- package/dist/commands/members/update.d.ts +21 -0
- package/dist/commands/members/update.js +104 -0
- package/dist/commands/members/update.js.map +1 -0
- package/dist/commands/members.d.ts +23 -0
- package/dist/commands/members.js +136 -0
- package/dist/commands/members.js.map +1 -0
- package/dist/commands/pw-test.d.ts +34 -0
- package/dist/commands/pw-test.js +378 -0
- package/dist/commands/pw-test.js.map +1 -0
- package/dist/commands/rca/get.d.ts +15 -0
- package/dist/commands/rca/get.js +69 -0
- package/dist/commands/rca/get.js.map +1 -0
- package/dist/commands/rca/run.d.ts +16 -0
- package/dist/commands/rca/run.js +113 -0
- package/dist/commands/rca/run.js.map +1 -0
- package/dist/commands/rules.d.ts +10 -0
- package/dist/commands/rules.js +127 -0
- package/dist/commands/rules.js.map +1 -0
- package/dist/commands/runtimes.d.ts +8 -0
- package/dist/commands/runtimes.js +25 -0
- package/dist/commands/runtimes.js.map +1 -0
- package/dist/commands/skills/index.d.ts +12 -0
- package/dist/commands/skills/index.js +108 -0
- package/dist/commands/skills/index.js.map +1 -0
- package/dist/commands/skills/install.d.ts +23 -0
- package/dist/commands/skills/install.js +203 -0
- package/dist/commands/skills/install.js.map +1 -0
- package/dist/commands/status-pages/get.d.ts +14 -0
- package/dist/commands/status-pages/get.js +48 -0
- package/dist/commands/status-pages/get.js.map +1 -0
- package/dist/commands/status-pages/list.d.ts +14 -0
- package/dist/commands/status-pages/list.js +82 -0
- package/dist/commands/status-pages/list.js.map +1 -0
- package/dist/commands/switch.d.ts +10 -0
- package/dist/commands/switch.js +53 -0
- package/dist/commands/switch.js.map +1 -0
- package/dist/commands/sync-playwright.d.ts +8 -0
- package/dist/commands/sync-playwright.js +53 -0
- package/dist/commands/sync-playwright.js.map +1 -0
- package/dist/commands/test-sessions/get.d.ts +21 -0
- package/dist/commands/test-sessions/get.js +121 -0
- package/dist/commands/test-sessions/get.js.map +1 -0
- package/dist/commands/test-sessions/list.d.ts +22 -0
- package/dist/commands/test-sessions/list.js +190 -0
- package/dist/commands/test-sessions/list.js.map +1 -0
- package/dist/commands/test.d.ts +37 -0
- package/dist/commands/test.js +390 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/trigger.d.ts +40 -0
- package/dist/commands/trigger.js +241 -0
- package/dist/commands/trigger.js.map +1 -0
- package/dist/commands/validate.d.ts +13 -0
- package/dist/commands/validate.js +81 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/commands/whoami.d.ts +8 -0
- package/dist/commands/whoami.js +22 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/config.d.ts +31 -0
- package/dist/config.js +4 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.d.ts +16 -0
- package/dist/constants.js +25 -0
- package/dist/constants.js.map +1 -0
- package/dist/constructs/agentic-check-codegen.d.ts +22 -0
- package/dist/constructs/agentic-check-codegen.js +58 -0
- package/dist/constructs/agentic-check-codegen.js.map +1 -0
- package/dist/constructs/agentic-check.d.ts +130 -0
- package/dist/constructs/agentic-check.js +100 -0
- package/dist/constructs/agentic-check.js.map +1 -0
- package/dist/constructs/alert-channel-codegen.d.ts +37 -0
- package/dist/constructs/alert-channel-codegen.js +96 -0
- package/dist/constructs/alert-channel-codegen.js.map +1 -0
- package/dist/constructs/alert-channel-subscription-codegen.d.ts +11 -0
- package/dist/constructs/alert-channel-subscription-codegen.js +20 -0
- package/dist/constructs/alert-channel-subscription-codegen.js.map +1 -0
- package/dist/constructs/alert-channel-subscription.d.ts +46 -0
- package/dist/constructs/alert-channel-subscription.js +45 -0
- package/dist/constructs/alert-channel-subscription.js.map +1 -0
- package/dist/constructs/alert-channel.d.ts +130 -0
- package/dist/constructs/alert-channel.js +103 -0
- package/dist/constructs/alert-channel.js.map +1 -0
- package/dist/constructs/alert-escalation-policy-codegen.d.ts +4 -0
- package/dist/constructs/alert-escalation-policy-codegen.js +55 -0
- package/dist/constructs/alert-escalation-policy-codegen.js.map +1 -0
- package/dist/constructs/alert-escalation-policy.d.ts +114 -0
- package/dist/constructs/alert-escalation-policy.js +62 -0
- package/dist/constructs/alert-escalation-policy.js.map +1 -0
- package/dist/constructs/api-assertion-codegen.d.ts +3 -0
- package/dist/constructs/api-assertion-codegen.js +19 -0
- package/dist/constructs/api-assertion-codegen.js.map +1 -0
- package/dist/constructs/api-assertion.d.ts +74 -0
- package/dist/constructs/api-assertion.js +81 -0
- package/dist/constructs/api-assertion.js.map +1 -0
- package/dist/constructs/api-check-bundle.d.ts +58 -0
- package/dist/constructs/api-check-bundle.js +30 -0
- package/dist/constructs/api-check-bundle.js.map +1 -0
- package/dist/constructs/api-check-codegen.d.ts +19 -0
- package/dist/constructs/api-check-codegen.js +83 -0
- package/dist/constructs/api-check-codegen.js.map +1 -0
- package/dist/constructs/api-check.d.ts +193 -0
- package/dist/constructs/api-check.js +219 -0
- package/dist/constructs/api-check.js.map +1 -0
- package/dist/constructs/api-request-codegen.d.ts +4 -0
- package/dist/constructs/api-request-codegen.js +64 -0
- package/dist/constructs/api-request-codegen.js.map +1 -0
- package/dist/constructs/api-request.d.ts +67 -0
- package/dist/constructs/api-request.js +2 -0
- package/dist/constructs/api-request.js.map +1 -0
- package/dist/constructs/browser-check-bundle.d.ts +59 -0
- package/dist/constructs/browser-check-bundle.js +27 -0
- package/dist/constructs/browser-check-bundle.js.map +1 -0
- package/dist/constructs/browser-check-codegen.d.ts +14 -0
- package/dist/constructs/browser-check-codegen.js +44 -0
- package/dist/constructs/browser-check-codegen.js.map +1 -0
- package/dist/constructs/browser-check.d.ts +129 -0
- package/dist/constructs/browser-check.js +169 -0
- package/dist/constructs/browser-check.js.map +1 -0
- package/dist/constructs/check-codegen.d.ts +74 -0
- package/dist/constructs/check-codegen.js +251 -0
- package/dist/constructs/check-codegen.js.map +1 -0
- package/dist/constructs/check-config.d.ts +2 -0
- package/dist/constructs/check-config.js +17 -0
- package/dist/constructs/check-config.js.map +1 -0
- package/dist/constructs/check-group-codegen.d.ts +46 -0
- package/dist/constructs/check-group-codegen.js +268 -0
- package/dist/constructs/check-group-codegen.js.map +1 -0
- package/dist/constructs/check-group-ref.d.ts +20 -0
- package/dist/constructs/check-group-ref.js +46 -0
- package/dist/constructs/check-group-ref.js.map +1 -0
- package/dist/constructs/check-group-v1.d.ts +304 -0
- package/dist/constructs/check-group-v1.js +254 -0
- package/dist/constructs/check-group-v1.js.map +1 -0
- package/dist/constructs/check-group-v2.d.ts +120 -0
- package/dist/constructs/check-group-v2.js +68 -0
- package/dist/constructs/check-group-v2.js.map +1 -0
- package/dist/constructs/check-group.d.ts +4 -0
- package/dist/constructs/check-group.js +5 -0
- package/dist/constructs/check-group.js.map +1 -0
- package/dist/constructs/check.d.ts +336 -0
- package/dist/constructs/check.js +234 -0
- package/dist/constructs/check.js.map +1 -0
- package/dist/constructs/construct-codegen.d.ts +39 -0
- package/dist/constructs/construct-codegen.js +95 -0
- package/dist/constructs/construct-codegen.js.map +1 -0
- package/dist/constructs/construct-diagnostics.d.ts +53 -0
- package/dist/constructs/construct-diagnostics.js +156 -0
- package/dist/constructs/construct-diagnostics.js.map +1 -0
- package/dist/constructs/construct.d.ts +142 -0
- package/dist/constructs/construct.js +120 -0
- package/dist/constructs/construct.js.map +1 -0
- package/dist/constructs/dashboard-bundle.d.ts +11 -0
- package/dist/constructs/dashboard-bundle.js +15 -0
- package/dist/constructs/dashboard-bundle.js.map +1 -0
- package/dist/constructs/dashboard-codegen.d.ts +29 -0
- package/dist/constructs/dashboard-codegen.js +104 -0
- package/dist/constructs/dashboard-codegen.js.map +1 -0
- package/dist/constructs/dashboard.d.ts +226 -0
- package/dist/constructs/dashboard.js +140 -0
- package/dist/constructs/dashboard.js.map +1 -0
- package/dist/constructs/diagnostics.d.ts +59 -0
- package/dist/constructs/diagnostics.js +71 -0
- package/dist/constructs/diagnostics.js.map +1 -0
- package/dist/constructs/dns-assertion-codegen.d.ts +3 -0
- package/dist/constructs/dns-assertion-codegen.js +26 -0
- package/dist/constructs/dns-assertion-codegen.js.map +1 -0
- package/dist/constructs/dns-assertion.d.ts +45 -0
- package/dist/constructs/dns-assertion.js +51 -0
- package/dist/constructs/dns-assertion.js.map +1 -0
- package/dist/constructs/dns-monitor-codegen.d.ts +13 -0
- package/dist/constructs/dns-monitor-codegen.js +34 -0
- package/dist/constructs/dns-monitor-codegen.js.map +1 -0
- package/dist/constructs/dns-monitor.d.ts +87 -0
- package/dist/constructs/dns-monitor.js +55 -0
- package/dist/constructs/dns-monitor.js.map +1 -0
- package/dist/constructs/dns-request-codegen.d.ts +4 -0
- package/dist/constructs/dns-request-codegen.js +28 -0
- package/dist/constructs/dns-request-codegen.js.map +1 -0
- package/dist/constructs/dns-request.d.ts +53 -0
- package/dist/constructs/dns-request.js +2 -0
- package/dist/constructs/dns-request.js.map +1 -0
- package/dist/constructs/email-alert-channel-codegen.d.ts +13 -0
- package/dist/constructs/email-alert-channel-codegen.js +34 -0
- package/dist/constructs/email-alert-channel-codegen.js.map +1 -0
- package/dist/constructs/email-alert-channel.d.ts +27 -0
- package/dist/constructs/email-alert-channel.js +37 -0
- package/dist/constructs/email-alert-channel.js.map +1 -0
- package/dist/constructs/engine.d.ts +40 -0
- package/dist/constructs/engine.js +23 -0
- package/dist/constructs/engine.js.map +1 -0
- package/dist/constructs/environment-variable.d.ts +21 -0
- package/dist/constructs/environment-variable.js +2 -0
- package/dist/constructs/environment-variable.js.map +1 -0
- package/dist/constructs/frequency-codegen.d.ts +8 -0
- package/dist/constructs/frequency-codegen.js +51 -0
- package/dist/constructs/frequency-codegen.js.map +1 -0
- package/dist/constructs/frequency.d.ts +62 -0
- package/dist/constructs/frequency.js +66 -0
- package/dist/constructs/frequency.js.map +1 -0
- package/dist/constructs/heartbeat-monitor-codegen.d.ts +11 -0
- package/dist/constructs/heartbeat-monitor-codegen.js +29 -0
- package/dist/constructs/heartbeat-monitor-codegen.js.map +1 -0
- package/dist/constructs/heartbeat-monitor.d.ts +40 -0
- package/dist/constructs/heartbeat-monitor.js +56 -0
- package/dist/constructs/heartbeat-monitor.js.map +1 -0
- package/dist/constructs/http-header.d.ts +18 -0
- package/dist/constructs/http-header.js +2 -0
- package/dist/constructs/http-header.js.map +1 -0
- package/dist/constructs/http-request.d.ts +2 -0
- package/dist/constructs/http-request.js +2 -0
- package/dist/constructs/http-request.js.map +1 -0
- package/dist/constructs/icmp-assertion-codegen.d.ts +3 -0
- package/dist/constructs/icmp-assertion-codegen.js +18 -0
- package/dist/constructs/icmp-assertion-codegen.js.map +1 -0
- package/dist/constructs/icmp-assertion.d.ts +56 -0
- package/dist/constructs/icmp-assertion.js +57 -0
- package/dist/constructs/icmp-assertion.js.map +1 -0
- package/dist/constructs/icmp-monitor-codegen.d.ts +13 -0
- package/dist/constructs/icmp-monitor-codegen.js +34 -0
- package/dist/constructs/icmp-monitor-codegen.js.map +1 -0
- package/dist/constructs/icmp-monitor.d.ts +83 -0
- package/dist/constructs/icmp-monitor.js +43 -0
- package/dist/constructs/icmp-monitor.js.map +1 -0
- package/dist/constructs/icmp-request-codegen.d.ts +4 -0
- package/dist/constructs/icmp-request-codegen.js +24 -0
- package/dist/constructs/icmp-request-codegen.js.map +1 -0
- package/dist/constructs/icmp-request.d.ts +37 -0
- package/dist/constructs/icmp-request.js +2 -0
- package/dist/constructs/icmp-request.js.map +1 -0
- package/dist/constructs/incident.d.ts +15 -0
- package/dist/constructs/incident.js +2 -0
- package/dist/constructs/incident.js.map +1 -0
- package/dist/constructs/incidentio-alert-channel-codegen.d.ts +13 -0
- package/dist/constructs/incidentio-alert-channel-codegen.js +85 -0
- package/dist/constructs/incidentio-alert-channel-codegen.js.map +1 -0
- package/dist/constructs/incidentio-alert-channel.d.ts +44 -0
- package/dist/constructs/incidentio-alert-channel.js +67 -0
- package/dist/constructs/incidentio-alert-channel.js.map +1 -0
- package/dist/constructs/index.d.ts +54 -0
- package/dist/constructs/index.js +55 -0
- package/dist/constructs/index.js.map +1 -0
- package/dist/constructs/internal/assertion-codegen.d.ts +11 -0
- package/dist/constructs/internal/assertion-codegen.js +144 -0
- package/dist/constructs/internal/assertion-codegen.js.map +1 -0
- package/dist/constructs/internal/assertion.d.ts +40 -0
- package/dist/constructs/internal/assertion.js +93 -0
- package/dist/constructs/internal/assertion.js.map +1 -0
- package/dist/constructs/internal/codegen/codegen.d.ts +9 -0
- package/dist/constructs/internal/codegen/codegen.js +16 -0
- package/dist/constructs/internal/codegen/codegen.js.map +1 -0
- package/dist/constructs/internal/codegen/context.d.ts +62 -0
- package/dist/constructs/internal/codegen/context.js +413 -0
- package/dist/constructs/internal/codegen/context.js.map +1 -0
- package/dist/constructs/internal/codegen/index.d.ts +4 -0
- package/dist/constructs/internal/codegen/index.js +5 -0
- package/dist/constructs/internal/codegen/index.js.map +1 -0
- package/dist/constructs/internal/codegen/safety.d.ts +2 -0
- package/dist/constructs/internal/codegen/safety.js +3 -0
- package/dist/constructs/internal/codegen/safety.js.map +1 -0
- package/dist/constructs/internal/codegen/snippet.d.ts +12 -0
- package/dist/constructs/internal/codegen/snippet.js +39 -0
- package/dist/constructs/internal/codegen/snippet.js.map +1 -0
- package/dist/constructs/internal/common-diagnostics.d.ts +21 -0
- package/dist/constructs/internal/common-diagnostics.js +84 -0
- package/dist/constructs/internal/common-diagnostics.js.map +1 -0
- package/dist/constructs/internal/sanitize.d.ts +15 -0
- package/dist/constructs/internal/sanitize.js +36 -0
- package/dist/constructs/internal/sanitize.js.map +1 -0
- package/dist/constructs/ip.d.ts +2 -0
- package/dist/constructs/ip.js +2 -0
- package/dist/constructs/ip.js.map +1 -0
- package/dist/constructs/key-value-pair-codegen.d.ts +4 -0
- package/dist/constructs/key-value-pair-codegen.js +35 -0
- package/dist/constructs/key-value-pair-codegen.js.map +1 -0
- package/dist/constructs/key-value-pair.d.ts +41 -0
- package/dist/constructs/key-value-pair.js +2 -0
- package/dist/constructs/key-value-pair.js.map +1 -0
- package/dist/constructs/maintenance-window-codegen.d.ts +14 -0
- package/dist/constructs/maintenance-window-codegen.js +53 -0
- package/dist/constructs/maintenance-window-codegen.js.map +1 -0
- package/dist/constructs/maintenance-window.d.ts +62 -0
- package/dist/constructs/maintenance-window.js +53 -0
- package/dist/constructs/maintenance-window.js.map +1 -0
- package/dist/constructs/monitor-codegen.d.ts +1 -0
- package/dist/constructs/monitor-codegen.js +2 -0
- package/dist/constructs/monitor-codegen.js.map +1 -0
- package/dist/constructs/monitor.d.ts +127 -0
- package/dist/constructs/monitor.js +17 -0
- package/dist/constructs/monitor.js.map +1 -0
- package/dist/constructs/msteams-alert-channel-codegen.d.ts +13 -0
- package/dist/constructs/msteams-alert-channel-codegen.js +71 -0
- package/dist/constructs/msteams-alert-channel-codegen.js.map +1 -0
- package/dist/constructs/msteams-alert-channel.d.ts +39 -0
- package/dist/constructs/msteams-alert-channel.js +162 -0
- package/dist/constructs/msteams-alert-channel.js.map +1 -0
- package/dist/constructs/multi-step-check-bundle.d.ts +47 -0
- package/dist/constructs/multi-step-check-bundle.js +21 -0
- package/dist/constructs/multi-step-check-bundle.js.map +1 -0
- package/dist/constructs/multi-step-check-codegen.d.ts +13 -0
- package/dist/constructs/multi-step-check-codegen.js +35 -0
- package/dist/constructs/multi-step-check-codegen.js.map +1 -0
- package/dist/constructs/multi-step-check.d.ts +75 -0
- package/dist/constructs/multi-step-check.js +121 -0
- package/dist/constructs/multi-step-check.js.map +1 -0
- package/dist/constructs/opsgenie-alert-channel-codegen.d.ts +16 -0
- package/dist/constructs/opsgenie-alert-channel-codegen.js +37 -0
- package/dist/constructs/opsgenie-alert-channel-codegen.js.map +1 -0
- package/dist/constructs/opsgenie-alert-channel.d.ts +46 -0
- package/dist/constructs/opsgenie-alert-channel.js +47 -0
- package/dist/constructs/opsgenie-alert-channel.js.map +1 -0
- package/dist/constructs/pagerduty-alert-channel-codegen.d.ts +15 -0
- package/dist/constructs/pagerduty-alert-channel-codegen.js +49 -0
- package/dist/constructs/pagerduty-alert-channel-codegen.js.map +1 -0
- package/dist/constructs/pagerduty-alert-channel.d.ts +40 -0
- package/dist/constructs/pagerduty-alert-channel.js +44 -0
- package/dist/constructs/pagerduty-alert-channel.js.map +1 -0
- package/dist/constructs/phone-call-alert-channel-codegen.d.ts +14 -0
- package/dist/constructs/phone-call-alert-channel-codegen.js +42 -0
- package/dist/constructs/phone-call-alert-channel-codegen.js.map +1 -0
- package/dist/constructs/phone-call-alert-channel.d.ts +34 -0
- package/dist/constructs/phone-call-alert-channel.js +42 -0
- package/dist/constructs/phone-call-alert-channel.js.map +1 -0
- package/dist/constructs/playwright-check-bundle.d.ts +63 -0
- package/dist/constructs/playwright-check-bundle.js +36 -0
- package/dist/constructs/playwright-check-bundle.js.map +1 -0
- package/dist/constructs/playwright-check.d.ts +193 -0
- package/dist/constructs/playwright-check.js +328 -0
- package/dist/constructs/playwright-check.js.map +1 -0
- package/dist/constructs/playwright-config-codegen.d.ts +4 -0
- package/dist/constructs/playwright-config-codegen.js +5 -0
- package/dist/constructs/playwright-config-codegen.js.map +1 -0
- package/dist/constructs/playwright-config.d.ts +52 -0
- package/dist/constructs/playwright-config.js +2 -0
- package/dist/constructs/playwright-config.js.map +1 -0
- package/dist/constructs/private-location-check-assignment-codegen.d.ts +10 -0
- package/dist/constructs/private-location-check-assignment-codegen.js +15 -0
- package/dist/constructs/private-location-check-assignment-codegen.js.map +1 -0
- package/dist/constructs/private-location-check-assignment.d.ts +30 -0
- package/dist/constructs/private-location-check-assignment.js +36 -0
- package/dist/constructs/private-location-check-assignment.js.map +1 -0
- package/dist/constructs/private-location-codegen.d.ts +15 -0
- package/dist/constructs/private-location-codegen.js +46 -0
- package/dist/constructs/private-location-codegen.js.map +1 -0
- package/dist/constructs/private-location-group-assignment-codegen.d.ts +10 -0
- package/dist/constructs/private-location-group-assignment-codegen.js +15 -0
- package/dist/constructs/private-location-group-assignment-codegen.js.map +1 -0
- package/dist/constructs/private-location-group-assignment.d.ts +31 -0
- package/dist/constructs/private-location-group-assignment.js +39 -0
- package/dist/constructs/private-location-group-assignment.js.map +1 -0
- package/dist/constructs/private-location.d.ts +66 -0
- package/dist/constructs/private-location.js +88 -0
- package/dist/constructs/private-location.js.map +1 -0
- package/dist/constructs/project-bundle.d.ts +30 -0
- package/dist/constructs/project-bundle.js +40 -0
- package/dist/constructs/project-bundle.js.map +1 -0
- package/dist/constructs/project.d.ts +61 -0
- package/dist/constructs/project.js +127 -0
- package/dist/constructs/project.js.map +1 -0
- package/dist/constructs/query-param.d.ts +18 -0
- package/dist/constructs/query-param.js +2 -0
- package/dist/constructs/query-param.js.map +1 -0
- package/dist/constructs/ref-codegen.d.ts +3 -0
- package/dist/constructs/ref-codegen.js +11 -0
- package/dist/constructs/ref-codegen.js.map +1 -0
- package/dist/constructs/ref.d.ts +49 -0
- package/dist/constructs/ref.js +54 -0
- package/dist/constructs/ref.js.map +1 -0
- package/dist/constructs/retry-strategy-codegen.d.ts +4 -0
- package/dist/constructs/retry-strategy-codegen.js +104 -0
- package/dist/constructs/retry-strategy-codegen.js.map +1 -0
- package/dist/constructs/retry-strategy.d.ts +196 -0
- package/dist/constructs/retry-strategy.js +110 -0
- package/dist/constructs/retry-strategy.js.map +1 -0
- package/dist/constructs/session.d.ts +67 -0
- package/dist/constructs/session.js +197 -0
- package/dist/constructs/session.js.map +1 -0
- package/dist/constructs/slack-alert-channel-codegen.d.ts +14 -0
- package/dist/constructs/slack-alert-channel-codegen.js +42 -0
- package/dist/constructs/slack-alert-channel-codegen.js.map +1 -0
- package/dist/constructs/slack-alert-channel.d.ts +27 -0
- package/dist/constructs/slack-alert-channel.js +41 -0
- package/dist/constructs/slack-alert-channel.js.map +1 -0
- package/dist/constructs/slack-app-alert-channel-codegen.d.ts +13 -0
- package/dist/constructs/slack-app-alert-channel-codegen.js +39 -0
- package/dist/constructs/slack-app-alert-channel-codegen.js.map +1 -0
- package/dist/constructs/slack-app-alert-channel.d.ts +31 -0
- package/dist/constructs/slack-app-alert-channel.js +38 -0
- package/dist/constructs/slack-app-alert-channel.js.map +1 -0
- package/dist/constructs/sms-alert-channel-codegen.d.ts +14 -0
- package/dist/constructs/sms-alert-channel-codegen.js +42 -0
- package/dist/constructs/sms-alert-channel-codegen.js.map +1 -0
- package/dist/constructs/sms-alert-channel.d.ts +33 -0
- package/dist/constructs/sms-alert-channel.js +41 -0
- package/dist/constructs/sms-alert-channel.js.map +1 -0
- package/dist/constructs/status-page-codegen.d.ts +23 -0
- package/dist/constructs/status-page-codegen.js +67 -0
- package/dist/constructs/status-page-codegen.js.map +1 -0
- package/dist/constructs/status-page-service-codegen.d.ts +12 -0
- package/dist/constructs/status-page-service-codegen.js +39 -0
- package/dist/constructs/status-page-service-codegen.js.map +1 -0
- package/dist/constructs/status-page-service.d.ts +43 -0
- package/dist/constructs/status-page-service.js +61 -0
- package/dist/constructs/status-page-service.js.map +1 -0
- package/dist/constructs/status-page.d.ts +72 -0
- package/dist/constructs/status-page.js +58 -0
- package/dist/constructs/status-page.js.map +1 -0
- package/dist/constructs/tcp-monitor-codegen.d.ts +15 -0
- package/dist/constructs/tcp-monitor-codegen.js +64 -0
- package/dist/constructs/tcp-monitor-codegen.js.map +1 -0
- package/dist/constructs/tcp-monitor.d.ts +155 -0
- package/dist/constructs/tcp-monitor.js +83 -0
- package/dist/constructs/tcp-monitor.js.map +1 -0
- package/dist/constructs/telegram-alert-channel-codegen.d.ts +13 -0
- package/dist/constructs/telegram-alert-channel-codegen.js +98 -0
- package/dist/constructs/telegram-alert-channel-codegen.js.map +1 -0
- package/dist/constructs/telegram-alert-channel.d.ts +44 -0
- package/dist/constructs/telegram-alert-channel.js +60 -0
- package/dist/constructs/telegram-alert-channel.js.map +1 -0
- package/dist/constructs/url-assertion-codegen.d.ts +3 -0
- package/dist/constructs/url-assertion-codegen.js +11 -0
- package/dist/constructs/url-assertion-codegen.js.map +1 -0
- package/dist/constructs/url-assertion.d.ts +60 -0
- package/dist/constructs/url-assertion.js +52 -0
- package/dist/constructs/url-assertion.js.map +1 -0
- package/dist/constructs/url-monitor-codegen.d.ts +13 -0
- package/dist/constructs/url-monitor-codegen.js +34 -0
- package/dist/constructs/url-monitor-codegen.js.map +1 -0
- package/dist/constructs/url-monitor.d.ts +151 -0
- package/dist/constructs/url-monitor.js +109 -0
- package/dist/constructs/url-monitor.js.map +1 -0
- package/dist/constructs/url-request-codegen.d.ts +4 -0
- package/dist/constructs/url-request-codegen.js +27 -0
- package/dist/constructs/url-request-codegen.js.map +1 -0
- package/dist/constructs/url-request.d.ts +65 -0
- package/dist/constructs/url-request.js +2 -0
- package/dist/constructs/url-request.js.map +1 -0
- package/dist/constructs/validator-error.d.ts +2 -0
- package/dist/constructs/validator-error.js +3 -0
- package/dist/constructs/validator-error.js.map +1 -0
- package/dist/constructs/webhook-alert-channel-codegen.d.ts +34 -0
- package/dist/constructs/webhook-alert-channel-codegen.js +147 -0
- package/dist/constructs/webhook-alert-channel-codegen.js.map +1 -0
- package/dist/constructs/webhook-alert-channel.d.ts +68 -0
- package/dist/constructs/webhook-alert-channel.js +59 -0
- package/dist/constructs/webhook-alert-channel.js.map +1 -0
- package/dist/formatters/account-members.d.ts +8 -0
- package/dist/formatters/account-members.js +115 -0
- package/dist/formatters/account-members.js.map +1 -0
- package/dist/formatters/account-plan.d.ts +16 -0
- package/dist/formatters/account-plan.js +320 -0
- package/dist/formatters/account-plan.js.map +1 -0
- package/dist/formatters/alert-channels.d.ts +15 -0
- package/dist/formatters/alert-channels.js +257 -0
- package/dist/formatters/alert-channels.js.map +1 -0
- package/dist/formatters/analytics.d.ts +8 -0
- package/dist/formatters/analytics.js +223 -0
- package/dist/formatters/analytics.js.map +1 -0
- package/dist/formatters/assets.d.ts +22 -0
- package/dist/formatters/assets.js +280 -0
- package/dist/formatters/assets.js.map +1 -0
- package/dist/formatters/batch-stats.d.ts +8 -0
- package/dist/formatters/batch-stats.js +184 -0
- package/dist/formatters/batch-stats.js.map +1 -0
- package/dist/formatters/check-result-detail.d.ts +12 -0
- package/dist/formatters/check-result-detail.js +651 -0
- package/dist/formatters/check-result-detail.js.map +1 -0
- package/dist/formatters/checks.d.ts +29 -0
- package/dist/formatters/checks.js +336 -0
- package/dist/formatters/checks.js.map +1 -0
- package/dist/formatters/incidents.d.ts +7 -0
- package/dist/formatters/incidents.js +172 -0
- package/dist/formatters/incidents.js.map +1 -0
- package/dist/formatters/rca.d.ts +42 -0
- package/dist/formatters/rca.js +156 -0
- package/dist/formatters/rca.js.map +1 -0
- package/dist/formatters/render.d.ts +47 -0
- package/dist/formatters/render.js +261 -0
- package/dist/formatters/render.js.map +1 -0
- package/dist/formatters/status-pages.d.ts +7 -0
- package/dist/formatters/status-pages.js +236 -0
- package/dist/formatters/status-pages.js.map +1 -0
- package/dist/formatters/test-sessions.d.ts +18 -0
- package/dist/formatters/test-sessions.js +341 -0
- package/dist/formatters/test-sessions.js.map +1 -0
- package/dist/help/examples.d.ts +6 -0
- package/dist/help/examples.js +20 -0
- package/dist/help/examples.js.map +1 -0
- package/dist/help/help-extension.d.ts +6 -0
- package/dist/help/help-extension.js +91 -0
- package/dist/help/help-extension.js.map +1 -0
- package/dist/help/skills.d.ts +7 -0
- package/dist/help/skills.js +20 -0
- package/dist/help/skills.js.map +1 -0
- package/dist/helpers/account-member-target.d.ts +14 -0
- package/dist/helpers/account-member-target.js +37 -0
- package/dist/helpers/account-member-target.js.map +1 -0
- package/dist/helpers/api-fields.d.ts +4 -0
- package/dist/helpers/api-fields.js +24 -0
- package/dist/helpers/api-fields.js.map +1 -0
- package/dist/helpers/cli-mode.d.ts +4 -0
- package/dist/helpers/cli-mode.js +62 -0
- package/dist/helpers/cli-mode.js.map +1 -0
- package/dist/helpers/command-preview.d.ts +24 -0
- package/dist/helpers/command-preview.js +50 -0
- package/dist/helpers/command-preview.js.map +1 -0
- package/dist/helpers/command-style.d.ts +21 -0
- package/dist/helpers/command-style.js +108 -0
- package/dist/helpers/command-style.js.map +1 -0
- package/dist/helpers/constants.d.ts +1 -0
- package/dist/helpers/constants.js +2 -0
- package/dist/helpers/constants.js.map +1 -0
- package/dist/helpers/content-range.d.ts +1 -0
- package/dist/helpers/content-range.js +7 -0
- package/dist/helpers/content-range.js.map +1 -0
- package/dist/helpers/flags.d.ts +11 -0
- package/dist/helpers/flags.js +45 -0
- package/dist/helpers/flags.js.map +1 -0
- package/dist/helpers/incidents.d.ts +15 -0
- package/dist/helpers/incidents.js +50 -0
- package/dist/helpers/incidents.js.map +1 -0
- package/dist/helpers/number.d.ts +3 -0
- package/dist/helpers/number.js +20 -0
- package/dist/helpers/number.js.map +1 -0
- package/dist/helpers/onboarding/boilerplate.d.ts +15 -0
- package/dist/helpers/onboarding/boilerplate.js +166 -0
- package/dist/helpers/onboarding/boilerplate.js.map +1 -0
- package/dist/helpers/onboarding/clipboard.d.ts +1 -0
- package/dist/helpers/onboarding/clipboard.js +28 -0
- package/dist/helpers/onboarding/clipboard.js.map +1 -0
- package/dist/helpers/onboarding/detect-project.d.ts +10 -0
- package/dist/helpers/onboarding/detect-project.js +31 -0
- package/dist/helpers/onboarding/detect-project.js.map +1 -0
- package/dist/helpers/onboarding/index.d.ts +7 -0
- package/dist/helpers/onboarding/index.js +8 -0
- package/dist/helpers/onboarding/index.js.map +1 -0
- package/dist/helpers/onboarding/messages.d.ts +5 -0
- package/dist/helpers/onboarding/messages.js +141 -0
- package/dist/helpers/onboarding/messages.js.map +1 -0
- package/dist/helpers/onboarding/prompt-display.d.ts +1 -0
- package/dist/helpers/onboarding/prompt-display.js +76 -0
- package/dist/helpers/onboarding/prompt-display.js.map +1 -0
- package/dist/helpers/onboarding/prompts-helpers.d.ts +2 -0
- package/dist/helpers/onboarding/prompts-helpers.js +11 -0
- package/dist/helpers/onboarding/prompts-helpers.js.map +1 -0
- package/dist/helpers/onboarding/skill-install.d.ts +10 -0
- package/dist/helpers/onboarding/skill-install.js +85 -0
- package/dist/helpers/onboarding/skill-install.js.map +1 -0
- package/dist/helpers/onboarding/template-prompt.d.ts +2 -0
- package/dist/helpers/onboarding/template-prompt.js +14 -0
- package/dist/helpers/onboarding/template-prompt.js.map +1 -0
- package/dist/helpers/recast-acorn-parser.d.ts +2 -0
- package/dist/helpers/recast-acorn-parser.js +22 -0
- package/dist/helpers/recast-acorn-parser.js.map +1 -0
- package/dist/helpers/result-assets.d.ts +54 -0
- package/dist/helpers/result-assets.js +305 -0
- package/dist/helpers/result-assets.js.map +1 -0
- package/dist/helpers/test-helper.d.ts +17 -0
- package/dist/helpers/test-helper.js +75 -0
- package/dist/helpers/test-helper.js.map +1 -0
- package/dist/helpers/wrap.d.ts +6 -0
- package/dist/helpers/wrap.js +49 -0
- package/dist/helpers/wrap.js.map +1 -0
- package/dist/helpers/write-config-helpers.d.ts +5 -0
- package/dist/helpers/write-config-helpers.js +55 -0
- package/dist/helpers/write-config-helpers.js.map +1 -0
- package/dist/hooks/command-not-found.d.ts +3 -0
- package/dist/hooks/command-not-found.js +22 -0
- package/dist/hooks/command-not-found.js.map +1 -0
- package/dist/hooks/parse-error.d.ts +3 -0
- package/dist/hooks/parse-error.js +15 -0
- package/dist/hooks/parse-error.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/loader/config.d.ts +3 -0
- package/dist/loader/config.js +8 -0
- package/dist/loader/config.js.map +1 -0
- package/dist/loader/index.d.ts +5 -0
- package/dist/loader/index.js +6 -0
- package/dist/loader/index.js.map +1 -0
- package/dist/loader/jiti.d.ts +28 -0
- package/dist/loader/jiti.js +76 -0
- package/dist/loader/jiti.js.map +1 -0
- package/dist/loader/loader.d.ts +43 -0
- package/dist/loader/loader.js +37 -0
- package/dist/loader/loader.js.map +1 -0
- package/dist/loader/match.d.ts +15 -0
- package/dist/loader/match.js +43 -0
- package/dist/loader/match.js.map +1 -0
- package/dist/loader/mixed.d.ts +7 -0
- package/dist/loader/mixed.js +36 -0
- package/dist/loader/mixed.js.map +1 -0
- package/dist/loader/native.d.ts +10 -0
- package/dist/loader/native.js +30 -0
- package/dist/loader/native.js.map +1 -0
- package/dist/messages/common-messages.d.ts +5 -0
- package/dist/messages/common-messages.js +7 -0
- package/dist/messages/common-messages.js.map +1 -0
- package/dist/playwright/playwright-config-loader.d.ts +1 -0
- package/dist/playwright/playwright-config-loader.js +26 -0
- package/dist/playwright/playwright-config-loader.js.map +1 -0
- package/dist/playwright/playwright-config-template.d.ts +8 -0
- package/dist/playwright/playwright-config-template.js +53 -0
- package/dist/playwright/playwright-config-template.js.map +1 -0
- package/dist/reporters/abstract-list.d.ts +57 -0
- package/dist/reporters/abstract-list.js +283 -0
- package/dist/reporters/abstract-list.js.map +1 -0
- package/dist/reporters/ci.d.ts +12 -0
- package/dist/reporters/ci.js +28 -0
- package/dist/reporters/ci.js.map +1 -0
- package/dist/reporters/dot.d.ts +10 -0
- package/dist/reporters/dot.js +26 -0
- package/dist/reporters/dot.js.map +1 -0
- package/dist/reporters/github.d.ts +32 -0
- package/dist/reporters/github.js +93 -0
- package/dist/reporters/github.js.map +1 -0
- package/dist/reporters/json.d.ts +26 -0
- package/dist/reporters/json.js +74 -0
- package/dist/reporters/json.js.map +1 -0
- package/dist/reporters/list.d.ts +15 -0
- package/dist/reporters/list.js +81 -0
- package/dist/reporters/list.js.map +1 -0
- package/dist/reporters/reporter.d.ts +25 -0
- package/dist/reporters/reporter.js +22 -0
- package/dist/reporters/reporter.js.map +1 -0
- package/dist/reporters/util.d.ts +20 -0
- package/dist/reporters/util.js +596 -0
- package/dist/reporters/util.js.map +1 -0
- package/dist/rest/account-members.d.ts +56 -0
- package/dist/rest/account-members.js +18 -0
- package/dist/rest/account-members.js.map +1 -0
- package/dist/rest/accounts.d.ts +20 -0
- package/dist/rest/accounts.js +14 -0
- package/dist/rest/accounts.js.map +1 -0
- package/dist/rest/alert-channels.d.ts +52 -0
- package/dist/rest/alert-channels.js +23 -0
- package/dist/rest/alert-channels.js.map +1 -0
- package/dist/rest/alert-notifications.d.ts +39 -0
- package/dist/rest/alert-notifications.js +19 -0
- package/dist/rest/alert-notifications.js.map +1 -0
- package/dist/rest/analytics.d.ts +41 -0
- package/dist/rest/analytics.js +60 -0
- package/dist/rest/analytics.js.map +1 -0
- package/dist/rest/api.d.ts +67 -0
- package/dist/rest/api.js +121 -0
- package/dist/rest/api.js.map +1 -0
- package/dist/rest/asset-manifests.d.ts +30 -0
- package/dist/rest/asset-manifests.js +29 -0
- package/dist/rest/asset-manifests.js.map +1 -0
- package/dist/rest/assets.d.ts +64 -0
- package/dist/rest/assets.js +90 -0
- package/dist/rest/assets.js.map +1 -0
- package/dist/rest/batch-analytics.d.ts +25 -0
- package/dist/rest/batch-analytics.js +14 -0
- package/dist/rest/batch-analytics.js.map +1 -0
- package/dist/rest/cancel.d.ts +14 -0
- package/dist/rest/cancel.js +28 -0
- package/dist/rest/cancel.js.map +1 -0
- package/dist/rest/check-groups.d.ts +16 -0
- package/dist/rest/check-groups.js +11 -0
- package/dist/rest/check-groups.js.map +1 -0
- package/dist/rest/check-results.d.ts +183 -0
- package/dist/rest/check-results.js +14 -0
- package/dist/rest/check-results.js.map +1 -0
- package/dist/rest/check-statuses.d.ts +23 -0
- package/dist/rest/check-statuses.js +20 -0
- package/dist/rest/check-statuses.js.map +1 -0
- package/dist/rest/checkly-storage.d.ts +14 -0
- package/dist/rest/checkly-storage.js +17 -0
- package/dist/rest/checkly-storage.js.map +1 -0
- package/dist/rest/checks.d.ts +48 -0
- package/dist/rest/checks.js +43 -0
- package/dist/rest/checks.js.map +1 -0
- package/dist/rest/entitlements.d.ts +47 -0
- package/dist/rest/entitlements.js +11 -0
- package/dist/rest/entitlements.js.map +1 -0
- package/dist/rest/environment-variables.d.ts +43 -0
- package/dist/rest/environment-variables.js +91 -0
- package/dist/rest/environment-variables.js.map +1 -0
- package/dist/rest/error-groups.d.ts +49 -0
- package/dist/rest/error-groups.js +14 -0
- package/dist/rest/error-groups.js.map +1 -0
- package/dist/rest/errors.d.ts +84 -0
- package/dist/rest/errors.js +216 -0
- package/dist/rest/errors.js.map +1 -0
- package/dist/rest/heartbeat-checks.d.ts +11 -0
- package/dist/rest/heartbeat-checks.js +16 -0
- package/dist/rest/heartbeat-checks.js.map +1 -0
- package/dist/rest/incidents.d.ts +60 -0
- package/dist/rest/incidents.js +28 -0
- package/dist/rest/incidents.js.map +1 -0
- package/dist/rest/locations.d.ts +11 -0
- package/dist/rest/locations.js +11 -0
- package/dist/rest/locations.js.map +1 -0
- package/dist/rest/private-locations.d.ts +10 -0
- package/dist/rest/private-locations.js +10 -0
- package/dist/rest/private-locations.js.map +1 -0
- package/dist/rest/projects.d.ts +161 -0
- package/dist/rest/projects.js +205 -0
- package/dist/rest/projects.js.map +1 -0
- package/dist/rest/rca.d.ts +14 -0
- package/dist/rest/rca.js +28 -0
- package/dist/rest/rca.js.map +1 -0
- package/dist/rest/runtimes.d.ts +9 -0
- package/dist/rest/runtimes.js +16 -0
- package/dist/rest/runtimes.js.map +1 -0
- package/dist/rest/status-pages.d.ts +40 -0
- package/dist/rest/status-pages.js +16 -0
- package/dist/rest/status-pages.js.map +1 -0
- package/dist/rest/test-session-error-groups.d.ts +18 -0
- package/dist/rest/test-session-error-groups.js +11 -0
- package/dist/rest/test-session-error-groups.js.map +1 -0
- package/dist/rest/test-sessions.d.ts +167 -0
- package/dist/rest/test-sessions.js +76 -0
- package/dist/rest/test-sessions.js.map +1 -0
- package/dist/rest/users.d.ts +12 -0
- package/dist/rest/users.js +11 -0
- package/dist/rest/users.js.map +1 -0
- package/dist/rest/util.d.ts +3 -0
- package/dist/rest/util.js +10 -0
- package/dist/rest/util.js.map +1 -0
- package/dist/runtimes/index.d.ts +2 -0
- package/dist/runtimes/index.js +2 -0
- package/dist/runtimes/index.js.map +1 -0
- package/dist/runtimes/runtime.d.ts +8 -0
- package/dist/runtimes/runtime.js +2 -0
- package/dist/runtimes/runtime.js.map +1 -0
- package/dist/runtimes/snapshot.d.ts +2 -0
- package/dist/runtimes/snapshot.js +11 -0
- package/dist/runtimes/snapshot.js.map +1 -0
- package/dist/services/abstract-check-runner.d.ts +63 -0
- package/dist/services/abstract-check-runner.js +289 -0
- package/dist/services/abstract-check-runner.js.map +1 -0
- package/dist/services/check-parser/bundler.d.ts +58 -0
- package/dist/services/check-parser/bundler.js +219 -0
- package/dist/services/check-parser/bundler.js.map +1 -0
- package/dist/services/check-parser/cache-hash.d.ts +79 -0
- package/dist/services/check-parser/cache-hash.js +179 -0
- package/dist/services/check-parser/cache-hash.js.map +1 -0
- package/dist/services/check-parser/collector.d.ts +33 -0
- package/dist/services/check-parser/collector.js +46 -0
- package/dist/services/check-parser/collector.js.map +1 -0
- package/dist/services/check-parser/errors.d.ts +8 -0
- package/dist/services/check-parser/errors.js +46 -0
- package/dist/services/check-parser/errors.js.map +1 -0
- package/dist/services/check-parser/faux-package.d.ts +4 -0
- package/dist/services/check-parser/faux-package.js +16 -0
- package/dist/services/check-parser/faux-package.js.map +1 -0
- package/dist/services/check-parser/package-files/extension.d.ts +38 -0
- package/dist/services/check-parser/package-files/extension.js +66 -0
- package/dist/services/check-parser/package-files/extension.js.map +1 -0
- package/dist/services/check-parser/package-files/jsconfig-json-file.d.ts +17 -0
- package/dist/services/check-parser/package-files/jsconfig-json-file.js +23 -0
- package/dist/services/check-parser/package-files/jsconfig-json-file.js.map +1 -0
- package/dist/services/check-parser/package-files/json-source-file.d.ts +11 -0
- package/dist/services/check-parser/package-files/json-source-file.js +32 -0
- package/dist/services/check-parser/package-files/json-source-file.js.map +1 -0
- package/dist/services/check-parser/package-files/json-text-source-file-parser.d.ts +7 -0
- package/dist/services/check-parser/package-files/json-text-source-file-parser.js +47 -0
- package/dist/services/check-parser/package-files/json-text-source-file-parser.js.map +1 -0
- package/dist/services/check-parser/package-files/json-text-source-file.d.ts +7 -0
- package/dist/services/check-parser/package-files/json-text-source-file.js +18 -0
- package/dist/services/check-parser/package-files/json-text-source-file.js.map +1 -0
- package/dist/services/check-parser/package-files/loader.d.ts +7 -0
- package/dist/services/check-parser/package-files/loader.js +24 -0
- package/dist/services/check-parser/package-files/loader.js.map +1 -0
- package/dist/services/check-parser/package-files/lockfile-package-version.d.ts +85 -0
- package/dist/services/check-parser/package-files/lockfile-package-version.js +317 -0
- package/dist/services/check-parser/package-files/lockfile-package-version.js.map +1 -0
- package/dist/services/check-parser/package-files/lookup.d.ts +12 -0
- package/dist/services/check-parser/package-files/lookup.js +52 -0
- package/dist/services/check-parser/package-files/lookup.js.map +1 -0
- package/dist/services/check-parser/package-files/package-json-file.d.ts +59 -0
- package/dist/services/check-parser/package-files/package-json-file.js +248 -0
- package/dist/services/check-parser/package-files/package-json-file.js.map +1 -0
- package/dist/services/check-parser/package-files/package-manager.d.ts +222 -0
- package/dist/services/check-parser/package-files/package-manager.js +785 -0
- package/dist/services/check-parser/package-files/package-manager.js.map +1 -0
- package/dist/services/check-parser/package-files/paths.d.ts +98 -0
- package/dist/services/check-parser/package-files/paths.js +234 -0
- package/dist/services/check-parser/package-files/paths.js.map +1 -0
- package/dist/services/check-parser/package-files/resolver.d.ts +124 -0
- package/dist/services/check-parser/package-files/resolver.js +468 -0
- package/dist/services/check-parser/package-files/resolver.js.map +1 -0
- package/dist/services/check-parser/package-files/result.d.ts +38 -0
- package/dist/services/check-parser/package-files/result.js +53 -0
- package/dist/services/check-parser/package-files/result.js.map +1 -0
- package/dist/services/check-parser/package-files/source-file-parser.d.ts +10 -0
- package/dist/services/check-parser/package-files/source-file-parser.js +13 -0
- package/dist/services/check-parser/package-files/source-file-parser.js.map +1 -0
- package/dist/services/check-parser/package-files/source-file.d.ts +15 -0
- package/dist/services/check-parser/package-files/source-file.js +38 -0
- package/dist/services/check-parser/package-files/source-file.js.map +1 -0
- package/dist/services/check-parser/package-files/tsconfig-json-file.d.ts +66 -0
- package/dist/services/check-parser/package-files/tsconfig-json-file.js +81 -0
- package/dist/services/check-parser/package-files/tsconfig-json-file.js.map +1 -0
- package/dist/services/check-parser/package-files/walk.d.ts +8 -0
- package/dist/services/check-parser/package-files/walk.js +35 -0
- package/dist/services/check-parser/package-files/walk.js.map +1 -0
- package/dist/services/check-parser/package-files/workspace.d.ts +60 -0
- package/dist/services/check-parser/package-files/workspace.js +103 -0
- package/dist/services/check-parser/package-files/workspace.js.map +1 -0
- package/dist/services/check-parser/parser.d.ts +67 -0
- package/dist/services/check-parser/parser.js +491 -0
- package/dist/services/check-parser/parser.js.map +1 -0
- package/dist/services/check-parser/playwright-config-expander.d.ts +7 -0
- package/dist/services/check-parser/playwright-config-expander.js +96 -0
- package/dist/services/check-parser/playwright-config-expander.js.map +1 -0
- package/dist/services/checkly-config-codegen.d.ts +4 -0
- package/dist/services/checkly-config-codegen.js +189 -0
- package/dist/services/checkly-config-codegen.js.map +1 -0
- package/dist/services/checkly-config-loader.d.ts +97 -0
- package/dist/services/checkly-config-loader.js +113 -0
- package/dist/services/checkly-config-loader.js.map +1 -0
- package/dist/services/config.d.ts +28 -0
- package/dist/services/config.js +93 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/engine-detector.d.ts +6 -0
- package/dist/services/engine-detector.js +141 -0
- package/dist/services/engine-detector.js.map +1 -0
- package/dist/services/engine-resolver.d.ts +6 -0
- package/dist/services/engine-resolver.js +47 -0
- package/dist/services/engine-resolver.js.map +1 -0
- package/dist/services/engine-rules-loader.d.ts +21 -0
- package/dist/services/engine-rules-loader.js +44 -0
- package/dist/services/engine-rules-loader.js.map +1 -0
- package/dist/services/load-dotenv.d.ts +1 -0
- package/dist/services/load-dotenv.js +44 -0
- package/dist/services/load-dotenv.js.map +1 -0
- package/dist/services/playwright-config.d.ts +27 -0
- package/dist/services/playwright-config.js +139 -0
- package/dist/services/playwright-config.js.map +1 -0
- package/dist/services/playwright-project-bundler.d.ts +47 -0
- package/dist/services/playwright-project-bundler.js +380 -0
- package/dist/services/playwright-project-bundler.js.map +1 -0
- package/dist/services/project-parser.d.ts +30 -0
- package/dist/services/project-parser.js +291 -0
- package/dist/services/project-parser.js.map +1 -0
- package/dist/services/proxy.d.ts +2 -0
- package/dist/services/proxy.js +36 -0
- package/dist/services/proxy.js.map +1 -0
- package/dist/services/shell.d.ts +2 -0
- package/dist/services/shell.js +15 -0
- package/dist/services/shell.js.map +1 -0
- package/dist/services/snapshot-service.d.ts +13 -0
- package/dist/services/snapshot-service.js +56 -0
- package/dist/services/snapshot-service.js.map +1 -0
- package/dist/services/socket-client.d.ts +4 -0
- package/dist/services/socket-client.js +58 -0
- package/dist/services/socket-client.js.map +1 -0
- package/dist/services/test-filters.d.ts +3 -0
- package/dist/services/test-filters.js +21 -0
- package/dist/services/test-filters.js.map +1 -0
- package/dist/services/test-runner.d.ts +28 -0
- package/dist/services/test-runner.js +82 -0
- package/dist/services/test-runner.js.map +1 -0
- package/dist/services/trigger-runner.d.ts +29 -0
- package/dist/services/trigger-runner.js +49 -0
- package/dist/services/trigger-runner.js.map +1 -0
- package/dist/services/util.d.ts +34 -0
- package/dist/services/util.js +167 -0
- package/dist/services/util.js.map +1 -0
- package/dist/sourcegen/args.d.ts +7 -0
- package/dist/sourcegen/args.js +22 -0
- package/dist/sourcegen/args.js.map +1 -0
- package/dist/sourcegen/argsbuilder.d.ts +22 -0
- package/dist/sourcegen/argsbuilder.js +106 -0
- package/dist/sourcegen/argsbuilder.js.map +1 -0
- package/dist/sourcegen/array.d.ts +8 -0
- package/dist/sourcegen/array.js +28 -0
- package/dist/sourcegen/array.js.map +1 -0
- package/dist/sourcegen/arraybuilder.d.ts +21 -0
- package/dist/sourcegen/arraybuilder.js +104 -0
- package/dist/sourcegen/arraybuilder.js.map +1 -0
- package/dist/sourcegen/boolean.d.ts +7 -0
- package/dist/sourcegen/boolean.js +18 -0
- package/dist/sourcegen/boolean.js.map +1 -0
- package/dist/sourcegen/case.d.ts +9 -0
- package/dist/sourcegen/case.js +96 -0
- package/dist/sourcegen/case.js.map +1 -0
- package/dist/sourcegen/comment.d.ts +32 -0
- package/dist/sourcegen/comment.js +113 -0
- package/dist/sourcegen/comment.js.map +1 -0
- package/dist/sourcegen/decl.d.ts +43 -0
- package/dist/sourcegen/decl.js +86 -0
- package/dist/sourcegen/decl.js.map +1 -0
- package/dist/sourcegen/declbuilder.d.ts +14 -0
- package/dist/sourcegen/declbuilder.js +34 -0
- package/dist/sourcegen/declbuilder.js.map +1 -0
- package/dist/sourcegen/expr.d.ts +39 -0
- package/dist/sourcegen/expr.js +77 -0
- package/dist/sourcegen/expr.js.map +1 -0
- package/dist/sourcegen/exprbuilder.d.ts +13 -0
- package/dist/sourcegen/exprbuilder.js +49 -0
- package/dist/sourcegen/exprbuilder.js.map +1 -0
- package/dist/sourcegen/identifier.d.ts +12 -0
- package/dist/sourcegen/identifier.js +22 -0
- package/dist/sourcegen/identifier.js.map +1 -0
- package/dist/sourcegen/index.d.ts +22 -0
- package/dist/sourcegen/index.js +23 -0
- package/dist/sourcegen/index.js.map +1 -0
- package/dist/sourcegen/null.d.ts +5 -0
- package/dist/sourcegen/null.js +7 -0
- package/dist/sourcegen/null.js.map +1 -0
- package/dist/sourcegen/number.d.ts +7 -0
- package/dist/sourcegen/number.js +18 -0
- package/dist/sourcegen/number.js.map +1 -0
- package/dist/sourcegen/object.d.ts +28 -0
- package/dist/sourcegen/object.js +80 -0
- package/dist/sourcegen/object.js.map +1 -0
- package/dist/sourcegen/objectbuilder.d.ts +25 -0
- package/dist/sourcegen/objectbuilder.js +122 -0
- package/dist/sourcegen/objectbuilder.js.map +1 -0
- package/dist/sourcegen/output.d.ts +14 -0
- package/dist/sourcegen/output.js +81 -0
- package/dist/sourcegen/output.js.map +1 -0
- package/dist/sourcegen/program.d.ts +53 -0
- package/dist/sourcegen/program.js +254 -0
- package/dist/sourcegen/program.js.map +1 -0
- package/dist/sourcegen/string.d.ts +8 -0
- package/dist/sourcegen/string.js +23 -0
- package/dist/sourcegen/string.js.map +1 -0
- package/dist/sourcegen/undefined.d.ts +5 -0
- package/dist/sourcegen/undefined.js +7 -0
- package/dist/sourcegen/undefined.js.map +1 -0
- package/dist/sourcegen/unknown.d.ts +2 -0
- package/dist/sourcegen/unknown.js +36 -0
- package/dist/sourcegen/unknown.js.map +1 -0
- package/dist/sourcegen/value.d.ts +4 -0
- package/dist/sourcegen/value.js +3 -0
- package/dist/sourcegen/value.js.map +1 -0
- package/dist/testing/fixture-sandbox.d.ts +41 -0
- package/dist/testing/fixture-sandbox.js +122 -0
- package/dist/testing/fixture-sandbox.js.map +1 -0
- package/dist/testing/global-setup.d.ts +2 -0
- package/dist/testing/global-setup.js +14 -0
- package/dist/testing/global-setup.js.map +1 -0
- package/dist/util/index.d.ts +9 -0
- package/dist/util/index.js +23 -0
- package/dist/util/index.js.map +1 -0
- package/oclif.manifest.json +3702 -0
- package/package.json +166 -0
|
@@ -0,0 +1,1273 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { setTimeout } from 'node:timers/promises';
|
|
4
|
+
import { Args, Flags } from '@oclif/core';
|
|
5
|
+
import prompts from 'prompts';
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import logSymbols from 'log-symbols';
|
|
8
|
+
import { validate as validateUuid } from 'uuid';
|
|
9
|
+
import { execa } from 'execa';
|
|
10
|
+
import { LOGICAL_ID_PATTERN } from '../../constants.js';
|
|
11
|
+
import * as api from '../../rest/api.js';
|
|
12
|
+
import { AuthCommand } from '../authCommand.js';
|
|
13
|
+
import commonMessages from '../../messages/common-messages.js';
|
|
14
|
+
import { splitConfigFilePath } from '../../services/util.js';
|
|
15
|
+
import { ConfigNotFoundError, loadChecklyConfig } from '../../services/checkly-config-loader.js';
|
|
16
|
+
import { ProjectNotFoundError, NoImportableResourcesFoundError } from '../../rest/projects.js';
|
|
17
|
+
import { cased, docComment, Program } from '../../sourcegen/index.js';
|
|
18
|
+
import { ConstructCodegen, sortResources } from '../../constructs/construct-codegen.js';
|
|
19
|
+
import { Context } from '../../constructs/internal/codegen/index.js';
|
|
20
|
+
import { isSnippet, isSafeSnippetFilename, } from '../../constructs/internal/codegen/snippet.js';
|
|
21
|
+
import { ExitError } from '@oclif/core/errors';
|
|
22
|
+
import { confirmCommit, performCommitAction } from './commit.js';
|
|
23
|
+
import { confirmApply, performApplyAction } from './apply.js';
|
|
24
|
+
import { generateChecklyConfig } from '../../services/checkly-config-codegen.js';
|
|
25
|
+
import { PackageJsonFile } from '../../services/check-parser/package-files/package-json-file.js';
|
|
26
|
+
import { detectNearestPackageJson, detectPackageManager, knownPackageManagers } from '../../services/check-parser/package-files/package-manager.js';
|
|
27
|
+
import { parseProject } from '../../services/project-parser.js';
|
|
28
|
+
import { Session } from '../../constructs/session.js';
|
|
29
|
+
import { Diagnostics } from '../../constructs/index.js';
|
|
30
|
+
export default class ImportPlanCommand extends AuthCommand {
|
|
31
|
+
static hidden = false;
|
|
32
|
+
static readOnly = true;
|
|
33
|
+
static idempotent = true;
|
|
34
|
+
static description = `\
|
|
35
|
+
Import existing resources from your Checkly account to your project.
|
|
36
|
+
|
|
37
|
+
By default, all resources that can be imported will be imported. However, you
|
|
38
|
+
may fine-tune the process by including or excluding any combination of
|
|
39
|
+
resources.
|
|
40
|
+
|
|
41
|
+
The import process consists of three steps:
|
|
42
|
+
|
|
43
|
+
1. Creating a plan, which generates the appropriate code for your resources
|
|
44
|
+
2. Applying the plan, which links your resources to the generated code
|
|
45
|
+
3. Committing the plan, which finalizes the import session
|
|
46
|
+
|
|
47
|
+
CREATING A PLAN
|
|
48
|
+
|
|
49
|
+
Creating a plan carries no risk as no concrete links to your Checkly resources
|
|
50
|
+
are made at this point. However, if you accidentally deploy the generated code
|
|
51
|
+
before applying the plan, you will end up with duplicate resources and will
|
|
52
|
+
not be able to complete the import session without first deleting the
|
|
53
|
+
duplicates.
|
|
54
|
+
|
|
55
|
+
For the curious, you may also preview the generated code with the '--preview'
|
|
56
|
+
option. No plan will be created, allowing you to leisurely inspect the
|
|
57
|
+
generated code. However keep in mind that you will need to create a plan to
|
|
58
|
+
actually import any resources, at which point the code will be generated
|
|
59
|
+
again.
|
|
60
|
+
|
|
61
|
+
You may cancel any plan you've created without affecting any of the
|
|
62
|
+
underlying resources.
|
|
63
|
+
|
|
64
|
+
APPLYING A PLAN
|
|
65
|
+
|
|
66
|
+
Applying a plan links your existing resources to the generated code. You
|
|
67
|
+
should carefully review the generated code to make sure that it contains the
|
|
68
|
+
resources you expect before applying a plan. After a plan has been applied,
|
|
69
|
+
any deployments of those resources will irreversibly modify the underlying
|
|
70
|
+
Checkly resources. However, as a fail safe against concurrent use, any
|
|
71
|
+
deployments not including the imported resources will not delete the
|
|
72
|
+
underlying resources (or the links to the resources). This means that there
|
|
73
|
+
is no need to block deployments while working on an import session.
|
|
74
|
+
|
|
75
|
+
Even after you've applied a plan, you may still cancel it, which will unlink
|
|
76
|
+
the underlying resources from your project once more. However, keep in mind
|
|
77
|
+
that any changes to the resources that you've already deployed cannot be
|
|
78
|
+
undone.
|
|
79
|
+
|
|
80
|
+
COMMITTING A PLAN
|
|
81
|
+
|
|
82
|
+
Finally, committing a plan removes all fail safes and permanently links the
|
|
83
|
+
imported resources to your project. Any resources you remove from your code
|
|
84
|
+
will result in the underlying resources also getting irrevocably deleted on
|
|
85
|
+
the next deploy. You should only commit your plan once you are sure that all
|
|
86
|
+
future deployments include the imported resources.`;
|
|
87
|
+
static flags = {
|
|
88
|
+
'config': Flags.string({
|
|
89
|
+
char: 'c',
|
|
90
|
+
description: commonMessages.configFile,
|
|
91
|
+
}),
|
|
92
|
+
'root': Flags.string({
|
|
93
|
+
description: 'The root folder in which to write generated code files.',
|
|
94
|
+
default: '__checks__',
|
|
95
|
+
}),
|
|
96
|
+
'preview': Flags.boolean({
|
|
97
|
+
description: 'Preview generated code without creating an actual import plan.',
|
|
98
|
+
default: false,
|
|
99
|
+
}),
|
|
100
|
+
'debug-import-plan': Flags.boolean({
|
|
101
|
+
description: 'Output the import plan to a file.',
|
|
102
|
+
default: false,
|
|
103
|
+
hidden: true,
|
|
104
|
+
}),
|
|
105
|
+
'debug-import-plan-input-file': Flags.string({
|
|
106
|
+
description: 'A file to load an import plan from.',
|
|
107
|
+
hidden: true,
|
|
108
|
+
}),
|
|
109
|
+
'debug-import-plan-output-file': Flags.string({
|
|
110
|
+
description: 'The file to output the import plan to.',
|
|
111
|
+
default: './debug-import-plan.json',
|
|
112
|
+
hidden: true,
|
|
113
|
+
}),
|
|
114
|
+
};
|
|
115
|
+
static args = {
|
|
116
|
+
resource: Args.string({
|
|
117
|
+
name: 'resource',
|
|
118
|
+
required: false,
|
|
119
|
+
description: 'A specific resource to import.',
|
|
120
|
+
}),
|
|
121
|
+
};
|
|
122
|
+
static strict = false;
|
|
123
|
+
static hiddenAliases = [
|
|
124
|
+
'import',
|
|
125
|
+
];
|
|
126
|
+
async run() {
|
|
127
|
+
const { flags, argv } = await this.parse(ImportPlanCommand);
|
|
128
|
+
const { config: configFilename, root: rootDirectory, 'debug-import-plan': debugImportPlan, 'debug-import-plan-input-file': debugImportPlanInputFile, 'debug-import-plan-output-file': debugImportPlanOutputFile, preview, } = flags;
|
|
129
|
+
const filters = argv.map(value => {
|
|
130
|
+
return parseFilter(value);
|
|
131
|
+
});
|
|
132
|
+
const createProgram = () => {
|
|
133
|
+
return new Program({
|
|
134
|
+
rootDirectory,
|
|
135
|
+
constructFileSuffix: '.check',
|
|
136
|
+
constructHeaders: preview ? [previewComment()] : undefined,
|
|
137
|
+
specFileSuffix: '.spec',
|
|
138
|
+
language: 'typescript',
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
const friendExports = {
|
|
142
|
+
'alert-channel': new Map(),
|
|
143
|
+
'check-group': new Map(),
|
|
144
|
+
'private-location': new Map(),
|
|
145
|
+
'status-page-service': new Map(),
|
|
146
|
+
};
|
|
147
|
+
if (debugImportPlanInputFile) {
|
|
148
|
+
const plan = await (async () => {
|
|
149
|
+
this.style.actionStart('Loading debug import plan');
|
|
150
|
+
try {
|
|
151
|
+
const input = await fs.readFile(debugImportPlanInputFile, {
|
|
152
|
+
encoding: 'utf8',
|
|
153
|
+
});
|
|
154
|
+
const plan = JSON.parse(input);
|
|
155
|
+
this.style.actionSuccess();
|
|
156
|
+
return plan;
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
this.style.actionFailure();
|
|
160
|
+
throw err;
|
|
161
|
+
}
|
|
162
|
+
})();
|
|
163
|
+
this.style.shortSuccess(`Successfully loaded debug import plan from "${debugImportPlanInputFile}".`);
|
|
164
|
+
const program = createProgram();
|
|
165
|
+
const codegen = new ConstructCodegen(program);
|
|
166
|
+
const { failures } = this.#generateCode(plan, program, codegen, friendExports);
|
|
167
|
+
if (failures.length) {
|
|
168
|
+
this.#outputFailures(failures, codegen);
|
|
169
|
+
this.style.shortError(`Unable to continue due to failed resources.`);
|
|
170
|
+
this.exit(1);
|
|
171
|
+
}
|
|
172
|
+
this.style.actionStart('Writing files');
|
|
173
|
+
try {
|
|
174
|
+
await program.realize();
|
|
175
|
+
this.style.actionSuccess();
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
this.style.actionFailure();
|
|
179
|
+
throw err;
|
|
180
|
+
}
|
|
181
|
+
this.style.longSuccess(`Debug import plan has been created!`, `You can find the generated code under the following directory:`
|
|
182
|
+
+ `\n\n`
|
|
183
|
+
+ ` ${chalk.green(rootDirectory)}`);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
this.style.shortInfo(`You are about to import resources from your Checkly account.`);
|
|
187
|
+
this.style.comment(`Please make sure to commit any unsaved changes to avoid having any `
|
|
188
|
+
+ `local changes get overwritten by generated code.`);
|
|
189
|
+
const { configDirectory, configFilenames } = splitConfigFilePath(configFilename);
|
|
190
|
+
const checklyConfig = await this.#loadConfig(configDirectory, configFilenames)
|
|
191
|
+
?? await this.#interactiveCreateConfig(configDirectory);
|
|
192
|
+
await this.#initializeProject(checklyConfig);
|
|
193
|
+
const constructExports = await this.#findExportedResources(configDirectory, checklyConfig, rootDirectory);
|
|
194
|
+
const friends = [];
|
|
195
|
+
for (const constructExport of constructExports) {
|
|
196
|
+
const { type, logicalId } = constructExport;
|
|
197
|
+
const friendExport = friendExports[type];
|
|
198
|
+
if (friendExport === undefined) {
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
friendExport.set(logicalId, constructExport);
|
|
202
|
+
friends.push({
|
|
203
|
+
type,
|
|
204
|
+
logicalId,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
const { logicalId, } = checklyConfig;
|
|
208
|
+
if (!preview) {
|
|
209
|
+
const { data: existingPlans } = await api.projects.findImportPlans(logicalId, {
|
|
210
|
+
onlyUncommitted: true,
|
|
211
|
+
});
|
|
212
|
+
if (existingPlans.length !== 0) {
|
|
213
|
+
await this.#handleExistingPlans(existingPlans);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
// These are needed for the interactive filter creation for now. Ideally
|
|
217
|
+
// we'd remove these.
|
|
218
|
+
const program = createProgram();
|
|
219
|
+
const codegen = new ConstructCodegen(program);
|
|
220
|
+
// If the user provided no filter, ask interactively.
|
|
221
|
+
if (filters.length === 0) {
|
|
222
|
+
filters.push(...await this.#interactiveFilter(logicalId, codegen));
|
|
223
|
+
}
|
|
224
|
+
// Inject the default filter.
|
|
225
|
+
//
|
|
226
|
+
// By default all resource will be included, unless the user has specified
|
|
227
|
+
// an inclusive filter by themselves, in which case the default filter
|
|
228
|
+
// excludes all resources.
|
|
229
|
+
filters.unshift({
|
|
230
|
+
type: filters.some(({ type }) => type === 'include') ? 'exclude' : 'include',
|
|
231
|
+
});
|
|
232
|
+
while (true) {
|
|
233
|
+
// Recreate program on every attempt as otherwise resources from earlier
|
|
234
|
+
// runs will persist.
|
|
235
|
+
const program = createProgram();
|
|
236
|
+
const codegen = new ConstructCodegen(program);
|
|
237
|
+
const plan = await this.#createImportPlan(logicalId, {
|
|
238
|
+
preview,
|
|
239
|
+
filters,
|
|
240
|
+
friends,
|
|
241
|
+
});
|
|
242
|
+
if (!plan) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (debugImportPlan) {
|
|
246
|
+
const output = JSON.stringify(plan, null, 2);
|
|
247
|
+
await fs.writeFile(debugImportPlanOutputFile, output, 'utf8');
|
|
248
|
+
this.style.shortSuccess(`Successfully wrote debug import plan to "${debugImportPlanOutputFile}".`);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
try {
|
|
252
|
+
const { failures } = this.#generateCode(plan, program, codegen, friendExports);
|
|
253
|
+
if (failures.length) {
|
|
254
|
+
const excludeFailed = this.#outputFailures(failures, codegen);
|
|
255
|
+
// Proactively exclude failed resources. If the user wants to
|
|
256
|
+
// retry they'll already be in the filter list, and otherwise the
|
|
257
|
+
// filters will simply not get used.
|
|
258
|
+
filters.push(...excludeFailed);
|
|
259
|
+
const retry = await this.#confirmRetryWithoutFailed();
|
|
260
|
+
if (!retry) {
|
|
261
|
+
this.cancelAndExit();
|
|
262
|
+
}
|
|
263
|
+
// When previewing, there is no plan to cancel.
|
|
264
|
+
if (preview) {
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
this.style.comment(`The current plan will be cancelled so that a new plan can be created.`);
|
|
268
|
+
this.style.actionStart('Cancelling current plan');
|
|
269
|
+
try {
|
|
270
|
+
await api.projects.cancelImportPlan(plan.id);
|
|
271
|
+
this.style.actionSuccess();
|
|
272
|
+
}
|
|
273
|
+
catch (err) {
|
|
274
|
+
this.style.actionFailure();
|
|
275
|
+
throw err;
|
|
276
|
+
}
|
|
277
|
+
this.style.comment(`A new plan will be created without the failed resources.`);
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
this.style.actionStart('Writing files');
|
|
281
|
+
try {
|
|
282
|
+
await program.realize();
|
|
283
|
+
this.style.actionSuccess();
|
|
284
|
+
}
|
|
285
|
+
catch (err) {
|
|
286
|
+
this.style.actionFailure();
|
|
287
|
+
throw err;
|
|
288
|
+
}
|
|
289
|
+
this.log(`${logSymbols.success} ${chalk.bold('Your import plan has been created!')}`);
|
|
290
|
+
this.log();
|
|
291
|
+
this.log(` You can find the generated code under the following directory:`);
|
|
292
|
+
this.log();
|
|
293
|
+
this.log(` ${chalk.green(rootDirectory)}`);
|
|
294
|
+
this.log();
|
|
295
|
+
this.log(`\
|
|
296
|
+
The imported resources have not been linked to your project yet. Please
|
|
297
|
+
make sure to inspect the generated code. Should you find anything you do
|
|
298
|
+
not like, you can cancel the import plan and no harm will be done.
|
|
299
|
+
|
|
300
|
+
${logSymbols.warning} \
|
|
301
|
+
${chalk.yellow('If you deploy now, you will end up with duplicate resources!')}
|
|
302
|
+
|
|
303
|
+
Once you have inspected the code, the next step will be to apply the plan,
|
|
304
|
+
which links the generated code to the underlying resources, making them
|
|
305
|
+
modifiable. At this point you may still cancel the plan, though any changes
|
|
306
|
+
you've already deployed cannot be undone.
|
|
307
|
+
|
|
308
|
+
${logSymbols.info} \
|
|
309
|
+
${chalk.cyan('For safety, resources are not deletable until the plan has been committed.')}
|
|
310
|
+
|
|
311
|
+
The final step will be to commit your plan, at which point the underlying
|
|
312
|
+
resources will be fully managed by the Checkly CLI in the exact same
|
|
313
|
+
manner as any other CLI-native resource.
|
|
314
|
+
`);
|
|
315
|
+
const apply = await confirmApply.call(this);
|
|
316
|
+
if (!apply) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
await performApplyAction.call(this, plan);
|
|
320
|
+
const commit = await confirmCommit.call(this);
|
|
321
|
+
if (!commit) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
await performCommitAction.call(this, plan);
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
catch (err) {
|
|
328
|
+
if (err instanceof ExitError) {
|
|
329
|
+
throw err;
|
|
330
|
+
}
|
|
331
|
+
try {
|
|
332
|
+
const output = JSON.stringify(plan, null, 2);
|
|
333
|
+
await fs.writeFile(debugImportPlanOutputFile, output, 'utf8');
|
|
334
|
+
this.log(`${logSymbols.warning} Please contact Checkly support at support@checklyhq.com and attach the newly created "${debugImportPlanOutputFile}" file.`);
|
|
335
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
336
|
+
}
|
|
337
|
+
catch (err) {
|
|
338
|
+
this.log(`${logSymbols.warning} Please contact Checkly support at support@checklyhq.com.`);
|
|
339
|
+
}
|
|
340
|
+
throw err;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
#outputFailures(failures, codegen) {
|
|
345
|
+
const filters = [];
|
|
346
|
+
this.log(`${logSymbols.error} ${chalk.red('The following resources could not be imported:')}`);
|
|
347
|
+
this.log();
|
|
348
|
+
for (const { resource, cause } of failures) {
|
|
349
|
+
const spec = `${resource.type}:${resource.physicalId}`;
|
|
350
|
+
const desc = (() => {
|
|
351
|
+
try {
|
|
352
|
+
return codegen.describe(resource);
|
|
353
|
+
}
|
|
354
|
+
catch {
|
|
355
|
+
return resource.type;
|
|
356
|
+
}
|
|
357
|
+
})();
|
|
358
|
+
this.log(` ${desc} (${chalk.gray(spec)})`);
|
|
359
|
+
this.log();
|
|
360
|
+
this.log(` ${chalk.red(cause.toString())}`);
|
|
361
|
+
this.log();
|
|
362
|
+
filters.push({
|
|
363
|
+
type: 'exclude',
|
|
364
|
+
resource: {
|
|
365
|
+
type: resource.type,
|
|
366
|
+
physicalId: resource.physicalId,
|
|
367
|
+
},
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
return filters;
|
|
371
|
+
}
|
|
372
|
+
#outputConfigSection(options) {
|
|
373
|
+
const { title, step: [step, totalSteps], description } = options;
|
|
374
|
+
this.log(` ${title} ${chalk.grey(`(step ${step}/${totalSteps})`)}`);
|
|
375
|
+
this.log();
|
|
376
|
+
this.style.comment(description);
|
|
377
|
+
}
|
|
378
|
+
async #askProjectName(step) {
|
|
379
|
+
this.#outputConfigSection({
|
|
380
|
+
title: `Let's give your project a name`,
|
|
381
|
+
description: `You'll be able to change the name later if you like.`,
|
|
382
|
+
step,
|
|
383
|
+
});
|
|
384
|
+
while (true) {
|
|
385
|
+
const { projectName } = await prompts({
|
|
386
|
+
name: 'projectName',
|
|
387
|
+
type: 'text',
|
|
388
|
+
message: 'What should we call your project?',
|
|
389
|
+
});
|
|
390
|
+
this.log();
|
|
391
|
+
if (projectName === undefined) {
|
|
392
|
+
this.cancelAndExit();
|
|
393
|
+
}
|
|
394
|
+
if (projectName.trim() !== '') {
|
|
395
|
+
return projectName;
|
|
396
|
+
}
|
|
397
|
+
this.style.comment(`Sorry, but a project name is absolutely required. `
|
|
398
|
+
+ `You can also press ESC to cancel and exit.`);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
async #askLogicalId(suggested, step) {
|
|
402
|
+
this.#outputConfigSection({
|
|
403
|
+
title: `Set up a unique project identifier`,
|
|
404
|
+
description: `The identifier given here uniquely identifies your `
|
|
405
|
+
+ `project among any other Checkly projects you may have. You will `
|
|
406
|
+
+ `not be able to change the identifier later without recreating the `
|
|
407
|
+
+ `project. Please choose a value you'll be comfortable with `
|
|
408
|
+
+ `long term.`,
|
|
409
|
+
step,
|
|
410
|
+
});
|
|
411
|
+
while (true) {
|
|
412
|
+
const { logicalId } = await prompts({
|
|
413
|
+
name: 'logicalId',
|
|
414
|
+
type: 'text',
|
|
415
|
+
message: 'How would you like your project to be identified?',
|
|
416
|
+
initial: suggested,
|
|
417
|
+
validate: input => {
|
|
418
|
+
if (!LOGICAL_ID_PATTERN.test(input)) {
|
|
419
|
+
return `Please only use ASCII letters, numbers, and the `
|
|
420
|
+
+ `symbols _, -, /, #, and .`;
|
|
421
|
+
}
|
|
422
|
+
return true;
|
|
423
|
+
},
|
|
424
|
+
});
|
|
425
|
+
this.log();
|
|
426
|
+
if (logicalId === undefined) {
|
|
427
|
+
this.cancelAndExit();
|
|
428
|
+
}
|
|
429
|
+
if (logicalId.trim() !== '') {
|
|
430
|
+
return logicalId;
|
|
431
|
+
}
|
|
432
|
+
this.style.comment(`Sorry, but a project identifier is absolutely required. `
|
|
433
|
+
+ `You can also press ESC to cancel and exit.`);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
async #interactiveCreateConfig(configDirectory) {
|
|
437
|
+
this.style.shortWarning(`Unable to find an existing Checkly configuration file.`);
|
|
438
|
+
this.style.comment(`Setting up Checkly for the first time? No worries, we'll walk you `
|
|
439
|
+
+ `through the process.`);
|
|
440
|
+
const choices = [{
|
|
441
|
+
title: `Yes, I want to start a new project for the imported resources`,
|
|
442
|
+
value: 'init',
|
|
443
|
+
description: `We'll walk you through a minimal setup`,
|
|
444
|
+
}, {
|
|
445
|
+
title: `No, I intended to import resources into an existing project`,
|
|
446
|
+
value: 'mistake',
|
|
447
|
+
description: 'Exit and verify your configuration.',
|
|
448
|
+
}, {
|
|
449
|
+
title: 'No, I want to cancel and exit',
|
|
450
|
+
value: 'exit',
|
|
451
|
+
description: 'No changes will be made.',
|
|
452
|
+
}];
|
|
453
|
+
const { action } = await prompts({
|
|
454
|
+
name: 'action',
|
|
455
|
+
type: 'select',
|
|
456
|
+
message: 'Set up a new Checkly project?',
|
|
457
|
+
choices,
|
|
458
|
+
});
|
|
459
|
+
this.log();
|
|
460
|
+
switch (action) {
|
|
461
|
+
case 'init': {
|
|
462
|
+
const projectName = await this.#askProjectName([1, 2]);
|
|
463
|
+
const suggestedLogicalId = cased(projectName, 'kebab-case');
|
|
464
|
+
const logicalId = await this.#askLogicalId(suggestedLogicalId, [2, 2]);
|
|
465
|
+
try {
|
|
466
|
+
this.style.actionStart('Creating project');
|
|
467
|
+
await api.projects.create({
|
|
468
|
+
name: projectName,
|
|
469
|
+
logicalId,
|
|
470
|
+
});
|
|
471
|
+
this.style.actionSuccess();
|
|
472
|
+
}
|
|
473
|
+
catch (err) {
|
|
474
|
+
this.style.actionFailure();
|
|
475
|
+
throw err;
|
|
476
|
+
}
|
|
477
|
+
const program = new Program({
|
|
478
|
+
rootDirectory: configDirectory,
|
|
479
|
+
constructFileSuffix: '.check',
|
|
480
|
+
specFileSuffix: '.spec',
|
|
481
|
+
language: 'typescript',
|
|
482
|
+
});
|
|
483
|
+
const context = new Context();
|
|
484
|
+
const config = {
|
|
485
|
+
projectName,
|
|
486
|
+
logicalId,
|
|
487
|
+
checks: {
|
|
488
|
+
tags: ['mac'],
|
|
489
|
+
checkMatch: '**/__checks__/**/*.check.ts',
|
|
490
|
+
},
|
|
491
|
+
};
|
|
492
|
+
try {
|
|
493
|
+
this.style.actionStart('Creating Checkly configuration');
|
|
494
|
+
// TODO: Make this less ugly.
|
|
495
|
+
generateChecklyConfig(program, context, config, 'checkly.config.ts');
|
|
496
|
+
this.style.actionSuccess();
|
|
497
|
+
}
|
|
498
|
+
catch (err) {
|
|
499
|
+
this.style.actionFailure();
|
|
500
|
+
throw err;
|
|
501
|
+
}
|
|
502
|
+
let askInstall = false;
|
|
503
|
+
let packageJson;
|
|
504
|
+
try {
|
|
505
|
+
this.style.actionStart('Configuring package.json for Checkly');
|
|
506
|
+
// TODO: Make this less ugly.
|
|
507
|
+
packageJson = await (async () => {
|
|
508
|
+
const file = await this.#loadPackageJson();
|
|
509
|
+
if (file !== undefined) {
|
|
510
|
+
this.style.shortSuccess(`Found existing package.json`);
|
|
511
|
+
return file;
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
this.style.shortSuccess(`Creating a new minimal package.json`);
|
|
515
|
+
return this.#createPackageJson(logicalId);
|
|
516
|
+
}
|
|
517
|
+
})();
|
|
518
|
+
const ownPackageJson = await this.loadPackageJsonOfSelf();
|
|
519
|
+
const updated = packageJson.upsertDevDependencies({
|
|
520
|
+
checkly: `^${ownPackageJson?.version ?? '6'}`,
|
|
521
|
+
});
|
|
522
|
+
if (updated) {
|
|
523
|
+
this.style.shortSuccess(`Successfully added Checkly devDependencies`);
|
|
524
|
+
program.staticSupportFile(packageJson.meta.filePath, packageJson.toJSON());
|
|
525
|
+
askInstall = true;
|
|
526
|
+
}
|
|
527
|
+
else {
|
|
528
|
+
this.style.shortSuccess(`Checkly devDependencies are already up to date`);
|
|
529
|
+
}
|
|
530
|
+
this.style.actionSuccess();
|
|
531
|
+
}
|
|
532
|
+
catch (err) {
|
|
533
|
+
this.style.actionFailure();
|
|
534
|
+
throw err;
|
|
535
|
+
}
|
|
536
|
+
try {
|
|
537
|
+
this.style.actionStart('Writing project files');
|
|
538
|
+
await program.realize();
|
|
539
|
+
this.style.actionSuccess();
|
|
540
|
+
}
|
|
541
|
+
catch (err) {
|
|
542
|
+
this.style.actionFailure();
|
|
543
|
+
throw err;
|
|
544
|
+
}
|
|
545
|
+
if (askInstall && packageJson !== undefined) {
|
|
546
|
+
await this.#interactiveNpmInstall(packageJson.meta.dirname);
|
|
547
|
+
}
|
|
548
|
+
return config;
|
|
549
|
+
}
|
|
550
|
+
case 'mistake':
|
|
551
|
+
this.style.fatal(`Please verify your configuration and try again.`);
|
|
552
|
+
this.cancelAndExit();
|
|
553
|
+
break;
|
|
554
|
+
case 'exit':
|
|
555
|
+
// falls through
|
|
556
|
+
default: {
|
|
557
|
+
this.cancelAndExit();
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
async #loadPackageJson() {
|
|
562
|
+
try {
|
|
563
|
+
return await detectNearestPackageJson(process.cwd());
|
|
564
|
+
}
|
|
565
|
+
catch {
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
#createPackageJson(logicalId) {
|
|
570
|
+
return PackageJsonFile.make(PackageJsonFile.FILENAME, {
|
|
571
|
+
name: logicalId,
|
|
572
|
+
version: '1.0.0',
|
|
573
|
+
private: true,
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
async #interactiveNpmInstall(dirPath, forcePackageManager) {
|
|
577
|
+
const packageManager = forcePackageManager ?? await (async () => {
|
|
578
|
+
try {
|
|
579
|
+
this.style.actionStart(`Detecting package manager`);
|
|
580
|
+
const packageManager = await detectPackageManager(dirPath);
|
|
581
|
+
this.style.actionSuccess();
|
|
582
|
+
this.style.comment(`It looks like your package manager is ${packageManager.name}.`);
|
|
583
|
+
return packageManager;
|
|
584
|
+
}
|
|
585
|
+
catch (err) {
|
|
586
|
+
this.style.actionFailure();
|
|
587
|
+
throw err;
|
|
588
|
+
}
|
|
589
|
+
})();
|
|
590
|
+
const { unsafeDisplayCommand, executable, args } = packageManager.installCommand();
|
|
591
|
+
const choices = [{
|
|
592
|
+
title: `Yes, please run \`${unsafeDisplayCommand}\` for me`,
|
|
593
|
+
value: 'install',
|
|
594
|
+
}, {
|
|
595
|
+
title: `I want to use a different package manager`,
|
|
596
|
+
value: 'other-manager',
|
|
597
|
+
}, {
|
|
598
|
+
title: 'I will do it later myself',
|
|
599
|
+
value: 'later',
|
|
600
|
+
}];
|
|
601
|
+
const { action } = await prompts({
|
|
602
|
+
type: 'select',
|
|
603
|
+
name: 'action',
|
|
604
|
+
message: 'Would you like to install dependencies now? (recommended)',
|
|
605
|
+
choices,
|
|
606
|
+
});
|
|
607
|
+
this.log();
|
|
608
|
+
switch (action) {
|
|
609
|
+
case 'install': {
|
|
610
|
+
this.style.comment(`Ok, now running \`${unsafeDisplayCommand}\`.`);
|
|
611
|
+
try {
|
|
612
|
+
await execa(executable, args, {
|
|
613
|
+
cwd: dirPath,
|
|
614
|
+
stdout: ['inherit'],
|
|
615
|
+
stderr: ['inherit'],
|
|
616
|
+
stdin: ['inherit'],
|
|
617
|
+
});
|
|
618
|
+
this.log();
|
|
619
|
+
this.style.comment(`Successfully installed dependencies.`);
|
|
620
|
+
}
|
|
621
|
+
catch (err) {
|
|
622
|
+
if (err instanceof Error) {
|
|
623
|
+
this.style.longError(`Failed to install dependencies`, err.message); // TODO :
|
|
624
|
+
}
|
|
625
|
+
this.style.comment(`Uh oh. Looks like that didn't quite work as expected.`
|
|
626
|
+
+ `\n\n`
|
|
627
|
+
+ `You can still continue the import process and install `
|
|
628
|
+
+ `dependencies later by yourself.`);
|
|
629
|
+
const { action } = await prompts({
|
|
630
|
+
type: 'confirm',
|
|
631
|
+
name: 'action',
|
|
632
|
+
message: 'Continue the import process?',
|
|
633
|
+
});
|
|
634
|
+
this.log();
|
|
635
|
+
if (action) {
|
|
636
|
+
this.style.comment(`Great, let's proceed to the next step.`);
|
|
637
|
+
await setTimeout(200);
|
|
638
|
+
}
|
|
639
|
+
else {
|
|
640
|
+
this.cancelAndExit();
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
break;
|
|
644
|
+
}
|
|
645
|
+
case 'other-manager': {
|
|
646
|
+
const packageManagersByName = Object.fromEntries(knownPackageManagers.map(packageManager => {
|
|
647
|
+
return [packageManager.name, packageManager];
|
|
648
|
+
}));
|
|
649
|
+
const choices = knownPackageManagers.map(packageManager => ({
|
|
650
|
+
title: packageManager.name,
|
|
651
|
+
value: packageManager.name,
|
|
652
|
+
}));
|
|
653
|
+
choices.push({
|
|
654
|
+
title: 'None of the above',
|
|
655
|
+
value: 'other',
|
|
656
|
+
});
|
|
657
|
+
const { action } = await prompts({
|
|
658
|
+
type: 'select',
|
|
659
|
+
name: 'action',
|
|
660
|
+
message: 'Which package manager would you like to use?',
|
|
661
|
+
choices,
|
|
662
|
+
});
|
|
663
|
+
this.log();
|
|
664
|
+
if (action === undefined) {
|
|
665
|
+
this.cancelAndExit();
|
|
666
|
+
}
|
|
667
|
+
if (action === 'other') {
|
|
668
|
+
this.style.comment(`Alright. If possible, let us know which package manager you `
|
|
669
|
+
+ `use and we may be able to support it in the future.`
|
|
670
|
+
+ `\n\n`
|
|
671
|
+
+ `You can still continue the import process and install `
|
|
672
|
+
+ `dependencies later by yourself.`);
|
|
673
|
+
const { action } = await prompts({
|
|
674
|
+
type: 'confirm',
|
|
675
|
+
name: 'action',
|
|
676
|
+
message: 'Continue the import process?',
|
|
677
|
+
});
|
|
678
|
+
this.log();
|
|
679
|
+
if (action) {
|
|
680
|
+
this.style.comment(`Great, let's proceed to the next step.`);
|
|
681
|
+
await setTimeout(200);
|
|
682
|
+
break;
|
|
683
|
+
}
|
|
684
|
+
else {
|
|
685
|
+
this.cancelAndExit();
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
const packageManager = packageManagersByName[action];
|
|
689
|
+
if (packageManager === undefined) {
|
|
690
|
+
throw new Error(`Somehow, you selected an option that does not exist.`);
|
|
691
|
+
}
|
|
692
|
+
return this.#interactiveNpmInstall(dirPath, packageManager);
|
|
693
|
+
}
|
|
694
|
+
case 'later': {
|
|
695
|
+
this.style.comment(`Ok, but make sure to perform the appropriate actions to install `
|
|
696
|
+
+ `dependencies once you've completed the setup.`
|
|
697
|
+
+ `\n\n`
|
|
698
|
+
+ `If you do not, the Checkly CLI will not function as intended.`);
|
|
699
|
+
await setTimeout(200);
|
|
700
|
+
break;
|
|
701
|
+
}
|
|
702
|
+
default: {
|
|
703
|
+
this.cancelAndExit();
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
async #loadConfig(configDirectory, configFilenames) {
|
|
708
|
+
try {
|
|
709
|
+
const { config: checklyConfig, } = await loadChecklyConfig(configDirectory, configFilenames);
|
|
710
|
+
return checklyConfig;
|
|
711
|
+
}
|
|
712
|
+
catch (err) {
|
|
713
|
+
if (err instanceof ConfigNotFoundError) {
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
throw err;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
async #validateProject(project) {
|
|
720
|
+
this.style.actionStart('Validating project resources');
|
|
721
|
+
const diagnostics = new Diagnostics();
|
|
722
|
+
await project.validate(diagnostics);
|
|
723
|
+
for (const diag of diagnostics.observations) {
|
|
724
|
+
if (diag.isFatal()) {
|
|
725
|
+
this.style.longError(diag.title, diag.message);
|
|
726
|
+
}
|
|
727
|
+
else if (!diag.isBenign()) {
|
|
728
|
+
this.style.longWarning(diag.title, diag.message);
|
|
729
|
+
}
|
|
730
|
+
else {
|
|
731
|
+
this.style.longInfo(diag.title, diag.message);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
if (diagnostics.isFatal()) {
|
|
735
|
+
this.style.actionFailure();
|
|
736
|
+
this.style.shortError(`Unable to continue due to unresolved validation errors.`);
|
|
737
|
+
this.exit(1);
|
|
738
|
+
}
|
|
739
|
+
this.style.actionSuccess();
|
|
740
|
+
}
|
|
741
|
+
async #findExportedResources(configDirectory, checklyConfig, rootDirectory) {
|
|
742
|
+
this.style.actionStart('Parsing your project');
|
|
743
|
+
let project;
|
|
744
|
+
try {
|
|
745
|
+
const account = this.account;
|
|
746
|
+
const availableRuntimes = await api.runtimes.getAll();
|
|
747
|
+
project = await parseProject({
|
|
748
|
+
directory: configDirectory,
|
|
749
|
+
projectLogicalId: checklyConfig.logicalId,
|
|
750
|
+
projectName: checklyConfig.projectName,
|
|
751
|
+
repoUrl: checklyConfig.repoUrl,
|
|
752
|
+
checkMatch: checklyConfig.checks?.checkMatch,
|
|
753
|
+
browserCheckMatch: checklyConfig.checks?.browserChecks?.testMatch,
|
|
754
|
+
multiStepCheckMatch: checklyConfig.checks?.multiStepChecks?.testMatch,
|
|
755
|
+
ignoreDirectoriesMatch: checklyConfig.checks?.ignoreDirectoriesMatch,
|
|
756
|
+
checkDefaults: checklyConfig.checks,
|
|
757
|
+
browserCheckDefaults: checklyConfig.checks?.browserChecks,
|
|
758
|
+
availableRuntimes: availableRuntimes.reduce((acc, runtime) => {
|
|
759
|
+
acc[runtime.name] = runtime;
|
|
760
|
+
return acc;
|
|
761
|
+
}, {}),
|
|
762
|
+
defaultRuntimeId: account.runtimeId,
|
|
763
|
+
verifyRuntimeDependencies: false,
|
|
764
|
+
});
|
|
765
|
+
this.style.actionSuccess();
|
|
766
|
+
}
|
|
767
|
+
catch (err) {
|
|
768
|
+
this.style.actionFailure();
|
|
769
|
+
throw err;
|
|
770
|
+
}
|
|
771
|
+
await this.#validateProject(project);
|
|
772
|
+
this.style.actionStart('Searching for exported resources');
|
|
773
|
+
const constructExports = Session.constructExports;
|
|
774
|
+
this.style.actionSuccess();
|
|
775
|
+
switch (constructExports.length) {
|
|
776
|
+
case 0: {
|
|
777
|
+
this.style.comment(`Did not find any exported resources.`);
|
|
778
|
+
break;
|
|
779
|
+
}
|
|
780
|
+
case 1: {
|
|
781
|
+
this.style.comment(`Found 1 exported resource.`);
|
|
782
|
+
break;
|
|
783
|
+
}
|
|
784
|
+
default: {
|
|
785
|
+
this.style.comment(`Found ${constructExports.length} exported resources.`);
|
|
786
|
+
break;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
// Paths need to be relative to the root directory or our generated
|
|
790
|
+
// imports won't work correctly.
|
|
791
|
+
for (const constructExport of constructExports) {
|
|
792
|
+
constructExport.filePath = path.relative(rootDirectory, constructExport.filePath);
|
|
793
|
+
}
|
|
794
|
+
return constructExports;
|
|
795
|
+
}
|
|
796
|
+
async #confirmRetryWithoutFailed() {
|
|
797
|
+
const { action } = await prompts({
|
|
798
|
+
name: 'action',
|
|
799
|
+
type: 'confirm',
|
|
800
|
+
message: 'Would you like to try again without the failed resources?',
|
|
801
|
+
});
|
|
802
|
+
this.log();
|
|
803
|
+
return action ?? false;
|
|
804
|
+
}
|
|
805
|
+
async #createImportPlan(logicalId, options) {
|
|
806
|
+
this.style.actionStart('Creating a new plan');
|
|
807
|
+
try {
|
|
808
|
+
const { data } = await api.projects.createImportPlan(logicalId, options);
|
|
809
|
+
this.style.actionSuccess();
|
|
810
|
+
return data;
|
|
811
|
+
}
|
|
812
|
+
catch (err) {
|
|
813
|
+
this.style.actionFailure();
|
|
814
|
+
if (err instanceof NoImportableResourcesFoundError) {
|
|
815
|
+
this.style.fatal(err.message);
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
if (err instanceof ProjectNotFoundError) {
|
|
819
|
+
this.style.fatal(err.message);
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
throw err;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
async #interactiveFilter(logicalId, codegen) {
|
|
826
|
+
const choices = [{
|
|
827
|
+
title: `I want to import everything in one go`,
|
|
828
|
+
value: 'all',
|
|
829
|
+
}, {
|
|
830
|
+
title: `Let me choose resources manually`,
|
|
831
|
+
value: 'choose',
|
|
832
|
+
description: 'You will be presented with options.',
|
|
833
|
+
}, {
|
|
834
|
+
title: 'Cancel and exit',
|
|
835
|
+
value: 'exit',
|
|
836
|
+
description: 'No changes will be made.',
|
|
837
|
+
}];
|
|
838
|
+
const { action } = await prompts({
|
|
839
|
+
name: 'action',
|
|
840
|
+
type: 'select',
|
|
841
|
+
message: 'Which resources would you like to import?',
|
|
842
|
+
choices,
|
|
843
|
+
});
|
|
844
|
+
this.log();
|
|
845
|
+
switch (action) {
|
|
846
|
+
case 'all':
|
|
847
|
+
return [];
|
|
848
|
+
case 'choose': {
|
|
849
|
+
const choices = await (async () => {
|
|
850
|
+
this.style.actionStart('Fetching available resources');
|
|
851
|
+
try {
|
|
852
|
+
const { data } = await api.projects.createImportPlan(logicalId, {
|
|
853
|
+
preview: true,
|
|
854
|
+
filters: [{
|
|
855
|
+
type: 'include',
|
|
856
|
+
}],
|
|
857
|
+
});
|
|
858
|
+
this.style.actionSuccess();
|
|
859
|
+
return (data.changes?.resources ?? []).flatMap(resource => {
|
|
860
|
+
if (!isFilterable(resource.type)) {
|
|
861
|
+
return [];
|
|
862
|
+
}
|
|
863
|
+
try {
|
|
864
|
+
return [{
|
|
865
|
+
title: codegen.describe(resource),
|
|
866
|
+
value: `${resource.type}:${resource.physicalId}`,
|
|
867
|
+
description: `${resource.type}:${resource.physicalId}`,
|
|
868
|
+
}];
|
|
869
|
+
}
|
|
870
|
+
catch {
|
|
871
|
+
return [];
|
|
872
|
+
}
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
catch (err) {
|
|
876
|
+
this.style.actionFailure();
|
|
877
|
+
if (err instanceof NoImportableResourcesFoundError) {
|
|
878
|
+
return [];
|
|
879
|
+
}
|
|
880
|
+
throw err;
|
|
881
|
+
}
|
|
882
|
+
})();
|
|
883
|
+
choices.sort((a, b) => {
|
|
884
|
+
return a.title.localeCompare(b.title);
|
|
885
|
+
});
|
|
886
|
+
const { resources } = await prompts({
|
|
887
|
+
name: 'resources',
|
|
888
|
+
type: 'autocompleteMultiselect',
|
|
889
|
+
message: 'Please select the resources you would like to import',
|
|
890
|
+
choices,
|
|
891
|
+
hint: ' - Space to select. Return to submit.',
|
|
892
|
+
instructions: false,
|
|
893
|
+
});
|
|
894
|
+
this.log();
|
|
895
|
+
if (resources === undefined) {
|
|
896
|
+
this.cancelAndExit();
|
|
897
|
+
}
|
|
898
|
+
if (resources.length === 0) {
|
|
899
|
+
this.style.fatal(`You did not choose any resources.`);
|
|
900
|
+
this.cancelAndExit();
|
|
901
|
+
}
|
|
902
|
+
return resources.map(parseFilter);
|
|
903
|
+
}
|
|
904
|
+
case 'exit':
|
|
905
|
+
// falls through
|
|
906
|
+
default: {
|
|
907
|
+
this.cancelAndExit();
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
#generateCode(plan, program, codegen, friendExports) {
|
|
912
|
+
this.style.actionStart('Generating Checkly constructs for imported resources');
|
|
913
|
+
try {
|
|
914
|
+
const context = new Context();
|
|
915
|
+
const failures = new Map();
|
|
916
|
+
if (plan.changes) {
|
|
917
|
+
const { resources, friends, auxiliary } = plan.changes;
|
|
918
|
+
if (friends) {
|
|
919
|
+
for (const resource of friends) {
|
|
920
|
+
try {
|
|
921
|
+
if (friendExports[resource.type] === undefined) {
|
|
922
|
+
throw new Error(`Unable to process unsupported friend resource type '${resource.type}'.`);
|
|
923
|
+
}
|
|
924
|
+
const friendExport = friendExports[resource.type].get(resource.logicalId);
|
|
925
|
+
if (friendExport === undefined) {
|
|
926
|
+
throw new Error(`Received friend resource '${resource.logicalId}' that was not requested for.`);
|
|
927
|
+
}
|
|
928
|
+
switch (resource.type) {
|
|
929
|
+
case 'alert-channel':
|
|
930
|
+
context.registerFriendAlertChannel(resource.physicalId, friendExport);
|
|
931
|
+
break;
|
|
932
|
+
case 'check-group':
|
|
933
|
+
context.registerFriendCheckGroup(resource.physicalId, friendExport);
|
|
934
|
+
break;
|
|
935
|
+
case 'private-location':
|
|
936
|
+
context.registerFriendPrivateLocation(resource.physicalId, friendExport);
|
|
937
|
+
break;
|
|
938
|
+
case 'status-page-service':
|
|
939
|
+
context.registerFriendStatusPageService(resource.physicalId, friendExport);
|
|
940
|
+
break;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
catch (cause) {
|
|
944
|
+
throw new Error(`Failed to process friend resource '${resource.type}:${resource.physicalId}' (${resource.logicalId}): ${cause}`, { cause });
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
if (auxiliary) {
|
|
949
|
+
const globalSnippetFiles = new Set();
|
|
950
|
+
for (const resource of auxiliary) {
|
|
951
|
+
try {
|
|
952
|
+
switch (resource.type) {
|
|
953
|
+
case 'snippet': {
|
|
954
|
+
const snippet = resource.payload;
|
|
955
|
+
if (!isSnippet(snippet)) {
|
|
956
|
+
throw new Error(`Invalid auxiliary snippet`);
|
|
957
|
+
}
|
|
958
|
+
const snippetFilePath = context.filePath('snippets', snippet.name, {
|
|
959
|
+
unique: false,
|
|
960
|
+
contentKey: `snippet::${snippet.id}`,
|
|
961
|
+
case: isSafeSnippetFilename(snippet.name) ? 'identity' : 'kebab-case',
|
|
962
|
+
});
|
|
963
|
+
const snippetFile = program.staticSupportFile(snippetFilePath.fullPath, snippet.script);
|
|
964
|
+
globalSnippetFiles.add(snippetFile);
|
|
965
|
+
context.registerAuxiliarySnippetFile(snippet.id, snippetFile);
|
|
966
|
+
break;
|
|
967
|
+
}
|
|
968
|
+
default:
|
|
969
|
+
throw new Error(`Unable to process unsupported auxiliary resource type '${resource.type}'.`);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
catch (cause) {
|
|
973
|
+
throw new Error(`Failed to process auxiliary resource '${resource.type}:${resource.physicalId}': ${cause}`, { cause });
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
// Due to questionable historical design choices, snippets may
|
|
977
|
+
// reference other snippets in two ways:
|
|
978
|
+
//
|
|
979
|
+
// 1. From the same folder (i.e. `require('./other-snippet')`) if
|
|
980
|
+
// the requiring snippet is NOT the main entrypoint, but has
|
|
981
|
+
// itself been required by another snippet or script.
|
|
982
|
+
// 2. From the magic './snippets' folder using
|
|
983
|
+
// `require('./snippets/other-snippet')` irrespective of whether
|
|
984
|
+
// the requiring snippet is the main entrypoint or not (works in
|
|
985
|
+
// either case).
|
|
986
|
+
//
|
|
987
|
+
// To emulate this functionality with a proper file structure, we
|
|
988
|
+
// need to check if any global snippets are using the second method,
|
|
989
|
+
// and create appropriate aliases in the beatifully named
|
|
990
|
+
// './snippets/snippets/' folder so that the paths can resolve
|
|
991
|
+
// without modification.
|
|
992
|
+
for (const globalSnippetFile of globalSnippetFiles) {
|
|
993
|
+
const content = globalSnippetFile.content.toString();
|
|
994
|
+
const snippetFiles = context.findScriptSnippetFiles(content);
|
|
995
|
+
for (const snippetFile of snippetFiles) {
|
|
996
|
+
const localSnippetFile = program.generatedSupportFile(`snippets/snippets/${snippetFile.basename}`);
|
|
997
|
+
localSnippetFile.header(docComment(`This file has been generated to help resolve cross-snippet imports.\n`
|
|
998
|
+
+ `\n`
|
|
999
|
+
+ `We recommend rewriting your imports to not reference this file, after which\n`
|
|
1000
|
+
+ `you may remove it.`));
|
|
1001
|
+
localSnippetFile.plainImport(localSnippetFile.relativePath(snippetFile));
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
sortResources(resources);
|
|
1006
|
+
for (const resource of resources) {
|
|
1007
|
+
try {
|
|
1008
|
+
codegen.prepare(resource.logicalId, resource, context);
|
|
1009
|
+
}
|
|
1010
|
+
catch (cause) {
|
|
1011
|
+
if (!(cause instanceof Error)) {
|
|
1012
|
+
throw cause;
|
|
1013
|
+
}
|
|
1014
|
+
failures.set(resource.logicalId, {
|
|
1015
|
+
resource,
|
|
1016
|
+
cause,
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
for (const resource of resources) {
|
|
1021
|
+
if (failures.has(resource.logicalId)) {
|
|
1022
|
+
continue;
|
|
1023
|
+
}
|
|
1024
|
+
try {
|
|
1025
|
+
codegen.gencode(resource.logicalId, resource, context);
|
|
1026
|
+
}
|
|
1027
|
+
catch (cause) {
|
|
1028
|
+
if (!(cause instanceof Error)) {
|
|
1029
|
+
throw cause;
|
|
1030
|
+
}
|
|
1031
|
+
failures.set(resource.logicalId, {
|
|
1032
|
+
resource,
|
|
1033
|
+
cause,
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
if (failures.size === 0) {
|
|
1039
|
+
this.style.actionSuccess();
|
|
1040
|
+
}
|
|
1041
|
+
else {
|
|
1042
|
+
this.style.actionFailure();
|
|
1043
|
+
}
|
|
1044
|
+
return {
|
|
1045
|
+
failures: [...failures.values()],
|
|
1046
|
+
};
|
|
1047
|
+
}
|
|
1048
|
+
catch (err) {
|
|
1049
|
+
this.style.actionFailure();
|
|
1050
|
+
throw err;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
async #initializeProject(config) {
|
|
1054
|
+
const { logicalId, projectName, repoUrl, } = config;
|
|
1055
|
+
this.style.actionStart('Checking project status');
|
|
1056
|
+
try {
|
|
1057
|
+
await api.projects.get(logicalId);
|
|
1058
|
+
this.style.actionSuccess();
|
|
1059
|
+
// The project has already been initialized, not need to do anything.
|
|
1060
|
+
return;
|
|
1061
|
+
}
|
|
1062
|
+
catch (err) {
|
|
1063
|
+
this.style.actionFailure();
|
|
1064
|
+
if (!(err instanceof ProjectNotFoundError)) {
|
|
1065
|
+
throw err;
|
|
1066
|
+
}
|
|
1067
|
+
// The project does not exist yet and we must create (initialize) it.
|
|
1068
|
+
}
|
|
1069
|
+
const choices = [{
|
|
1070
|
+
title: `Yes, I want to start a new project with the imported resources`,
|
|
1071
|
+
value: 'init',
|
|
1072
|
+
}, {
|
|
1073
|
+
title: `No, I intended to import resources into an existing project`,
|
|
1074
|
+
value: 'mistake',
|
|
1075
|
+
description: 'Exit and verify your configuration.',
|
|
1076
|
+
}, {
|
|
1077
|
+
title: 'No, I want to cancel and exit',
|
|
1078
|
+
value: 'exit',
|
|
1079
|
+
description: 'No changes will be made.',
|
|
1080
|
+
}];
|
|
1081
|
+
const { action } = await prompts({
|
|
1082
|
+
name: 'action',
|
|
1083
|
+
type: 'select',
|
|
1084
|
+
message: 'Your project has not been initialized yet. Initialize now?',
|
|
1085
|
+
choices,
|
|
1086
|
+
});
|
|
1087
|
+
this.log();
|
|
1088
|
+
switch (action) {
|
|
1089
|
+
case 'init': {
|
|
1090
|
+
try {
|
|
1091
|
+
this.style.actionStart('Initializing project');
|
|
1092
|
+
await api.projects.create({
|
|
1093
|
+
name: projectName,
|
|
1094
|
+
logicalId,
|
|
1095
|
+
repoUrl,
|
|
1096
|
+
});
|
|
1097
|
+
this.style.actionSuccess();
|
|
1098
|
+
}
|
|
1099
|
+
catch (err) {
|
|
1100
|
+
this.style.actionFailure();
|
|
1101
|
+
throw err;
|
|
1102
|
+
}
|
|
1103
|
+
break;
|
|
1104
|
+
}
|
|
1105
|
+
case 'mistake':
|
|
1106
|
+
this.style.fatal(`Please verify your configuration and try again.`);
|
|
1107
|
+
this.cancelAndExit();
|
|
1108
|
+
break;
|
|
1109
|
+
case 'exit':
|
|
1110
|
+
// falls through
|
|
1111
|
+
default: {
|
|
1112
|
+
this.cancelAndExit();
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
async #handleExistingPlans(plans) {
|
|
1117
|
+
const choices = [{
|
|
1118
|
+
title: 'I want to exit and rethink',
|
|
1119
|
+
value: 'exit',
|
|
1120
|
+
description: 'No changes will be made.',
|
|
1121
|
+
}, {
|
|
1122
|
+
title: 'I want to see some basic details about the existing plans first',
|
|
1123
|
+
value: 'show',
|
|
1124
|
+
}, {
|
|
1125
|
+
title: 'I want to cancel all existing plans and create a new plan',
|
|
1126
|
+
value: 'cancel-proceed',
|
|
1127
|
+
}, {
|
|
1128
|
+
title: 'I want to create a new plan regardless',
|
|
1129
|
+
value: 'new',
|
|
1130
|
+
}];
|
|
1131
|
+
while (true) {
|
|
1132
|
+
const { action } = await prompts({
|
|
1133
|
+
name: 'action',
|
|
1134
|
+
type: 'select',
|
|
1135
|
+
message: `Found ${plans.length} existing uncommitted plan(s). How do you want to proceed?`,
|
|
1136
|
+
choices,
|
|
1137
|
+
});
|
|
1138
|
+
this.log();
|
|
1139
|
+
switch (action) {
|
|
1140
|
+
case 'show': {
|
|
1141
|
+
this.log();
|
|
1142
|
+
for (const plan of plans) {
|
|
1143
|
+
this.log(`Plan ${plan.id}:`);
|
|
1144
|
+
this.log(` Created at: ${new Date(plan.createdAt)}`);
|
|
1145
|
+
this.log(` Applied?: ${plan.appliedAt ? 'yes' : 'no'}`);
|
|
1146
|
+
if (plan.appliedAt) {
|
|
1147
|
+
this.log(` Applied at: ${new Date(plan.appliedAt)}`);
|
|
1148
|
+
}
|
|
1149
|
+
this.log();
|
|
1150
|
+
}
|
|
1151
|
+
const { action } = await prompts({
|
|
1152
|
+
name: 'action',
|
|
1153
|
+
type: 'select',
|
|
1154
|
+
message: 'Do you want to exit or retry?',
|
|
1155
|
+
choices: [{
|
|
1156
|
+
title: 'Exit',
|
|
1157
|
+
value: 'exit',
|
|
1158
|
+
description: 'No changes will be made.',
|
|
1159
|
+
}, {
|
|
1160
|
+
title: 'Return to previous options',
|
|
1161
|
+
value: 'return',
|
|
1162
|
+
}],
|
|
1163
|
+
});
|
|
1164
|
+
this.log();
|
|
1165
|
+
if (action === 'exit') {
|
|
1166
|
+
this.cancelAndExit();
|
|
1167
|
+
}
|
|
1168
|
+
continue;
|
|
1169
|
+
}
|
|
1170
|
+
case 'cancel-proceed': {
|
|
1171
|
+
this.style.actionStart('Cancelling existing plans');
|
|
1172
|
+
try {
|
|
1173
|
+
for (const plan of plans) {
|
|
1174
|
+
await api.projects.cancelImportPlan(plan.id);
|
|
1175
|
+
this.style.shortSuccess(`Cancelled plan ${plan.id}`);
|
|
1176
|
+
}
|
|
1177
|
+
this.style.actionSuccess();
|
|
1178
|
+
}
|
|
1179
|
+
catch (err) {
|
|
1180
|
+
this.style.actionFailure();
|
|
1181
|
+
throw err;
|
|
1182
|
+
}
|
|
1183
|
+
return;
|
|
1184
|
+
}
|
|
1185
|
+
case 'new': {
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1188
|
+
case 'exit':
|
|
1189
|
+
// falls through
|
|
1190
|
+
default: {
|
|
1191
|
+
this.cancelAndExit();
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
cancelAndExit() {
|
|
1197
|
+
this.log('Exiting without making any changes.');
|
|
1198
|
+
this.exit(0);
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
function previewComment() {
|
|
1202
|
+
return docComment('This Checkly construct file has been generated for preview purposes only.'
|
|
1203
|
+
+ '\n\n'
|
|
1204
|
+
+ 'Deploying this file will create duplicate resources.');
|
|
1205
|
+
}
|
|
1206
|
+
class InvalidResourceIdentifierError extends Error {
|
|
1207
|
+
}
|
|
1208
|
+
function parseFilter(spec) {
|
|
1209
|
+
const filter = {
|
|
1210
|
+
type: 'include',
|
|
1211
|
+
};
|
|
1212
|
+
if (spec.startsWith('!')) {
|
|
1213
|
+
filter.type = 'exclude';
|
|
1214
|
+
spec = spec.slice(1);
|
|
1215
|
+
}
|
|
1216
|
+
const [type, physicalId] = spec.split(':', 2);
|
|
1217
|
+
const parseId = importables[type];
|
|
1218
|
+
if (parseId === undefined) {
|
|
1219
|
+
throw new Error(`Invalid resource specifier '${spec}': Unsupported resource type '${type}'`);
|
|
1220
|
+
}
|
|
1221
|
+
try {
|
|
1222
|
+
filter.resource = {
|
|
1223
|
+
type,
|
|
1224
|
+
physicalId: parseId(physicalId),
|
|
1225
|
+
};
|
|
1226
|
+
}
|
|
1227
|
+
catch (err) {
|
|
1228
|
+
if (err instanceof InvalidResourceIdentifierError) {
|
|
1229
|
+
throw new Error(`Invalid resource specifier '${spec}': ${err.message}`, { cause: err });
|
|
1230
|
+
}
|
|
1231
|
+
throw err;
|
|
1232
|
+
}
|
|
1233
|
+
return filter;
|
|
1234
|
+
}
|
|
1235
|
+
function integerPhysicalId(value) {
|
|
1236
|
+
if (value === undefined) {
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
if (value === '' || value === '*') {
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
const numberValue = parseInt(value, 10);
|
|
1243
|
+
if (Number.isNaN(numberValue)) {
|
|
1244
|
+
throw new InvalidResourceIdentifierError(`Resource identifier '${value}' must be a valid integer`);
|
|
1245
|
+
}
|
|
1246
|
+
return numberValue;
|
|
1247
|
+
}
|
|
1248
|
+
function uuidPhysicalId(value) {
|
|
1249
|
+
if (value === undefined) {
|
|
1250
|
+
return;
|
|
1251
|
+
}
|
|
1252
|
+
if (value === '' || value === '*') {
|
|
1253
|
+
return;
|
|
1254
|
+
}
|
|
1255
|
+
if (!validateUuid(value)) {
|
|
1256
|
+
throw new InvalidResourceIdentifierError(`Resource identifier '${value}' must be a valid UUID`);
|
|
1257
|
+
}
|
|
1258
|
+
return value;
|
|
1259
|
+
}
|
|
1260
|
+
const importables = {
|
|
1261
|
+
'alert-channel': integerPhysicalId,
|
|
1262
|
+
'check-group': integerPhysicalId,
|
|
1263
|
+
'check': uuidPhysicalId,
|
|
1264
|
+
'dashboard': integerPhysicalId,
|
|
1265
|
+
'maintenance-window': integerPhysicalId,
|
|
1266
|
+
'private-location': uuidPhysicalId,
|
|
1267
|
+
'status-page-service': uuidPhysicalId,
|
|
1268
|
+
'status-page': uuidPhysicalId,
|
|
1269
|
+
};
|
|
1270
|
+
function isFilterable(type) {
|
|
1271
|
+
return importables[type] !== undefined;
|
|
1272
|
+
}
|
|
1273
|
+
//# sourceMappingURL=plan.js.map
|