@algolia/client-personalization 5.40.0 → 5.40.1

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,7 +4,7 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@algolia/client-personalization"] = {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
- function H(){function r(e){return new Promise(o=>{let t=new XMLHttpRequest;t.open(e.method,e.url,true),Object.keys(e.headers).forEach(n=>t.setRequestHeader(n,e.headers[n]));let a=(n,s)=>setTimeout(()=>{t.abort(),o({status:0,content:s,isTimedOut:true});},n),m=a(e.connectTimeout,"Connection timeout"),h;t.onreadystatechange=()=>{t.readyState>t.OPENED&&h===void 0&&(clearTimeout(m),h=a(e.responseTimeout,"Socket timeout"));},t.onerror=()=>{t.status===0&&(clearTimeout(m),clearTimeout(h),o({content:t.responseText||"Network request failed",status:t.status,isTimedOut:false}));},t.onload=()=>{clearTimeout(m),clearTimeout(h),o({content:t.responseText,status:t.status,isTimedOut:false});},t.send(e.data);})}return {send:r}}function j(r){let e,o=`algolia-client-js-${r.key}`;function t(){return e===void 0&&(e=r.localStorage||window.localStorage),e}function a(){return JSON.parse(t().getItem(o)||"{}")}function m(n){t().setItem(o,JSON.stringify(n));}function h(){let n=r.timeToLive?r.timeToLive*1e3:null,s=a(),i=Object.fromEntries(Object.entries(s).filter(([,d])=>d.timestamp!==void 0));if(m(i),!n)return;let u=Object.fromEntries(Object.entries(i).filter(([,d])=>{let P=new Date().getTime();return !(d.timestamp+n<P)}));m(u);}return {get(n,s,i={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(h(),a()[JSON.stringify(n)])).then(u=>Promise.all([u?u.value:s(),u!==void 0])).then(([u,d])=>Promise.all([u,d||i.miss(u)])).then(([u])=>u)},set(n,s){return Promise.resolve().then(()=>{let i=a();return i[JSON.stringify(n)]={timestamp:new Date().getTime(),value:s},t().setItem(o,JSON.stringify(i)),s})},delete(n){return Promise.resolve().then(()=>{let s=a();delete s[JSON.stringify(n)],t().setItem(o,JSON.stringify(s));})},clear(){return Promise.resolve().then(()=>{t().removeItem(o);})}}}function V(){return {get(r,e,o={miss:()=>Promise.resolve()}){return e().then(a=>Promise.all([a,o.miss(a)])).then(([a])=>a)},set(r,e){return Promise.resolve(e)},delete(r){return Promise.resolve()},clear(){return Promise.resolve()}}}function q(r){let e=[...r.caches],o=e.shift();return o===void 0?V():{get(t,a,m={miss:()=>Promise.resolve()}){return o.get(t,a,m).catch(()=>q({caches:e}).get(t,a,m))},set(t,a){return o.set(t,a).catch(()=>q({caches:e}).set(t,a))},delete(t){return o.delete(t).catch(()=>q({caches:e}).delete(t))},clear(){return o.clear().catch(()=>q({caches:e}).clear())}}}function O(r={serializable:true}){let e={};return {get(o,t,a={miss:()=>Promise.resolve()}){let m=JSON.stringify(o);if(m in e)return Promise.resolve(r.serializable?JSON.parse(e[m]):e[m]);let h=t();return h.then(n=>a.miss(n)).then(()=>h)},set(o,t){return e[JSON.stringify(o)]=r.serializable?JSON.stringify(t):t,Promise.resolve(t)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function Y(r){let e={value:`Algolia for JavaScript (${r})`,add(o){let t=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(t)===-1&&(e.value=`${e.value}${t}`),e}};return e}function G(r,e,o="WithinHeaders"){let t={"x-algolia-api-key":e,"x-algolia-application-id":r};return {headers(){return o==="WithinHeaders"?t:{}},queryParameters(){return o==="WithinQueryParameters"?t:{}}}}function W({algoliaAgents:r,client:e,version:o}){let t=Y(o).add({segment:e,version:o});return r.forEach(a=>t.add(a)),t}function J(){return {debug(r,e){return Promise.resolve()},info(r,e){return Promise.resolve()},error(r,e){return Promise.resolve()}}}var L=120*1e3;function $(r,e="up"){let o=Date.now();function t(){return e==="up"||Date.now()-o>L}function a(){return e==="timed out"&&Date.now()-o<=L}return {...r,status:e,lastUpdate:o,isUp:t,isTimedOut:a}}var Q=class extends Error{name="AlgoliaError";constructor(r,e){super(r),e&&(this.name=e);}};var M=class extends Q{stackTrace;constructor(r,e,o){super(r,o),this.stackTrace=e;}},Z=class extends M{constructor(r){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",r,"RetryError");}},z=class extends M{status;constructor(r,e,o,t="ApiError"){super(r,o,t),this.status=e;}},ee=class extends Q{response;constructor(r,e){super(r,"DeserializationError"),this.response=e;}},re=class extends z{error;constructor(r,e,o,t){super(r,e,t,"DetailedApiError"),this.error=o;}};function te(r,e,o){let t=oe(o),a=`${r.protocol}://${r.url}${r.port?`:${r.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return t.length&&(a+=`?${t}`),a}function oe(r){return Object.keys(r).filter(e=>r[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(r[e])==="[object Array]"?r[e].join(","):r[e]).replace(/\+/g,"%20")}`).join("&")}function se(r,e){if(r.method==="GET"||r.data===void 0&&e.data===void 0)return;let o=Array.isArray(r.data)?r.data:{...r.data,...e.data};return JSON.stringify(o)}function ae(r,e,o){let t={Accept:"application/json",...r,...e,...o},a={};return Object.keys(t).forEach(m=>{let h=t[m];a[m.toLowerCase()]=h;}),a}function ne(r){try{return JSON.parse(r.content)}catch(e){throw new ee(e.message,r)}}function ie({content:r,status:e},o){try{let t=JSON.parse(r);return "error"in t?new re(t.message,e,t.error,o):new z(t.message,e,o)}catch{}return new z(r,e,o)}function ce({isTimedOut:r,status:e}){return !r&&~~e===0}function ue({isTimedOut:r,status:e}){return r||ce({isTimedOut:r,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function le({status:r}){return ~~(r/100)===2}function me(r){return r.map(e=>F(e))}function F(r){let e=r.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...r,request:{...r.request,headers:{...r.request.headers,...e}}}}function B({hosts:r,hostsCache:e,baseHeaders:o,logger:t,baseQueryParameters:a,algoliaAgent:m,timeouts:h,requester:n,requestsCache:s,responsesCache:i}){async function u(c){let l=await Promise.all(c.map(p=>e.get(p,()=>Promise.resolve($(p))))),g=l.filter(p=>p.isUp()),y=l.filter(p=>p.isTimedOut()),R=[...g,...y];return {hosts:R.length>0?R:c,getTimeout(p,T){return (y.length===0&&p===0?1:y.length+3+p)*T}}}async function d(c,l,g=true){let y=[],R=se(c,l),E=ae(o,c.headers,l.headers),p=c.method==="GET"?{...c.data,...l.data}:{},T={...a,...c.queryParameters,...p};if(m.value&&(T["x-algolia-agent"]=m.value),l&&l.queryParameters)for(let f of Object.keys(l.queryParameters))!l.queryParameters[f]||Object.prototype.toString.call(l.queryParameters[f])==="[object Object]"?T[f]=l.queryParameters[f]:T[f]=l.queryParameters[f].toString();let S=0,N=async(f,A)=>{let v=f.pop();if(v===void 0)throw new Z(me(y));let C={...h,...l.timeouts},k={data:R,headers:E,method:c.method,url:te(v,c.path,T),connectTimeout:A(S,C.connect),responseTimeout:A(S,g?C.read:C.write)},D=b=>{let _={request:k,response:b,host:v,triesLeft:f.length};return y.push(_),_},w=await n.send(k);if(ue(w)){let b=D(w);return w.isTimedOut&&S++,t.info("Retryable failure",F(b)),await e.set(v,$(v,w.isTimedOut?"timed out":"down")),N(f,A)}if(le(w))return ne(w);throw D(w),ie(w,y)},K=r.filter(f=>f.accept==="readWrite"||(g?f.accept==="read":f.accept==="write")),U=await u(K);return N([...U.hosts].reverse(),U.getTimeout)}function P(c,l={}){let g=c.useReadTransporter||c.method==="GET";if(!g)return d(c,l,g);let y=()=>d(c,l);if((l.cacheable||c.cacheable)!==true)return y();let E={request:c,requestOptions:l,transporter:{queryParameters:a,headers:o}};return i.get(E,()=>s.get(E,()=>s.set(E,y()).then(p=>Promise.all([s.delete(E),p]),p=>Promise.all([s.delete(E),Promise.reject(p)])).then(([p,T])=>T)),{miss:p=>i.set(E,p)})}return {hostsCache:e,requester:n,timeouts:h,logger:t,algoliaAgent:m,baseHeaders:o,baseQueryParameters:a,hosts:r,request:P,requestsCache:s,responsesCache:i}}var x="5.40.0",I=["eu","us"];function de(r){return [{url:"personalization.{region}.algolia.com".replace("{region}",r),accept:"readWrite",protocol:"https"}]}function X({appId:r,apiKey:e,authMode:o,algoliaAgents:t,region:a,...m}){let h=G(r,e,o),n=B({hosts:de(a),...m,algoliaAgent:W({algoliaAgents:t,client:"Personalization",version:x}),baseHeaders:{"content-type":"text/plain",...h.headers(),...m.baseHeaders},baseQueryParameters:{...h.queryParameters(),...m.baseQueryParameters}});return {transporter:n,appId:r,apiKey:e,clearCache(){return Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then(()=>{})},get _ua(){return n.algoliaAgent.value},addAlgoliaAgent(s,i){n.algoliaAgent.add({segment:s,version:i});},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?n.baseHeaders["x-algolia-api-key"]=s:n.baseQueryParameters["x-algolia-api-key"]=s;},customDelete({path:s,parameters:i},u){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let l={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{}};return n.request(l,u)},customGet({path:s,parameters:i},u){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let l={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{}};return n.request(l,u)},customPost({path:s,parameters:i,body:u},d){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let g={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{},data:u||{}};return n.request(g,d)},customPut({path:s,parameters:i,body:u},d){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let g={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{},data:u||{}};return n.request(g,d)},deleteUserProfile({userToken:s},i){if(!s)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");let c={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(c,i)},getPersonalizationStrategy(s){let P={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return n.request(P,s)},getUserTokenProfile({userToken:s},i){if(!s)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");let c={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(c,i)},setPersonalizationStrategy(s,i){if(!s)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!s.eventsScoring)throw new Error("Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`.");if(!s.facetsScoring)throw new Error("Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`.");if(!s.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");let c={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:s};return n.request(c,i)}}}function De(r,e,o,t){if(!r||typeof r!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(!o||o&&(typeof o!="string"||!I.includes(o)))throw new Error(`\`region\` is required and must be one of the following: ${I.join(", ")}`);return X({appId:r,apiKey:e,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},logger:J(),requester:H(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:false}),hostsCache:q({caches:[j({key:`${x}-${r}`}),O()]}),...t})}
7
+ function H(){function r(e){return new Promise(o=>{let t=new XMLHttpRequest;t.open(e.method,e.url,true),Object.keys(e.headers).forEach(n=>t.setRequestHeader(n,e.headers[n]));let a=(n,s)=>setTimeout(()=>{t.abort(),o({status:0,content:s,isTimedOut:true});},n),m=a(e.connectTimeout,"Connection timeout"),h;t.onreadystatechange=()=>{t.readyState>t.OPENED&&h===void 0&&(clearTimeout(m),h=a(e.responseTimeout,"Socket timeout"));},t.onerror=()=>{t.status===0&&(clearTimeout(m),clearTimeout(h),o({content:t.responseText||"Network request failed",status:t.status,isTimedOut:false}));},t.onload=()=>{clearTimeout(m),clearTimeout(h),o({content:t.responseText,status:t.status,isTimedOut:false});},t.send(e.data);})}return {send:r}}function j(r){let e,o=`algolia-client-js-${r.key}`;function t(){return e===void 0&&(e=r.localStorage||window.localStorage),e}function a(){return JSON.parse(t().getItem(o)||"{}")}function m(n){t().setItem(o,JSON.stringify(n));}function h(){let n=r.timeToLive?r.timeToLive*1e3:null,s=a(),i=Object.fromEntries(Object.entries(s).filter(([,d])=>d.timestamp!==void 0));if(m(i),!n)return;let u=Object.fromEntries(Object.entries(i).filter(([,d])=>{let P=new Date().getTime();return !(d.timestamp+n<P)}));m(u);}return {get(n,s,i={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(h(),a()[JSON.stringify(n)])).then(u=>Promise.all([u?u.value:s(),u!==void 0])).then(([u,d])=>Promise.all([u,d||i.miss(u)])).then(([u])=>u)},set(n,s){return Promise.resolve().then(()=>{let i=a();return i[JSON.stringify(n)]={timestamp:new Date().getTime(),value:s},t().setItem(o,JSON.stringify(i)),s})},delete(n){return Promise.resolve().then(()=>{let s=a();delete s[JSON.stringify(n)],t().setItem(o,JSON.stringify(s));})},clear(){return Promise.resolve().then(()=>{t().removeItem(o);})}}}function V(){return {get(r,e,o={miss:()=>Promise.resolve()}){return e().then(a=>Promise.all([a,o.miss(a)])).then(([a])=>a)},set(r,e){return Promise.resolve(e)},delete(r){return Promise.resolve()},clear(){return Promise.resolve()}}}function q(r){let e=[...r.caches],o=e.shift();return o===void 0?V():{get(t,a,m={miss:()=>Promise.resolve()}){return o.get(t,a,m).catch(()=>q({caches:e}).get(t,a,m))},set(t,a){return o.set(t,a).catch(()=>q({caches:e}).set(t,a))},delete(t){return o.delete(t).catch(()=>q({caches:e}).delete(t))},clear(){return o.clear().catch(()=>q({caches:e}).clear())}}}function O(r={serializable:true}){let e={};return {get(o,t,a={miss:()=>Promise.resolve()}){let m=JSON.stringify(o);if(m in e)return Promise.resolve(r.serializable?JSON.parse(e[m]):e[m]);let h=t();return h.then(n=>a.miss(n)).then(()=>h)},set(o,t){return e[JSON.stringify(o)]=r.serializable?JSON.stringify(t):t,Promise.resolve(t)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function Y(r){let e={value:`Algolia for JavaScript (${r})`,add(o){let t=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(t)===-1&&(e.value=`${e.value}${t}`),e}};return e}function G(r,e,o="WithinHeaders"){let t={"x-algolia-api-key":e,"x-algolia-application-id":r};return {headers(){return o==="WithinHeaders"?t:{}},queryParameters(){return o==="WithinQueryParameters"?t:{}}}}function W({algoliaAgents:r,client:e,version:o}){let t=Y(o).add({segment:e,version:o});return r.forEach(a=>t.add(a)),t}function J(){return {debug(r,e){return Promise.resolve()},info(r,e){return Promise.resolve()},error(r,e){return Promise.resolve()}}}var L=120*1e3;function $(r,e="up"){let o=Date.now();function t(){return e==="up"||Date.now()-o>L}function a(){return e==="timed out"&&Date.now()-o<=L}return {...r,status:e,lastUpdate:o,isUp:t,isTimedOut:a}}var Q=class extends Error{name="AlgoliaError";constructor(r,e){super(r),e&&(this.name=e);}};var M=class extends Q{stackTrace;constructor(r,e,o){super(r,o),this.stackTrace=e;}},Z=class extends M{constructor(r){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",r,"RetryError");}},z=class extends M{status;constructor(r,e,o,t="ApiError"){super(r,o,t),this.status=e;}},ee=class extends Q{response;constructor(r,e){super(r,"DeserializationError"),this.response=e;}},re=class extends z{error;constructor(r,e,o,t){super(r,e,t,"DetailedApiError"),this.error=o;}};function te(r,e,o){let t=oe(o),a=`${r.protocol}://${r.url}${r.port?`:${r.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return t.length&&(a+=`?${t}`),a}function oe(r){return Object.keys(r).filter(e=>r[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(r[e])==="[object Array]"?r[e].join(","):r[e]).replace(/\+/g,"%20")}`).join("&")}function se(r,e){if(r.method==="GET"||r.data===void 0&&e.data===void 0)return;let o=Array.isArray(r.data)?r.data:{...r.data,...e.data};return JSON.stringify(o)}function ae(r,e,o){let t={Accept:"application/json",...r,...e,...o},a={};return Object.keys(t).forEach(m=>{let h=t[m];a[m.toLowerCase()]=h;}),a}function ne(r){try{return JSON.parse(r.content)}catch(e){throw new ee(e.message,r)}}function ie({content:r,status:e},o){try{let t=JSON.parse(r);return "error"in t?new re(t.message,e,t.error,o):new z(t.message,e,o)}catch{}return new z(r,e,o)}function ce({isTimedOut:r,status:e}){return !r&&~~e===0}function ue({isTimedOut:r,status:e}){return r||ce({isTimedOut:r,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function le({status:r}){return ~~(r/100)===2}function me(r){return r.map(e=>F(e))}function F(r){let e=r.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...r,request:{...r.request,headers:{...r.request.headers,...e}}}}function B({hosts:r,hostsCache:e,baseHeaders:o,logger:t,baseQueryParameters:a,algoliaAgent:m,timeouts:h,requester:n,requestsCache:s,responsesCache:i}){async function u(c){let l=await Promise.all(c.map(p=>e.get(p,()=>Promise.resolve($(p))))),g=l.filter(p=>p.isUp()),y=l.filter(p=>p.isTimedOut()),R=[...g,...y];return {hosts:R.length>0?R:c,getTimeout(p,T){return (y.length===0&&p===0?1:y.length+3+p)*T}}}async function d(c,l,g=true){let y=[],R=se(c,l),E=ae(o,c.headers,l.headers),p=c.method==="GET"?{...c.data,...l.data}:{},T={...a,...c.queryParameters,...p};if(m.value&&(T["x-algolia-agent"]=m.value),l&&l.queryParameters)for(let f of Object.keys(l.queryParameters))!l.queryParameters[f]||Object.prototype.toString.call(l.queryParameters[f])==="[object Object]"?T[f]=l.queryParameters[f]:T[f]=l.queryParameters[f].toString();let S=0,N=async(f,A)=>{let v=f.pop();if(v===void 0)throw new Z(me(y));let C={...h,...l.timeouts},k={data:R,headers:E,method:c.method,url:te(v,c.path,T),connectTimeout:A(S,C.connect),responseTimeout:A(S,g?C.read:C.write)},D=b=>{let _={request:k,response:b,host:v,triesLeft:f.length};return y.push(_),_},w=await n.send(k);if(ue(w)){let b=D(w);return w.isTimedOut&&S++,t.info("Retryable failure",F(b)),await e.set(v,$(v,w.isTimedOut?"timed out":"down")),N(f,A)}if(le(w))return ne(w);throw D(w),ie(w,y)},K=r.filter(f=>f.accept==="readWrite"||(g?f.accept==="read":f.accept==="write")),U=await u(K);return N([...U.hosts].reverse(),U.getTimeout)}function P(c,l={}){let g=c.useReadTransporter||c.method==="GET";if(!g)return d(c,l,g);let y=()=>d(c,l);if((l.cacheable||c.cacheable)!==true)return y();let E={request:c,requestOptions:l,transporter:{queryParameters:a,headers:o}};return i.get(E,()=>s.get(E,()=>s.set(E,y()).then(p=>Promise.all([s.delete(E),p]),p=>Promise.all([s.delete(E),Promise.reject(p)])).then(([p,T])=>T)),{miss:p=>i.set(E,p)})}return {hostsCache:e,requester:n,timeouts:h,logger:t,algoliaAgent:m,baseHeaders:o,baseQueryParameters:a,hosts:r,request:P,requestsCache:s,responsesCache:i}}var x="5.40.1",I=["eu","us"];function de(r){return [{url:"personalization.{region}.algolia.com".replace("{region}",r),accept:"readWrite",protocol:"https"}]}function X({appId:r,apiKey:e,authMode:o,algoliaAgents:t,region:a,...m}){let h=G(r,e,o),n=B({hosts:de(a),...m,algoliaAgent:W({algoliaAgents:t,client:"Personalization",version:x}),baseHeaders:{"content-type":"text/plain",...h.headers(),...m.baseHeaders},baseQueryParameters:{...h.queryParameters(),...m.baseQueryParameters}});return {transporter:n,appId:r,apiKey:e,clearCache(){return Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then(()=>{})},get _ua(){return n.algoliaAgent.value},addAlgoliaAgent(s,i){n.algoliaAgent.add({segment:s,version:i});},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?n.baseHeaders["x-algolia-api-key"]=s:n.baseQueryParameters["x-algolia-api-key"]=s;},customDelete({path:s,parameters:i},u){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let l={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{}};return n.request(l,u)},customGet({path:s,parameters:i},u){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let l={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{}};return n.request(l,u)},customPost({path:s,parameters:i,body:u},d){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let g={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{},data:u||{}};return n.request(g,d)},customPut({path:s,parameters:i,body:u},d){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let g={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{},data:u||{}};return n.request(g,d)},deleteUserProfile({userToken:s},i){if(!s)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");let c={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(c,i)},getPersonalizationStrategy(s){let P={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return n.request(P,s)},getUserTokenProfile({userToken:s},i){if(!s)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");let c={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(c,i)},setPersonalizationStrategy(s,i){if(!s)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!s.eventsScoring)throw new Error("Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`.");if(!s.facetsScoring)throw new Error("Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`.");if(!s.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");let c={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:s};return n.request(c,i)}}}function De(r,e,o,t){if(!r||typeof r!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(!o||o&&(typeof o!="string"||!I.includes(o)))throw new Error(`\`region\` is required and must be one of the following: ${I.join(", ")}`);return X({appId:r,apiKey:e,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},logger:J(),requester:H(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:false}),hostsCache:q({caches:[j({key:`${x}-${r}`}),O()]}),...t})}
8
8
 
9
9
  exports.apiClientVersion = x;
10
10
  exports.personalizationClient = De;
@@ -4,7 +4,7 @@ import { createFetchRequester } from "@algolia/requester-fetch";
4
4
 
5
5
  // src/personalizationClient.ts
6
6
  import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
7
- var apiClientVersion = "5.40.0";
7
+ var apiClientVersion = "5.40.1";
8
8
  var REGIONS = ["eu", "us"];
9
9
  function getDefaultHosts(region) {
10
10
  const url = "personalization.{region}.algolia.com".replace("{region}", region);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../builds/fetch.ts","../../src/personalizationClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nexport type PersonalizationClient = ReturnType<typeof createPersonalizationClient>;\n\nimport { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common';\nimport { createFetchRequester } from '@algolia/requester-fetch';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { createPersonalizationClient } from '../src/personalizationClient';\n\nimport type { Region } from '../src/personalizationClient';\nimport { REGIONS } from '../src/personalizationClient';\n\nexport type { Region, RegionOptions } from '../src/personalizationClient';\n\nexport { apiClientVersion } from '../src/personalizationClient';\n\nexport * from '../model';\n\nexport function personalizationClient(\n appId: string,\n apiKey: string,\n region: Region,\n options?: ClientOptions | undefined,\n): PersonalizationClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {\n throw new Error(`\\`region\\` is required and must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n return {\n ...createPersonalizationClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 2000,\n read: 5000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createFetchRequester(),\n algoliaAgents: [{ segment: 'Fetch' }],\n responsesCache: createNullCache(),\n requestsCache: createNullCache(),\n hostsCache: createMemoryCache(),\n ...options,\n }),\n };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\n\nimport type { DeleteUserProfileResponse } from '../model/deleteUserProfileResponse';\n\nimport type { GetUserTokenResponse } from '../model/getUserTokenResponse';\nimport type { PersonalizationStrategyParams } from '../model/personalizationStrategyParams';\nimport type { SetPersonalizationStrategyResponse } from '../model/setPersonalizationStrategyResponse';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserProfileProps,\n GetUserTokenProfileProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '5.40.0';\n\nexport const REGIONS = ['eu', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region: Region };\n\nfunction getDefaultHosts(region: Region): Host[] {\n const url = 'personalization.{region}.algolia.com'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createPersonalizationClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Personalization',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param deleteUserProfile - The deleteUserProfile object.\n * @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUserProfile(\n { userToken }: DeleteUserProfileProps,\n requestOptions?: RequestOptions,\n ): Promise<DeleteUserProfileResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `deleteUserProfile`.');\n }\n\n const requestPath = '/1/profiles/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the current personalization strategy.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getPersonalizationStrategy(requestOptions?: RequestOptions | undefined): Promise<PersonalizationStrategyParams> {\n const requestPath = '/1/strategies/personalization';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a user profile and their affinities for different facets.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param getUserTokenProfile - The getUserTokenProfile object.\n * @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getUserTokenProfile(\n { userToken }: GetUserTokenProfileProps,\n requestOptions?: RequestOptions,\n ): Promise<GetUserTokenResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `getUserTokenProfile`.');\n }\n\n const requestPath = '/1/profiles/personalization/{userToken}'.replace(\n '{userToken}',\n encodeURIComponent(userToken),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Creates a new personalization strategy.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param personalizationStrategyParams - The personalizationStrategyParams object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n setPersonalizationStrategy(\n personalizationStrategyParams: PersonalizationStrategyParams,\n requestOptions?: RequestOptions,\n ): Promise<SetPersonalizationStrategyResponse> {\n if (!personalizationStrategyParams) {\n throw new Error(\n 'Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.',\n );\n }\n\n if (!personalizationStrategyParams.eventsScoring) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`.',\n );\n }\n if (!personalizationStrategyParams.facetsScoring) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`.',\n );\n }\n if (!personalizationStrategyParams.personalizationImpact) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.',\n );\n }\n\n const requestPath = '/1/strategies/personalization';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: personalizationStrategyParams,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAIA,SAAS,mBAAmB,iBAAiB,wBAAwB;AACrE,SAAS,4BAA4B;;;ACKrC,SAAS,YAAY,mBAAmB,uBAAuB;AAiBxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAIlC,SAAS,gBAAgB,QAAwB;AAC/C,QAAM,MAAM,uCAAuC,QAAQ,YAAY,MAAM;AAE7E,SAAO,CAAC,EAAE,KAAK,QAAQ,aAAa,UAAU,QAAQ,CAAC;AACzD;AAEO,SAAS,4BAA4B;AAAA,EAC1C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAAwC;AACtC,QAAM,OAAO,WAAW,aAAa,cAAc,QAAQ;AAC3D,QAAM,cAAc,kBAAkB;AAAA,IACpC,OAAO,gBAAgB,YAAY;AAAA,IACnC,GAAG;AAAA,IACH,cAAc,gBAAgB;AAAA,MAC5B;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA,IACX,CAAC;AAAA,IACD,aAAa;AAAA,MACX,gBAAgB;AAAA,MAChB,GAAG,KAAK,QAAQ;AAAA,MAChB,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,qBAAqB;AAAA,MACnB,GAAG,KAAK,gBAAgB;AAAA,MACxB,GAAG,QAAQ;AAAA,IACb;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA;AAAA;AAAA;AAAA,IAKA,OAAO;AAAA;AAAA;AAAA;AAAA,IAKP,QAAQ;AAAA;AAAA;AAAA;AAAA,IAKR,aAA4B;AAC1B,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AAA,UACR;AAAA,QACF;AAAA,MACF;AACA,UAAI,CAAC,8BAA8B,uBAAuB;AACxD,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AAEA,YAAM,cAAc;AACpB,YAAM,UAAmB,CAAC;AAC1B,YAAM,kBAAmC,CAAC;AAE1C,YAAM,UAAmB;AAAA,QACvB,QAAQ;AAAA,QACR,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,MAAM;AAAA,MACR;AAEA,aAAO,YAAY,QAAQ,SAAS,cAAc;AAAA,IACpD;AAAA,EACF;AACF;;;AD/VO,SAAS,sBACd,OACA,QACA,QACA,SACuB;AACvB,MAAI,CAAC,SAAS,OAAO,UAAU,UAAU;AACvC,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAEA,MAAI,CAAC,UAAW,WAAW,OAAO,WAAW,YAAY,CAAC,QAAQ,SAAS,MAAM,IAAK;AACpF,UAAM,IAAI,MAAM,4DAA4D,QAAQ,KAAK,IAAI,CAAC,EAAE;AAAA,EAClG;AAEA,SAAO;AAAA,IACL,GAAG,4BAA4B;AAAA,MAC7B;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,QACR,SAAS;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,QAAQ,iBAAiB;AAAA,MACzB,WAAW,qBAAqB;AAAA,MAChC,eAAe,CAAC,EAAE,SAAS,QAAQ,CAAC;AAAA,MACpC,gBAAgB,gBAAgB;AAAA,MAChC,eAAe,gBAAgB;AAAA,MAC/B,YAAY,kBAAkB;AAAA,MAC9B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;","names":[]}
1
+ {"version":3,"sources":["../../builds/fetch.ts","../../src/personalizationClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nexport type PersonalizationClient = ReturnType<typeof createPersonalizationClient>;\n\nimport { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common';\nimport { createFetchRequester } from '@algolia/requester-fetch';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { createPersonalizationClient } from '../src/personalizationClient';\n\nimport type { Region } from '../src/personalizationClient';\nimport { REGIONS } from '../src/personalizationClient';\n\nexport type { Region, RegionOptions } from '../src/personalizationClient';\n\nexport { apiClientVersion } from '../src/personalizationClient';\n\nexport * from '../model';\n\nexport function personalizationClient(\n appId: string,\n apiKey: string,\n region: Region,\n options?: ClientOptions | undefined,\n): PersonalizationClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {\n throw new Error(`\\`region\\` is required and must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n return {\n ...createPersonalizationClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 2000,\n read: 5000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createFetchRequester(),\n algoliaAgents: [{ segment: 'Fetch' }],\n responsesCache: createNullCache(),\n requestsCache: createNullCache(),\n hostsCache: createMemoryCache(),\n ...options,\n }),\n };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\n\nimport type { DeleteUserProfileResponse } from '../model/deleteUserProfileResponse';\n\nimport type { GetUserTokenResponse } from '../model/getUserTokenResponse';\nimport type { PersonalizationStrategyParams } from '../model/personalizationStrategyParams';\nimport type { SetPersonalizationStrategyResponse } from '../model/setPersonalizationStrategyResponse';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserProfileProps,\n GetUserTokenProfileProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '5.40.1';\n\nexport const REGIONS = ['eu', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region: Region };\n\nfunction getDefaultHosts(region: Region): Host[] {\n const url = 'personalization.{region}.algolia.com'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createPersonalizationClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Personalization',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param deleteUserProfile - The deleteUserProfile object.\n * @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUserProfile(\n { userToken }: DeleteUserProfileProps,\n requestOptions?: RequestOptions,\n ): Promise<DeleteUserProfileResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `deleteUserProfile`.');\n }\n\n const requestPath = '/1/profiles/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the current personalization strategy.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getPersonalizationStrategy(requestOptions?: RequestOptions | undefined): Promise<PersonalizationStrategyParams> {\n const requestPath = '/1/strategies/personalization';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a user profile and their affinities for different facets.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param getUserTokenProfile - The getUserTokenProfile object.\n * @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getUserTokenProfile(\n { userToken }: GetUserTokenProfileProps,\n requestOptions?: RequestOptions,\n ): Promise<GetUserTokenResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `getUserTokenProfile`.');\n }\n\n const requestPath = '/1/profiles/personalization/{userToken}'.replace(\n '{userToken}',\n encodeURIComponent(userToken),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Creates a new personalization strategy.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param personalizationStrategyParams - The personalizationStrategyParams object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n setPersonalizationStrategy(\n personalizationStrategyParams: PersonalizationStrategyParams,\n requestOptions?: RequestOptions,\n ): Promise<SetPersonalizationStrategyResponse> {\n if (!personalizationStrategyParams) {\n throw new Error(\n 'Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.',\n );\n }\n\n if (!personalizationStrategyParams.eventsScoring) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`.',\n );\n }\n if (!personalizationStrategyParams.facetsScoring) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`.',\n );\n }\n if (!personalizationStrategyParams.personalizationImpact) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.',\n );\n }\n\n const requestPath = '/1/strategies/personalization';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: personalizationStrategyParams,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAIA,SAAS,mBAAmB,iBAAiB,wBAAwB;AACrE,SAAS,4BAA4B;;;ACKrC,SAAS,YAAY,mBAAmB,uBAAuB;AAiBxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAIlC,SAAS,gBAAgB,QAAwB;AAC/C,QAAM,MAAM,uCAAuC,QAAQ,YAAY,MAAM;AAE7E,SAAO,CAAC,EAAE,KAAK,QAAQ,aAAa,UAAU,QAAQ,CAAC;AACzD;AAEO,SAAS,4BAA4B;AAAA,EAC1C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAAwC;AACtC,QAAM,OAAO,WAAW,aAAa,cAAc,QAAQ;AAC3D,QAAM,cAAc,kBAAkB;AAAA,IACpC,OAAO,gBAAgB,YAAY;AAAA,IACnC,GAAG;AAAA,IACH,cAAc,gBAAgB;AAAA,MAC5B;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA,IACX,CAAC;AAAA,IACD,aAAa;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iB;AAAA,MACzB,WAAW,qBAAqB;AAAA,MAChC,eAAe,CAAC,EAAE,SAAS,QAAQ,CAAC;AAAA,MACpC,gBAAgB,gBAAgB;AAAA,MAChC,eAAe,gBAAgB;AAAA,MAC/B,YAAY,kBAAkB;AAAA,MAC9B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -29,7 +29,7 @@ var import_client_common2 = require("@algolia/client-common");
29
29
 
30
30
  // src/personalizationClient.ts
31
31
  var import_client_common = require("@algolia/client-common");
32
- var apiClientVersion = "5.40.0";
32
+ var apiClientVersion = "5.40.1";
33
33
  var REGIONS = ["eu", "us"];
34
34
  function getDefaultHosts(region) {
35
35
  const url = "personalization.{region}.algolia.com".replace("{region}", region);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../builds/node.ts","../../src/personalizationClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nexport type PersonalizationClient = ReturnType<typeof createPersonalizationClient>;\n\nimport { createHttpRequester } from '@algolia/requester-node-http';\n\nimport { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { createPersonalizationClient } from '../src/personalizationClient';\n\nimport type { Region } from '../src/personalizationClient';\nimport { REGIONS } from '../src/personalizationClient';\n\nexport type { Region, RegionOptions } from '../src/personalizationClient';\n\nexport { apiClientVersion } from '../src/personalizationClient';\n\nexport * from '../model';\n\nexport function personalizationClient(\n appId: string,\n apiKey: string,\n region: Region,\n options?: ClientOptions | undefined,\n): PersonalizationClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {\n throw new Error(`\\`region\\` is required and must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n return {\n ...createPersonalizationClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 2000,\n read: 5000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createHttpRequester(),\n algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],\n responsesCache: createNullCache(),\n requestsCache: createNullCache(),\n hostsCache: createMemoryCache(),\n ...options,\n }),\n };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\n\nimport type { DeleteUserProfileResponse } from '../model/deleteUserProfileResponse';\n\nimport type { GetUserTokenResponse } from '../model/getUserTokenResponse';\nimport type { PersonalizationStrategyParams } from '../model/personalizationStrategyParams';\nimport type { SetPersonalizationStrategyResponse } from '../model/setPersonalizationStrategyResponse';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserProfileProps,\n GetUserTokenProfileProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '5.40.0';\n\nexport const REGIONS = ['eu', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region: Region };\n\nfunction getDefaultHosts(region: Region): Host[] {\n const url = 'personalization.{region}.algolia.com'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createPersonalizationClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Personalization',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param deleteUserProfile - The deleteUserProfile object.\n * @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUserProfile(\n { userToken }: DeleteUserProfileProps,\n requestOptions?: RequestOptions,\n ): Promise<DeleteUserProfileResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `deleteUserProfile`.');\n }\n\n const requestPath = '/1/profiles/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the current personalization strategy.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getPersonalizationStrategy(requestOptions?: RequestOptions | undefined): Promise<PersonalizationStrategyParams> {\n const requestPath = '/1/strategies/personalization';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a user profile and their affinities for different facets.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param getUserTokenProfile - The getUserTokenProfile object.\n * @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getUserTokenProfile(\n { userToken }: GetUserTokenProfileProps,\n requestOptions?: RequestOptions,\n ): Promise<GetUserTokenResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `getUserTokenProfile`.');\n }\n\n const requestPath = '/1/profiles/personalization/{userToken}'.replace(\n '{userToken}',\n encodeURIComponent(userToken),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Creates a new personalization strategy.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param personalizationStrategyParams - The personalizationStrategyParams object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n setPersonalizationStrategy(\n personalizationStrategyParams: PersonalizationStrategyParams,\n requestOptions?: RequestOptions,\n ): Promise<SetPersonalizationStrategyResponse> {\n if (!personalizationStrategyParams) {\n throw new Error(\n 'Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.',\n );\n }\n\n if (!personalizationStrategyParams.eventsScoring) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`.',\n );\n }\n if (!personalizationStrategyParams.facetsScoring) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`.',\n );\n }\n if (!personalizationStrategyParams.personalizationImpact) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.',\n );\n }\n\n const requestPath = '/1/strategies/personalization';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: personalizationStrategyParams,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAI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A,MACR;AAEA,aAAO,YAAY,QAAQ,SAAS,cAAc;AAAA,IACpD;AAAA,EACF;AACF;;;AD9VO,SAAS,sBACd,OACA,QACA,QACA,SACuB;AACvB,MAAI,CAAC,SAAS,OAAO,UAAU,UAAU;AACvC,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAEA,MAAI,CAAC,UAAW,WAAW,OAAO,WAAW,YAAY,CAAC,QAAQ,SAAS,MAAM,IAAK;AACpF,UAAM,IAAI,MAAM,4DAA4D,QAAQ,KAAK,IAAI,CAAC,EAAE;AAAA,EAClG;AAEA,SAAO;AAAA,IACL,GAAG,4BAA4B;AAAA,MAC7B;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,QACR,SAAS;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,YAAQ,wCAAiB;AAAA,MACzB,eAAW,gDAAoB;AAAA,MAC/B,eAAe,CAAC,EAAE,SAAS,WAAW,SAAS,QAAQ,SAAS,KAAK,CAAC;AAAA,MACtE,oBAAgB,uCAAgB;AAAA,MAChC,mBAAe,uCAAgB;AAAA,MAC/B,gBAAY,yCAAkB;AAAA,MAC9B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;","names":["import_client_common"]}
1
+ {"version":3,"sources":["../../builds/node.ts","../../src/personalizationClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nexport type PersonalizationClient = ReturnType<typeof createPersonalizationClient>;\n\nimport { createHttpRequester } from '@algolia/requester-node-http';\n\nimport { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { createPersonalizationClient } from '../src/personalizationClient';\n\nimport type { Region } from '../src/personalizationClient';\nimport { REGIONS } from '../src/personalizationClient';\n\nexport type { Region, RegionOptions } from '../src/personalizationClient';\n\nexport { apiClientVersion } from '../src/personalizationClient';\n\nexport * from '../model';\n\nexport function personalizationClient(\n appId: string,\n apiKey: string,\n region: Region,\n options?: ClientOptions | undefined,\n): PersonalizationClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {\n throw new Error(`\\`region\\` is required and must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n return {\n ...createPersonalizationClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 2000,\n read: 5000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createHttpRequester(),\n algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],\n responsesCache: createNullCache(),\n requestsCache: createNullCache(),\n hostsCache: createMemoryCache(),\n ...options,\n }),\n };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\n\nimport type { DeleteUserProfileResponse } from '../model/deleteUserProfileResponse';\n\nimport type { GetUserTokenResponse } from '../model/getUserTokenResponse';\nimport type { PersonalizationStrategyParams } from '../model/personalizationStrategyParams';\nimport type { SetPersonalizationStrategyResponse } from '../model/setPersonalizationStrategyResponse';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserProfileProps,\n GetUserTokenProfileProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '5.40.1';\n\nexport const REGIONS = ['eu', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region: Region };\n\nfunction getDefaultHosts(region: Region): Host[] {\n const url = 'personalization.{region}.algolia.com'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createPersonalizationClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Personalization',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param deleteUserProfile - The deleteUserProfile object.\n * @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUserProfile(\n { userToken }: DeleteUserProfileProps,\n requestOptions?: RequestOptions,\n ): Promise<DeleteUserProfileResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `deleteUserProfile`.');\n }\n\n const requestPath = '/1/profiles/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the current personalization strategy.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getPersonalizationStrategy(requestOptions?: RequestOptions | undefined): Promise<PersonalizationStrategyParams> {\n const requestPath = '/1/strategies/personalization';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a user profile and their affinities for different facets.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param getUserTokenProfile - The getUserTokenProfile object.\n * @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getUserTokenProfile(\n { userToken }: GetUserTokenProfileProps,\n requestOptions?: RequestOptions,\n ): Promise<GetUserTokenResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `getUserTokenProfile`.');\n }\n\n const requestPath = '/1/profiles/personalization/{userToken}'.replace(\n '{userToken}',\n encodeURIComponent(userToken),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Creates a new personalization strategy.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param personalizationStrategyParams - The personalizationStrategyParams object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n setPersonalizationStrategy(\n personalizationStrategyParams: PersonalizationStrategyParams,\n requestOptions?: RequestOptions,\n ): Promise<SetPersonalizationStrategyResponse> {\n if (!personalizationStrategyParams) {\n throw new Error(\n 'Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.',\n );\n }\n\n if (!personalizationStrategyParams.eventsScoring) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`.',\n );\n }\n if (!personalizationStrategyParams.facetsScoring) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`.',\n );\n }\n if (!personalizationStrategyParams.personalizationImpact) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.',\n );\n }\n\n const requestPath = '/1/strategies/personalization';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: personalizationStrategyParams,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,iCAAoC;AAEpC,IAAAA,wBAAqE;;;ACIrE,2BAA+D;AAiBxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAIlC,SAAS,gBAAgB,QAAwB;AAC/C,QAAM,MAAM,uCAAuC,QAAQ,YAAY,MAAM;AAE7E,SAAO,CAAC,EAAE,KAAK,QAAQ,aAAa,UAAU,QAAQ,CAAC;AACzD;AAEO,SAAS,4BAA4B;AAAA,EAC1C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAAwC;AACtC,QAAM,WAAO,iCAAW,aAAa,cAAc,QAAQ;AAC3D,QAAM,kBAAc,wCAAkB;AAAA,IACpC,OAAO,gBAAgB,YAAY;AAAA,IACnC,GAAG;AAAA,IACH,kBAAc,sCAAgB;AAAA,MAC5B;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA,IACX,CAAC;AAAA,IACD,aAAa;AAAA,MACX,gBAAgB;AAAA,MAChB,GAAG,KAAK,QAAQ;AAAA,MAChB,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,qBAAqB;AAAA,MACnB,GAAG,KAAK,gBAAgB;AAAA,MACxB,GAAG,QAAQ;AAAA,IACb;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA;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,CAAC;AAAA,EACH;AACF;","names":["import_client_common"]}
@@ -4,7 +4,7 @@ import { createMemoryCache, createNullCache, createNullLogger } from "@algolia/c
4
4
 
5
5
  // src/personalizationClient.ts
6
6
  import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
7
- var apiClientVersion = "5.40.0";
7
+ var apiClientVersion = "5.40.1";
8
8
  var REGIONS = ["eu", "us"];
9
9
  function getDefaultHosts(region) {
10
10
  const url = "personalization.{region}.algolia.com".replace("{region}", region);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../builds/node.ts","../../src/personalizationClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nexport type PersonalizationClient = ReturnType<typeof createPersonalizationClient>;\n\nimport { createHttpRequester } from '@algolia/requester-node-http';\n\nimport { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { createPersonalizationClient } from '../src/personalizationClient';\n\nimport type { Region } from '../src/personalizationClient';\nimport { REGIONS } from '../src/personalizationClient';\n\nexport type { Region, RegionOptions } from '../src/personalizationClient';\n\nexport { apiClientVersion } from '../src/personalizationClient';\n\nexport * from '../model';\n\nexport function personalizationClient(\n appId: string,\n apiKey: string,\n region: Region,\n options?: ClientOptions | undefined,\n): PersonalizationClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {\n throw new Error(`\\`region\\` is required and must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n return {\n ...createPersonalizationClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 2000,\n read: 5000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createHttpRequester(),\n algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],\n responsesCache: createNullCache(),\n requestsCache: createNullCache(),\n hostsCache: createMemoryCache(),\n ...options,\n }),\n };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\n\nimport type { DeleteUserProfileResponse } from '../model/deleteUserProfileResponse';\n\nimport type { GetUserTokenResponse } from '../model/getUserTokenResponse';\nimport type { PersonalizationStrategyParams } from '../model/personalizationStrategyParams';\nimport type { SetPersonalizationStrategyResponse } from '../model/setPersonalizationStrategyResponse';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserProfileProps,\n GetUserTokenProfileProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '5.40.0';\n\nexport const REGIONS = ['eu', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region: Region };\n\nfunction getDefaultHosts(region: Region): Host[] {\n const url = 'personalization.{region}.algolia.com'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createPersonalizationClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Personalization',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param deleteUserProfile - The deleteUserProfile object.\n * @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUserProfile(\n { userToken }: DeleteUserProfileProps,\n requestOptions?: RequestOptions,\n ): Promise<DeleteUserProfileResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `deleteUserProfile`.');\n }\n\n const requestPath = '/1/profiles/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the current personalization strategy.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getPersonalizationStrategy(requestOptions?: RequestOptions | undefined): Promise<PersonalizationStrategyParams> {\n const requestPath = '/1/strategies/personalization';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a user profile and their affinities for different facets.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param getUserTokenProfile - The getUserTokenProfile object.\n * @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getUserTokenProfile(\n { userToken }: GetUserTokenProfileProps,\n requestOptions?: RequestOptions,\n ): Promise<GetUserTokenResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `getUserTokenProfile`.');\n }\n\n const requestPath = '/1/profiles/personalization/{userToken}'.replace(\n '{userToken}',\n encodeURIComponent(userToken),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Creates a new personalization strategy.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param personalizationStrategyParams - The personalizationStrategyParams object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n setPersonalizationStrategy(\n personalizationStrategyParams: PersonalizationStrategyParams,\n requestOptions?: RequestOptions,\n ): Promise<SetPersonalizationStrategyResponse> {\n if (!personalizationStrategyParams) {\n throw new Error(\n 'Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.',\n );\n }\n\n if (!personalizationStrategyParams.eventsScoring) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`.',\n );\n }\n if (!personalizationStrategyParams.facetsScoring) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`.',\n );\n }\n if (!personalizationStrategyParams.personalizationImpact) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.',\n );\n }\n\n const requestPath = '/1/strategies/personalization';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: personalizationStrategyParams,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAIA,SAAS,2BAA2B;AAEpC,SAAS,mBAAmB,iBAAiB,wBAAwB;;;ACIrE,SAAS,YAAY,mBAAmB,uBAAuB;AAiBxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAIlC,SAAS,gBAAgB,QAAwB;AAC/C,QAAM,MAAM,uCAAuC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AI,MAAM,qBAAqB;AAAA,EACvC;AAEA,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAEA,MAAI,CAAC,UAAW,WAAW,OAAO,WAAW,YAAY,CAAC,QAAQ,SAAS,MAAM,IAAK;AACpF,UAAM,IAAI,MAAM,4DAA4D,QAAQ,KAAK,IAAI,CAAC,EAAE;AAAA,EAClG;AAEA,SAAO;AAAA,IACL,GAAG,4BAA4B;AAAA,MAC7B;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,QACR,SAAS;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,QAAQ,iBAAiB;AAAA,MACzB,WAAW,oBAAoB;AAAA,MAC/B,eAAe,CAAC,EAAE,SAAS,WAAW,SAAS,QAAQ,SAAS,KAAK,CAAC;AAAA,MACtE,gBAAgB,gBAAgB;AAAA,MAChC,eAAe,gBAAgB;AAAA,MAC/B,YAAY,kBAAkB;AAAA,MAC9B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;","names":[]}
1
+ {"version":3,"sources":["../../builds/node.ts","../../src/personalizationClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nexport type PersonalizationClient = ReturnType<typeof createPersonalizationClient>;\n\nimport { createHttpRequester } from '@algolia/requester-node-http';\n\nimport { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { createPersonalizationClient } from '../src/personalizationClient';\n\nimport type { Region } from '../src/personalizationClient';\nimport { REGIONS } from '../src/personalizationClient';\n\nexport type { Region, RegionOptions } from '../src/personalizationClient';\n\nexport { apiClientVersion } from '../src/personalizationClient';\n\nexport * from '../model';\n\nexport function personalizationClient(\n appId: string,\n apiKey: string,\n region: Region,\n options?: ClientOptions | undefined,\n): PersonalizationClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {\n throw new Error(`\\`region\\` is required and must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n return {\n ...createPersonalizationClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 2000,\n read: 5000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createHttpRequester(),\n algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],\n responsesCache: createNullCache(),\n requestsCache: createNullCache(),\n hostsCache: createMemoryCache(),\n ...options,\n }),\n };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\n\nimport type { DeleteUserProfileResponse } from '../model/deleteUserProfileResponse';\n\nimport type { GetUserTokenResponse } from '../model/getUserTokenResponse';\nimport type { PersonalizationStrategyParams } from '../model/personalizationStrategyParams';\nimport type { SetPersonalizationStrategyResponse } from '../model/setPersonalizationStrategyResponse';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserProfileProps,\n GetUserTokenProfileProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '5.40.1';\n\nexport const REGIONS = ['eu', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region: Region };\n\nfunction getDefaultHosts(region: Region): Host[] {\n const url = 'personalization.{region}.algolia.com'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createPersonalizationClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Personalization',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param deleteUserProfile - The deleteUserProfile object.\n * @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUserProfile(\n { userToken }: DeleteUserProfileProps,\n requestOptions?: RequestOptions,\n ): Promise<DeleteUserProfileResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `deleteUserProfile`.');\n }\n\n const requestPath = '/1/profiles/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the current personalization strategy.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getPersonalizationStrategy(requestOptions?: RequestOptions | undefined): Promise<PersonalizationStrategyParams> {\n const requestPath = '/1/strategies/personalization';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a user profile and their affinities for different facets.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param getUserTokenProfile - The getUserTokenProfile object.\n * @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getUserTokenProfile(\n { userToken }: GetUserTokenProfileProps,\n requestOptions?: RequestOptions,\n ): Promise<GetUserTokenResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `getUserTokenProfile`.');\n }\n\n const requestPath = '/1/profiles/personalization/{userToken}'.replace(\n '{userToken}',\n encodeURIComponent(userToken),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Creates a new personalization strategy.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param personalizationStrategyParams - The personalizationStrategyParams object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n setPersonalizationStrategy(\n personalizationStrategyParams: PersonalizationStrategyParams,\n requestOptions?: RequestOptions,\n ): Promise<SetPersonalizationStrategyResponse> {\n if (!personalizationStrategyParams) {\n throw new Error(\n 'Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.',\n );\n }\n\n if (!personalizationStrategyParams.eventsScoring) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`.',\n );\n }\n if (!personalizationStrategyParams.facetsScoring) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`.',\n );\n }\n if (!personalizationStrategyParams.personalizationImpact) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.',\n );\n }\n\n const requestPath = '/1/strategies/personalization';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: personalizationStrategyParams,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAIA,SAAS,2BAA2B;AAEpC,SAAS,mBAAmB,iBAAiB,wBAAwB;;;ACIrE,SAAS,YAAY,mBAAmB,uBAAuB;AAiBxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAIlC,SAAS,gBAAgB,QAAwB;AAC/C,QAAM,MAAM,uCAAuC,QAAQ,YAAY,MAAM;AAE7E,SAAO,CAAC,EAAE,KAAK,QAAQ,aAAa,UAAU,QAAQ,CAAC;AACzD;AAEO,SAAS,4BAA4B;AAAA,EAC1C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAAwC;AACtC,QAAM,OAAO,WAAW,aAAa,cAAc,QAAQ;AAC3D,QAAM,cAAc,kBAAkB;AAAA,IACpC,OAAO,gBAAgB,YAAY;AAAA,IACnC,GAAG;AAAA,IACH,cAAc,gBAAgB;AAAA,MAC5B;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA,IACX,CAAC;AAAA,IACD,aAAa;AAAA,MACX,gBAAgB;AAAA,MAChB,GAAG,KAAK,QAAQ;AAAA,MAChB,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,qBAAqB;AAAA,MACnB,GAAG,KAAK,gBAAgB;AAAA,MACxB,GAAG,QAAQ;AAAA,IACb;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA;AAAA;AAAA;AAAA,IAKA,OAAO;AAAA;AAAA;AAAA;AAAA,IAKP,QAAQ;AAAA;AAAA;AAAA;AAAA,IAKR,aAA4B;AAC1B,aAAO,QAAQ,IAAI,CAAC,YAAY,cAAc,MAAM,GAAG,YAAY,eAAe,MAAM,CAAC,CAAC,EAAE,KAA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UACR;AAAA,QACF;AAAA,MACF;AAEA,YAAM,cAAc;AACpB,YAAM,UAAmB,CAAC;AAC1B,YAAM,kBAAmC,CAAC;AAE1C,YAAM,UAAmB;AAAA,QACvB,QAAQ;AAAA,QACR,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,MAAM;AAAA,MACR;AAEA,aAAO,YAAY,QAAQ,SAAS,cAAc;AAAA,IACpD;AAAA,EACF;AACF;;;AD9VO,SAAS,sBACd,OACA,QACA,QACA,SACuB;AACvB,MAAI,CAAC,SAAS,OAAO,UAAU,UAAU;AACvC,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAEA,MAAI,CAAC,UAAW,WAAW,OAAO,WAAW,YAAY,CAAC,QAAQ,SAAS,MAAM,IAAK;AACpF,UAAM,IAAI,MAAM,4DAA4D,QAAQ,KAAK,IAAI,CAAC,EAAE;AAAA,EAClG;AAEA,SAAO;AAAA,IACL,GAAG,4BAA4B;AAAA,MAC7B;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,QACR,SAAS;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,QAAQ,iBAAiB;AAAA,MACzB,WAAW,oBAAoB;AAAA,MAC/B,eAAe,CAAC,EAAE,SAAS,WAAW,SAAS,QAAQ,SAAS,KAAK,CAAC;AAAA,MACtE,gBAAgB,gBAAgB;AAAA,MAChC,eAAe,gBAAgB;AAAA,MAC/B,YAAY,kBAAkB;AAAA,MAC9B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -4,7 +4,7 @@ import { createFetchRequester } from "@algolia/requester-fetch";
4
4
 
5
5
  // src/personalizationClient.ts
6
6
  import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
7
- var apiClientVersion = "5.40.0";
7
+ var apiClientVersion = "5.40.1";
8
8
  var REGIONS = ["eu", "us"];
9
9
  function getDefaultHosts(region) {
10
10
  const url = "personalization.{region}.algolia.com".replace("{region}", region);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../builds/worker.ts","../../src/personalizationClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nexport type PersonalizationClient = ReturnType<typeof createPersonalizationClient>;\n\nimport { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common';\nimport { createFetchRequester } from '@algolia/requester-fetch';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { createPersonalizationClient } from '../src/personalizationClient';\n\nimport type { Region } from '../src/personalizationClient';\nimport { REGIONS } from '../src/personalizationClient';\n\nexport type { Region, RegionOptions } from '../src/personalizationClient';\n\nexport { apiClientVersion } from '../src/personalizationClient';\n\nexport * from '../model';\n\nexport function personalizationClient(\n appId: string,\n apiKey: string,\n region: Region,\n options?: ClientOptions | undefined,\n): PersonalizationClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {\n throw new Error(`\\`region\\` is required and must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n return {\n ...createPersonalizationClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 2000,\n read: 5000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createFetchRequester(),\n algoliaAgents: [{ segment: 'Worker' }],\n responsesCache: createNullCache(),\n requestsCache: createNullCache(),\n hostsCache: createMemoryCache(),\n ...options,\n }),\n };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\n\nimport type { DeleteUserProfileResponse } from '../model/deleteUserProfileResponse';\n\nimport type { GetUserTokenResponse } from '../model/getUserTokenResponse';\nimport type { PersonalizationStrategyParams } from '../model/personalizationStrategyParams';\nimport type { SetPersonalizationStrategyResponse } from '../model/setPersonalizationStrategyResponse';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserProfileProps,\n GetUserTokenProfileProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '5.40.0';\n\nexport const REGIONS = ['eu', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region: Region };\n\nfunction getDefaultHosts(region: Region): Host[] {\n const url = 'personalization.{region}.algolia.com'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createPersonalizationClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Personalization',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param deleteUserProfile - The deleteUserProfile object.\n * @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUserProfile(\n { userToken }: DeleteUserProfileProps,\n requestOptions?: RequestOptions,\n ): Promise<DeleteUserProfileResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `deleteUserProfile`.');\n }\n\n const requestPath = '/1/profiles/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the current personalization strategy.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getPersonalizationStrategy(requestOptions?: RequestOptions | undefined): Promise<PersonalizationStrategyParams> {\n const requestPath = '/1/strategies/personalization';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a user profile and their affinities for different facets.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param getUserTokenProfile - The getUserTokenProfile object.\n * @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getUserTokenProfile(\n { userToken }: GetUserTokenProfileProps,\n requestOptions?: RequestOptions,\n ): Promise<GetUserTokenResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `getUserTokenProfile`.');\n }\n\n const requestPath = '/1/profiles/personalization/{userToken}'.replace(\n '{userToken}',\n encodeURIComponent(userToken),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Creates a new personalization strategy.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param personalizationStrategyParams - The personalizationStrategyParams object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n setPersonalizationStrategy(\n personalizationStrategyParams: PersonalizationStrategyParams,\n requestOptions?: RequestOptions,\n ): Promise<SetPersonalizationStrategyResponse> {\n if (!personalizationStrategyParams) {\n throw new Error(\n 'Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.',\n );\n }\n\n if (!personalizationStrategyParams.eventsScoring) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`.',\n );\n }\n if (!personalizationStrategyParams.facetsScoring) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`.',\n );\n }\n if (!personalizationStrategyParams.personalizationImpact) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.',\n );\n }\n\n const requestPath = '/1/strategies/personalization';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: personalizationStrategyParams,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAIA,SAAS,mBAAmB,iBAAiB,wBAAwB;AACrE,SAAS,4BAA4B;;;ACKrC,SAAS,YAAY,mBAAmB,uBAAuB;AAiBxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAIlC,SAAS,gBAAgB,QAAwB;AAC/C,QAAM,MAAM,uCAAuC,QAAQ,YAAY,MAAM;AAE7E,SAAO,CAAC,EAAE,KAAK,QAAQ,aAAa,UAAU,QAAQ,CAAC;AACzD;AAEO,SAAS,4BAA4B;AAAA,EAC1C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAAwC;AACtC,QAAM,OAA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Q,KAAK,IAAI,CAAC,EAAE;AAAA,EAClG;AAEA,SAAO;AAAA,IACL,GAAG,4BAA4B;AAAA,MAC7B;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,QACR,SAAS;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,QAAQ,iBAAiB;AAAA,MACzB,WAAW,qBAAqB;AAAA,MAChC,eAAe,CAAC,EAAE,SAAS,SAAS,CAAC;AAAA,MACrC,gBAAgB,gBAAgB;AAAA,MAChC,eAAe,gBAAgB;AAAA,MAC/B,YAAY,kBAAkB;AAAA,MAC9B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;","names":[]}
1
+ {"version":3,"sources":["../../builds/worker.ts","../../src/personalizationClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nexport type PersonalizationClient = ReturnType<typeof createPersonalizationClient>;\n\nimport { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common';\nimport { createFetchRequester } from '@algolia/requester-fetch';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { createPersonalizationClient } from '../src/personalizationClient';\n\nimport type { Region } from '../src/personalizationClient';\nimport { REGIONS } from '../src/personalizationClient';\n\nexport type { Region, RegionOptions } from '../src/personalizationClient';\n\nexport { apiClientVersion } from '../src/personalizationClient';\n\nexport * from '../model';\n\nexport function personalizationClient(\n appId: string,\n apiKey: string,\n region: Region,\n options?: ClientOptions | undefined,\n): PersonalizationClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {\n throw new Error(`\\`region\\` is required and must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n return {\n ...createPersonalizationClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 2000,\n read: 5000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createFetchRequester(),\n algoliaAgents: [{ segment: 'Worker' }],\n responsesCache: createNullCache(),\n requestsCache: createNullCache(),\n hostsCache: createMemoryCache(),\n ...options,\n }),\n };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\n\nimport type { DeleteUserProfileResponse } from '../model/deleteUserProfileResponse';\n\nimport type { GetUserTokenResponse } from '../model/getUserTokenResponse';\nimport type { PersonalizationStrategyParams } from '../model/personalizationStrategyParams';\nimport type { SetPersonalizationStrategyResponse } from '../model/setPersonalizationStrategyResponse';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserProfileProps,\n GetUserTokenProfileProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '5.40.1';\n\nexport const REGIONS = ['eu', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region: Region };\n\nfunction getDefaultHosts(region: Region): Host[] {\n const url = 'personalization.{region}.algolia.com'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createPersonalizationClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Personalization',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param deleteUserProfile - The deleteUserProfile object.\n * @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUserProfile(\n { userToken }: DeleteUserProfileProps,\n requestOptions?: RequestOptions,\n ): Promise<DeleteUserProfileResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `deleteUserProfile`.');\n }\n\n const requestPath = '/1/profiles/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the current personalization strategy.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getPersonalizationStrategy(requestOptions?: RequestOptions | undefined): Promise<PersonalizationStrategyParams> {\n const requestPath = '/1/strategies/personalization';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a user profile and their affinities for different facets.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param getUserTokenProfile - The getUserTokenProfile object.\n * @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getUserTokenProfile(\n { userToken }: GetUserTokenProfileProps,\n requestOptions?: RequestOptions,\n ): Promise<GetUserTokenResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `getUserTokenProfile`.');\n }\n\n const requestPath = '/1/profiles/personalization/{userToken}'.replace(\n '{userToken}',\n encodeURIComponent(userToken),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Creates a new personalization strategy.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param personalizationStrategyParams - The personalizationStrategyParams object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n setPersonalizationStrategy(\n personalizationStrategyParams: PersonalizationStrategyParams,\n requestOptions?: RequestOptions,\n ): Promise<SetPersonalizationStrategyResponse> {\n if (!personalizationStrategyParams) {\n throw new Error(\n 'Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.',\n );\n }\n\n if (!personalizationStrategyParams.eventsScoring) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`.',\n );\n }\n if (!personalizationStrategyParams.facetsScoring) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`.',\n );\n }\n if (!personalizationStrategyParams.personalizationImpact) {\n throw new Error(\n 'Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.',\n );\n }\n\n const requestPath = '/1/strategies/personalization';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: personalizationStrategyParams,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAIA,SAAS,mBAAmB,iBAAiB,wBAAwB;AACrE,SAAS,4BAA4B;;;ACKrC,SAAS,YAAY,mBAAmB,uBAAuB;AAiBxD,IAAM,mBAAm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D/VO,SAAS,sBACd,OACA,QACA,QACA,SACuB;AACvB,MAAI,CAAC,SAAS,OAAO,UAAU,UAAU;AACvC,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAEA,MAAI,CAAC,UAAW,WAAW,OAAO,WAAW,YAAY,CAAC,QAAQ,SAAS,MAAM,IAAK;AACpF,UAAM,IAAI,MAAM,4DAA4D,QAAQ,KAAK,IAAI,CAAC,EAAE;AAAA,EAClG;AAEA,SAAO;AAAA,IACL,GAAG,4BAA4B;AAAA,MAC7B;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,QACR,SAAS;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,QAAQ,iBAAiB;AAAA,MACzB,WAAW,qBAAqB;AAAA,MAChC,eAAe,CAAC,EAAE,SAAS,SAAS,CAAC;AAAA,MACrC,gBAAgB,gBAAgB;AAAA,MAChC,eAAe,gBAAgB;AAAA,MAC/B,YAAY,kBAAkB;AAAA,MAC9B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;","names":[]}
package/dist/fetch.d.ts CHANGED
@@ -164,7 +164,7 @@ type GetUserTokenProfileProps = {
164
164
  userToken: string;
165
165
  };
166
166
 
167
- declare const apiClientVersion = "5.40.0";
167
+ declare const apiClientVersion = "5.40.1";
168
168
  declare const REGIONS: readonly ["eu", "us"];
169
169
  type Region = (typeof REGIONS)[number];
170
170
  type RegionOptions = {
package/dist/node.d.cts CHANGED
@@ -164,7 +164,7 @@ type GetUserTokenProfileProps = {
164
164
  userToken: string;
165
165
  };
166
166
 
167
- declare const apiClientVersion = "5.40.0";
167
+ declare const apiClientVersion = "5.40.1";
168
168
  declare const REGIONS: readonly ["eu", "us"];
169
169
  type Region = (typeof REGIONS)[number];
170
170
  type RegionOptions = {
package/dist/node.d.ts CHANGED
@@ -164,7 +164,7 @@ type GetUserTokenProfileProps = {
164
164
  userToken: string;
165
165
  };
166
166
 
167
- declare const apiClientVersion = "5.40.0";
167
+ declare const apiClientVersion = "5.40.1";
168
168
  declare const REGIONS: readonly ["eu", "us"];
169
169
  type Region = (typeof REGIONS)[number];
170
170
  type RegionOptions = {
@@ -26,7 +26,7 @@ __export(personalizationClient_exports, {
26
26
  });
27
27
  module.exports = __toCommonJS(personalizationClient_exports);
28
28
  var import_client_common = require("@algolia/client-common");
29
- var apiClientVersion = "5.40.0";
29
+ var apiClientVersion = "5.40.1";
30
30
  var REGIONS = ["eu", "us"];
31
31
  function getDefaultHosts(region) {
32
32
  const url = "personalization.{region}.algolia.com".replace("{region}", region);