ms-rest-azure-js
Advanced tools
Comparing version 0.11.101 to 0.11.104
@@ -0,0 +0,0 @@ ### 0.2.8 - 2017/04/02 |
@@ -7,4 +7,4 @@ "use strict"; | ||
var msRest = require("ms-rest-js"); | ||
var pollingState_1 = require("./pollingState"); | ||
var constants_1 = require("./util/constants"); | ||
var pollingState_1 = require("./pollingState"); | ||
/** | ||
@@ -22,11 +22,5 @@ * @class | ||
function AzureServiceClient(credentials, options) { | ||
var _this = _super.call(this, credentials, updateOptionsWithDefaultValues(options)) || this; | ||
var _this = _super.call(this, credentials, options = updateOptionsWithDefaultValues(options)) || this; | ||
_this.acceptLanguage = constants_1.default.DEFAULT_LANGUAGE; | ||
_this.longRunningOperationRetryTimeout = 30; | ||
_this.rpRegistrationRetryTimeout = 30; | ||
_this.acceptLanguage = constants_1.default.DEFAULT_LANGUAGE; | ||
_this.longRunningOperationRetryTimeout = 30; | ||
if (!options) { | ||
options = {}; | ||
} | ||
if (options.acceptLanguage != undefined) { | ||
@@ -38,13 +32,3 @@ _this.acceptLanguage = options.acceptLanguage; | ||
} | ||
if (options.rpRegistrationRetryTimeout != undefined) { | ||
_this.rpRegistrationRetryTimeout = options.rpRegistrationRetryTimeout; | ||
} | ||
try { | ||
var moduleName = "ms-rest-azure"; | ||
var moduleVersion = constants_1.default.msRestAzureVersion; | ||
_this.addUserAgentInfo(moduleName + "/" + moduleVersion); | ||
} | ||
catch (err) { | ||
// do nothing | ||
} | ||
_this.addUserAgentInfo("ms-rest-azure/" + constants_1.default.msRestAzureVersion); | ||
return _this; | ||
@@ -89,3 +73,3 @@ } | ||
if (!pollingState.azureAsyncOperationHeaderLink) return [3 /*break*/, 4]; | ||
return [4 /*yield*/, updateStateFromAzureAsyncOperationHeader(this, pollingState, true)]; | ||
return [4 /*yield*/, updateStateFromAzureAsyncOperationHeader(this, pollingState)]; | ||
case 3: | ||
@@ -135,2 +119,3 @@ _a.sent(); | ||
} | ||
exports.updateOptionsWithDefaultValues = updateOptionsWithDefaultValues; | ||
/** | ||
@@ -152,2 +137,3 @@ * Verified whether an unexpected polling status code for long running operation was received for the response of the initial request. | ||
} | ||
exports.checkResponseStatusCodeFailed = checkResponseStatusCodeFailed; | ||
/** | ||
@@ -158,4 +144,3 @@ * Retrieve operation status by polling from "azure-asyncoperation" header. | ||
*/ | ||
function updateStateFromAzureAsyncOperationHeader(client, pollingState, inPostOrDelete) { | ||
if (inPostOrDelete === void 0) { inPostOrDelete = false; } | ||
function updateStateFromAzureAsyncOperationHeader(client, pollingState) { | ||
return getStatus(client, pollingState.azureAsyncOperationHeaderLink, pollingState.optionsOfInitialRequest).then(function (result) { | ||
@@ -174,7 +159,6 @@ var parsedResponse = result.parsedBody; | ||
pollingState.resource = undefined; | ||
if (inPostOrDelete) { | ||
pollingState.resource = result.parsedBody; | ||
} | ||
pollingState.resource = result.parsedBody; | ||
}); | ||
} | ||
exports.updateStateFromAzureAsyncOperationHeader = updateStateFromAzureAsyncOperationHeader; | ||
/** | ||
@@ -209,2 +193,3 @@ * Retrieve PUT operation status by polling from "location" header. | ||
} | ||
exports.updateStateFromLocationHeader = updateStateFromLocationHeader; | ||
/** | ||
@@ -233,2 +218,3 @@ * Polling for resource status. | ||
} | ||
exports.updateStateFromGetResourceOperation = updateStateFromGetResourceOperation; | ||
/** | ||
@@ -264,9 +250,3 @@ * Retrieves operation status by querying the operation URL. | ||
error.response = operationResponse; | ||
try { | ||
error.body = responseBody; | ||
} | ||
catch (badResponse) { | ||
error.message += " Error \"" + badResponse + "\" occured while deserializing the response body - \"" + operationResponse.bodyAsText + "\"."; | ||
error.body = operationResponse.bodyAsText; | ||
} | ||
error.body = responseBody; | ||
throw error; | ||
@@ -277,2 +257,3 @@ } | ||
} | ||
exports.getStatus = getStatus; | ||
//# sourceMappingURL=azureServiceClient.js.map |
@@ -13,3 +13,2 @@ "use strict"; | ||
function PollingState(resultOfInitialRequest, retryTimeout) { | ||
if (retryTimeout === void 0) { retryTimeout = 30; } | ||
/** | ||
@@ -16,0 +15,0 @@ * @param {number} [retryTimeout] - The timeout in seconds to retry on intermediate operation results. Default Value is 30. |
@@ -5,4 +5,4 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
import * as msRest from "ms-rest-js"; | ||
import PollingState from "./pollingState"; | ||
import Constants from "./util/constants"; | ||
import PollingState from "./pollingState"; | ||
/** | ||
@@ -20,11 +20,5 @@ * @class | ||
function AzureServiceClient(credentials, options) { | ||
var _this = _super.call(this, credentials, updateOptionsWithDefaultValues(options)) || this; | ||
var _this = _super.call(this, credentials, options = updateOptionsWithDefaultValues(options)) || this; | ||
_this.acceptLanguage = Constants.DEFAULT_LANGUAGE; | ||
_this.longRunningOperationRetryTimeout = 30; | ||
_this.rpRegistrationRetryTimeout = 30; | ||
_this.acceptLanguage = Constants.DEFAULT_LANGUAGE; | ||
_this.longRunningOperationRetryTimeout = 30; | ||
if (!options) { | ||
options = {}; | ||
} | ||
if (options.acceptLanguage != undefined) { | ||
@@ -36,13 +30,3 @@ _this.acceptLanguage = options.acceptLanguage; | ||
} | ||
if (options.rpRegistrationRetryTimeout != undefined) { | ||
_this.rpRegistrationRetryTimeout = options.rpRegistrationRetryTimeout; | ||
} | ||
try { | ||
var moduleName = "ms-rest-azure"; | ||
var moduleVersion = Constants.msRestAzureVersion; | ||
_this.addUserAgentInfo(moduleName + "/" + moduleVersion); | ||
} | ||
catch (err) { | ||
// do nothing | ||
} | ||
_this.addUserAgentInfo("ms-rest-azure/" + Constants.msRestAzureVersion); | ||
return _this; | ||
@@ -87,3 +71,3 @@ } | ||
if (!pollingState.azureAsyncOperationHeaderLink) return [3 /*break*/, 4]; | ||
return [4 /*yield*/, updateStateFromAzureAsyncOperationHeader(this, pollingState, true)]; | ||
return [4 /*yield*/, updateStateFromAzureAsyncOperationHeader(this, pollingState)]; | ||
case 3: | ||
@@ -124,3 +108,3 @@ _a.sent(); | ||
var terminalStates = ["Succeeded", "Failed", "Canceled"]; | ||
function updateOptionsWithDefaultValues(options) { | ||
export function updateOptionsWithDefaultValues(options) { | ||
if (!options) { | ||
@@ -138,3 +122,3 @@ options = {}; | ||
*/ | ||
function checkResponseStatusCodeFailed(initialResponse) { | ||
export function checkResponseStatusCodeFailed(initialResponse) { | ||
var statusCode = initialResponse.status; | ||
@@ -156,4 +140,3 @@ var method = initialResponse.request.method; | ||
*/ | ||
function updateStateFromAzureAsyncOperationHeader(client, pollingState, inPostOrDelete) { | ||
if (inPostOrDelete === void 0) { inPostOrDelete = false; } | ||
export function updateStateFromAzureAsyncOperationHeader(client, pollingState) { | ||
return getStatus(client, pollingState.azureAsyncOperationHeaderLink, pollingState.optionsOfInitialRequest).then(function (result) { | ||
@@ -172,5 +155,3 @@ var parsedResponse = result.parsedBody; | ||
pollingState.resource = undefined; | ||
if (inPostOrDelete) { | ||
pollingState.resource = result.parsedBody; | ||
} | ||
pollingState.resource = result.parsedBody; | ||
}); | ||
@@ -183,3 +164,3 @@ } | ||
*/ | ||
function updateStateFromLocationHeader(client, method, pollingState) { | ||
export function updateStateFromLocationHeader(client, method, pollingState) { | ||
return getStatus(client, pollingState.locationHeaderLink, pollingState.optionsOfInitialRequest).then(function (result) { | ||
@@ -213,3 +194,3 @@ var parsedResponse = result.parsedBody; | ||
*/ | ||
function updateStateFromGetResourceOperation(client, resourceUrl, pollingState) { | ||
export function updateStateFromGetResourceOperation(client, resourceUrl, pollingState) { | ||
return getStatus(client, resourceUrl, pollingState.optionsOfInitialRequest).then(function (result) { | ||
@@ -237,3 +218,3 @@ if (!result.parsedBody) { | ||
*/ | ||
function getStatus(client, operationUrl, options) { | ||
export function getStatus(client, operationUrl, options) { | ||
// Construct URL | ||
@@ -263,9 +244,3 @@ var requestUrl = operationUrl.replace(" ", "%20"); | ||
error.response = operationResponse; | ||
try { | ||
error.body = responseBody; | ||
} | ||
catch (badResponse) { | ||
error.message += " Error \"" + badResponse + "\" occured while deserializing the response body - \"" + operationResponse.bodyAsText + "\"."; | ||
error.body = operationResponse.bodyAsText; | ||
} | ||
error.body = responseBody; | ||
throw error; | ||
@@ -272,0 +247,0 @@ } |
@@ -11,3 +11,2 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
function PollingState(resultOfInitialRequest, retryTimeout) { | ||
if (retryTimeout === void 0) { retryTimeout = 30; } | ||
/** | ||
@@ -14,0 +13,0 @@ * @param {number} [retryTimeout] - The timeout in seconds to retry on intermediate operation results. Default Value is 30. |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "0.11.101", | ||
"version": "0.11.104", | ||
"description": "Isomorphic Azure client runtime for Typescript/node.js/browser javascript client libraries generated using AutoRest", | ||
@@ -34,3 +34,3 @@ "tags": [ | ||
"dependencies": { | ||
"ms-rest-js": "~0.16.366", | ||
"ms-rest-js": "~0.16.371", | ||
"tslib": "^1.9.2" | ||
@@ -43,2 +43,3 @@ }, | ||
"npm-run-all": "^4.1.2", | ||
"nyc": "^12.0.2", | ||
"should": "5.2.0", | ||
@@ -62,2 +63,18 @@ "shx": "^0.2.2", | ||
}, | ||
"nyc": { | ||
"extension": [ | ||
".ts" | ||
], | ||
"exclude": [ | ||
"**/*.d.ts" | ||
], | ||
"include": [ | ||
"lib/**/*.ts" | ||
], | ||
"reporter": [ | ||
"text", | ||
"html" | ||
], | ||
"all": true | ||
}, | ||
"scripts": { | ||
@@ -71,3 +88,3 @@ "build": "run-p build:node build:es build:browser", | ||
"test": "run-p test:tslint test:unit", | ||
"test:unit": "mocha", | ||
"test:unit": "nyc mocha", | ||
"test:tslint": "tslint -p . -c tslint.json --exclude test/**/*.ts", | ||
@@ -74,0 +91,0 @@ "prepare": "npm run build", |
@@ -0,0 +0,0 @@ # ms-rest-azure-js |
import * as msRest from "ms-rest-js"; | ||
import PollingState from "./pollingState"; | ||
/** | ||
@@ -15,7 +16,2 @@ * Options to be provided while creating the client. | ||
longRunningOperationRetryTimeout?: number; | ||
/** | ||
* @property {number} [rpRegistrationRetryTimeout] - Gets or sets the retry timeout in seconds for | ||
* AutomaticRPRegistration. Default value is 30 seconds. | ||
*/ | ||
rpRegistrationRetryTimeout?: number; | ||
} | ||
@@ -34,3 +30,2 @@ /** | ||
longRunningOperationRetryTimeout: number; | ||
rpRegistrationRetryTimeout: number; | ||
constructor(credentials: msRest.ServiceClientCredentials, options?: AzureServiceClientOptions); | ||
@@ -52,1 +47,31 @@ /** | ||
} | ||
export declare function updateOptionsWithDefaultValues(options?: AzureServiceClientOptions): AzureServiceClientOptions; | ||
/** | ||
* Verified whether an unexpected polling status code for long running operation was received for the response of the initial request. | ||
* @param {msRest.HttpOperationResponse} initialResponse - Response to the initial request that was sent as a part of the asynchronous operation. | ||
*/ | ||
export declare function checkResponseStatusCodeFailed(initialResponse: msRest.HttpOperationResponse): boolean; | ||
/** | ||
* Retrieve operation status by polling from "azure-asyncoperation" header. | ||
* @param {PollingState} pollingState - The object to persist current operation state. | ||
* @param {boolean} inPostOrDelete - Invoked by Post Or Delete operation. | ||
*/ | ||
export declare function updateStateFromAzureAsyncOperationHeader(client: AzureServiceClient, pollingState: PollingState): Promise<void>; | ||
/** | ||
* Retrieve PUT operation status by polling from "location" header. | ||
* @param {string} method - The HTTP method. | ||
* @param {PollingState} pollingState - The object to persist current operation state. | ||
*/ | ||
export declare function updateStateFromLocationHeader(client: AzureServiceClient, method: msRest.HttpMethods, pollingState: PollingState): Promise<void>; | ||
/** | ||
* Polling for resource status. | ||
* @param {string} resourceUrl - The url of resource. | ||
* @param {PollingState} pollingState - The object to persist current operation state. | ||
*/ | ||
export declare function updateStateFromGetResourceOperation(client: AzureServiceClient, resourceUrl: string, pollingState: PollingState): Promise<void>; | ||
/** | ||
* Retrieves operation status by querying the operation URL. | ||
* @param {string} operationUrl - URL used to poll operation result. | ||
* @param {object} options - Options that can be set on the request object | ||
*/ | ||
export declare function getStatus(client: AzureServiceClient, operationUrl: string, options?: msRest.RequestOptionsBase): Promise<msRest.HttpOperationResponse>; |
@@ -43,3 +43,3 @@ import { LongRunningOperationStates as LroStates } from "./util/constants"; | ||
*/ | ||
status?: LroStates; | ||
status: LroStates; | ||
/** | ||
@@ -49,3 +49,3 @@ * @param {msRest.RestError} [error] - Provides information about the error that happened while polling. | ||
error?: msRest.RestError; | ||
constructor(resultOfInitialRequest: msRest.HttpOperationResponse, retryTimeout?: number); | ||
constructor(resultOfInitialRequest: msRest.HttpOperationResponse, retryTimeout: number); | ||
/** | ||
@@ -52,0 +52,0 @@ * Update cached data using the provided response object |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
339991
36
9226
14
1
2
Updatedms-rest-js@~0.16.371