UNPKG

liferay-headless-rest-client

Version:
2 lines (1 loc) 16.6 kB
var x=async(F,Z)=>{let G=typeof Z=="function"?await Z(F):Z;if(G)return F.scheme==="bearer"?`Bearer ${G}`:F.scheme==="basic"?`Basic ${btoa(G)}`:G},O=(F,Z,G)=>{typeof G=="string"||G instanceof Blob?F.append(Z,G):F.append(Z,JSON.stringify(G))};var h={bodySerializer:(F)=>{let Z=new FormData;return Object.entries(F).forEach(([G,E])=>{E!=null&&(Array.isArray(E)?E.forEach((B)=>O(Z,G,B)):O(Z,G,E))}),Z}},w={bodySerializer:(F)=>JSON.stringify(F,(Z,G)=>typeof G=="bigint"?G.toString():G)};var m=(F)=>{switch(F){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},b=(F)=>{switch(F){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},d=(F)=>{switch(F){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},R=({allowReserved:F,explode:Z,name:G,style:E,value:B})=>{if(!Z){let V=(F?B:B.map((J)=>encodeURIComponent(J))).join(b(E));switch(E){case"label":return`.${V}`;case"matrix":return`;${G}=${V}`;case"simple":return V;default:return`${G}=${V}`}}let H=m(E),k=B.map((V)=>E==="label"||E==="simple"?F?V:encodeURIComponent(V):D({allowReserved:F,name:G,value:V})).join(H);return E==="label"||E==="matrix"?H+k:k},D=({allowReserved:F,name:Z,value:G})=>{if(G==null)return"";if(typeof G=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${Z}=${F?G:encodeURIComponent(G)}`},S=({allowReserved:F,explode:Z,name:G,style:E,value:B})=>{if(B instanceof Date)return`${G}=${B.toISOString()}`;if(E!=="deepObject"&&!Z){let V=[];Object.entries(B).forEach(([P,M])=>{V=[...V,P,F?M:encodeURIComponent(M)]});let J=V.join(",");switch(E){case"form":return`${G}=${J}`;case"label":return`.${J}`;case"matrix":return`;${G}=${J}`;default:return J}}let H=d(E),k=Object.entries(B).map(([V,J])=>D({allowReserved:F,name:E==="deepObject"?`${G}[${V}]`:V,value:J})).join(H);return E==="label"||E==="matrix"?H+k:k},g=/\{[^{}]+\}/g,f=({path:F,url:Z})=>{let G=Z,E=Z.match(g);if(E)for(let B of E){let H=!1,k=B.substring(1,B.length-1),V="simple";k.endsWith("*")&&(H=!0,k=k.substring(0,k.length-1)),k.startsWith(".")?(k=k.substring(1),V="label"):k.startsWith(";")&&(k=k.substring(1),V="matrix");let J=F[k];if(J==null)continue;if(Array.isArray(J)){G=G.replace(B,R({explode:H,name:k,style:V,value:J}));continue}if(typeof J=="object"){G=G.replace(B,S({explode:H,name:k,style:V,value:J}));continue}if(V==="matrix"){G=G.replace(B,`;${D({name:k,value:J})}`);continue}let P=encodeURIComponent(V==="label"?`.${J}`:J);G=G.replace(B,P)}return G},v=({allowReserved:F,array:Z,object:G}={})=>(E)=>{let B=[];if(E&&typeof E=="object")for(let H in E){let k=E[H];if(k!=null)if(Array.isArray(k)){let V=R({allowReserved:F,explode:!0,name:H,style:"form",value:k,...Z});V&&B.push(V)}else if(typeof k=="object"){let V=S({allowReserved:F,explode:!0,name:H,style:"deepObject",value:k,...G});V&&B.push(V)}else{let V=D({allowReserved:F,name:H,value:k});V&&B.push(V)}}return B.join("&")},u=(F)=>{if(!F)return"stream";let Z=F.split(";")[0]?.trim();if(Z){if(Z.startsWith("application/json")||Z.endsWith("+json"))return"json";if(Z==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some((G)=>Z.startsWith(G)))return"blob";if(Z.startsWith("text/"))return"text"}},c=async({security:F,...Z})=>{for(let G of F){let E=await x(G,Z.auth);if(!E)continue;let B=G.name??"Authorization";switch(G.in){case"query":Z.query||(Z.query={}),Z.query[B]=E;break;case"cookie":Z.headers.append("Cookie",`${B}=${E}`);break;case"header":default:Z.headers.set(B,E);break}return}},U=(F)=>_({baseUrl:F.baseUrl,path:F.path,query:F.query,querySerializer:typeof F.querySerializer=="function"?F.querySerializer:v(F.querySerializer),url:F.url}),_=({baseUrl:F,path:Z,query:G,querySerializer:E,url:B})=>{let H=B.startsWith("/")?B:`/${B}`,k=(F??"")+H;Z&&(k=f({path:Z,url:k}));let V=G?E(G):"";return V.startsWith("?")&&(V=V.substring(1)),V&&(k+=`?${V}`),k},Y=(F,Z)=>{let G={...F,...Z};return G.baseUrl?.endsWith("/")&&(G.baseUrl=G.baseUrl.substring(0,G.baseUrl.length-1)),G.headers=z(F.headers,Z.headers),G},z=(...F)=>{let Z=new Headers;for(let G of F){if(!G||typeof G!="object")continue;let E=G instanceof Headers?G.entries():Object.entries(G);for(let[B,H]of E)if(H===null)Z.delete(B);else if(Array.isArray(H))for(let k of H)Z.append(B,k);else H!==void 0&&Z.set(B,typeof H=="object"?JSON.stringify(H):H)}return Z},I=class{_fns;constructor(){this._fns=[]}clear(){this._fns=[]}getInterceptorIndex(F){return typeof F=="number"?this._fns[F]?F:-1:this._fns.indexOf(F)}exists(F){let Z=this.getInterceptorIndex(F);return!!this._fns[Z]}eject(F){let Z=this.getInterceptorIndex(F);this._fns[Z]&&(this._fns[Z]=null)}update(F,Z){let G=this.getInterceptorIndex(F);return this._fns[G]?(this._fns[G]=Z,F):!1}use(F){return this._fns=[...this._fns,F],this._fns.length-1}},A=()=>({error:new I,request:new I,response:new I}),C=v({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),y={"Content-Type":"application/json"},N=(F={})=>({...w,headers:y,parseAs:"auto",querySerializer:C,...F}),T=(F={})=>{let Z=Y(N(),F),G=()=>({...Z}),E=(k)=>(Z=Y(Z,k),G()),B=A(),H=async(k)=>{let V={...Z,...k,fetch:k.fetch??Z.fetch??globalThis.fetch,headers:z(Z.headers,k.headers)};V.security&&await c({...V,security:V.security}),V.body&&V.bodySerializer&&(V.body=V.bodySerializer(V.body)),(V.body===void 0||V.body==="")&&V.headers.delete("Content-Type");let J=U(V),P={redirect:"follow",...V},M=new Request(J,P);for(let L of B.request._fns)L&&(M=await L(M,V));let j=V.fetch,K=await j(M);for(let L of B.response._fns)L&&(K=await L(K,M,V));let $={request:M,response:K};if(K.ok){if(K.status===204||K.headers.get("Content-Length")==="0")return V.responseStyle==="data"?{}:{data:{},...$};let L=(V.parseAs==="auto"?u(K.headers.get("Content-Type")):V.parseAs)??"json";if(L==="stream")return V.responseStyle==="data"?K.body:{data:K.body,...$};let W=await K[L]();return L==="json"&&(V.responseValidator&&await V.responseValidator(W),V.responseTransformer&&(W=await V.responseTransformer(W))),V.responseStyle==="data"?W:{data:W,...$}}let q=await K.text();try{q=JSON.parse(q)}catch{}let Q=q;for(let L of B.error._fns)L&&(Q=await L(q,K,M,V));if(Q=Q||{},V.throwOnError)throw Q;return V.responseStyle==="data"?void 0:{error:Q,...$}};return{buildUrl:U,connect:(k)=>H({...k,method:"CONNECT"}),delete:(k)=>H({...k,method:"DELETE"}),get:(k)=>H({...k,method:"GET"}),getConfig:G,head:(k)=>H({...k,method:"HEAD"}),interceptors:B,options:(k)=>H({...k,method:"OPTIONS"}),patch:(k)=>H({...k,method:"PATCH"}),post:(k)=>H({...k,method:"POST"}),put:(k)=>H({...k,method:"PUT"}),request:H,setConfig:E,trace:(k)=>H({...k,method:"TRACE"})}};var X=T(N({baseUrl:"http://localhost:8080"}));var s=(F)=>{return(F.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/assignees/metrics",...F,headers:{"Content-Type":"application/json",...F.headers}})},n=(F)=>{return(F.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/assignees",...F,headers:{"Content-Type":"application/json",...F.headers}})},t=(F)=>{return(F?.client??X).get({url:"/o/portal-workflow-metrics/v1.0/calendars",...F})},i=(F)=>{return(F?.client??X).post({url:"/o/portal-workflow-metrics/v1.0/calendars/export-batch",...F})},o=(F)=>{return(F.client??X).get({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/histograms/metrics",...F})},FF=(F)=>{return(F?.client??X).get({url:"/o/portal-workflow-metrics/v1.0/indexes",...F})},GF=(F)=>{return(F?.client??X).patch({url:"/o/portal-workflow-metrics/v1.0/indexes/refresh",...F,headers:{"Content-Type":"application/json",...F?.headers}})},VF=(F)=>{return(F?.client??X).patch({url:"/o/portal-workflow-metrics/v1.0/indexes/reindex",...F,headers:{"Content-Type":"application/json",...F?.headers}})},XF=(F)=>{return(F?.client??X).post({url:"/o/portal-workflow-metrics/v1.0/indexes/export-batch",...F})},ZF=(F)=>{return(F.client??X).delete({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/instances/{instanceId}",...F})},kF=(F)=>{return(F.client??X).get({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/instances/{instanceId}",...F})},BF=(F)=>{return(F.client??X).patch({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/instances/{instanceId}",...F,headers:{"Content-Type":"application/json",...F.headers}})},EF=(F)=>{return(F.client??X).get({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/instances",...F})},HF=(F)=>{return(F.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/instances",...F,headers:{"Content-Type":"application/json",...F.headers}})},JF=(F)=>{return(F.client??X).patch({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/instances/{instanceId}/complete",...F,headers:{"Content-Type":"application/json",...F.headers}})},KF=(F)=>{return(F.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/instances/batch",...F,headers:{"Content-Type":"application/json",...F.headers}})},LF=(F)=>{return(F.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/instances/export-batch",...F})},MF=(F)=>{return(F.client??X).get({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/nodes/metrics",...F})},PF=(F)=>{return(F.client??X).delete({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/nodes/{nodeId}",...F})},QF=(F)=>{return(F.client??X).get({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/nodes",...F})},WF=(F)=>{return(F.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/nodes",...F,headers:{"Content-Type":"application/json",...F.headers}})},$F=(F)=>{return(F.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/nodes/batch",...F,headers:{"Content-Type":"application/json",...F.headers}})},qF=(F)=>{return(F.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/nodes/export-batch",...F})},DF=(F)=>{return(F.client??X).get({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/metrics",...F})},IF=(F)=>{return(F?.client??X).get({url:"/o/portal-workflow-metrics/v1.0/processes/metrics",...F})},NF=(F)=>{return(F?.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/metrics/export-batch",...F})},OF=(F)=>{return(F.client??X).delete({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}",...F})},UF=(F)=>{return(F.client??X).get({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}",...F})},YF=(F)=>{return(F.client??X).put({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}",...F,headers:{"Content-Type":"application/json",...F.headers}})},RF=(F)=>{return(F?.client??X).delete({url:"/o/portal-workflow-metrics/v1.0/processes/batch",...F,headers:{"Content-Type":"application/json",...F?.headers}})},SF=(F)=>{return(F?.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/batch",...F,headers:{"Content-Type":"application/json",...F?.headers}})},vF=(F)=>{return(F?.client??X).put({url:"/o/portal-workflow-metrics/v1.0/processes/batch",...F,headers:{"Content-Type":"application/json",...F?.headers}})},zF=(F)=>{return(F.client??X).get({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/title",...F})},TF=(F)=>{return(F?.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes",...F,headers:{"Content-Type":"application/json",...F?.headers}})},jF=(F)=>{return(F.client??X).get({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/process-versions",...F})},xF=(F)=>{return(F.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/process-versions/export-batch",...F})},wF=(F)=>{return(F?.client??X).get({url:"/o/portal-workflow-metrics/v1.0/reindex/statuses",...F})},mF=(F)=>{return(F?.client??X).post({url:"/o/portal-workflow-metrics/v1.0/reindex/statuses/export-batch",...F})},bF=(F)=>{return(F.client??X).get({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/roles",...F})},dF=(F)=>{return(F.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/roles/export-batch",...F})},gF=(F)=>{return(F.client??X).delete({url:"/o/portal-workflow-metrics/v1.0/slas/{slaId}",...F})},fF=(F)=>{return(F.client??X).get({url:"/o/portal-workflow-metrics/v1.0/slas/{slaId}",...F})},uF=(F)=>{return(F.client??X).put({url:"/o/portal-workflow-metrics/v1.0/slas/{slaId}",...F,headers:{"Content-Type":"application/json",...F.headers}})},cF=(F)=>{return(F?.client??X).delete({url:"/o/portal-workflow-metrics/v1.0/slas/batch",...F,headers:{"Content-Type":"application/json",...F?.headers}})},_F=(F)=>{return(F?.client??X).put({url:"/o/portal-workflow-metrics/v1.0/slas/batch",...F,headers:{"Content-Type":"application/json",...F?.headers}})},AF=(F)=>{return(F.client??X).get({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/slas",...F})},CF=(F)=>{return(F.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/slas",...F,headers:{"Content-Type":"application/json",...F.headers}})},yF=(F)=>{return(F.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/slas/batch",...F,headers:{"Content-Type":"application/json",...F.headers}})},hF=(F)=>{return(F.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/slas/export-batch",...F})},aF=(F)=>{return(F.client??X).get({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/last-sla-result",...F})},rF=(F)=>{return(F.client??X).delete({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/tasks/{taskId}",...F})},lF=(F)=>{return(F.client??X).get({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/tasks/{taskId}",...F})},eF=(F)=>{return(F.client??X).patch({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/tasks/{taskId}",...F,headers:{"Content-Type":"application/json",...F.headers}})},pF=(F)=>{return(F.client??X).get({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/tasks",...F})},sF=(F)=>{return(F.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/tasks",...F,headers:{"Content-Type":"application/json",...F.headers}})},nF=(F)=>{return(F.client??X).patch({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/tasks/{taskId}/complete",...F,headers:{"Content-Type":"application/json",...F.headers}})},tF=(F)=>{return(F.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/tasks/batch",...F,headers:{"Content-Type":"application/json",...F.headers}})},iF=(F)=>{return(F.client??X).post({url:"/o/portal-workflow-metrics/v1.0/processes/{processId}/tasks/export-batch",...F})},oF=(F)=>{return(F?.client??X).post({url:"/o/portal-workflow-metrics/v1.0/tasks",...F,headers:{"Content-Type":"application/json",...F?.headers}})},FG=(F)=>{return(F?.client??X).get({url:"/o/portal-workflow-metrics/v1.0/time-ranges",...F})},GG=(F)=>{return(F?.client??X).post({url:"/o/portal-workflow-metrics/v1.0/time-ranges/export-batch",...F})};export{_F as putSlaBatch,uF as putSla,vF as putProcessBatch,YF as putProcess,GG as postTimeRangesPageExportBatch,oF as postTasksPage,mF as postReindexStatusesPageExportBatch,iF as postProcessTasksPageExportBatch,tF as postProcessTaskBatch,sF as postProcessTask,hF as postProcessSlasPageExportBatch,yF as postProcessSlaBatch,CF as postProcessSla,dF as postProcessRolesPageExportBatch,xF as postProcessProcessVersionsPageExportBatch,qF as postProcessNodesPageExportBatch,$F as postProcessNodeBatch,WF as postProcessNode,NF as postProcessMetricsPageExportBatch,LF as postProcessInstancesPageExportBatch,KF as postProcessInstanceBatch,HF as postProcessInstance,SF as postProcessBatch,n as postProcessAssigneesPage,s as postProcessAssigneeMetricsPage,TF as postProcess,XF as postIndexesPageExportBatch,i as postCalendarsPageExportBatch,nF as patchProcessTaskComplete,eF as patchProcessTask,JF as patchProcessInstanceComplete,BF as patchProcessInstance,VF as patchIndexReindex,GF as patchIndexRefresh,FG as getTimeRangesPage,fF as getSla,wF as getReindexStatusesPage,zF as getProcessTitle,pF as getProcessTasksPage,lF as getProcessTask,AF as getProcessSlasPage,bF as getProcessRolesPage,jF as getProcessProcessVersionsPage,QF as getProcessNodesPage,MF as getProcessNodeMetricsPage,IF as getProcessMetricsPage,DF as getProcessMetric,aF as getProcessLastSlaResult,EF as getProcessInstancesPage,kF as getProcessInstance,o as getProcessHistogramMetric,UF as getProcess,FF as getIndexesPage,t as getCalendarsPage,cF as deleteSlaBatch,gF as deleteSla,rF as deleteProcessTask,PF as deleteProcessNode,ZF as deleteProcessInstance,RF as deleteProcessBatch,OF as deleteProcess};