checkly 0.0.0-pr.686.4c0f5e3

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 (228) hide show
  1. package/README.md +43 -0
  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 +35 -0
  140. package/dist/reporters/abstract-list.js +135 -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 +95 -0
  150. package/dist/reporters/github.js.map +1 -0
  151. package/dist/reporters/list.d.ts +14 -0
  152. package/dist/reporters/list.js +56 -0
  153. package/dist/reporters/list.js.map +1 -0
  154. package/dist/reporters/reporter.d.ts +15 -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 +57 -0
  185. package/dist/rest/test-sessions.js +21 -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 +55 -0
  191. package/dist/services/abstract-check-runner.js +154 -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 +174 -0
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.environmentVariables = exports.testSessions = exports.privateLocations = exports.locations = exports.runtimes = exports.assets = exports.projects = exports.user = exports.accounts = exports.api = exports.validateAuthentication = exports.getDefaults = void 0;
4
+ const axios_1 = require("axios");
5
+ const config_1 = require("../services/config");
6
+ const accounts_1 = require("./accounts");
7
+ const users_1 = require("./users");
8
+ const projects_1 = require("./projects");
9
+ const assets_1 = require("./assets");
10
+ const runtimes_1 = require("./runtimes");
11
+ const private_locations_1 = require("./private-locations");
12
+ const locations_1 = require("./locations");
13
+ const test_sessions_1 = require("./test-sessions");
14
+ const environment_variables_1 = require("./environment-variables");
15
+ function getDefaults() {
16
+ const environments = {
17
+ production: {
18
+ apiUrl: 'https://api.checklyhq.com',
19
+ },
20
+ development: {
21
+ apiUrl: 'http://localhost:3000',
22
+ },
23
+ test: {
24
+ apiUrl: 'https://api-test.checklyhq.com',
25
+ },
26
+ staging: {
27
+ apiUrl: 'https://api-test.checklyhq.com',
28
+ },
29
+ };
30
+ const env = config_1.default.getEnv();
31
+ const apiKey = config_1.default.getApiKey();
32
+ const accountId = config_1.default.getAccountId();
33
+ const baseURL = environments[env].apiUrl;
34
+ const Authorization = `Bearer ${apiKey}`;
35
+ return { baseURL, accountId, Authorization, apiKey };
36
+ }
37
+ exports.getDefaults = getDefaults;
38
+ async function validateAuthentication() {
39
+ var _a;
40
+ if (!config_1.default.hasValidCredentials()) {
41
+ throw new Error('Run `npx checkly login` or manually set `CHECKLY_API_KEY` ' +
42
+ '& `CHECKLY_ACCOUNT_ID` environment variables to setup authentication.');
43
+ }
44
+ const accountId = config_1.default.getAccountId();
45
+ const apiKey = config_1.default.getApiKey();
46
+ try {
47
+ // check if credentials works
48
+ await exports.accounts.get(accountId);
49
+ }
50
+ catch (err) {
51
+ if (((_a = err.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
52
+ throw new Error(`Authentication failed with account id "${accountId}" ` +
53
+ `and API key "...${apiKey === null || apiKey === void 0 ? void 0 : apiKey.slice(-4)}"`);
54
+ }
55
+ else if (!err.response) {
56
+ // The request was made but no response was received. This may be due to an internet connection issue.
57
+ throw new Error(`Encountered an error connecting to Checkly. Please check that the internet connection is working. ${err.message}`);
58
+ }
59
+ else {
60
+ throw new Error(`Encountered an unexpected error connecting to Checkly: ${err.message}`);
61
+ }
62
+ }
63
+ }
64
+ exports.validateAuthentication = validateAuthentication;
65
+ function init() {
66
+ const { baseURL } = getDefaults();
67
+ const api = axios_1.default.create({ baseURL });
68
+ api.interceptors.request.use(function (config) {
69
+ const { Authorization, accountId } = getDefaults();
70
+ if (Authorization && config.headers) {
71
+ config.headers.Authorization = Authorization;
72
+ }
73
+ if (accountId && config.headers) {
74
+ config.headers['x-checkly-account'] = accountId;
75
+ }
76
+ return config;
77
+ });
78
+ return api;
79
+ }
80
+ exports.api = init();
81
+ exports.accounts = new accounts_1.default(exports.api);
82
+ exports.user = new users_1.default(exports.api);
83
+ exports.projects = new projects_1.default(exports.api);
84
+ exports.assets = new assets_1.default(exports.api);
85
+ exports.runtimes = new runtimes_1.default(exports.api);
86
+ exports.locations = new locations_1.default(exports.api);
87
+ exports.privateLocations = new private_locations_1.default(exports.api);
88
+ exports.testSessions = new test_sessions_1.default(exports.api);
89
+ exports.environmentVariables = new environment_variables_1.default(exports.api);
90
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/rest/api.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,13 @@
1
+ import type { AxiosInstance } from 'axios';
2
+ export default class Assets {
3
+ api: AxiosInstance;
4
+ constructor(api: AxiosInstance);
5
+ getLogs(region: string, key: string): Promise<Array<{
6
+ time: number;
7
+ msg: string;
8
+ level: string;
9
+ }>>;
10
+ getCheckRunData(region: string, key: string): Promise<any>;
11
+ private getAssets;
12
+ getAssetsLink(region: string, key: string): Promise<any>;
13
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // eslint-disable-next-line no-restricted-syntax
4
+ var AssetType;
5
+ (function (AssetType) {
6
+ AssetType["LOG"] = "log";
7
+ AssetType["CHECK_RUN_DATA"] = "check-run-data";
8
+ AssetType["SCREENSHOT"] = "screenshot";
9
+ })(AssetType || (AssetType = {}));
10
+ class Assets {
11
+ constructor(api) {
12
+ this.api = api;
13
+ }
14
+ getLogs(region, key) {
15
+ return this.getAssets(AssetType.LOG, region, key);
16
+ }
17
+ getCheckRunData(region, key) {
18
+ return this.getAssets(AssetType.CHECK_RUN_DATA, region, key);
19
+ }
20
+ async getAssets(assetType, region, key) {
21
+ const response = await this.api.get(`/next/assets/${assetType}/${region}/${encodeURIComponent(key)}`);
22
+ return response.data;
23
+ }
24
+ async getAssetsLink(region, key) {
25
+ const response = await this.api.get(`/next/assets/${AssetType.CHECK_RUN_DATA}/${region}/${encodeURIComponent(key)}/redirect?link=true`);
26
+ return response.data;
27
+ }
28
+ }
29
+ exports.default = Assets;
30
+ //# sourceMappingURL=assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.js","sourceRoot":"","sources":["../../src/rest/assets.ts"],"names":[],"mappings":";;AAEA,gDAAgD;AAChD,IAAK,SAIJ;AAJD,WAAK,SAAS;IACZ,wBAAW,CAAA;IACX,8CAAiC,CAAA;IACjC,sCAAyB,CAAA;AAC3B,CAAC,EAJI,SAAS,KAAT,SAAS,QAIb;AAED,MAAqB,MAAM;IAEzB,YAAa,GAAkB;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,OAAO,CAAE,MAAc,EAAE,GAAW;QAClC,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;IACnD,CAAC;IAED,eAAe,CAAE,MAAc,EAAE,GAAW;QAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9D,CAAC;IAEO,KAAK,CAAC,SAAS,CAAE,SAAoB,EAAE,MAAc,EAAE,GAAW;QACxE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,gBAAgB,SAAS,IAAI,MAAM,IAAI,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QACrG,OAAO,QAAQ,CAAC,IAAI,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,aAAa,CAAE,MAAc,EAAE,GAAW;QAC9C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CACjC,gBAAgB,SAAS,CAAC,cAAc,IAAI,MAAM,IAAI,kBAAkB,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;QACrG,OAAO,QAAQ,CAAC,IAAI,CAAA;IACtB,CAAC;CACF;AAxBD,yBAwBC"}
@@ -0,0 +1,16 @@
1
+ import type { AxiosInstance } from 'axios';
2
+ export interface EnvironmentVariable {
3
+ key: string;
4
+ value: string;
5
+ locked: boolean;
6
+ }
7
+ declare class EnvironmentVariables {
8
+ api: AxiosInstance;
9
+ constructor(api: AxiosInstance);
10
+ getAll(): Promise<import("axios").AxiosResponse<EnvironmentVariable[], any>>;
11
+ delete(environmentVariableKey: string): Promise<import("axios").AxiosResponse<any, any>>;
12
+ add(environmentVariableKey: string, environmentVariableValue: string, locked: boolean): Promise<import("axios").AxiosResponse<any, any>>;
13
+ get(environmentVariableKey: string): Promise<import("axios").AxiosResponse<EnvironmentVariable, any>>;
14
+ update(environmentVariableKey: string, environmentVariableValue: string, locked?: boolean): Promise<import("axios").AxiosResponse<any, any>>;
15
+ }
16
+ export default EnvironmentVariables;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class EnvironmentVariables {
4
+ constructor(api) {
5
+ this.api = api;
6
+ }
7
+ getAll() {
8
+ return this.api.get('/v1/variables');
9
+ }
10
+ delete(environmentVariableKey) {
11
+ return this.api.delete(`/v1/variables/${environmentVariableKey}`);
12
+ }
13
+ add(environmentVariableKey, environmentVariableValue, locked) {
14
+ return this.api.post('/v1/variables', { key: environmentVariableKey, value: environmentVariableValue, locked });
15
+ }
16
+ get(environmentVariableKey) {
17
+ return this.api.get(`/v1/variables/${environmentVariableKey}`);
18
+ }
19
+ // update environment variable with default locked value false
20
+ update(environmentVariableKey, environmentVariableValue, locked = false) {
21
+ return this.api.put(`/v1/variables/${environmentVariableKey}`, { value: environmentVariableValue, locked });
22
+ }
23
+ }
24
+ exports.default = EnvironmentVariables;
25
+ //# sourceMappingURL=environment-variables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment-variables.js","sourceRoot":"","sources":["../../src/rest/environment-variables.ts"],"names":[],"mappings":";;AAQA,MAAM,oBAAoB;IAExB,YAAa,GAAkB;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAA6B,eAAe,CAAC,CAAA;IAClE,CAAC;IAED,MAAM,CAAE,sBAA8B;QACpC,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,iBAAiB,sBAAsB,EAAE,CAAC,CAAA;IACnE,CAAC;IAED,GAAG,CAAE,sBAA8B,EAAE,wBAAgC,EAAE,MAAe;QACpF,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,GAAG,EAAE,sBAAsB,EAAE,KAAK,EAAE,wBAAwB,EAAE,MAAM,EAAE,CAAC,CAAA;IACjH,CAAC;IAED,GAAG,CAAE,sBAA8B;QACjC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAsB,iBAAiB,sBAAsB,EAAE,CAAC,CAAA;IACrF,CAAC;IAED,8DAA8D;IAC9D,MAAM,CAAE,sBAA8B,EAAE,wBAAgC,EAAE,MAAM,GAAG,KAAK;QACtF,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,iBAAiB,sBAAsB,EAAE,EAAE,EAAE,KAAK,EAAE,wBAAwB,EAAE,MAAM,EAAE,CAAC,CAAA;IAC7G,CAAC;CACF;AAED,kBAAe,oBAAoB,CAAA"}
@@ -0,0 +1,11 @@
1
+ import type { AxiosInstance } from 'axios';
2
+ export interface Location {
3
+ name: string;
4
+ region: string;
5
+ }
6
+ declare class Locations {
7
+ api: AxiosInstance;
8
+ constructor(api: AxiosInstance);
9
+ getAll(): Promise<import("axios").AxiosResponse<Location[], any>>;
10
+ }
11
+ export default Locations;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Locations {
4
+ constructor(api) {
5
+ this.api = api;
6
+ }
7
+ getAll() {
8
+ return this.api.get('/v1/locations');
9
+ }
10
+ }
11
+ exports.default = Locations;
12
+ //# sourceMappingURL=locations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locations.js","sourceRoot":"","sources":["../../src/rest/locations.ts"],"names":[],"mappings":";;AAOA,MAAM,SAAS;IAEb,YAAa,GAAkB;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAkB,eAAe,CAAC,CAAA;IACvD,CAAC;CACF;AAED,kBAAe,SAAS,CAAA"}
@@ -0,0 +1,11 @@
1
+ import type { AxiosInstance } from 'axios';
2
+ interface PrivateLocation {
3
+ slugName: string;
4
+ id: string;
5
+ }
6
+ export default class PrivateLocations {
7
+ api: AxiosInstance;
8
+ constructor(api: AxiosInstance);
9
+ getAll(): Promise<import("axios").AxiosResponse<PrivateLocation[], any>>;
10
+ }
11
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class PrivateLocations {
4
+ constructor(api) {
5
+ this.api = api;
6
+ }
7
+ getAll() {
8
+ return this.api.get('/v1/private-locations');
9
+ }
10
+ }
11
+ exports.default = PrivateLocations;
12
+ //# sourceMappingURL=private-locations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-locations.js","sourceRoot":"","sources":["../../src/rest/private-locations.ts"],"names":[],"mappings":";;AAOA,MAAqB,gBAAgB;IAEnC,YAAa,GAAkB;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAyB,uBAAuB,CAAC,CAAA;IACtE,CAAC;CACF;AATD,mCASC"}
@@ -0,0 +1,43 @@
1
+ import type { AxiosInstance } from 'axios';
2
+ export interface Project {
3
+ name: string;
4
+ logicalId: string;
5
+ repoUrl?: string;
6
+ }
7
+ type ProjectResponse = Project & {
8
+ id: string;
9
+ created_at: string;
10
+ };
11
+ export interface Change {
12
+ logicalId: string;
13
+ physicalId?: string;
14
+ type: string;
15
+ action: string;
16
+ }
17
+ export interface ResourceSync {
18
+ logicalId: string;
19
+ physicalId?: string | number;
20
+ type: string;
21
+ member: boolean;
22
+ payload: any;
23
+ }
24
+ export interface ProjectSync {
25
+ project: Project;
26
+ resources: Array<ResourceSync>;
27
+ }
28
+ export interface ProjectDeployResponse {
29
+ project: Project;
30
+ diff: Array<Change>;
31
+ }
32
+ declare class Projects {
33
+ api: AxiosInstance;
34
+ constructor(api: AxiosInstance);
35
+ getAll(): Promise<import("axios").AxiosResponse<ProjectResponse[], any>>;
36
+ get(id: string): Promise<import("axios").AxiosResponse<ProjectResponse, any>>;
37
+ create(project: Project): Promise<import("axios").AxiosResponse<any, any>>;
38
+ deleteProject(logicalId: string): Promise<import("axios").AxiosResponse<any, any>>;
39
+ deploy(resources: ProjectSync, { dryRun }?: {
40
+ dryRun?: boolean | undefined;
41
+ }): Promise<import("axios").AxiosResponse<ProjectDeployResponse, any>>;
42
+ }
43
+ export default Projects;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Projects {
4
+ constructor(api) {
5
+ this.api = api;
6
+ }
7
+ getAll() {
8
+ return this.api.get('/next/projects');
9
+ }
10
+ get(id) {
11
+ return this.api.get(`/next/projects/${id}`);
12
+ }
13
+ create(project) {
14
+ return this.api.post('/next/projects', project);
15
+ }
16
+ deleteProject(logicalId) {
17
+ return this.api.delete(`/next/projects/${logicalId}`);
18
+ }
19
+ deploy(resources, { dryRun = false } = {}) {
20
+ return this.api.post(`/next-v2/projects/deploy?dryRun=${dryRun}`, resources);
21
+ }
22
+ }
23
+ exports.default = Projects;
24
+ //# sourceMappingURL=projects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/rest/projects.ts"],"names":[],"mappings":";;AAkCA,MAAM,QAAQ;IAEZ,YAAa,GAAkB;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAyB,gBAAgB,CAAC,CAAA;IAC/D,CAAC;IAED,GAAG,CAAE,EAAU;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAkB,kBAAkB,EAAE,EAAE,CAAC,CAAA;IAC9D,CAAC;IAED,MAAM,CAAE,OAAgB;QACtB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAED,aAAa,CAAE,SAAiB;QAC9B,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,kBAAkB,SAAS,EAAE,CAAC,CAAA;IACvD,CAAC;IAED,MAAM,CAAE,SAAsB,EAAE,EAAE,MAAM,GAAG,KAAK,EAAE,GAAG,EAAE;QACrD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAClB,mCAAmC,MAAM,EAAE,EAC3C,SAAS,CACV,CAAA;IACH,CAAC;CACF;AAED,kBAAe,QAAQ,CAAA"}
@@ -0,0 +1,15 @@
1
+ import type { AxiosInstance } from 'axios';
2
+ export interface Runtime {
3
+ name: string;
4
+ stage?: string;
5
+ runtimeEndOfLife?: string;
6
+ description?: string;
7
+ dependencies: Record<string, string>;
8
+ }
9
+ declare class Runtimes {
10
+ api: AxiosInstance;
11
+ constructor(api: AxiosInstance);
12
+ getAll(): Promise<import("axios").AxiosResponse<Runtime[], any>>;
13
+ get(runtimeId: string): Promise<import("axios").AxiosResponse<Runtime, any>>;
14
+ }
15
+ export default Runtimes;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Runtimes {
4
+ constructor(api) {
5
+ this.api = api;
6
+ }
7
+ getAll() {
8
+ return this.api.get('/v1/runtimes');
9
+ }
10
+ get(runtimeId) {
11
+ return this.api.get(`/v1/runtimes/${runtimeId}`);
12
+ }
13
+ }
14
+ exports.default = Runtimes;
15
+ //# sourceMappingURL=runtimes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimes.js","sourceRoot":"","sources":["../../src/rest/runtimes.ts"],"names":[],"mappings":";;AAUA,MAAM,QAAQ;IAEZ,YAAa,GAAkB;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAiB,cAAc,CAAC,CAAA;IACrD,CAAC;IAED,GAAG,CAAE,SAAiB;QACpB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAU,gBAAgB,SAAS,EAAE,CAAC,CAAA;IAC3D,CAAC;CACF;AAED,kBAAe,QAAQ,CAAA"}
@@ -0,0 +1,57 @@
1
+ import type { AxiosInstance } from 'axios';
2
+ import { GitInformation } from '../services/util';
3
+ type RunTestSessionRequest = {
4
+ name: string;
5
+ checkRunJobs: any[];
6
+ project: {
7
+ logicalId: string;
8
+ };
9
+ runLocation: string | {
10
+ type: 'PUBLIC';
11
+ region: string;
12
+ } | {
13
+ type: 'PRIVATE';
14
+ slugName: string;
15
+ id: string;
16
+ };
17
+ repoInfo?: GitInformation | null;
18
+ environment?: string | null;
19
+ shouldRecord: boolean;
20
+ };
21
+ type TriggerTestSessionRequest = {
22
+ name: string;
23
+ runLocation: string | {
24
+ type: 'PUBLIC';
25
+ region: string;
26
+ } | {
27
+ type: 'PRIVATE';
28
+ slugName: string;
29
+ id: string;
30
+ };
31
+ shouldRecord: boolean;
32
+ targetTags: string[][];
33
+ checkRunSuiteId: string;
34
+ environmentVariables: Array<{
35
+ key: string;
36
+ value: string;
37
+ }>;
38
+ repoInfo: GitInformation | null;
39
+ environment: string | null;
40
+ };
41
+ export type TestResultsShortLinks = {
42
+ testResultLink: string;
43
+ testTraceLinks: string[];
44
+ videoLinks: string[];
45
+ screenshotLinks: string[];
46
+ };
47
+ declare class TestSessions {
48
+ api: AxiosInstance;
49
+ constructor(api: AxiosInstance);
50
+ run(payload: RunTestSessionRequest): Promise<import("axios").AxiosResponse<any, any>>;
51
+ trigger(payload: TriggerTestSessionRequest): Promise<import("axios").AxiosResponse<any, any>>;
52
+ getShortLink(id: string): Promise<import("axios").AxiosResponse<{
53
+ link: string;
54
+ }, any>>;
55
+ getResultShortLinks(testSessionId: string, testResultId: string): Promise<import("axios").AxiosResponse<TestResultsShortLinks, any>>;
56
+ }
57
+ export default TestSessions;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class TestSessions {
4
+ constructor(api) {
5
+ this.api = api;
6
+ }
7
+ run(payload) {
8
+ return this.api.post('/next/test-sessions/run', payload);
9
+ }
10
+ trigger(payload) {
11
+ return this.api.post('/next/test-sessions/trigger', payload);
12
+ }
13
+ getShortLink(id) {
14
+ return this.api.get(`/next/test-sessions/${id}/link`);
15
+ }
16
+ getResultShortLinks(testSessionId, testResultId) {
17
+ return this.api.get(`/next/test-sessions/${testSessionId}/results/${testResultId}/links`);
18
+ }
19
+ }
20
+ exports.default = TestSessions;
21
+ //# sourceMappingURL=test-sessions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-sessions.js","sourceRoot":"","sources":["../../src/rest/test-sessions.ts"],"names":[],"mappings":";;AA+BA,MAAM,YAAY;IAEhB,YAAa,GAAkB;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,GAAG,CAAE,OAA8B;QACjC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAA;IAC1D,CAAC;IAED,OAAO,CAAE,OAAkC;QACzC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAA;IAC9D,CAAC;IAED,YAAY,CAAE,EAAU;QACtB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAmB,uBAAuB,EAAE,OAAO,CAAC,CAAA;IACzE,CAAC;IAED,mBAAmB,CAAE,aAAqB,EAAE,YAAoB;QAC9D,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAwB,uBAAuB,aAAa,YAAY,YAAY,QAAQ,CAAC,CAAA;IAClH,CAAC;CACF;AAED,kBAAe,YAAY,CAAA"}
@@ -0,0 +1,12 @@
1
+ import type { AxiosInstance } from 'axios';
2
+ export interface User {
3
+ id: string;
4
+ name: string;
5
+ nickname?: string;
6
+ }
7
+ declare class Users {
8
+ api: AxiosInstance;
9
+ constructor(api: AxiosInstance);
10
+ get(): Promise<import("axios").AxiosResponse<User, any>>;
11
+ }
12
+ export default Users;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Users {
4
+ constructor(api) {
5
+ this.api = api;
6
+ }
7
+ get() {
8
+ return this.api.get('/next/users/me');
9
+ }
10
+ }
11
+ exports.default = Users;
12
+ //# sourceMappingURL=users.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/rest/users.ts"],"names":[],"mappings":";;AAQA,MAAM,KAAK;IAET,YAAa,GAAkB;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,GAAG;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAO,gBAAgB,CAAC,CAAA;IAC7C,CAAC;CACF;AAED,kBAAe,KAAK,CAAA"}
@@ -0,0 +1,55 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import PQueue from 'p-queue';
4
+ import { EventEmitter } from 'node:events';
5
+ import type { Region } from '..';
6
+ export declare enum Events {
7
+ CHECK_REGISTERED = "CHECK_REGISTERED",
8
+ CHECK_INPROGRESS = "CHECK_INPROGRESS",
9
+ CHECK_FAILED = "CHECK_FAILED",
10
+ CHECK_SUCCESSFUL = "CHECK_SUCCESSFUL",
11
+ CHECK_FINISHED = "CHECK_FINISHED",
12
+ RUN_STARTED = "RUN_STARTED",
13
+ RUN_FINISHED = "RUN_FINISHED",
14
+ ERROR = "ERROR"
15
+ }
16
+ export type PrivateRunLocation = {
17
+ type: 'PRIVATE';
18
+ id: string;
19
+ slugName: string;
20
+ };
21
+ export type PublicRunLocation = {
22
+ type: 'PUBLIC';
23
+ region: keyof Region;
24
+ };
25
+ export type RunLocation = PublicRunLocation | PrivateRunLocation;
26
+ export type CheckRunId = string;
27
+ export default abstract class AbstractCheckRunner extends EventEmitter {
28
+ checks: Map<CheckRunId, {
29
+ check: any;
30
+ testResultId?: string;
31
+ }>;
32
+ testSessionId?: string;
33
+ timeouts: Map<CheckRunId, NodeJS.Timeout>;
34
+ accountId: string;
35
+ timeout: number;
36
+ verbose: boolean;
37
+ queue: PQueue;
38
+ constructor(accountId: string, timeout: number, verbose: boolean);
39
+ abstract scheduleChecks(checkRunSuiteId: string): Promise<{
40
+ testSessionId?: string;
41
+ checks: Array<{
42
+ check: any;
43
+ checkRunId: CheckRunId;
44
+ testResultId?: string;
45
+ }>;
46
+ }>;
47
+ run(): Promise<void>;
48
+ private configureResultListener;
49
+ private processMessage;
50
+ private allChecksFinished;
51
+ private setAllTimeouts;
52
+ private disableAllTimeouts;
53
+ private disableTimeout;
54
+ private getShortLinks;
55
+ }