Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@microsoft/ocsdk

Package Overview
Dependencies
Maintainers
5
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/ocsdk - npm Package Compare versions

Comparing version 0.5.2 to 0.5.3-main.04bb1da

lib/Utils/axiosRetryHandler.d.ts

2

CHANGELOG.md

@@ -7,2 +7,4 @@ # Changelog

- added axios-retry library support
## [0.5.2] - 2024-05-20

@@ -9,0 +11,0 @@

2

lib/Interfaces/IAxiosRetryOptions.d.ts

@@ -14,3 +14,3 @@ export default interface IAxiosRetryOptions {

*/
shouldRetry?(response?: any, axiosRetryOptions?: IAxiosRetryOptions): boolean;
shouldRetry?(error?: any, retryOn429?: boolean): boolean;
/**

@@ -17,0 +17,0 @@ * Overwrite request headers on demand based on response headers of the same name

@@ -1,4 +0,3 @@

import { AxiosResponse } from "axios";
import IAxiosRetryOptions from "../Interfaces/IAxiosRetryOptions";
declare const sessionInitRetryHandler: (response: AxiosResponse<any> | undefined, axiosRetryOptions: IAxiosRetryOptions) => boolean;
import { AxiosError } from "axios";
declare const sessionInitRetryHandler: (error: AxiosError, retryOn429: boolean | undefined) => boolean;
export default sessionInitRetryHandler;

@@ -12,9 +12,15 @@ "use strict";

var _axiosRetry = require("axios-retry");
var _axiosRetryHandler = require("../Utils/axiosRetryHandler");
/* eslint-disable @typescript-eslint/no-explicit-any */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
var sessionInitRetryHandler = function sessionInitRetryHandler(response, axiosRetryOptions) {
if (response !== null && response !== void 0 && response.status) {
switch (response.status) {
var sessionInitRetryHandler = function sessionInitRetryHandler(error, retryOn429) {
var _error$response, _error$response2, _error$response2$head, _error$response3, _error$response4, _error$response5, _error$response6;
if (error !== null && error !== void 0 && (_error$response = error.response) !== null && _error$response !== void 0 && _error$response.status) {
switch (error.response.status) {
case _Constants["default"].tooManyRequestsStatusCode:
if (axiosRetryOptions && axiosRetryOptions.retryOn429 === false) {
if (retryOn429 === false) {
return false;

@@ -26,3 +32,3 @@ }

case _Constants["default"].badRequestStatusCode:
if (parseInt(response.headers.errorcode) === _Constants["default"].outOfOfficeErrorCode) {
if ((_error$response2 = error.response) !== null && _error$response2 !== void 0 && (_error$response2$head = _error$response2.headers) !== null && _error$response2$head !== void 0 && _error$response2$head.errorcode && parseInt(error.response.headers.errorcode) === _Constants["default"].outOfOfficeErrorCode) {
return false;

@@ -34,7 +40,7 @@ }

default:
return true;
return (0, _axiosRetryHandler.isRetryableError)(error) || (0, _axiosRetry.isNetworkError)(error) || ((_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.status) == 0 || !((_error$response4 = error.response) !== null && _error$response4 !== void 0 && _error$response4.status);
}
}
return true;
return (0, _axiosRetryHandler.isRetryableError)(error) || (0, _axiosRetry.isNetworkError)(error) || ((_error$response5 = error.response) === null || _error$response5 === void 0 ? void 0 : _error$response5.status) == 0 || !((_error$response6 = error.response) !== null && _error$response6 !== void 0 && _error$response6.status);
};

@@ -44,2 +50,2 @@

exports["default"] = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9VdGlscy9TZXNzaW9uSW5pdFJldHJ5SGFuZGxlci50cyJdLCJuYW1lcyI6WyJzZXNzaW9uSW5pdFJldHJ5SGFuZGxlciIsInJlc3BvbnNlIiwiYXhpb3NSZXRyeU9wdGlvbnMiLCJzdGF0dXMiLCJDb25zdGFudHMiLCJ0b29NYW55UmVxdWVzdHNTdGF0dXNDb2RlIiwicmV0cnlPbjQyOSIsImJhZFJlcXVlc3RTdGF0dXNDb2RlIiwicGFyc2VJbnQiLCJoZWFkZXJzIiwiZXJyb3Jjb2RlIiwib3V0T2ZPZmZpY2VFcnJvckNvZGUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OztBQUVBOztBQUZBO0FBS0E7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2R1bGUtYm91bmRhcnktdHlwZXNcbmNvbnN0IHNlc3Npb25Jbml0UmV0cnlIYW5kbGVyID0gKHJlc3BvbnNlOiBBeGlvc1Jlc3BvbnNlPGFueT4gfCB1bmRlZmluZWQsIGF4aW9zUmV0cnlPcHRpb25zOiBJQXhpb3NSZXRyeU9wdGlvbnMpID0+IHtcbiAgICBpZiAocmVzcG9uc2U/LnN0YXR1cykge1xuICAgICAgICBzd2l0Y2ggKHJlc3BvbnNlLnN0YXR1cykge1xuICAgICAgICAgICAgY2FzZSBDb25zdGFudHMudG9vTWFueVJlcXVlc3RzU3RhdHVzQ29kZTpcbiAgICAgICAgICAgICAgICBpZiAoYXhpb3NSZXRyeU9wdGlvbnMgJiYgYXhpb3NSZXRyeU9wdGlvbnMucmV0cnlPbjQyOSA9PT0gZmFsc2UpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgQ29uc3RhbnRzLmJhZFJlcXVlc3RTdGF0dXNDb2RlOlxuICAgICAgICAgICAgICAgIGlmIChwYXJzZUludChyZXNwb25zZS5oZWFkZXJzLmVycm9yY29kZSkgPT09IENvbnN0YW50cy5vdXRPZk9mZmljZUVycm9yQ29kZSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgZGVmYXVsdDogcmV0dXJuIHRydWU7XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIHRydWU7XG59XG5leHBvcnQgZGVmYXVsdCBzZXNzaW9uSW5pdFJldHJ5SGFuZGxlcjsiXX0=
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9VdGlscy9TZXNzaW9uSW5pdFJldHJ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5zdGF0dXMpIHtcbiAgICAgICAgc3dpdGNoIChlcnJvci5yZXNwb25zZS5zdGF0dXMpIHtcbiAgICAgICAgICAgIGNhc2UgQ29uc3RhbnRzLnRvb01hbnlSZXF1ZXN0c1N0YXR1c0NvZGU6XG4gICAgICAgICAgICAgICAgaWYgKHJldHJ5T240MjkgPT09IGZhbHNlKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIENvbnN0YW50cy5iYWRSZXF1ZXN0U3RhdHVzQ29kZTpcbiAgICAgICAgICAgICAgICBpZiAoZXJyb3IucmVzcG9uc2U/LmhlYWRlcnM/LmVycm9yY29kZSAmJiBwYXJzZUludChlcnJvci5yZXNwb25zZS5oZWFkZXJzLmVycm9yY29kZSkgPT09IENvbnN0YW50cy5vdXRPZk9mZmljZUVycm9yQ29kZSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgZGVmYXVsdDogcmV0dXJuIGlzUmV0cnlhYmxlRXJyb3IoZXJyb3IpIHx8IGlzTmV0d29ya0Vycm9yKGVycm9yKSB8fCBlcnJvci5yZXNwb25zZT8uc3RhdHVzID09IDAgfHwgIWVycm9yLnJlc3BvbnNlPy5zdGF0dXM7XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIGlzUmV0cnlhYmxlRXJyb3IoZXJyb3IpIHx8IGlzTmV0d29ya0Vycm9yKGVycm9yKSB8fCBlcnJvci5yZXNwb25zZT8uc3RhdHVzID09IDAgfHwgIWVycm9yLnJlc3BvbnNlPy5zdGF0dXM7XG59XG5leHBvcnQgZGVmYXVsdCBzZXNzaW9uSW5pdFJldHJ5SGFuZGxlcjsiXX0=
{
"name": "@microsoft/ocsdk",
"version": "0.5.2",
"version": "0.5.3-main.04bb1da",
"description": "Microsoft Omnichannel SDK",

@@ -62,4 +62,5 @@ "files": [

"@types/node": "^12.20.26",
"axios": "^1.6.1"
"axios": "^1.6.1",
"axios-retry": "^3.9.1"
}
}

@@ -67,3 +67,3 @@ # Omnichannel SDK

getChatTokenTimeBetweenRetriesOnFailure: 10000,
maxRequestRetriesOnFailure: 3
maxRequestRetriesOnFailure: 5
};

@@ -247,3 +247,3 @@

*/
maxRequestRetriesOnFailure: 3,
maxRequestRetriesOnFailure: 5,
}

@@ -250,0 +250,0 @@ ```

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc