include node_modules so release .zip is deployable
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NODEJS_TIMEOUT_ERROR_CODES = exports.TRANSIENT_ERROR_STATUS_CODES = exports.TRANSIENT_ERROR_CODES = exports.THROTTLING_ERROR_CODES = exports.CLOCK_SKEW_ERROR_CODES = void 0;
|
||||
exports.CLOCK_SKEW_ERROR_CODES = [
|
||||
"AuthFailure",
|
||||
"InvalidSignatureException",
|
||||
"RequestExpired",
|
||||
"RequestInTheFuture",
|
||||
"RequestTimeTooSkewed",
|
||||
"SignatureDoesNotMatch",
|
||||
];
|
||||
exports.THROTTLING_ERROR_CODES = [
|
||||
"BandwidthLimitExceeded",
|
||||
"EC2ThrottledException",
|
||||
"LimitExceededException",
|
||||
"PriorRequestNotComplete",
|
||||
"ProvisionedThroughputExceededException",
|
||||
"RequestLimitExceeded",
|
||||
"RequestThrottled",
|
||||
"RequestThrottledException",
|
||||
"SlowDown",
|
||||
"ThrottledException",
|
||||
"Throttling",
|
||||
"ThrottlingException",
|
||||
"TooManyRequestsException",
|
||||
"TransactionInProgressException",
|
||||
];
|
||||
exports.TRANSIENT_ERROR_CODES = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"];
|
||||
exports.TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504];
|
||||
exports.NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"];
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isServerError = exports.isTransientError = exports.isThrottlingError = exports.isClockSkewError = exports.isRetryableByTrait = void 0;
|
||||
const constants_1 = require("./constants");
|
||||
const isRetryableByTrait = (error) => error.$retryable !== undefined;
|
||||
exports.isRetryableByTrait = isRetryableByTrait;
|
||||
const isClockSkewError = (error) => constants_1.CLOCK_SKEW_ERROR_CODES.includes(error.name);
|
||||
exports.isClockSkewError = isClockSkewError;
|
||||
const isThrottlingError = (error) => {
|
||||
var _a, _b;
|
||||
return ((_a = error.$metadata) === null || _a === void 0 ? void 0 : _a.httpStatusCode) === 429 ||
|
||||
constants_1.THROTTLING_ERROR_CODES.includes(error.name) ||
|
||||
((_b = error.$retryable) === null || _b === void 0 ? void 0 : _b.throttling) == true;
|
||||
};
|
||||
exports.isThrottlingError = isThrottlingError;
|
||||
const isTransientError = (error) => {
|
||||
var _a;
|
||||
return constants_1.TRANSIENT_ERROR_CODES.includes(error.name) ||
|
||||
constants_1.NODEJS_TIMEOUT_ERROR_CODES.includes((error === null || error === void 0 ? void 0 : error.code) || "") ||
|
||||
constants_1.TRANSIENT_ERROR_STATUS_CODES.includes(((_a = error.$metadata) === null || _a === void 0 ? void 0 : _a.httpStatusCode) || 0);
|
||||
};
|
||||
exports.isTransientError = isTransientError;
|
||||
const isServerError = (error) => {
|
||||
var _a;
|
||||
if (((_a = error.$metadata) === null || _a === void 0 ? void 0 : _a.httpStatusCode) !== undefined) {
|
||||
const statusCode = error.$metadata.httpStatusCode;
|
||||
if (500 <= statusCode && statusCode <= 599 && !(0, exports.isTransientError)(error)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
exports.isServerError = isServerError;
|
||||
Reference in New Issue
Block a user