UNPKG

liveperson-functions-cli

Version:
42 lines 1.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isRetriableError = exports.isNetworkError = exports.isBuiltInNamespace = exports.isNotFoundError = exports.isEmptyString = exports.isNullOrUndefined = void 0; const restError_1 = require("../types/errors/restError"); const constants_1 = require("./constants"); function isNullOrUndefined(o) { return o === null || o === undefined; } exports.isNullOrUndefined = isNullOrUndefined; function isEmptyString(s) { return s === ''; } exports.isEmptyString = isEmptyString; function isNotFoundError(e) { if (e instanceof restError_1.RestError) { return e.statusCode === 404; } return false; } exports.isNotFoundError = isNotFoundError; function isBuiltInNamespace(namespace) { return constants_1.BUILT_IN_NAMESPACES.includes(namespace); } exports.isBuiltInNamespace = isBuiltInNamespace; function isNetworkError(e) { if (isNullOrUndefined(e)) { return false; } return typeof e.code === 'string' || typeof e.errno === 'string'; } exports.isNetworkError = isNetworkError; function isRetriableError(e) { if (isNullOrUndefined(e)) { return false; } if (isNetworkError(e)) { return constants_1.RETRIABLE_NETWORK_ERRORS.includes(e.code || e.errno); } return false; } exports.isRetriableError = isRetriableError; //# sourceMappingURL=predicates.js.map