@mablhq/mabl-cli 1.13.19 → 1.13.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/basicApiClient.js +15 -5
- package/api/mablApiClient.js +1 -1
- package/execution/index.js +1 -1
- package/package.json +1 -1
package/api/basicApiClient.js
CHANGED
|
@@ -31,9 +31,10 @@ const async_retry_1 = __importDefault(require("async-retry"));
|
|
|
31
31
|
const logUtils_1 = require("../util/logUtils");
|
|
32
32
|
const asyncUtil_1 = require("../util/asyncUtil");
|
|
33
33
|
const MABL_ENTITY_VERSION_HEADER = 'x-mabl-entity-version';
|
|
34
|
-
const
|
|
34
|
+
const DEFAULT_RETRYABLE_REQUEST_TIMEOUT_MILLISECONDS = 60000;
|
|
35
|
+
const DEFAULT_NONRETRYABLE_REQUEST_TIMEOUT_MILLISECONDS = 600000;
|
|
35
36
|
const DEFAULT_RETRIES = 5;
|
|
36
|
-
const DEFAULT_MAX_TOTAL_RETRY_TIME_MILLISECONDS =
|
|
37
|
+
const DEFAULT_MAX_TOTAL_RETRY_TIME_MILLISECONDS = DEFAULT_RETRYABLE_REQUEST_TIMEOUT_MILLISECONDS * DEFAULT_RETRIES;
|
|
37
38
|
const DEFAULT_MIN_RETRY_TIMEOUT_MILLISECONDS = 100;
|
|
38
39
|
const DEFAULT_MAX_RETRY_TIMEOUT_MILLISECONDS = 1000;
|
|
39
40
|
var AuthType;
|
|
@@ -48,7 +49,7 @@ class BasicApiClient {
|
|
|
48
49
|
sslVerify: options.sslVerify,
|
|
49
50
|
proxyHost: options.proxyUrl,
|
|
50
51
|
});
|
|
51
|
-
config.timeout = (_a = options.requestTimeoutMillis) !== null && _a !== void 0 ? _a :
|
|
52
|
+
config.timeout = (_a = options.requestTimeoutMillis) !== null && _a !== void 0 ? _a : DEFAULT_RETRYABLE_REQUEST_TIMEOUT_MILLISECONDS;
|
|
52
53
|
switch (options.authType) {
|
|
53
54
|
case AuthType.ApiKey:
|
|
54
55
|
config.auth = {
|
|
@@ -73,10 +74,19 @@ class BasicApiClient {
|
|
|
73
74
|
if (options.userAgentOverride) {
|
|
74
75
|
config.headers[httpUtil_1.USER_AGENT_HEADER] = options.userAgentOverride;
|
|
75
76
|
}
|
|
77
|
+
this.httpRequestConfig = config;
|
|
76
78
|
this.httpClient = axios_1.default.create(config);
|
|
77
79
|
this.retryConfig = options.retryConfig;
|
|
78
80
|
this.debugLogger = (_b = options.debugLogger) !== null && _b !== void 0 ? _b : logUtils_1.logInternal;
|
|
79
81
|
}
|
|
82
|
+
getNonRetryableRequestConfig(override) {
|
|
83
|
+
const overrideWithTimeout = { ...(override !== null && override !== void 0 ? override : {}) };
|
|
84
|
+
if (!overrideWithTimeout.timeout) {
|
|
85
|
+
overrideWithTimeout.timeout =
|
|
86
|
+
DEFAULT_NONRETRYABLE_REQUEST_TIMEOUT_MILLISECONDS;
|
|
87
|
+
}
|
|
88
|
+
return { ...this.httpRequestConfig, ...overrideWithTimeout };
|
|
89
|
+
}
|
|
80
90
|
makeGetRequest(path) {
|
|
81
91
|
return this.retryWrappedRequest(`makeGetRequest('${path}')`, () => this.getRequest(path));
|
|
82
92
|
}
|
|
@@ -101,12 +111,12 @@ class BasicApiClient {
|
|
|
101
111
|
return { ...result, entity_version: versionHeader };
|
|
102
112
|
}
|
|
103
113
|
async makePostRequest(path, requestBody, requestConfig) {
|
|
104
|
-
const response = await this.debugRequest('POST', path, () => this.httpClient.post(path, requestBody, requestConfig));
|
|
114
|
+
const response = await this.debugRequest('POST', path, () => this.httpClient.post(path, requestBody, this.getNonRetryableRequestConfig(requestConfig)));
|
|
105
115
|
BasicApiClient.checkResponseStatusCode(response);
|
|
106
116
|
return response.data;
|
|
107
117
|
}
|
|
108
118
|
async makePutRequest(path, requestBody) {
|
|
109
|
-
const response = await this.debugRequest('PUT', path, () => this.httpClient.put(path, requestBody));
|
|
119
|
+
const response = await this.debugRequest('PUT', path, () => this.httpClient.put(path, requestBody, this.getNonRetryableRequestConfig()));
|
|
110
120
|
BasicApiClient.checkResponseStatusCode(response);
|
|
111
121
|
return response.data;
|
|
112
122
|
}
|
package/api/mablApiClient.js
CHANGED
|
@@ -127,7 +127,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
127
127
|
}
|
|
128
128
|
async createDeployment(deployment) {
|
|
129
129
|
try {
|
|
130
|
-
return await this.makePostRequest(`${env_1.BASE_API_URL}/deployments`, deployment);
|
|
130
|
+
return await this.makePostRequest(`${env_1.BASE_API_URL}/deployments`, deployment, { timeout: 0 });
|
|
131
131
|
}
|
|
132
132
|
catch (error) {
|
|
133
133
|
throw toApiError(`Failed to create deployment`, error);
|