@alwaysmeticulous/cli 2.39.0 → 2.40.4

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 (119) hide show
  1. package/dist/api/test-run.api.d.ts +3 -31
  2. package/dist/api/test-run.api.js +3 -96
  3. package/dist/commands/download-replay/download-replay.command.js +4 -4
  4. package/dist/commands/download-session/download-session.command.js +4 -4
  5. package/dist/commands/record/record.command.js +8 -11
  6. package/dist/commands/replay/replay.command.d.ts +4 -20
  7. package/dist/commands/replay/replay.command.js +4 -239
  8. package/dist/commands/run-all-tests/run-all-tests.command.js +5 -6
  9. package/dist/commands/show-project/show-project.command.js +2 -3
  10. package/dist/index.d.ts +0 -7
  11. package/dist/index.js +1 -13
  12. package/dist/main.js +5 -11
  13. package/dist/utils/sentry.utils.d.ts +0 -4
  14. package/dist/utils/sentry.utils.js +3 -23
  15. package/package.json +14 -32
  16. package/dist/api/client.d.ts +0 -5
  17. package/dist/api/client.js +0 -32
  18. package/dist/api/download.d.ts +0 -1
  19. package/dist/api/download.js +0 -21
  20. package/dist/api/project.api.d.ts +0 -3
  21. package/dist/api/project.api.js +0 -22
  22. package/dist/api/replay-diff.api.d.ts +0 -13
  23. package/dist/api/replay-diff.api.js +0 -32
  24. package/dist/api/replay.api.d.ts +0 -36
  25. package/dist/api/replay.api.js +0 -89
  26. package/dist/api/session.api.d.ts +0 -6
  27. package/dist/api/session.api.js +0 -45
  28. package/dist/api/types.d.ts +0 -39
  29. package/dist/api/types.js +0 -2
  30. package/dist/api/upload.d.ts +0 -1
  31. package/dist/api/upload.js +0 -18
  32. package/dist/archive/archive.d.ts +0 -4
  33. package/dist/archive/archive.js +0 -64
  34. package/dist/command-utils/common-types.d.ts +0 -20
  35. package/dist/command-utils/common-types.js +0 -2
  36. package/dist/commands/bootstrap/bootstrap.command.d.ts +0 -2
  37. package/dist/commands/bootstrap/bootstrap.command.js +0 -33
  38. package/dist/commands/create-test/create-test.command.d.ts +0 -94
  39. package/dist/commands/create-test/create-test.command.js +0 -170
  40. package/dist/commands/replay/utils/compute-diff.d.ts +0 -13
  41. package/dist/commands/replay/utils/compute-diff.js +0 -95
  42. package/dist/commands/replay/utils/exit-early-if-skip-upload-env-var-set.d.ts +0 -1
  43. package/dist/commands/replay/utils/exit-early-if-skip-upload-env-var-set.js +0 -27
  44. package/dist/commands/screenshot-diff/screenshot-diff.command.d.ts +0 -53
  45. package/dist/commands/screenshot-diff/screenshot-diff.command.js +0 -182
  46. package/dist/commands/screenshot-diff/utils/get-screenshot-filename.d.ts +0 -2
  47. package/dist/commands/screenshot-diff/utils/get-screenshot-filename.js +0 -18
  48. package/dist/commands/screenshot-diff/utils/get-screenshot-identifier.d.ts +0 -2
  49. package/dist/commands/screenshot-diff/utils/get-screenshot-identifier.js +0 -24
  50. package/dist/commands/screenshot-diff/utils/has-notable-differences.d.ts +0 -2
  51. package/dist/commands/screenshot-diff/utils/has-notable-differences.js +0 -10
  52. package/dist/commands/serve/serve.command.d.ts +0 -10
  53. package/dist/commands/serve/serve.command.js +0 -31
  54. package/dist/commands/update-tests/update-tests.command.d.ts +0 -21
  55. package/dist/commands/update-tests/update-tests.command.js +0 -96
  56. package/dist/config/config.d.ts +0 -3
  57. package/dist/config/config.js +0 -70
  58. package/dist/config/config.types.d.ts +0 -16
  59. package/dist/config/config.types.js +0 -2
  60. package/dist/config/snippets.d.ts +0 -1
  61. package/dist/config/snippets.js +0 -18
  62. package/dist/errors/config.d.ts +0 -3
  63. package/dist/errors/config.js +0 -10
  64. package/dist/image/diff.utils.d.ts +0 -19
  65. package/dist/image/diff.utils.js +0 -25
  66. package/dist/image/io.utils.d.ts +0 -3
  67. package/dist/image/io.utils.js +0 -25
  68. package/dist/local-data/local-data.utils.d.ts +0 -20
  69. package/dist/local-data/local-data.utils.js +0 -92
  70. package/dist/local-data/replay-assets.d.ts +0 -3
  71. package/dist/local-data/replay-assets.js +0 -94
  72. package/dist/local-data/replays.d.ts +0 -18
  73. package/dist/local-data/replays.js +0 -87
  74. package/dist/local-data/screenshot-diffs.d.ts +0 -7
  75. package/dist/local-data/screenshot-diffs.js +0 -20
  76. package/dist/local-data/serve-assets-from-simulation.d.ts +0 -5
  77. package/dist/local-data/serve-assets-from-simulation.js +0 -52
  78. package/dist/local-data/sessions.d.ts +0 -10
  79. package/dist/local-data/sessions.js +0 -41
  80. package/dist/parallel-tests/__tests__/merge-test-results.spec.d.ts +0 -1
  81. package/dist/parallel-tests/__tests__/merge-test-results.spec.js +0 -104
  82. package/dist/parallel-tests/__tests__/mock-test-results.d.ts +0 -17
  83. package/dist/parallel-tests/__tests__/mock-test-results.js +0 -106
  84. package/dist/parallel-tests/__tests__/parrallel-tests.handler.spec.d.ts +0 -1
  85. package/dist/parallel-tests/__tests__/parrallel-tests.handler.spec.js +0 -205
  86. package/dist/parallel-tests/execute-test-in-child-process.d.ts +0 -3
  87. package/dist/parallel-tests/execute-test-in-child-process.js +0 -44
  88. package/dist/parallel-tests/merge-test-results.d.ts +0 -12
  89. package/dist/parallel-tests/merge-test-results.js +0 -122
  90. package/dist/parallel-tests/messages.types.d.ts +0 -17
  91. package/dist/parallel-tests/messages.types.js +0 -2
  92. package/dist/parallel-tests/parallel-replay.handler.d.ts +0 -3
  93. package/dist/parallel-tests/parallel-replay.handler.js +0 -57
  94. package/dist/parallel-tests/parallel-replay.types.d.ts +0 -16
  95. package/dist/parallel-tests/parallel-replay.types.js +0 -2
  96. package/dist/parallel-tests/parallel-tests.handler.d.ts +0 -14
  97. package/dist/parallel-tests/parallel-tests.handler.js +0 -194
  98. package/dist/parallel-tests/run-all-tests.d.ts +0 -73
  99. package/dist/parallel-tests/run-all-tests.js +0 -237
  100. package/dist/parallel-tests/run-all-tests.types.d.ts +0 -6
  101. package/dist/parallel-tests/run-all-tests.types.js +0 -2
  102. package/dist/parallel-tests/screenshot-diff-results.utils.d.ts +0 -7
  103. package/dist/parallel-tests/screenshot-diff-results.utils.js +0 -20
  104. package/dist/parallel-tests/task.handler.d.ts +0 -1
  105. package/dist/parallel-tests/task.handler.js +0 -86
  106. package/dist/utils/api-token.utils.d.ts +0 -1
  107. package/dist/utils/api-token.utils.js +0 -31
  108. package/dist/utils/commit-sha.utils.d.ts +0 -1
  109. package/dist/utils/commit-sha.utils.js +0 -42
  110. package/dist/utils/config.utils.d.ts +0 -7
  111. package/dist/utils/config.utils.js +0 -33
  112. package/dist/utils/github-summary.utils.d.ts +0 -5
  113. package/dist/utils/github-summary.utils.js +0 -38
  114. package/dist/utils/run-all-tests.utils.d.ts +0 -16
  115. package/dist/utils/run-all-tests.utils.js +0 -32
  116. package/dist/utils/test-run-environment.utils.d.ts +0 -2
  117. package/dist/utils/test-run-environment.utils.js +0 -25
  118. package/dist/utils/version.utils.d.ts +0 -1
  119. package/dist/utils/version.utils.js +0 -17
package/dist/index.d.ts CHANGED
@@ -1,14 +1,7 @@
1
- export { GetLatestTestRunResultsOptions } from "./api/test-run.api";
2
- export { bootstrapCommand } from "./commands/bootstrap/bootstrap.command";
3
- export { createTestCommand } from "./commands/create-test/create-test.command";
4
1
  export { downloadReplayCommand } from "./commands/download-replay/download-replay.command";
5
2
  export { downloadSessionCommand } from "./commands/download-session/download-session.command";
6
3
  export { recordCommand } from "./commands/record/record.command";
7
4
  export { replayCommand } from "./commands/replay/replay.command";
8
5
  export { runAllTestsCommand } from "./commands/run-all-tests/run-all-tests.command";
9
- export { screenshotDiffCommand } from "./commands/screenshot-diff/screenshot-diff.command";
10
6
  export { showProjectCommand } from "./commands/show-project/show-project.command";
11
- export { updateTestsCommand } from "./commands/update-tests/update-tests.command";
12
- export { runAllTests, RunAllTestsResult, RunAllTestsTestRun as TestRun, RunAllTestsTestRun, } from "./parallel-tests/run-all-tests";
13
7
  export { initLogger, setLogLevel } from "./utils/logger.utils";
14
- export { initSentry } from "./utils/sentry.utils";
package/dist/index.js CHANGED
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initSentry = exports.setLogLevel = exports.initLogger = exports.runAllTests = exports.updateTestsCommand = exports.showProjectCommand = exports.screenshotDiffCommand = exports.runAllTestsCommand = exports.replayCommand = exports.recordCommand = exports.downloadSessionCommand = exports.downloadReplayCommand = exports.createTestCommand = exports.bootstrapCommand = void 0;
4
- var bootstrap_command_1 = require("./commands/bootstrap/bootstrap.command");
5
- Object.defineProperty(exports, "bootstrapCommand", { enumerable: true, get: function () { return bootstrap_command_1.bootstrapCommand; } });
6
- var create_test_command_1 = require("./commands/create-test/create-test.command");
7
- Object.defineProperty(exports, "createTestCommand", { enumerable: true, get: function () { return create_test_command_1.createTestCommand; } });
3
+ exports.setLogLevel = exports.initLogger = exports.showProjectCommand = exports.runAllTestsCommand = exports.replayCommand = exports.recordCommand = exports.downloadSessionCommand = exports.downloadReplayCommand = void 0;
8
4
  var download_replay_command_1 = require("./commands/download-replay/download-replay.command");
9
5
  Object.defineProperty(exports, "downloadReplayCommand", { enumerable: true, get: function () { return download_replay_command_1.downloadReplayCommand; } });
10
6
  var download_session_command_1 = require("./commands/download-session/download-session.command");
@@ -15,16 +11,8 @@ var replay_command_1 = require("./commands/replay/replay.command");
15
11
  Object.defineProperty(exports, "replayCommand", { enumerable: true, get: function () { return replay_command_1.replayCommand; } });
16
12
  var run_all_tests_command_1 = require("./commands/run-all-tests/run-all-tests.command");
17
13
  Object.defineProperty(exports, "runAllTestsCommand", { enumerable: true, get: function () { return run_all_tests_command_1.runAllTestsCommand; } });
18
- var screenshot_diff_command_1 = require("./commands/screenshot-diff/screenshot-diff.command");
19
- Object.defineProperty(exports, "screenshotDiffCommand", { enumerable: true, get: function () { return screenshot_diff_command_1.screenshotDiffCommand; } });
20
14
  var show_project_command_1 = require("./commands/show-project/show-project.command");
21
15
  Object.defineProperty(exports, "showProjectCommand", { enumerable: true, get: function () { return show_project_command_1.showProjectCommand; } });
22
- var update_tests_command_1 = require("./commands/update-tests/update-tests.command");
23
- Object.defineProperty(exports, "updateTestsCommand", { enumerable: true, get: function () { return update_tests_command_1.updateTestsCommand; } });
24
- var run_all_tests_1 = require("./parallel-tests/run-all-tests");
25
- Object.defineProperty(exports, "runAllTests", { enumerable: true, get: function () { return run_all_tests_1.runAllTests; } });
26
16
  var logger_utils_1 = require("./utils/logger.utils");
27
17
  Object.defineProperty(exports, "initLogger", { enumerable: true, get: function () { return logger_utils_1.initLogger; } });
28
18
  Object.defineProperty(exports, "setLogLevel", { enumerable: true, get: function () { return logger_utils_1.setLogLevel; } });
29
- var sentry_utils_1 = require("./utils/sentry.utils");
30
- Object.defineProperty(exports, "initSentry", { enumerable: true, get: function () { return sentry_utils_1.initSentry; } });
package/dist/main.js CHANGED
@@ -4,19 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.main = void 0;
7
+ const path_1 = require("path");
7
8
  const common_1 = require("@alwaysmeticulous/common");
9
+ const sentry_1 = require("@alwaysmeticulous/sentry");
8
10
  const yargs_1 = __importDefault(require("yargs"));
9
- const bootstrap_command_1 = require("./commands/bootstrap/bootstrap.command");
10
- const create_test_command_1 = require("./commands/create-test/create-test.command");
11
11
  const download_replay_command_1 = require("./commands/download-replay/download-replay.command");
12
12
  const download_session_command_1 = require("./commands/download-session/download-session.command");
13
13
  const record_command_1 = require("./commands/record/record.command");
14
14
  const replay_command_1 = require("./commands/replay/replay.command");
15
15
  const run_all_tests_command_1 = require("./commands/run-all-tests/run-all-tests.command");
16
- const screenshot_diff_command_1 = require("./commands/screenshot-diff/screenshot-diff.command");
17
- const serve_command_1 = require("./commands/serve/serve.command");
18
16
  const show_project_command_1 = require("./commands/show-project/show-project.command");
19
- const update_tests_command_1 = require("./commands/update-tests/update-tests.command");
20
17
  const logger_utils_1 = require("./utils/logger.utils");
21
18
  const sentry_utils_1 = require("./utils/sentry.utils");
22
19
  const handleDataDir = (dataDir) => {
@@ -24,23 +21,20 @@ const handleDataDir = (dataDir) => {
24
21
  };
25
22
  const main = async () => {
26
23
  (0, logger_utils_1.initLogger)();
27
- await (0, sentry_utils_1.initSentry)();
24
+ const packageJsonPath = (0, path_1.normalize)((0, path_1.join)(__dirname, "../package.json"));
25
+ const meticulousVersion = await (0, common_1.getMeticulousVersion)(packageJsonPath);
26
+ await (0, sentry_1.initSentry)(meticulousVersion);
28
27
  yargs_1.default
29
28
  .scriptName("meticulous")
30
29
  .usage(`$0 <command>
31
30
 
32
31
  Meticulous CLI`)
33
- .command(bootstrap_command_1.bootstrapCommand)
34
- .command(create_test_command_1.createTestCommand)
35
32
  .command(download_replay_command_1.downloadReplayCommand)
36
33
  .command(download_session_command_1.downloadSessionCommand)
37
34
  .command(record_command_1.recordCommand)
38
35
  .command(replay_command_1.replayCommand)
39
36
  .command(run_all_tests_command_1.runAllTestsCommand)
40
- .command(screenshot_diff_command_1.screenshotDiffCommand)
41
37
  .command(show_project_command_1.showProjectCommand)
42
- .command(update_tests_command_1.updateTestsCommand)
43
- .command("serve", false, serve_command_1.serveCommand) // This is a debugging command, so we hide it to not pollute the main menu
44
38
  .help()
45
39
  .strict()
46
40
  .demandCommand()
@@ -1,6 +1,2 @@
1
- import * as Sentry from "@sentry/node";
2
- import { Duration } from "luxon";
3
- export declare const SENTRY_FLUSH_TIMEOUT: Duration;
4
- export declare const initSentry: (tracesSampleRateOverride?: number) => Promise<Sentry.Hub>;
5
1
  export declare const setOptions: (options: any) => void;
6
2
  export declare const wrapHandler: <T>(handler: (args: T) => Promise<void>) => (args: T) => Promise<void>;
@@ -26,31 +26,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.wrapHandler = exports.setOptions = exports.initSentry = exports.SENTRY_FLUSH_TIMEOUT = void 0;
29
+ exports.wrapHandler = exports.setOptions = void 0;
30
30
  const common_1 = require("@alwaysmeticulous/common");
31
+ const sentry_1 = require("@alwaysmeticulous/sentry");
31
32
  const Sentry = __importStar(require("@sentry/node"));
32
- const tracing_1 = require("@sentry/tracing");
33
33
  const loglevel_1 = __importDefault(require("loglevel"));
34
- const luxon_1 = require("luxon");
35
- const version_utils_1 = require("./version.utils");
36
- const SENTRY_DSN = "https://10c6a6c9f5434786b37fb81b01323798@o914390.ingest.sentry.io/6435232";
37
- exports.SENTRY_FLUSH_TIMEOUT = luxon_1.Duration.fromObject({ seconds: 1 });
38
- const getTracesSampleRate = () => {
39
- var _a;
40
- return parseFloat((_a = process.env["METICULOUS_TELEMETRY_SAMPLE_RATE"]) !== null && _a !== void 0 ? _a : "1.0");
41
- };
42
- const initSentry = async (tracesSampleRateOverride) => {
43
- const meticulousVersion = await (0, version_utils_1.getMeticulousVersion)();
44
- Sentry.init({
45
- dsn: SENTRY_DSN,
46
- release: meticulousVersion,
47
- tracesSampleRate: tracesSampleRateOverride !== null && tracesSampleRateOverride !== void 0 ? tracesSampleRateOverride : getTracesSampleRate(),
48
- environment: __filename.endsWith(".ts") ? "development" : "production",
49
- });
50
- (0, tracing_1.addExtensionMethods)();
51
- return Sentry.getCurrentHub();
52
- };
53
- exports.initSentry = initSentry;
54
34
  const setOptions = (options) => {
55
35
  Sentry.setContext("invoke-options", options);
56
36
  };
@@ -87,5 +67,5 @@ const reportHandlerError = async (error) => {
87
67
  logger.info("");
88
68
  logger.info("Tip: run `meticulous <command> --help` for help on a particular command, or `meticulous --help` for a list of the available commands.");
89
69
  Sentry.captureException(error);
90
- await Sentry.flush(exports.SENTRY_FLUSH_TIMEOUT.toMillis());
70
+ await Sentry.flush(sentry_1.SENTRY_FLUSH_TIMEOUT.toMillis());
91
71
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwaysmeticulous/cli",
3
- "version": "2.39.0",
3
+ "version": "2.40.4",
4
4
  "description": "The Meticulous CLI",
5
5
  "license": "ISC",
6
6
  "main": "dist/index.js",
@@ -23,43 +23,25 @@
23
23
  "cli": "node dist/main.js",
24
24
  "cli:dev": "ts-node src/main.ts",
25
25
  "cli:dev-localhost": "METICULOUS_API_URL=http://localhost:3001/api/ ts-node src/main.ts",
26
- "test": "jest"
26
+ "test": "jest --passWithNoTests",
27
+ "depcheck": "depcheck --ignore-patterns=dist"
27
28
  },
28
29
  "dependencies": {
29
- "@alwaysmeticulous/common": "^2.39.0",
30
+ "@alwaysmeticulous/api": "^2.40.4",
31
+ "@alwaysmeticulous/client": "^2.40.4",
32
+ "@alwaysmeticulous/common": "^2.40.4",
33
+ "@alwaysmeticulous/downloading-helpers": "^2.40.4",
34
+ "@alwaysmeticulous/record": "^2.40.4",
35
+ "@alwaysmeticulous/replay-orchestrator": "^2.40.4",
36
+ "@alwaysmeticulous/sdk-bundles-api": "^2.40.4",
37
+ "@alwaysmeticulous/sentry": "^2.40.0",
30
38
  "@sentry/node": "^7.36.0",
31
- "@sentry/tracing": "^7.36.0",
32
- "adm-zip": "^0.5.9",
33
- "archiver": "^5.3.1",
34
39
  "axios": "^1.2.6",
35
- "chalk": "^4.1.2",
36
- "cosmiconfig": "^8.0.0",
37
- "express": "^4.18.1",
38
- "fast-json-stable-stringify": "^2.1.0",
39
- "find-free-port": "^2.0.0",
40
- "inquirer": "^8.2.4",
41
- "luxon": "^3.2.1",
42
- "pixelmatch": "^5.3.0",
43
- "pngjs": "^7.0.0",
44
- "proper-lockfile": "^4.1.2",
40
+ "loglevel": "^1.8.0",
45
41
  "yargs": "^17.5.1"
46
42
  },
47
43
  "devDependencies": {
48
- "@alwaysmeticulous/api": "^2.39.0",
49
- "@types/express": "^4.17.14",
50
- "@types/proper-lockfile": "^4.1.2"
51
- },
52
- "peerDependencies": {
53
- "@alwaysmeticulous/record": "^2.3.3",
54
- "@alwaysmeticulous/replayer": "^2.5.1"
55
- },
56
- "peerDependenciesMeta": {
57
- "@alwaysmeticulous/record": {
58
- "optional": true
59
- },
60
- "@alwaysmeticulous/replayer": {
61
- "optional": true
62
- }
44
+ "@types/yargs": "^17.0.10"
63
45
  },
64
46
  "author": {
65
47
  "name": "The Meticulous Team",
@@ -95,5 +77,5 @@
95
77
  "coverageDirectory": "../coverage",
96
78
  "testEnvironment": "node"
97
79
  },
98
- "gitHead": "b6488b15a8233fcd1380b1607ec254d5d3bc0378"
80
+ "gitHead": "11acce96c03e23cbb556779a121710a8136d24db"
99
81
  }
@@ -1,5 +0,0 @@
1
- import { AxiosInstance } from "axios";
2
- export interface ClientOptions {
3
- apiToken: string | null | undefined;
4
- }
5
- export declare const createClient: (options: ClientOptions) => AxiosInstance;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createClient = void 0;
7
- const common_1 = require("@alwaysmeticulous/common");
8
- const axios_1 = __importDefault(require("axios"));
9
- const loglevel_1 = __importDefault(require("loglevel"));
10
- const api_token_utils_1 = require("../utils/api-token.utils");
11
- const BASE_API_URL = "https://app.meticulous.ai/api/";
12
- const createClient = ({ apiToken: apiToken_, }) => {
13
- const apiToken = (0, api_token_utils_1.getApiToken)(apiToken_);
14
- if (!apiToken) {
15
- const logger = loglevel_1.default.getLogger(common_1.METICULOUS_LOGGER_NAME);
16
- logger.error("You must provide an API token by using the --apiToken parameter");
17
- process.exit(1);
18
- }
19
- return axios_1.default.create({
20
- baseURL: getApiUrl(),
21
- headers: {
22
- authorization: apiToken,
23
- },
24
- });
25
- };
26
- exports.createClient = createClient;
27
- const getApiUrl = () => {
28
- if (process.env["METICULOUS_API_URL"]) {
29
- return process.env["METICULOUS_API_URL"];
30
- }
31
- return BASE_API_URL;
32
- };
@@ -1 +0,0 @@
1
- export declare const downloadFile: (fileUrl: string, path: string) => Promise<void>;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.downloadFile = void 0;
7
- const fs_1 = require("fs");
8
- const stream_1 = require("stream");
9
- const util_1 = require("util");
10
- const axios_1 = __importDefault(require("axios"));
11
- const promisifiedFinished = (0, util_1.promisify)(stream_1.finished);
12
- const downloadFile = async (fileUrl, path) => {
13
- const writer = (0, fs_1.createWriteStream)(path);
14
- return axios_1.default
15
- .request({ method: "GET", url: fileUrl, responseType: "stream" })
16
- .then(async (response) => {
17
- response.data.pipe(writer);
18
- return promisifiedFinished(writer);
19
- });
20
- };
21
- exports.downloadFile = downloadFile;
@@ -1,3 +0,0 @@
1
- import { Project } from "@alwaysmeticulous/api";
2
- import { AxiosInstance } from "axios";
3
- export declare const getProject: (client: AxiosInstance) => Promise<Project | null>;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getProject = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const getProject = async (client) => {
9
- const { data } = await client
10
- .get("projects/token-info")
11
- .catch((error) => {
12
- var _a;
13
- if (axios_1.default.isAxiosError(error)) {
14
- if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
15
- return { data: null };
16
- }
17
- }
18
- throw error;
19
- });
20
- return data;
21
- };
22
- exports.getProject = getProject;
@@ -1,13 +0,0 @@
1
- import { ReplayDiff, ReplayDiffData } from "@alwaysmeticulous/api";
2
- import { AxiosInstance } from "axios";
3
- export declare const getReplayDiff: ({ client, replayDiffId, }: {
4
- client: AxiosInstance;
5
- replayDiffId: string;
6
- }) => Promise<ReplayDiff | null>;
7
- export declare const createReplayDiff: ({ client, headReplayId, baseReplayId, testRunId, data: replayDiffData, }: {
8
- client: AxiosInstance;
9
- headReplayId: string;
10
- baseReplayId: string;
11
- testRunId: string | null;
12
- data: ReplayDiffData;
13
- }) => Promise<ReplayDiff>;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createReplayDiff = exports.getReplayDiff = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const getReplayDiff = async ({ client, replayDiffId, }) => {
9
- const { data } = await client
10
- .get(`replay-diffs/${replayDiffId}`)
11
- .catch((error) => {
12
- var _a;
13
- if (axios_1.default.isAxiosError(error)) {
14
- if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
15
- return { data: null };
16
- }
17
- }
18
- throw error;
19
- });
20
- return data;
21
- };
22
- exports.getReplayDiff = getReplayDiff;
23
- const createReplayDiff = async ({ client, headReplayId, baseReplayId, testRunId, data: replayDiffData, }) => {
24
- const { data } = await client.post("replay-diffs", {
25
- headReplayId,
26
- baseReplayId,
27
- ...(testRunId ? { testRunId } : {}),
28
- data: replayDiffData,
29
- });
30
- return data;
31
- };
32
- exports.createReplayDiff = createReplayDiff;
@@ -1,36 +0,0 @@
1
- import { Replay } from "@alwaysmeticulous/common";
2
- import { AxiosInstance } from "axios";
3
- export declare const getReplay: (client: AxiosInstance, replayId: string) => Promise<Replay>;
4
- export declare const createReplay: (options: {
5
- client: AxiosInstance;
6
- commitSha: string;
7
- sessionId: string;
8
- meticulousSha: string;
9
- version: "v1" | "v2";
10
- metadata: {
11
- [key: string]: any;
12
- };
13
- }) => Promise<Replay>;
14
- export interface ReplayPushUrlOutput {
15
- replayId: string;
16
- pushUrl: string;
17
- }
18
- export declare const getReplayPushUrl: (client: AxiosInstance, replayId: string) => Promise<ReplayPushUrlOutput | null>;
19
- export interface ReplayDownloadUrlOutput {
20
- replayId: string;
21
- dowloadUrl: string;
22
- }
23
- export declare const getReplayDownloadUrl: (client: AxiosInstance, replayId: string) => Promise<ReplayDownloadUrlOutput | null>;
24
- export declare const putReplayPushedStatus: (client: AxiosInstance, projectBuildId: string, status: "success" | "failure", replayCommandId: string) => Promise<any>;
25
- export declare const getReplayCommandId: (client: AxiosInstance, sessionId: string) => Promise<string>;
26
- export interface ScreenshotDiffStats {
27
- baseReplayId: string;
28
- headReplayId: string;
29
- stats: {
30
- width: number;
31
- height: number;
32
- mismatchPixels: number;
33
- };
34
- }
35
- export declare const postScreenshotDiffStats: (client: AxiosInstance, options: ScreenshotDiffStats) => Promise<void>;
36
- export declare const getReplayUrl: (replay: any) => string;
@@ -1,89 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getReplayUrl = exports.postScreenshotDiffStats = exports.getReplayCommandId = exports.putReplayPushedStatus = exports.getReplayDownloadUrl = exports.getReplayPushUrl = exports.createReplay = exports.getReplay = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const getReplay = async (client, replayId) => {
9
- const { data } = await client.get(`replays/${replayId}`).catch((error) => {
10
- var _a;
11
- if (axios_1.default.isAxiosError(error)) {
12
- if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
13
- return { data: null };
14
- }
15
- }
16
- throw error;
17
- });
18
- return data;
19
- };
20
- exports.getReplay = getReplay;
21
- const createReplay = async ({ client, commitSha, sessionId, meticulousSha, version, metadata, }) => {
22
- const { data } = await client.post("replays", {
23
- commitSha,
24
- sessionId,
25
- meticulousSha,
26
- version,
27
- metadata,
28
- });
29
- return data;
30
- };
31
- exports.createReplay = createReplay;
32
- const getReplayPushUrl = async (client, replayId) => {
33
- const { data } = await client
34
- .get(`replays/${replayId}/push-url`)
35
- .catch((error) => {
36
- var _a;
37
- if (axios_1.default.isAxiosError(error)) {
38
- if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
39
- return { data: null };
40
- }
41
- }
42
- throw error;
43
- });
44
- return data;
45
- };
46
- exports.getReplayPushUrl = getReplayPushUrl;
47
- const getReplayDownloadUrl = async (client, replayId) => {
48
- const { data } = await client
49
- .get(`replays/${replayId}/archive-url`)
50
- .catch((error) => {
51
- var _a;
52
- if (axios_1.default.isAxiosError(error)) {
53
- if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
54
- return { data: null };
55
- }
56
- }
57
- throw error;
58
- });
59
- return data;
60
- };
61
- exports.getReplayDownloadUrl = getReplayDownloadUrl;
62
- const putReplayPushedStatus = async (client, projectBuildId, status, replayCommandId) => {
63
- const { data } = await client.put(`replays/${projectBuildId}/pushed`, {
64
- status,
65
- replayCommandId,
66
- });
67
- return data;
68
- };
69
- exports.putReplayPushedStatus = putReplayPushedStatus;
70
- const getReplayCommandId = async (client, sessionId) => {
71
- const { data } = await client.post("replays/start", { sessionId });
72
- const { replayCommandId } = data;
73
- return replayCommandId;
74
- };
75
- exports.getReplayCommandId = getReplayCommandId;
76
- const postScreenshotDiffStats = async (client, { baseReplayId, headReplayId, stats }) => {
77
- await client.post(`replays/${headReplayId}/screenshot-diff`, {
78
- baseReplayId,
79
- stats,
80
- });
81
- };
82
- exports.postScreenshotDiffStats = postScreenshotDiffStats;
83
- const getReplayUrl = (replay) => {
84
- const organizationName = encodeURIComponent(replay.project.organization.name);
85
- const projectName = encodeURIComponent(replay.project.name);
86
- const replayUrl = `https://app.meticulous.ai/projects/${organizationName}/${projectName}/simulations/${replay.id}`;
87
- return replayUrl;
88
- };
89
- exports.getReplayUrl = getReplayUrl;
@@ -1,6 +0,0 @@
1
- import { SessionData } from "@alwaysmeticulous/api";
2
- import { AxiosInstance } from "axios";
3
- export declare const getRecordedSession: (client: AxiosInstance, sessionId: string) => Promise<any>;
4
- export declare const getRecordedSessionData: (client: AxiosInstance, sessionId: string) => Promise<SessionData>;
5
- export declare const getRecordingCommandId: (client: AxiosInstance) => Promise<string>;
6
- export declare const postSessionIdNotification: (client: AxiosInstance, sessionId: string, recordingCommandId: string) => Promise<void>;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.postSessionIdNotification = exports.getRecordingCommandId = exports.getRecordedSessionData = exports.getRecordedSession = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const getRecordedSession = async (client, sessionId) => {
9
- const { data } = await client.get(`sessions/${sessionId}`).catch((error) => {
10
- var _a;
11
- if (axios_1.default.isAxiosError(error)) {
12
- if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
13
- return { data: null };
14
- }
15
- }
16
- throw error;
17
- });
18
- return data;
19
- };
20
- exports.getRecordedSession = getRecordedSession;
21
- const getRecordedSessionData = async (client, sessionId) => {
22
- const { data } = await client
23
- .get(`sessions/${sessionId}/data`)
24
- .catch((error) => {
25
- var _a;
26
- if (axios_1.default.isAxiosError(error)) {
27
- if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
28
- return { data: null };
29
- }
30
- }
31
- throw error;
32
- });
33
- return data;
34
- };
35
- exports.getRecordedSessionData = getRecordedSessionData;
36
- const getRecordingCommandId = async (client) => {
37
- const { data } = await client.post("sessions/start");
38
- const { recordingCommandId } = data;
39
- return recordingCommandId;
40
- };
41
- exports.getRecordingCommandId = getRecordingCommandId;
42
- const postSessionIdNotification = async (client, sessionId, recordingCommandId) => {
43
- await client.post(`sessions/${sessionId}/notify`, { recordingCommandId });
44
- };
45
- exports.postSessionIdNotification = postSessionIdNotification;
@@ -1,39 +0,0 @@
1
- import { ScreenshotIdentifier } from "@alwaysmeticulous/api";
2
- import { TestCaseResult } from "../config/config.types";
3
- interface Organization {
4
- id: string;
5
- name: string;
6
- createdAt: string;
7
- updatedAt: string;
8
- }
9
- interface Project {
10
- id: string;
11
- name: string;
12
- recordingToken: string;
13
- apiToken: string;
14
- isGitHubIntegrationActive: boolean;
15
- url: string;
16
- organization: Organization;
17
- createdAt: string;
18
- updatedAt: string;
19
- }
20
- export type TestRunStatus = "Running" | "Success" | "Failure";
21
- export interface TestRun {
22
- id: string;
23
- status: TestRunStatus;
24
- project: Project;
25
- resultData?: {
26
- results: TestCaseResult[];
27
- [key: string]: any;
28
- };
29
- [key: string]: any;
30
- }
31
- /**
32
- * All the information required to locate & download a screenshot of a replay.
33
- */
34
- export interface ScreenshotLocator {
35
- replayId: string;
36
- screenshotIdentifier: ScreenshotIdentifier;
37
- screenshotUrl: string;
38
- }
39
- export {};
package/dist/api/types.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export declare const uploadArchive: (uploadUrl: string, archivePath: string) => Promise<void>;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.uploadArchive = void 0;
7
- const promises_1 = require("fs/promises");
8
- const axios_1 = __importDefault(require("axios"));
9
- const uploadArchive = async (uploadUrl, archivePath) => {
10
- await axios_1.default.put(uploadUrl, await (0, promises_1.readFile)(archivePath), {
11
- headers: {
12
- "Content-Type": "application/zip",
13
- },
14
- maxBodyLength: Infinity,
15
- maxContentLength: Infinity,
16
- });
17
- };
18
- exports.uploadArchive = uploadArchive;
@@ -1,4 +0,0 @@
1
- export declare const checkDistFolder: (dist: string) => Promise<void>;
2
- export declare const createArchive: (dist: string) => Promise<string>;
3
- export declare const createReplayArchive: (dir: string) => Promise<string>;
4
- export declare const deleteArchive: (archivePath: string) => Promise<void>;