@algolia/ingestion 1.36.0 → 1.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,10 +4,10 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@algolia/ingestion"] = {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
- function G(){function a(o){return new Promise(d=>{let c=new XMLHttpRequest;c.open(o.method,o.url,true),Object.keys(o.headers).forEach(i=>c.setRequestHeader(i,o.headers[i]));let f=(i,e)=>setTimeout(()=>{c.abort(),d({status:0,content:e,isTimedOut:true});},i),w=f(o.connectTimeout,"Connection timeout"),T;c.onreadystatechange=()=>{c.readyState>c.OPENED&&T===void 0&&(clearTimeout(w),T=f(o.responseTimeout,"Socket timeout"));},c.onerror=()=>{c.status===0&&(clearTimeout(w),clearTimeout(T),d({content:c.responseText||"Network request failed",status:c.status,isTimedOut:false}));},c.onload=()=>{clearTimeout(w),clearTimeout(T),d({content:c.responseText,status:c.status,isTimedOut:false});},c.send(o.data);})}return {send:a}}function W(a){let o,d=`algolia-client-js-${a.key}`;function c(){return o===void 0&&(o=a.localStorage||window.localStorage),o}function f(){return JSON.parse(c().getItem(d)||"{}")}function w(i){c().setItem(d,JSON.stringify(i));}function T(){let i=a.timeToLive?a.timeToLive*1e3:null,e=f(),r=Object.fromEntries(Object.entries(e).filter(([,n])=>n.timestamp!==void 0));if(w(r),!i)return;let s=Object.fromEntries(Object.entries(r).filter(([,n])=>{let u=new Date().getTime();return !(n.timestamp+i<u)}));w(s);}return {get(i,e,r={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(T(),f()[JSON.stringify(i)])).then(s=>Promise.all([s?s.value:e(),s!==void 0])).then(([s,n])=>Promise.all([s,n||r.miss(s)])).then(([s])=>s)},set(i,e){return Promise.resolve().then(()=>{let r=f();return r[JSON.stringify(i)]={timestamp:new Date().getTime(),value:e},c().setItem(d,JSON.stringify(r)),e})},delete(i){return Promise.resolve().then(()=>{let e=f();delete e[JSON.stringify(i)],c().setItem(d,JSON.stringify(e));})},clear(){return Promise.resolve().then(()=>{c().removeItem(d);})}}}function Y(){return {get(a,o,d={miss:()=>Promise.resolve()}){return o().then(f=>Promise.all([f,d.miss(f)])).then(([f])=>f)},set(a,o){return Promise.resolve(o)},delete(a){return Promise.resolve()},clear(){return Promise.resolve()}}}function x(a){let o=[...a.caches],d=o.shift();return d===void 0?Y():{get(c,f,w={miss:()=>Promise.resolve()}){return d.get(c,f,w).catch(()=>x({caches:o}).get(c,f,w))},set(c,f){return d.set(c,f).catch(()=>x({caches:o}).set(c,f))},delete(c){return d.delete(c).catch(()=>x({caches:o}).delete(c))},clear(){return d.clear().catch(()=>x({caches:o}).clear())}}}function O(a={serializable:true}){let o={};return {get(d,c,f={miss:()=>Promise.resolve()}){let w=JSON.stringify(d);if(w in o)return Promise.resolve(a.serializable?JSON.parse(o[w]):o[w]);let T=c();return T.then(i=>f.miss(i)).then(()=>T)},set(d,c){return o[JSON.stringify(d)]=a.serializable?JSON.stringify(c):c,Promise.resolve(c)},delete(d){return delete o[JSON.stringify(d)],Promise.resolve()},clear(){return o={},Promise.resolve()}}}function Z(a){let o={value:`Algolia for JavaScript (${a})`,add(d){let c=`; ${d.segment}${d.version!==void 0?` (${d.version})`:""}`;return o.value.indexOf(c)===-1&&(o.value=`${o.value}${c}`),o}};return o}function $(a,o,d="WithinHeaders"){let c={"x-algolia-api-key":o,"x-algolia-application-id":a};return {headers(){return d==="WithinHeaders"?c:{}},queryParameters(){return d==="WithinQueryParameters"?c:{}}}}function j({func:a,validate:o,aggregator:d,error:c,timeout:f=()=>0}){let w=T=>new Promise((i,e)=>{a(T).then(async r=>(d&&await d(r),await o(r)?i(r):c&&await c.validate(r)?e(new Error(await c.message(r))):setTimeout(()=>{w(r).then(i).catch(e);},await f()))).catch(r=>{e(r);});});return w()}function B({algoliaAgents:a,client:o,version:d}){let c=Z(d).add({segment:o,version:d});return a.forEach(f=>c.add(f)),c}function J(){return {debug(a,o){return Promise.resolve()},info(a,o){return Promise.resolve()},error(a,o){return Promise.resolve()}}}var N=120*1e3;function _(a,o="up"){let d=Date.now();function c(){return o==="up"||Date.now()-d>N}function f(){return o==="timed out"&&Date.now()-d<=N}return {...a,status:o,lastUpdate:d,isUp:c,isTimedOut:f}}var M=class extends Error{name="AlgoliaError";constructor(a,o){super(a),o&&(this.name=o);}};var z=class extends M{stackTrace;constructor(a,o,d){super(a,d),this.stackTrace=o;}},ee=class extends z{constructor(a){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",a,"RetryError");}},H=class extends z{status;constructor(a,o,d,c="ApiError"){super(a,d,c),this.status=o;}},re=class extends M{response;constructor(a,o){super(a,"DeserializationError"),this.response=o;}},te=class extends H{error;constructor(a,o,d,c){super(a,o,c,"DetailedApiError"),this.error=d;}};function se(a,o,d){let c=oe(d),f=`${a.protocol}://${a.url}${a.port?`:${a.port}`:""}/${o.charAt(0)==="/"?o.substring(1):o}`;return c.length&&(f+=`?${c}`),f}function oe(a){return Object.keys(a).filter(o=>a[o]!==void 0).sort().map(o=>`${o}=${encodeURIComponent(Object.prototype.toString.call(a[o])==="[object Array]"?a[o].join(","):a[o]).replace(/\+/g,"%20")}`).join("&")}function ae(a,o){if(a.method==="GET"||a.data===void 0&&o.data===void 0)return;let d=Array.isArray(a.data)?a.data:{...a.data,...o.data};return JSON.stringify(d)}function ne(a,o,d){let c={Accept:"application/json",...a,...o,...d},f={};return Object.keys(c).forEach(w=>{let T=c[w];f[w.toLowerCase()]=T;}),f}function ie(a){try{return JSON.parse(a.content)}catch(o){throw new re(o.message,a)}}function ue({content:a,status:o},d){try{let c=JSON.parse(a);return "error"in c?new te(c.message,o,c.error,d):new H(c.message,o,d)}catch{}return new H(a,o,d)}function me({isTimedOut:a,status:o}){return !a&&~~o===0}function ce({isTimedOut:a,status:o}){return a||me({isTimedOut:a,status:o})||~~(o/100)!==2&&~~(o/100)!==4}function de({status:a}){return ~~(a/100)===2}function pe(a){return a.map(o=>F(o))}function F(a){let o=a.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...a,request:{...a.request,headers:{...a.request.headers,...o}}}}function X({hosts:a,hostsCache:o,baseHeaders:d,logger:c,baseQueryParameters:f,algoliaAgent:w,timeouts:T,requester:i,requestsCache:e,responsesCache:r}){async function s(t){let m=await Promise.all(t.map(g=>o.get(g,()=>Promise.resolve(_(g))))),p=m.filter(g=>g.isUp()),P=m.filter(g=>g.isTimedOut()),l=[...p,...P];return {hosts:l.length>0?l:t,getTimeout(g,h){return (P.length===0&&g===0?1:P.length+3+g)*h}}}async function n(t,m,p=true){let P=[],l=ae(t,m),q=ne(d,t.headers,m.headers),g=t.method==="GET"?{...t.data,...m.data}:{},h={...f,...t.queryParameters,...g};if(w.value&&(h["x-algolia-agent"]=w.value),m&&m.queryParameters)for(let E of Object.keys(m.queryParameters))!m.queryParameters[E]||Object.prototype.toString.call(m.queryParameters[E])==="[object Object]"?h[E]=m.queryParameters[E]:h[E]=m.queryParameters[E].toString();let R=0,y=async(E,v)=>{let I=E.pop();if(I===void 0)throw new ee(pe(P));let A={...T,...m.timeouts},Q={data:l,headers:q,method:t.method,url:se(I,t.path,h),connectTimeout:v(R,A.connect),responseTimeout:v(R,p?A.read:A.write)},L=U=>{let V={request:Q,response:U,host:I,triesLeft:E.length};return P.push(V),V},S=await i.send(Q);if(ce(S)){let U=L(S);return S.isTimedOut&&R++,c.info("Retryable failure",F(U)),await o.set(I,_(I,S.isTimedOut?"timed out":"down")),y(E,v)}if(de(S))return ie(S);throw L(S),ue(S,P)},D=a.filter(E=>E.accept==="readWrite"||(p?E.accept==="read":E.accept==="write")),k=await s(D);return y([...k.hosts].reverse(),k.getTimeout)}function u(t,m={}){let p=t.useReadTransporter||t.method==="GET";if(!p)return n(t,m,p);let P=()=>n(t,m);if((m.cacheable||t.cacheable)!==true)return P();let q={request:t,requestOptions:m,transporter:{queryParameters:f,headers:d}};return r.get(q,()=>e.get(q,()=>e.set(q,P()).then(g=>Promise.all([e.delete(q),g]),g=>Promise.all([e.delete(q),Promise.reject(g)])).then(([g,h])=>h)),{miss:g=>r.set(q,g)})}return {hostsCache:o,requester:i,timeouts:T,logger:c,algoliaAgent:w,baseHeaders:d,baseQueryParameters:f,hosts:a,request:u,requestsCache:e,responsesCache:r}}var C="1.36.0",b=["eu","us"];function he(a){return [{url:"data.{region}.algolia.com".replace("{region}",a),accept:"readWrite",protocol:"https"}]}function fe(a){return a.type==="onDemand"}function le(a){return a.type==="schedule"}function Pe(a){return a.type==="subscription"}function K({appId:a,apiKey:o,authMode:d,algoliaAgents:c,region:f,...w}){let T=$(a,o,d),i=X({hosts:he(f),...w,algoliaAgent:B({algoliaAgents:c,client:"Ingestion",version:C}),baseHeaders:{"content-type":"text/plain",...T.headers(),...w.baseHeaders},baseQueryParameters:{...T.queryParameters(),...w.baseQueryParameters}});return {transporter:i,appId:a,apiKey:o,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(e,r){i.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!d||d==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=e:i.baseQueryParameters["x-algolia-api-key"]=e;},async chunkedPush({indexName:e,objects:r,action:s="addObject",waitForTasks:n,batchSize:u=1e3,referenceIndexName:t},m){let p=[],P=0,l=[],q=Math.floor(u/10)||u,g=r.entries();for(let[h,R]of g)if(p.push(R),(p.length===u||h===r.length-1)&&(l.push(await this.push({indexName:e,pushTaskPayload:{action:s,records:p},referenceIndexName:t},m)),p=[]),n&&l.length>0&&(l.length%q===0||h===r.length-1)){for(let y of l.slice(P,P+q)){if(!y.eventID)throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");let D=0;await j({func:async()=>{if(y.eventID===void 0||!y.eventID)throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");return this.getEvent({runID:y.runID,eventID:y.eventID}).catch(k=>{if(k.status!==404)throw k})},validate:k=>k!==void 0,aggregator:()=>D+=1,error:{validate:()=>D>=50,message:()=>`The maximum number of retries exceeded. (${D}/50)`},timeout:()=>Math.min(D*500,5e3)});}P+=q;}return l},createAuthentication(e,r){if(!e)throw new Error("Parameter `authenticationCreate` is required when calling `createAuthentication`.");if(!e.type)throw new Error("Parameter `authenticationCreate.type` is required when calling `createAuthentication`.");if(!e.name)throw new Error("Parameter `authenticationCreate.name` is required when calling `createAuthentication`.");if(!e.input)throw new Error("Parameter `authenticationCreate.input` is required when calling `createAuthentication`.");let t={method:"POST",path:"/1/authentications",queryParameters:{},headers:{},data:e};return i.request(t,r)},createDestination(e,r){if(!e)throw new Error("Parameter `destinationCreate` is required when calling `createDestination`.");if(!e.type)throw new Error("Parameter `destinationCreate.type` is required when calling `createDestination`.");if(!e.name)throw new Error("Parameter `destinationCreate.name` is required when calling `createDestination`.");if(!e.input)throw new Error("Parameter `destinationCreate.input` is required when calling `createDestination`.");let t={method:"POST",path:"/1/destinations",queryParameters:{},headers:{},data:e};return i.request(t,r)},createSource(e,r){if(!e)throw new Error("Parameter `sourceCreate` is required when calling `createSource`.");if(!e.type)throw new Error("Parameter `sourceCreate.type` is required when calling `createSource`.");if(!e.name)throw new Error("Parameter `sourceCreate.name` is required when calling `createSource`.");let t={method:"POST",path:"/1/sources",queryParameters:{},headers:{},data:e};return i.request(t,r)},createTask(e,r){if(!e)throw new Error("Parameter `taskCreate` is required when calling `createTask`.");if(!e.sourceID)throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTask`.");if(!e.destinationID)throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTask`.");if(!e.action)throw new Error("Parameter `taskCreate.action` is required when calling `createTask`.");let t={method:"POST",path:"/2/tasks",queryParameters:{},headers:{},data:e};return i.request(t,r)},createTaskV1(e,r){if(!e)throw new Error("Parameter `taskCreate` is required when calling `createTaskV1`.");if(!e.sourceID)throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTaskV1`.");if(!e.destinationID)throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTaskV1`.");if(!e.trigger)throw new Error("Parameter `taskCreate.trigger` is required when calling `createTaskV1`.");if(!e.action)throw new Error("Parameter `taskCreate.action` is required when calling `createTaskV1`.");let t={method:"POST",path:"/1/tasks",queryParameters:{},headers:{},data:e};return i.request(t,r)},createTransformation(e,r){if(!e)throw new Error("Parameter `transformationCreate` is required when calling `createTransformation`.");if(!e.name)throw new Error("Parameter `transformationCreate.name` is required when calling `createTransformation`.");let t={method:"POST",path:"/1/transformations",queryParameters:{},headers:{},data:e};return i.request(t,r)},customDelete({path:e,parameters:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let m={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return i.request(m,s)},customGet({path:e,parameters:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let m={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return i.request(m,s)},customPost({path:e,parameters:r,body:s},n){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let p={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:s||{}};return i.request(p,n)},customPut({path:e,parameters:r,body:s},n){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let p={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:s||{}};return i.request(p,n)},deleteAuthentication({authenticationID:e},r){if(!e)throw new Error("Parameter `authenticationID` is required when calling `deleteAuthentication`.");let t={method:"DELETE",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},deleteDestination({destinationID:e},r){if(!e)throw new Error("Parameter `destinationID` is required when calling `deleteDestination`.");let t={method:"DELETE",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},deleteSource({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `deleteSource`.");let t={method:"DELETE",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},deleteTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `deleteTask`.");let t={method:"DELETE",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},deleteTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `deleteTaskV1`.");let t={method:"DELETE",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},deleteTransformation({transformationID:e},r){if(!e)throw new Error("Parameter `transformationID` is required when calling `deleteTransformation`.");let t={method:"DELETE",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},disableTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `disableTask`.");let t={method:"PUT",path:"/2/tasks/{taskID}/disable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},disableTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `disableTaskV1`.");let t={method:"PUT",path:"/1/tasks/{taskID}/disable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},enableTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `enableTask`.");let t={method:"PUT",path:"/2/tasks/{taskID}/enable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},enableTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `enableTaskV1`.");let t={method:"PUT",path:"/1/tasks/{taskID}/enable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},getAuthentication({authenticationID:e},r){if(!e)throw new Error("Parameter `authenticationID` is required when calling `getAuthentication`.");let t={method:"GET",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},getDestination({destinationID:e},r){if(!e)throw new Error("Parameter `destinationID` is required when calling `getDestination`.");let t={method:"GET",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},getEvent({runID:e,eventID:r},s){if(!e)throw new Error("Parameter `runID` is required when calling `getEvent`.");if(!r)throw new Error("Parameter `eventID` is required when calling `getEvent`.");let m={method:"GET",path:"/1/runs/{runID}/events/{eventID}".replace("{runID}",encodeURIComponent(e)).replace("{eventID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return i.request(m,s)},getRun({runID:e},r){if(!e)throw new Error("Parameter `runID` is required when calling `getRun`.");let t={method:"GET",path:"/1/runs/{runID}".replace("{runID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},getSource({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `getSource`.");let t={method:"GET",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},getTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getTask`.");let t={method:"GET",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},getTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getTaskV1`.");let t={method:"GET",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},getTransformation({transformationID:e},r){if(!e)throw new Error("Parameter `transformationID` is required when calling `getTransformation`.");let t={method:"GET",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},listAuthentications({itemsPerPage:e,page:r,type:s,platform:n,sort:u,order:t}={},m=void 0){let p="/1/authentications",P={},l={};e!==void 0&&(l.itemsPerPage=e.toString()),r!==void 0&&(l.page=r.toString()),s!==void 0&&(l.type=s.toString()),n!==void 0&&(l.platform=n.toString()),u!==void 0&&(l.sort=u.toString()),t!==void 0&&(l.order=t.toString());let q={method:"GET",path:p,queryParameters:l,headers:P};return i.request(q,m)},listDestinations({itemsPerPage:e,page:r,type:s,authenticationID:n,transformationID:u,sort:t,order:m}={},p=void 0){let P="/1/destinations",l={},q={};e!==void 0&&(q.itemsPerPage=e.toString()),r!==void 0&&(q.page=r.toString()),s!==void 0&&(q.type=s.toString()),n!==void 0&&(q.authenticationID=n.toString()),u!==void 0&&(q.transformationID=u.toString()),t!==void 0&&(q.sort=t.toString()),m!==void 0&&(q.order=m.toString());let g={method:"GET",path:P,queryParameters:q,headers:l};return i.request(g,p)},listEvents({runID:e,itemsPerPage:r,page:s,status:n,type:u,sort:t,order:m,startDate:p,endDate:P},l){if(!e)throw new Error("Parameter `runID` is required when calling `listEvents`.");let q="/1/runs/{runID}/events".replace("{runID}",encodeURIComponent(e)),g={},h={};r!==void 0&&(h.itemsPerPage=r.toString()),s!==void 0&&(h.page=s.toString()),n!==void 0&&(h.status=n.toString()),u!==void 0&&(h.type=u.toString()),t!==void 0&&(h.sort=t.toString()),m!==void 0&&(h.order=m.toString()),p!==void 0&&(h.startDate=p.toString()),P!==void 0&&(h.endDate=P.toString());let R={method:"GET",path:q,queryParameters:h,headers:g};return i.request(R,l)},listRuns({itemsPerPage:e,page:r,status:s,type:n,taskID:u,sort:t,order:m,startDate:p,endDate:P}={},l=void 0){let q="/1/runs",g={},h={};e!==void 0&&(h.itemsPerPage=e.toString()),r!==void 0&&(h.page=r.toString()),s!==void 0&&(h.status=s.toString()),n!==void 0&&(h.type=n.toString()),u!==void 0&&(h.taskID=u.toString()),t!==void 0&&(h.sort=t.toString()),m!==void 0&&(h.order=m.toString()),p!==void 0&&(h.startDate=p.toString()),P!==void 0&&(h.endDate=P.toString());let R={method:"GET",path:q,queryParameters:h,headers:g};return i.request(R,l)},listSources({itemsPerPage:e,page:r,type:s,authenticationID:n,sort:u,order:t}={},m=void 0){let p="/1/sources",P={},l={};e!==void 0&&(l.itemsPerPage=e.toString()),r!==void 0&&(l.page=r.toString()),s!==void 0&&(l.type=s.toString()),n!==void 0&&(l.authenticationID=n.toString()),u!==void 0&&(l.sort=u.toString()),t!==void 0&&(l.order=t.toString());let q={method:"GET",path:p,queryParameters:l,headers:P};return i.request(q,m)},listTasks({itemsPerPage:e,page:r,action:s,enabled:n,sourceID:u,sourceType:t,destinationID:m,triggerType:p,withEmailNotifications:P,sort:l,order:q}={},g=void 0){let h="/2/tasks",R={},y={};e!==void 0&&(y.itemsPerPage=e.toString()),r!==void 0&&(y.page=r.toString()),s!==void 0&&(y.action=s.toString()),n!==void 0&&(y.enabled=n.toString()),u!==void 0&&(y.sourceID=u.toString()),t!==void 0&&(y.sourceType=t.toString()),m!==void 0&&(y.destinationID=m.toString()),p!==void 0&&(y.triggerType=p.toString()),P!==void 0&&(y.withEmailNotifications=P.toString()),l!==void 0&&(y.sort=l.toString()),q!==void 0&&(y.order=q.toString());let D={method:"GET",path:h,queryParameters:y,headers:R};return i.request(D,g)},listTasksV1({itemsPerPage:e,page:r,action:s,enabled:n,sourceID:u,destinationID:t,triggerType:m,sort:p,order:P}={},l=void 0){let q="/1/tasks",g={},h={};e!==void 0&&(h.itemsPerPage=e.toString()),r!==void 0&&(h.page=r.toString()),s!==void 0&&(h.action=s.toString()),n!==void 0&&(h.enabled=n.toString()),u!==void 0&&(h.sourceID=u.toString()),t!==void 0&&(h.destinationID=t.toString()),m!==void 0&&(h.triggerType=m.toString()),p!==void 0&&(h.sort=p.toString()),P!==void 0&&(h.order=P.toString());let R={method:"GET",path:q,queryParameters:h,headers:g};return i.request(R,l)},listTransformations({itemsPerPage:e,page:r,sort:s,order:n}={},u=void 0){let t="/1/transformations",m={},p={};e!==void 0&&(p.itemsPerPage=e.toString()),r!==void 0&&(p.page=r.toString()),s!==void 0&&(p.sort=s.toString()),n!==void 0&&(p.order=n.toString());let P={method:"GET",path:t,queryParameters:p,headers:m};return i.request(P,u)},push({indexName:e,pushTaskPayload:r,watch:s,referenceIndexName:n},u){if(!e)throw new Error("Parameter `indexName` is required when calling `push`.");if(!r)throw new Error("Parameter `pushTaskPayload` is required when calling `push`.");if(!r.action)throw new Error("Parameter `pushTaskPayload.action` is required when calling `push`.");if(!r.records)throw new Error("Parameter `pushTaskPayload.records` is required when calling `push`.");let t="/1/push/{indexName}".replace("{indexName}",encodeURIComponent(e)),m={},p={};s!==void 0&&(p.watch=s.toString()),n!==void 0&&(p.referenceIndexName=n.toString());let P={method:"POST",path:t,queryParameters:p,headers:m,data:r};return u={timeouts:{connect:18e4,read:18e4,write:18e4,...u?.timeouts}},i.request(P,u)},pushTask({taskID:e,pushTaskPayload:r,watch:s},n){if(!e)throw new Error("Parameter `taskID` is required when calling `pushTask`.");if(!r)throw new Error("Parameter `pushTaskPayload` is required when calling `pushTask`.");if(!r.action)throw new Error("Parameter `pushTaskPayload.action` is required when calling `pushTask`.");if(!r.records)throw new Error("Parameter `pushTaskPayload.records` is required when calling `pushTask`.");let u="/2/tasks/{taskID}/push".replace("{taskID}",encodeURIComponent(e)),t={},m={};s!==void 0&&(m.watch=s.toString());let p={method:"POST",path:u,queryParameters:m,headers:t,data:r};return n={timeouts:{connect:18e4,read:18e4,write:18e4,...n?.timeouts}},i.request(p,n)},runSource({sourceID:e,runSourcePayload:r},s){if(!e)throw new Error("Parameter `sourceID` is required when calling `runSource`.");let m={method:"POST",path:"/1/sources/{sourceID}/run".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return i.request(m,s)},runTask({taskID:e,runTaskPayload:r},s){if(!e)throw new Error("Parameter `taskID` is required when calling `runTask`.");let m={method:"POST",path:"/2/tasks/{taskID}/run".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return i.request(m,s)},runTaskV1({taskID:e,runTaskPayload:r},s){if(!e)throw new Error("Parameter `taskID` is required when calling `runTaskV1`.");let m={method:"POST",path:"/1/tasks/{taskID}/run".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return i.request(m,s)},searchAuthentications(e,r){if(!e)throw new Error("Parameter `authenticationSearch` is required when calling `searchAuthentications`.");if(!e.authenticationIDs)throw new Error("Parameter `authenticationSearch.authenticationIDs` is required when calling `searchAuthentications`.");let t={method:"POST",path:"/1/authentications/search",queryParameters:{},headers:{},data:e};return i.request(t,r)},searchDestinations(e,r){if(!e)throw new Error("Parameter `destinationSearch` is required when calling `searchDestinations`.");if(!e.destinationIDs)throw new Error("Parameter `destinationSearch.destinationIDs` is required when calling `searchDestinations`.");let t={method:"POST",path:"/1/destinations/search",queryParameters:{},headers:{},data:e};return i.request(t,r)},searchSources(e,r){if(!e)throw new Error("Parameter `sourceSearch` is required when calling `searchSources`.");if(!e.sourceIDs)throw new Error("Parameter `sourceSearch.sourceIDs` is required when calling `searchSources`.");let t={method:"POST",path:"/1/sources/search",queryParameters:{},headers:{},data:e};return i.request(t,r)},searchTasks(e,r){if(!e)throw new Error("Parameter `taskSearch` is required when calling `searchTasks`.");if(!e.taskIDs)throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasks`.");let t={method:"POST",path:"/2/tasks/search",queryParameters:{},headers:{},data:e};return i.request(t,r)},searchTasksV1(e,r){if(!e)throw new Error("Parameter `taskSearch` is required when calling `searchTasksV1`.");if(!e.taskIDs)throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasksV1`.");let t={method:"POST",path:"/1/tasks/search",queryParameters:{},headers:{},data:e};return i.request(t,r)},searchTransformations(e,r){if(!e)throw new Error("Parameter `transformationSearch` is required when calling `searchTransformations`.");if(!e.transformationIDs)throw new Error("Parameter `transformationSearch.transformationIDs` is required when calling `searchTransformations`.");let t={method:"POST",path:"/1/transformations/search",queryParameters:{},headers:{},data:e};return i.request(t,r)},triggerDockerSourceDiscover({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `triggerDockerSourceDiscover`.");let t={method:"POST",path:"/1/sources/{sourceID}/discover".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r={timeouts:{connect:18e4,read:18e4,write:18e4,...r?.timeouts}},i.request(t,r)},tryTransformation(e,r){if(!e)throw new Error("Parameter `transformationTry` is required when calling `tryTransformation`.");if(!e.sampleRecord)throw new Error("Parameter `transformationTry.sampleRecord` is required when calling `tryTransformation`.");let t={method:"POST",path:"/1/transformations/try",queryParameters:{},headers:{},data:e};return i.request(t,r)},tryTransformationBeforeUpdate({transformationID:e,transformationTry:r},s){if(!e)throw new Error("Parameter `transformationID` is required when calling `tryTransformationBeforeUpdate`.");if(!r)throw new Error("Parameter `transformationTry` is required when calling `tryTransformationBeforeUpdate`.");if(!r.sampleRecord)throw new Error("Parameter `transformationTry.sampleRecord` is required when calling `tryTransformationBeforeUpdate`.");let m={method:"POST",path:"/1/transformations/{transformationID}/try".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(m,s)},updateAuthentication({authenticationID:e,authenticationUpdate:r},s){if(!e)throw new Error("Parameter `authenticationID` is required when calling `updateAuthentication`.");if(!r)throw new Error("Parameter `authenticationUpdate` is required when calling `updateAuthentication`.");let m={method:"PATCH",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(m,s)},updateDestination({destinationID:e,destinationUpdate:r},s){if(!e)throw new Error("Parameter `destinationID` is required when calling `updateDestination`.");if(!r)throw new Error("Parameter `destinationUpdate` is required when calling `updateDestination`.");let m={method:"PATCH",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(m,s)},updateSource({sourceID:e,sourceUpdate:r},s){if(!e)throw new Error("Parameter `sourceID` is required when calling `updateSource`.");if(!r)throw new Error("Parameter `sourceUpdate` is required when calling `updateSource`.");let m={method:"PATCH",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(m,s)},updateTask({taskID:e,taskUpdate:r},s){if(!e)throw new Error("Parameter `taskID` is required when calling `updateTask`.");if(!r)throw new Error("Parameter `taskUpdate` is required when calling `updateTask`.");let m={method:"PATCH",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(m,s)},updateTaskV1({taskID:e,taskUpdate:r},s){if(!e)throw new Error("Parameter `taskID` is required when calling `updateTaskV1`.");if(!r)throw new Error("Parameter `taskUpdate` is required when calling `updateTaskV1`.");let m={method:"PATCH",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(m,s)},updateTransformation({transformationID:e,transformationCreate:r},s){if(!e)throw new Error("Parameter `transformationID` is required when calling `updateTransformation`.");if(!r)throw new Error("Parameter `transformationCreate` is required when calling `updateTransformation`.");if(!r.name)throw new Error("Parameter `transformationCreate.name` is required when calling `updateTransformation`.");let m={method:"PUT",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(m,s)},validateSource(e,r=void 0){let t={method:"POST",path:"/1/sources/validate",queryParameters:{},headers:{},data:e||{}};return r={timeouts:{connect:18e4,read:18e4,write:18e4,...r?.timeouts}},i.request(t,r)},validateSourceBeforeUpdate({sourceID:e,sourceUpdate:r},s){if(!e)throw new Error("Parameter `sourceID` is required when calling `validateSourceBeforeUpdate`.");if(!r)throw new Error("Parameter `sourceUpdate` is required when calling `validateSourceBeforeUpdate`.");let m={method:"POST",path:"/1/sources/{sourceID}/validate".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return s={timeouts:{connect:18e4,read:18e4,write:18e4,...s?.timeouts}},i.request(m,s)}}}function ws(a,o,d,c){if(!a||typeof a!="string")throw new Error("`appId` is missing.");if(!o||typeof o!="string")throw new Error("`apiKey` is missing.");if(!d||d&&(typeof d!="string"||!b.includes(d)))throw new Error(`\`region\` is required and must be one of the following: ${b.join(", ")}`);return K({appId:a,apiKey:o,region:d,timeouts:{connect:25e3,read:25e3,write:25e3},logger:J(),requester:G(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:false}),hostsCache:x({caches:[W({key:`${C}-${a}`}),O()]}),...c})}
7
+ function G(){function a(o){return new Promise(d=>{let m=new XMLHttpRequest;m.open(o.method,o.url,true),Object.keys(o.headers).forEach(i=>m.setRequestHeader(i,o.headers[i]));let f=(i,e)=>setTimeout(()=>{m.abort(),d({status:0,content:e,isTimedOut:true});},i),w=f(o.connectTimeout,"Connection timeout"),T;m.onreadystatechange=()=>{m.readyState>m.OPENED&&T===void 0&&(clearTimeout(w),T=f(o.responseTimeout,"Socket timeout"));},m.onerror=()=>{m.status===0&&(clearTimeout(w),clearTimeout(T),d({content:m.responseText||"Network request failed",status:m.status,isTimedOut:false}));},m.onload=()=>{clearTimeout(w),clearTimeout(T),d({content:m.responseText,status:m.status,isTimedOut:false});},m.send(o.data);})}return {send:a}}function W(a){let o,d=`algolia-client-js-${a.key}`;function m(){return o===void 0&&(o=a.localStorage||window.localStorage),o}function f(){return JSON.parse(m().getItem(d)||"{}")}function w(i){m().setItem(d,JSON.stringify(i));}function T(){let i=a.timeToLive?a.timeToLive*1e3:null,e=f(),r=Object.fromEntries(Object.entries(e).filter(([,n])=>n.timestamp!==void 0));if(w(r),!i)return;let s=Object.fromEntries(Object.entries(r).filter(([,n])=>{let u=new Date().getTime();return !(n.timestamp+i<u)}));w(s);}return {get(i,e,r={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(T(),f()[JSON.stringify(i)])).then(s=>Promise.all([s?s.value:e(),s!==void 0])).then(([s,n])=>Promise.all([s,n||r.miss(s)])).then(([s])=>s)},set(i,e){return Promise.resolve().then(()=>{let r=f();return r[JSON.stringify(i)]={timestamp:new Date().getTime(),value:e},m().setItem(d,JSON.stringify(r)),e})},delete(i){return Promise.resolve().then(()=>{let e=f();delete e[JSON.stringify(i)],m().setItem(d,JSON.stringify(e));})},clear(){return Promise.resolve().then(()=>{m().removeItem(d);})}}}function Y(){return {get(a,o,d={miss:()=>Promise.resolve()}){return o().then(f=>Promise.all([f,d.miss(f)])).then(([f])=>f)},set(a,o){return Promise.resolve(o)},delete(a){return Promise.resolve()},clear(){return Promise.resolve()}}}function S(a){let o=[...a.caches],d=o.shift();return d===void 0?Y():{get(m,f,w={miss:()=>Promise.resolve()}){return d.get(m,f,w).catch(()=>S({caches:o}).get(m,f,w))},set(m,f){return d.set(m,f).catch(()=>S({caches:o}).set(m,f))},delete(m){return d.delete(m).catch(()=>S({caches:o}).delete(m))},clear(){return d.clear().catch(()=>S({caches:o}).clear())}}}function O(a={serializable:true}){let o={};return {get(d,m,f={miss:()=>Promise.resolve()}){let w=JSON.stringify(d);if(w in o)return Promise.resolve(a.serializable?JSON.parse(o[w]):o[w]);let T=m();return T.then(i=>f.miss(i)).then(()=>T)},set(d,m){return o[JSON.stringify(d)]=a.serializable?JSON.stringify(m):m,Promise.resolve(m)},delete(d){return delete o[JSON.stringify(d)],Promise.resolve()},clear(){return o={},Promise.resolve()}}}function Z(a){let o={value:`Algolia for JavaScript (${a})`,add(d){let m=`; ${d.segment}${d.version!==void 0?` (${d.version})`:""}`;return o.value.indexOf(m)===-1&&(o.value=`${o.value}${m}`),o}};return o}function $(a,o,d="WithinHeaders"){let m={"x-algolia-api-key":o,"x-algolia-application-id":a};return {headers(){return d==="WithinHeaders"?m:{}},queryParameters(){return d==="WithinQueryParameters"?m:{}}}}function j({func:a,validate:o,aggregator:d,error:m,timeout:f=()=>0}){let w=T=>new Promise((i,e)=>{a(T).then(async r=>(d&&await d(r),await o(r)?i(r):m&&await m.validate(r)?e(new Error(await m.message(r))):setTimeout(()=>{w(r).then(i).catch(e);},await f()))).catch(r=>{e(r);});});return w()}function B({algoliaAgents:a,client:o,version:d}){let m=Z(d).add({segment:o,version:d});return a.forEach(f=>m.add(f)),m}function J(){return {debug(a,o){return Promise.resolve()},info(a,o){return Promise.resolve()},error(a,o){return Promise.resolve()}}}var N=120*1e3;function _(a,o="up"){let d=Date.now();function m(){return o==="up"||Date.now()-d>N}function f(){return o==="timed out"&&Date.now()-d<=N}return {...a,status:o,lastUpdate:d,isUp:m,isTimedOut:f}}var M=class extends Error{name="AlgoliaError";constructor(a,o){super(a),o&&(this.name=o);}};var z=class extends M{stackTrace;constructor(a,o,d){super(a,d),this.stackTrace=o;}},ee=class extends z{constructor(a){super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",a,"RetryError");}},H=class extends z{status;constructor(a,o,d,m="ApiError"){super(a,d,m),this.status=o;}},re=class extends M{response;constructor(a,o){super(a,"DeserializationError"),this.response=o;}},te=class extends H{error;constructor(a,o,d,m){super(a,o,m,"DetailedApiError"),this.error=d;}};function se(a,o,d){let m=oe(d),f=`${a.protocol}://${a.url}${a.port?`:${a.port}`:""}/${o.charAt(0)==="/"?o.substring(1):o}`;return m.length&&(f+=`?${m}`),f}function oe(a){return Object.keys(a).filter(o=>a[o]!==void 0).sort().map(o=>`${o}=${encodeURIComponent(Object.prototype.toString.call(a[o])==="[object Array]"?a[o].join(","):a[o]).replace(/\+/g,"%20")}`).join("&")}function ae(a,o){if(a.method==="GET"||a.data===void 0&&o.data===void 0)return;let d=Array.isArray(a.data)?a.data:{...a.data,...o.data};return JSON.stringify(d)}function ne(a,o,d){let m={Accept:"application/json",...a,...o,...d},f={};return Object.keys(m).forEach(w=>{let T=m[w];f[w.toLowerCase()]=T;}),f}function ie(a){try{return JSON.parse(a.content)}catch(o){throw new re(o.message,a)}}function ue({content:a,status:o},d){try{let m=JSON.parse(a);return "error"in m?new te(m.message,o,m.error,d):new H(m.message,o,d)}catch{}return new H(a,o,d)}function ce({isTimedOut:a,status:o}){return !a&&~~o===0}function me({isTimedOut:a,status:o}){return a||ce({isTimedOut:a,status:o})||~~(o/100)!==2&&~~(o/100)!==4}function de({status:a}){return ~~(a/100)===2}function pe(a){return a.map(o=>F(o))}function F(a){let o=a.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...a,request:{...a.request,headers:{...a.request.headers,...o}}}}function X({hosts:a,hostsCache:o,baseHeaders:d,logger:m,baseQueryParameters:f,algoliaAgent:w,timeouts:T,requester:i,requestsCache:e,responsesCache:r}){async function s(t){let c=await Promise.all(t.map(g=>o.get(g,()=>Promise.resolve(_(g))))),p=c.filter(g=>g.isUp()),P=c.filter(g=>g.isTimedOut()),l=[...p,...P];return {hosts:l.length>0?l:t,getTimeout(g,h){return (P.length===0&&g===0?1:P.length+3+g)*h}}}async function n(t,c,p=true){let P=[],l=ae(t,c),q=ne(d,t.headers,c.headers),g=t.method==="GET"?{...t.data,...c.data}:{},h={...f,...t.queryParameters,...g};if(w.value&&(h["x-algolia-agent"]=w.value),c&&c.queryParameters)for(let E of Object.keys(c.queryParameters))!c.queryParameters[E]||Object.prototype.toString.call(c.queryParameters[E])==="[object Object]"?h[E]=c.queryParameters[E]:h[E]=c.queryParameters[E].toString();let R=0,y=async(E,v)=>{let I=E.pop();if(I===void 0)throw new ee(pe(P));let U={...T,...c.timeouts},Q={data:l,headers:q,method:t.method,url:se(I,t.path,h),connectTimeout:v(R,U.connect),responseTimeout:v(R,p?U.read:U.write)},L=A=>{let V={request:Q,response:A,host:I,triesLeft:E.length};return P.push(V),V},D=await i.send(Q);if(me(D)){let A=L(D);return D.isTimedOut&&R++,m.info("Retryable failure",F(A)),await o.set(I,_(I,D.isTimedOut?"timed out":"down")),y(E,v)}if(de(D))return ie(D);throw L(D),ue(D,P)},k=a.filter(E=>E.accept==="readWrite"||(p?E.accept==="read":E.accept==="write")),x=await s(k);return y([...x.hosts].reverse(),x.getTimeout)}function u(t,c={}){let p=t.useReadTransporter||t.method==="GET";if(!p)return n(t,c,p);let P=()=>n(t,c);if((c.cacheable||t.cacheable)!==true)return P();let q={request:t,requestOptions:c,transporter:{queryParameters:f,headers:d}};return r.get(q,()=>e.get(q,()=>e.set(q,P()).then(g=>Promise.all([e.delete(q),g]),g=>Promise.all([e.delete(q),Promise.reject(g)])).then(([g,h])=>h)),{miss:g=>r.set(q,g)})}return {hostsCache:o,requester:i,timeouts:T,logger:m,algoliaAgent:w,baseHeaders:d,baseQueryParameters:f,hosts:a,request:u,requestsCache:e,responsesCache:r}}var C="1.37.0",b=["eu","us"];function he(a){return [{url:"data.{region}.algolia.com".replace("{region}",a),accept:"readWrite",protocol:"https"}]}function fe(a){return a.type==="onDemand"}function le(a){return a.type==="schedule"}function Pe(a){return a.type==="subscription"}function K({appId:a,apiKey:o,authMode:d,algoliaAgents:m,region:f,...w}){let T=$(a,o,d),i=X({hosts:he(f),...w,algoliaAgent:B({algoliaAgents:m,client:"Ingestion",version:C}),baseHeaders:{"content-type":"text/plain",...T.headers(),...w.baseHeaders},baseQueryParameters:{...T.queryParameters(),...w.baseQueryParameters}});return {transporter:i,appId:a,apiKey:o,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(e,r){i.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!d||d==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=e:i.baseQueryParameters["x-algolia-api-key"]=e;},async chunkedPush({indexName:e,objects:r,action:s="addObject",waitForTasks:n,batchSize:u=1e3,referenceIndexName:t},c){let p=[],P=0,l=[],q=Math.floor(u/10)||u,g=r.entries();for(let[h,R]of g)if(p.push(R),(p.length===u||h===r.length-1)&&(l.push(await this.push({indexName:e,pushTaskPayload:{action:s,records:p},referenceIndexName:t},c)),p=[]),n&&l.length>0&&(l.length%q===0||h===r.length-1)){for(let y of l.slice(P,P+q)){if(!y.eventID)throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");let k=0;await j({func:async()=>{if(y.eventID===void 0||!y.eventID)throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");return this.getEvent({runID:y.runID,eventID:y.eventID}).catch(x=>{if(x.status!==404)throw x})},validate:x=>x!==void 0,aggregator:()=>k+=1,error:{validate:()=>k>=50,message:()=>`The maximum number of retries exceeded. (${k}/50)`},timeout:()=>Math.min(k*500,5e3)});}P+=q;}return l},createAuthentication(e,r){if(!e)throw new Error("Parameter `authenticationCreate` is required when calling `createAuthentication`.");if(!e.type)throw new Error("Parameter `authenticationCreate.type` is required when calling `createAuthentication`.");if(!e.name)throw new Error("Parameter `authenticationCreate.name` is required when calling `createAuthentication`.");if(!e.input)throw new Error("Parameter `authenticationCreate.input` is required when calling `createAuthentication`.");let t={method:"POST",path:"/1/authentications",queryParameters:{},headers:{},data:e};return i.request(t,r)},createDestination(e,r){if(!e)throw new Error("Parameter `destinationCreate` is required when calling `createDestination`.");if(!e.type)throw new Error("Parameter `destinationCreate.type` is required when calling `createDestination`.");if(!e.name)throw new Error("Parameter `destinationCreate.name` is required when calling `createDestination`.");if(!e.input)throw new Error("Parameter `destinationCreate.input` is required when calling `createDestination`.");let t={method:"POST",path:"/1/destinations",queryParameters:{},headers:{},data:e};return i.request(t,r)},createSource(e,r){if(!e)throw new Error("Parameter `sourceCreate` is required when calling `createSource`.");if(!e.type)throw new Error("Parameter `sourceCreate.type` is required when calling `createSource`.");if(!e.name)throw new Error("Parameter `sourceCreate.name` is required when calling `createSource`.");let t={method:"POST",path:"/1/sources",queryParameters:{},headers:{},data:e};return i.request(t,r)},createTask(e,r){if(!e)throw new Error("Parameter `taskCreate` is required when calling `createTask`.");if(!e.sourceID)throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTask`.");if(!e.destinationID)throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTask`.");if(!e.action)throw new Error("Parameter `taskCreate.action` is required when calling `createTask`.");let t={method:"POST",path:"/2/tasks",queryParameters:{},headers:{},data:e};return i.request(t,r)},createTaskV1(e,r){if(!e)throw new Error("Parameter `taskCreate` is required when calling `createTaskV1`.");if(!e.sourceID)throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTaskV1`.");if(!e.destinationID)throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTaskV1`.");if(!e.trigger)throw new Error("Parameter `taskCreate.trigger` is required when calling `createTaskV1`.");if(!e.action)throw new Error("Parameter `taskCreate.action` is required when calling `createTaskV1`.");let t={method:"POST",path:"/1/tasks",queryParameters:{},headers:{},data:e};return i.request(t,r)},createTransformation(e,r){if(!e)throw new Error("Parameter `transformationCreate` is required when calling `createTransformation`.");if(!e.name)throw new Error("Parameter `transformationCreate.name` is required when calling `createTransformation`.");let t={method:"POST",path:"/1/transformations",queryParameters:{},headers:{},data:e};return i.request(t,r)},customDelete({path:e,parameters:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let c={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return i.request(c,s)},customGet({path:e,parameters:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let c={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return i.request(c,s)},customPost({path:e,parameters:r,body:s},n){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let p={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:s||{}};return i.request(p,n)},customPut({path:e,parameters:r,body:s},n){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let p={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:s||{}};return i.request(p,n)},deleteAuthentication({authenticationID:e},r){if(!e)throw new Error("Parameter `authenticationID` is required when calling `deleteAuthentication`.");let t={method:"DELETE",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},deleteDestination({destinationID:e},r){if(!e)throw new Error("Parameter `destinationID` is required when calling `deleteDestination`.");let t={method:"DELETE",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},deleteSource({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `deleteSource`.");let t={method:"DELETE",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},deleteTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `deleteTask`.");let t={method:"DELETE",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},deleteTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `deleteTaskV1`.");let t={method:"DELETE",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},deleteTransformation({transformationID:e},r){if(!e)throw new Error("Parameter `transformationID` is required when calling `deleteTransformation`.");let t={method:"DELETE",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},disableTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `disableTask`.");let t={method:"PUT",path:"/2/tasks/{taskID}/disable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},disableTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `disableTaskV1`.");let t={method:"PUT",path:"/1/tasks/{taskID}/disable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},enableTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `enableTask`.");let t={method:"PUT",path:"/2/tasks/{taskID}/enable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},enableTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `enableTaskV1`.");let t={method:"PUT",path:"/1/tasks/{taskID}/enable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},getAuthentication({authenticationID:e},r){if(!e)throw new Error("Parameter `authenticationID` is required when calling `getAuthentication`.");let t={method:"GET",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},getDestination({destinationID:e},r){if(!e)throw new Error("Parameter `destinationID` is required when calling `getDestination`.");let t={method:"GET",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},getEvent({runID:e,eventID:r},s){if(!e)throw new Error("Parameter `runID` is required when calling `getEvent`.");if(!r)throw new Error("Parameter `eventID` is required when calling `getEvent`.");let c={method:"GET",path:"/1/runs/{runID}/events/{eventID}".replace("{runID}",encodeURIComponent(e)).replace("{eventID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return i.request(c,s)},getRun({runID:e},r){if(!e)throw new Error("Parameter `runID` is required when calling `getRun`.");let t={method:"GET",path:"/1/runs/{runID}".replace("{runID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},getSource({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `getSource`.");let t={method:"GET",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},getTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getTask`.");let t={method:"GET",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},getTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getTaskV1`.");let t={method:"GET",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},getTransformation({transformationID:e},r){if(!e)throw new Error("Parameter `transformationID` is required when calling `getTransformation`.");let t={method:"GET",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(t,r)},listAuthentications({itemsPerPage:e,page:r,type:s,platform:n,sort:u,order:t}={},c=void 0){let p="/1/authentications",P={},l={};e!==void 0&&(l.itemsPerPage=e.toString()),r!==void 0&&(l.page=r.toString()),s!==void 0&&(l.type=s.toString()),n!==void 0&&(l.platform=n.toString()),u!==void 0&&(l.sort=u.toString()),t!==void 0&&(l.order=t.toString());let q={method:"GET",path:p,queryParameters:l,headers:P};return i.request(q,c)},listDestinations({itemsPerPage:e,page:r,type:s,authenticationID:n,transformationID:u,sort:t,order:c}={},p=void 0){let P="/1/destinations",l={},q={};e!==void 0&&(q.itemsPerPage=e.toString()),r!==void 0&&(q.page=r.toString()),s!==void 0&&(q.type=s.toString()),n!==void 0&&(q.authenticationID=n.toString()),u!==void 0&&(q.transformationID=u.toString()),t!==void 0&&(q.sort=t.toString()),c!==void 0&&(q.order=c.toString());let g={method:"GET",path:P,queryParameters:q,headers:l};return i.request(g,p)},listEvents({runID:e,itemsPerPage:r,page:s,status:n,type:u,sort:t,order:c,startDate:p,endDate:P},l){if(!e)throw new Error("Parameter `runID` is required when calling `listEvents`.");let q="/1/runs/{runID}/events".replace("{runID}",encodeURIComponent(e)),g={},h={};r!==void 0&&(h.itemsPerPage=r.toString()),s!==void 0&&(h.page=s.toString()),n!==void 0&&(h.status=n.toString()),u!==void 0&&(h.type=u.toString()),t!==void 0&&(h.sort=t.toString()),c!==void 0&&(h.order=c.toString()),p!==void 0&&(h.startDate=p.toString()),P!==void 0&&(h.endDate=P.toString());let R={method:"GET",path:q,queryParameters:h,headers:g};return i.request(R,l)},listRuns({itemsPerPage:e,page:r,status:s,type:n,taskID:u,sort:t,order:c,startDate:p,endDate:P}={},l=void 0){let q="/1/runs",g={},h={};e!==void 0&&(h.itemsPerPage=e.toString()),r!==void 0&&(h.page=r.toString()),s!==void 0&&(h.status=s.toString()),n!==void 0&&(h.type=n.toString()),u!==void 0&&(h.taskID=u.toString()),t!==void 0&&(h.sort=t.toString()),c!==void 0&&(h.order=c.toString()),p!==void 0&&(h.startDate=p.toString()),P!==void 0&&(h.endDate=P.toString());let R={method:"GET",path:q,queryParameters:h,headers:g};return i.request(R,l)},listSources({itemsPerPage:e,page:r,type:s,authenticationID:n,sort:u,order:t}={},c=void 0){let p="/1/sources",P={},l={};e!==void 0&&(l.itemsPerPage=e.toString()),r!==void 0&&(l.page=r.toString()),s!==void 0&&(l.type=s.toString()),n!==void 0&&(l.authenticationID=n.toString()),u!==void 0&&(l.sort=u.toString()),t!==void 0&&(l.order=t.toString());let q={method:"GET",path:p,queryParameters:l,headers:P};return i.request(q,c)},listTasks({itemsPerPage:e,page:r,action:s,enabled:n,sourceID:u,sourceType:t,destinationID:c,triggerType:p,withEmailNotifications:P,sort:l,order:q}={},g=void 0){let h="/2/tasks",R={},y={};e!==void 0&&(y.itemsPerPage=e.toString()),r!==void 0&&(y.page=r.toString()),s!==void 0&&(y.action=s.toString()),n!==void 0&&(y.enabled=n.toString()),u!==void 0&&(y.sourceID=u.toString()),t!==void 0&&(y.sourceType=t.toString()),c!==void 0&&(y.destinationID=c.toString()),p!==void 0&&(y.triggerType=p.toString()),P!==void 0&&(y.withEmailNotifications=P.toString()),l!==void 0&&(y.sort=l.toString()),q!==void 0&&(y.order=q.toString());let k={method:"GET",path:h,queryParameters:y,headers:R};return i.request(k,g)},listTasksV1({itemsPerPage:e,page:r,action:s,enabled:n,sourceID:u,destinationID:t,triggerType:c,sort:p,order:P}={},l=void 0){let q="/1/tasks",g={},h={};e!==void 0&&(h.itemsPerPage=e.toString()),r!==void 0&&(h.page=r.toString()),s!==void 0&&(h.action=s.toString()),n!==void 0&&(h.enabled=n.toString()),u!==void 0&&(h.sourceID=u.toString()),t!==void 0&&(h.destinationID=t.toString()),c!==void 0&&(h.triggerType=c.toString()),p!==void 0&&(h.sort=p.toString()),P!==void 0&&(h.order=P.toString());let R={method:"GET",path:q,queryParameters:h,headers:g};return i.request(R,l)},listTransformations({itemsPerPage:e,page:r,sort:s,order:n}={},u=void 0){let t="/1/transformations",c={},p={};e!==void 0&&(p.itemsPerPage=e.toString()),r!==void 0&&(p.page=r.toString()),s!==void 0&&(p.sort=s.toString()),n!==void 0&&(p.order=n.toString());let P={method:"GET",path:t,queryParameters:p,headers:c};return i.request(P,u)},push({indexName:e,pushTaskPayload:r,watch:s,referenceIndexName:n},u){if(!e)throw new Error("Parameter `indexName` is required when calling `push`.");if(!r)throw new Error("Parameter `pushTaskPayload` is required when calling `push`.");if(!r.action)throw new Error("Parameter `pushTaskPayload.action` is required when calling `push`.");if(!r.records)throw new Error("Parameter `pushTaskPayload.records` is required when calling `push`.");let t="/1/push/{indexName}".replace("{indexName}",encodeURIComponent(e)),c={},p={};s!==void 0&&(p.watch=s.toString()),n!==void 0&&(p.referenceIndexName=n.toString());let P={method:"POST",path:t,queryParameters:p,headers:c,data:r};return u={timeouts:{connect:18e4,read:18e4,write:18e4,...u?.timeouts}},i.request(P,u)},pushTask({taskID:e,pushTaskPayload:r,watch:s},n){if(!e)throw new Error("Parameter `taskID` is required when calling `pushTask`.");if(!r)throw new Error("Parameter `pushTaskPayload` is required when calling `pushTask`.");if(!r.action)throw new Error("Parameter `pushTaskPayload.action` is required when calling `pushTask`.");if(!r.records)throw new Error("Parameter `pushTaskPayload.records` is required when calling `pushTask`.");let u="/2/tasks/{taskID}/push".replace("{taskID}",encodeURIComponent(e)),t={},c={};s!==void 0&&(c.watch=s.toString());let p={method:"POST",path:u,queryParameters:c,headers:t,data:r};return n={timeouts:{connect:18e4,read:18e4,write:18e4,...n?.timeouts}},i.request(p,n)},replaceTask({taskID:e,taskReplace:r},s){if(!e)throw new Error("Parameter `taskID` is required when calling `replaceTask`.");if(!r)throw new Error("Parameter `taskReplace` is required when calling `replaceTask`.");if(!r.destinationID)throw new Error("Parameter `taskReplace.destinationID` is required when calling `replaceTask`.");if(!r.action)throw new Error("Parameter `taskReplace.action` is required when calling `replaceTask`.");let c={method:"PUT",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(c,s)},runSource({sourceID:e,runSourcePayload:r},s){if(!e)throw new Error("Parameter `sourceID` is required when calling `runSource`.");let c={method:"POST",path:"/1/sources/{sourceID}/run".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return i.request(c,s)},runTask({taskID:e,runTaskPayload:r},s){if(!e)throw new Error("Parameter `taskID` is required when calling `runTask`.");let c={method:"POST",path:"/2/tasks/{taskID}/run".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return i.request(c,s)},runTaskV1({taskID:e,runTaskPayload:r},s){if(!e)throw new Error("Parameter `taskID` is required when calling `runTaskV1`.");let c={method:"POST",path:"/1/tasks/{taskID}/run".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return i.request(c,s)},searchAuthentications(e,r){if(!e)throw new Error("Parameter `authenticationSearch` is required when calling `searchAuthentications`.");if(!e.authenticationIDs)throw new Error("Parameter `authenticationSearch.authenticationIDs` is required when calling `searchAuthentications`.");let t={method:"POST",path:"/1/authentications/search",queryParameters:{},headers:{},data:e};return i.request(t,r)},searchDestinations(e,r){if(!e)throw new Error("Parameter `destinationSearch` is required when calling `searchDestinations`.");if(!e.destinationIDs)throw new Error("Parameter `destinationSearch.destinationIDs` is required when calling `searchDestinations`.");let t={method:"POST",path:"/1/destinations/search",queryParameters:{},headers:{},data:e};return i.request(t,r)},searchSources(e,r){if(!e)throw new Error("Parameter `sourceSearch` is required when calling `searchSources`.");if(!e.sourceIDs)throw new Error("Parameter `sourceSearch.sourceIDs` is required when calling `searchSources`.");let t={method:"POST",path:"/1/sources/search",queryParameters:{},headers:{},data:e};return i.request(t,r)},searchTasks(e,r){if(!e)throw new Error("Parameter `taskSearch` is required when calling `searchTasks`.");if(!e.taskIDs)throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasks`.");let t={method:"POST",path:"/2/tasks/search",queryParameters:{},headers:{},data:e};return i.request(t,r)},searchTasksV1(e,r){if(!e)throw new Error("Parameter `taskSearch` is required when calling `searchTasksV1`.");if(!e.taskIDs)throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasksV1`.");let t={method:"POST",path:"/1/tasks/search",queryParameters:{},headers:{},data:e};return i.request(t,r)},searchTransformations(e,r){if(!e)throw new Error("Parameter `transformationSearch` is required when calling `searchTransformations`.");if(!e.transformationIDs)throw new Error("Parameter `transformationSearch.transformationIDs` is required when calling `searchTransformations`.");let t={method:"POST",path:"/1/transformations/search",queryParameters:{},headers:{},data:e};return i.request(t,r)},triggerDockerSourceDiscover({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `triggerDockerSourceDiscover`.");let t={method:"POST",path:"/1/sources/{sourceID}/discover".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r={timeouts:{connect:18e4,read:18e4,write:18e4,...r?.timeouts}},i.request(t,r)},tryTransformation(e,r){if(!e)throw new Error("Parameter `transformationTry` is required when calling `tryTransformation`.");if(!e.sampleRecord)throw new Error("Parameter `transformationTry.sampleRecord` is required when calling `tryTransformation`.");let t={method:"POST",path:"/1/transformations/try",queryParameters:{},headers:{},data:e};return i.request(t,r)},tryTransformationBeforeUpdate({transformationID:e,transformationTry:r},s){if(!e)throw new Error("Parameter `transformationID` is required when calling `tryTransformationBeforeUpdate`.");if(!r)throw new Error("Parameter `transformationTry` is required when calling `tryTransformationBeforeUpdate`.");if(!r.sampleRecord)throw new Error("Parameter `transformationTry.sampleRecord` is required when calling `tryTransformationBeforeUpdate`.");let c={method:"POST",path:"/1/transformations/{transformationID}/try".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(c,s)},updateAuthentication({authenticationID:e,authenticationUpdate:r},s){if(!e)throw new Error("Parameter `authenticationID` is required when calling `updateAuthentication`.");if(!r)throw new Error("Parameter `authenticationUpdate` is required when calling `updateAuthentication`.");let c={method:"PATCH",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(c,s)},updateDestination({destinationID:e,destinationUpdate:r},s){if(!e)throw new Error("Parameter `destinationID` is required when calling `updateDestination`.");if(!r)throw new Error("Parameter `destinationUpdate` is required when calling `updateDestination`.");let c={method:"PATCH",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(c,s)},updateSource({sourceID:e,sourceUpdate:r},s){if(!e)throw new Error("Parameter `sourceID` is required when calling `updateSource`.");if(!r)throw new Error("Parameter `sourceUpdate` is required when calling `updateSource`.");let c={method:"PATCH",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(c,s)},updateTask({taskID:e,taskUpdate:r},s){if(!e)throw new Error("Parameter `taskID` is required when calling `updateTask`.");if(!r)throw new Error("Parameter `taskUpdate` is required when calling `updateTask`.");let c={method:"PATCH",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(c,s)},updateTaskV1({taskID:e,taskUpdate:r},s){if(!e)throw new Error("Parameter `taskID` is required when calling `updateTaskV1`.");if(!r)throw new Error("Parameter `taskUpdate` is required when calling `updateTaskV1`.");let c={method:"PATCH",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(c,s)},updateTransformation({transformationID:e,transformationCreate:r},s){if(!e)throw new Error("Parameter `transformationID` is required when calling `updateTransformation`.");if(!r)throw new Error("Parameter `transformationCreate` is required when calling `updateTransformation`.");if(!r.name)throw new Error("Parameter `transformationCreate.name` is required when calling `updateTransformation`.");let c={method:"PUT",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(c,s)},validateSource(e,r=void 0){let t={method:"POST",path:"/1/sources/validate",queryParameters:{},headers:{},data:e||{}};return r={timeouts:{connect:18e4,read:18e4,write:18e4,...r?.timeouts}},i.request(t,r)},validateSourceBeforeUpdate({sourceID:e,sourceUpdate:r},s){if(!e)throw new Error("Parameter `sourceID` is required when calling `validateSourceBeforeUpdate`.");if(!r)throw new Error("Parameter `sourceUpdate` is required when calling `validateSourceBeforeUpdate`.");let c={method:"POST",path:"/1/sources/{sourceID}/validate".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return s={timeouts:{connect:18e4,read:18e4,write:18e4,...s?.timeouts}},i.request(c,s)}}}function ys(a,o,d,m){if(!a||typeof a!="string")throw new Error("`appId` is missing.");if(!o||typeof o!="string")throw new Error("`apiKey` is missing.");if(!d||d&&(typeof d!="string"||!b.includes(d)))throw new Error(`\`region\` is required and must be one of the following: ${b.join(", ")}`);return K({appId:a,apiKey:o,region:d,timeouts:{connect:25e3,read:25e3,write:25e3},logger:J(),requester:G(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:false}),hostsCache:S({caches:[W({key:`${C}-${a}`}),O()]}),...m})}
8
8
 
9
9
  exports.apiClientVersion = C;
10
- exports.ingestionClient = ws;
10
+ exports.ingestionClient = ys;
11
11
  exports.isOnDemandTrigger = fe;
12
12
  exports.isScheduleTrigger = le;
13
13
  exports.isSubscriptionTrigger = Pe;
@@ -4,7 +4,7 @@ import { createFetchRequester } from "@algolia/requester-fetch";
4
4
 
5
5
  // src/ingestionClient.ts
6
6
  import { createAuth, createIterablePromise, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
7
- var apiClientVersion = "1.36.0";
7
+ var apiClientVersion = "1.37.0";
8
8
  var REGIONS = ["eu", "us"];
9
9
  function getDefaultHosts(region) {
10
10
  const url = "data.{region}.algolia.com".replace("{region}", region);
@@ -1458,6 +1458,38 @@ function createIngestionClient({
1458
1458
  };
1459
1459
  return transporter.request(request, requestOptions);
1460
1460
  },
1461
+ /**
1462
+ * Fully updates a task by its ID, use partialUpdateTask if you only want to update a subset of fields.
1463
+ * @param replaceTask - The replaceTask object.
1464
+ * @param replaceTask.taskID - Unique identifier of a task.
1465
+ * @param replaceTask.taskReplace - The taskReplace object.
1466
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1467
+ */
1468
+ replaceTask({ taskID, taskReplace }, requestOptions) {
1469
+ if (!taskID) {
1470
+ throw new Error("Parameter `taskID` is required when calling `replaceTask`.");
1471
+ }
1472
+ if (!taskReplace) {
1473
+ throw new Error("Parameter `taskReplace` is required when calling `replaceTask`.");
1474
+ }
1475
+ if (!taskReplace.destinationID) {
1476
+ throw new Error("Parameter `taskReplace.destinationID` is required when calling `replaceTask`.");
1477
+ }
1478
+ if (!taskReplace.action) {
1479
+ throw new Error("Parameter `taskReplace.action` is required when calling `replaceTask`.");
1480
+ }
1481
+ const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
1482
+ const headers = {};
1483
+ const queryParameters = {};
1484
+ const request = {
1485
+ method: "PUT",
1486
+ path: requestPath,
1487
+ queryParameters,
1488
+ headers,
1489
+ data: taskReplace
1490
+ };
1491
+ return transporter.request(request, requestOptions);
1492
+ },
1461
1493
  /**
1462
1494
  * Runs all tasks linked to a source, only available for Shopify, BigCommerce and commercetools sources. Creates one run per task.
1463
1495
  *
@@ -1926,7 +1958,7 @@ function createIngestionClient({
1926
1958
  return transporter.request(request, requestOptions);
1927
1959
  },
1928
1960
  /**
1929
- * Updates a task by its ID.
1961
+ * Partially updates a task by its ID.
1930
1962
  * @param updateTask - The updateTask object.
1931
1963
  * @param updateTask.taskID - Unique identifier of a task.
1932
1964
  * @param updateTask.taskUpdate - The taskUpdate object.