🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

dynamics-web-api

Package Overview
Dependencies
Maintainers
1
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamics-web-api - npm Package Compare versions

Comparing version
2.2.0
to
2.2.1
+1
-1
dist/dynamics-web-api.d.ts

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

/*! dynamics-web-api v2.2.0 (c) 2025 Aleksandr Rogov. License: MIT */
/*! dynamics-web-api v2.2.1 (c) 2025 Aleksandr Rogov. License: MIT */
/**

@@ -3,0 +3,0 @@ * Microsoft Dataverse Web API helper library for Node.js and Browser.

@@ -1,14 +0,15 @@

/*! dynamics-web-api v2.2.0 (c) 2025 Aleksandr Rogov. License: MIT */
/*! dynamics-web-api v2.2.1 (c) 2025 Aleksandr Rogov. License: MIT */
"use strict";var _dynamicsWebApiExports=(()=>{var q=Object.defineProperty;var $e=Object.getOwnPropertyDescriptor;var we=Object.getOwnPropertyNames;var Be=Object.prototype.hasOwnProperty;var y=(n,e)=>()=>(n&&(e=n(n=0)),e);var ie=(n,e)=>{for(var t in e)q(n,t,{get:e[t],enumerable:!0})},qe=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of we(e))!Be.call(n,a)&&a!==t&&q(n,a,{get:()=>e[a],enumerable:!(i=$e(e,a))||i.enumerable});return n};var re=n=>qe(q({},"__esModule",{value:!0}),n);function se(){return window.crypto}var oe=y(()=>{"use strict"});function ce(n){return!!Me.exec(n)}function W(n){let e=Fe.exec(n);return e?e[1]:null}function O(n){if(!n)return null;let e=Ge.exec(n);return e?e[1]:null}function M(n){return n.replace(Xe,(e,t)=>t)}function le(n){return n.split(He).map((t,i)=>i%2===0?M(t):t).join("")}function pe(n){let e=Le.exec(n["@odata.id"]);return{id:e[2],collection:e[1],oDataContext:n["@odata.context"]}}function ue(n){let e=Ke.exec(n);if(!e)return null;let t=parseInt(e[2],10),i=ze(e[1]);return{page:t,sanitizedCookie:i}}function ze(n){let e={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return n.replace(Ve,t=>e[t])}function me(n){return n.replace(je,"")}function de(n){return n.replace(Qe,e=>`\\u${("0000"+e.charCodeAt(0).toString(16)).slice(-4)}`)}function F(n){return n.replace(Ye,"")}function Re(n){return Je.test(n??"")?"PUT":"PATCH"}var N,Me,Fe,Ge,Xe,Le,He,Ke,Ve,je,Qe,Ye,ye,G,fe,he,ge,$,X,Je,be,Ae,Ce,xe,g=y(()=>{"use strict";N="[0-9a-fA-F]{8}[-]?([0-9a-fA-F]{4}[-]?){3}[0-9a-fA-F]{12}",Me=new RegExp(N,"i"),Fe=new RegExp("^{?("+N+")}?$","i"),Ge=new RegExp("("+N+")\\)$","i"),Xe=new RegExp(`{(${N})}`,"g"),Le=new RegExp(`\\/(\\w+)\\((${N})`,"i");He=/(["'].*?["'])/;Ke=/pagingcookie="(<cookie page="(\d+)".+<\/cookie>)/,Ve=/[<>"']/g;je=/^\//;Qe=/[\u007F-\uFFFF]/g;Ye=/"/g;ye=/^([^()<>@,;:\\"\/[\]?={} \t]+)\s?:\s?(.*)/,G=/HTTP\/?\s*[\d.]*\s+(\d{3})\s+([\w\s]*)$/m,fe=/Content-Type: text\/plain/i,he=/OData-EntityId.+/i,ge=/\w+$/g,$=/\r?\n/,X=/(\w+)(\([\d\w-]+\))$/,Je=/EntityDefinitions|RelationshipDefinitions|GlobalOptionSetDefinitions/;be=/^<fetch.+top=/,Ae=/^<fetch.+page=/,Ce=/^(<fetch)/,xe=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:Z|[-+]\d{2}:\d{2})$/});function et(n){return n==null?"":typeof n=="string"&&!n.startsWith("Microsoft.Dynamics.CRM")&&!ce(n)?`'${n}'`:typeof n=="object"?JSON.stringify(n):n.toString()}function tt(n){let e=Object.keys(n),t=[],i=[];return e.forEach((a,s)=>{let o=n[a];if(o==null)return;o=et(o);let c=s+1;t.push(`${a}=@p${c}`),i.push(`@p${c}=${W(o)||o}`)}),{key:`(${t.join(",")})`,queryParams:i}}function Pe(n,e){return n.hasOwnProperty(e)||n.hasOwnProperty(e.toLowerCase())}function S(n,e){return n[e]?n[e]:n[e.toLowerCase()]}var Ze,d,l,T=y(()=>{"use strict";oe();g();Ze=4194304;d=class d{static buildFunctionParameters(e){return e?tt(e):{key:"()"}}static getFetchXmlPagingCookie(e="",t=1){e=decodeURIComponent(decodeURIComponent(e));let i=ue(e);return{cookie:i?.sanitizedCookie||"",page:i?.page||t,nextPage:i?.page?i.page+1:t+1}}static isNull(e){return typeof e>"u"||e==null}static generateUUID(){return se().randomUUID()}static getXrmContext(){if(typeof GetGlobalContext<"u")return GetGlobalContext();if(typeof Xrm<"u"){if(!d.isNull(Xrm.Utility)&&!d.isNull(Xrm.Utility.getGlobalContext))return Xrm.Utility.getGlobalContext();if(!d.isNull(Xrm.Page)&&!d.isNull(Xrm.Page.context))return Xrm.Page.context}throw new Error("Xrm Context is not available. In most cases, it can be resolved by adding a reference to a ClientGlobalContext.js.aspx. Please refer to MSDN documentation for more details.")}static getClientUrl(){let t=d.getXrmContext().getClientUrl();return t.match(/\/$/)&&(t=t.substring(0,t.length-1)),t}static isRunningWithinPortals(){return!!window.shell}static isObject(e){return typeof e=="object"&&!!e&&!Array.isArray(e)&&Object.prototype.toString.call(e)!=="[object Date]"}static copyObject(e,t){let i={};for(let a in e)e.hasOwnProperty(a)&&!t?.includes(a)&&(d.isObject(e[a])?i[a]=d.copyObject(e[a]):Array.isArray(e[a])?i[a]=e[a].slice():i[a]=e[a]);return i}static copyRequest(e,t=[]){t.includes("signal")||t.push("signal");let i=d.copyObject(e,t);return i.signal=e.signal,i}static setFileChunk(e,t,i,a){a=a||0;let s=a+i>t.length?t.length%i:i,o;o=new Uint8Array(s);for(let c=0;c<s;c++)o[c]=t[a+c];e.data=o,e.contentRange="bytes "+a+"-"+(a+s-1)+"/"+t.length}static convertToFileBuffer(e){let t=new Uint8Array(e.length);for(var i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}};d.downloadChunkSize=Ze;l=d});function f(n,e,t){throw new Error(t?`${n} requires a ${e} parameter to be of type ${t}.`:`${n} requires a ${e} parameter.`)}var r,x=y(()=>{"use strict";g();r=class n{static handleErrorResponse(e){throw new Error(`Error: ${e.status}: ${e.message}`)}static parameterCheck(e,t,i,a){(typeof e>"u"||e===null||e==="")&&f(t,i,a)}static stringParameterCheck(e,t,i){typeof e!="string"&&f(t,i,"String")}static maxLengthStringParameterCheck(e,t,i,a){if(e&&e.length>a)throw new Error(`${i} has a ${a} character limit.`)}static arrayParameterCheck(e,t,i){e.constructor!==Array&&f(t,i,"Array")}static stringOrArrayParameterCheck(e,t,i){e.constructor!==Array&&typeof e!="string"&&f(t,i,"String or Array")}static numberParameterCheck(e,t,i){if(typeof e!="number"){if(typeof e=="string"&&e&&!isNaN(parseInt(e)))return;f(t,i,"Number")}}static batchIsEmpty(){return[new Error("Payload of the batch operation is empty. Please make that you have other operations in between startBatch() and executeBatch() to successfuly build a batch payload.")]}static handleHttpError(e,t){let i=new Error;return Object.keys(e).forEach(a=>{i[a]=e[a]}),t&&Object.keys(t).forEach(a=>{i[a]=t[a]}),i}static boolParameterCheck(e,t,i){typeof e!="boolean"&&f(t,i,"Boolean")}static guidParameterCheck(e,t,i){let a=W(e);return a||f(t,i,"GUID String"),a}static keyParameterCheck(e,t,i){try{n.stringParameterCheck(e,t,i);let a=W(e);if(a)return a;let s=e.split(",");if(s.length)for(let o=0;o<s.length;o++)s[o]=s[o].trim().replace(/"/g,"'"),/^[\w\d\_]+\=(.+)$/i.exec(s[o])[0];return s.join(",")}catch{f(t,i,"String representing GUID or Alternate Key")}}static callbackParameterCheck(e,t,i){typeof e!="function"&&f(t,i,"Function")}static throwBatchIncompatible(e,t){if(t)throw t=!1,new Error(e+" cannot be used in a BATCH request.")}static throwBatchNotStarted(e){if(!e)throw new Error("Batch operation has not been started. Please call a DynamicsWebApi.startBatch() function prior to calling DynamicsWebApi.executeBatch() to perform a batch request correctly.")}}});var D,_,B,b,ke=y(()=>{"use strict";B=class B{};B.Prefer=(_=class{static get(e){return`${B.Prefer.IncludeAnnotations}="${e}"`}},_.ReturnRepresentation="return=representation",_.Annotations=(D=class{},D.AssociatedNavigationProperty="Microsoft.Dynamics.CRM.associatednavigationproperty",D.LookupLogicalName="Microsoft.Dynamics.CRM.lookuplogicalname",D.All="*",D.FormattedValue="OData.Community.Display.V1.FormattedValue",D.FetchXmlPagingCookie="Microsoft.Dynamics.CRM.fetchxmlpagingcookie",D),_.IncludeAnnotations="odata.include-annotations",_);b=B});function Te(n,e){if(typeof e=="string"){let t=xe.exec(e);if(t)return new Date(Date.UTC(+t[1],+t[2]-1,+t[3],+t[4],+t[5],+t[6]))}return e}var Ee=y(()=>{"use strict";g()});function st(n){let e={position:0},t={},i,a,s;do{if(s=e.position,a=ot(n,e),!a)break;i=ye.exec(a),i!==null?t[i[1].toLowerCase()]=i[2]:e.position=s}while(a&&i);return t}function ot(n,e){return ct(n,e,$)}function ct(n,e,t){let i=e.position||0,a=n.slice(i),s=t.exec(a);if(!s)return null;let o=i+s.index;return e.position=o+s[0].length,n.substring(i,o)}function lt(n){let e=G.exec(n);return{httpStatusString:e[0],httpStatus:parseInt(e[1]),httpStatusMessage:e[2].trim()}}function pt(n){G.lastIndex=0;let e=ge.exec(n.trim());return e?.length?e[0]:void 0}function ut(n,e,t){let i=pt(n);return Y(i)}function mt(n,e,t){if(e?.[t]?.valueIfEmpty!==void 0)return e[t].valueIfEmpty;{let i=he.exec(n);return O(i?.[0])??void 0}}function dt(n,e,t){let{httpStatusString:i,httpStatus:a,httpStatusMessage:s}=lt(n),o=n.substring(n.indexOf("{"),n.lastIndexOf("}")+1);if(!o)return fe.test(n)?ut(n,e,t):mt(n,e,t);let c=Q(o,e,t);if(a<400)return c;let m=st(n.substring(n.indexOf(i)+i.length+1,n.indexOf("{")));return r.handleHttpError(c,{status:a,statusText:s,statusMessage:s,headers:m})}function j(n,e,t=0){let i=n.substring(0,n.search($)),a=n.split(i);a.shift(),a.pop();let s=[];for(let o of a){if(o.indexOf("--changesetresponse_")===-1){s.push(dt(o,e,t++));continue}o=o.trim();let c=o.substring(o.search($)+1).trim();s=s.concat(j(c,e,t++))}return s}var ve=y(()=>{"use strict";x();g();J()});function Z(n,e){let t=null;if(n.indexOf("@")!==-1){let i=n.split("@");switch(i[1]){case"odata.context":t="oDataContext";break;case"odata.count":t="oDataCount",e=e!=null?parseInt(e):0;break;case"odata.nextLink":t="oDataNextLink";break;case"odata.deltaLink":t="oDataDeltaLink";break;case b.Prefer.Annotations.FormattedValue:t=i[0]+"_Formatted";break;case b.Prefer.Annotations.AssociatedNavigationProperty:t=i[0]+"_NavigationProperty";break;case b.Prefer.Annotations.LookupLogicalName:t=i[0]+"_LogicalName";break}}return[t,e]}function ee(n,e){if(e){if(e.isRef&&n["@odata.id"]!=null)return pe(n);if(e.toCount)return Z("@odata.count",n["@odata.count"])[1]||0}for(let i in n){if(n[i]!=null)if(Array.isArray(n[i]))for(var t=0;t<n[i].length;t++)n[i][t]=ee(n[i][t]);else typeof n[i]=="object"&&ee(n[i]);let a=Z(i,n[i]);if(a[0]&&(n[a[0]]=a[1]),i.indexOf("_x002e_")!==-1){let s=i.split("_x002e_");if(!n.hasOwnProperty(s[0]))n[s[0]]={_dwaType:"alias"};else if(typeof n[s[0]]!="object"||typeof n[s[0]]=="object"&&!n[s[0]].hasOwnProperty("_dwaType"))throw new Error("The alias name of the linked entity must be unique!");n[s[0]][s[1]]=n[i],a=Z(s[1],n[i]),a[0]&&(n[s[0]][a[0]]=a[1])}}return e&&e.hasOwnProperty("pageNumber")&&n["@"+b.Prefer.Annotations.FetchXmlPagingCookie]!=null&&(n.PagingInfo=l.getFetchXmlPagingCookie(n["@"+b.Prefer.Annotations.FetchXmlPagingCookie],e.pageNumber)),n}function yt(n){return window.atob(n)}function ft(n,e,t){let i=n;t?.hasOwnProperty("parse")&&(i=JSON.parse(i).value,i=yt(i));let a={value:i};e["x-ms-file-name"]&&(a.fileName=e["x-ms-file-name"]),e["x-ms-file-size"]&&(a.fileSize=parseInt(e["x-ms-file-size"]));let s=S(e,"Location");return s&&(a.location=s),a}function ht(n){return n.indexOf("--batchresponse_")>-1}function gt(n){return Pe(n,"Content-Disposition")}function Rt(n){return S(n,"Content-Type")?.startsWith("application/json")==!0}function bt(n,e){let t=j(n,e);return e?.[0].convertedToBatch?t[0]:t}function At(n,e,t){return ft(n,e,t[0])}function Q(n,e,t=0){return ee(JSON.parse(n,Te),e[t])}function Y(n){let e=Number(n);return isFinite(e)?e:n}function Ct(n,e){if(e?.[0]?.valueIfEmpty!==void 0)return e[0].valueIfEmpty;let t=S(n,"OData-EntityId");if(t)return O(t)??void 0;let i=S(n,"Location");if(i){let a={location:i};return n["x-ms-chunk-size"]&&(a.chunkSize=parseInt(n["x-ms-chunk-size"])),a}}function te(n,e,t){return n.length?ht(n)?bt(n,t):gt(e)?At(n,e,t):Rt(e)?Q(n,t):Y(n):Ct(e,t)}var J=y(()=>{"use strict";ke();T();Ee();g();ve()});function k(n){let e={};if(!n)return e;let t=n.split(`\r
`);for(let i=0,a=t.length;i<a;i++){let s=t[i],o=s.indexOf(": ");o>0&&(e[s.substring(0,o)]=s.substring(o+2))}return e}var Ne=y(()=>{"use strict"});var We={};ie(We,{XhrWrapper:()=>U,executeRequest:()=>xt});function xt(n){return new Promise((e,t)=>{Pt(n,e,t)})}function Pt(n,e,t){let i=n.data,a=n.headers,s=n.responseParams,o=n.abortSignal;if(o?.aborted){t(r.handleHttpError({name:"AbortError",code:20,message:"The user aborted a request."}));return}let c=new XMLHttpRequest;c.open(n.method,n.uri,n.isAsync||!1);for(let p in a)c.setRequestHeader(p,a[p]);c.onreadystatechange=function(){if(c.readyState===4)switch(o&&o.removeEventListener("abort",m),c.status){case 200:case 201:case 204:case 206:case 304:{let C=k(c.getAllResponseHeaders()),Oe={data:te(c.responseText,C,s[n.requestId]),headers:C,status:c.status};c=null,e(Oe);break}case 0:break;default:if(!c)break;let p,u;try{u=k(c.getAllResponseHeaders());let C=te(c.responseText,u,s[n.requestId]);if(Array.isArray(C)){t(C);break}p=C.error}catch{c.response.length>0?p={message:c.response}:p={message:"Unexpected Error"}}let h={status:c.status,statusText:c.statusText,headers:u};c=null,t(r.handleHttpError(p,h));break}},n.timeout&&(c.timeout=n.timeout),c.onerror=function(){let p=k(c.getAllResponseHeaders());t(r.handleHttpError({status:c.status,statusText:c.statusText,message:c.responseText||"Network Error",headers:p})),c=null},c.ontimeout=function(){let p=k(c.getAllResponseHeaders());t(r.handleHttpError({name:"TimeoutError",status:c.status,statusText:c.statusText,message:c.responseText||"Request Timed Out",headers:p})),c=null},c.onabort=function(){if(!c)return;let p=k(c.getAllResponseHeaders());t(r.handleHttpError({status:c.status,statusText:c.statusText,message:"Request aborted",headers:p})),c=null};let m=()=>{if(!c)return;let p=k(c.getAllResponseHeaders());t(r.handleHttpError({name:"AbortError",code:20,status:c.status,statusText:c.statusText,message:"The user aborted a request.",headers:p})),c.abort(),c=null};o&&o.addEventListener("abort",m),i?c.send(i):c.send(),U.afterSendEvent&&U.afterSendEvent()}var U,Se=y(()=>{"use strict";x();J();Ne();U=class{}});var Nt={};ie(Nt,{DynamicsWebApi:()=>ae});T();x();var nt=(n,e)=>l.isRunningWithinPortals()?new URL("_api",window.location.origin).toString()+"/":(n||(n=l.getClientUrl()),new URL(`api/${e.path}/v${e.version}`,n).toString()+"/"),L=(n,e,t)=>{let i=t[e];n?.version&&(r.stringParameterCheck(n.version,"DynamicsWebApi.setConfig",`config.${e}.version`),i.version=n.version),n?.path&&(r.stringParameterCheck(n.path,"DynamicsWebApi.setConfig",`config.${e}.path`),i.path=n.path),i.url=nt(t.serverUrl,i)},P=class{static merge(e,t){t?.serverUrl&&(r.stringParameterCheck(t.serverUrl,"DynamicsWebApi.setConfig","config.serverUrl"),e.serverUrl=t.serverUrl),L(t?.dataApi,"dataApi",e),L(t?.searchApi,"searchApi",e),t?.impersonate&&(e.impersonate=r.guidParameterCheck(t.impersonate,"DynamicsWebApi.setConfig","config.impersonate")),t?.impersonateAAD&&(e.impersonateAAD=r.guidParameterCheck(t.impersonateAAD,"DynamicsWebApi.setConfig","config.impersonateAAD")),t?.onTokenRefresh&&(r.callbackParameterCheck(t.onTokenRefresh,"DynamicsWebApi.setConfig","config.onTokenRefresh"),e.onTokenRefresh=t.onTokenRefresh),t?.includeAnnotations&&(r.stringParameterCheck(t.includeAnnotations,"DynamicsWebApi.setConfig","config.includeAnnotations"),e.includeAnnotations=t.includeAnnotations),t?.timeout&&(r.numberParameterCheck(t.timeout,"DynamicsWebApi.setConfig","config.timeout"),e.timeout=t.timeout),t?.maxPageSize&&(r.numberParameterCheck(t.maxPageSize,"DynamicsWebApi.setConfig","config.maxPageSize"),e.maxPageSize=t.maxPageSize),t?.returnRepresentation&&(r.boolParameterCheck(t.returnRepresentation,"DynamicsWebApi.setConfig","config.returnRepresentation"),e.returnRepresentation=t.returnRepresentation),t?.useEntityNames&&(r.boolParameterCheck(t.useEntityNames,"DynamicsWebApi.setConfig","config.useEntityNames"),e.useEntityNames=t.useEntityNames),t?.headers&&(e.headers=t.headers)}static default(){return{serverUrl:null,impersonate:null,impersonateAAD:null,onTokenRefresh:null,includeAnnotations:null,maxPageSize:null,returnRepresentation:null,proxy:null,dataApi:{path:"data",version:"9.2",url:""},searchApi:{path:"search",version:"1.0",url:""}}}};P.mergeApiConfigs=L;T();x();T();T();x();g();var R=null,H=n=>{R=n},w=(n,e)=>{if(n.path=n.path||"",n.functionName=n.functionName||"",n.url)r.stringParameterCheck(n.url,`DynamicsWebApi.${n.functionName}`,"request.url"),n.path=n.url.replace(e.dataApi.url,"");else if(!n._isUnboundRequest&&!n.contentId&&!n.collection&&r.parameterCheck(n.collection,`DynamicsWebApi.${n.functionName}`,"request.collection"),n.collection!=null&&(r.stringParameterCheck(n.collection,`DynamicsWebApi.${n.functionName}`,"request.collection"),n.path=n.collection,n.key&&(n.key=r.keyParameterCheck(n.key,`DynamicsWebApi.${n.functionName}`,"request.key"),n.path+=`(${n.key})`)),n.contentId&&(r.stringParameterCheck(n.contentId,`DynamicsWebApi.${n.functionName}`,"request.contentId"),n.contentId.startsWith("$")&&(n.path=n.path?`${n.contentId}/${n.path}`:n.contentId)),n.addPath&&(n.path&&(n.path+="/"),n.path+=n.addPath),n.path=De(n,e,n.path),n.fetchXml){r.stringParameterCheck(n.fetchXml,`DynamicsWebApi.${n.functionName}`,"request.fetchXml");let t=n.path.indexOf("?")===-1?"?":"&";n.path+=`${t}fetchXml=${encodeURIComponent(n.fetchXml)}`}return n.hasOwnProperty("async")&&n.async!=null?r.boolParameterCheck(n.async,`DynamicsWebApi.${n.functionName}`,"request.async"):n.async=!0,n.headers=at(n,e),n},De=(n,e,t="",i="&")=>{let a=[];if(n){if(n.navigationProperty){if(r.stringParameterCheck(n.navigationProperty,`DynamicsWebApi.${n.functionName}`,"request.navigationProperty"),t+="/"+n.navigationProperty,n.navigationPropertyKey){let s=r.keyParameterCheck(n.navigationPropertyKey,`DynamicsWebApi.${n.functionName}`,"request.navigationPropertyKey");t+="("+s+")"}n.navigationProperty==="Attributes"&&n.metadataAttributeType&&(r.stringParameterCheck(n.metadataAttributeType,`DynamicsWebApi.${n.functionName}`,"request.metadataAttributeType"),t+="/"+n.metadataAttributeType)}if(n.select?.length&&(r.arrayParameterCheck(n.select,`DynamicsWebApi.${n.functionName}`,"request.select"),n.functionName=="retrieve"&&n.select.length==1&&n.select[0].endsWith("/$ref")?t+="/"+n.select[0]:(n.select[0].startsWith("/")&&n.functionName=="retrieve"&&(n.navigationProperty==null?t+=n.select.shift():n.select.shift()),n.select.length&&a.push("$select="+n.select.join(",")))),n.filter){r.stringParameterCheck(n.filter,`DynamicsWebApi.${n.functionName}`,"request.filter");let s=le(n.filter);a.push("$filter="+encodeURIComponent(s))}if(n.fieldName&&(r.stringParameterCheck(n.fieldName,`DynamicsWebApi.${n.functionName}`,"request.fieldName"),n.property||(n.property=n.fieldName),delete n.fieldName),n.property&&(r.stringParameterCheck(n.property,`DynamicsWebApi.${n.functionName}`,"request.property"),t+="/"+n.property),n.savedQuery&&a.push("savedQuery="+r.guidParameterCheck(n.savedQuery,`DynamicsWebApi.${n.functionName}`,"request.savedQuery")),n.userQuery&&a.push("userQuery="+r.guidParameterCheck(n.userQuery,`DynamicsWebApi.${n.functionName}`,"request.userQuery")),n.apply&&(r.stringParameterCheck(n.apply,`DynamicsWebApi.${n.functionName}`,"request.apply"),a.push("$apply="+n.apply)),n.count&&(r.boolParameterCheck(n.count,`DynamicsWebApi.${n.functionName}`,"request.count"),a.push("$count="+n.count)),n.top&&n.top>0&&(r.numberParameterCheck(n.top,`DynamicsWebApi.${n.functionName}`,"request.top"),a.push("$top="+n.top)),n.orderBy!=null&&n.orderBy.length&&(r.arrayParameterCheck(n.orderBy,`DynamicsWebApi.${n.functionName}`,"request.orderBy"),a.push("$orderby="+n.orderBy.join(","))),n.partitionId&&(r.stringParameterCheck(n.partitionId,`DynamicsWebApi.${n.functionName}`,"request.partitionId"),a.push("partitionid='"+n.partitionId+"'")),n.downloadSize&&(r.stringParameterCheck(n.downloadSize,`DynamicsWebApi.${n.functionName}`,"request.downloadSize"),a.push("size="+n.downloadSize)),n.queryParams?.length&&(r.arrayParameterCheck(n.queryParams,`DynamicsWebApi.${n.functionName}`,"request.queryParams"),a.push(n.queryParams.join("&"))),n.fileName&&(r.stringParameterCheck(n.fileName,`DynamicsWebApi.${n.functionName}`,"request.fileName"),a.push("x-ms-file-name="+n.fileName)),n.data&&r.parameterCheck(n.data,`DynamicsWebApi.${n.functionName}`,"request.data"),n.isBatch&&r.boolParameterCheck(n.isBatch,`DynamicsWebApi.${n.functionName}`,"request.isBatch"),l.isNull(n.inChangeSet)||r.boolParameterCheck(n.inChangeSet,`DynamicsWebApi.${n.functionName}`,"request.inChangeSet"),n.isBatch&&l.isNull(n.inChangeSet)&&(n.inChangeSet=!0),n.timeout&&r.numberParameterCheck(n.timeout,`DynamicsWebApi.${n.functionName}`,"request.timeout"),n.expand?.length)if(r.stringOrArrayParameterCheck(n.expand,`DynamicsWebApi.${n.functionName}`,"request.expand"),typeof n.expand=="string")a.push("$expand="+n.expand);else{let s=[];for(let{property:o,...c}of n.expand){if(!o)continue;let m={functionName:`${n.functionName} $expand`,...c},p=De(m,e,"",";");p&&(p=`(${p.slice(1)})`),s.push(o+p)}s.length&&a.push("$expand="+s.join(","))}}return a.length?t+"?"+a.join(i):t},at=(n,e)=>{let t={...e.headers,...n.userHeaders},i=it(n,e);if(i.length&&(t.Prefer=i),n.collection==="$metadata"&&(t.Accept="application/xml"),n.transferMode&&(t["x-ms-transfer-mode"]=n.transferMode),n.ifmatch!=null&&n.ifnonematch!=null)throw new Error(`DynamicsWebApi.${n.functionName}. Either one of request.ifmatch or request.ifnonematch parameters should be used in a call, not both.`);return n.ifmatch&&(r.stringParameterCheck(n.ifmatch,`DynamicsWebApi.${n.functionName}`,"request.ifmatch"),t["If-Match"]=n.ifmatch),n.ifnonematch&&(r.stringParameterCheck(n.ifnonematch,`DynamicsWebApi.${n.functionName}`,"request.ifnonematch"),t["If-None-Match"]=n.ifnonematch),n.impersonate&&(r.stringParameterCheck(n.impersonate,`DynamicsWebApi.${n.functionName}`,"request.impersonate"),t.MSCRMCallerID=r.guidParameterCheck(n.impersonate,`DynamicsWebApi.${n.functionName}`,"request.impersonate")),n.impersonateAAD&&(r.stringParameterCheck(n.impersonateAAD,`DynamicsWebApi.${n.functionName}`,"request.impersonateAAD"),t.CallerObjectId=r.guidParameterCheck(n.impersonateAAD,`DynamicsWebApi.${n.functionName}`,"request.impersonateAAD")),n.token&&(r.stringParameterCheck(n.token,`DynamicsWebApi.${n.functionName}`,"request.token"),t.Authorization="Bearer "+n.token),n.duplicateDetection&&(r.boolParameterCheck(n.duplicateDetection,`DynamicsWebApi.${n.functionName}`,"request.duplicateDetection"),t["MSCRM.SuppressDuplicateDetection"]="false"),n.bypassCustomPluginExecution&&(r.boolParameterCheck(n.bypassCustomPluginExecution,`DynamicsWebApi.${n.functionName}`,"request.bypassCustomPluginExecution"),t["MSCRM.BypassCustomPluginExecution"]="true"),n.noCache&&(r.boolParameterCheck(n.noCache,`DynamicsWebApi.${n.functionName}`,"request.noCache"),t["Cache-Control"]="no-cache"),n.mergeLabels&&(r.boolParameterCheck(n.mergeLabels,`DynamicsWebApi.${n.functionName}`,"request.mergeLabels"),t["MSCRM.MergeLabels"]="true"),n.contentId&&(r.stringParameterCheck(n.contentId,`DynamicsWebApi.${n.functionName}`,"request.contentId"),n.contentId.startsWith("$")||(t["Content-ID"]=n.contentId)),n.contentRange&&(r.stringParameterCheck(n.contentRange,`DynamicsWebApi.${n.functionName}`,"request.contentRange"),t["Content-Range"]=n.contentRange),n.range&&(r.stringParameterCheck(n.range,`DynamicsWebApi.${n.functionName}`,"request.range"),t.Range=n.range),t},it=(n,e)=>{let{returnRepresentation:t,includeAnnotations:i,maxPageSize:a,trackChanges:s,continueOnError:o}=n;n.prefer&&n.prefer.length&&(r.stringOrArrayParameterCheck(n.prefer,`DynamicsWebApi.${n.functionName}`,"request.prefer"),(typeof n.prefer=="string"?n.prefer.split(","):n.prefer).forEach(p=>{let u=p.trim();u==="return=representation"?t=!0:u.includes("odata.include-annotations=")?i=F(u.replace("odata.include-annotations=","")):u.startsWith("odata.maxpagesize=")?a=Number(F(u.replace("odata.maxpagesize=","")))||0:u.includes("odata.track-changes")?s=!0:u.includes("odata.continue-on-error")&&(o=!0)}));let c=[];return e&&(t==null&&(t=e.returnRepresentation),i=i??e.includeAnnotations,a=a??e.maxPageSize),t&&(r.boolParameterCheck(t,`DynamicsWebApi.${n.functionName}`,"request.returnRepresentation"),c.push("return=representation")),i&&(r.stringParameterCheck(i,`DynamicsWebApi.${n.functionName}`,"request.includeAnnotations"),c.push(`odata.include-annotations="${i}"`)),a&&a>0&&(r.numberParameterCheck(a,`DynamicsWebApi.${n.functionName}`,"request.maxPageSize"),c.push("odata.maxpagesize="+a)),s&&(r.boolParameterCheck(s,`DynamicsWebApi.${n.functionName}`,"request.trackChanges"),c.push("odata.track-changes")),o&&(r.boolParameterCheck(o,`DynamicsWebApi.${n.functionName}`,"request.continueOnError"),c.push("odata.continue-on-error")),c.join(",")},K=(n,e,t)=>{let i=`dwa_batch_${l.generateUUID()}`,a=[],s=null,o=1e5,c=(p,u)=>{for(let h in p)h==="Authorization"||h==="Content-ID"||u.push(`${h}: ${p[h]}`)};n.forEach(p=>{p.functionName="executeBatch",t?.inChangeSet===!1&&(p.inChangeSet=!1);let u=p.method==="GET"?!1:!!p.inChangeSet;if(!u&&s&&(a.push(`
--${s}--`),s=null,o=1e5),s||(a.push(`
--${i}`),u&&(s=`changeset_${l.generateUUID()}`,a.push("Content-Type: multipart/mixed;boundary="+s))),u&&a.push(`
--${s}`),a.push("Content-Type: application/http"),a.push("Content-Transfer-Encoding: binary"),u){let h=p.headers.hasOwnProperty("Content-ID")?p.headers["Content-ID"]:++o;a.push(`Content-ID: ${h}`)}p.path?.startsWith("$")?a.push(`
${p.method} ${p.path} HTTP/1.1`):a.push(`
${p.method} ${e.dataApi.url}${p.path} HTTP/1.1`),p.method==="GET"?a.push("Accept: application/json"):a.push("Content-Type: application/json"),p.headers&&c(p.headers,a),p.data&&a.push(`
${V(p.data,e)}`)}),s&&a.push(`
--${s}--`),a.push(`
--${i}--`);let m=z(t?.userHeaders);return m["Content-Type"]=`multipart/mixed;boundary=${i}`,{headers:m,body:a.join(`
`);for(let i=0,a=t.length;i<a;i++){let s=t[i],o=s.indexOf(": ");o>0&&(e[s.substring(0,o)]=s.substring(o+2))}return e}var Ne=y(()=>{"use strict"});var We={};ie(We,{XhrWrapper:()=>U,executeRequest:()=>xt});function xt(n){return new Promise((e,t)=>{Pt(n,e,t)})}function Pt(n,e,t){let i=n.data,a=n.headers,s=n.responseParams,o=n.abortSignal;if(o?.aborted){t(r.handleHttpError({name:"AbortError",code:20,message:"The user aborted a request."}));return}let c=new XMLHttpRequest;c.open(n.method,n.uri,n.isAsync||!1);for(let p in a)c.setRequestHeader(p,a[p]);c.onreadystatechange=function(){if(c.readyState===4)switch(o&&o.removeEventListener("abort",m),c.status){case 200:case 201:case 204:case 206:case 304:{let C=k(c.getAllResponseHeaders()),Oe={data:te(c.responseText,C,s[n.requestId]),headers:C,status:c.status};c=null,e(Oe);break}case 0:break;default:if(!c)break;let p,u;try{u=k(c.getAllResponseHeaders());let C=te(c.responseText,u,s[n.requestId]);if(Array.isArray(C)){t(C);break}p=C.error}catch{c.response.length>0?p={message:c.response}:p={message:"Unexpected Error"}}let h={status:c.status,statusText:c.statusText,headers:u};c=null,t(r.handleHttpError(p,h));break}},n.timeout&&(c.timeout=n.timeout),c.onerror=function(){let p=k(c.getAllResponseHeaders());t(r.handleHttpError({status:c.status,statusText:c.statusText,message:c.responseText||"Network Error",headers:p})),c=null},c.ontimeout=function(){let p=k(c.getAllResponseHeaders());t(r.handleHttpError({name:"TimeoutError",status:c.status,statusText:c.statusText,message:c.responseText||"Request Timed Out",headers:p})),c=null},c.onabort=function(){if(!c)return;let p=k(c.getAllResponseHeaders());t(r.handleHttpError({status:c.status,statusText:c.statusText,message:"Request aborted",headers:p})),c=null};let m=()=>{if(!c)return;let p=k(c.getAllResponseHeaders());t(r.handleHttpError({name:"AbortError",code:20,status:c.status,statusText:c.statusText,message:"The user aborted a request.",headers:p})),c.abort(),c=null};o&&o.addEventListener("abort",m),i?c.send(i):c.send(),U.afterSendEvent&&U.afterSendEvent()}var U,Se=y(()=>{"use strict";x();J();Ne();U=class{}});var Nt={};ie(Nt,{DynamicsWebApi:()=>ae});T();x();var nt=(n,e)=>l.isRunningWithinPortals()?new URL("_api",window.location.origin).toString()+"/":(n||(n=l.getClientUrl()),new URL(`api/${e.path}/v${e.version}`,n).toString()+"/"),L=(n,e,t)=>{let i=t[e];n?.version&&(r.stringParameterCheck(n.version,"DynamicsWebApi.setConfig",`config.${e}.version`),i.version=n.version),n?.path&&(r.stringParameterCheck(n.path,"DynamicsWebApi.setConfig",`config.${e}.path`),i.path=n.path),i.url=nt(t.serverUrl,i)},P=class{static merge(e,t){t?.serverUrl&&(r.stringParameterCheck(t.serverUrl,"DynamicsWebApi.setConfig","config.serverUrl"),e.serverUrl=t.serverUrl),L(t?.dataApi,"dataApi",e),L(t?.searchApi,"searchApi",e),t?.impersonate&&(e.impersonate=r.guidParameterCheck(t.impersonate,"DynamicsWebApi.setConfig","config.impersonate")),t?.impersonateAAD&&(e.impersonateAAD=r.guidParameterCheck(t.impersonateAAD,"DynamicsWebApi.setConfig","config.impersonateAAD")),t?.onTokenRefresh&&(r.callbackParameterCheck(t.onTokenRefresh,"DynamicsWebApi.setConfig","config.onTokenRefresh"),e.onTokenRefresh=t.onTokenRefresh),t?.includeAnnotations&&(r.stringParameterCheck(t.includeAnnotations,"DynamicsWebApi.setConfig","config.includeAnnotations"),e.includeAnnotations=t.includeAnnotations),t?.timeout&&(r.numberParameterCheck(t.timeout,"DynamicsWebApi.setConfig","config.timeout"),e.timeout=t.timeout),t?.maxPageSize&&(r.numberParameterCheck(t.maxPageSize,"DynamicsWebApi.setConfig","config.maxPageSize"),e.maxPageSize=t.maxPageSize),t?.returnRepresentation&&(r.boolParameterCheck(t.returnRepresentation,"DynamicsWebApi.setConfig","config.returnRepresentation"),e.returnRepresentation=t.returnRepresentation),t?.useEntityNames&&(r.boolParameterCheck(t.useEntityNames,"DynamicsWebApi.setConfig","config.useEntityNames"),e.useEntityNames=t.useEntityNames),t?.headers&&(e.headers=t.headers)}static default(){return{serverUrl:null,impersonate:null,impersonateAAD:null,onTokenRefresh:null,includeAnnotations:null,maxPageSize:null,returnRepresentation:null,proxy:null,dataApi:{path:"data",version:"9.2",url:""},searchApi:{path:"search",version:"1.0",url:""}}}};P.mergeApiConfigs=L;T();x();T();T();x();g();var R=null,H=n=>{R=n},w=(n,e)=>{if(n.path=n.path||"",n.functionName=n.functionName||"",n.url)r.stringParameterCheck(n.url,`DynamicsWebApi.${n.functionName}`,"request.url"),n.path=n.url.replace(e.dataApi.url,"");else if(!n._isUnboundRequest&&!n.contentId&&!n.collection&&r.parameterCheck(n.collection,`DynamicsWebApi.${n.functionName}`,"request.collection"),n.collection!=null&&(r.stringParameterCheck(n.collection,`DynamicsWebApi.${n.functionName}`,"request.collection"),n.path=n.collection,n.key&&(n.key=r.keyParameterCheck(n.key,`DynamicsWebApi.${n.functionName}`,"request.key"),n.path+=`(${n.key})`)),n.contentId&&(r.stringParameterCheck(n.contentId,`DynamicsWebApi.${n.functionName}`,"request.contentId"),n.contentId.startsWith("$")&&(n.path=n.path?`${n.contentId}/${n.path}`:n.contentId)),n.addPath&&(n.path&&(n.path+="/"),n.path+=n.addPath),n.path=De(n,e,n.path),n.fetchXml){r.stringParameterCheck(n.fetchXml,`DynamicsWebApi.${n.functionName}`,"request.fetchXml");let t=n.path.indexOf("?")===-1?"?":"&";n.path+=`${t}fetchXml=${encodeURIComponent(n.fetchXml)}`}return n.hasOwnProperty("async")&&n.async!=null?r.boolParameterCheck(n.async,`DynamicsWebApi.${n.functionName}`,"request.async"):n.async=!0,n.headers=at(n,e),n},De=(n,e,t="",i="&")=>{let a=[];if(n){if(n.navigationProperty){if(r.stringParameterCheck(n.navigationProperty,`DynamicsWebApi.${n.functionName}`,"request.navigationProperty"),t+="/"+n.navigationProperty,n.navigationPropertyKey){let s=r.keyParameterCheck(n.navigationPropertyKey,`DynamicsWebApi.${n.functionName}`,"request.navigationPropertyKey");t+="("+s+")"}n.navigationProperty==="Attributes"&&n.metadataAttributeType&&(r.stringParameterCheck(n.metadataAttributeType,`DynamicsWebApi.${n.functionName}`,"request.metadataAttributeType"),t+="/"+n.metadataAttributeType)}if(n.select?.length&&(r.arrayParameterCheck(n.select,`DynamicsWebApi.${n.functionName}`,"request.select"),n.functionName=="retrieve"&&n.select.length==1&&n.select[0].endsWith("/$ref")?t+="/"+n.select[0]:(n.select[0].startsWith("/")&&n.functionName=="retrieve"&&(n.navigationProperty==null?t+=n.select.shift():n.select.shift()),n.select.length&&a.push("$select="+n.select.join(",")))),n.filter){r.stringParameterCheck(n.filter,`DynamicsWebApi.${n.functionName}`,"request.filter");let s=le(n.filter);a.push("$filter="+encodeURIComponent(s))}if(n.fieldName&&(r.stringParameterCheck(n.fieldName,`DynamicsWebApi.${n.functionName}`,"request.fieldName"),n.property||(n.property=n.fieldName),delete n.fieldName),n.property&&(r.stringParameterCheck(n.property,`DynamicsWebApi.${n.functionName}`,"request.property"),t+="/"+n.property),n.savedQuery&&a.push("savedQuery="+r.guidParameterCheck(n.savedQuery,`DynamicsWebApi.${n.functionName}`,"request.savedQuery")),n.userQuery&&a.push("userQuery="+r.guidParameterCheck(n.userQuery,`DynamicsWebApi.${n.functionName}`,"request.userQuery")),n.apply&&(r.stringParameterCheck(n.apply,`DynamicsWebApi.${n.functionName}`,"request.apply"),a.push("$apply="+n.apply)),n.count&&(r.boolParameterCheck(n.count,`DynamicsWebApi.${n.functionName}`,"request.count"),a.push("$count="+n.count)),n.top&&n.top>0&&(r.numberParameterCheck(n.top,`DynamicsWebApi.${n.functionName}`,"request.top"),a.push("$top="+n.top)),n.orderBy!=null&&n.orderBy.length&&(r.arrayParameterCheck(n.orderBy,`DynamicsWebApi.${n.functionName}`,"request.orderBy"),a.push("$orderby="+n.orderBy.join(","))),n.partitionId&&(r.stringParameterCheck(n.partitionId,`DynamicsWebApi.${n.functionName}`,"request.partitionId"),a.push("partitionid='"+n.partitionId+"'")),n.downloadSize&&(r.stringParameterCheck(n.downloadSize,`DynamicsWebApi.${n.functionName}`,"request.downloadSize"),a.push("size="+n.downloadSize)),n.queryParams?.length&&(r.arrayParameterCheck(n.queryParams,`DynamicsWebApi.${n.functionName}`,"request.queryParams"),a.push(n.queryParams.join("&"))),n.fileName&&(r.stringParameterCheck(n.fileName,`DynamicsWebApi.${n.functionName}`,"request.fileName"),a.push("x-ms-file-name="+n.fileName)),n.data&&r.parameterCheck(n.data,`DynamicsWebApi.${n.functionName}`,"request.data"),n.isBatch&&r.boolParameterCheck(n.isBatch,`DynamicsWebApi.${n.functionName}`,"request.isBatch"),l.isNull(n.inChangeSet)||r.boolParameterCheck(n.inChangeSet,`DynamicsWebApi.${n.functionName}`,"request.inChangeSet"),n.isBatch&&l.isNull(n.inChangeSet)&&(n.inChangeSet=!0),n.timeout&&r.numberParameterCheck(n.timeout,`DynamicsWebApi.${n.functionName}`,"request.timeout"),n.expand?.length)if(r.stringOrArrayParameterCheck(n.expand,`DynamicsWebApi.${n.functionName}`,"request.expand"),typeof n.expand=="string")a.push("$expand="+n.expand);else{let s=[];for(let{property:o,...c}of n.expand){if(!o)continue;let m={functionName:`${n.functionName} $expand`,...c},p=De(m,e,"",";");p&&(p=`(${p.slice(1)})`),s.push(o+p)}s.length&&a.push("$expand="+s.join(","))}}return a.length?t+"?"+a.join(i):t},at=(n,e)=>{let t={...e.headers,...n.userHeaders},i=it(n,e);if(i.length&&(t.Prefer=i),n.collection==="$metadata"&&(t.Accept="application/xml"),n.transferMode&&(t["x-ms-transfer-mode"]=n.transferMode),n.ifmatch!=null&&n.ifnonematch!=null)throw new Error(`DynamicsWebApi.${n.functionName}. Either one of request.ifmatch or request.ifnonematch parameters should be used in a call, not both.`);return n.ifmatch&&(r.stringParameterCheck(n.ifmatch,`DynamicsWebApi.${n.functionName}`,"request.ifmatch"),t["If-Match"]=n.ifmatch),n.ifnonematch&&(r.stringParameterCheck(n.ifnonematch,`DynamicsWebApi.${n.functionName}`,"request.ifnonematch"),t["If-None-Match"]=n.ifnonematch),n.impersonate&&(r.stringParameterCheck(n.impersonate,`DynamicsWebApi.${n.functionName}`,"request.impersonate"),t.MSCRMCallerID=r.guidParameterCheck(n.impersonate,`DynamicsWebApi.${n.functionName}`,"request.impersonate")),n.impersonateAAD&&(r.stringParameterCheck(n.impersonateAAD,`DynamicsWebApi.${n.functionName}`,"request.impersonateAAD"),t.CallerObjectId=r.guidParameterCheck(n.impersonateAAD,`DynamicsWebApi.${n.functionName}`,"request.impersonateAAD")),n.token&&(r.stringParameterCheck(n.token,`DynamicsWebApi.${n.functionName}`,"request.token"),t.Authorization="Bearer "+n.token),n.duplicateDetection&&(r.boolParameterCheck(n.duplicateDetection,`DynamicsWebApi.${n.functionName}`,"request.duplicateDetection"),t["MSCRM.SuppressDuplicateDetection"]="false"),n.bypassCustomPluginExecution&&(r.boolParameterCheck(n.bypassCustomPluginExecution,`DynamicsWebApi.${n.functionName}`,"request.bypassCustomPluginExecution"),t["MSCRM.BypassCustomPluginExecution"]="true"),n.noCache&&(r.boolParameterCheck(n.noCache,`DynamicsWebApi.${n.functionName}`,"request.noCache"),t["Cache-Control"]="no-cache"),n.mergeLabels&&(r.boolParameterCheck(n.mergeLabels,`DynamicsWebApi.${n.functionName}`,"request.mergeLabels"),t["MSCRM.MergeLabels"]="true"),n.contentId&&(r.stringParameterCheck(n.contentId,`DynamicsWebApi.${n.functionName}`,"request.contentId"),n.contentId.startsWith("$")||(t["Content-ID"]=n.contentId)),n.contentRange&&(r.stringParameterCheck(n.contentRange,`DynamicsWebApi.${n.functionName}`,"request.contentRange"),t["Content-Range"]=n.contentRange),n.range&&(r.stringParameterCheck(n.range,`DynamicsWebApi.${n.functionName}`,"request.range"),t.Range=n.range),t},it=(n,e)=>{let{returnRepresentation:t,includeAnnotations:i,maxPageSize:a,trackChanges:s,continueOnError:o}=n;n.prefer&&n.prefer.length&&(r.stringOrArrayParameterCheck(n.prefer,`DynamicsWebApi.${n.functionName}`,"request.prefer"),(typeof n.prefer=="string"?n.prefer.split(","):n.prefer).forEach(p=>{let u=p.trim();u==="return=representation"?t=!0:u.includes("odata.include-annotations=")?i=F(u.replace("odata.include-annotations=","")):u.startsWith("odata.maxpagesize=")?a=Number(F(u.replace("odata.maxpagesize=","")))||0:u.includes("odata.track-changes")?s=!0:u.includes("odata.continue-on-error")&&(o=!0)}));let c=[];return e&&(t==null&&(t=e.returnRepresentation),i=i??e.includeAnnotations,a=a??e.maxPageSize),t&&(r.boolParameterCheck(t,`DynamicsWebApi.${n.functionName}`,"request.returnRepresentation"),c.push("return=representation")),i&&(r.stringParameterCheck(i,`DynamicsWebApi.${n.functionName}`,"request.includeAnnotations"),c.push(`odata.include-annotations="${i}"`)),a&&a>0&&(r.numberParameterCheck(a,`DynamicsWebApi.${n.functionName}`,"request.maxPageSize"),c.push("odata.maxpagesize="+a)),s&&(r.boolParameterCheck(s,`DynamicsWebApi.${n.functionName}`,"request.trackChanges"),c.push("odata.track-changes")),o&&(r.boolParameterCheck(o,`DynamicsWebApi.${n.functionName}`,"request.continueOnError"),c.push("odata.continue-on-error")),c.join(",")},K=(n,e,t)=>{let i=`dwa_batch_${l.generateUUID()}`,a=[],s=null,o=1e5,c=(p,u)=>{for(let h in p)h==="Authorization"||h==="Content-ID"||u.push(`${h}: ${p[h]}`)};n.forEach(p=>{p.functionName="executeBatch",t?.inChangeSet===!1&&(p.inChangeSet=!1);let u=p.method==="GET"?!1:!!p.inChangeSet;if(!u&&s&&(a.push(`\r
--${s}--`),s=null,o=1e5),s||(a.push(`\r
--${i}`),u&&(s=`changeset_${l.generateUUID()}`,a.push("Content-Type: multipart/mixed;boundary="+s))),u&&a.push(`\r
--${s}`),a.push("Content-Type: application/http"),a.push("Content-Transfer-Encoding: binary"),u){let h=p.headers.hasOwnProperty("Content-ID")?p.headers["Content-ID"]:++o;a.push(`Content-ID: ${h}`)}p.path?.startsWith("$")?a.push(`\r
${p.method} ${p.path} HTTP/1.1`):a.push(`\r
${p.method} ${e.dataApi.url}${p.path} HTTP/1.1`),p.method==="GET"?a.push("Accept: application/json"):a.push("Content-Type: application/json"),p.headers&&c(p.headers,a),p.data&&a.push(`\r
${V(p.data,e)}`)}),s&&a.push(`\r
--${s}--`),a.push(`\r
--${i}--\r
`);let m=z(t?.userHeaders);return m["Content-Type"]=`multipart/mixed;boundary=${i}`,{headers:m,body:a.join(`\r
`)}},I=n=>{if(l.isNull(R))return null;let e=R[n];if(!e){for(let t in R)if(R[t]===n)return n}return e},V=(n,e)=>{if(!n)return null;if(n instanceof Uint8Array||n instanceof Uint16Array||n instanceof Uint32Array)return n;let t=s=>{let o=X.exec(s);if(o&&o.length>2){let c=I(o[1]);if(!l.isNull(c))return s.replace(X,`${c}$2`)}return s},i=(s,o)=>(o.startsWith(e.dataApi.url)||(s.endsWith("@odata.bind")?o.startsWith("/")||(o=`/${o}`):o=`${e.dataApi.url}${me(o)}`),o),a=JSON.stringify(n,(s,o)=>{if(s.endsWith("@odata.bind")||s.endsWith("@odata.id"))typeof o=="string"&&!o.startsWith("$")&&(o=M(o),e.useEntityNames&&(o=t(o)),o=i(s,o));else if(s.startsWith("oData")||s.endsWith("_Formatted")||s.endsWith("_NavigationProperty")||s.endsWith("_LogicalName"))return;return o});return de(a)},z=(n={})=>(n.Accept||(n.Accept="application/json"),n["OData-MaxVersion"]||(n["OData-MaxVersion"]="4.0"),n["OData-Version"]||(n["OData-Version"]="4.0"),n["Content-Range"]?n["Content-Type"]="application/octet-stream":n["Content-Type"]||(n["Content-Type"]="application/json; charset=utf-8"),n);x();async function Ie(n){return(Se(),re(We)).executeRequest(n)}var _e=(n,e)=>{E[n]?E[n].push(e):E[n]=[e]},Dt=(n,e)=>{A[n]?A[n].push(e):A[n]=[e]},ne=n=>{delete E[n],A.hasOwnProperty(n)&&delete A[n]},Ue=async(n,e)=>{try{let t=await v.sendRequest(n,e);return ne(n.requestId),t}catch(t){throw ne(n.requestId),t}finally{ne(n.requestId)}},A={},E={},kt=["$metadata","EntityDefinitions","RelationshipDefinitions","GlobalOptionSetDefinitions","ManagedPropertyDefinitions","query","suggest","autocomplete"],Tt=n=>kt.indexOf(n)>-1,Et=async(n,e)=>{if(!l.isNull(R))return I(n)||n;let t=w({method:"GET",collection:"EntityDefinitions",select:["EntitySetName","LogicalName"],noCache:!0,functionName:"retrieveMultiple"},e),i=await Ue(t,e);H({});for(let a=0;a<i.data.value.length;a++)R[i.data.value[a].LogicalName]=i.data.value[a].EntitySetName;return I(n)||n},vt=async(n,e)=>{if(!n||Tt(n)||(n=n.toLowerCase(),!e.useEntityNames))return n;try{return await Et(n,e)}catch(t){throw new Error("Unable to fetch Collection Names. Error: "+t.message)}},v=class{static async sendRequest(e,t){e.headers=e.headers||{},e.responseParameters=e.responseParameters||{},e.requestId=e.requestId||l.generateUUID(),_e(e.requestId,e.responseParameters);let i=null,a=e.responseParameters?.convertedToBatch;if(e.path==="$batch"&&!a){let c=A[e.requestId];if(!c)throw r.batchIsEmpty();let m=K(c,t,e);i=m.body,e.headers={...m.headers,...e.headers},delete A[e.requestId]}else i=a?e.data:V(e.data,t),a||(e.headers=z(e.headers));t.impersonate&&!e.headers.MSCRMCallerID&&(e.headers.MSCRMCallerID=t.impersonate),t.impersonateAAD&&!e.headers.CallerObjectId&&(e.headers.CallerObjectId=t.impersonateAAD);let s=null;if(t.onTokenRefresh&&(!e.headers||e.headers&&!e.headers.Authorization)&&(s=await t.onTokenRefresh(),!s))throw new Error("Token is empty. Request is aborted.");s&&(e.headers.Authorization="Bearer "+(s.hasOwnProperty("accessToken")?s.accessToken:s)),l.isRunningWithinPortals()&&(e.headers.__RequestVerificationToken=await window.shell.getTokenDeferred());let o=e.apiConfig?e.apiConfig.url:t.dataApi.url;return await Ie({method:e.method,uri:o.toString()+e.path,data:i,proxy:t.proxy,isAsync:e.async,headers:e.headers,requestId:e.requestId,abortSignal:e.signal,responseParams:E,timeout:e.timeout||t.timeout})}static async makeRequest(e,t){if(e.responseParameters=e.responseParameters||{},e.userHeaders=e.headers,delete e.headers,!e.isBatch){let i=await vt(e.collection,t);if(e.collection=i,w(e,t),e.responseParameters.convertedToBatch=!1,e.path.length>2e3){let a=K([e],t);e.headers.Authorization&&(a.headers.Authorization=e.headers.Authorization),e.method="POST",e.path="$batch",e.data=a.body,e.headers={...a.headers,...e.userHeaders},e.responseParameters.convertedToBatch=!0}return Ue(e,t)}w(e,t),_e(e.requestId,e.responseParameters),Dt(e.requestId,e)}static _clearTestData(){H(null),E={},A={}}static getCollectionName(e){return I(e)}};g();var ae=class n{constructor(e){this._config=P.default();this._isBatch=!1;this._batchRequestId=null;this.setConfig=e=>P.merge(this._config,e);this._makeRequest=async e=>(e.isBatch=this._isBatch,this._batchRequestId&&(e.requestId=this._batchRequestId),v.makeRequest(e,this._config));this.create=async e=>{r.parameterCheck(e,"DynamicsWebApi.create","request");let t;return e.functionName?t=e:(t=l.copyRequest(e),t.functionName="create"),t.method="POST",(await this._makeRequest(t))?.data};this.retrieve=async e=>{r.parameterCheck(e,"DynamicsWebApi.retrieve","request");let t;return e.functionName?t=e:(t=l.copyRequest(e),t.functionName="retrieve"),t.method="GET",t.responseParameters={isRef:t.select?.length===1&&t.select[0].endsWith("/$ref")},(await this._makeRequest(t))?.data};this.update=async e=>{r.parameterCheck(e,"DynamicsWebApi.update","request");let t;e.functionName?t=e:(t=l.copyRequest(e),t.functionName="update"),t.method??(t.method=Re(t.collection)),t.responseParameters={valueIfEmpty:!0},t.ifmatch??(t.ifmatch="*");let i=t.ifmatch;try{return(await this._makeRequest(t))?.data}catch(a){if(i&&a.status===412)return!1;throw a}};this.updateSingleProperty=async e=>{r.parameterCheck(e,"DynamicsWebApi.updateSingleProperty","request"),r.parameterCheck(e.fieldValuePair,"DynamicsWebApi.updateSingleProperty","request.fieldValuePair");var t=Object.keys(e.fieldValuePair)[0],i=e.fieldValuePair[t];let a=l.copyRequest(e);return a.navigationProperty=t,a.data={value:i},a.functionName="updateSingleProperty",a.method="PUT",delete a.fieldValuePair,(await this._makeRequest(a))?.data};this.deleteRecord=async e=>{r.parameterCheck(e,"DynamicsWebApi.deleteRecord","request");let t;e.functionName?t=e:(t=l.copyRequest(e),t.functionName="deleteRecord"),t.method="DELETE",t.responseParameters={valueIfEmpty:!0};let i=t.ifmatch;try{return(await this._makeRequest(t))?.data}catch(a){if(i&&a.status===412)return!1;throw a}};this.upsert=async e=>{r.parameterCheck(e,"DynamicsWebApi.upsert","request");let t=l.copyRequest(e);t.method="PATCH",t.functionName="upsert";let i=t.ifnonematch,a=t.ifmatch;try{return(await this._makeRequest(t))?.data}catch(s){if(i&&s.status===412)return null;if(a&&s.status===404)return null;throw s}};this._uploadFileChunk=async(e,t,i,a=0)=>{if(l.setFileChunk(e,t,i,a),await this._makeRequest(e),a+=i,a<=t.length)return this._uploadFileChunk(e,t,i,a)};this.uploadFile=async e=>{r.throwBatchIncompatible("DynamicsWebApi.uploadFile",this._isBatch),r.parameterCheck(e,"DynamicsWebApi.uploadFile","request");let t=l.copyRequest(e,["data"]);t.method="PATCH",t.functionName="uploadFile",t.transferMode="chunked";let i=await this._makeRequest(t);return t.url=i?.data.location,delete t.transferMode,delete t.fieldName,delete t.property,delete t.fileName,this._uploadFileChunk(t,e.data,i?.data.chunkSize)};this._downloadFileChunk=async(e,t=0,i="")=>{e.range="bytes="+t+"-"+(t+l.downloadChunkSize-1),e.downloadSize="full";let a=await this._makeRequest(e);return e.url=a?.data.location,i+=a?.data.value,t+=l.downloadChunkSize,t<=a?.data.fileSize?this._downloadFileChunk(e,t,i):{fileName:a?.data.fileName,fileSize:a?.data.fileSize,data:l.convertToFileBuffer(i)}};this.downloadFile=e=>{r.throwBatchIncompatible("DynamicsWebApi.downloadFile",this._isBatch),r.parameterCheck(e,"DynamicsWebApi.downloadFile","request");let t=l.copyRequest(e);return t.method="GET",t.functionName="downloadFile",t.responseParameters={parse:!0},this._downloadFileChunk(t)};this.retrieveMultiple=async(e,t)=>{r.parameterCheck(e,"DynamicsWebApi.retrieveMultiple","request");let i;return e.functionName?i=e:(i=l.copyRequest(e),i.functionName="retrieveMultiple"),i.method="GET",t&&(r.stringParameterCheck(t,"DynamicsWebApi.retrieveMultiple","nextPageLink"),i.url=t),(await this._makeRequest(i))?.data};this._retrieveAllRequest=async(e,t,i=[])=>{let a=await this.retrieveMultiple(e,t);i=i.concat(a.value);let s=a.oDataNextLink;if(s)return this._retrieveAllRequest(e,s,i);let o={value:i};return a.oDataDeltaLink&&(o["@odata.deltaLink"]=a.oDataDeltaLink,o.oDataDeltaLink=a.oDataDeltaLink),o};this.retrieveAll=e=>(r.throwBatchIncompatible("DynamicsWebApi.retrieveAll",this._isBatch),this._retrieveAllRequest(e));this.count=async e=>{r.parameterCheck(e,"DynamicsWebApi.count","request");let t=l.copyRequest(e);return t.method="GET",t.functionName="count",t.filter?.length?t.count=!0:t.navigationProperty="$count",t.responseParameters={toCount:t.count},(await this._makeRequest(t))?.data};this.countAll=async e=>{r.throwBatchIncompatible("DynamicsWebApi.countAll",this._isBatch),r.parameterCheck(e,"DynamicsWebApi.countAll","request");let t=await this._retrieveAllRequest(e);return t&&t.value?t.value.length:0};this.fetch=async e=>{r.parameterCheck(e,"DynamicsWebApi.fetch","request");let t=l.copyRequest(e);if(t.method="GET",t.functionName="fetch",r.stringParameterCheck(t.fetchXml,"DynamicsWebApi.fetch","request.fetchXml"),t.fetchXml&&!be.test(t.fetchXml)){let a="";Ae.test(t.fetchXml)||(t.pageNumber=t.pageNumber||1,r.numberParameterCheck(t.pageNumber,"DynamicsWebApi.fetch","request.pageNumber"),a=`$1 page="${t.pageNumber}"`),t.pagingCookie!=null&&(r.stringParameterCheck(t.pagingCookie,"DynamicsWebApi.fetch","request.pagingCookie"),a+=` paging-cookie="${t.pagingCookie}"`),a&&(t.fetchXml=t.fetchXml.replace(Ce,a))}return t.responseParameters={pageNumber:t.pageNumber},(await this._makeRequest(t))?.data};this.fetchAll=async e=>{r.parameterCheck(e,"DynamicsWebApi.fetchAll","request");let t=async(i,a=[])=>{let s=await this.fetch(i);return a=a.concat(s.value),s.PagingInfo?(i.pageNumber=s.PagingInfo.nextPage,i.pagingCookie=s.PagingInfo.cookie,t(i,a)):{value:a}};return r.throwBatchIncompatible("DynamicsWebApi.fetchAll",this._isBatch),t(e)};this.associate=async e=>{r.parameterCheck(e,"DynamicsWebApi.associate","request");let t=l.copyRequest(e);t.method="POST",t.functionName="associate",r.stringParameterCheck(e.relatedCollection,"DynamicsWebApi.associate","request.relatedcollection"),r.stringParameterCheck(e.relationshipName,"DynamicsWebApi.associate","request.relationshipName");let i=r.keyParameterCheck(e.primaryKey,"DynamicsWebApi.associate","request.primaryKey"),a=r.keyParameterCheck(e.relatedKey,"DynamicsWebApi.associate","request.relatedKey");t.navigationProperty=e.relationshipName+"/$ref",t.key=i,t.data={"@odata.id":`${e.relatedCollection}(${a})`},await this._makeRequest(t)};this.disassociate=async e=>{r.parameterCheck(e,"DynamicsWebApi.disassociate","request");let t=l.copyRequest(e);t.method="DELETE",t.functionName="disassociate",r.stringParameterCheck(e.relationshipName,"DynamicsWebApi.disassociate","request.relationshipName");let i=r.keyParameterCheck(e.primaryKey,"DynamicsWebApi.disassociate","request.primaryKey"),a=r.keyParameterCheck(e.relatedKey,"DynamicsWebApi.disassociate","request.relatedId");t.key=i,t.navigationProperty=`${e.relationshipName}(${a})/$ref`,await this._makeRequest(t)};this.associateSingleValued=async e=>{r.parameterCheck(e,"DynamicsWebApi.associateSingleValued","request");let t=l.copyRequest(e);t.method="PUT",t.functionName="associateSingleValued";let i=r.keyParameterCheck(e.primaryKey,"DynamicsWebApi.associateSingleValued","request.primaryKey"),a=r.keyParameterCheck(e.relatedKey,"DynamicsWebApi.associateSingleValued","request.relatedKey");r.stringParameterCheck(e.navigationProperty,"DynamicsWebApi.associateSingleValued","request.navigationProperty"),r.stringParameterCheck(e.relatedCollection,"DynamicsWebApi.associateSingleValued","request.relatedcollection"),t.navigationProperty+="/$ref",t.key=i,t.data={"@odata.id":`${e.relatedCollection}(${a})`},await this._makeRequest(t)};this.disassociateSingleValued=async e=>{r.parameterCheck(e,"DynamicsWebApi.disassociateSingleValued","request");let t=l.copyRequest(e);t.method="DELETE",t.functionName="disassociateSingleValued";let i=r.keyParameterCheck(e.primaryKey,"DynamicsWebApi.disassociateSingleValued","request.primaryKey");r.stringParameterCheck(e.navigationProperty,"DynamicsWebApi.disassociateSingleValued","request.navigationProperty"),t.navigationProperty+="/$ref",t.key=i,await this._makeRequest(t)};this.callFunction=async e=>{r.parameterCheck(e,"DynamicsWebApi.callFunction","request");let t=p=>p.name||p.functionName,i=typeof e!="string",a=i?t(e):e,s=i?"request.name":"name",o=i?l.copyObject(e,["name"]):{functionName:a};r.stringParameterCheck(a,"DynamicsWebApi.callFunction",s);let c=l.buildFunctionParameters(o.parameters);return o.method="GET",o.addPath=a+c.key,o.queryParams=c.queryParams,o._isUnboundRequest=!o.collection,o.functionName="callFunction",(await this._makeRequest(o))?.data};this.callAction=async e=>{r.parameterCheck(e,"DynamicsWebApi.callAction","request"),r.stringParameterCheck(e.actionName,"DynamicsWebApi.callAction","request.actionName");let t=l.copyRequest(e,["action"]);return t.method="POST",t.functionName="callAction",t.addPath=e.actionName,t._isUnboundRequest=!t.collection,t.data=e.action,(await this._makeRequest(t))?.data};this.createEntity=e=>{r.parameterCheck(e,"DynamicsWebApi.createEntity","request"),r.parameterCheck(e.data,"DynamicsWebApi.createEntity","request.data");let t=l.copyRequest(e);return t.collection="EntityDefinitions",t.functionName="createEntity",this.create(t)};this.updateEntity=e=>{r.parameterCheck(e,"DynamicsWebApi.updateEntity","request"),r.parameterCheck(e.data,"DynamicsWebApi.updateEntity","request.data"),r.guidParameterCheck(e.data.MetadataId,"DynamicsWebApi.updateEntity","request.data.MetadataId");let t=l.copyRequest(e);return t.collection="EntityDefinitions",t.key=t.data.MetadataId,t.functionName="updateEntity",t.method="PUT",this.update(t)};this.retrieveEntity=e=>{r.parameterCheck(e,"DynamicsWebApi.retrieveEntity","request"),r.keyParameterCheck(e.key,"DynamicsWebApi.retrieveEntity","request.key");let t=l.copyRequest(e);return t.collection="EntityDefinitions",t.functionName="retrieveEntity",this.retrieve(t)};this.retrieveEntities=e=>{let t=e?l.copyRequest(e):{};return t.collection="EntityDefinitions",t.functionName="retrieveEntities",this.retrieveMultiple(t)};this.createAttribute=e=>{r.parameterCheck(e,"DynamicsWebApi.createAttribute","request"),r.parameterCheck(e.data,"DynamicsWebApi.createAttribute","request.data"),r.keyParameterCheck(e.entityKey,"DynamicsWebApi.createAttribute","request.entityKey");let t=l.copyRequest(e);return t.collection="EntityDefinitions",t.functionName="retrieveEntity",t.navigationProperty="Attributes",t.key=e.entityKey,this.create(t)};this.updateAttribute=e=>{r.parameterCheck(e,"DynamicsWebApi.updateAttribute","request"),r.parameterCheck(e.data,"DynamicsWebApi.updateAttribute","request.data"),r.keyParameterCheck(e.entityKey,"DynamicsWebApi.updateAttribute","request.entityKey"),r.guidParameterCheck(e.data.MetadataId,"DynamicsWebApi.updateAttribute","request.data.MetadataId"),e.castType&&r.stringParameterCheck(e.castType,"DynamicsWebApi.updateAttribute","request.castType");let t=l.copyRequest(e);return t.collection="EntityDefinitions",t.navigationProperty="Attributes",t.navigationPropertyKey=e.data.MetadataId,t.metadataAttributeType=e.castType,t.key=e.entityKey,t.functionName="updateAttribute",t.method="PUT",this.update(t)};this.retrieveAttributes=e=>{r.parameterCheck(e,"DynamicsWebApi.retrieveAttributes","request"),r.keyParameterCheck(e.entityKey,"DynamicsWebApi.retrieveAttributes","request.entityKey"),e.castType&&r.stringParameterCheck(e.castType,"DynamicsWebApi.retrieveAttributes","request.castType");let t=l.copyRequest(e);return t.collection="EntityDefinitions",t.navigationProperty="Attributes",t.metadataAttributeType=e.castType,t.key=e.entityKey,t.functionName="retrieveAttributes",this.retrieveMultiple(t)};this.retrieveAttribute=e=>{r.parameterCheck(e,"DynamicsWebApi.retrieveAttributes","request"),r.keyParameterCheck(e.entityKey,"DynamicsWebApi.retrieveAttribute","request.entityKey"),r.keyParameterCheck(e.attributeKey,"DynamicsWebApi.retrieveAttribute","request.attributeKey"),e.castType&&r.stringParameterCheck(e.castType,"DynamicsWebApi.retrieveAttribute","request.castType");let t=l.copyRequest(e);return t.collection="EntityDefinitions",t.navigationProperty="Attributes",t.navigationPropertyKey=e.attributeKey,t.metadataAttributeType=e.castType,t.key=e.entityKey,t.functionName="retrieveAttribute",this.retrieve(t)};this.createRelationship=e=>{r.parameterCheck(e,"DynamicsWebApi.createRelationship","request"),r.parameterCheck(e.data,"DynamicsWebApi.createRelationship","request.data");let t=l.copyRequest(e);return t.collection="RelationshipDefinitions",t.functionName="createRelationship",this.create(t)};this.updateRelationship=e=>{r.parameterCheck(e,"DynamicsWebApi.updateRelationship","request"),r.parameterCheck(e.data,"DynamicsWebApi.updateRelationship","request.data"),r.guidParameterCheck(e.data.MetadataId,"DynamicsWebApi.updateRelationship","request.data.MetadataId"),e.castType&&r.stringParameterCheck(e.castType,"DynamicsWebApi.updateRelationship","request.castType");let t=l.copyRequest(e);return t.collection="RelationshipDefinitions",t.key=e.data.MetadataId,t.navigationProperty=e.castType,t.functionName="updateRelationship",t.method="PUT",this.update(t)};this.deleteRelationship=e=>{r.parameterCheck(e,"DynamicsWebApi.deleteRelationship","request"),r.keyParameterCheck(e.key,"DynamicsWebApi.deleteRelationship","request.key");let t=l.copyRequest(e);return t.collection="RelationshipDefinitions",t.functionName="deleteRelationship",this.deleteRecord(t)};this.retrieveRelationships=e=>{let t=e?l.copyRequest(e):{};return t.collection="RelationshipDefinitions",t.functionName="retrieveRelationships",e&&e.castType&&(r.stringParameterCheck(e.castType,"DynamicsWebApi.retrieveRelationships","request.castType"),t.navigationProperty=e.castType),this.retrieveMultiple(t)};this.retrieveRelationship=e=>{r.parameterCheck(e,"DynamicsWebApi.retrieveRelationship","request"),r.keyParameterCheck(e.key,"DynamicsWebApi.retrieveRelationship","request.key"),e.castType&&r.stringParameterCheck(e.castType,"DynamicsWebApi.retrieveRelationship","request.castType");let t=l.copyRequest(e);return t.collection="RelationshipDefinitions",t.navigationProperty=e.castType,t.functionName="retrieveRelationship",this.retrieve(t)};this.createGlobalOptionSet=e=>{r.parameterCheck(e,"DynamicsWebApi.createGlobalOptionSet","request"),r.parameterCheck(e.data,"DynamicsWebApi.createGlobalOptionSet","request.data");let t=l.copyRequest(e);return t.collection="GlobalOptionSetDefinitions",t.functionName="createGlobalOptionSet",this.create(t)};this.updateGlobalOptionSet=e=>{r.parameterCheck(e,"DynamicsWebApi.updateGlobalOptionSet","request"),r.parameterCheck(e.data,"DynamicsWebApi.updateGlobalOptionSet","request.data"),r.guidParameterCheck(e.data.MetadataId,"DynamicsWebApi.updateGlobalOptionSet","request.data.MetadataId"),e.castType&&r.stringParameterCheck(e.castType,"DynamicsWebApi.updateGlobalOptionSet","request.castType");let t=l.copyRequest(e);return t.collection="GlobalOptionSetDefinitions",t.key=e.data.MetadataId,t.functionName="updateGlobalOptionSet",t.method="PUT",this.update(t)};this.deleteGlobalOptionSet=e=>{r.parameterCheck(e,"DynamicsWebApi.deleteGlobalOptionSet","request");let t=l.copyRequest(e);return t.collection="GlobalOptionSetDefinitions",t.functionName="deleteGlobalOptionSet",this.deleteRecord(t)};this.retrieveGlobalOptionSet=e=>{r.parameterCheck(e,"DynamicsWebApi.retrieveGlobalOptionSet","request"),e.castType&&r.stringParameterCheck(e.castType,"DynamicsWebApi.retrieveGlobalOptionSet","request.castType");let t=l.copyRequest(e);return t.collection="GlobalOptionSetDefinitions",t.navigationProperty=e.castType,t.functionName="retrieveGlobalOptionSet",this.retrieve(t)};this.retrieveGlobalOptionSets=e=>{let t=e?l.copyRequest(e):{};return t.collection="GlobalOptionSetDefinitions",t.functionName="retrieveGlobalOptionSets",e?.castType&&(r.stringParameterCheck(e.castType,"DynamicsWebApi.retrieveGlobalOptionSets","request.castType"),t.navigationProperty=e.castType),this.retrieveMultiple(t)};this.retrieveCsdlMetadata=async e=>{let t=e?l.copyRequest(e):{};return t.collection="$metadata",t.functionName="retrieveCsdlMetadata",e?.addAnnotations&&(r.boolParameterCheck(e.addAnnotations,"DynamicsWebApi.retrieveCsdlMetadata","request.addAnnotations"),t.includeAnnotations="*"),(await this._makeRequest(t))?.data};this.search=async e=>{r.parameterCheck(e,"DynamicsWebApi.search","request");let t=l.isObject(e),i=t?"request.query.search":"term",a=t?l.copyObject(e):{query:{search:e}};return r.parameterCheck(a.query,"DynamicsWebApi.search","request.query"),r.stringParameterCheck(a.query.search,"DynamicsWebApi.search",i),r.maxLengthStringParameterCheck(a.query.search,"DynamicsWebApi.search",i,100),a.collection="query",a.functionName="search",a.method="POST",a.data=a.query,a.apiConfig=this._config.searchApi,delete a.query,(await this._makeRequest(a))?.data};this.suggest=async e=>{r.parameterCheck(e,"DynamicsWebApi.suggest","request");let t=l.isObject(e),i=t?"request.query.search":"term",a=t?l.copyObject(e):{query:{search:e}};return r.parameterCheck(a.query,"DynamicsWebApi.suggest","request.query"),r.stringParameterCheck(a.query.search,"DynamicsWebApi.suggest",i),r.maxLengthStringParameterCheck(a.query.search,"DynamicsWebApi.suggest",i,100),a.functionName=a.collection="suggest",a.method="POST",a.data=a.query,a.apiConfig=this._config.searchApi,delete a.query,(await this._makeRequest(a))?.data};this.autocomplete=async e=>{r.parameterCheck(e,"DynamicsWebApi.autocomplete","request");let t=l.isObject(e),i=t?"request.query.search":"term",a=t?l.copyObject(e):{query:{search:e}};return t&&r.parameterCheck(a.query,"DynamicsWebApi.autocomplete","request.query"),r.stringParameterCheck(a.query.search,"DynamicsWebApi.autocomplete",i),r.maxLengthStringParameterCheck(a.query.search,"DynamicsWebApi.autocomplete",i,100),a.functionName=a.collection="autocomplete",a.method="POST",a.data=a.query,a.apiConfig=this._config.searchApi,delete a.query,(await this._makeRequest(a))?.data};this.startBatch=()=>{this._isBatch=!0,this._batchRequestId=l.generateUUID()};this.executeBatch=async e=>{r.throwBatchNotStarted(this._isBatch);let t=e?l.copyRequest(e):{};return t.collection="$batch",t.method="POST",t.functionName="executeBatch",t.requestId=this._batchRequestId,this._batchRequestId=null,this._isBatch=!1,(await this._makeRequest(t))?.data};this.initializeInstance=e=>new n(e||this._config);this.Utility={getCollectionName:e=>v.getCollectionName(e)};P.merge(this._config,e)}};return re(Nt);})();
var DynamicsWebApi = _dynamicsWebApiExports.DynamicsWebApi
//# sourceMappingURL=dynamics-web-api.min.js.map
{
"name": "dynamics-web-api",
"version": "2.2.0",
"version": "2.2.1",
"description": "DynamicsWebApi is a Microsoft Dataverse Web API helper library",

@@ -5,0 +5,0 @@ "keywords": [

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 too big to display

Sorry, the diff of this file is too big to display