checkly 3.1.1 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/README.md +42 -110
  2. package/bin/dev +17 -0
  3. package/bin/run +5 -0
  4. package/bin/run.cmd +3 -0
  5. package/constructs.d.ts +1 -0
  6. package/constructs.js +1 -0
  7. package/dist/auth/index.d.ts +15 -0
  8. package/dist/auth/index.js +228 -0
  9. package/dist/auth/index.js.map +1 -0
  10. package/dist/commands/authCommand.d.ts +5 -0
  11. package/dist/commands/authCommand.js +14 -0
  12. package/dist/commands/authCommand.js.map +1 -0
  13. package/dist/commands/baseCommand.d.ts +9 -0
  14. package/dist/commands/baseCommand.js +21 -0
  15. package/dist/commands/baseCommand.js.map +1 -0
  16. package/dist/commands/deploy.d.ts +13 -0
  17. package/dist/commands/deploy.js +171 -0
  18. package/dist/commands/deploy.js.map +1 -0
  19. package/dist/commands/destroy.d.ts +10 -0
  20. package/dist/commands/destroy.js +47 -0
  21. package/dist/commands/destroy.js.map +1 -0
  22. package/dist/commands/env/add.d.ts +13 -0
  23. package/dist/commands/env/add.js +54 -0
  24. package/dist/commands/env/add.js.map +1 -0
  25. package/dist/commands/env/ls.d.ts +6 -0
  26. package/dist/commands/env/ls.js +21 -0
  27. package/dist/commands/env/ls.js.map +1 -0
  28. package/dist/commands/env/pull.d.ts +12 -0
  29. package/dist/commands/env/pull.js +63 -0
  30. package/dist/commands/env/pull.js.map +1 -0
  31. package/dist/commands/env/rm.d.ts +12 -0
  32. package/dist/commands/env/rm.js +56 -0
  33. package/dist/commands/env/rm.js.map +1 -0
  34. package/dist/commands/env/update.d.ts +13 -0
  35. package/dist/commands/env/update.js +54 -0
  36. package/dist/commands/env/update.js.map +1 -0
  37. package/dist/commands/login.d.ts +13 -0
  38. package/dist/commands/login.js +129 -0
  39. package/dist/commands/login.js.map +1 -0
  40. package/dist/commands/logout.d.ts +9 -0
  41. package/dist/commands/logout.js +40 -0
  42. package/dist/commands/logout.js.map +1 -0
  43. package/dist/commands/runtimes.d.ts +6 -0
  44. package/dist/commands/runtimes.js +26 -0
  45. package/dist/commands/runtimes.js.map +1 -0
  46. package/dist/commands/switch.d.ts +9 -0
  47. package/dist/commands/switch.js +59 -0
  48. package/dist/commands/switch.js.map +1 -0
  49. package/dist/commands/test.d.ts +36 -0
  50. package/dist/commands/test.js +237 -0
  51. package/dist/commands/test.js.map +1 -0
  52. package/dist/commands/trigger.d.ts +32 -0
  53. package/dist/commands/trigger.js +173 -0
  54. package/dist/commands/trigger.js.map +1 -0
  55. package/dist/commands/whoami.d.ts +6 -0
  56. package/dist/commands/whoami.js +16 -0
  57. package/dist/commands/whoami.js.map +1 -0
  58. package/dist/config.d.ts +31 -0
  59. package/dist/config.js +8 -0
  60. package/dist/config.js.map +1 -0
  61. package/dist/constructs/alert-channel-subscription.d.ts +44 -0
  62. package/dist/constructs/alert-channel-subscription.js +39 -0
  63. package/dist/constructs/alert-channel-subscription.js.map +1 -0
  64. package/dist/constructs/alert-channel.d.ts +53 -0
  65. package/dist/constructs/alert-channel.js +55 -0
  66. package/dist/constructs/alert-channel.js.map +1 -0
  67. package/dist/constructs/api-check.d.ts +179 -0
  68. package/dist/constructs/api-check.js +248 -0
  69. package/dist/constructs/api-check.js.map +1 -0
  70. package/dist/constructs/browser-check.d.ts +59 -0
  71. package/dist/constructs/browser-check.js +102 -0
  72. package/dist/constructs/browser-check.js.map +1 -0
  73. package/dist/constructs/check-group.d.ts +116 -0
  74. package/dist/constructs/check-group.js +113 -0
  75. package/dist/constructs/check-group.js.map +1 -0
  76. package/dist/constructs/check.d.ts +111 -0
  77. package/dist/constructs/check.js +88 -0
  78. package/dist/constructs/check.js.map +1 -0
  79. package/dist/constructs/construct.d.ts +17 -0
  80. package/dist/constructs/construct.js +22 -0
  81. package/dist/constructs/construct.js.map +1 -0
  82. package/dist/constructs/email-alert-channel.d.ts +26 -0
  83. package/dist/constructs/email-alert-channel.js +37 -0
  84. package/dist/constructs/email-alert-channel.js.map +1 -0
  85. package/dist/constructs/environment-variable.d.ts +2 -0
  86. package/dist/constructs/environment-variable.js +3 -0
  87. package/dist/constructs/environment-variable.js.map +1 -0
  88. package/dist/constructs/frequency.d.ts +20 -0
  89. package/dist/constructs/frequency.js +26 -0
  90. package/dist/constructs/frequency.js.map +1 -0
  91. package/dist/constructs/http-header.d.ts +2 -0
  92. package/dist/constructs/http-header.js +3 -0
  93. package/dist/constructs/http-header.js.map +1 -0
  94. package/dist/constructs/index.d.ts +15 -0
  95. package/dist/constructs/index.js +32 -0
  96. package/dist/constructs/index.js.map +1 -0
  97. package/dist/constructs/key-value-pair.d.ts +5 -0
  98. package/dist/constructs/key-value-pair.js +3 -0
  99. package/dist/constructs/key-value-pair.js.map +1 -0
  100. package/dist/constructs/opsgenie-alert-channel.d.ts +45 -0
  101. package/dist/constructs/opsgenie-alert-channel.js +44 -0
  102. package/dist/constructs/opsgenie-alert-channel.js.map +1 -0
  103. package/dist/constructs/pagerduty-alert-channel.d.ts +39 -0
  104. package/dist/constructs/pagerduty-alert-channel.js +42 -0
  105. package/dist/constructs/pagerduty-alert-channel.js.map +1 -0
  106. package/dist/constructs/project.d.ts +57 -0
  107. package/dist/constructs/project.js +100 -0
  108. package/dist/constructs/project.js.map +1 -0
  109. package/dist/constructs/query-param.d.ts +2 -0
  110. package/dist/constructs/query-param.js +3 -0
  111. package/dist/constructs/query-param.js.map +1 -0
  112. package/dist/constructs/ref.d.ts +5 -0
  113. package/dist/constructs/ref.js +13 -0
  114. package/dist/constructs/ref.js.map +1 -0
  115. package/dist/constructs/slack-alert-channel.d.ts +26 -0
  116. package/dist/constructs/slack-alert-channel.js +40 -0
  117. package/dist/constructs/slack-alert-channel.js.map +1 -0
  118. package/dist/constructs/sms-alert-channel.d.ts +27 -0
  119. package/dist/constructs/sms-alert-channel.js +38 -0
  120. package/dist/constructs/sms-alert-channel.js.map +1 -0
  121. package/dist/constructs/validator-error.d.ts +2 -0
  122. package/dist/constructs/validator-error.js +7 -0
  123. package/dist/constructs/validator-error.js.map +1 -0
  124. package/dist/constructs/webhook-alert-channel.d.ts +59 -0
  125. package/dist/constructs/webhook-alert-channel.js +50 -0
  126. package/dist/constructs/webhook-alert-channel.js.map +1 -0
  127. package/dist/help/examples.d.ts +6 -0
  128. package/dist/help/examples.js +22 -0
  129. package/dist/help/examples.js.map +1 -0
  130. package/dist/help/help-extension.d.ts +4 -0
  131. package/dist/help/help-extension.js +41 -0
  132. package/dist/help/help-extension.js.map +1 -0
  133. package/dist/index.d.ts +3 -0
  134. package/dist/index.js +7 -0
  135. package/dist/index.js.map +1 -0
  136. package/dist/messages/common-messages.d.ts +5 -0
  137. package/dist/messages/common-messages.js +9 -0
  138. package/dist/messages/common-messages.js.map +1 -0
  139. package/dist/reporters/abstract-list.d.ts +34 -0
  140. package/dist/reporters/abstract-list.js +128 -0
  141. package/dist/reporters/abstract-list.js.map +1 -0
  142. package/dist/reporters/ci.d.ts +12 -0
  143. package/dist/reporters/ci.js +29 -0
  144. package/dist/reporters/ci.js.map +1 -0
  145. package/dist/reporters/dot.d.ts +12 -0
  146. package/dist/reporters/dot.js +28 -0
  147. package/dist/reporters/dot.js.map +1 -0
  148. package/dist/reporters/github.d.ts +34 -0
  149. package/dist/reporters/github.js +103 -0
  150. package/dist/reporters/github.js.map +1 -0
  151. package/dist/reporters/list.d.ts +13 -0
  152. package/dist/reporters/list.js +57 -0
  153. package/dist/reporters/list.js.map +1 -0
  154. package/dist/reporters/reporter.d.ts +14 -0
  155. package/dist/reporters/reporter.js +23 -0
  156. package/dist/reporters/reporter.js.map +1 -0
  157. package/dist/reporters/util.d.ts +15 -0
  158. package/dist/reporters/util.js +283 -0
  159. package/dist/reporters/util.js.map +1 -0
  160. package/dist/rest/accounts.d.ts +12 -0
  161. package/dist/rest/accounts.js +15 -0
  162. package/dist/rest/accounts.js.map +1 -0
  163. package/dist/rest/api.d.ts +27 -0
  164. package/dist/rest/api.js +90 -0
  165. package/dist/rest/api.js.map +1 -0
  166. package/dist/rest/assets.d.ts +13 -0
  167. package/dist/rest/assets.js +30 -0
  168. package/dist/rest/assets.js.map +1 -0
  169. package/dist/rest/environment-variables.d.ts +16 -0
  170. package/dist/rest/environment-variables.js +25 -0
  171. package/dist/rest/environment-variables.js.map +1 -0
  172. package/dist/rest/locations.d.ts +11 -0
  173. package/dist/rest/locations.js +12 -0
  174. package/dist/rest/locations.js.map +1 -0
  175. package/dist/rest/private-locations.d.ts +11 -0
  176. package/dist/rest/private-locations.js +12 -0
  177. package/dist/rest/private-locations.js.map +1 -0
  178. package/dist/rest/projects.d.ts +43 -0
  179. package/dist/rest/projects.js +24 -0
  180. package/dist/rest/projects.js.map +1 -0
  181. package/dist/rest/runtimes.d.ts +15 -0
  182. package/dist/rest/runtimes.js +15 -0
  183. package/dist/rest/runtimes.js.map +1 -0
  184. package/dist/rest/test-sessions.d.ts +47 -0
  185. package/dist/rest/test-sessions.js +15 -0
  186. package/dist/rest/test-sessions.js.map +1 -0
  187. package/dist/rest/users.d.ts +12 -0
  188. package/dist/rest/users.js +12 -0
  189. package/dist/rest/users.js.map +1 -0
  190. package/dist/services/abstract-check-runner.d.ts +50 -0
  191. package/dist/services/abstract-check-runner.js +151 -0
  192. package/dist/services/abstract-check-runner.js.map +1 -0
  193. package/dist/services/check-parser/collector.d.ts +33 -0
  194. package/dist/services/check-parser/collector.js +48 -0
  195. package/dist/services/check-parser/collector.js.map +1 -0
  196. package/dist/services/check-parser/errors.d.ts +8 -0
  197. package/dist/services/check-parser/errors.js +45 -0
  198. package/dist/services/check-parser/errors.js.map +1 -0
  199. package/dist/services/check-parser/parser.d.ts +39 -0
  200. package/dist/services/check-parser/parser.js +296 -0
  201. package/dist/services/check-parser/parser.js.map +1 -0
  202. package/dist/services/checkly-config-loader.d.ts +54 -0
  203. package/dist/services/checkly-config-loader.js +55 -0
  204. package/dist/services/checkly-config-loader.js.map +1 -0
  205. package/dist/services/config.d.ts +24 -0
  206. package/dist/services/config.js +75 -0
  207. package/dist/services/config.js.map +1 -0
  208. package/dist/services/project-parser.d.ts +19 -0
  209. package/dist/services/project-parser.js +87 -0
  210. package/dist/services/project-parser.js.map +1 -0
  211. package/dist/services/socket-client.d.ts +4 -0
  212. package/dist/services/socket-client.js +20 -0
  213. package/dist/services/socket-client.js.map +1 -0
  214. package/dist/services/test-filters.d.ts +2 -0
  215. package/dist/services/test-filters.js +16 -0
  216. package/dist/services/test-filters.js.map +1 -0
  217. package/dist/services/test-runner.d.ts +21 -0
  218. package/dist/services/test-runner.js +50 -0
  219. package/dist/services/test-runner.js.map +1 -0
  220. package/dist/services/trigger-runner.d.ts +26 -0
  221. package/dist/services/trigger-runner.js +47 -0
  222. package/dist/services/trigger-runner.js.map +1 -0
  223. package/dist/services/util.d.ts +30 -0
  224. package/dist/services/util.js +157 -0
  225. package/dist/services/util.js.map +1 -0
  226. package/dist/tsconfig.tsbuildinfo +1 -0
  227. package/oclif.manifest.json +527 -0
  228. package/package.json +163 -18
  229. package/LICENSE +0 -121
  230. package/dist/checkly.min.js +0 -1
  231. package/index.js +0 -285
  232. package/logo.png +0 -0
  233. package/test.js +0 -183
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const ci_info_1 = require("ci-info");
5
+ const api = require("../rest/api");
6
+ const authCommand_1 = require("./authCommand");
7
+ const checkly_config_loader_1 = require("../services/checkly-config-loader");
8
+ const util_1 = require("../services/util");
9
+ const trigger_runner_1 = require("../services/trigger-runner");
10
+ const abstract_check_runner_1 = require("../services/abstract-check-runner");
11
+ const config_1 = require("../services/config");
12
+ const reporter_1 = require("../reporters/reporter");
13
+ const DEFAULT_REGION = 'eu-central-1';
14
+ class Trigger extends authCommand_1.AuthCommand {
15
+ async run() {
16
+ var _a, _b, _c;
17
+ const { flags } = await this.parse(Trigger);
18
+ const { location: runLocation, 'private-location': privateRunLocation, config: configFilename, tags: targetTags, timeout, verbose: verboseFlag, record: shouldRecord, reporter: reporterFlag, env, 'env-file': envFile, 'test-session-name': testSessionName, } = flags;
19
+ const envVars = await (0, util_1.getEnvs)(envFile, env);
20
+ const { configDirectory, configFilenames } = (0, util_1.splitConfigFilePath)(configFilename);
21
+ let checklyConfig;
22
+ try {
23
+ const { config } = await (0, checkly_config_loader_1.loadChecklyConfig)(configDirectory, configFilenames);
24
+ checklyConfig = config;
25
+ }
26
+ catch (err) { } // Don't throw an error if the config file is missing
27
+ const location = await this.prepareRunLocation(checklyConfig === null || checklyConfig === void 0 ? void 0 : checklyConfig.cli, {
28
+ runLocation: runLocation,
29
+ privateRunLocation,
30
+ });
31
+ const verbose = this.prepareVerboseFlag(verboseFlag, (_a = checklyConfig === null || checklyConfig === void 0 ? void 0 : checklyConfig.cli) === null || _a === void 0 ? void 0 : _a.verbose);
32
+ const reporterTypes = this.prepareReportersTypes(reporterFlag, (_b = checklyConfig === null || checklyConfig === void 0 ? void 0 : checklyConfig.cli) === null || _b === void 0 ? void 0 : _b.reporters);
33
+ const reporters = (0, reporter_1.createReporters)(reporterTypes, location, verbose);
34
+ const repoInfo = (0, util_1.getGitInformation)();
35
+ const ciInfo = (0, util_1.getCiInformation)();
36
+ const runner = new trigger_runner_1.default(config_1.default.getAccountId(), timeout, verbose, shouldRecord, location, (_c = targetTags === null || targetTags === void 0 ? void 0 : targetTags.map((tags) => tags.split(','))) !== null && _c !== void 0 ? _c : [], Object.entries(envVars).map(([key, value]) => ({ key, value })), repoInfo, ciInfo.environment, testSessionName);
37
+ // TODO: This is essentially the same for `checkly test`. Maybe reuse code.
38
+ runner.on(abstract_check_runner_1.Events.RUN_STARTED, (checks, testSessionId) => reporters.forEach(r => r.onBegin(checks, testSessionId)));
39
+ runner.on(abstract_check_runner_1.Events.CHECK_SUCCESSFUL, (checkRunId, _, result) => {
40
+ if (result.hasFailures) {
41
+ process.exitCode = 1;
42
+ }
43
+ reporters.forEach(r => r.onCheckEnd(checkRunId, result));
44
+ });
45
+ runner.on(abstract_check_runner_1.Events.CHECK_FAILED, (checkRunId, check, message) => {
46
+ reporters.forEach(r => r.onCheckEnd(checkRunId, {
47
+ ...check,
48
+ hasFailures: true,
49
+ runError: message,
50
+ }));
51
+ process.exitCode = 1;
52
+ });
53
+ runner.on(abstract_check_runner_1.Events.RUN_FINISHED, () => reporters.forEach(r => r.onEnd()));
54
+ runner.on(abstract_check_runner_1.Events.ERROR, (err) => {
55
+ reporters.forEach(r => r.onError(err));
56
+ process.exitCode = 1;
57
+ });
58
+ await runner.run();
59
+ }
60
+ // TODO: Reuse prepare* methods from the `checkly test command`
61
+ async prepareRunLocation(configOptions = {}, cliFlags = {}) {
62
+ // Command line options take precedence
63
+ if (cliFlags.runLocation) {
64
+ const { data: availableLocations } = await api.locations.getAll();
65
+ if (availableLocations.some(l => l.region === cliFlags.runLocation)) {
66
+ return { type: 'PUBLIC', region: cliFlags.runLocation };
67
+ }
68
+ throw new Error(`Unable to run checks on unsupported location "${cliFlags.runLocation}". ` +
69
+ `Supported locations are:\n${availableLocations.map(l => `${l.region}`).join('\n')}`);
70
+ }
71
+ else if (cliFlags.privateRunLocation) {
72
+ return this.preparePrivateRunLocation(cliFlags.privateRunLocation);
73
+ }
74
+ else if (configOptions.runLocation && configOptions.privateRunLocation) {
75
+ throw new Error('Both runLocation and privateRunLocation fields were set in the Checkly config file.' +
76
+ ` Please only specify one run location. The configured locations were' +
77
+ ' "${configOptions.runLocation}" and "${configOptions.privateRunLocation}"`);
78
+ }
79
+ else if (configOptions.runLocation) {
80
+ return { type: 'PUBLIC', region: configOptions.runLocation };
81
+ }
82
+ else if (configOptions.privateRunLocation) {
83
+ return this.preparePrivateRunLocation(configOptions.privateRunLocation);
84
+ }
85
+ else {
86
+ return { type: 'PUBLIC', region: DEFAULT_REGION };
87
+ }
88
+ }
89
+ async preparePrivateRunLocation(privateLocationSlugName) {
90
+ try {
91
+ const { data: privateLocations } = await api.privateLocations.getAll();
92
+ const privateLocation = privateLocations.find(({ slugName }) => slugName === privateLocationSlugName);
93
+ if (privateLocation) {
94
+ return { type: 'PRIVATE', id: privateLocation.id, slugName: privateLocationSlugName };
95
+ }
96
+ const { data: account } = await api.accounts.get(config_1.default.getAccountId());
97
+ throw new Error(`The specified private location "${privateLocationSlugName}" was not found on account "${account.name}".`);
98
+ }
99
+ catch (err) {
100
+ throw new Error(`Failed to get private locations. ${err.message}.`);
101
+ }
102
+ }
103
+ prepareVerboseFlag(verboseFlag, cliVerboseFlag) {
104
+ var _a;
105
+ return (_a = verboseFlag !== null && verboseFlag !== void 0 ? verboseFlag : cliVerboseFlag) !== null && _a !== void 0 ? _a : false;
106
+ }
107
+ prepareReportersTypes(reporterFlag, cliReporters = []) {
108
+ if (!reporterFlag && !cliReporters.length) {
109
+ return [ci_info_1.isCI ? 'ci' : 'list'];
110
+ }
111
+ return reporterFlag ? [reporterFlag] : cliReporters;
112
+ }
113
+ }
114
+ exports.default = Trigger;
115
+ Trigger.hidden = false;
116
+ Trigger.description = 'Trigger checks on Checkly';
117
+ Trigger.flags = {
118
+ location: core_1.Flags.string({
119
+ char: 'l',
120
+ description: 'The location to run the checks at.',
121
+ }),
122
+ 'private-location': core_1.Flags.string({
123
+ description: 'The private location to run checks at.',
124
+ exclusive: ['location'],
125
+ }),
126
+ tags: core_1.Flags.string({
127
+ char: 't',
128
+ description: 'Filter the checks to be run using a comma separated list of tags.' +
129
+ ' Checks will only be run if they contain all of the specified tags.' +
130
+ ' Multiple --tags flags can be passed, in which case checks will be run if they match any of the --tags filters.' +
131
+ ' F.ex. `--tags production,webapp --tags production,backend` will run checks with tags (production AND webapp) OR (production AND backend).',
132
+ multiple: true,
133
+ required: false,
134
+ }),
135
+ config: core_1.Flags.string({
136
+ char: 'c',
137
+ description: 'The Checkly CLI config filename.',
138
+ }),
139
+ timeout: core_1.Flags.integer({
140
+ default: 240,
141
+ description: 'A timeout (in seconds) to wait for checks to complete.',
142
+ }),
143
+ verbose: core_1.Flags.boolean({
144
+ char: 'v',
145
+ description: 'Always show the full logs of the checks.',
146
+ allowNo: true,
147
+ }),
148
+ reporter: core_1.Flags.string({
149
+ char: 'r',
150
+ description: 'A list of custom reporters for the test output.',
151
+ options: ['list', 'dot', 'ci', 'github'],
152
+ }),
153
+ env: core_1.Flags.string({
154
+ char: 'e',
155
+ description: 'Env vars to be passed to the check run.',
156
+ exclusive: ['env-file'],
157
+ multiple: true,
158
+ default: [],
159
+ }),
160
+ 'env-file': core_1.Flags.string({
161
+ description: 'dotenv file path to be passed. For example --env-file="./.env"',
162
+ exclusive: ['env'],
163
+ }),
164
+ record: core_1.Flags.boolean({
165
+ description: 'Record check results in Checkly as a test session with full logs, traces and videos.',
166
+ default: false,
167
+ }),
168
+ 'test-session-name': core_1.Flags.string({
169
+ char: 'n',
170
+ description: 'A name to use when storing results in Checkly with --record.',
171
+ }),
172
+ };
173
+ //# sourceMappingURL=trigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger.js","sourceRoot":"","sources":["../../src/commands/trigger.ts"],"names":[],"mappings":";;AAAA,sCAAmC;AACnC,qCAA8B;AAE9B,mCAAkC;AAClC,+CAA2C;AAC3C,6EAAqE;AACrE,2CAAoG;AAEpG,+DAAsD;AACtD,6EAAuG;AACvG,+CAAuC;AACvC,oDAAqE;AAErE,MAAM,cAAc,GAAG,cAAc,CAAA;AAErC,MAAqB,OAAQ,SAAQ,yBAAW;IA4D9C,KAAK,CAAC,GAAG;;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC3C,MAAM,EACJ,QAAQ,EAAE,WAAW,EACrB,kBAAkB,EAAE,kBAAkB,EACtC,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,UAAU,EAChB,OAAO,EACP,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,YAAY,EACtB,GAAG,EACH,UAAU,EAAE,OAAO,EACnB,mBAAm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AAC,OAAO,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,0CAA0C;QACvD,OAAO,EAAE,IAAI;KACd,CAAC;IACF,QAAQ,EAAE,YAAK,CAAC,MAAM,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,iDAAiD;QAC9D,OAAO,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC;KACzC,CAAC;IACF,GAAG,EAAE,YAAK,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,yCAAyC;QACtD,SAAS,EAAE,CAAC,UAAU,CAAC;QACvB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;KACZ,CAAC;IACF,UAAU,EAAE,YAAK,CAAC,MAAM,CAAC;QACvB,WAAW,EAAE,gEAAgE;QAC7E,SAAS,EAAE,CAAC,KAAK,CAAC;KACnB,CAAC;IACF,MAAM,EAAE,YAAK,CAAC,OAAO,CAAC;QACpB,WAAW,EAAE,sFAAsF;QACnG,OAAO,EAAE,KAAK;KACf,CAAC;IACF,mBAAmB,EAAE,YAAK,CAAC,MAAM,CAAC;QAChC,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,8DAA8D;KAC5E,CAAC;CACH,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { AuthCommand } from './authCommand';
2
+ export default class Whoami extends AuthCommand {
3
+ static hidden: boolean;
4
+ static description: string;
5
+ run(): Promise<void>;
6
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const config_1 = require("../services/config");
4
+ const api = require("../rest/api");
5
+ const authCommand_1 = require("./authCommand");
6
+ class Whoami extends authCommand_1.AuthCommand {
7
+ async run() {
8
+ const { data: account } = await api.accounts.get(config_1.default.getAccountId());
9
+ const { data: user } = await api.user.get();
10
+ this.log(`You are currently on account "${account.name}" (${account.id}) as ${user.name}.`);
11
+ }
12
+ }
13
+ exports.default = Whoami;
14
+ Whoami.hidden = false;
15
+ Whoami.description = 'See your currently logged in account and user.';
16
+ //# sourceMappingURL=whoami.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../src/commands/whoami.ts"],"names":[],"mappings":";;AAAA,+CAAuC;AACvC,mCAAkC;AAClC,+CAA2C;AAE3C,MAAqB,MAAO,SAAQ,yBAAW;IAG7C,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAM,CAAC,YAAY,EAAE,CAAC,CAAA;QACvE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;QAC3C,IAAI,CAAC,GAAG,CAAC,iCAAiC,OAAO,CAAC,IAAI,MAAM,OAAO,CAAC,EAAE,QAAQ,IAAI,CAAC,IAAI,GAAG,CAAC,CAAA;IAC7F,CAAC;;AAPH,yBAQC;AAPQ,aAAM,GAAG,KAAK,CAAA;AACd,kBAAW,GAAG,gDAAgD,CAAA"}
@@ -0,0 +1,31 @@
1
+ import type { ChecklyConfig } from './services/checkly-config-loader';
2
+ /**
3
+ * Supported regions
4
+ */
5
+ declare module './' {
6
+ interface Region {
7
+ 'us-east-1': string;
8
+ 'us-east-2': string;
9
+ 'us-west-1': string;
10
+ 'us-west-2': string;
11
+ 'ca-central-1': string;
12
+ 'sa-east-1': string;
13
+ 'eu-west-1': string;
14
+ 'eu-central-1': string;
15
+ 'eu-west-2': string;
16
+ 'eu-west-3': string;
17
+ 'eu-north-1': string;
18
+ 'eu-south-1': string;
19
+ 'me-south-1': string;
20
+ 'ap-southeast-1': string;
21
+ 'ap-northeast-1': string;
22
+ 'ap-east-1': string;
23
+ 'ap-southeast-2': string;
24
+ 'ap-southeast-3': string;
25
+ 'ap-northeast-2': string;
26
+ 'ap-northeast-3': string;
27
+ 'ap-south-1': string;
28
+ 'af-south-1': string;
29
+ }
30
+ }
31
+ export declare function defineConfig(config: ChecklyConfig): ChecklyConfig;
package/dist/config.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineConfig = void 0;
4
+ function defineConfig(config) {
5
+ return config;
6
+ }
7
+ exports.defineConfig = defineConfig;
8
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAiCA,SAAgB,YAAY,CAAE,MAAqB;IACjD,OAAO,MAAM,CAAA;AACf,CAAC;AAFD,oCAEC"}
@@ -0,0 +1,44 @@
1
+ import { Ref } from './ref';
2
+ import { Construct } from './construct';
3
+ export interface AlertChannelSubscriptionProps {
4
+ alertChannelId: Ref;
5
+ /**
6
+ * You can either pass a checkId or a groupId, but not both.
7
+ */
8
+ checkId?: Ref;
9
+ /**
10
+ * You can either pass a groupId or a checkId, but not both.
11
+ */
12
+ groupId?: Ref;
13
+ /**
14
+ * Determines if the suscription active or not.
15
+ */
16
+ activated: boolean;
17
+ }
18
+ /**
19
+ * Creates an Alert Channel Subscription
20
+ *
21
+ * @remarks
22
+ *
23
+ * This class make use of the Alert Channel Subscriptions endpoints.
24
+ */
25
+ export declare class AlertChannelSubscription extends Construct {
26
+ alertChannelId: Ref;
27
+ checkId?: Ref;
28
+ groupId?: Ref;
29
+ activated: boolean;
30
+ static readonly __checklyType = "alert-channel-subscription";
31
+ /**
32
+ * Constructs the Alert Channel Syscription instance
33
+ *
34
+ * @param logicalId unique project-scoped resource name identification
35
+ * @param props alert channel subscription configuration properties
36
+ */
37
+ constructor(logicalId: string, props: AlertChannelSubscriptionProps);
38
+ synthesize(): {
39
+ alertChannelId: Ref;
40
+ checkId: Ref | undefined;
41
+ groupId: Ref | undefined;
42
+ activated: boolean;
43
+ };
44
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AlertChannelSubscription = void 0;
4
+ const construct_1 = require("./construct");
5
+ const project_1 = require("./project");
6
+ /**
7
+ * Creates an Alert Channel Subscription
8
+ *
9
+ * @remarks
10
+ *
11
+ * This class make use of the Alert Channel Subscriptions endpoints.
12
+ */
13
+ class AlertChannelSubscription extends construct_1.Construct {
14
+ /**
15
+ * Constructs the Alert Channel Syscription instance
16
+ *
17
+ * @param logicalId unique project-scoped resource name identification
18
+ * @param props alert channel subscription configuration properties
19
+ */
20
+ constructor(logicalId, props) {
21
+ super(AlertChannelSubscription.__checklyType, logicalId);
22
+ this.alertChannelId = props.alertChannelId;
23
+ this.checkId = props.checkId;
24
+ this.groupId = props.groupId;
25
+ this.activated = props.activated;
26
+ project_1.Session.registerConstruct(this);
27
+ }
28
+ synthesize() {
29
+ return {
30
+ alertChannelId: this.alertChannelId,
31
+ checkId: this.checkId,
32
+ groupId: this.groupId,
33
+ activated: this.activated,
34
+ };
35
+ }
36
+ }
37
+ exports.AlertChannelSubscription = AlertChannelSubscription;
38
+ AlertChannelSubscription.__checklyType = 'alert-channel-subscription';
39
+ //# sourceMappingURL=alert-channel-subscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-channel-subscription.js","sourceRoot":"","sources":["../../src/constructs/alert-channel-subscription.ts"],"names":[],"mappings":";;;AACA,2CAAuC;AACvC,uCAAmC;AAkBnC;;;;;;GAMG;AACH,MAAa,wBAAyB,SAAQ,qBAAS;IAQrD;;;;;OAKG;IACH,YAAa,SAAiB,EAAE,KAAoC;QAClE,KAAK,CAAC,wBAAwB,CAAC,aAAa,EAAE,SAAS,CAAC,CAAA;QACxD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAA;QAC1C,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAA;QAC5B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAA;QAChC,iBAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA;IACjC,CAAC;IAED,UAAU;QACR,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAA;IACH,CAAC;;AA9BH,4DA+BC;AAzBiB,sCAAa,GAAG,4BAA4B,CAAA"}
@@ -0,0 +1,53 @@
1
+ import { Construct } from './construct';
2
+ export interface AlertChannelProps {
3
+ /**
4
+ * Determines if an alert should be send for check recoveries.
5
+ */
6
+ sendRecovery?: boolean;
7
+ /**
8
+ * Determines if an alert should be send for check failures.
9
+ */
10
+ sendFailure?: boolean;
11
+ /**
12
+ * Determines if an alert should be send when a check is degraded.
13
+ */
14
+ sendDegraded?: boolean;
15
+ /**
16
+ * Determines if an alert should be send for expiring SSL certificates.
17
+ */
18
+ sslExpiry?: boolean;
19
+ /**
20
+ * At what moment in time to start alerting on SSL certificates.
21
+ */
22
+ sslExpiryThreshold?: number;
23
+ }
24
+ declare class AlertChannelWrapper extends Construct {
25
+ constructor(logicalId: string, physicalId: string | number);
26
+ synthesize(): null;
27
+ }
28
+ /**
29
+ * Creates an Alert Channels
30
+ *
31
+ * @remarks
32
+ *
33
+ * This class make use of the Alert Channels endpoints.
34
+ */
35
+ export declare abstract class AlertChannel extends Construct {
36
+ sendRecovery?: boolean;
37
+ sendFailure?: boolean;
38
+ sendDegraded?: boolean;
39
+ sslExpiry?: boolean;
40
+ sslExpiryThreshold?: number;
41
+ static readonly __checklyType = "alert-channel";
42
+ /**
43
+ * Constructs the Alert Channel instance
44
+ *
45
+ * @param logicalId unique project-scoped resource name identification
46
+ * @param props alert channel configuration properties
47
+ */
48
+ constructor(logicalId: string, props: AlertChannelProps);
49
+ static fromId(id: string | number): AlertChannelWrapper;
50
+ allowInChecklyConfig(): boolean;
51
+ synthesize(): any | null;
52
+ }
53
+ export {};
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AlertChannel = void 0;
4
+ const construct_1 = require("./construct");
5
+ const project_1 = require("./project");
6
+ class AlertChannelWrapper extends construct_1.Construct {
7
+ constructor(logicalId, physicalId) {
8
+ super(AlertChannel.__checklyType, logicalId, physicalId, false);
9
+ project_1.Session.registerConstruct(this);
10
+ }
11
+ synthesize() {
12
+ return null;
13
+ }
14
+ }
15
+ /**
16
+ * Creates an Alert Channels
17
+ *
18
+ * @remarks
19
+ *
20
+ * This class make use of the Alert Channels endpoints.
21
+ */
22
+ class AlertChannel extends construct_1.Construct {
23
+ /**
24
+ * Constructs the Alert Channel instance
25
+ *
26
+ * @param logicalId unique project-scoped resource name identification
27
+ * @param props alert channel configuration properties
28
+ */
29
+ constructor(logicalId, props) {
30
+ super(AlertChannel.__checklyType, logicalId);
31
+ this.sendRecovery = props.sendRecovery;
32
+ this.sendFailure = props.sendFailure;
33
+ this.sendDegraded = props.sendDegraded;
34
+ this.sslExpiry = props.sslExpiry;
35
+ this.sslExpiryThreshold = props.sslExpiryThreshold;
36
+ }
37
+ static fromId(id) {
38
+ return new AlertChannelWrapper(`alert-channel-${id}`, id);
39
+ }
40
+ allowInChecklyConfig() {
41
+ return true;
42
+ }
43
+ synthesize() {
44
+ return {
45
+ sendRecovery: this.sendRecovery,
46
+ sendFailure: this.sendFailure,
47
+ sendDegraded: this.sendDegraded,
48
+ sslExpiry: this.sslExpiry,
49
+ sslExpiryThreshold: this.sslExpiryThreshold,
50
+ };
51
+ }
52
+ }
53
+ exports.AlertChannel = AlertChannel;
54
+ AlertChannel.__checklyType = 'alert-channel';
55
+ //# sourceMappingURL=alert-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-channel.js","sourceRoot":"","sources":["../../src/constructs/alert-channel.ts"],"names":[],"mappings":";;;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Check, CheckProps } from './check';
2
+ import { HttpHeader } from './http-header';
3
+ import { QueryParam } from './query-param';
4
+ import { Content, Entrypoint } from './construct';
5
+ declare enum AssertionSource {
6
+ STATUS_CODE = "STATUS_CODE",
7
+ JSON_BODY = "JSON_BODY",
8
+ HEADERS = "HEADERS",
9
+ TEXT_BODY = "TEXT_BODY",
10
+ RESPONSE_TIME = "RESPONSE_TIME"
11
+ }
12
+ export interface Assertion {
13
+ source: string;
14
+ property: string;
15
+ comparison: string;
16
+ target: string;
17
+ regex: string | null;
18
+ }
19
+ export declare class AssertionBuilder {
20
+ static statusCode(): NumericAssertionBuilder;
21
+ static jsonBody(property?: string): GeneralAssertionBuilder;
22
+ static headers(property?: string, regex?: string): GeneralAssertionBuilder;
23
+ static textBody(property?: string): GeneralAssertionBuilder;
24
+ static responseTme(): NumericAssertionBuilder;
25
+ }
26
+ declare class NumericAssertionBuilder {
27
+ source: AssertionSource;
28
+ constructor(source: AssertionSource);
29
+ equals(target: number): Assertion;
30
+ notEquals(target: number): Assertion;
31
+ lessThan(target: number): Assertion;
32
+ greaterThan(target: number): Assertion;
33
+ /** @private */
34
+ private _toAssertion;
35
+ }
36
+ declare class GeneralAssertionBuilder {
37
+ source: AssertionSource;
38
+ property?: string;
39
+ regex?: string;
40
+ constructor(source: AssertionSource, property?: string, regex?: string);
41
+ equals(target: string | number | boolean): Assertion;
42
+ notEquals(target: string | number | boolean): Assertion;
43
+ hasKey(target: string): Assertion;
44
+ notHasKey(target: string): Assertion;
45
+ hasValue(target: string | number | boolean): Assertion;
46
+ notHasValue(target: string | number | boolean): Assertion;
47
+ isEmpty(): Assertion;
48
+ notEmpty(): Assertion;
49
+ lessThan(target: string | number | boolean): Assertion;
50
+ greaterThan(target: string | number | boolean): Assertion;
51
+ contains(target: string): Assertion;
52
+ notContains(target: string): Assertion;
53
+ isNull(): Assertion;
54
+ isNotNull(): Assertion;
55
+ /** @private */
56
+ private _toAssertion;
57
+ }
58
+ export type BodyType = 'JSON' | 'FORM' | 'RAW' | 'GRAPHQL' | 'NONE';
59
+ export type HttpRequestMethod = 'get' | 'GET' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'head' | 'HEAD' | 'delete' | 'DELETE' | 'options' | 'OPTIONS';
60
+ export interface BasicAuth {
61
+ username: string;
62
+ password: string;
63
+ }
64
+ export type ApiCheckDefaultConfig = {
65
+ url?: string;
66
+ headers?: Array<HttpHeader>;
67
+ queryParameters?: Array<QueryParam>;
68
+ basicAuth?: BasicAuth;
69
+ };
70
+ export interface Request {
71
+ url: string;
72
+ method: HttpRequestMethod;
73
+ followRedirects?: boolean;
74
+ skipSSL?: boolean;
75
+ /**
76
+ * Check the main Checkly documentation on assertions for specific values like regular expressions
77
+ * and JSON path descriptors you can use in the "property" field.
78
+ */
79
+ assertions?: Array<Assertion>;
80
+ body?: string;
81
+ bodyType?: BodyType;
82
+ headers?: Array<HttpHeader>;
83
+ queryParameters?: Array<QueryParam>;
84
+ basicAuth?: BasicAuth;
85
+ }
86
+ export interface ScriptDependency {
87
+ path: string;
88
+ content: string;
89
+ }
90
+ export interface ApiCheckProps extends CheckProps {
91
+ /**
92
+ * Determines the request that the check is going to run.
93
+ */
94
+ request: Request;
95
+ /**
96
+ * A valid piece of Node.js code to run in the setup phase.
97
+ * @deprecated use the "setupScript" property instead
98
+ */
99
+ localSetupScript?: string;
100
+ /**
101
+ * A valid piece of Node.js code to run in the setup phase.
102
+ */
103
+ setupScript?: Content | Entrypoint;
104
+ /**
105
+ * A valid piece of Node.js code to run in the teardown phase.
106
+ * @deprecated use the "tearDownScript" property instead
107
+ */
108
+ localTearDownScript?: string;
109
+ /**
110
+ * A valid piece of Node.js code to run in the teardown phase.
111
+ */
112
+ tearDownScript?: Content | Entrypoint;
113
+ /**
114
+ * The response time in milliseconds where a check should be considered degraded.
115
+ */
116
+ degradedResponseTime?: number;
117
+ /**
118
+ * The response time in milliseconds where a check should be considered failing.
119
+ */
120
+ maxResponseTime?: number;
121
+ }
122
+ /**
123
+ * Creates an API Check
124
+ *
125
+ * @remarks
126
+ *
127
+ * This class make use of the API Checks endpoints.
128
+ */
129
+ export declare class ApiCheck extends Check {
130
+ request: Request;
131
+ localSetupScript?: string;
132
+ localTearDownScript?: string;
133
+ degradedResponseTime?: number;
134
+ maxResponseTime?: number;
135
+ private readonly setupScriptDependencies?;
136
+ private readonly tearDownScriptDependencies?;
137
+ private readonly setupScriptPath?;
138
+ private readonly tearDownScriptPath?;
139
+ /**
140
+ * Constructs the API Check instance
141
+ *
142
+ * @param logicalId unique project-scoped resource name identification
143
+ * @param props check configuration properties
144
+ *
145
+ * {@link https://checklyhq.com/docs/cli/constructs/#apicheck Read more in the docs}
146
+ */
147
+ constructor(logicalId: string, props: ApiCheckProps);
148
+ static bundle(entrypoint: string, runtimeId: string): {
149
+ script: string;
150
+ scriptPath: string;
151
+ dependencies: ScriptDependency[];
152
+ };
153
+ synthesize(): {
154
+ checkType: string;
155
+ request: Request;
156
+ localSetupScript: string | undefined;
157
+ setupScriptPath: string | undefined;
158
+ setupScriptDependencies: ScriptDependency[] | undefined;
159
+ localTearDownScript: string | undefined;
160
+ tearDownScriptPath: string | undefined;
161
+ tearDownScriptDependencies: ScriptDependency[] | undefined;
162
+ degradedResponseTime: number | undefined;
163
+ maxResponseTime: number | undefined;
164
+ name: string;
165
+ activated: boolean | undefined;
166
+ muted: boolean | undefined;
167
+ doubleCheck: boolean | undefined;
168
+ shouldFail: boolean | undefined;
169
+ runtimeId: string | undefined;
170
+ locations: (keyof import("..").Region)[] | undefined;
171
+ privateLocations: string[] | undefined;
172
+ tags: string[] | undefined;
173
+ frequency: number | undefined;
174
+ frequencyOffset: number | undefined;
175
+ groupId: import("./ref").Ref | undefined;
176
+ environmentVariables: import("./key-value-pair").default[] | undefined;
177
+ };
178
+ }
179
+ export {};