Socket
Socket
Sign inDemoInstall

ms-rest-azure-js

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.17.164 to 0.17.165

24

dist/lib/cloudError.js

@@ -50,2 +50,26 @@ "use strict";

}
},
additionalInfo: {
required: false,
serializedName: "additionalInfo",
type: {
name: "Composite",
className: "AdditionalInfoElement",
modelProperties: {
type: {
required: true,
serializedName: "type",
type: {
name: "String"
}
},
info: {
required: false,
serializedName: "info",
type: {
name: "Object"
}
}
}
}
}

@@ -52,0 +76,0 @@ }

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

}
},
additionalInfo: {
required: false,
serializedName: "additionalInfo",
type: {
name: "Composite",
className: "AdditionalInfoElement",
modelProperties: {
type: {
required: true,
serializedName: "type",
type: {
name: "String"
}
},
info: {
required: false,
serializedName: "info",
type: {
name: "Object"
}
}
}
}
}

@@ -50,0 +74,0 @@ }

@@ -1246,2 +1246,26 @@ var msRestAzure =

}
},
additionalInfo: {
required: false,
serializedName: "additionalInfo",
type: {
name: "Composite",
className: "AdditionalInfoElement",
modelProperties: {
type: {
required: true,
serializedName: "type",
type: {
name: "String"
}
},
info: {
required: false,
serializedName: "info",
type: {
name: "Object"
}
}
}
}
}

@@ -1248,0 +1272,0 @@ }

2

msRestAzureBundle.min.js

@@ -1,1 +0,1 @@

var msRestAzure=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}([function(e,t,r){"use strict";t.c=function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},r.d(t,"a",function(){return o}),t.b=function(e,t,r,n){return new(r||(r=Promise))(function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(i,a)}u((n=n.apply(e,t||[])).next())})},t.d=function(e,t){var r,n,o,s,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};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)};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(e,t){e.exports=msRest},function(e,t,r){"use strict";r.d(t,"a",function(){return i}),t.b=function(e,t,r){var n=Object(s.a)(t,e,r);return new i(n,t)},t.c=function(e,t){var r=Object(s.b)(e,t);return new i(r,t.initialResponse)};var n=r(0),o=r(1),s=(r.n(o),r(6)),i=function(){function e(e,t){this._lroPollStrategy=e,this._initialResponse=t}return 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 n.b(this,void 0,void 0,function(){var e;return n.d(this,function(t){return e=this._lroPollStrategy,[2,e?e.pollUntilFinished().then(function(t){if(t)return e.getOperationResponse().then(a);throw e.getRestError()}):Promise.resolve(a(this._initialResponse))]})})},e.prototype.getPollState=function(){var e=this._lroPollStrategy;return e?e.getPollState():void 0},e}();function a(e){var t=e.request,r=t.operationResponseGetter,n=t.operationSpec;return Object(o.flattenResponse)(e,r&&n&&r(n,e))}},function(e,t,r){"use strict";r.d(t,"a",function(){return n}),r.d(t,"b",function(){return o});var n="en-us",o="0.1.0"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5);r.d(t,"AzureServiceClient",function(){return n.a});var o=r(7);r.d(t,"BaseResourceMapper",function(){return o.a});var s=r(8);r.d(t,"CloudErrorMapper",function(){return s.a});var i=r(9);r.d(t,"CognitiveServicesCredentials",function(){return i.a});var a=r(2);r.d(t,"LROPoller",function(){return a.a});var u=r(3);r.d(t,"DEFAULT_LANGUAGE",function(){return u.a}),r.d(t,"msRestAzureVersion",function(){return u.b})},function(e,t,r){"use strict";r.d(t,"a",function(){return a});var n=r(0),o=r(1),s=(r.n(o),r(2)),i=r(3),a=function(e){function t(t,r){var n=e.call(this,t,r=function(e){e||(e={});void 0==e.generateClientRequestIdHeader&&(e.generateClientRequestIdHeader=!0);return e}(r))||this;n.acceptLanguage=i.a;var o=t.environment;return o&&!n.baseUri&&(n.baseUri=o.resourceManagerEndpointUrl),void 0!=r.acceptLanguage&&(n.acceptLanguage=r.acceptLanguage),void 0!=r.longRunningOperationRetryTimeout&&(n.longRunningOperationRetryTimeout=r.longRunningOperationRetryTimeout),n.addUserAgentInfo("ms-rest-azure/"+i.b),n}return n.c(t,e),t.prototype.sendLRORequest=function(e,t,r){var n=this;return this.sendOperationRequest(e,t).then(function(e){return Object(s.b)(n,e._response,r)})},t.prototype.sendLongRunningRequest=function(e,t){return this.beginLongRunningRequest(e,t).then(function(e){return e.pollUntilFinished()}).then(function(e){return e._response})},t.prototype.beginLongRunningRequest=function(e,t){var r=this;return this.sendRequest(e).then(function(e){return Object(s.b)(r,e,t)})},t.prototype.restoreLROPoller=function(e){return Object(s.c)(this,e)},t}(o.ServiceClient)},function(e,t,r){"use strict";t.a=function(e,t,r){var n,o,s=e.request.method,i=e.status;if(y(e))n="AzureAsyncOperation";else if(f(e))n="Location";else if("PUT"===s||"PATCH"===s)n="GetResource";else if(201!==i&&202!==i&&!p(l(e)))throw new Error("Can't determine long running operation polling strategy.");if(n){var a=u(e),c={pollStrategyType:n,options:r,initialResponse:e,mostRecentResponse:e,mostRecentRequest:e.request,azureAsyncOperationHeaderValue:y(e),locationHeaderValue:f(e),resource:a,state:l(e,a)};o=d(t,c)}else o=void 0;return o},t.b=d;var n=r(0),o=r(1),s=(r.n(o),function(){function e(e,t){this._azureServiceClient=e,this._pollState=t}return e.prototype.getOperationStatus=function(){return this._pollState.state},e.prototype.isFinished=function(){return p(this._pollState.state)},e.prototype.pollUntilFinished=function(){return n.b(this,void 0,void 0,function(){var e;return n.d(this,function(t){switch(t.label){case 0:return this.isFinished()?[3,3]:(e=function(e,t){var r=30;if(void 0!=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,Object(o.delay)(1e3*e)]);case 1:return t.sent(),[4,this.sendPollRequest()];case 2:return t.sent(),[3,0];case 3:return[2,this.isFinalStatusAcceptable()]}})})},e.prototype.shouldDoFinalGetResourceRequest=function(){var e=this._pollState.initialResponse.request.method;return!this._pollState.resource&&("PUT"===e||"PATCH"===e||"POST"===e)},e.prototype.getMostRecentResponse=function(){return this._pollState.mostRecentResponse},e.prototype.getOperationResponse=function(){return n.b(this,void 0,void 0,function(){var e,t,r;return n.d(this,function(o){switch(o.label){case 0:return this.shouldDoFinalGetResourceRequest()?[4,this.doFinalGetResourceRequest()]:[3,2];case 1:o.sent(),o.label=2;case 2:return e=this._pollState.mostRecentResponse,t=n.a({},e,{headers:e.headers.clone()}),(r=this._pollState.resource)?"string"==typeof r.valueOf()?(t.bodyAsText=r,t.parsedBody=JSON.parse(r)):(t.bodyAsText=JSON.stringify(r),t.parsedBody=r):(t.bodyAsText=e.bodyAsText,t.parsedBody=e.parsedBody),[2,t]}})})},e.prototype.getRestError=function(){var e=new o.RestError("");if(e.request=Object(o.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},e.prototype.updateState=function(e,t){var r=this;return this.updateOperationStatus(e,t).then(function(e){r._pollState.state=a(e.parsedBody)||"Succeeded",r._pollState.mostRecentResponse=e,r._pollState.mostRecentRequest=e.request;try{r._pollState.resource=u(e)}catch(n){r._pollState.resource=void 0;var t=e.status;if("DELETE"!==r._pollState.initialResponse.request.method||t<400||499<t)throw n}})},e.prototype.updateOperationStatus=function(e,t){var r=e.replace(" ","%20"),n=new o.WebResource(r,"GET"),s=this._pollState;n.operationSpec=s.mostRecentRequest.operationSpec,n.shouldDeserialize=t,n.operationResponseGetter=i;var a=s.options;if(a&&a.customHeaders)for(var u=a.customHeaders,l=0,c=Object.keys(u);l<c.length;l++){var p=c[l];n.headers.set(p,u[p])}return this._azureServiceClient.sendRequest(n)},e.prototype.getPollState=function(){return this._pollState},e}());function i(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 a(e){var t;return e&&(e.provisioningState?t=e.provisioningState:e.properties&&(t=e.properties.provisioningState)),t}function u(e){var t;try{e.parsedBody?t=e.parsedBody:e.bodyAsText&&e.bodyAsText.length>0&&(t=JSON.parse(e.bodyAsText))}catch(t){var r=new o.RestError('Error "'+t+'" occurred in parsing the responseBody " +\n "while creating the PollingState for Long Running Operation- "'+e.bodyAsText+'"');throw r.request=e.request,r.response=e,r}return t}function l(e,t){var r;switch(void 0==t&&(t=u(e)),e.status){case 202:r="InProgress";break;case 204:r="Succeeded";break;case 201:r=a(t)||"InProgress";break;case 200:var n=a(t);r=n||(y(e)||f(e)?"InProgress":"Succeeded");break;default:r="Failed"}return r}var c=["Succeeded","Failed","Canceled"];function p(e){return-1!==c.indexOf(e)}function d(e,t){var r;switch(t.pollStrategyType){case"AzureAsyncOperation":r=new R(e,t);break;case"Location":r=new h(e,t);break;case"GetResource":r=new v(e,t);break;default:throw new Error('Unrecognized LRO poll strategy type: "'+t.pollStrategyType+'"')}return r}function f(e){return e.headers.get("location")}var h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.c(t,e),t.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},t.prototype.sendPollRequest=function(){var e=this._pollState;return this.updateOperationStatus(e.locationHeaderValue,this.locationStrategyShouldDeserialize.bind(this)).then(function(t){var r=f(t);r&&(e.locationHeaderValue=r),e.mostRecentResponse=t,e.mostRecentRequest=t.request;var n=e.initialResponse,s=n.request.method,i=n.status,a=t.status;if(202===a)e.state="InProgress";else if(200===a||201===a&&("PUT"===s||"PATCH"===s)||204===a&&("DELETE"===s||"POST"===s))e.state="Succeeded",e.resource=u(t);else{if(404!==a||"POST"!==s||200!==i&&201!==i&&202!==i){if(400<=a&&a<=499){var l=t.bodyAsText;throw new o.RestError(l,void 0,a,Object(o.stripRequest)(t.request),t,l)}throw new Error("The response with status code "+a+' from polling for long running operation url "'+e.locationHeaderValue+'" is not valid.')}e.state="Failed",e.resource=u(t)}})},t.prototype.isFinalStatusAcceptable=function(){var e=this._pollState,t=e.initialResponse,r=t.status;return"Succeeded"===e.state||"POST"===t.request.method&&404===e.mostRecentResponse.status&&(200===r||201===r||202===r)},t.prototype.shouldDoFinalGetResourceRequest=function(){var t=this._pollState,r=t.initialResponse,n=r.request.method,o=r.status;return("POST"!==n||404!==t.mostRecentResponse.status||200!==o&&201!==o&&202!==o)&&(e.prototype.shouldDoFinalGetResourceRequest.call(this)||"POST"===n&&201===o)},t.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)},t}(s);function y(e){return e.headers.get("azure-asyncoperation")}var R=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.c(t,e),t.prototype.sendPollRequest=function(){var e=this._pollState;return this.updateOperationStatus(e.azureAsyncOperationHeaderValue,!1).then(function(t){var r=t.status,n=t.parsedBody;if(200!==r&&201!==r&&202!==r&&204!==r){var s=new o.RestError("Invalid status code ("+r+') with response body "'+t.bodyAsText+'" occurred when polling for operation status.');throw s.statusCode=r,s.request=Object(o.stripRequest)(t.request),s.response=t,s.body=n,s}if(!n)throw new Error("The response from long running operation does not contain a body.");if(!n.status)throw new Error('The response "'+t.bodyAsText+'" from long running operation does not contain the status property.');var i=y(t);i&&(e.azureAsyncOperationHeaderValue=i),e.state=n.status,e.mostRecentResponse=t,e.mostRecentRequest=t.request,e.resource=u(t)})},t.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||202===o:"DELETE"===r&&(n=200===o||202===o)}return n},t.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)},t.prototype.isFinalStatusAcceptable=function(){var e=this._pollState,t=e.initialResponse,r=t.status;return"Succeeded"===e.state||"POST"===t.request.method&&(200===r||201===r)},t}(s),v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.c(t,e),t.prototype.sendPollRequest=function(){var e=this._pollState;return this.updateOperationStatus(e.initialResponse.request.url,!1).then(function(t){var r=t.status,n=t.parsedBody;if(200!==r&&201!==r&&202!==r&&204!==r){var s=new o.RestError('Invalid status code with response body "'+t.bodyAsText+'" occurred when polling for operation status.');throw s.statusCode=r,s.request=Object(o.stripRequest)(t.request),s.response=t,s.body=n,s}if(!t.parsedBody)throw new Error("The response from long running operation does not contain a body.");e.state=a(t.parsedBody)||"Succeeded",e.mostRecentResponse=t,e.mostRecentRequest=t.request,e.resource=u(t)})},t.prototype.isFinalStatusAcceptable=function(){return"Succeeded"===this._pollState.state},t.prototype.doFinalGetResourceRequest=function(){return this.sendPollRequest()},t}(s)},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n={serializedName:"BaseResource",type:{name:"Composite",className:"BaseResource",modelProperties:{}}}},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n={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"}}}}}},function(e,t,r){"use strict";r.d(t,"a",function(){return s});var n=r(0),o=r(1),s=(r.n(o),function(e){function t(t){if(!t||t&&"string"!=typeof t.valueOf())throw new Error("subscriptionKey cannot be null or undefined and must be of type string.");var r={inHeader:{"Ocp-Apim-Subscription-Key":t,"X-BingApis-SDK-Client":"node-SDK"}};return e.call(this,r)||this}return n.c(t,e),t}(o.ApiKeyCredentials))}]);
var msRestAzure=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}([function(e,t,r){"use strict";t.c=function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},r.d(t,"a",function(){return o}),t.b=function(e,t,r,n){return new(r||(r=Promise))(function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(i,a)}u((n=n.apply(e,t||[])).next())})},t.d=function(e,t){var r,n,o,s,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};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)};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(e,t){e.exports=msRest},function(e,t,r){"use strict";r.d(t,"a",function(){return i}),t.b=function(e,t,r){var n=Object(s.a)(t,e,r);return new i(n,t)},t.c=function(e,t){var r=Object(s.b)(e,t);return new i(r,t.initialResponse)};var n=r(0),o=r(1),s=(r.n(o),r(6)),i=function(){function e(e,t){this._lroPollStrategy=e,this._initialResponse=t}return 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 n.b(this,void 0,void 0,function(){var e;return n.d(this,function(t){return e=this._lroPollStrategy,[2,e?e.pollUntilFinished().then(function(t){if(t)return e.getOperationResponse().then(a);throw e.getRestError()}):Promise.resolve(a(this._initialResponse))]})})},e.prototype.getPollState=function(){var e=this._lroPollStrategy;return e?e.getPollState():void 0},e}();function a(e){var t=e.request,r=t.operationResponseGetter,n=t.operationSpec;return Object(o.flattenResponse)(e,r&&n&&r(n,e))}},function(e,t,r){"use strict";r.d(t,"a",function(){return n}),r.d(t,"b",function(){return o});var n="en-us",o="0.1.0"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5);r.d(t,"AzureServiceClient",function(){return n.a});var o=r(7);r.d(t,"BaseResourceMapper",function(){return o.a});var s=r(8);r.d(t,"CloudErrorMapper",function(){return s.a});var i=r(9);r.d(t,"CognitiveServicesCredentials",function(){return i.a});var a=r(2);r.d(t,"LROPoller",function(){return a.a});var u=r(3);r.d(t,"DEFAULT_LANGUAGE",function(){return u.a}),r.d(t,"msRestAzureVersion",function(){return u.b})},function(e,t,r){"use strict";r.d(t,"a",function(){return a});var n=r(0),o=r(1),s=(r.n(o),r(2)),i=r(3),a=function(e){function t(t,r){var n=e.call(this,t,r=function(e){e||(e={});void 0==e.generateClientRequestIdHeader&&(e.generateClientRequestIdHeader=!0);return e}(r))||this;n.acceptLanguage=i.a;var o=t.environment;return o&&!n.baseUri&&(n.baseUri=o.resourceManagerEndpointUrl),void 0!=r.acceptLanguage&&(n.acceptLanguage=r.acceptLanguage),void 0!=r.longRunningOperationRetryTimeout&&(n.longRunningOperationRetryTimeout=r.longRunningOperationRetryTimeout),n.addUserAgentInfo("ms-rest-azure/"+i.b),n}return n.c(t,e),t.prototype.sendLRORequest=function(e,t,r){var n=this;return this.sendOperationRequest(e,t).then(function(e){return Object(s.b)(n,e._response,r)})},t.prototype.sendLongRunningRequest=function(e,t){return this.beginLongRunningRequest(e,t).then(function(e){return e.pollUntilFinished()}).then(function(e){return e._response})},t.prototype.beginLongRunningRequest=function(e,t){var r=this;return this.sendRequest(e).then(function(e){return Object(s.b)(r,e,t)})},t.prototype.restoreLROPoller=function(e){return Object(s.c)(this,e)},t}(o.ServiceClient)},function(e,t,r){"use strict";t.a=function(e,t,r){var n,o,s=e.request.method,i=e.status;if(y(e))n="AzureAsyncOperation";else if(f(e))n="Location";else if("PUT"===s||"PATCH"===s)n="GetResource";else if(201!==i&&202!==i&&!p(l(e)))throw new Error("Can't determine long running operation polling strategy.");if(n){var a=u(e),c={pollStrategyType:n,options:r,initialResponse:e,mostRecentResponse:e,mostRecentRequest:e.request,azureAsyncOperationHeaderValue:y(e),locationHeaderValue:f(e),resource:a,state:l(e,a)};o=d(t,c)}else o=void 0;return o},t.b=d;var n=r(0),o=r(1),s=(r.n(o),function(){function e(e,t){this._azureServiceClient=e,this._pollState=t}return e.prototype.getOperationStatus=function(){return this._pollState.state},e.prototype.isFinished=function(){return p(this._pollState.state)},e.prototype.pollUntilFinished=function(){return n.b(this,void 0,void 0,function(){var e;return n.d(this,function(t){switch(t.label){case 0:return this.isFinished()?[3,3]:(e=function(e,t){var r=30;if(void 0!=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,Object(o.delay)(1e3*e)]);case 1:return t.sent(),[4,this.sendPollRequest()];case 2:return t.sent(),[3,0];case 3:return[2,this.isFinalStatusAcceptable()]}})})},e.prototype.shouldDoFinalGetResourceRequest=function(){var e=this._pollState.initialResponse.request.method;return!this._pollState.resource&&("PUT"===e||"PATCH"===e||"POST"===e)},e.prototype.getMostRecentResponse=function(){return this._pollState.mostRecentResponse},e.prototype.getOperationResponse=function(){return n.b(this,void 0,void 0,function(){var e,t,r;return n.d(this,function(o){switch(o.label){case 0:return this.shouldDoFinalGetResourceRequest()?[4,this.doFinalGetResourceRequest()]:[3,2];case 1:o.sent(),o.label=2;case 2:return e=this._pollState.mostRecentResponse,t=n.a({},e,{headers:e.headers.clone()}),(r=this._pollState.resource)?"string"==typeof r.valueOf()?(t.bodyAsText=r,t.parsedBody=JSON.parse(r)):(t.bodyAsText=JSON.stringify(r),t.parsedBody=r):(t.bodyAsText=e.bodyAsText,t.parsedBody=e.parsedBody),[2,t]}})})},e.prototype.getRestError=function(){var e=new o.RestError("");if(e.request=Object(o.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},e.prototype.updateState=function(e,t){var r=this;return this.updateOperationStatus(e,t).then(function(e){r._pollState.state=a(e.parsedBody)||"Succeeded",r._pollState.mostRecentResponse=e,r._pollState.mostRecentRequest=e.request;try{r._pollState.resource=u(e)}catch(n){r._pollState.resource=void 0;var t=e.status;if("DELETE"!==r._pollState.initialResponse.request.method||t<400||499<t)throw n}})},e.prototype.updateOperationStatus=function(e,t){var r=e.replace(" ","%20"),n=new o.WebResource(r,"GET"),s=this._pollState;n.operationSpec=s.mostRecentRequest.operationSpec,n.shouldDeserialize=t,n.operationResponseGetter=i;var a=s.options;if(a&&a.customHeaders)for(var u=a.customHeaders,l=0,c=Object.keys(u);l<c.length;l++){var p=c[l];n.headers.set(p,u[p])}return this._azureServiceClient.sendRequest(n)},e.prototype.getPollState=function(){return this._pollState},e}());function i(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 a(e){var t;return e&&(e.provisioningState?t=e.provisioningState:e.properties&&(t=e.properties.provisioningState)),t}function u(e){var t;try{e.parsedBody?t=e.parsedBody:e.bodyAsText&&e.bodyAsText.length>0&&(t=JSON.parse(e.bodyAsText))}catch(t){var r=new o.RestError('Error "'+t+'" occurred in parsing the responseBody " +\n "while creating the PollingState for Long Running Operation- "'+e.bodyAsText+'"');throw r.request=e.request,r.response=e,r}return t}function l(e,t){var r;switch(void 0==t&&(t=u(e)),e.status){case 202:r="InProgress";break;case 204:r="Succeeded";break;case 201:r=a(t)||"InProgress";break;case 200:var n=a(t);r=n||(y(e)||f(e)?"InProgress":"Succeeded");break;default:r="Failed"}return r}var c=["Succeeded","Failed","Canceled"];function p(e){return-1!==c.indexOf(e)}function d(e,t){var r;switch(t.pollStrategyType){case"AzureAsyncOperation":r=new R(e,t);break;case"Location":r=new h(e,t);break;case"GetResource":r=new v(e,t);break;default:throw new Error('Unrecognized LRO poll strategy type: "'+t.pollStrategyType+'"')}return r}function f(e){return e.headers.get("location")}var h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.c(t,e),t.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},t.prototype.sendPollRequest=function(){var e=this._pollState;return this.updateOperationStatus(e.locationHeaderValue,this.locationStrategyShouldDeserialize.bind(this)).then(function(t){var r=f(t);r&&(e.locationHeaderValue=r),e.mostRecentResponse=t,e.mostRecentRequest=t.request;var n=e.initialResponse,s=n.request.method,i=n.status,a=t.status;if(202===a)e.state="InProgress";else if(200===a||201===a&&("PUT"===s||"PATCH"===s)||204===a&&("DELETE"===s||"POST"===s))e.state="Succeeded",e.resource=u(t);else{if(404!==a||"POST"!==s||200!==i&&201!==i&&202!==i){if(400<=a&&a<=499){var l=t.bodyAsText;throw new o.RestError(l,void 0,a,Object(o.stripRequest)(t.request),t,l)}throw new Error("The response with status code "+a+' from polling for long running operation url "'+e.locationHeaderValue+'" is not valid.')}e.state="Failed",e.resource=u(t)}})},t.prototype.isFinalStatusAcceptable=function(){var e=this._pollState,t=e.initialResponse,r=t.status;return"Succeeded"===e.state||"POST"===t.request.method&&404===e.mostRecentResponse.status&&(200===r||201===r||202===r)},t.prototype.shouldDoFinalGetResourceRequest=function(){var t=this._pollState,r=t.initialResponse,n=r.request.method,o=r.status;return("POST"!==n||404!==t.mostRecentResponse.status||200!==o&&201!==o&&202!==o)&&(e.prototype.shouldDoFinalGetResourceRequest.call(this)||"POST"===n&&201===o)},t.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)},t}(s);function y(e){return e.headers.get("azure-asyncoperation")}var R=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.c(t,e),t.prototype.sendPollRequest=function(){var e=this._pollState;return this.updateOperationStatus(e.azureAsyncOperationHeaderValue,!1).then(function(t){var r=t.status,n=t.parsedBody;if(200!==r&&201!==r&&202!==r&&204!==r){var s=new o.RestError("Invalid status code ("+r+') with response body "'+t.bodyAsText+'" occurred when polling for operation status.');throw s.statusCode=r,s.request=Object(o.stripRequest)(t.request),s.response=t,s.body=n,s}if(!n)throw new Error("The response from long running operation does not contain a body.");if(!n.status)throw new Error('The response "'+t.bodyAsText+'" from long running operation does not contain the status property.');var i=y(t);i&&(e.azureAsyncOperationHeaderValue=i),e.state=n.status,e.mostRecentResponse=t,e.mostRecentRequest=t.request,e.resource=u(t)})},t.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||202===o:"DELETE"===r&&(n=200===o||202===o)}return n},t.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)},t.prototype.isFinalStatusAcceptable=function(){var e=this._pollState,t=e.initialResponse,r=t.status;return"Succeeded"===e.state||"POST"===t.request.method&&(200===r||201===r)},t}(s),v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.c(t,e),t.prototype.sendPollRequest=function(){var e=this._pollState;return this.updateOperationStatus(e.initialResponse.request.url,!1).then(function(t){var r=t.status,n=t.parsedBody;if(200!==r&&201!==r&&202!==r&&204!==r){var s=new o.RestError('Invalid status code with response body "'+t.bodyAsText+'" occurred when polling for operation status.');throw s.statusCode=r,s.request=Object(o.stripRequest)(t.request),s.response=t,s.body=n,s}if(!t.parsedBody)throw new Error("The response from long running operation does not contain a body.");e.state=a(t.parsedBody)||"Succeeded",e.mostRecentResponse=t,e.mostRecentRequest=t.request,e.resource=u(t)})},t.prototype.isFinalStatusAcceptable=function(){return"Succeeded"===this._pollState.state},t.prototype.doFinalGetResourceRequest=function(){return this.sendPollRequest()},t}(s)},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n={serializedName:"BaseResource",type:{name:"Composite",className:"BaseResource",modelProperties:{}}}},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n={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"}}}}}}}}},function(e,t,r){"use strict";r.d(t,"a",function(){return s});var n=r(0),o=r(1),s=(r.n(o),function(e){function t(t){if(!t||t&&"string"!=typeof t.valueOf())throw new Error("subscriptionKey cannot be null or undefined and must be of type string.");var r={inHeader:{"Ocp-Apim-Subscription-Key":t,"X-BingApis-SDK-Client":"node-SDK"}};return e.call(this,r)||this}return n.c(t,e),t}(o.ApiKeyCredentials))}]);

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

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

@@ -11,0 +11,0 @@ "tags": [

@@ -27,3 +27,21 @@ import { CompositeMapper } from "ms-rest-js";

innerError?: any;
/**
* @property {AdditionalInfoElement} [innerError] The additional error information
*/
additionalInfo?: AdditionalInfoElement;
}
/**
* @interface
* Additional data for an instance of CloudError.
*/
export interface AdditionalInfoElement {
/**
* @property {string} [type] Type of the data.
*/
type?: string;
/**
* @property {string} [info] Additional info.
*/
info?: string;
}
export declare const CloudErrorMapper: CompositeMapper;
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