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

@azure/ms-rest-azure-js

Package Overview
Dependencies
Maintainers
6
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/ms-rest-azure-js - npm Package Compare versions

Comparing version 1.3.8 to 2.0.0

9

Changelog.md
# Changelog
## 2.0.0 - 2019-07-15
- Bumping the version to `2.0.0` since the underlying dependency `@azure/ms-rest-js` has moved to `2.x.x` range.
- `@azure/ms-rest-js@2.x.x` is using `node-fetch` instead of `axios` as the http client for node.js scenario.
- We have made some bug fixes to handling cookie parsing errors in the `2.0.3` version
- This helps us in making it easier to update the autorest generated TypeScript sdk packages on an on-demand basis and keeping sdks from unnecessarily getting runtime updates when they are eventually going to get updated to use the new `@azure/core-*` runtime packages in couple of weeks from now.
## 1.3.8 - 2019-06-06
- Fixed tests to pass when -preview suffix set in version.
## 1.3.7 - 2019-06-04

@@ -3,0 +12,0 @@ - Updated `@azure/ms-rest-js` to `^1.8.10`

16

dist/msRestAzure.js

@@ -8,4 +8,4 @@ /** @license ms-rest-azure-js

typeof define === 'function' && define.amd ? define(['exports', '@azure/ms-rest-js'], factory) :
(factory((global.msRestAzure = {}),global.msRest));
}(this, (function (exports,msRestJs) { 'use strict';
(global = global || self, factory(global.msRestAzure = {}, global.msRest));
}(this, function (exports, msRestJs) { 'use strict';

@@ -822,3 +822,3 @@ /*! *****************************************************************************

*/
var msRestAzureVersion = "1.3.7";
var msRestAzureVersion = "2.0.0";

@@ -1031,13 +1031,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

// Copyright (c) Microsoft Corporation. All rights reserved.
exports.AzureServiceClient = AzureServiceClient;
exports.getDefaultUserAgentValue = getDefaultUserAgentValue;
exports.BaseResourceMapper = BaseResourceMapper;
exports.CloudErrorMapper = CloudErrorMapper;
exports.CognitiveServicesCredentials = CognitiveServicesCredentials;
exports.DEFAULT_LANGUAGE = DEFAULT_LANGUAGE;
exports.LROPoller = LROPoller;
exports.createLROPollerFromInitialResponse = createLROPollerFromInitialResponse;
exports.createLROPollerFromPollState = createLROPollerFromPollState;
exports.LROPoller = LROPoller;
exports.DEFAULT_LANGUAGE = DEFAULT_LANGUAGE;
exports.getDefaultUserAgentValue = getDefaultUserAgentValue;
exports.msRestAzureVersion = msRestAzureVersion;

@@ -1047,3 +1045,3 @@

})));
}));
//# sourceMappingURL=msRestAzure.js.map

@@ -5,2 +5,2 @@ /** @license ms-rest-azure-js

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@azure/ms-rest-js")):"function"==typeof define&&define.amd?define(["exports","@azure/ms-rest-js"],t):t(e.msRestAzure={},e.msRest)}(this,function(e,p){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function t(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function r(s,i,a,u){return new(a=a||Promise)(function(e,t){function r(e){try{o(u.next(e))}catch(e){t(e)}}function n(e){try{o(u.throw(e))}catch(e){t(e)}}function o(t){t.done?e(t.value):new a(function(e){e(t.value)}).then(r,n)}o((u=u.apply(s,i||[])).next())})}function s(r,n){var o,s,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,s&&(i=2&t[0]?s.return:t[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,t[1])).done)return i;switch(s=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,s=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=n.call(r,a)}catch(e){t=[6,e],s=0}finally{o=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}var i=(a.prototype.getOperationStatus=function(){return this._pollState.state},a.prototype.isFinished=function(){return f(this._pollState.state)},a.prototype.pollUntilFinished=function(){return r(this,void 0,void 0,function(){var t;return s(this,function(e){switch(e.label){case 0:return this.isFinished()?[3,3]:(t=function(e,t){var r=30;if(null!=e.longRunningOperationRetryTimeout)r=e.longRunningOperationRetryTimeout;else{var n=t.headers.get("retry-after");if(n){var o=parseInt(n);Number.isNaN(o)||(r=o)}}return r}(this._azureServiceClient,this._pollState.mostRecentResponse),[4,p.delay(1e3*t)]);case 1:return e.sent(),[4,this.sendPollRequest()];case 2:return e.sent(),[3,0];case 3:return[2,this.isFinalStatusAcceptable()]}})})},a.prototype.shouldDoFinalGetResourceRequest=function(){var e=this._pollState.initialResponse.request.method;return!this._pollState.resource&&("PUT"===e||"PATCH"===e||"POST"===e)},a.prototype.getMostRecentResponse=function(){return this._pollState.mostRecentResponse},a.prototype.getOperationResponse=function(){return r(this,void 0,void 0,function(){var t,r,n;return s(this,function(e){switch(e.label){case 0:return this.shouldDoFinalGetResourceRequest()?[4,this.doFinalGetResourceRequest()]:[3,2];case 1:e.sent(),e.label=2;case 2:return t=this._pollState.mostRecentResponse,r=o({},t,{headers:t.headers.clone()}),(n=this._pollState.resource)?"string"==typeof n.valueOf()?(r.bodyAsText=n,r.parsedBody=JSON.parse(n)):(r.bodyAsText=JSON.stringify(n),r.parsedBody=n):(r.bodyAsText=t.bodyAsText,r.parsedBody=t.parsedBody),[2,r]}})})},a.prototype.getRestError=function(){var e=new p.RestError("");if(e.request=p.stripRequest(this._pollState.mostRecentRequest),e.response=this._pollState.mostRecentResponse,e.message='Long running operation failed with status: "'+this._pollState.state+'".',e.body=this._pollState.resource,e.body){var t=e.body.error;t&&(t.message&&(e.message='Long running operation failed with error: "'+t.message+'".'),t.code&&(e.code=t.code))}return e},a.prototype.updateState=function(e,t){var r=this;return this.updateOperationStatus(e,t).then(function(e){r._pollState.state=u(e.parsedBody)||"Succeeded",r._pollState.mostRecentResponse=e,r._pollState.mostRecentRequest=e.request,r._pollState.resource=l(e)}).catch(function(e){var t;if(!e.response||!e.response.status)throw e;if(t=e.response.status,"DELETE"!==r._pollState.initialResponse.request.method||t<400||499<t)throw e})},a.prototype.updateOperationStatus=function(e,t){var r=e.replace(" ","%20"),n=new p.WebResource(r,"GET"),o=this._pollState;n.operationSpec=o.mostRecentRequest.operationSpec,n.shouldDeserialize=t,n.operationResponseGetter=c;var s=o.options;if(s&&s.customHeaders)for(var i=s.customHeaders,a=0,u=Object.keys(i);a<u.length;a++){var l=u[a];n.headers.set(l,i[l])}return this._azureServiceClient.sendRequest(n)},a.prototype.getPollState=function(){return this._pollState},a);function a(e,t){this._azureServiceClient=e,this._pollState=t}function c(e,t){var r=t.status,n=e.responses,o=n[r];return o||(200===r?o=n[201]||n[202]:201<=r&&r<=299&&(o={})),o}function u(e){var t;return e&&(e.provisioningState?t=e.provisioningState:e.properties&&(t=e.properties.provisioningState)),t}function l(t){var e;try{t.parsedBody?e=t.parsedBody:t.bodyAsText&&0<t.bodyAsText.length&&(e=JSON.parse(t.bodyAsText))}catch(e){var r=new p.RestError('Error "'+e+'" occurred in parsing the responseBody " +\n "while creating the PollingState for Long Running Operation- "'+t.bodyAsText+'"');throw r.request=t.request,r.response=t,r}return e}function d(e,t){var r;switch(null==t&&(t=l(e)),e.status){case 202:r="InProgress";break;case 204:r="Succeeded";break;case 201:r=u(t)||"InProgress";break;case 200:var n=u(t);r=n||(b(e)||g(e)?"InProgress":"Succeeded");break;default:r="Failed"}return r}var h=["Succeeded","Failed","Canceled","Cancelled"];function f(e){for(var t=!1,r=0,n=h;r<n.length;r++){if(y(e,n[r])){t=!0;break}}return t}function y(e,t){return(e&&e.toLowerCase())===(t&&t.toLowerCase())}function R(e,t){var r;switch(t.pollStrategyType){case"AzureAsyncOperation":r=new P(e,t);break;case"Location":r=new v(e,t);break;case"GetResource":r=new O(e,t);break;default:throw new Error('Unrecognized LRO poll strategy type: "'+t.pollStrategyType+'"')}return r}function g(e){return e.headers.get("location")}var S,v=(t(m,S=i),m.prototype.locationStrategyShouldDeserialize=function(e){var t=!1,r=this._pollState.initialResponse.request.method,n=e.status;return 200!==n&&(201!==n||"PUT"!==r&&"PATCH"!==r)&&(204!==n||"DELETE"!==r&&"POST"!==r)||(t=!0),t},m.prototype.sendPollRequest=function(){var u=this._pollState;return this.updateOperationStatus(u.locationHeaderValue,this.locationStrategyShouldDeserialize.bind(this)).then(function(e){var t=g(e);t&&(u.locationHeaderValue=t),u.mostRecentResponse=e,u.mostRecentRequest=e.request;var r=u.initialResponse,n=r.request.method,o=r.status,s=e.status;if(202===s)u.state="InProgress";else if(200===s||201===s&&("PUT"===n||"PATCH"===n)||204===s&&("DELETE"===n||"POST"===n))u.state="Succeeded",u.resource=l(e);else{if(404!==s||"POST"!==n||200!==o&&201!==o&&202!==o){if(400<=s&&s<=499){var i=e.bodyAsText,a=i;try{a=JSON.parse(i).message}catch(e){}throw new p.RestError(a,void 0,s,p.stripRequest(e.request),e,i)}throw new Error("The response with status code "+s+' from polling for long running operation url "'+u.locationHeaderValue+'" is not valid.')}u.state="Failed",u.resource=l(e)}})},m.prototype.isFinalStatusAcceptable=function(){var e=this._pollState,t=e.initialResponse,r=t.status;return y(e.state,"Succeeded")||"POST"===t.request.method&&404===e.mostRecentResponse.status&&(200===r||201===r||202===r)},m.prototype.shouldDoFinalGetResourceRequest=function(){var e=this._pollState,t=e.initialResponse,r=t.request.method,n=t.status;return("POST"!==r||404!==e.mostRecentResponse.status||200!==n&&201!==n&&202!==n)&&(S.prototype.shouldDoFinalGetResourceRequest.call(this)||"POST"===r&&201===n)},m.prototype.doFinalGetResourceRequest=function(){var e,t=this._pollState,r=t.initialResponse,n=r.status,o=r.request;return e="POST"!==o.method||200!==n&&201!==n&&202!==n?o.url:t.locationHeaderValue,this.updateState(e,!0)},m);function m(){return null!==S&&S.apply(this,arguments)||this}function b(e){return e.headers.get("azure-asyncoperation")}var q,P=(t(_,q=i),_.prototype.sendPollRequest=function(){var s=this._pollState;return this.updateOperationStatus(s.azureAsyncOperationHeaderValue,!1).then(function(e){var t=e.status,r=e.parsedBody;if(200!==t&&201!==t&&202!==t&&204!==t){var n=new p.RestError("Invalid status code ("+t+') with response body "'+e.bodyAsText+'" occurred when polling for operation status.');throw n.statusCode=t,n.request=p.stripRequest(e.request),n.response=e,n.body=r,n}if(!r)throw new Error("The response from long running operation does not contain a body.");if(!r.status)throw new Error('The response "'+e.bodyAsText+'" from long running operation does not contain the status property.');var o=b(e);o&&(s.azureAsyncOperationHeaderValue=o),s.state=r.status,s.mostRecentResponse=e,s.mostRecentRequest=e.request,s.resource=l(e)})},_.prototype.shouldDoFinalGetResourceRequest=function(){var e=this._pollState,t=e.initialResponse,r=t.request.method,n=!1;if("PUT"===r||"PATCH"===r)n=!0;else if(e.locationHeaderValue){var o=t.status;"POST"===r?n=200===o||201===o:"DELETE"===r&&(n=200===o||202===o)}return n},_.prototype.doFinalGetResourceRequest=function(){var e=this._pollState,t=e.locationHeaderValue,r=e.initialResponse,n=r.request,o=n.url;if(t){var s=n.method,i=r.status;("POST"!==s||200!==i&&201!==i&&202!==i)&&("DELETE"!==s||200!==i&&202!==i)||(o=t)}return this.updateState(o,!0)},_.prototype.isFinalStatusAcceptable=function(){var e=this._pollState,t=e.initialResponse,r=t.status;return y(e.state,"Succeeded")||"POST"===t.request.method&&(200===r||201===r)},_);function _(){return null!==q&&q.apply(this,arguments)||this}var w,O=(t(T,w=i),T.prototype.sendPollRequest=function(){var o=this._pollState;return this.updateOperationStatus(o.initialResponse.request.url,!1).then(function(e){var t=e.status,r=e.parsedBody;if(200!==t&&201!==t&&202!==t&&204!==t){var n=new p.RestError('Invalid status code with response body "'+e.bodyAsText+'" occurred when polling for operation status.');throw n.statusCode=t,n.request=p.stripRequest(e.request),n.response=e,n.body=r,n}if(!e.parsedBody)throw new Error("The response from long running operation does not contain a body.");o.state=u(e.parsedBody)||"Succeeded",o.mostRecentResponse=e,o.mostRecentRequest=e.request,o.resource=l(e)})},T.prototype.isFinalStatusAcceptable=function(){return y(this._pollState.state,"Succeeded")},T.prototype.doFinalGetResourceRequest=function(){return this.sendPollRequest()},T);function T(){return null!==w&&w.apply(this,arguments)||this}var A=(E.prototype.getInitialResponse=function(){return this._initialResponse},E.prototype.getMostRecentResponse=function(){var e=this._lroPollStrategy;return e?e.getMostRecentResponse():this._initialResponse},E.prototype.isFinished=function(){var e=this._lroPollStrategy;return!e||e.isFinished()},E.prototype.isFinalStatusAcceptable=function(){var e,t=this._lroPollStrategy;return t?t.isFinished()&&(e=t.isFinalStatusAcceptable()):e=!0,e},E.prototype.getOperationStatus=function(){var e=this._lroPollStrategy;return e?e.getOperationStatus():"Succeeded"},E.prototype.getOperationResponse=function(){var e,t=this._lroPollStrategy;if(t)if(t.isFinished()){if(!t.isFinalStatusAcceptable())throw t.getRestError();e=t.getOperationResponse()}else e=Promise.resolve(void 0);else e=Promise.resolve(this._initialResponse);return e},E.prototype.poll=function(){var e=this._lroPollStrategy;return e?e.sendPollRequest().then(function(){return e.getOperationStatus()}):Promise.resolve("Succeeded")},E.prototype.pollUntilFinished=function(){return r(this,void 0,void 0,function(){var t;return s(this,function(e){return[2,(t=this._lroPollStrategy)?t.pollUntilFinished().then(function(e){if(e)return t.getOperationResponse().then(z);throw t.getRestError()}):Promise.resolve(z(this._initialResponse))]})})},E.prototype.getPollState=function(){var e=this._lroPollStrategy;return e?e.getPollState():void 0},E);function E(e,t){this._lroPollStrategy=e,this._initialResponse=t}function C(e,t,r){var n=function(e,t,r){var n,o,s=e.request.method,i=e.status;if(b(e))n="AzureAsyncOperation";else if(g(e))n="Location";else if("PUT"===s||"PATCH"===s)n="GetResource";else if(201!==i&&202!==i&&!f(d(e)))throw new Error("Can't determine long running operation polling strategy.");if(n){var a=l(e);o=R(t,{pollStrategyType:n,options:r,initialResponse:e,mostRecentResponse:e,mostRecentRequest:e.request,azureAsyncOperationHeaderValue:b(e),locationHeaderValue:g(e),resource:a,state:d(e,a)})}else o=void 0;return o}(t,e,r);return new A(n,t)}function F(e,t){var r=R(e,t);return new A(r,t.initialResponse)}function z(e){var t=e.request,r=t.operationResponseGetter,n=t.operationSpec;return p.flattenResponse(e,r&&n&&r(n,e))}var L,N="en-us",x="1.3.7",H=(t(D,L=p.ServiceClient),D.prototype.sendLRORequest=function(e,t,r){var n=this;return this.sendOperationRequest(e,t).then(function(e){return C(n,e._response,r)})},D.prototype.sendLongRunningRequest=function(e,t){return this.beginLongRunningRequest(e,t).then(function(e){return e.pollUntilFinished()}).then(function(e){return e._response})},D.prototype.beginLongRunningRequest=function(e,t){var r=this;return this.sendRequest(e).then(function(e){return C(r,e,t)})},D.prototype.restoreLROPoller=function(e){return F(this,e)},D);function D(e,t){var r=L.call(this,e,t=function(e){e=e||{};null==e.generateClientRequestIdHeader&&(e.generateClientRequestIdHeader=!0);e.userAgent||(e.userAgent=G());return e}(t))||this;r.acceptLanguage=N;var n=e.environment;return n&&!r.baseUri&&(r.baseUri=n.resourceManagerEndpointUrl),null!=t.acceptLanguage&&(r.acceptLanguage=t.acceptLanguage),null!=t.longRunningOperationRetryTimeout&&(r.longRunningOperationRetryTimeout=t.longRunningOperationRetryTimeout),r}function G(){var e=p.getDefaultUserAgentValue();return"ms-rest-azure-js/"+x+" "+e}var U,B=(t(I,U=p.ApiKeyCredentials),I);function I(e){if(!e||e&&"string"!=typeof e.valueOf())throw new Error("subscriptionKey cannot be null or undefined and must be of type string.");var t={inHeader:{"Ocp-Apim-Subscription-Key":e,"X-BingApis-SDK-Client":"node-SDK"}};return U.call(this,t)||this}e.AzureServiceClient=H,e.getDefaultUserAgentValue=G,e.BaseResourceMapper={serializedName:"BaseResource",type:{name:"Composite",className:"BaseResource",modelProperties:{}}},e.CloudErrorMapper={serializedName:"CloudError",type:{name:"Composite",className:"CloudError",modelProperties:{code:{required:!0,serializedName:"code",type:{name:"String"}},message:{required:!0,serializedName:"message",type:{name:"String"}},target:{serializedName:"target",type:{name:"String"}},details:{serializedName:"details",type:{name:"Sequence",element:{serializedName:"CloudErrorElementType",type:{name:"Composite",className:"CloudError"}}}},innerError:{required:!1,serializedName:"innererror",type:{name:"Object"}},additionalInfo:{required:!1,serializedName:"additionalInfo",type:{name:"Composite",className:"AdditionalInfoElement",modelProperties:{type:{required:!0,serializedName:"type",type:{name:"String"}},info:{required:!1,serializedName:"info",type:{name:"Object"}}}}}}}},e.CognitiveServicesCredentials=B,e.createLROPollerFromInitialResponse=C,e.createLROPollerFromPollState=F,e.LROPoller=A,e.DEFAULT_LANGUAGE=N,e.msRestAzureVersion=x,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@azure/ms-rest-js")):"function"==typeof define&&define.amd?define(["exports","@azure/ms-rest-js"],t):t((e=e||self).msRestAzure={},e.msRest)}(this,function(e,p){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function t(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function r(s,i,a,u){return new(a=a||Promise)(function(e,t){function r(e){try{o(u.next(e))}catch(e){t(e)}}function n(e){try{o(u.throw(e))}catch(e){t(e)}}function o(t){t.done?e(t.value):new a(function(e){e(t.value)}).then(r,n)}o((u=u.apply(s,i||[])).next())})}function s(r,n){var o,s,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,s&&(i=2&t[0]?s.return:t[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,t[1])).done)return i;switch(s=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,s=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=n.call(r,a)}catch(e){t=[6,e],s=0}finally{o=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}var i=(a.prototype.getOperationStatus=function(){return this._pollState.state},a.prototype.isFinished=function(){return f(this._pollState.state)},a.prototype.pollUntilFinished=function(){return r(this,void 0,void 0,function(){var t;return s(this,function(e){switch(e.label){case 0:return this.isFinished()?[3,3]:(t=function(e,t){var r=30;if(null!=e.longRunningOperationRetryTimeout)r=e.longRunningOperationRetryTimeout;else{var n=t.headers.get("retry-after");if(n){var o=parseInt(n);Number.isNaN(o)||(r=o)}}return r}(this._azureServiceClient,this._pollState.mostRecentResponse),[4,p.delay(1e3*t)]);case 1:return e.sent(),[4,this.sendPollRequest()];case 2:return e.sent(),[3,0];case 3:return[2,this.isFinalStatusAcceptable()]}})})},a.prototype.shouldDoFinalGetResourceRequest=function(){var e=this._pollState.initialResponse.request.method;return!this._pollState.resource&&("PUT"===e||"PATCH"===e||"POST"===e)},a.prototype.getMostRecentResponse=function(){return this._pollState.mostRecentResponse},a.prototype.getOperationResponse=function(){return r(this,void 0,void 0,function(){var t,r,n;return s(this,function(e){switch(e.label){case 0:return this.shouldDoFinalGetResourceRequest()?[4,this.doFinalGetResourceRequest()]:[3,2];case 1:e.sent(),e.label=2;case 2:return t=this._pollState.mostRecentResponse,r=o({},t,{headers:t.headers.clone()}),(n=this._pollState.resource)?"string"==typeof n.valueOf()?(r.bodyAsText=n,r.parsedBody=JSON.parse(n)):(r.bodyAsText=JSON.stringify(n),r.parsedBody=n):(r.bodyAsText=t.bodyAsText,r.parsedBody=t.parsedBody),[2,r]}})})},a.prototype.getRestError=function(){var e=new p.RestError("");if(e.request=p.stripRequest(this._pollState.mostRecentRequest),e.response=this._pollState.mostRecentResponse,e.message='Long running operation failed with status: "'+this._pollState.state+'".',e.body=this._pollState.resource,e.body){var t=e.body.error;t&&(t.message&&(e.message='Long running operation failed with error: "'+t.message+'".'),t.code&&(e.code=t.code))}return e},a.prototype.updateState=function(e,t){var r=this;return this.updateOperationStatus(e,t).then(function(e){r._pollState.state=u(e.parsedBody)||"Succeeded",r._pollState.mostRecentResponse=e,r._pollState.mostRecentRequest=e.request,r._pollState.resource=l(e)}).catch(function(e){var t;if(!e.response||!e.response.status)throw e;if(t=e.response.status,"DELETE"!==r._pollState.initialResponse.request.method||t<400||499<t)throw e})},a.prototype.updateOperationStatus=function(e,t){var r=e.replace(" ","%20"),n=new p.WebResource(r,"GET"),o=this._pollState;n.operationSpec=o.mostRecentRequest.operationSpec,n.shouldDeserialize=t,n.operationResponseGetter=c;var s=o.options;if(s&&s.customHeaders)for(var i=s.customHeaders,a=0,u=Object.keys(i);a<u.length;a++){var l=u[a];n.headers.set(l,i[l])}return this._azureServiceClient.sendRequest(n)},a.prototype.getPollState=function(){return this._pollState},a);function a(e,t){this._azureServiceClient=e,this._pollState=t}function c(e,t){var r=t.status,n=e.responses,o=n[r];return o||(200===r?o=n[201]||n[202]:201<=r&&r<=299&&(o={})),o}function u(e){var t;return e&&(e.provisioningState?t=e.provisioningState:e.properties&&(t=e.properties.provisioningState)),t}function l(t){var e;try{t.parsedBody?e=t.parsedBody:t.bodyAsText&&0<t.bodyAsText.length&&(e=JSON.parse(t.bodyAsText))}catch(e){var r=new p.RestError('Error "'+e+'" occurred in parsing the responseBody " +\n "while creating the PollingState for Long Running Operation- "'+t.bodyAsText+'"');throw r.request=t.request,r.response=t,r}return e}function d(e,t){var r;switch(null==t&&(t=l(e)),e.status){case 202:r="InProgress";break;case 204:r="Succeeded";break;case 201:r=u(t)||"InProgress";break;case 200:var n=u(t);r=n||(b(e)||g(e)?"InProgress":"Succeeded");break;default:r="Failed"}return r}var h=["Succeeded","Failed","Canceled","Cancelled"];function f(e){for(var t=!1,r=0,n=h;r<n.length;r++){if(y(e,n[r])){t=!0;break}}return t}function y(e,t){return(e&&e.toLowerCase())===(t&&t.toLowerCase())}function R(e,t){var r;switch(t.pollStrategyType){case"AzureAsyncOperation":r=new P(e,t);break;case"Location":r=new v(e,t);break;case"GetResource":r=new O(e,t);break;default:throw new Error('Unrecognized LRO poll strategy type: "'+t.pollStrategyType+'"')}return r}function g(e){return e.headers.get("location")}var S,v=(t(m,S=i),m.prototype.locationStrategyShouldDeserialize=function(e){var t=!1,r=this._pollState.initialResponse.request.method,n=e.status;return 200!==n&&(201!==n||"PUT"!==r&&"PATCH"!==r)&&(204!==n||"DELETE"!==r&&"POST"!==r)||(t=!0),t},m.prototype.sendPollRequest=function(){var u=this._pollState;return this.updateOperationStatus(u.locationHeaderValue,this.locationStrategyShouldDeserialize.bind(this)).then(function(e){var t=g(e);t&&(u.locationHeaderValue=t),u.mostRecentResponse=e,u.mostRecentRequest=e.request;var r=u.initialResponse,n=r.request.method,o=r.status,s=e.status;if(202===s)u.state="InProgress";else if(200===s||201===s&&("PUT"===n||"PATCH"===n)||204===s&&("DELETE"===n||"POST"===n))u.state="Succeeded",u.resource=l(e);else{if(404!==s||"POST"!==n||200!==o&&201!==o&&202!==o){if(400<=s&&s<=499){var i=e.bodyAsText,a=i;try{a=JSON.parse(i).message}catch(e){}throw new p.RestError(a,void 0,s,p.stripRequest(e.request),e,i)}throw new Error("The response with status code "+s+' from polling for long running operation url "'+u.locationHeaderValue+'" is not valid.')}u.state="Failed",u.resource=l(e)}})},m.prototype.isFinalStatusAcceptable=function(){var e=this._pollState,t=e.initialResponse,r=t.status;return y(e.state,"Succeeded")||"POST"===t.request.method&&404===e.mostRecentResponse.status&&(200===r||201===r||202===r)},m.prototype.shouldDoFinalGetResourceRequest=function(){var e=this._pollState,t=e.initialResponse,r=t.request.method,n=t.status;return("POST"!==r||404!==e.mostRecentResponse.status||200!==n&&201!==n&&202!==n)&&(S.prototype.shouldDoFinalGetResourceRequest.call(this)||"POST"===r&&201===n)},m.prototype.doFinalGetResourceRequest=function(){var e,t=this._pollState,r=t.initialResponse,n=r.status,o=r.request;return e="POST"!==o.method||200!==n&&201!==n&&202!==n?o.url:t.locationHeaderValue,this.updateState(e,!0)},m);function m(){return null!==S&&S.apply(this,arguments)||this}function b(e){return e.headers.get("azure-asyncoperation")}var q,P=(t(_,q=i),_.prototype.sendPollRequest=function(){var s=this._pollState;return this.updateOperationStatus(s.azureAsyncOperationHeaderValue,!1).then(function(e){var t=e.status,r=e.parsedBody;if(200!==t&&201!==t&&202!==t&&204!==t){var n=new p.RestError("Invalid status code ("+t+') with response body "'+e.bodyAsText+'" occurred when polling for operation status.');throw n.statusCode=t,n.request=p.stripRequest(e.request),n.response=e,n.body=r,n}if(!r)throw new Error("The response from long running operation does not contain a body.");if(!r.status)throw new Error('The response "'+e.bodyAsText+'" from long running operation does not contain the status property.');var o=b(e);o&&(s.azureAsyncOperationHeaderValue=o),s.state=r.status,s.mostRecentResponse=e,s.mostRecentRequest=e.request,s.resource=l(e)})},_.prototype.shouldDoFinalGetResourceRequest=function(){var e=this._pollState,t=e.initialResponse,r=t.request.method,n=!1;if("PUT"===r||"PATCH"===r)n=!0;else if(e.locationHeaderValue){var o=t.status;"POST"===r?n=200===o||201===o:"DELETE"===r&&(n=200===o||202===o)}return n},_.prototype.doFinalGetResourceRequest=function(){var e=this._pollState,t=e.locationHeaderValue,r=e.initialResponse,n=r.request,o=n.url;if(t){var s=n.method,i=r.status;("POST"!==s||200!==i&&201!==i&&202!==i)&&("DELETE"!==s||200!==i&&202!==i)||(o=t)}return this.updateState(o,!0)},_.prototype.isFinalStatusAcceptable=function(){var e=this._pollState,t=e.initialResponse,r=t.status;return y(e.state,"Succeeded")||"POST"===t.request.method&&(200===r||201===r)},_);function _(){return null!==q&&q.apply(this,arguments)||this}var w,O=(t(T,w=i),T.prototype.sendPollRequest=function(){var o=this._pollState;return this.updateOperationStatus(o.initialResponse.request.url,!1).then(function(e){var t=e.status,r=e.parsedBody;if(200!==t&&201!==t&&202!==t&&204!==t){var n=new p.RestError('Invalid status code with response body "'+e.bodyAsText+'" occurred when polling for operation status.');throw n.statusCode=t,n.request=p.stripRequest(e.request),n.response=e,n.body=r,n}if(!e.parsedBody)throw new Error("The response from long running operation does not contain a body.");o.state=u(e.parsedBody)||"Succeeded",o.mostRecentResponse=e,o.mostRecentRequest=e.request,o.resource=l(e)})},T.prototype.isFinalStatusAcceptable=function(){return y(this._pollState.state,"Succeeded")},T.prototype.doFinalGetResourceRequest=function(){return this.sendPollRequest()},T);function T(){return null!==w&&w.apply(this,arguments)||this}var A=(E.prototype.getInitialResponse=function(){return this._initialResponse},E.prototype.getMostRecentResponse=function(){var e=this._lroPollStrategy;return e?e.getMostRecentResponse():this._initialResponse},E.prototype.isFinished=function(){var e=this._lroPollStrategy;return!e||e.isFinished()},E.prototype.isFinalStatusAcceptable=function(){var e,t=this._lroPollStrategy;return t?t.isFinished()&&(e=t.isFinalStatusAcceptable()):e=!0,e},E.prototype.getOperationStatus=function(){var e=this._lroPollStrategy;return e?e.getOperationStatus():"Succeeded"},E.prototype.getOperationResponse=function(){var e,t=this._lroPollStrategy;if(t)if(t.isFinished()){if(!t.isFinalStatusAcceptable())throw t.getRestError();e=t.getOperationResponse()}else e=Promise.resolve(void 0);else e=Promise.resolve(this._initialResponse);return e},E.prototype.poll=function(){var e=this._lroPollStrategy;return e?e.sendPollRequest().then(function(){return e.getOperationStatus()}):Promise.resolve("Succeeded")},E.prototype.pollUntilFinished=function(){return r(this,void 0,void 0,function(){var t;return s(this,function(e){return[2,(t=this._lroPollStrategy)?t.pollUntilFinished().then(function(e){if(e)return t.getOperationResponse().then(z);throw t.getRestError()}):Promise.resolve(z(this._initialResponse))]})})},E.prototype.getPollState=function(){var e=this._lroPollStrategy;return e?e.getPollState():void 0},E);function E(e,t){this._lroPollStrategy=e,this._initialResponse=t}function C(e,t,r){var n=function(e,t,r){var n,o,s=e.request.method,i=e.status;if(b(e))n="AzureAsyncOperation";else if(g(e))n="Location";else if("PUT"===s||"PATCH"===s)n="GetResource";else if(201!==i&&202!==i&&!f(d(e)))throw new Error("Can't determine long running operation polling strategy.");if(n){var a=l(e);o=R(t,{pollStrategyType:n,options:r,initialResponse:e,mostRecentResponse:e,mostRecentRequest:e.request,azureAsyncOperationHeaderValue:b(e),locationHeaderValue:g(e),resource:a,state:d(e,a)})}else o=void 0;return o}(t,e,r);return new A(n,t)}function F(e,t){var r=R(e,t);return new A(r,t.initialResponse)}function z(e){var t=e.request,r=t.operationResponseGetter,n=t.operationSpec;return p.flattenResponse(e,r&&n&&r(n,e))}var L,N="en-us",x="2.0.0",H=(t(D,L=p.ServiceClient),D.prototype.sendLRORequest=function(e,t,r){var n=this;return this.sendOperationRequest(e,t).then(function(e){return C(n,e._response,r)})},D.prototype.sendLongRunningRequest=function(e,t){return this.beginLongRunningRequest(e,t).then(function(e){return e.pollUntilFinished()}).then(function(e){return e._response})},D.prototype.beginLongRunningRequest=function(e,t){var r=this;return this.sendRequest(e).then(function(e){return C(r,e,t)})},D.prototype.restoreLROPoller=function(e){return F(this,e)},D);function D(e,t){var r=L.call(this,e,t=function(e){e=e||{};null==e.generateClientRequestIdHeader&&(e.generateClientRequestIdHeader=!0);e.userAgent||(e.userAgent=G());return e}(t))||this;r.acceptLanguage=N;var n=e.environment;return n&&!r.baseUri&&(r.baseUri=n.resourceManagerEndpointUrl),null!=t.acceptLanguage&&(r.acceptLanguage=t.acceptLanguage),null!=t.longRunningOperationRetryTimeout&&(r.longRunningOperationRetryTimeout=t.longRunningOperationRetryTimeout),r}function G(){var e=p.getDefaultUserAgentValue();return"ms-rest-azure-js/"+x+" "+e}var U,B=(t(I,U=p.ApiKeyCredentials),I);function I(e){if(!e||e&&"string"!=typeof e.valueOf())throw new Error("subscriptionKey cannot be null or undefined and must be of type string.");var t={inHeader:{"Ocp-Apim-Subscription-Key":e,"X-BingApis-SDK-Client":"node-SDK"}};return U.call(this,t)||this}e.AzureServiceClient=H,e.BaseResourceMapper={serializedName:"BaseResource",type:{name:"Composite",className:"BaseResource",modelProperties:{}}},e.CloudErrorMapper={serializedName:"CloudError",type:{name:"Composite",className:"CloudError",modelProperties:{code:{required:!0,serializedName:"code",type:{name:"String"}},message:{required:!0,serializedName:"message",type:{name:"String"}},target:{serializedName:"target",type:{name:"String"}},details:{serializedName:"details",type:{name:"Sequence",element:{serializedName:"CloudErrorElementType",type:{name:"Composite",className:"CloudError"}}}},innerError:{required:!1,serializedName:"innererror",type:{name:"Object"}},additionalInfo:{required:!1,serializedName:"additionalInfo",type:{name:"Composite",className:"AdditionalInfoElement",modelProperties:{type:{required:!0,serializedName:"type",type:{name:"String"}},info:{required:!1,serializedName:"info",type:{name:"Object"}}}}}}}},e.CognitiveServicesCredentials=B,e.DEFAULT_LANGUAGE=N,e.LROPoller=A,e.createLROPollerFromInitialResponse=C,e.createLROPollerFromPollState=F,e.getDefaultUserAgentValue=G,e.msRestAzureVersion=x,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -20,3 +20,3 @@ /**

*/
export declare const msRestAzureVersion = "1.3.7";
export declare const msRestAzureVersion = "2.0.0";
//# sourceMappingURL=constants.d.ts.map

@@ -15,3 +15,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

*/
export var msRestAzureVersion = "1.3.7";
export var msRestAzureVersion = "2.0.0";
//# sourceMappingURL=constants.js.map

@@ -30,2 +30,2 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

*/
export const msRestAzureVersion = "1.3.7";
export const msRestAzureVersion = "2.0.0";

@@ -8,3 +8,3 @@ {

},
"version": "1.3.8",
"version": "2.0.0",
"description": "Isomorphic Azure client runtime for Typescript/node.js/browser javascript client libraries generated using AutoRest",

@@ -45,4 +45,4 @@ "tags": [

"dependencies": {
"@azure/ms-rest-js": "^1.8.10",
"tslib": "^1.9.3"
"@azure/ms-rest-js": "^2.0.3",
"tslib": "^1.10.0"
},

@@ -54,20 +54,20 @@ "devDependencies": {

"@types/node": "^10.9.4",
"chai": "^4.1.2",
"mocha": "^5.2.0",
"mocha-junit-reporter": "^1.18.0",
"chai": "^4.2.0",
"mocha": "^6.1.4",
"mocha-junit-reporter": "^1.23.0",
"mocha-multi-reporters": "^1.1.7",
"npm-run-all": "^4.1.5",
"nyc": "^14.1.1",
"opn-cli": "^4.0.0",
"rollup": "^0.67.3",
"rollup-plugin-node-resolve": "^3.4.0",
"open-cli": "^5.0.0",
"rollup": "^1.17.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-visualizer": "^0.9.2",
"rollup-plugin-visualizer": "^2.4.4",
"shx": "^0.3.2",
"ts-loader": "^5.3.1",
"ts-node": "^7.0.1",
"tslint": "^5.7.0",
"typescript": "^3.1.1",
"uglify-js": "^3.4.9",
"yarn": "^1.6.0"
"ts-loader": "^6.0.4",
"ts-node": "^8.3.0",
"tslint": "^5.18.0",
"typescript": "^3.5.3",
"uglify-js": "^3.6.0",
"yarn": "^1.17.3"
},

@@ -74,0 +74,0 @@ "homepage": "https://github.com/Azure/ms-rest-azure-js",

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