@microsoft/microsoft-graph-client
Advanced tools
Comparing version 1.7.0 to 1.7.1-spfx
@@ -26,2 +26,2 @@ /** | ||
*/ | ||
export declare const PACKAGE_VERSION = "1.7.0"; | ||
export declare const PACKAGE_VERSION = "1.7.1-spfx"; |
@@ -26,3 +26,3 @@ /** | ||
*/ | ||
export const PACKAGE_VERSION = "1.7.0"; | ||
export const PACKAGE_VERSION = "1.7.1-spfx"; | ||
//# sourceMappingURL=Constants.js.map |
@@ -1,1 +0,1 @@ | ||
var e;!function(e){e.GET="GET",e.PATCH="PATCH",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE"}(e||(e={}));var t=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class n{constructor(e){if(this.requests=new Map,void 0!==e){const t=n.requestLimit;if(e.length>t){const e=new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${t}`);throw e.name="Limit Exceeded Error",e}for(const t of e)this.addRequest(t)}}static validateDependencies(e){if(0===e.size){const e=new Error("Empty requests map, Please provide at least one request.");throw e.name="Empty Requests Error",e}return(e=>{const t=e.entries();let n=t.next();for(;!n.done;){const e=n.value[1];if(void 0!==e.dependsOn&&e.dependsOn.length>0)return!1;n=t.next()}return!0})(e)||(e=>{const t=e.entries();let n=t.next();const r=n.value[1];if(void 0!==r.dependsOn&&r.dependsOn.length>0)return!1;let i=n;for(n=t.next();!n.done;){const e=n.value[1];if(void 0===e.dependsOn||1!==e.dependsOn.length||e.dependsOn[0]!==i.value[1].id)return!1;i=n,n=t.next()}return!0})(e)||(e=>{const t=e.entries();let n=t.next();const r=n.value[1];let i;if(void 0===r.dependsOn||0===r.dependsOn.length)i=r.id;else{if(1!==r.dependsOn.length)return!1;{const t=r.dependsOn[0];if(t===r.id||!e.has(t))return!1;i=t}}for(n=t.next();!n.done;){const e=n.value[1];if((void 0===e.dependsOn||0===e.dependsOn.length)&&i!==e.id)return!1;if(void 0!==e.dependsOn&&0!==e.dependsOn.length){if(1===e.dependsOn.length&&(e.id===i||e.dependsOn[0]!==i))return!1;if(e.dependsOn.length>1)return!1}n=t.next()}return!0})(e)}static getRequestData(r){return t(this,void 0,void 0,function*(){const t={url:""},i=new RegExp("^https?://");t.url=i.test(r.url)?"/"+r.url.split(/.*?\/\/.*?\//)[1]:r.url,t.method=r.method;const o={};return r.headers.forEach((e,t)=>{o[t]=e}),Object.keys(o).length&&(t.headers=o),r.method!==e.PATCH&&r.method!==e.POST&&r.method!==e.PUT||(t.body=yield n.getRequestBody(r)),t})}static getRequestBody(e){return t(this,void 0,void 0,function*(){let t,n=!1;try{const r=e.clone();t=yield r.json(),n=!0}catch(e){}if(!n)try{if("undefined"!=typeof Blob){const n=yield e.blob(),r=new FileReader;t=yield new Promise(e=>{r.addEventListener("load",()=>{const t=r.result,n=new RegExp("^s*data:(.+?/.+?(;.+?=.+?)*)?(;base64)?,(.*)s*$").exec(t);e(n[4])},!1),r.readAsDataURL(n)})}else if("undefined"!=typeof Buffer){t=(yield e.buffer()).toString("base64")}n=!0}catch(e){}return t})}addRequest(e){const t=n.requestLimit;if(""===e.id){const e=new Error("Id for a request is empty, Please provide an unique id");throw e.name="Empty Id For Request",e}if(this.requests.size===t){const e=new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${t}`);throw e.name="Limit Exceeded Error",e}if(this.requests.has(e.id)){const t=new Error(`Adding request with duplicate id ${e.id}, Make the id of the requests unique`);throw t.name="Duplicate RequestId Error",t}return this.requests.set(e.id,e),e.id}removeRequest(e){const t=this.requests.delete(e),n=this.requests.entries();let r=n.next();for(;!r.done;){const t=r.value[1].dependsOn;if(void 0!==t){const n=t.indexOf(e);-1!==n&&t.splice(n,1),0===t.length&&delete r.value[1].dependsOn}r=n.next()}return t}getContent(){return t(this,void 0,void 0,function*(){const e=[],t={requests:e},r=this.requests.entries();let i=r.next();if(i.done){const e=new Error("No requests added yet, Please add at least one request.");throw e.name="Empty Payload",e}if(!n.validateDependencies(this.requests)){const e=new Error("Invalid dependency found, Dependency should be:\n1. Parallel - no individual request states a dependency in the dependsOn property.\n2. Serial - all individual requests depend on the previous individual request.\n3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency.");throw e.name="Invalid Dependency",e}for(;!i.done;){const t=i.value[1],o=yield n.getRequestData(t.request);if(void 0!==o.body&&(void 0===o.headers||void 0===o.headers["content-type"])){const e=new Error(`Content-type header is not mentioned for request #${t.id}, For request having body, Content-type header should be mentioned`);throw e.name="Invalid Content-type header",e}o.id=t.id,void 0!==t.dependsOn&&t.dependsOn.length>0&&(o.dependsOn=t.dependsOn),e.push(o),i=r.next()}return t.requests=e,t})}addDependency(e,t){if(!this.requests.has(e)){const t=new Error(`Dependent ${e} does not exists, Please check the id`);throw t.name="Invalid Dependent",t}if(void 0!==t&&!this.requests.has(t)){const e=new Error(`Dependency ${t} does not exists, Please check the id`);throw e.name="Invalid Dependency",e}if(void 0!==t){const n=this.requests.get(e);if(void 0===n.dependsOn&&(n.dependsOn=[]),-1!==n.dependsOn.indexOf(t)){const n=new Error(`Dependency ${t} is already added for the request ${e}`);throw n.name="Duplicate Dependency",n}n.dependsOn.push(t)}else{const n=this.requests.entries();let r,i=n.next();for(;!i.done&&i.value[1].id!==e;)r=i,i=n.next();if(void 0===r){const e=new Error(`Can't add dependency ${t}, There is only a dependent request in the batch`);throw e.name="Invalid Dependency Addition",e}{const t=r.value[0];if(void 0===i.value[1].dependsOn&&(i.value[1].dependsOn=[]),-1!==i.value[1].dependsOn.indexOf(t)){const n=new Error(`Dependency ${t} is already added for the request ${e}`);throw n.name="Duplicate Dependency",n}i.value[1].dependsOn.push(t)}}}removeDependency(e,t){const n=this.requests.get(e);if(void 0===n||void 0===n.dependsOn||0===n.dependsOn.length)return!1;if(void 0!==t){const e=n.dependsOn.indexOf(t);return-1!==e&&(n.dependsOn.splice(e,1),!0)}return delete n.dependsOn,!0}}n.requestLimit=20;class r{constructor(e){this.responses=new Map,this.update(e)}createResponseObject(e){const t=e.body,n={};return n.status=e.status,void 0!==e.statusText&&(n.statusText=e.statusText),n.headers=e.headers,new Response(t,n)}update(e){this.nextLink=e["@nextLink"];const t=e.responses;for(let e=0,n=t.length;e<n;e++)this.responses.set(t[e].id,this.createResponseObject(t[e]))}getResponseById(e){return this.responses.get(e)}getResponses(){return this.responses}*getResponsesIterator(){const e=this.responses.entries();let t=e.next();for(;!t.done;)yield t.value,t=e.next()}}class i{constructor(e=[]){this.middlewareOptions=new Map;for(const t of e){const e=t.constructor.name;this.middlewareOptions.set(e,t)}}getMiddlewareOptions(e){return this.middlewareOptions.get(e)}setMiddlewareOptions(e,t){this.middlewareOptions.set(e,t)}}var o=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};const s=()=>{let e="";for(let t=0;t<32;t++)8!==t&&12!==t&&16!==t&&20!==t||(e+="-"),e+=Math.floor(16*Math.random()).toString(16);return e},a=(e,t,n)=>{let r=null;if(e instanceof Request)r=e.headers.get(n);else if(void 0!==t&&void 0!==t.headers)if(t.headers instanceof Headers)r=t.headers.get(n);else if(t.headers instanceof Array){const e=t.headers;for(let t=0,i=e.length;t<i;t++)if(e[t][0]===n){r=e[t][1];break}}else void 0!==t.headers[n]&&(r=t.headers[n]);return r},c=(e,t,n,r)=>{e instanceof Request?e.headers.set(n,r):void 0!==t&&(void 0===t.headers?t.headers={[n]:r}:t.headers instanceof Headers?t.headers.set(n,r):t.headers instanceof Array?t.headers.push([n,r]):Object.assign(t.headers,{[n]:r}))},d=(e,t)=>o(void 0,void 0,void 0,function*(){const n=t.headers.get("Content-Type")?yield t.blob():yield Promise.resolve(void 0),{method:r,headers:i,referrer:o,referrerPolicy:s,mode:a,credentials:c,cache:d,redirect:u,integrity:h,keepalive:l,signal:p}=t;return new Request(e,{method:r,headers:i,body:n,referrer:o,referrerPolicy:s,mode:a,credentials:c,cache:d,redirect:u,integrity:h,keepalive:l,signal:p})});class u{constructor(e,t){this.authenticationProvider=e,this.authenticationProviderOptions=t}}var h;!function(e){e[e.NONE=0]="NONE",e[e.REDIRECT_HANDLER_ENABLED=1]="REDIRECT_HANDLER_ENABLED",e[e.RETRY_HANDLER_ENABLED=2]="RETRY_HANDLER_ENABLED",e[e.AUTHENTICATION_HANDLER_ENABLED=4]="AUTHENTICATION_HANDLER_ENABLED"}(h||(h={}));class l{constructor(){this.featureUsage=h.NONE}static updateFeatureUsageFlag(e,t){let n;e.middlewareControl instanceof i?n=e.middlewareControl.getMiddlewareOptions(l.name):e.middlewareControl=new i,void 0===n&&(n=new l,e.middlewareControl.setMiddlewareOptions(l.name,n)),n.setFeatureUsage(t)}setFeatureUsage(e){this.featureUsage=this.featureUsage|e}getFeatureUsage(){return this.featureUsage.toString(16)}}var p=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class f{constructor(e){this.authenticationProvider=e}execute(e){return p(this,void 0,void 0,function*(){try{let t,n,r;e.middlewareControl instanceof i&&(t=e.middlewareControl.getMiddlewareOptions(u.name)),void 0!==t&&(n=t.authenticationProvider,r=t.authenticationProviderOptions),void 0===n&&(n=this.authenticationProvider);const o=`Bearer ${yield n.getAccessToken(r)}`;return c(e.request,e.options,f.AUTHORIZATION_HEADER,o),l.updateFeatureUsageFlag(e,h.AUTHENTICATION_HANDLER_ENABLED),yield this.nextMiddleware.execute(e)}catch(e){throw e}})}setNext(e){this.nextMiddleware=e}}f.AUTHORIZATION_HEADER="Authorization";var y=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class m{execute(e){return y(this,void 0,void 0,function*(){try{return void(e.response=yield fetch(e.request,e.options))}catch(e){throw e}})}}class v{constructor(e=v.DEFAULT_DELAY,t=v.DEFAULT_MAX_RETRIES,n=v.DEFAULT_SHOULD_RETRY){if(e>v.MAX_DELAY&&t>v.MAX_MAX_RETRIES){const e=new Error(`Delay and MaxRetries should not be more than ${v.MAX_DELAY} and ${v.MAX_MAX_RETRIES}`);throw e.name="MaxLimitExceeded",e}if(e>v.MAX_DELAY){const e=new Error(`Delay should not be more than ${v.MAX_DELAY}`);throw e.name="MaxLimitExceeded",e}if(t>v.MAX_MAX_RETRIES){const e=new Error(`MaxRetries should not be more than ${v.MAX_MAX_RETRIES}`);throw e.name="MaxLimitExceeded",e}this.delay=Math.min(e,v.MAX_DELAY),this.maxRetries=Math.min(t,v.MAX_MAX_RETRIES),this.shouldRetry=n}getMaxDelay(){return v.MAX_DELAY}}v.DEFAULT_DELAY=3,v.DEFAULT_MAX_RETRIES=3,v.MAX_DELAY=180,v.MAX_MAX_RETRIES=10,v.DEFAULT_SHOULD_RETRY=(()=>!0);var E=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class w{constructor(e=new v){this.options=e}isRetry(e){return-1!==w.RETRY_STATUS_CODES.indexOf(e.status)}isBuffered(t,n){const r=t instanceof Request?t.method:n.method;if(r===e.PUT||r===e.PATCH||r===e.POST){if("application/octet-stream"===a(t,n,"Content-Type"))return!1}return!0}getDelay(e,t,n){const r=()=>Number(Math.random().toFixed(3)),i=void 0!==e.headers?e.headers.get(w.RETRY_AFTER_HEADER):null;let o;return o=null!==i?Number.isNaN(Number(i))?Math.round((new Date(i).getTime()-Date.now())/1e3):Number(i):t>=2?this.getExponentialBackOffTime(t)+n+r():n+r(),Math.min(o,this.options.getMaxDelay()+r())}getExponentialBackOffTime(e){return Math.round(.5*(Math.pow(2,e)-1))}sleep(e){return E(this,void 0,void 0,function*(){const t=1e3*e;return new Promise(e=>setTimeout(e,t))})}getOptions(e){let t;return e.middlewareControl instanceof i&&(t=e.middlewareControl.getMiddlewareOptions(this.options.constructor.name)),void 0===t&&(t=Object.assign(new v,this.options)),t}executeWithRetry(e,t,n){return E(this,void 0,void 0,function*(){try{if(yield this.nextMiddleware.execute(e),t<n.maxRetries&&this.isRetry(e.response)&&this.isBuffered(e.request,e.options)&&n.shouldRetry(n.delay,t,e.request,e.options,e.response)){++t,c(e.request,e.options,w.RETRY_ATTEMPT_HEADER,t.toString());const r=this.getDelay(e.response,t,n.delay);return yield this.sleep(r),yield this.executeWithRetry(e,t,n)}return}catch(e){throw e}})}execute(e){return E(this,void 0,void 0,function*(){try{const t=0,n=this.getOptions(e);return l.updateFeatureUsageFlag(e,h.RETRY_HANDLER_ENABLED),yield this.executeWithRetry(e,t,n)}catch(e){throw e}})}setNext(e){this.nextMiddleware=e}}w.RETRY_STATUS_CODES=[429,503,504],w.RETRY_ATTEMPT_HEADER="Retry-Attempt",w.RETRY_AFTER_HEADER="Retry-After";const g="v1.0",R="https://graph.microsoft.com/",A="1.7.0";var T=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class x{execute(e){return T(this,void 0,void 0,function*(){try{let t=a(e.request,e.options,x.CLIENT_REQUEST_ID_HEADER);null===t&&(t=s(),c(e.request,e.options,x.CLIENT_REQUEST_ID_HEADER,t));let n,r=`${x.PRODUCT_NAME}/${A}`;if(e.middlewareControl instanceof i&&(n=e.middlewareControl.getMiddlewareOptions(l.name)),void 0!==n){const e=n.getFeatureUsage();r+=` (${x.FEATURE_USAGE_STRING}=${e})`}return c(e.request,e.options,x.SDK_VERSION_HEADER,r),yield this.nextMiddleware.execute(e)}catch(e){throw e}})}setNext(e){this.nextMiddleware=e}}x.CLIENT_REQUEST_ID_HEADER="client-request-id",x.SDK_VERSION_HEADER="SdkVersion",x.PRODUCT_NAME="graph-js",x.FEATURE_USAGE_STRING="featureUsage";class O{constructor(e=-1,t=-1){this.minValue=e,this.maxValue=t}}var D=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class _{constructor(e,t,n,r={}){this.DEFAULT_FILE_SIZE=5242880,this.client=e,this.file=t,void 0===r.rangeSize&&(r.rangeSize=this.DEFAULT_FILE_SIZE),this.options=r,this.uploadSession=n,this.nextRange=new O(0,this.options.rangeSize-1)}static createUploadSession(e,t,n,r={}){return D(this,void 0,void 0,function*(){try{const i=yield e.api(t).headers(r).post(n);return{url:i.uploadUrl,expiry:new Date(i.expirationDateTime)}}catch(e){throw e}})}parseRange(e){const t=e[0];if(void 0===t||""===t)return new O;const n=t.split("-"),r=parseInt(n[0],10);let i=parseInt(n[1],10);return Number.isNaN(i)&&(i=this.file.size-1),new O(r,i)}updateTaskStatus(e){this.uploadSession.expiry=new Date(e.expirationDateTime),this.nextRange=this.parseRange(e.nextExpectedRanges)}getNextRange(){if(-1===this.nextRange.minValue)return this.nextRange;const e=this.nextRange.minValue;let t=e+this.options.rangeSize-1;return t>=this.file.size&&(t=this.file.size-1),new O(e,t)}sliceFile(e){return this.file.content.slice(e.minValue,e.maxValue+1)}upload(){return D(this,void 0,void 0,function*(){try{for(;;){const e=this.getNextRange();if(-1===e.maxValue){const e=new Error("Task with which you are trying to upload is already completed, Please check for your uploaded file");throw e.name="Invalid Session",e}const t=this.sliceFile(e),n=yield this.uploadSlice(t,e,this.file.size);if(void 0!==n.id)return n;this.updateTaskStatus(n)}}catch(e){throw e}})}uploadSlice(e,t,n){return D(this,void 0,void 0,function*(){try{return yield this.client.api(this.uploadSession.url).headers({"Content-Length":`${t.maxValue-t.minValue+1}`,"Content-Range":`bytes ${t.minValue}-${t.maxValue}/${n}`}).put(e)}catch(e){throw e}})}cancel(){return D(this,void 0,void 0,function*(){try{return yield this.client.api(this.uploadSession.url).delete()}catch(e){throw e}})}getStatus(){return D(this,void 0,void 0,function*(){try{const e=yield this.client.api(this.uploadSession.url).get();return this.updateTaskStatus(e),e}catch(e){throw e}})}resume(){return D(this,void 0,void 0,function*(){try{return yield this.getStatus(),yield this.upload()}catch(e){throw e}})}}const P=(e=5242880)=>{return e>62914560&&(e=62914560),(e=>(e>327680&&(e=320*Math.floor(e/327680)*1024),e))(e)};var L=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class b extends _{constructor(e,t,n,r){super(e,t,n,r)}static constructCreateSessionUrl(e,t=b.DEFAULT_UPLOAD_PATH){return e=e.trim(),""===(t=t.trim())&&(t="/"),"/"!==t[0]&&(t=`/${t}`),"/"!==t[t.length-1]&&(t=`${t}/`),encodeURI(`/me/drive/root:${t}${e}:/createUploadSession`)}static create(e,t,n){return L(this,void 0,void 0,function*(){const r=n.fileName;let i,o;switch(t.constructor.name){case"Blob":o=(i=new File([t],r)).size;break;case"File":o=(i=t).size;break;case"Buffer":const e=t;o=e.byteLength-e.byteOffset,i=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}try{const t=b.constructCreateSessionUrl(n.fileName,n.path),s=yield b.createUploadSession(e,t,n.fileName),a=P(n.rangeSize);return new b(e,{name:r,content:i,size:o},s,{rangeSize:a})}catch(e){throw e}})}static createUploadSession(e,t,n){const r=Object.create(null,{createUploadSession:{get:()=>super.createUploadSession}});return L(this,void 0,void 0,function*(){const i={item:{"@microsoft.graph.conflictBehavior":"rename",name:n}};try{return r.createUploadSession.call(this,e,t,i)}catch(e){throw e}})}commit(e){return L(this,void 0,void 0,function*(){try{const t={name:this.file.name,"@microsoft.graph.conflictBehavior":"rename","@microsoft.graph.sourceUrl":this.uploadSession.url};return yield this.client.api(e).put(t)}catch(e){throw e}})}}b.DEFAULT_UPLOAD_PATH="/";var S=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class U{constructor(e,t,n){this.client=e,this.collection=t.value,this.nextLink=t["@odata.nextLink"],this.deltaLink=t["@odata.deltaLink"],this.callback=n,this.complete=!1}iterationHelper(){if(void 0===this.collection)return!1;let e=!0;for(;e&&0!==this.collection.length;){const t=this.collection.shift();e=this.callback(t)}return e}fetchAndUpdateNextPageData(){return S(this,void 0,void 0,function*(){try{const e=yield this.client.api(this.nextLink).get();this.collection=e.value,this.nextLink=e["@odata.nextLink"],this.deltaLink=e["@odata.deltaLink"]}catch(e){throw e}})}getDeltaLink(){return this.deltaLink}iterate(){return S(this,void 0,void 0,function*(){try{let e=this.iterationHelper();for(;e;)void 0!==this.nextLink?(yield this.fetchAndUpdateNextPageData(),e=this.iterationHelper()):e=!1;void 0===this.nextLink&&0===this.collection.length&&(this.complete=!0)}catch(e){throw e}})}resume(){return S(this,void 0,void 0,function*(){try{return this.iterate()}catch(e){throw e}})}isComplete(){return this.complete}}var C=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class M{constructor(e){this.provider=e}getAccessToken(){return C(this,void 0,void 0,function*(){return new Promise((e,t)=>{this.provider((n,r)=>{r?e(r):t(n)})})})}}class N{constructor(e=-1){this.statusCode=e,this.code=null,this.message=null,this.requestId=null,this.date=new Date,this.body=null}}var q=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class I{static constructError(e,t){const n=new N(t);return void 0!==e.name&&(n.code=e.name),n.body=e.toString(),n.message=e.message,n.date=new Date,n}static constructErrorFromResponse(e,t){e=e.error;const n=new N(t);n.code=e.code,n.message=e.message,void 0!==e.innerError&&(n.requestId=e.innerError["request-id"],n.date=new Date(e.innerError.date));try{n.body=JSON.stringify(e)}catch(e){}return n}static getError(e=null,t=-1,n){return q(this,void 0,void 0,function*(){let r;if(r=e&&e.error?I.constructErrorFromResponse(e,t):e&&"Error"===e.constructor.name?I.constructError(e,t):new N(t),"function"!=typeof n)return r;n(r,null)})}}const F=["$select","$expand","$orderby","$filter","$top","$skip","$skipToken","$count"],k=e=>{const t=e=>e.replace(/\/+$/,""),n=e=>e.replace(/^\/+/,"");return Array.prototype.slice.call(e).reduce((e,r)=>[t(e),n(r)].join("/"))},H=e=>{const t=e.constructor.name;if("Buffer"===t||"Blob"===t||"File"===t||"FormData"===t||"string"==typeof e)return e;if("ArrayBuffer"===t)e=Buffer.from(e);else if("Int8Array"===t||"Int16Array"===t||"Int32Array"===t||"Uint8Array"===t||"Uint16Array"===t||"Uint32Array"===t||"Uint8ClampedArray"===t||"Float32Array"===t||"Float64Array"===t||"DataView"===t)e=Buffer.from(e.buffer);else try{e=JSON.stringify(e)}catch(e){throw new Error("Unable to stringify the content")}return e};var $;!function(e){e.ARRAYBUFFER="arraybuffer",e.BLOB="blob",e.DOCUMENT="document",e.JSON="json",e.RAW="raw",e.STREAM="stream",e.TEXT="text"}($||($={}));var X,B,Q,j=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};!function(e){e.TEXT_HTML="text/html",e.TEXT_XML="text/xml",e.APPLICATION_XML="application/xml",e.APPLICATION_XHTML="application/xhtml+xml"}(X||(X={})),function(e){e.TEXT_PLAIN="text/plain",e.APPLICATION_JSON="application/json"}(B||(B={})),function(e){e.DOCUMENT="^(text\\/(html|xml))|(application\\/(xml|xhtml\\+xml))$",e.IMAGE="^image\\/.+"}(Q||(Q={}));class Y{static parseDocumentResponse(e,t){try{return"undefined"!=typeof DOMParser?new Promise((n,r)=>{e.text().then(e=>{try{const i=(new DOMParser).parseFromString(e,t);n(i)}catch(e){r(e)}})}):Promise.resolve(e.body)}catch(e){throw e}}static convertResponse(e,t){return j(this,void 0,void 0,function*(){const n=e.clone();if(204===n.status)return Promise.resolve();let r;try{switch(t){case $.ARRAYBUFFER:r=yield n.arrayBuffer();break;case $.BLOB:r=yield n.blob();break;case $.DOCUMENT:r=yield Y.parseDocumentResponse(n,X.TEXT_XML);break;case $.JSON:r=yield n.json();break;case $.STREAM:r=yield Promise.resolve(n.body);break;case $.TEXT:r=yield n.text();break;default:const e=n.headers.get("Content-type");if(null!==e){const t=e.split(";")[0];r=new RegExp(Q.DOCUMENT).test(t)?yield Y.parseDocumentResponse(n,t):new RegExp(Q.IMAGE).test(t)?n.blob():t===B.TEXT_PLAIN?yield n.text():t===B.APPLICATION_JSON?yield n.json():Promise.resolve(n.body)}else r=Promise.resolve(n.body)}}catch(e){throw e}return r})}static getResponse(e,t,n){return j(this,void 0,void 0,function*(){try{if(t===$.RAW)return Promise.resolve(e);{const r=yield Y.convertResponse(e,t);if(!e.ok)throw r;if("function"!=typeof n)return r;n(null,r,e)}}catch(e){throw e}})}}var z=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class V{constructor(e,t,n){this.parsePath=(e=>{if(-1!==e.indexOf("https://")){const t=(e=e.replace("https://","")).indexOf("/");-1!==t&&(this.urlComponents.host="https://"+e.substring(0,t),e=e.substring(t+1,e.length));const n=e.indexOf("/");-1!==n&&(this.urlComponents.version=e.substring(0,n),e=e.substring(n+1,e.length))}"/"===e.charAt(0)&&(e=e.substr(1));const t=e.indexOf("?");if(-1===t)this.urlComponents.path=e;else{this.urlComponents.path=e.substr(0,t);const n=e.substring(t+1,e.length).split("&");for(const e of n){const t=e.split("="),n=t[0],r=t[1];-1!==F.indexOf(n)?this.urlComponents.oDataQueryParams[n]=r:this.urlComponents.otherURLQueryParams[n]=r}}}),this.httpClient=e,this.config=t,this.urlComponents={host:this.config.baseUrl,version:this.config.defaultVersion,oDataQueryParams:{},otherURLQueryParams:{}},this._headers={},this._options={},this._middlewareOptions=[],this.parsePath(n)}addCsvQueryParameter(e,t,n){this.urlComponents.oDataQueryParams[e]=this.urlComponents.oDataQueryParams[e]?this.urlComponents.oDataQueryParams[e]+",":"";let r=[];n.length>1&&"string"==typeof t?r=Array.prototype.slice.call(n):"string"==typeof t?r.push(t):r=r.concat(t),this.urlComponents.oDataQueryParams[e]+=r.join(",")}buildFullUrl(){const e=k([this.urlComponents.host,this.urlComponents.version,this.urlComponents.path])+this.createQueryString();return this.config.debugLogging&&console.log(e),e}createQueryString(){const e=this.urlComponents,t=[];if(0!==Object.keys(e.oDataQueryParams).length)for(const n in e.oDataQueryParams)e.oDataQueryParams.hasOwnProperty(n)&&t.push(n+"="+e.oDataQueryParams[n]);if(0!==Object.keys(e.otherURLQueryParams).length)for(const n in e.otherURLQueryParams)e.otherURLQueryParams.hasOwnProperty(n)&&t.push(n+"="+e.otherURLQueryParams[n]);return t.length>0?"?"+t.join("&"):""}updateRequestOptions(e){const t=Object.assign({},e.headers);if(void 0!==this.config.fetchOptions){const t=Object.assign({},this.config.fetchOptions);Object.assign(e,t),void 0!==typeof this.config.fetchOptions.headers&&(e.headers=Object.assign({},this.config.fetchOptions.headers))}Object.assign(e,this._options),void 0!==e.headers&&Object.assign(t,e.headers),Object.assign(t,this._headers),e.headers=t}send(e,t,n){return z(this,void 0,void 0,function*(){let r;const o=new i(this._middlewareOptions);this.updateRequestOptions(t);try{return r=(yield this.httpClient.sendRequest({request:e,options:t,middlewareControl:o})).response,yield Y.getResponse(r,this._responseType,n)}catch(e){let t;throw void 0!==r&&(t=r.status),yield I.getError(e,t,n)}})}header(e,t){return this._headers[e]=t,this}headers(e){for(const t in e)e.hasOwnProperty(t)&&(this._headers[t]=e[t]);return this}option(e,t){return this._options[e]=t,this}options(e){for(const t in e)e.hasOwnProperty(t)&&(this._options[t]=e[t]);return this}middlewareOptions(e){return this._middlewareOptions=e,this}version(e){return this.urlComponents.version=e,this}responseType(e){return this._responseType=e,this}select(e){return this.addCsvQueryParameter("$select",e,arguments),this}expand(e){return this.addCsvQueryParameter("$expand",e,arguments),this}orderby(e){return this.addCsvQueryParameter("$orderby",e,arguments),this}filter(e){return this.urlComponents.oDataQueryParams.$filter=e,this}search(e){return this.urlComponents.oDataQueryParams.$search=e,this}top(e){return this.urlComponents.oDataQueryParams.$top=e,this}skip(e){return this.urlComponents.oDataQueryParams.$skip=e,this}skipToken(e){return this.urlComponents.oDataQueryParams.$skipToken=e,this}count(e){return this.urlComponents.oDataQueryParams.$count=e.toString(),this}query(e){const t=this.urlComponents.otherURLQueryParams;if("string"==typeof e){const n=e.split("="),r=n[0],i=n[1];t[r]=i}else for(const n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return this}get(t){return z(this,void 0,void 0,function*(){const n=this.buildFullUrl(),r={method:e.GET};try{return yield this.send(n,r,t)}catch(e){throw e}})}post(t,n){return z(this,void 0,void 0,function*(){const r=this.buildFullUrl(),i={method:e.POST,body:H(t),headers:void 0!==t.constructor&&"FormData"===t.constructor.name?{}:{"Content-Type":"application/json"}};try{return yield this.send(r,i,n)}catch(e){throw e}})}create(e,t){return z(this,void 0,void 0,function*(){try{return yield this.post(e,t)}catch(e){throw e}})}put(t,n){return z(this,void 0,void 0,function*(){const r=this.buildFullUrl(),i={method:e.PUT,body:H(t),headers:{"Content-Type":"application/octet-stream"}};try{return yield this.send(r,i,n)}catch(e){throw e}})}patch(t,n){return z(this,void 0,void 0,function*(){const r=this.buildFullUrl(),i={method:e.PATCH,body:H(t),headers:{"Content-Type":"application/json"}};try{return yield this.send(r,i,n)}catch(e){throw e}})}update(e,t){return z(this,void 0,void 0,function*(){try{return yield this.patch(e,t)}catch(e){throw e}})}delete(t){return z(this,void 0,void 0,function*(){const n=this.buildFullUrl(),r={method:e.DELETE};try{return yield this.send(n,r,t)}catch(e){throw e}})}del(e){return z(this,void 0,void 0,function*(){try{return yield this.delete(e)}catch(e){throw e}})}getStream(t){return z(this,void 0,void 0,function*(){const n=this.buildFullUrl(),r={method:e.GET};this.responseType($.STREAM);try{return yield this.send(n,r,t)}catch(e){throw e}})}putStream(t,n){return z(this,void 0,void 0,function*(){const r=this.buildFullUrl(),i={method:e.PUT,headers:{"Content-Type":"application/octet-stream"},body:t};try{return yield this.send(r,i,n)}catch(e){throw e}})}}var W=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class G{constructor(e){this.middleware=e}sendRequest(e){return W(this,void 0,void 0,function*(){try{if(!(e.request instanceof Request)&&void 0===e.options){const e=new Error;throw e.name="InvalidRequestOptions",e.message="Unable to execute the middleware, Please provide valid options for a request",e}return yield this.middleware.execute(e),e}catch(e){throw e}})}}class Z{constructor(e=Z.DEFAULT_MAX_REDIRECTS,t=Z.DEFAULT_SHOULD_RETRY){if(e>Z.MAX_MAX_REDIRECTS){const e=new Error(`MaxRedirects should not be more than ${Z.MAX_MAX_REDIRECTS}`);throw e.name="MaxLimitExceeded",e}this.maxRedirects=e,this.shouldRedirect=t}}Z.DEFAULT_MAX_REDIRECTS=5,Z.MAX_MAX_REDIRECTS=20,Z.DEFAULT_SHOULD_RETRY=(()=>!0);var J=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class K{constructor(e=new Z){this.options=e}isRedirect(e){return-1!==K.REDIRECT_STATUS_CODES.indexOf(e.status)}hasLocationHeader(e){return e.headers.has(K.LOCATION_HEADER)}getLocationHeader(e){return e.headers.get(K.LOCATION_HEADER)}isRelativeURL(e){return-1===e.indexOf("://")}shouldDropAuthorizationHeader(e,t){const n=/^[A-Za-z].+?:\/\/.+?(?=\/|$)/,r=n.exec(e);let i,o;null!==r&&(i=r[0]);const s=n.exec(t);return null!==s&&(o=s[0]),void 0!==i&&void 0!==o&&i!==o}updateRequestUrl(e,t){return J(this,void 0,void 0,function*(){t.request=t.request instanceof Request?yield d(e,t.request):e})}getOptions(e){let t;return e.middlewareControl instanceof i&&(t=e.middlewareControl.getMiddlewareOptions(this.options.constructor.name)),void 0===t&&(t=Object.assign(new Z,this.options)),t}executeWithRedirect(t,n,r){return J(this,void 0,void 0,function*(){try{yield this.nextMiddleware.execute(t);const i=t.response;if(!(n<r.maxRedirects&&this.isRedirect(i)&&this.hasLocationHeader(i)&&r.shouldRedirect(i)))return;if(++n,i.status===K.STATUS_CODE_SEE_OTHER)t.options.method=e.GET,delete t.options.body;else{const e=this.getLocationHeader(i);!this.isRelativeURL(e)&&this.shouldDropAuthorizationHeader(i.url,e)&&c(t.request,t.options,K.AUTHORIZATION_HEADER,void 0),yield this.updateRequestUrl(e,t)}yield this.executeWithRedirect(t,n,r)}catch(e){throw e}})}execute(e){return J(this,void 0,void 0,function*(){try{const t=0,n=this.getOptions(e);return e.options.redirect=K.MANUAL_REDIRECT,l.updateFeatureUsageFlag(e,h.REDIRECT_HANDLER_ENABLED),yield this.executeWithRedirect(e,t,n)}catch(e){throw e}})}setNext(e){this.nextMiddleware=e}}K.REDIRECT_STATUS_CODES=[301,302,303,307,308],K.STATUS_CODE_SEE_OTHER=303,K.LOCATION_HEADER="Location",K.AUTHORIZATION_HEADER="Authorization",K.MANUAL_REDIRECT="manual";const ee=()=>new Function("try {return this === global;}catch(e){return false;}")();class te{static createWithAuthenticationProvider(e){const t=new f(e),n=new w(new v),r=new x,i=new m;if(t.setNext(n),ee()){const e=new K(new Z);n.setNext(e),e.setNext(r)}else n.setNext(r);return r.setNext(i),te.createWithMiddleware(t)}static createWithMiddleware(e){return new G(e)}}const ne=()=>{if("undefined"==typeof Promise&&"undefined"==typeof fetch){const e=new Error("Library cannot function without Promise and fetch. So, please provide polyfill for them.");throw e.name="PolyFillNotAvailable",e}if("undefined"==typeof Promise){const e=new Error("Library cannot function without Promise. So, please provide polyfill for it.");throw e.name="PolyFillNotAvailable",e}if("undefined"==typeof fetch){const e=new Error("Library cannot function without fetch. So, please provide polyfill for it.");throw e.name="PolyFillNotAvailable",e}return!0};class re{constructor(e){this.config={baseUrl:R,debugLogging:!1,defaultVersion:g};try{ne()}catch(e){throw e}for(const t in e)e.hasOwnProperty(t)&&(this.config[t]=e[t]);let t;if(void 0!==e.authProvider&&void 0!==e.middleware){const e=new Error;throw e.name="AmbiguityInInitialization",e.message="Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain not both",e}if(void 0!==e.authProvider)t=te.createWithAuthenticationProvider(e.authProvider);else{if(void 0===e.middleware){const e=new Error;throw e.name="InvalidMiddlewareChain",e.message="Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain",e}t=new G(e.middleware)}this.httpClient=t}static init(e){const t={};for(const n in e)e.hasOwnProperty(n)&&(t[n]="authProvider"===n?new M(e[n]):e[n]);return re.initWithMiddleware(t)}static initWithMiddleware(e){try{return new re(e)}catch(e){throw e}}api(e){return new V(this.httpClient,this.config,e)}}var ie=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class oe{constructor(e,t,n){this.scopes=t,this.userAgentApplication="string"==typeof e?new Msal.UserAgentApplication(e,void 0,(e,t,n,r)=>{},n):e}getAccessToken(e){return ie(this,void 0,void 0,function*(){let t;if(void 0!==e&&(t=e.scopes),void 0!==t&&0!==t.length||(t=this.scopes),0===t.length){const e=new Error;throw e.name="EmptyScopes",e.message="Scopes cannot be empty, Please provide a scope",e}try{return yield this.userAgentApplication.acquireTokenSilent(t)}catch(e){try{yield this.userAgentApplication.loginPopup(t);try{return yield this.userAgentApplication.acquireTokenSilent(t)}catch(e){return yield this.userAgentApplication.acquireTokenPopup(t)}}catch(e){throw new Error(e)}}})}addScopes(e){if(0===e.length){const e=new Error;throw e.name="EmptyScopes",e.message="Scopes array cannot be empty",e}this.scopes=Array.from(new Set(this.scopes.concat(e)))}clearScopes(){this.scopes=[]}}class se{constructor(e){this.scopes=e}}export{f as AuthenticationHandler,u as AuthenticationHandlerOptions,n as BatchRequestContent,r as BatchResponseContent,re as Client,h as FeatureUsageFlag,N as GraphError,V as GraphRequest,m as HTTPMessageHandler,_ as LargeFileUploadTask,oe as MSALAuthenticationProvider,se as MSALAuthenticationProviderOptions,b as OneDriveLargeFileUploadTask,U as PageIterator,$ as ResponseType,w as RetryHandler,v as RetryHandlerOptions,x as TelemetryHandler,l as TelemetryHandlerOptions}; | ||
var e;!function(e){e.GET="GET",e.PATCH="PATCH",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE"}(e||(e={}));var t=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class n{constructor(e){if(this.requests=new Map,void 0!==e){const t=n.requestLimit;if(e.length>t){const e=new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${t}`);throw e.name="Limit Exceeded Error",e}for(const t of e)this.addRequest(t)}}static validateDependencies(e){if(0===e.size){const e=new Error("Empty requests map, Please provide at least one request.");throw e.name="Empty Requests Error",e}return(e=>{const t=e.entries();let n=t.next();for(;!n.done;){const e=n.value[1];if(void 0!==e.dependsOn&&e.dependsOn.length>0)return!1;n=t.next()}return!0})(e)||(e=>{const t=e.entries();let n=t.next();const r=n.value[1];if(void 0!==r.dependsOn&&r.dependsOn.length>0)return!1;let i=n;for(n=t.next();!n.done;){const e=n.value[1];if(void 0===e.dependsOn||1!==e.dependsOn.length||e.dependsOn[0]!==i.value[1].id)return!1;i=n,n=t.next()}return!0})(e)||(e=>{const t=e.entries();let n=t.next();const r=n.value[1];let i;if(void 0===r.dependsOn||0===r.dependsOn.length)i=r.id;else{if(1!==r.dependsOn.length)return!1;{const t=r.dependsOn[0];if(t===r.id||!e.has(t))return!1;i=t}}for(n=t.next();!n.done;){const e=n.value[1];if((void 0===e.dependsOn||0===e.dependsOn.length)&&i!==e.id)return!1;if(void 0!==e.dependsOn&&0!==e.dependsOn.length){if(1===e.dependsOn.length&&(e.id===i||e.dependsOn[0]!==i))return!1;if(e.dependsOn.length>1)return!1}n=t.next()}return!0})(e)}static getRequestData(r){return t(this,void 0,void 0,function*(){const t={url:""},i=new RegExp("^https?://");t.url=i.test(r.url)?"/"+r.url.split(/.*?\/\/.*?\//)[1]:r.url,t.method=r.method;const o={};return r.headers.forEach((e,t)=>{o[t]=e}),Object.keys(o).length&&(t.headers=o),r.method!==e.PATCH&&r.method!==e.POST&&r.method!==e.PUT||(t.body=yield n.getRequestBody(r)),t})}static getRequestBody(e){return t(this,void 0,void 0,function*(){let t,n=!1;try{const r=e.clone();t=yield r.json(),n=!0}catch(e){}if(!n)try{if("undefined"!=typeof Blob){const n=yield e.blob(),r=new FileReader;t=yield new Promise(e=>{r.addEventListener("load",()=>{const t=r.result,n=new RegExp("^s*data:(.+?/.+?(;.+?=.+?)*)?(;base64)?,(.*)s*$").exec(t);e(n[4])},!1),r.readAsDataURL(n)})}else if("undefined"!=typeof Buffer){t=(yield e.buffer()).toString("base64")}n=!0}catch(e){}return t})}addRequest(e){const t=n.requestLimit;if(""===e.id){const e=new Error("Id for a request is empty, Please provide an unique id");throw e.name="Empty Id For Request",e}if(this.requests.size===t){const e=new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${t}`);throw e.name="Limit Exceeded Error",e}if(this.requests.has(e.id)){const t=new Error(`Adding request with duplicate id ${e.id}, Make the id of the requests unique`);throw t.name="Duplicate RequestId Error",t}return this.requests.set(e.id,e),e.id}removeRequest(e){const t=this.requests.delete(e),n=this.requests.entries();let r=n.next();for(;!r.done;){const t=r.value[1].dependsOn;if(void 0!==t){const n=t.indexOf(e);-1!==n&&t.splice(n,1),0===t.length&&delete r.value[1].dependsOn}r=n.next()}return t}getContent(){return t(this,void 0,void 0,function*(){const e=[],t={requests:e},r=this.requests.entries();let i=r.next();if(i.done){const e=new Error("No requests added yet, Please add at least one request.");throw e.name="Empty Payload",e}if(!n.validateDependencies(this.requests)){const e=new Error("Invalid dependency found, Dependency should be:\n1. Parallel - no individual request states a dependency in the dependsOn property.\n2. Serial - all individual requests depend on the previous individual request.\n3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency.");throw e.name="Invalid Dependency",e}for(;!i.done;){const t=i.value[1],o=yield n.getRequestData(t.request);if(void 0!==o.body&&(void 0===o.headers||void 0===o.headers["content-type"])){const e=new Error(`Content-type header is not mentioned for request #${t.id}, For request having body, Content-type header should be mentioned`);throw e.name="Invalid Content-type header",e}o.id=t.id,void 0!==t.dependsOn&&t.dependsOn.length>0&&(o.dependsOn=t.dependsOn),e.push(o),i=r.next()}return t.requests=e,t})}addDependency(e,t){if(!this.requests.has(e)){const t=new Error(`Dependent ${e} does not exists, Please check the id`);throw t.name="Invalid Dependent",t}if(void 0!==t&&!this.requests.has(t)){const e=new Error(`Dependency ${t} does not exists, Please check the id`);throw e.name="Invalid Dependency",e}if(void 0!==t){const n=this.requests.get(e);if(void 0===n.dependsOn&&(n.dependsOn=[]),-1!==n.dependsOn.indexOf(t)){const n=new Error(`Dependency ${t} is already added for the request ${e}`);throw n.name="Duplicate Dependency",n}n.dependsOn.push(t)}else{const n=this.requests.entries();let r,i=n.next();for(;!i.done&&i.value[1].id!==e;)r=i,i=n.next();if(void 0===r){const e=new Error(`Can't add dependency ${t}, There is only a dependent request in the batch`);throw e.name="Invalid Dependency Addition",e}{const t=r.value[0];if(void 0===i.value[1].dependsOn&&(i.value[1].dependsOn=[]),-1!==i.value[1].dependsOn.indexOf(t)){const n=new Error(`Dependency ${t} is already added for the request ${e}`);throw n.name="Duplicate Dependency",n}i.value[1].dependsOn.push(t)}}}removeDependency(e,t){const n=this.requests.get(e);if(void 0===n||void 0===n.dependsOn||0===n.dependsOn.length)return!1;if(void 0!==t){const e=n.dependsOn.indexOf(t);return-1!==e&&(n.dependsOn.splice(e,1),!0)}return delete n.dependsOn,!0}}n.requestLimit=20;class r{constructor(e){this.responses=new Map,this.update(e)}createResponseObject(e){const t=e.body,n={};return n.status=e.status,void 0!==e.statusText&&(n.statusText=e.statusText),n.headers=e.headers,new Response(t,n)}update(e){this.nextLink=e["@nextLink"];const t=e.responses;for(let e=0,n=t.length;e<n;e++)this.responses.set(t[e].id,this.createResponseObject(t[e]))}getResponseById(e){return this.responses.get(e)}getResponses(){return this.responses}*getResponsesIterator(){const e=this.responses.entries();let t=e.next();for(;!t.done;)yield t.value,t=e.next()}}class i{constructor(e=[]){this.middlewareOptions=new Map;for(const t of e){const e=t.constructor.name;this.middlewareOptions.set(e,t)}}getMiddlewareOptions(e){return this.middlewareOptions.get(e)}setMiddlewareOptions(e,t){this.middlewareOptions.set(e,t)}}var o=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};const s=()=>{let e="";for(let t=0;t<32;t++)8!==t&&12!==t&&16!==t&&20!==t||(e+="-"),e+=Math.floor(16*Math.random()).toString(16);return e},a=(e,t,n)=>{let r=null;if(e instanceof Request)r=e.headers.get(n);else if(void 0!==t&&void 0!==t.headers)if(t.headers instanceof Headers)r=t.headers.get(n);else if(t.headers instanceof Array){const e=t.headers;for(let t=0,i=e.length;t<i;t++)if(e[t][0]===n){r=e[t][1];break}}else void 0!==t.headers[n]&&(r=t.headers[n]);return r},c=(e,t,n,r)=>{e instanceof Request?e.headers.set(n,r):void 0!==t&&(void 0===t.headers?t.headers={[n]:r}:t.headers instanceof Headers?t.headers.set(n,r):t.headers instanceof Array?t.headers.push([n,r]):Object.assign(t.headers,{[n]:r}))},d=(e,t)=>o(void 0,void 0,void 0,function*(){const n=t.headers.get("Content-Type")?yield t.blob():yield Promise.resolve(void 0),{method:r,headers:i,referrer:o,referrerPolicy:s,mode:a,credentials:c,cache:d,redirect:u,integrity:h,keepalive:l,signal:p}=t;return new Request(e,{method:r,headers:i,body:n,referrer:o,referrerPolicy:s,mode:a,credentials:c,cache:d,redirect:u,integrity:h,keepalive:l,signal:p})});class u{constructor(e,t){this.authenticationProvider=e,this.authenticationProviderOptions=t}}var h;!function(e){e[e.NONE=0]="NONE",e[e.REDIRECT_HANDLER_ENABLED=1]="REDIRECT_HANDLER_ENABLED",e[e.RETRY_HANDLER_ENABLED=2]="RETRY_HANDLER_ENABLED",e[e.AUTHENTICATION_HANDLER_ENABLED=4]="AUTHENTICATION_HANDLER_ENABLED"}(h||(h={}));class l{constructor(){this.featureUsage=h.NONE}static updateFeatureUsageFlag(e,t){let n;e.middlewareControl instanceof i?n=e.middlewareControl.getMiddlewareOptions(l.name):e.middlewareControl=new i,void 0===n&&(n=new l,e.middlewareControl.setMiddlewareOptions(l.name,n)),n.setFeatureUsage(t)}setFeatureUsage(e){this.featureUsage=this.featureUsage|e}getFeatureUsage(){return this.featureUsage.toString(16)}}var p=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class f{constructor(e){this.authenticationProvider=e}execute(e){return p(this,void 0,void 0,function*(){try{let t,n,r;e.middlewareControl instanceof i&&(t=e.middlewareControl.getMiddlewareOptions(u.name)),void 0!==t&&(n=t.authenticationProvider,r=t.authenticationProviderOptions),void 0===n&&(n=this.authenticationProvider);const o=`Bearer ${yield n.getAccessToken(r)}`;return c(e.request,e.options,f.AUTHORIZATION_HEADER,o),l.updateFeatureUsageFlag(e,h.AUTHENTICATION_HANDLER_ENABLED),yield this.nextMiddleware.execute(e)}catch(e){throw e}})}setNext(e){this.nextMiddleware=e}}f.AUTHORIZATION_HEADER="Authorization";var y=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class m{execute(e){return y(this,void 0,void 0,function*(){try{return void(e.response=yield fetch(e.request,e.options))}catch(e){throw e}})}}class v{constructor(e=v.DEFAULT_DELAY,t=v.DEFAULT_MAX_RETRIES,n=v.DEFAULT_SHOULD_RETRY){if(e>v.MAX_DELAY&&t>v.MAX_MAX_RETRIES){const e=new Error(`Delay and MaxRetries should not be more than ${v.MAX_DELAY} and ${v.MAX_MAX_RETRIES}`);throw e.name="MaxLimitExceeded",e}if(e>v.MAX_DELAY){const e=new Error(`Delay should not be more than ${v.MAX_DELAY}`);throw e.name="MaxLimitExceeded",e}if(t>v.MAX_MAX_RETRIES){const e=new Error(`MaxRetries should not be more than ${v.MAX_MAX_RETRIES}`);throw e.name="MaxLimitExceeded",e}this.delay=Math.min(e,v.MAX_DELAY),this.maxRetries=Math.min(t,v.MAX_MAX_RETRIES),this.shouldRetry=n}getMaxDelay(){return v.MAX_DELAY}}v.DEFAULT_DELAY=3,v.DEFAULT_MAX_RETRIES=3,v.MAX_DELAY=180,v.MAX_MAX_RETRIES=10,v.DEFAULT_SHOULD_RETRY=(()=>!0);var E=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class w{constructor(e=new v){this.options=e}isRetry(e){return-1!==w.RETRY_STATUS_CODES.indexOf(e.status)}isBuffered(t,n){const r=t instanceof Request?t.method:n.method;if(r===e.PUT||r===e.PATCH||r===e.POST){if("application/octet-stream"===a(t,n,"Content-Type"))return!1}return!0}getDelay(e,t,n){const r=()=>Number(Math.random().toFixed(3)),i=void 0!==e.headers?e.headers.get(w.RETRY_AFTER_HEADER):null;let o;return o=null!==i?Number.isNaN(Number(i))?Math.round((new Date(i).getTime()-Date.now())/1e3):Number(i):t>=2?this.getExponentialBackOffTime(t)+n+r():n+r(),Math.min(o,this.options.getMaxDelay()+r())}getExponentialBackOffTime(e){return Math.round(.5*(Math.pow(2,e)-1))}sleep(e){return E(this,void 0,void 0,function*(){const t=1e3*e;return new Promise(e=>setTimeout(e,t))})}getOptions(e){let t;return e.middlewareControl instanceof i&&(t=e.middlewareControl.getMiddlewareOptions(this.options.constructor.name)),void 0===t&&(t=Object.assign(new v,this.options)),t}executeWithRetry(e,t,n){return E(this,void 0,void 0,function*(){try{if(yield this.nextMiddleware.execute(e),t<n.maxRetries&&this.isRetry(e.response)&&this.isBuffered(e.request,e.options)&&n.shouldRetry(n.delay,t,e.request,e.options,e.response)){++t,c(e.request,e.options,w.RETRY_ATTEMPT_HEADER,t.toString());const r=this.getDelay(e.response,t,n.delay);return yield this.sleep(r),yield this.executeWithRetry(e,t,n)}return}catch(e){throw e}})}execute(e){return E(this,void 0,void 0,function*(){try{const t=0,n=this.getOptions(e);return l.updateFeatureUsageFlag(e,h.RETRY_HANDLER_ENABLED),yield this.executeWithRetry(e,t,n)}catch(e){throw e}})}setNext(e){this.nextMiddleware=e}}w.RETRY_STATUS_CODES=[429,503,504],w.RETRY_ATTEMPT_HEADER="Retry-Attempt",w.RETRY_AFTER_HEADER="Retry-After";const g="v1.0",R="https://graph.microsoft.com/",A="1.7.1-spfx";var T=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class x{execute(e){return T(this,void 0,void 0,function*(){try{let t=a(e.request,e.options,x.CLIENT_REQUEST_ID_HEADER);null===t&&(t=s(),c(e.request,e.options,x.CLIENT_REQUEST_ID_HEADER,t));let n,r=`${x.PRODUCT_NAME}/${A}`;if(e.middlewareControl instanceof i&&(n=e.middlewareControl.getMiddlewareOptions(l.name)),void 0!==n){const e=n.getFeatureUsage();r+=` (${x.FEATURE_USAGE_STRING}=${e})`}return c(e.request,e.options,x.SDK_VERSION_HEADER,r),yield this.nextMiddleware.execute(e)}catch(e){throw e}})}setNext(e){this.nextMiddleware=e}}x.CLIENT_REQUEST_ID_HEADER="client-request-id",x.SDK_VERSION_HEADER="SdkVersion",x.PRODUCT_NAME="graph-js",x.FEATURE_USAGE_STRING="featureUsage";class O{constructor(e=-1,t=-1){this.minValue=e,this.maxValue=t}}var D=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class _{constructor(e,t,n,r={}){this.DEFAULT_FILE_SIZE=5242880,this.client=e,this.file=t,void 0===r.rangeSize&&(r.rangeSize=this.DEFAULT_FILE_SIZE),this.options=r,this.uploadSession=n,this.nextRange=new O(0,this.options.rangeSize-1)}static createUploadSession(e,t,n,r={}){return D(this,void 0,void 0,function*(){try{const i=yield e.api(t).headers(r).post(n);return{url:i.uploadUrl,expiry:new Date(i.expirationDateTime)}}catch(e){throw e}})}parseRange(e){const t=e[0];if(void 0===t||""===t)return new O;const n=t.split("-"),r=parseInt(n[0],10);let i=parseInt(n[1],10);return Number.isNaN(i)&&(i=this.file.size-1),new O(r,i)}updateTaskStatus(e){this.uploadSession.expiry=new Date(e.expirationDateTime),this.nextRange=this.parseRange(e.nextExpectedRanges)}getNextRange(){if(-1===this.nextRange.minValue)return this.nextRange;const e=this.nextRange.minValue;let t=e+this.options.rangeSize-1;return t>=this.file.size&&(t=this.file.size-1),new O(e,t)}sliceFile(e){return this.file.content.slice(e.minValue,e.maxValue+1)}upload(){return D(this,void 0,void 0,function*(){try{for(;;){const e=this.getNextRange();if(-1===e.maxValue){const e=new Error("Task with which you are trying to upload is already completed, Please check for your uploaded file");throw e.name="Invalid Session",e}const t=this.sliceFile(e),n=yield this.uploadSlice(t,e,this.file.size);if(void 0!==n.id)return n;this.updateTaskStatus(n)}}catch(e){throw e}})}uploadSlice(e,t,n){return D(this,void 0,void 0,function*(){try{return yield this.client.api(this.uploadSession.url).headers({"Content-Length":`${t.maxValue-t.minValue+1}`,"Content-Range":`bytes ${t.minValue}-${t.maxValue}/${n}`}).put(e)}catch(e){throw e}})}cancel(){return D(this,void 0,void 0,function*(){try{return yield this.client.api(this.uploadSession.url).delete()}catch(e){throw e}})}getStatus(){return D(this,void 0,void 0,function*(){try{const e=yield this.client.api(this.uploadSession.url).get();return this.updateTaskStatus(e),e}catch(e){throw e}})}resume(){return D(this,void 0,void 0,function*(){try{return yield this.getStatus(),yield this.upload()}catch(e){throw e}})}}const P=(e=5242880)=>{return e>62914560&&(e=62914560),(e=>(e>327680&&(e=320*Math.floor(e/327680)*1024),e))(e)};var L=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class b extends _{constructor(e,t,n,r){super(e,t,n,r)}static constructCreateSessionUrl(e,t=b.DEFAULT_UPLOAD_PATH){return e=e.trim(),""===(t=t.trim())&&(t="/"),"/"!==t[0]&&(t=`/${t}`),"/"!==t[t.length-1]&&(t=`${t}/`),encodeURI(`/me/drive/root:${t}${e}:/createUploadSession`)}static create(e,t,n){return L(this,void 0,void 0,function*(){const r=n.fileName;let i,o;switch(t.constructor.name){case"Blob":o=(i=new File([t],r)).size;break;case"File":o=(i=t).size;break;case"Buffer":const e=t;o=e.byteLength-e.byteOffset,i=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}try{const t=b.constructCreateSessionUrl(n.fileName,n.path),s=yield b.createUploadSession(e,t,n.fileName),a=P(n.rangeSize);return new b(e,{name:r,content:i,size:o},s,{rangeSize:a})}catch(e){throw e}})}static createUploadSession(e,t,n){const r=Object.create(null,{createUploadSession:{get:()=>super.createUploadSession}});return L(this,void 0,void 0,function*(){const i={item:{"@microsoft.graph.conflictBehavior":"rename",name:n}};try{return r.createUploadSession.call(this,e,t,i)}catch(e){throw e}})}commit(e){return L(this,void 0,void 0,function*(){try{const t={name:this.file.name,"@microsoft.graph.conflictBehavior":"rename","@microsoft.graph.sourceUrl":this.uploadSession.url};return yield this.client.api(e).put(t)}catch(e){throw e}})}}b.DEFAULT_UPLOAD_PATH="/";var S=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class U{constructor(e,t,n){this.client=e,this.collection=t.value,this.nextLink=t["@odata.nextLink"],this.deltaLink=t["@odata.deltaLink"],this.callback=n,this.complete=!1}iterationHelper(){if(void 0===this.collection)return!1;let e=!0;for(;e&&0!==this.collection.length;){const t=this.collection.shift();e=this.callback(t)}return e}fetchAndUpdateNextPageData(){return S(this,void 0,void 0,function*(){try{const e=yield this.client.api(this.nextLink).get();this.collection=e.value,this.nextLink=e["@odata.nextLink"],this.deltaLink=e["@odata.deltaLink"]}catch(e){throw e}})}getDeltaLink(){return this.deltaLink}iterate(){return S(this,void 0,void 0,function*(){try{let e=this.iterationHelper();for(;e;)void 0!==this.nextLink?(yield this.fetchAndUpdateNextPageData(),e=this.iterationHelper()):e=!1;void 0===this.nextLink&&0===this.collection.length&&(this.complete=!0)}catch(e){throw e}})}resume(){return S(this,void 0,void 0,function*(){try{return this.iterate()}catch(e){throw e}})}isComplete(){return this.complete}}var C=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class M{constructor(e){this.provider=e}getAccessToken(){return C(this,void 0,void 0,function*(){return new Promise((e,t)=>{this.provider((n,r)=>{r?e(r):t(n)})})})}}class N{constructor(e=-1){this.statusCode=e,this.code=null,this.message=null,this.requestId=null,this.date=new Date,this.body=null}}var q=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class I{static constructError(e,t){const n=new N(t);return void 0!==e.name&&(n.code=e.name),n.body=e.toString(),n.message=e.message,n.date=new Date,n}static constructErrorFromResponse(e,t){e=e.error;const n=new N(t);n.code=e.code,n.message=e.message,void 0!==e.innerError&&(n.requestId=e.innerError["request-id"],n.date=new Date(e.innerError.date));try{n.body=JSON.stringify(e)}catch(e){}return n}static getError(e=null,t=-1,n){return q(this,void 0,void 0,function*(){let r;if(r=e&&e.error?I.constructErrorFromResponse(e,t):e&&"Error"===e.constructor.name?I.constructError(e,t):new N(t),"function"!=typeof n)return r;n(r,null)})}}const F=["$select","$expand","$orderby","$filter","$top","$skip","$skipToken","$count"],k=e=>{const t=e=>e.replace(/\/+$/,""),n=e=>e.replace(/^\/+/,"");return Array.prototype.slice.call(e).reduce((e,r)=>[t(e),n(r)].join("/"))},H=e=>{const t=e.constructor.name;if("Buffer"===t||"Blob"===t||"File"===t||"FormData"===t||"string"==typeof e)return e;if("ArrayBuffer"===t)e=Buffer.from(e);else if("Int8Array"===t||"Int16Array"===t||"Int32Array"===t||"Uint8Array"===t||"Uint16Array"===t||"Uint32Array"===t||"Uint8ClampedArray"===t||"Float32Array"===t||"Float64Array"===t||"DataView"===t)e=Buffer.from(e.buffer);else try{e=JSON.stringify(e)}catch(e){throw new Error("Unable to stringify the content")}return e};var $;!function(e){e.ARRAYBUFFER="arraybuffer",e.BLOB="blob",e.DOCUMENT="document",e.JSON="json",e.RAW="raw",e.STREAM="stream",e.TEXT="text"}($||($={}));var X,B,Q,j=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};!function(e){e.TEXT_HTML="text/html",e.TEXT_XML="text/xml",e.APPLICATION_XML="application/xml",e.APPLICATION_XHTML="application/xhtml+xml"}(X||(X={})),function(e){e.TEXT_PLAIN="text/plain",e.APPLICATION_JSON="application/json"}(B||(B={})),function(e){e.DOCUMENT="^(text\\/(html|xml))|(application\\/(xml|xhtml\\+xml))$",e.IMAGE="^image\\/.+"}(Q||(Q={}));class Y{static parseDocumentResponse(e,t){try{return"undefined"!=typeof DOMParser?new Promise((n,r)=>{e.text().then(e=>{try{const i=(new DOMParser).parseFromString(e,t);n(i)}catch(e){r(e)}})}):Promise.resolve(e.body)}catch(e){throw e}}static convertResponse(e,t){return j(this,void 0,void 0,function*(){const n=e.clone();if(204===n.status)return Promise.resolve();let r;try{switch(t){case $.ARRAYBUFFER:r=yield n.arrayBuffer();break;case $.BLOB:r=yield n.blob();break;case $.DOCUMENT:r=yield Y.parseDocumentResponse(n,X.TEXT_XML);break;case $.JSON:r=yield n.json();break;case $.STREAM:r=yield Promise.resolve(n.body);break;case $.TEXT:r=yield n.text();break;default:const e=n.headers.get("Content-type");if(null!==e){const t=e.split(";")[0];r=new RegExp(Q.DOCUMENT).test(t)?yield Y.parseDocumentResponse(n,t):new RegExp(Q.IMAGE).test(t)?n.blob():t===B.TEXT_PLAIN?yield n.text():t===B.APPLICATION_JSON?yield n.json():Promise.resolve(n.body)}else r=Promise.resolve(n.body)}}catch(e){throw e}return r})}static getResponse(e,t,n){return j(this,void 0,void 0,function*(){try{if(t===$.RAW)return Promise.resolve(e);{const r=yield Y.convertResponse(e,t);if(!e.ok)throw r;if("function"!=typeof n)return r;n(null,r,e)}}catch(e){throw e}})}}var z=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class V{constructor(e,t,n){this.parsePath=(e=>{if(-1!==e.indexOf("https://")){const t=(e=e.replace("https://","")).indexOf("/");-1!==t&&(this.urlComponents.host="https://"+e.substring(0,t),e=e.substring(t+1,e.length));const n=e.indexOf("/");-1!==n&&(this.urlComponents.version=e.substring(0,n),e=e.substring(n+1,e.length))}"/"===e.charAt(0)&&(e=e.substr(1));const t=e.indexOf("?");if(-1===t)this.urlComponents.path=e;else{this.urlComponents.path=e.substr(0,t);const n=e.substring(t+1,e.length).split("&");for(const e of n){const t=e.split("="),n=t[0],r=t[1];-1!==F.indexOf(n)?this.urlComponents.oDataQueryParams[n]=r:this.urlComponents.otherURLQueryParams[n]=r}}}),this.httpClient=e,this.config=t,this.urlComponents={host:this.config.baseUrl,version:this.config.defaultVersion,oDataQueryParams:{},otherURLQueryParams:{}},this._headers={},this._options={},this._middlewareOptions=[],this.parsePath(n)}addCsvQueryParameter(e,t,n){this.urlComponents.oDataQueryParams[e]=this.urlComponents.oDataQueryParams[e]?this.urlComponents.oDataQueryParams[e]+",":"";let r=[];n.length>1&&"string"==typeof t?r=Array.prototype.slice.call(n):"string"==typeof t?r.push(t):r=r.concat(t),this.urlComponents.oDataQueryParams[e]+=r.join(",")}buildFullUrl(){const e=k([this.urlComponents.host,this.urlComponents.version,this.urlComponents.path])+this.createQueryString();return this.config.debugLogging&&console.log(e),e}createQueryString(){const e=this.urlComponents,t=[];if(0!==Object.keys(e.oDataQueryParams).length)for(const n in e.oDataQueryParams)e.oDataQueryParams.hasOwnProperty(n)&&t.push(n+"="+e.oDataQueryParams[n]);if(0!==Object.keys(e.otherURLQueryParams).length)for(const n in e.otherURLQueryParams)e.otherURLQueryParams.hasOwnProperty(n)&&t.push(n+"="+e.otherURLQueryParams[n]);return t.length>0?"?"+t.join("&"):""}updateRequestOptions(e){const t=Object.assign({},e.headers);if(void 0!==this.config.fetchOptions){const t=Object.assign({},this.config.fetchOptions);Object.assign(e,t),void 0!==typeof this.config.fetchOptions.headers&&(e.headers=Object.assign({},this.config.fetchOptions.headers))}Object.assign(e,this._options),void 0!==e.headers&&Object.assign(t,e.headers),Object.assign(t,this._headers),e.headers=t}send(e,t,n){return z(this,void 0,void 0,function*(){let r;const o=new i(this._middlewareOptions);this.updateRequestOptions(t);try{return r=(yield this.httpClient.sendRequest({request:e,options:t,middlewareControl:o})).response,yield Y.getResponse(r,this._responseType,n)}catch(e){let t;throw void 0!==r&&(t=r.status),yield I.getError(e,t,n)}})}header(e,t){return this._headers[e]=t,this}headers(e){for(const t in e)e.hasOwnProperty(t)&&(this._headers[t]=e[t]);return this}option(e,t){return this._options[e]=t,this}options(e){for(const t in e)e.hasOwnProperty(t)&&(this._options[t]=e[t]);return this}middlewareOptions(e){return this._middlewareOptions=e,this}version(e){return this.urlComponents.version=e,this}responseType(e){return this._responseType=e,this}select(e){return this.addCsvQueryParameter("$select",e,arguments),this}expand(e){return this.addCsvQueryParameter("$expand",e,arguments),this}orderby(e){return this.addCsvQueryParameter("$orderby",e,arguments),this}filter(e){return this.urlComponents.oDataQueryParams.$filter=e,this}search(e){return this.urlComponents.oDataQueryParams.$search=e,this}top(e){return this.urlComponents.oDataQueryParams.$top=e,this}skip(e){return this.urlComponents.oDataQueryParams.$skip=e,this}skipToken(e){return this.urlComponents.oDataQueryParams.$skipToken=e,this}count(e){return this.urlComponents.oDataQueryParams.$count=e.toString(),this}query(e){const t=this.urlComponents.otherURLQueryParams;if("string"==typeof e){const n=e.split("="),r=n[0],i=n[1];t[r]=i}else for(const n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return this}get(t){return z(this,void 0,void 0,function*(){const n=this.buildFullUrl(),r={method:e.GET};try{return yield this.send(n,r,t)}catch(e){throw e}})}post(t,n){return z(this,void 0,void 0,function*(){const r=this.buildFullUrl(),i={method:e.POST,body:H(t),headers:void 0!==t.constructor&&"FormData"===t.constructor.name?{}:{"Content-Type":"application/json"}};try{return yield this.send(r,i,n)}catch(e){throw e}})}create(e,t){return z(this,void 0,void 0,function*(){try{return yield this.post(e,t)}catch(e){throw e}})}put(t,n){return z(this,void 0,void 0,function*(){const r=this.buildFullUrl(),i={method:e.PUT,body:H(t),headers:{"Content-Type":"application/octet-stream"}};try{return yield this.send(r,i,n)}catch(e){throw e}})}patch(t,n){return z(this,void 0,void 0,function*(){const r=this.buildFullUrl(),i={method:e.PATCH,body:H(t),headers:{"Content-Type":"application/json"}};try{return yield this.send(r,i,n)}catch(e){throw e}})}update(e,t){return z(this,void 0,void 0,function*(){try{return yield this.patch(e,t)}catch(e){throw e}})}delete(t){return z(this,void 0,void 0,function*(){const n=this.buildFullUrl(),r={method:e.DELETE};try{return yield this.send(n,r,t)}catch(e){throw e}})}del(e){return z(this,void 0,void 0,function*(){try{return yield this.delete(e)}catch(e){throw e}})}getStream(t){return z(this,void 0,void 0,function*(){const n=this.buildFullUrl(),r={method:e.GET};this.responseType($.STREAM);try{return yield this.send(n,r,t)}catch(e){throw e}})}putStream(t,n){return z(this,void 0,void 0,function*(){const r=this.buildFullUrl(),i={method:e.PUT,headers:{"Content-Type":"application/octet-stream"},body:t};try{return yield this.send(r,i,n)}catch(e){throw e}})}}var W=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class G{constructor(e){this.middleware=e}sendRequest(e){return W(this,void 0,void 0,function*(){try{if(!(e.request instanceof Request)&&void 0===e.options){const e=new Error;throw e.name="InvalidRequestOptions",e.message="Unable to execute the middleware, Please provide valid options for a request",e}return yield this.middleware.execute(e),e}catch(e){throw e}})}}class Z{constructor(e=Z.DEFAULT_MAX_REDIRECTS,t=Z.DEFAULT_SHOULD_RETRY){if(e>Z.MAX_MAX_REDIRECTS){const e=new Error(`MaxRedirects should not be more than ${Z.MAX_MAX_REDIRECTS}`);throw e.name="MaxLimitExceeded",e}this.maxRedirects=e,this.shouldRedirect=t}}Z.DEFAULT_MAX_REDIRECTS=5,Z.MAX_MAX_REDIRECTS=20,Z.DEFAULT_SHOULD_RETRY=(()=>!0);var J=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class K{constructor(e=new Z){this.options=e}isRedirect(e){return-1!==K.REDIRECT_STATUS_CODES.indexOf(e.status)}hasLocationHeader(e){return e.headers.has(K.LOCATION_HEADER)}getLocationHeader(e){return e.headers.get(K.LOCATION_HEADER)}isRelativeURL(e){return-1===e.indexOf("://")}shouldDropAuthorizationHeader(e,t){const n=/^[A-Za-z].+?:\/\/.+?(?=\/|$)/,r=n.exec(e);let i,o;null!==r&&(i=r[0]);const s=n.exec(t);return null!==s&&(o=s[0]),void 0!==i&&void 0!==o&&i!==o}updateRequestUrl(e,t){return J(this,void 0,void 0,function*(){t.request=t.request instanceof Request?yield d(e,t.request):e})}getOptions(e){let t;return e.middlewareControl instanceof i&&(t=e.middlewareControl.getMiddlewareOptions(this.options.constructor.name)),void 0===t&&(t=Object.assign(new Z,this.options)),t}executeWithRedirect(t,n,r){return J(this,void 0,void 0,function*(){try{yield this.nextMiddleware.execute(t);const i=t.response;if(!(n<r.maxRedirects&&this.isRedirect(i)&&this.hasLocationHeader(i)&&r.shouldRedirect(i)))return;if(++n,i.status===K.STATUS_CODE_SEE_OTHER)t.options.method=e.GET,delete t.options.body;else{const e=this.getLocationHeader(i);!this.isRelativeURL(e)&&this.shouldDropAuthorizationHeader(i.url,e)&&c(t.request,t.options,K.AUTHORIZATION_HEADER,void 0),yield this.updateRequestUrl(e,t)}yield this.executeWithRedirect(t,n,r)}catch(e){throw e}})}execute(e){return J(this,void 0,void 0,function*(){try{const t=0,n=this.getOptions(e);return e.options.redirect=K.MANUAL_REDIRECT,l.updateFeatureUsageFlag(e,h.REDIRECT_HANDLER_ENABLED),yield this.executeWithRedirect(e,t,n)}catch(e){throw e}})}setNext(e){this.nextMiddleware=e}}K.REDIRECT_STATUS_CODES=[301,302,303,307,308],K.STATUS_CODE_SEE_OTHER=303,K.LOCATION_HEADER="Location",K.AUTHORIZATION_HEADER="Authorization",K.MANUAL_REDIRECT="manual";const ee=()=>new Function("try {return this === global;}catch(e){return false;}")();class te{static createWithAuthenticationProvider(e){const t=new f(e),n=new w(new v),r=new x,i=new m;if(t.setNext(n),ee()){const e=new K(new Z);n.setNext(e),e.setNext(r)}else n.setNext(r);return r.setNext(i),te.createWithMiddleware(t)}static createWithMiddleware(e){return new G(e)}}const ne=()=>{if("undefined"==typeof Promise&&"undefined"==typeof fetch){const e=new Error("Library cannot function without Promise and fetch. So, please provide polyfill for them.");throw e.name="PolyFillNotAvailable",e}if("undefined"==typeof Promise){const e=new Error("Library cannot function without Promise. So, please provide polyfill for it.");throw e.name="PolyFillNotAvailable",e}if("undefined"==typeof fetch){const e=new Error("Library cannot function without fetch. So, please provide polyfill for it.");throw e.name="PolyFillNotAvailable",e}return!0};class re{constructor(e){this.config={baseUrl:R,debugLogging:!1,defaultVersion:g};try{ne()}catch(e){throw e}for(const t in e)e.hasOwnProperty(t)&&(this.config[t]=e[t]);let t;if(void 0!==e.authProvider&&void 0!==e.middleware){const e=new Error;throw e.name="AmbiguityInInitialization",e.message="Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain not both",e}if(void 0!==e.authProvider)t=te.createWithAuthenticationProvider(e.authProvider);else{if(void 0===e.middleware){const e=new Error;throw e.name="InvalidMiddlewareChain",e.message="Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain",e}t=new G(e.middleware)}this.httpClient=t}static init(e){const t={};for(const n in e)e.hasOwnProperty(n)&&(t[n]="authProvider"===n?new M(e[n]):e[n]);return re.initWithMiddleware(t)}static initWithMiddleware(e){try{return new re(e)}catch(e){throw e}}api(e){return new V(this.httpClient,this.config,e)}}var ie=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})};class oe{constructor(e,t,n){this.scopes=t,this.userAgentApplication="string"==typeof e?new Msal.UserAgentApplication(e,void 0,(e,t,n,r)=>{},n):e}getAccessToken(e){return ie(this,void 0,void 0,function*(){let t;if(void 0!==e&&(t=e.scopes),void 0!==t&&0!==t.length||(t=this.scopes),0===t.length){const e=new Error;throw e.name="EmptyScopes",e.message="Scopes cannot be empty, Please provide a scope",e}try{return yield this.userAgentApplication.acquireTokenSilent(t)}catch(e){try{yield this.userAgentApplication.loginPopup(t);try{return yield this.userAgentApplication.acquireTokenSilent(t)}catch(e){return yield this.userAgentApplication.acquireTokenPopup(t)}}catch(e){throw new Error(e)}}})}addScopes(e){if(0===e.length){const e=new Error;throw e.name="EmptyScopes",e.message="Scopes array cannot be empty",e}this.scopes=Array.from(new Set(this.scopes.concat(e)))}clearScopes(){this.scopes=[]}}class se{constructor(e){this.scopes=e}}export{f as AuthenticationHandler,u as AuthenticationHandlerOptions,n as BatchRequestContent,r as BatchResponseContent,re as Client,h as FeatureUsageFlag,N as GraphError,V as GraphRequest,m as HTTPMessageHandler,_ as LargeFileUploadTask,oe as MSALAuthenticationProvider,se as MSALAuthenticationProviderOptions,b as OneDriveLargeFileUploadTask,U as PageIterator,$ as ResponseType,w as RetryHandler,v as RetryHandlerOptions,x as TelemetryHandler,l as TelemetryHandlerOptions}; |
@@ -26,2 +26,2 @@ /** | ||
*/ | ||
export declare const PACKAGE_VERSION = "1.7.0"; | ||
export declare const PACKAGE_VERSION = "1.7.1-spfx"; |
@@ -28,3 +28,3 @@ "use strict"; | ||
*/ | ||
exports.PACKAGE_VERSION = "1.7.0"; | ||
exports.PACKAGE_VERSION = "1.7.1-spfx"; | ||
//# sourceMappingURL=Constants.js.map |
{ | ||
"name": "@microsoft/microsoft-graph-client", | ||
"//": "NOTE: The version here should match exactly the exported const PACKAGE_VERSION in Constants.ts. If you change it here, also change it there.", | ||
"version": "1.7.0", | ||
"version": "1.7.1-spfx", | ||
"description": "Microsoft Graph Client Library", | ||
@@ -15,3 +15,3 @@ "main": "lib/src/index.js", | ||
"es6-promise": "^4.2.6", | ||
"isomorphic-fetch": "^2.2.1", | ||
"isomorphic-fetch": "^3.0.0", | ||
"tslib": "^1.9.3" | ||
@@ -26,2 +26,8 @@ }, | ||
"husky": "^1.3.1", | ||
"karma": "^6.3.2", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-firefox-launcher": "^2.1.0", | ||
"karma-mocha": "^2.0.1", | ||
"karma-typescript": "^5.2.0", | ||
"lint-staged": "^8.1.5", | ||
@@ -44,5 +50,5 @@ "mocha": "^6.1.3", | ||
"build": "npm run build:cjs && npm run build:es && rollup -c && npm run web:js && npm run core:js", | ||
"test": "npm run build:cjs && mocha lib/spec/content && mocha lib/spec/core && mocha lib/spec/middleware && mocha lib/spec/tasks", | ||
"test:content": "tsc --p spec/tsconfig.json && mocha spec/content", | ||
"test:core": "tsc --p spec/tsconfig.json && mocha spec/core", | ||
"test": "npm run build:cjs && mocha lib/spec/content && mocha lib/spec/content/node && mocha lib/spec/core && mocha lib/spec/core/node && mocha lib/spec/middleware && mocha lib/spec/tasks", | ||
"test:content": "tsc --p spec/tsconfig.json && mocha spec/content && mocha spec/content/node", | ||
"test:core": "tsc --p spec/tsconfig.json && mocha spec/core && mocha spec/core/node", | ||
"test:middleware": "tsc --p spec/tsconfig.json && mocha spec/middleware", | ||
@@ -61,3 +67,4 @@ "test:tasks": "tsc --p spec/tsconfig.json && mocha spec/tasks", | ||
"format": "npm run format:css && npm run format:html && npm run format:js && npm run format:json && npm run format:md && npm run format:rc && npm run format:ts", | ||
"prepack": "npm install && npm run build && npm run test" | ||
"prepack": "npm install && npm run build", | ||
"karma": "karma start --single-run --browsers ChromeHeadless karma.conf.js" | ||
}, | ||
@@ -67,3 +74,4 @@ "repository": { | ||
"url": "https://github.com/microsoftgraph/msgraph-sdk-javascript.git" | ||
} | ||
}, | ||
"_id": "@microsoft/microsoft-graph-client@1.7.0" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
1030861
22
294
4
+ Addedisomorphic-fetch@3.0.0(transitive)
+ Addednode-fetch@2.7.0(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
- Removedencoding@0.1.13(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedsafer-buffer@2.1.2(transitive)
Updatedisomorphic-fetch@^3.0.0