@alwaysmeticulous/client 2.56.0 → 2.59.0

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.
@@ -11,5 +11,6 @@ export interface TestRun {
11
11
  export interface GetLatestTestRunOptions {
12
12
  client: AxiosInstance;
13
13
  commitSha: string;
14
+ logicalEnvironmentVersion?: number;
14
15
  }
15
- export declare const getLatestTestRunResults: ({ client, commitSha, }: GetLatestTestRunOptions) => Promise<TestRun | null>;
16
+ export declare const getLatestTestRunResults: ({ client, commitSha, logicalEnvironmentVersion, }: GetLatestTestRunOptions) => Promise<TestRun | null>;
@@ -2,10 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getLatestTestRunResults = void 0;
4
4
  const axios_1 = require("axios");
5
- const getLatestTestRunResults = async ({ client, commitSha, }) => {
5
+ const getLatestTestRunResults = async ({ client, commitSha, logicalEnvironmentVersion, }) => {
6
6
  var _a;
7
7
  const { data } = await client
8
- .get(`test-runs/cache?commitSha=${encodeURIComponent(commitSha)}`)
8
+ .get("test-runs/cache", {
9
+ params: {
10
+ commitSha: encodeURIComponent(commitSha),
11
+ ...(logicalEnvironmentVersion
12
+ ? {
13
+ logicalEnvironmentVersion: encodeURIComponent(logicalEnvironmentVersion),
14
+ }
15
+ : {}),
16
+ },
17
+ })
9
18
  .catch((error) => {
10
19
  var _a;
11
20
  if (error instanceof axios_1.AxiosError && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
package/dist/client.js CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createClient = void 0;
7
7
  const common_1 = require("@alwaysmeticulous/common");
8
8
  const axios_1 = __importDefault(require("axios"));
9
+ const axios_retry_1 = __importDefault(require("axios-retry"));
9
10
  const loglevel_1 = __importDefault(require("loglevel"));
10
11
  const api_token_utils_1 = require("./api-token.utils");
11
12
  const BASE_API_URL = "https://app.meticulous.ai/api/";
@@ -16,12 +17,16 @@ const createClient = ({ apiToken: apiToken_, }) => {
16
17
  logger.error("You must provide an API token by using the --apiToken parameter");
17
18
  process.exit(1);
18
19
  }
19
- return axios_1.default.create({
20
+ const client = axios_1.default.create({
20
21
  baseURL: getApiUrl(),
21
22
  headers: {
22
23
  authorization: apiToken,
23
24
  },
25
+ // 60 seconds default timeout
26
+ timeout: 60000,
24
27
  });
28
+ (0, axios_retry_1.default)(client, { retries: 3 });
29
+ return client;
25
30
  };
26
31
  exports.createClient = createClient;
27
32
  const getApiUrl = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwaysmeticulous/client",
3
- "version": "2.56.0",
3
+ "version": "2.59.0",
4
4
  "description": "Helper methods for using the Meticulous backend API",
5
5
  "license": "ISC",
6
6
  "main": "dist/index.js",
@@ -22,6 +22,7 @@
22
22
  "@alwaysmeticulous/api": "^2.56.0",
23
23
  "@alwaysmeticulous/common": "^2.56.0",
24
24
  "axios": "^1.2.6",
25
+ "axios-retry": "^3.5.0",
25
26
  "loglevel": "^1.8.0"
26
27
  },
27
28
  "author": {
@@ -41,5 +42,5 @@
41
42
  "bugs": {
42
43
  "url": "https://github.com/alwaysmeticulous/meticulous-sdk/issues"
43
44
  },
44
- "gitHead": "78222a2650425ced6537f3077ad47199a1fa45c3"
45
+ "gitHead": "3e2d1922a37728ffc3808e56a64f63a5c3fb87a6"
45
46
  }