From 7877a822b73954b1498b1e0e2cb658b762f27c26 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Tue, 19 Mar 2019 15:31:03 -0400 Subject: [PATCH] Enable retries --- api/WebApi.ts | 5 +- api/interfaces/common/VsoBaseInterfaces.ts | 10 +- package-lock.json | 116 ++++++++++----------- package.json | 4 +- 4 files changed, 70 insertions(+), 65 deletions(-) diff --git a/api/WebApi.ts b/api/WebApi.ts index 22be87d1..1dee5087 100644 --- a/api/WebApi.ts +++ b/api/WebApi.ts @@ -233,9 +233,12 @@ export class WebApi { // TODO: Don't call resource area here? Will cause infinite loop? public async getLocationsApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): Promise { + let optionsClone: VsoBaseInterfaces.IRequestOptions = Object.assign({}, this.options); + optionsClone.allowRetries = true; + optionsClone.maxRetries = 5; serverUrl = await serverUrl || this.serverUrl; handlers = handlers || [this.authHandler]; - return new locationsm.LocationsApi(serverUrl, handlers, this.options); + return new locationsm.LocationsApi(serverUrl, handlers, optionsClone); } public async getNotificationApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): Promise { diff --git a/api/interfaces/common/VsoBaseInterfaces.ts b/api/interfaces/common/VsoBaseInterfaces.ts index 6199efdb..f1860e13 100644 --- a/api/interfaces/common/VsoBaseInterfaces.ts +++ b/api/interfaces/common/VsoBaseInterfaces.ts @@ -85,10 +85,12 @@ export interface IHttpClientResponse { } export interface IRequestOptions { - socketTimeout?: number, - ignoreSslError?: boolean, - proxy?: IProxyConfiguration - cert?: ICertConfiguration + socketTimeout?: number; + ignoreSslError?: boolean; + proxy?: IProxyConfiguration; + cert?: ICertConfiguration; + allowRetries?: boolean; + maxRetries?: number; } export interface IProxyConfiguration { diff --git a/package-lock.json b/package-lock.json index 7220ecfa..17575816 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "azure-devops-node-api", - "version": "7.0.0", + "version": "7.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -16,9 +16,9 @@ "integrity": "sha512-wc+VveszMLyMWFvXLkloixT4n0harUIVZjnpzztaZ0nKLuul7Z32iMt2fUFGAaZ4y1XWjFRMtCI5ewvyh4aIeg==", "dev": true, "requires": { - "@types/events": "1.1.0", - "@types/minimatch": "3.0.3", - "@types/node": "8.9.2" + "@types/events": "*", + "@types/minimatch": "*", + "@types/node": "*" } }, "@types/minimatch": { @@ -45,8 +45,8 @@ "integrity": "sha512-M2giRw93PxKS7YjU6GZjtdV9HASdB7TWqizBXe4Ju7AqbKlWvTr0gNO92XH56D/gMxqD/jNHLNfC5hA34yGqrQ==", "dev": true, "requires": { - "@types/glob": "5.0.35", - "@types/node": "8.9.2" + "@types/glob": "*", + "@types/node": "*" } }, "assertion-error": { @@ -67,7 +67,7 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -83,12 +83,12 @@ "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", "dev": true, "requires": { - "assertion-error": "1.1.0", - "check-error": "1.0.2", - "deep-eql": "3.0.1", - "get-func-name": "2.0.0", - "pathval": "1.1.0", - "type-detect": "4.0.8" + "assertion-error": "^1.0.1", + "check-error": "^1.0.1", + "deep-eql": "^3.0.0", + "get-func-name": "^2.0.0", + "pathval": "^1.0.0", + "type-detect": "^4.0.0" } }, "check-error": { @@ -103,7 +103,7 @@ "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", "dev": true, "requires": { - "graceful-readlink": "1.0.1" + "graceful-readlink": ">= 1.0.0" } }, "concat-map": { @@ -118,7 +118,7 @@ "integrity": "sha512-D61LaDQPQkxJ5AUM2mbSJRbPkNs/TmdmOeLAi1hgDkpDfIfetSrjmWhccwtuResSwMbACjx/xXQofvM9CE/aeg==", "dev": true, "requires": { - "ms": "2.1.1" + "ms": "^2.1.1" } }, "deep-eql": { @@ -127,7 +127,7 @@ "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", "dev": true, "requires": { - "type-detect": "4.0.8" + "type-detect": "^4.0.0" } }, "deep-equal": { @@ -166,12 +166,12 @@ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "graceful-readlink": { @@ -204,8 +204,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -244,8 +244,8 @@ "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", "dev": true, "requires": { - "lodash._basecopy": "3.0.1", - "lodash.keys": "3.1.2" + "lodash._basecopy": "^3.0.0", + "lodash.keys": "^3.0.0" } }, "lodash._basecopy": { @@ -278,9 +278,9 @@ "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", "dev": true, "requires": { - "lodash._baseassign": "3.2.0", - "lodash._basecreate": "3.0.3", - "lodash._isiterateecall": "3.0.9" + "lodash._baseassign": "^3.0.0", + "lodash._basecreate": "^3.0.0", + "lodash._isiterateecall": "^3.0.0" } }, "lodash.isarguments": { @@ -301,9 +301,9 @@ "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", "dev": true, "requires": { - "lodash._getnative": "3.9.1", - "lodash.isarguments": "3.1.0", - "lodash.isarray": "3.0.4" + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" } }, "minimatch": { @@ -312,7 +312,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -365,12 +365,12 @@ "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "ms": { @@ -393,15 +393,15 @@ "integrity": "sha512-EDgl/WgNQ0C1BZZlASOQkQdE6tAWXJi8QQlugqzN64JJkvZ7ILijZuG24r4vCC7yOfnm6HKpne5AGExLGCeBWg==", "dev": true, "requires": { - "chai": "4.1.2", - "debug": "3.2.5", - "deep-equal": "1.0.1", - "json-stringify-safe": "5.0.1", - "lodash": "4.17.11", - "mkdirp": "0.5.1", - "propagate": "1.0.0", - "qs": "6.5.2", - "semver": "5.5.1" + "chai": "^4.1.2", + "debug": "^3.1.0", + "deep-equal": "^1.0.0", + "json-stringify-safe": "^5.0.1", + "lodash": "^4.17.5", + "mkdirp": "^0.5.0", + "propagate": "^1.0.0", + "qs": "^6.5.1", + "semver": "^5.5.0" } }, "once": { @@ -410,7 +410,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "os": { @@ -454,7 +454,7 @@ "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", "dev": true, "requires": { - "resolve": "1.5.0" + "resolve": "^1.1.6" } }, "resolve": { @@ -463,7 +463,7 @@ "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", "dev": true, "requires": { - "path-parse": "1.0.5" + "path-parse": "^1.0.5" } }, "semver": { @@ -478,9 +478,9 @@ "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", "dev": true, "requires": { - "glob": "7.1.2", - "interpret": "1.1.0", - "rechoir": "0.6.2" + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" } }, "supports-color": { @@ -489,7 +489,7 @@ "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", "dev": true, "requires": { - "has-flag": "1.0.0" + "has-flag": "^1.0.0" } }, "tunnel": { @@ -504,9 +504,9 @@ "dev": true }, "typed-rest-client": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.0.9.tgz", - "integrity": "sha512-iOdwgmnP/tF6Qs+oY4iEtCf/3fnCDl7Gy9LGPJ4E3M4Wj3uaSko15FVwbsaBmnBqTJORnXBWVY5306D4HH8oiA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.2.0.tgz", + "integrity": "sha512-FrUshzZ1yxH8YwGR29PWWnfksLEILbWJydU7zfIRkyH7kAEzB62uMAl2WY6EyolWpLpVHeJGgQm45/MaruaHpw==", "requires": { "tunnel": "0.0.4", "underscore": "1.8.3" diff --git a/package.json b/package.json index a62726a5..15bf3e49 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "azure-devops-node-api", "description": "Node client for Azure DevOps and TFS REST APIs", - "version": "7.1.0", + "version": "7.2.0", "main": "./WebApi.js", "types": "./WebApi.d.ts", "scripts": { @@ -26,7 +26,7 @@ "dependencies": { "os": "0.1.1", "tunnel": "0.0.4", - "typed-rest-client": "1.0.9", + "typed-rest-client": "1.2.0", "underscore": "1.8.3" }, "devDependencies": {