@algolia/ingestion 1.52.1 → 1.53.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,12 +4,12 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@algolia/ingestion"] = {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
- function B(a){let o,m=`algolia-client-js-${a.key}`;function c(){return o===void 0&&(o=a.localStorage||window.localStorage),o}function P(){return JSON.parse(c().getItem(m)||"{}")}function g(i){c().setItem(m,JSON.stringify(i));}function R(){let i=a.timeToLive?a.timeToLive*1e3:null,e=P(),r=Object.fromEntries(Object.entries(e).filter(([,n])=>n.timestamp!==void 0));if(g(r),!i)return;let t=Object.fromEntries(Object.entries(r).filter(([,n])=>{let u=new Date().getTime();return !(n.timestamp+i<u)}));g(t);}return {get(i,e,r={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(R(),P()[JSON.stringify(i)])).then(t=>Promise.all([t?t.value:e(),t!==void 0])).then(([t,n])=>Promise.all([t,n||r.miss(t)])).then(([t])=>t)},set(i,e){return Promise.resolve().then(()=>{let r=P();return r[JSON.stringify(i)]={timestamp:new Date().getTime(),value:e},c().setItem(m,JSON.stringify(r)),e})},delete(i){return Promise.resolve().then(()=>{let e=P();delete e[JSON.stringify(i)],c().setItem(m,JSON.stringify(e));})},clear(){return Promise.resolve().then(()=>{c().removeItem(m);})}}}function se(){return {get(a,o,m={miss:()=>Promise.resolve()}){return o().then(P=>Promise.all([P,m.miss(P)])).then(([P])=>P)},set(a,o){return Promise.resolve(o)},delete(a){return Promise.resolve()},clear(){return Promise.resolve()}}}function x(a){let o=[...a.caches],m=o.shift();return m===void 0?se():{get(c,P,g={miss:()=>Promise.resolve()}){return m.get(c,P,g).catch(()=>x({caches:o}).get(c,P,g))},set(c,P){return m.set(c,P).catch(()=>x({caches:o}).set(c,P))},delete(c){return m.delete(c).catch(()=>x({caches:o}).delete(c))},clear(){return m.clear().catch(()=>x({caches:o}).clear())}}}function C(a={serializable:true}){let o={};return {get(m,c,P={miss:()=>Promise.resolve()}){let g=JSON.stringify(m);if(g in o)return Promise.resolve(a.serializable?JSON.parse(o[g]):o[g]);let R=c();return R.then(i=>P.miss(i)).then(()=>R)},set(m,c){return o[JSON.stringify(m)]=a.serializable?JSON.stringify(c):c,Promise.resolve(c)},delete(m){return delete o[JSON.stringify(m)],Promise.resolve()},clear(){return o={},Promise.resolve()}}}function oe(a){let o={value:`Algolia for JavaScript (${a})`,add(m){let c=`; ${m.segment}${m.version!==void 0?` (${m.version})`:""}`;return o.value.indexOf(c)===-1&&(o.value=`${o.value}${c}`),o}};return o}function J(a,o,m="WithinHeaders"){let c={"x-algolia-api-key":o,"x-algolia-application-id":a};return {headers(){return m==="WithinHeaders"?c:{}},queryParameters(){return m==="WithinQueryParameters"?c:{}}}}function z({func:a,validate:o,aggregator:m,error:c,timeout:P=()=>0}){let g=R=>new Promise((i,e)=>{a(R).then(async r=>(m&&await m(r),await o(r)?i(r):c&&await c.validate(r)?e(new Error(await c.message(r))):setTimeout(()=>{g(r).then(i).catch(e);},await P()))).catch(r=>{e(r);});});return g()}function M({algoliaAgents:a,client:o,version:m}){let c=oe(m).add({segment:o,version:m});return a.forEach(P=>c.add(P)),c}function F(){return {debug(a,o){return Promise.resolve()},info(a,o){return Promise.resolve()},error(a,o){return Promise.resolve()}}}var ae=750,$=120*1e3;function j(a,o="up"){let m=Date.now();function c(){return o==="up"||Date.now()-m>$}function P(){return o==="timed out"&&Date.now()-m<=$}return {...a,status:o,lastUpdate:m,isUp:c,isTimedOut:P}}var X=class extends Error{name="AlgoliaError";constructor(a,o){super(a),o&&(this.name=o);}};var K=class extends X{stackTrace;constructor(a,o,m){super(a,m),this.stackTrace=o;}},ne=class extends K{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");}},Q=class extends K{status;constructor(a,o,m,c="ApiError"){super(a,m,c),this.status=o;}},ie=class extends X{response;constructor(a,o){super(a,"DeserializationError"),this.response=o;}},ue=class extends Q{error;constructor(a,o,m,c){super(a,o,c,"DetailedApiError"),this.error=m;}};function ce(a,o,m){let c=me(m),P=`${a.protocol}://${a.url}${a.port?`:${a.port}`:""}/${o.charAt(0)==="/"?o.substring(1):o}`;return c.length&&(P+=`?${c}`),P}function me(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 de(a,o){if(a.method==="GET"||a.data===void 0&&o.data===void 0)return;let m=Array.isArray(a.data)?a.data:{...a.data,...o.data};return JSON.stringify(m)}function pe(a,o,m){let c={Accept:"application/json",...a,...o,...m},P={};return Object.keys(c).forEach(g=>{let R=c[g];P[g.toLowerCase()]=R;}),P}function he(a){try{return JSON.parse(a.content)}catch(o){throw new ie(o.message,a)}}function fe({content:a,status:o},m){try{let c=JSON.parse(a);return "error"in c?new ue(c.message,o,c.error,m):new Q(c.message,o,m)}catch{}return new Q(a,o,m)}function le({isTimedOut:a,status:o}){return !a&&~~o===0}function Pe({isTimedOut:a,status:o}){return a||le({isTimedOut:a,status:o})||~~(o/100)!==2&&~~(o/100)!==4}function qe({status:a}){return ~~(a/100)===2}function ge(a){return a.map(o=>Y(o))}function Y(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 Z({hosts:a,hostsCache:o,baseHeaders:m,logger:c,baseQueryParameters:P,algoliaAgent:g,timeouts:R,requester:i,requestsCache:e,responsesCache:r,compress:t,compression:n}){async function u(p){let h=await Promise.all(p.map(w=>o.get(w,()=>Promise.resolve(j(w))))),l=h.filter(w=>w.isUp()),q=h.filter(w=>w.isTimedOut()),y=[...l,...q];return {hosts:y.length>0?y:p,getTimeout(w,T){return (q.length===0&&w===0?1:q.length+3+w)*T}}}async function s(p,h,l){let q=[],y=de(p,h),f=pe(m,p.headers,h.headers),w=n==="gzip"&&y!==void 0&&y.length>ae&&(p.method==="POST"||p.method==="PUT");w&&t===void 0&&c.info("Compression is disabled because no compress method is available.");let T=w&&t!==void 0,k=T?await t(y):y;T&&(f["content-encoding"]="gzip");let S=p.method==="GET"?{...p.data,...h.data}:{},O={...P,...p.queryParameters,...S};if(g.value&&(O["x-algolia-agent"]=g.value),h&&h.queryParameters)for(let E of Object.keys(h.queryParameters))!h.queryParameters[E]||Object.prototype.toString.call(h.queryParameters[E])==="[object Object]"?O[E]=h.queryParameters[E]:O[E]=h.queryParameters[E].toString();let U=0,V=async(E,A)=>{let I=E.pop();if(I===void 0)throw new ne(ge(q));let H={...R,...h.timeouts},N={data:k,headers:f,method:p.method,url:ce(I,p.path,O),connectTimeout:A(U,H.connect),responseTimeout:A(U,l?H.read:H.write)},_=b=>{let W={request:N,response:b,host:I,triesLeft:E.length};return q.push(W),W},D=await i.send(N);if(Pe(D)){let b=_(D);return D.isTimedOut&&U++,c.info("Retryable failure",Y(b)),await o.set(I,j(I,D.isTimedOut?"timed out":"down")),V(E,A)}if(qe(D))return he(D);throw _(D),fe(D,q)},te=a.filter(E=>E.accept==="readWrite"||(l?E.accept==="read":E.accept==="write")),G=await u(te);return V([...G.hosts].reverse(),G.getTimeout)}function d(p,h={}){let l=()=>s(p,h,q),q=p.useReadTransporter||p.method==="GET";if((h.cacheable||p.cacheable)!==true)return l();let f={request:p,requestOptions:h,transporter:{queryParameters:P,headers:m}};return r.get(f,()=>e.get(f,()=>e.set(f,l()).then(w=>Promise.all([e.delete(f),w]),w=>Promise.all([e.delete(f),Promise.reject(w)])).then(([w,T])=>T)),{miss:w=>r.set(f,w)})}return {hostsCache:o,requester:i,timeouts:R,logger:c,algoliaAgent:g,baseHeaders:m,baseQueryParameters:P,hosts:a,request:d,requestsCache:e,responsesCache:r}}function ee(){function a(o){return new Promise(m=>{let c=new XMLHttpRequest;c.open(o.method,o.url,true),Object.keys(o.headers).forEach(i=>c.setRequestHeader(i,o.headers[i]));let P=(i,e)=>setTimeout(()=>{c.abort(),m({status:0,content:e,isTimedOut:true});},i),g=P(o.connectTimeout,"Connection timeout"),R;c.onreadystatechange=()=>{c.readyState>c.OPENED&&R===void 0&&(clearTimeout(g),R=P(o.responseTimeout,"Socket timeout"));},c.onerror=()=>{c.status===0&&(clearTimeout(g),clearTimeout(R),m({content:c.responseText||"Network request failed",status:c.status,isTimedOut:false}));},c.onload=()=>{clearTimeout(g),clearTimeout(R),m({content:c.responseText,status:c.status,isTimedOut:false});},c.send(o.data);})}return {send:a}}var v="1.52.1",L=["eu","us"];function we(a){return [{url:"data.{region}.algolia.com".replace("{region}",a),accept:"readWrite",protocol:"https"}]}function Te(a){return a.type==="onDemand"}function ye(a){return a.type==="schedule"}function Re(a){return a.type==="subscription"}function re({appId:a,apiKey:o,authMode:m,algoliaAgents:c,region:P,...g}){let R=J(a,o,m),i=Z({hosts:we(P),...g,algoliaAgent:M({algoliaAgents:c,client:"Ingestion",version:v}),baseHeaders:{"content-type":"text/plain",...R.headers(),...g.baseHeaders},baseQueryParameters:{...R.queryParameters(),...g.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}){!m||m==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=e:i.baseQueryParameters["x-algolia-api-key"]=e;},async chunkedPush({indexName:e,objects:r,action:t="addObject",waitForTasks:n,batchSize:u=1e3,referenceIndexName:s},d){let p=[],h=0,l=[],q=Math.floor(u/10)||u,y=r.entries();for(let[f,w]of y)if(p.push(w),(p.length===u||f===r.length-1)&&(l.push(await this.push({indexName:e,pushTaskPayload:{action:t,records:p},referenceIndexName:s},d)),p=[]),n&&l.length>0&&(l.length%q===0||f===r.length-1)){for(let T of l.slice(h,h+q)){if(!T.eventID)throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");let k=0;await z({func:async()=>{if(T.eventID===void 0||!T.eventID)throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");return this.getEvent({runID:T.runID,eventID:T.eventID}).catch(S=>{if(S.status!==404)throw S})},validate:S=>S!==void 0,aggregator:()=>k+=1,error:{validate:()=>k>=50,message:()=>`The maximum number of retries exceeded. (${k}/50)`},timeout:()=>Math.min(k*1500,5e3)});}h+=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 s={method:"POST",path:"/1/authentications",queryParameters:{},headers:{},data:e};return i.request(s,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 s={method:"POST",path:"/1/destinations",queryParameters:{},headers:{},data:e};return i.request(s,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 s={method:"POST",path:"/1/sources",queryParameters:{},headers:{},data:e};return i.request(s,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 s={method:"POST",path:"/2/tasks",queryParameters:{},headers:{},data:e};return i.request(s,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 s={method:"POST",path:"/1/tasks",queryParameters:{},headers:{},data:e};return i.request(s,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 s={method:"POST",path:"/1/transformations",queryParameters:{},headers:{},data:e};return i.request(s,r)},customDelete({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let d={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return i.request(d,t)},customGet({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let d={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return i.request(d,t)},customPost({path:e,parameters:r,body:t},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:t||{}};return i.request(p,n)},customPut({path:e,parameters:r,body:t},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:t||{}};return i.request(p,n)},deleteAuthentication({authenticationID:e},r){if(!e)throw new Error("Parameter `authenticationID` is required when calling `deleteAuthentication`.");let s={method:"DELETE",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},deleteDestination({destinationID:e},r){if(!e)throw new Error("Parameter `destinationID` is required when calling `deleteDestination`.");let s={method:"DELETE",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},deleteSource({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `deleteSource`.");let s={method:"DELETE",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},deleteTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `deleteTask`.");let s={method:"DELETE",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},deleteTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `deleteTaskV1`.");let s={method:"DELETE",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},deleteTransformation({transformationID:e},r){if(!e)throw new Error("Parameter `transformationID` is required when calling `deleteTransformation`.");let s={method:"DELETE",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},disableTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `disableTask`.");let s={method:"PUT",path:"/2/tasks/{taskID}/disable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},disableTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `disableTaskV1`.");let s={method:"PUT",path:"/1/tasks/{taskID}/disable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},enableTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `enableTask`.");let s={method:"PUT",path:"/2/tasks/{taskID}/enable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},enableTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `enableTaskV1`.");let s={method:"PUT",path:"/1/tasks/{taskID}/enable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},getAuthentication({authenticationID:e},r){if(!e)throw new Error("Parameter `authenticationID` is required when calling `getAuthentication`.");let s={method:"GET",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},getDestination({destinationID:e},r){if(!e)throw new Error("Parameter `destinationID` is required when calling `getDestination`.");let s={method:"GET",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},getEvent({runID:e,eventID:r},t){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 d={method:"GET",path:"/1/runs/{runID}/events/{eventID}".replace("{runID}",encodeURIComponent(e)).replace("{eventID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return i.request(d,t)},getRun({runID:e},r){if(!e)throw new Error("Parameter `runID` is required when calling `getRun`.");let s={method:"GET",path:"/1/runs/{runID}".replace("{runID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},getSource({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `getSource`.");let s={method:"GET",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},getTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getTask`.");let s={method:"GET",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},getTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getTaskV1`.");let s={method:"GET",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},getTransformation({transformationID:e},r){if(!e)throw new Error("Parameter `transformationID` is required when calling `getTransformation`.");let s={method:"GET",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(s,r)},listAuthentications({itemsPerPage:e,page:r,type:t,platform:n,sort:u,order:s}={},d=void 0){let p="/1/authentications",h={},l={};e!==void 0&&(l.itemsPerPage=e.toString()),r!==void 0&&(l.page=r.toString()),t!==void 0&&(l.type=t.toString()),n!==void 0&&(l.platform=n.toString()),u!==void 0&&(l.sort=u.toString()),s!==void 0&&(l.order=s.toString());let q={method:"GET",path:p,queryParameters:l,headers:h};return i.request(q,d)},listDestinations({itemsPerPage:e,page:r,type:t,authenticationID:n,transformationID:u,sort:s,order:d}={},p=void 0){let h="/1/destinations",l={},q={};e!==void 0&&(q.itemsPerPage=e.toString()),r!==void 0&&(q.page=r.toString()),t!==void 0&&(q.type=t.toString()),n!==void 0&&(q.authenticationID=n.toString()),u!==void 0&&(q.transformationID=u.toString()),s!==void 0&&(q.sort=s.toString()),d!==void 0&&(q.order=d.toString());let y={method:"GET",path:h,queryParameters:q,headers:l};return i.request(y,p)},listEvents({runID:e,itemsPerPage:r,page:t,status:n,type:u,sort:s,order:d,startDate:p,endDate:h},l){if(!e)throw new Error("Parameter `runID` is required when calling `listEvents`.");let q="/1/runs/{runID}/events".replace("{runID}",encodeURIComponent(e)),y={},f={};r!==void 0&&(f.itemsPerPage=r.toString()),t!==void 0&&(f.page=t.toString()),n!==void 0&&(f.status=n.toString()),u!==void 0&&(f.type=u.toString()),s!==void 0&&(f.sort=s.toString()),d!==void 0&&(f.order=d.toString()),p!==void 0&&(f.startDate=p.toString()),h!==void 0&&(f.endDate=h.toString());let w={method:"GET",path:q,queryParameters:f,headers:y};return i.request(w,l)},listRuns({itemsPerPage:e,page:r,status:t,type:n,taskID:u,sort:s,order:d,startDate:p,endDate:h}={},l=void 0){let q="/1/runs",y={},f={};e!==void 0&&(f.itemsPerPage=e.toString()),r!==void 0&&(f.page=r.toString()),t!==void 0&&(f.status=t.toString()),n!==void 0&&(f.type=n.toString()),u!==void 0&&(f.taskID=u.toString()),s!==void 0&&(f.sort=s.toString()),d!==void 0&&(f.order=d.toString()),p!==void 0&&(f.startDate=p.toString()),h!==void 0&&(f.endDate=h.toString());let w={method:"GET",path:q,queryParameters:f,headers:y};return i.request(w,l)},listSources({itemsPerPage:e,page:r,type:t,authenticationID:n,sort:u,order:s}={},d=void 0){let p="/1/sources",h={},l={};e!==void 0&&(l.itemsPerPage=e.toString()),r!==void 0&&(l.page=r.toString()),t!==void 0&&(l.type=t.toString()),n!==void 0&&(l.authenticationID=n.toString()),u!==void 0&&(l.sort=u.toString()),s!==void 0&&(l.order=s.toString());let q={method:"GET",path:p,queryParameters:l,headers:h};return i.request(q,d)},listTasks({itemsPerPage:e,page:r,action:t,enabled:n,sourceID:u,sourceType:s,destinationID:d,triggerType:p,withEmailNotifications:h,sort:l,order:q}={},y=void 0){let f="/2/tasks",w={},T={};e!==void 0&&(T.itemsPerPage=e.toString()),r!==void 0&&(T.page=r.toString()),t!==void 0&&(T.action=t.toString()),n!==void 0&&(T.enabled=n.toString()),u!==void 0&&(T.sourceID=u.toString()),s!==void 0&&(T.sourceType=s.toString()),d!==void 0&&(T.destinationID=d.toString()),p!==void 0&&(T.triggerType=p.toString()),h!==void 0&&(T.withEmailNotifications=h.toString()),l!==void 0&&(T.sort=l.toString()),q!==void 0&&(T.order=q.toString());let k={method:"GET",path:f,queryParameters:T,headers:w};return i.request(k,y)},listTasksV1({itemsPerPage:e,page:r,action:t,enabled:n,sourceID:u,destinationID:s,triggerType:d,sort:p,order:h}={},l=void 0){let q="/1/tasks",y={},f={};e!==void 0&&(f.itemsPerPage=e.toString()),r!==void 0&&(f.page=r.toString()),t!==void 0&&(f.action=t.toString()),n!==void 0&&(f.enabled=n.toString()),u!==void 0&&(f.sourceID=u.toString()),s!==void 0&&(f.destinationID=s.toString()),d!==void 0&&(f.triggerType=d.toString()),p!==void 0&&(f.sort=p.toString()),h!==void 0&&(f.order=h.toString());let w={method:"GET",path:q,queryParameters:f,headers:y};return i.request(w,l)},listTransformations({itemsPerPage:e,page:r,sort:t,order:n,type:u}={},s=void 0){let d="/1/transformations",p={},h={};e!==void 0&&(h.itemsPerPage=e.toString()),r!==void 0&&(h.page=r.toString()),t!==void 0&&(h.sort=t.toString()),n!==void 0&&(h.order=n.toString()),u!==void 0&&(h.type=u.toString());let l={method:"GET",path:d,queryParameters:h,headers:p};return i.request(l,s)},push({indexName:e,pushTaskPayload:r,watch:t,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 s="/1/push/{indexName}".replace("{indexName}",encodeURIComponent(e)),d={},p={};t!==void 0&&(p.watch=t.toString()),n!==void 0&&(p.referenceIndexName=n.toString());let h={method:"POST",path:s,queryParameters:p,headers:d,data:r};return u={timeouts:{connect:18e4,read:18e4,write:18e4,...u?.timeouts}},i.request(h,u)},pushTask({taskID:e,pushTaskPayload:r,watch:t},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)),s={},d={};t!==void 0&&(d.watch=t.toString());let p={method:"POST",path:u,queryParameters:d,headers:s,data:r};return n={timeouts:{connect:18e4,read:18e4,write:18e4,...n?.timeouts}},i.request(p,n)},replaceTask({taskID:e,taskReplace:r},t){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 d={method:"PUT",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(d,t)},runSource({sourceID:e,runSourcePayload:r},t){if(!e)throw new Error("Parameter `sourceID` is required when calling `runSource`.");let d={method:"POST",path:"/1/sources/{sourceID}/run".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return i.request(d,t)},runTask({taskID:e,runTaskPayload:r},t){if(!e)throw new Error("Parameter `taskID` is required when calling `runTask`.");let d={method:"POST",path:"/2/tasks/{taskID}/run".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return i.request(d,t)},runTaskV1({taskID:e,runTaskPayload:r},t){if(!e)throw new Error("Parameter `taskID` is required when calling `runTaskV1`.");let d={method:"POST",path:"/1/tasks/{taskID}/run".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return i.request(d,t)},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 s={method:"POST",path:"/1/authentications/search",queryParameters:{},headers:{},data:e};return i.request(s,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 s={method:"POST",path:"/1/destinations/search",queryParameters:{},headers:{},data:e};return i.request(s,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 s={method:"POST",path:"/1/sources/search",queryParameters:{},headers:{},data:e};return i.request(s,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 s={method:"POST",path:"/2/tasks/search",queryParameters:{},headers:{},data:e};return i.request(s,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 s={method:"POST",path:"/1/tasks/search",queryParameters:{},headers:{},data:e};return i.request(s,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 s={method:"POST",path:"/1/transformations/search",queryParameters:{},headers:{},data:e};return i.request(s,r)},triggerDockerSourceDiscover({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `triggerDockerSourceDiscover`.");let s={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(s,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 s={method:"POST",path:"/1/transformations/try",queryParameters:{},headers:{},data:e};return i.request(s,r)},tryTransformationBeforeUpdate({transformationID:e,transformationTry:r},t){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 d={method:"POST",path:"/1/transformations/{transformationID}/try".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(d,t)},updateAuthentication({authenticationID:e,authenticationUpdate:r},t){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 d={method:"PATCH",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(d,t)},updateDestination({destinationID:e,destinationUpdate:r},t){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 d={method:"PATCH",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(d,t)},updateSource({sourceID:e,sourceUpdate:r},t){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 d={method:"PATCH",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(d,t)},updateTask({taskID:e,taskUpdate:r},t){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 d={method:"PATCH",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(d,t)},updateTaskV1({taskID:e,taskUpdate:r},t){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 d={method:"PATCH",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(d,t)},updateTransformation({transformationID:e,transformationCreate:r},t){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 d={method:"PUT",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return i.request(d,t)},validateSource(e,r=void 0){let s={method:"POST",path:"/1/sources/validate",queryParameters:{},headers:{},data:e||{}};return r={timeouts:{connect:18e4,read:18e4,write:18e4,...r?.timeouts}},i.request(s,r)},validateSourceBeforeUpdate({sourceID:e,sourceUpdate:r},t){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 d={method:"POST",path:"/1/sources/{sourceID}/validate".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t={timeouts:{connect:18e4,read:18e4,write:18e4,...t?.timeouts}},i.request(d,t)}}}function Os(a,o,m,c){if(!a||typeof a!="string")throw new Error("`appId` is missing.");if(!o||typeof o!="string")throw new Error("`apiKey` is missing.");if(!m||m&&(typeof m!="string"||!L.includes(m)))throw new Error(`\`region\` is required and must be one of the following: ${L.join(", ")}`);let{compression:P,...g}=c||{};return re({appId:a,apiKey:o,region:m,timeouts:{connect:25e3,read:25e3,write:25e3},logger:F(),requester:ee(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:C(),requestsCache:C({serializable:false}),hostsCache:x({caches:[B({key:`${v}-${a}`}),C()]}),...g})}
7
+ function j(a){let o,m=`algolia-client-js-${a.key}`;function c(){return o===void 0&&(o=a.localStorage||window.localStorage),o}function P(){return JSON.parse(c().getItem(m)||"{}")}function w(e){c().setItem(m,JSON.stringify(e));}function T(){return new Promise(e=>setTimeout(e,0))}function u(){let e=a.timeToLive?a.timeToLive*1e3:null,r=P(),s=new Date().getTime(),n=false;return {namespace:Object.fromEntries(Object.entries(r).filter(([,t])=>!t||t.timestamp===void 0||e&&t.timestamp+e<s?(n=true,false):true)),changed:n}}return {get(e,r,s={miss:()=>Promise.resolve()}){return T().then(()=>{let{namespace:n,changed:i}=u(),t=n[JSON.stringify(e)];return i&&w(n),t?t.value:r().then(d=>s.miss(d).then(()=>d))})},set(e,r){return T().then(()=>{let s=P();return s[JSON.stringify(e)]={timestamp:new Date().getTime(),value:r},c().setItem(m,JSON.stringify(s)),r})},delete(e){return T().then(()=>{let r=P();delete r[JSON.stringify(e)],c().setItem(m,JSON.stringify(r));})},clear(){return Promise.resolve().then(()=>{c().removeItem(m);})}}}function se(){return {get(a,o,m={miss:()=>Promise.resolve()}){return o().then(P=>Promise.all([P,m.miss(P)])).then(([P])=>P)},set(a,o){return Promise.resolve(o)},delete(a){return Promise.resolve()},clear(){return Promise.resolve()}}}function x(a){let o=[...a.caches],m=o.shift();return m===void 0?se():{get(c,P,w={miss:()=>Promise.resolve()}){return m.get(c,P,w).catch(()=>x({caches:o}).get(c,P,w))},set(c,P){return m.set(c,P).catch(()=>x({caches:o}).set(c,P))},delete(c){return m.delete(c).catch(()=>x({caches:o}).delete(c))},clear(){return m.clear().catch(()=>x({caches:o}).clear())}}}function C(a={serializable:true}){let o={};return {get(m,c,P={miss:()=>Promise.resolve()}){let w=JSON.stringify(m);if(w in o)return Promise.resolve(a.serializable?JSON.parse(o[w]):o[w]);let T=c();return T.then(u=>P.miss(u)).then(()=>T)},set(m,c){return o[JSON.stringify(m)]=a.serializable?JSON.stringify(c):c,Promise.resolve(c)},delete(m){return delete o[JSON.stringify(m)],Promise.resolve()},clear(){return o={},Promise.resolve()}}}function oe(a){let o={value:`Algolia for JavaScript (${a})`,add(m){let c=`; ${m.segment}${m.version!==void 0?` (${m.version})`:""}`;return o.value.indexOf(c)===-1&&(o.value=`${o.value}${c}`),o}};return o}function J(a,o,m="WithinHeaders"){let c={"x-algolia-api-key":o,"x-algolia-application-id":a};return {headers(){return m==="WithinHeaders"?c:{}},queryParameters(){return m==="WithinQueryParameters"?c:{}}}}function M({func:a,validate:o,aggregator:m,error:c,timeout:P=()=>0}){let w=T=>new Promise((u,e)=>{a(T).then(async r=>(m&&await m(r),await o(r)?u(r):c&&await c.validate(r)?e(new Error(await c.message(r))):setTimeout(()=>{w(r).then(u).catch(e);},await P()))).catch(r=>{e(r);});});return w()}function z({algoliaAgents:a,client:o,version:m}){let c=oe(m).add({segment:o,version:m});return a.forEach(P=>c.add(P)),c}function F(){return {debug(a,o){return Promise.resolve()},info(a,o){return Promise.resolve()},error(a,o){return Promise.resolve()}}}var ae=750,$=120*1e3;function B(a,o="up"){let m=Date.now();function c(){return o==="up"||Date.now()-m>$}function P(){return o==="timed out"&&Date.now()-m<=$}return {...a,status:o,lastUpdate:m,isUp:c,isTimedOut:P}}var X=class extends Error{name="AlgoliaError";constructor(a,o){super(a),o&&(this.name=o);}};var K=class extends X{stackTrace;constructor(a,o,m){super(a,m),this.stackTrace=o;}},ne=class extends K{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");}},Q=class extends K{status;constructor(a,o,m,c="ApiError"){super(a,m,c),this.status=o;}},ie=class extends X{response;constructor(a,o){super(a,"DeserializationError"),this.response=o;}},ue=class extends Q{error;constructor(a,o,m,c){super(a,o,c,"DetailedApiError"),this.error=m;}};function ce(a,o,m){let c=me(m),P=`${a.protocol}://${a.url}${a.port?`:${a.port}`:""}/${o.charAt(0)==="/"?o.substring(1):o}`;return c.length&&(P+=`?${c}`),P}function me(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 de(a,o){if(a.method==="GET"||a.data===void 0&&o.data===void 0)return;let m=Array.isArray(a.data)?a.data:{...a.data,...o.data};return JSON.stringify(m)}function pe(a,o,m){let c={Accept:"application/json",...a,...o,...m},P={};return Object.keys(c).forEach(w=>{let T=c[w];P[w.toLowerCase()]=T;}),P}function he(a){try{return JSON.parse(a.content)}catch(o){throw new ie(o.message,a)}}function fe({content:a,status:o},m){try{let c=JSON.parse(a);return "error"in c?new ue(c.message,o,c.error,m):new Q(c.message,o,m)}catch{}return new Q(a,o,m)}function le({isTimedOut:a,status:o}){return !a&&~~o===0}function Pe({isTimedOut:a,status:o}){return a||le({isTimedOut:a,status:o})||~~(o/100)!==2&&~~(o/100)!==4}function qe({status:a}){return ~~(a/100)===2}function ge(a){return a.map(o=>Y(o))}function Y(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 Z({hosts:a,hostsCache:o,baseHeaders:m,logger:c,baseQueryParameters:P,algoliaAgent:w,timeouts:T,requester:u,requestsCache:e,responsesCache:r,compress:s,compression:n}){async function i(p){let h=await Promise.all(p.map(g=>o.get(g,()=>Promise.resolve(B(g))))),l=h.filter(g=>g.isUp()),q=h.filter(g=>g.isTimedOut()),y=[...l,...q];return {hosts:y.length>0?y:p,getTimeout(g,R){return (q.length===0&&g===0?1:q.length+3+g)*R}}}async function t(p,h,l){let q=[],y=de(p,h),f=pe(m,p.headers,h.headers),g=n==="gzip"&&y!==void 0&&y.length>ae&&(p.method==="POST"||p.method==="PUT");g&&s===void 0&&c.info("Compression is disabled because no compress method is available.");let R=g&&s!==void 0,k=R?await s(y):y;R&&(f["content-encoding"]="gzip");let I=p.method==="GET"?{...p.data,...h.data}:{},D={...P,...p.queryParameters,...I};if(w.value&&(D["x-algolia-agent"]=w.value),h&&h.queryParameters)for(let E of Object.keys(h.queryParameters))!h.queryParameters[E]||Object.prototype.toString.call(h.queryParameters[E])==="[object Object]"?D[E]=h.queryParameters[E]:D[E]=h.queryParameters[E].toString();let U=0,V=async(E,A)=>{let O=E.pop();if(O===void 0)throw new ne(ge(q));let H={...T,...h.timeouts},N={data:k,headers:f,method:p.method,url:ce(O,p.path,D),connectTimeout:A(U,H.connect),responseTimeout:A(U,l?H.read:H.write)},_=b=>{let W={request:N,response:b,host:O,triesLeft:E.length};return q.push(W),W},S=await u.send(N);if(Pe(S)){let b=_(S);return S.isTimedOut&&U++,c.info("Retryable failure",Y(b)),await o.set(O,B(O,S.isTimedOut?"timed out":"down")),V(E,A)}if(qe(S))return he(S);throw _(S),fe(S,q)},te=a.filter(E=>E.accept==="readWrite"||(l?E.accept==="read":E.accept==="write")),G=await i(te);return V([...G.hosts].reverse(),G.getTimeout)}function d(p,h={}){let l=()=>t(p,h,q),q=p.useReadTransporter||p.method==="GET";if((h.cacheable||p.cacheable)!==true)return l();let f={request:p,requestOptions:h,transporter:{queryParameters:P,headers:m}};return r.get(f,()=>e.get(f,()=>e.set(f,l()).then(g=>Promise.all([e.delete(f),g]),g=>Promise.all([e.delete(f),Promise.reject(g)])).then(([g,R])=>R)),{miss:g=>r.set(f,g)})}return {hostsCache:o,requester:u,timeouts:T,logger:c,algoliaAgent:w,baseHeaders:m,baseQueryParameters:P,hosts:a,request:d,requestsCache:e,responsesCache:r}}function ee(){function a(o){return new Promise(m=>{let c=new XMLHttpRequest;c.open(o.method,o.url,true),Object.keys(o.headers).forEach(u=>c.setRequestHeader(u,o.headers[u]));let P=(u,e)=>setTimeout(()=>{c.abort(),m({status:0,content:e,isTimedOut:true});},u),w=P(o.connectTimeout,"Connection timeout"),T;c.onreadystatechange=()=>{c.readyState>c.OPENED&&T===void 0&&(clearTimeout(w),T=P(o.responseTimeout,"Socket timeout"));},c.onerror=()=>{c.status===0&&(clearTimeout(w),clearTimeout(T),m({content:c.responseText||"Network request failed",status:c.status,isTimedOut:false}));},c.onload=()=>{clearTimeout(w),clearTimeout(T),m({content:c.responseText,status:c.status,isTimedOut:false});},c.send(o.data);})}return {send:a}}var v="1.53.0",L=["eu","us"];function we(a){return [{url:"data.{region}.algolia.com".replace("{region}",a),accept:"readWrite",protocol:"https"}]}function ye(a){return a.type==="onDemand"}function Te(a){return a.type==="schedule"}function Re(a){return a.type==="subscription"}function re({appId:a,apiKey:o,authMode:m,algoliaAgents:c,region:P,...w}){let T=J(a,o,m),u=Z({hosts:we(P),...w,algoliaAgent:z({algoliaAgents:c,client:"Ingestion",version:v}),baseHeaders:{"content-type":"text/plain",...T.headers(),...w.baseHeaders},baseQueryParameters:{...T.queryParameters(),...w.baseQueryParameters}});return {transporter:u,appId:a,apiKey:o,clearCache(){return Promise.all([u.requestsCache.clear(),u.responsesCache.clear()]).then(()=>{})},get _ua(){return u.algoliaAgent.value},addAlgoliaAgent(e,r){u.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!m||m==="WithinHeaders"?u.baseHeaders["x-algolia-api-key"]=e:u.baseQueryParameters["x-algolia-api-key"]=e;},async chunkedPush({indexName:e,objects:r,action:s="addObject",waitForTasks:n,batchSize:i=1e3,referenceIndexName:t,maxRetries:d=100},p){let h=[],l=0,q=[],y=Math.floor(i/10)||i,f=r.entries();for(let[g,R]of f)if(h.push(R),(h.length===i||g===r.length-1)&&(q.push(await this.push({indexName:e,pushTaskPayload:{action:s,records:h},referenceIndexName:t},p)),h=[]),n&&q.length>0&&(q.length%y===0||g===r.length-1)){for(let k of q.slice(l,l+y)){if(!k.eventID)throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");let I=0;await M({func:async()=>{if(k.eventID===void 0||!k.eventID)throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");return this.getEvent({runID:k.runID,eventID:k.eventID}).catch(D=>{if(D.status!==404)throw D})},validate:D=>D!==void 0,aggregator:()=>I+=1,error:{validate:()=>I>=d,message:()=>`Stopped waiting for the task after ${d} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`},timeout:()=>Math.min(I*1500,5e3)});}l+=y;}return q},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 u.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 u.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 u.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 u.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 u.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 u.request(t,r)},customDelete({path:e,parameters:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let d={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return u.request(d,s)},customGet({path:e,parameters:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let d={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return u.request(d,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 u.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 u.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 u.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 u.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 u.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 u.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 u.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 u.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 u.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 u.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 u.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 u.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 u.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 u.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 d={method:"GET",path:"/1/runs/{runID}/events/{eventID}".replace("{runID}",encodeURIComponent(e)).replace("{eventID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(d,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 u.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 u.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 u.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 u.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 u.request(t,r)},listAuthentications({itemsPerPage:e,page:r,type:s,platform:n,sort:i,order:t}={},d=void 0){let p="/1/authentications",h={},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()),i!==void 0&&(l.sort=i.toString()),t!==void 0&&(l.order=t.toString());let q={method:"GET",path:p,queryParameters:l,headers:h};return u.request(q,d)},listDestinations({itemsPerPage:e,page:r,type:s,authenticationID:n,transformationID:i,sort:t,order:d}={},p=void 0){let h="/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()),i!==void 0&&(q.transformationID=i.toString()),t!==void 0&&(q.sort=t.toString()),d!==void 0&&(q.order=d.toString());let y={method:"GET",path:h,queryParameters:q,headers:l};return u.request(y,p)},listEvents({runID:e,itemsPerPage:r,page:s,status:n,type:i,sort:t,order:d,startDate:p,endDate:h},l){if(!e)throw new Error("Parameter `runID` is required when calling `listEvents`.");let q="/1/runs/{runID}/events".replace("{runID}",encodeURIComponent(e)),y={},f={};r!==void 0&&(f.itemsPerPage=r.toString()),s!==void 0&&(f.page=s.toString()),n!==void 0&&(f.status=n.toString()),i!==void 0&&(f.type=i.toString()),t!==void 0&&(f.sort=t.toString()),d!==void 0&&(f.order=d.toString()),p!==void 0&&(f.startDate=p.toString()),h!==void 0&&(f.endDate=h.toString());let g={method:"GET",path:q,queryParameters:f,headers:y};return u.request(g,l)},listRuns({itemsPerPage:e,page:r,status:s,type:n,taskID:i,sort:t,order:d,startDate:p,endDate:h}={},l=void 0){let q="/1/runs",y={},f={};e!==void 0&&(f.itemsPerPage=e.toString()),r!==void 0&&(f.page=r.toString()),s!==void 0&&(f.status=s.toString()),n!==void 0&&(f.type=n.toString()),i!==void 0&&(f.taskID=i.toString()),t!==void 0&&(f.sort=t.toString()),d!==void 0&&(f.order=d.toString()),p!==void 0&&(f.startDate=p.toString()),h!==void 0&&(f.endDate=h.toString());let g={method:"GET",path:q,queryParameters:f,headers:y};return u.request(g,l)},listSources({itemsPerPage:e,page:r,type:s,authenticationID:n,sort:i,order:t}={},d=void 0){let p="/1/sources",h={},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()),i!==void 0&&(l.sort=i.toString()),t!==void 0&&(l.order=t.toString());let q={method:"GET",path:p,queryParameters:l,headers:h};return u.request(q,d)},listTasks({itemsPerPage:e,page:r,action:s,enabled:n,sourceID:i,sourceType:t,destinationID:d,triggerType:p,withEmailNotifications:h,sort:l,order:q}={},y=void 0){let f="/2/tasks",g={},R={};e!==void 0&&(R.itemsPerPage=e.toString()),r!==void 0&&(R.page=r.toString()),s!==void 0&&(R.action=s.toString()),n!==void 0&&(R.enabled=n.toString()),i!==void 0&&(R.sourceID=i.toString()),t!==void 0&&(R.sourceType=t.toString()),d!==void 0&&(R.destinationID=d.toString()),p!==void 0&&(R.triggerType=p.toString()),h!==void 0&&(R.withEmailNotifications=h.toString()),l!==void 0&&(R.sort=l.toString()),q!==void 0&&(R.order=q.toString());let k={method:"GET",path:f,queryParameters:R,headers:g};return u.request(k,y)},listTasksV1({itemsPerPage:e,page:r,action:s,enabled:n,sourceID:i,destinationID:t,triggerType:d,sort:p,order:h}={},l=void 0){let q="/1/tasks",y={},f={};e!==void 0&&(f.itemsPerPage=e.toString()),r!==void 0&&(f.page=r.toString()),s!==void 0&&(f.action=s.toString()),n!==void 0&&(f.enabled=n.toString()),i!==void 0&&(f.sourceID=i.toString()),t!==void 0&&(f.destinationID=t.toString()),d!==void 0&&(f.triggerType=d.toString()),p!==void 0&&(f.sort=p.toString()),h!==void 0&&(f.order=h.toString());let g={method:"GET",path:q,queryParameters:f,headers:y};return u.request(g,l)},listTransformations({itemsPerPage:e,page:r,sort:s,order:n,type:i}={},t=void 0){let d="/1/transformations",p={},h={};e!==void 0&&(h.itemsPerPage=e.toString()),r!==void 0&&(h.page=r.toString()),s!==void 0&&(h.sort=s.toString()),n!==void 0&&(h.order=n.toString()),i!==void 0&&(h.type=i.toString());let l={method:"GET",path:d,queryParameters:h,headers:p};return u.request(l,t)},push({indexName:e,pushTaskPayload:r,watch:s,referenceIndexName:n},i){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)),d={},p={};s!==void 0&&(p.watch=s.toString()),n!==void 0&&(p.referenceIndexName=n.toString());let h={method:"POST",path:t,queryParameters:p,headers:d,data:r};return i={timeouts:{connect:18e4,read:18e4,write:18e4,...i?.timeouts}},u.request(h,i)},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 i="/2/tasks/{taskID}/push".replace("{taskID}",encodeURIComponent(e)),t={},d={};s!==void 0&&(d.watch=s.toString());let p={method:"POST",path:i,queryParameters:d,headers:t,data:r};return n={timeouts:{connect:18e4,read:18e4,write:18e4,...n?.timeouts}},u.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 d={method:"PUT",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return u.request(d,s)},runSource({sourceID:e,runSourcePayload:r},s){if(!e)throw new Error("Parameter `sourceID` is required when calling `runSource`.");let d={method:"POST",path:"/1/sources/{sourceID}/run".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return u.request(d,s)},runTask({taskID:e,runTaskPayload:r},s){if(!e)throw new Error("Parameter `taskID` is required when calling `runTask`.");let d={method:"POST",path:"/2/tasks/{taskID}/run".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return u.request(d,s)},runTaskV1({taskID:e,runTaskPayload:r},s){if(!e)throw new Error("Parameter `taskID` is required when calling `runTaskV1`.");let d={method:"POST",path:"/1/tasks/{taskID}/run".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return u.request(d,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 u.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 u.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 u.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 u.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 u.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 u.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}},u.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 u.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 d={method:"POST",path:"/1/transformations/{transformationID}/try".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return u.request(d,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 d={method:"PATCH",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return u.request(d,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 d={method:"PATCH",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return u.request(d,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 d={method:"PATCH",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return u.request(d,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 d={method:"PATCH",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return u.request(d,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 d={method:"PATCH",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return u.request(d,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 d={method:"PUT",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return u.request(d,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}},u.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 d={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}},u.request(d,s)}}}function Os(a,o,m,c){if(!a||typeof a!="string")throw new Error("`appId` is missing.");if(!o||typeof o!="string")throw new Error("`apiKey` is missing.");if(!m||m&&(typeof m!="string"||!L.includes(m)))throw new Error(`\`region\` is required and must be one of the following: ${L.join(", ")}`);let{compression:P,...w}=c||{};return re({appId:a,apiKey:o,region:m,timeouts:{connect:25e3,read:25e3,write:25e3},logger:F(),requester:ee(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:C(),requestsCache:C({serializable:false}),hostsCache:x({caches:[j({key:`${v}-${a}`}),C()]}),...w})}
8
8
 
9
9
  exports.apiClientVersion = v;
10
10
  exports.ingestionClient = Os;
11
- exports.isOnDemandTrigger = Te;
12
- exports.isScheduleTrigger = ye;
11
+ exports.isOnDemandTrigger = ye;
12
+ exports.isScheduleTrigger = Te;
13
13
  exports.isSubscriptionTrigger = Re;
14
14
 
15
15
  }));
@@ -5,7 +5,7 @@ import { createFetchRequester } from "@algolia/requester-fetch";
5
5
 
6
6
  // src/ingestionClient.ts
7
7
  import { createAuth, createIterablePromise, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
8
- var apiClientVersion = "1.52.1";
8
+ var apiClientVersion = "1.53.0";
9
9
  var REGIONS = ["eu", "us"];
10
10
  function getDefaultHosts(region) {
11
11
  const url = "data.{region}.algolia.com".replace("{region}", region);
@@ -102,6 +102,7 @@ function createIngestionClient({
102
102
  * @param chunkedPush.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
103
103
  * @param chunkedPush.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
104
104
  * @param chunkedPush.referenceIndexName - This is required when targeting an index that does not have a push connector setup (e.g. a tmp index), but you wish to attach another index's transformation to it (e.g. the source index name).
105
+ * @param chunkedPush.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
105
106
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getEvent` method and merged with the transporter requestOptions.
106
107
  */
107
108
  async chunkedPush({
@@ -110,7 +111,8 @@ function createIngestionClient({
110
111
  action = "addObject",
111
112
  waitForTasks,
112
113
  batchSize = 1e3,
113
- referenceIndexName
114
+ referenceIndexName,
115
+ maxRetries = 100
114
116
  }, requestOptions) {
115
117
  let records = [];
116
118
  let offset = 0;
@@ -146,8 +148,8 @@ function createIngestionClient({
146
148
  validate: (response) => response !== void 0,
147
149
  aggregator: () => retryCount += 1,
148
150
  error: {
149
- validate: () => retryCount >= 50,
150
- message: () => `The maximum number of retries exceeded. (${retryCount}/${50})`
151
+ validate: () => retryCount >= maxRetries,
152
+ message: () => `Stopped waiting for the task after ${maxRetries} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`
151
153
  },
152
154
  timeout: () => Math.min(retryCount * 1500, 5e3)
153
155
  });