Socket
Socket
Sign inDemoInstall

@algolia/client-abtesting

Package Overview
Dependencies
Maintainers
67
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/client-abtesting - npm Package Compare versions

Comparing version 5.0.0-alpha.2 to 5.0.0-alpha.3

4

dist/builds/browser.d.ts

@@ -1,6 +0,6 @@

import type { InitClientOptions } from '@algolia/client-common';
import type { ClientOptions } from '@algolia/client-common';
import type { AbtestingClient, Region } from '../src/abtestingClient';
export { apiClientVersion, AbtestingClient } from '../src/abtestingClient';
export * from '../model';
export declare function abtestingClient(appId: string, apiKey: string, region?: Region, options?: InitClientOptions): AbtestingClient;
export declare function abtestingClient(appId: string, apiKey: string, region?: Region, options?: ClientOptions): AbtestingClient;
//# sourceMappingURL=browser.d.ts.map

@@ -1,6 +0,6 @@

import type { InitClientOptions } from '@algolia/client-common';
import type { ClientOptions } from '@algolia/client-common';
import type { AbtestingClient, Region } from '../src/abtestingClient';
export { apiClientVersion, AbtestingClient } from '../src/abtestingClient';
export * from '../model';
export declare function abtestingClient(appId: string, apiKey: string, region?: Region, options?: InitClientOptions): AbtestingClient;
export declare function abtestingClient(appId: string, apiKey: string, region?: Region, options?: ClientOptions): AbtestingClient;
//# sourceMappingURL=node.d.ts.map

@@ -9,3 +9,3 @@ 'use strict';

// This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
const apiClientVersion = '5.0.0-alpha.2';
const apiClientVersion = '5.0.0-alpha.3';
const REGIONS = ['de', 'us'];

@@ -12,0 +12,0 @@ function getDefaultHosts(region) {

@@ -713,3 +713,3 @@ function createAuth(appId, apiKey, authMode = 'WithinHeaders') {

// This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
const apiClientVersion = '5.0.0-alpha.2';
const apiClientVersion = '5.0.0-alpha.3';
const REGIONS = ['de', 'us'];

@@ -716,0 +716,0 @@ function getDefaultHosts(region) {

@@ -5,3 +5,3 @@ import { createAuth, createTransporter, getAlgoliaAgent, DEFAULT_CONNECT_TIMEOUT_NODE, DEFAULT_READ_TIMEOUT_NODE, DEFAULT_WRITE_TIMEOUT_NODE, createNullCache, createMemoryCache } from '@algolia/client-common';

// This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
const apiClientVersion = '5.0.0-alpha.2';
const apiClientVersion = '5.0.0-alpha.3';
const REGIONS = ['de', 'us'];

@@ -8,0 +8,0 @@ function getDefaultHosts(region) {

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

/*! client-abtesting.umd.js | 5.0.0-alpha.2 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/client-abtesting"]={})}(this,(function(e){"use strict";function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e){let t;const r=`algolia-client-js-${e.key}`;function s(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(s().getItem(r)||"{}")}return{get:(e,t,r={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{const r=JSON.stringify(e),s=a()[r];return Promise.all([s||t(),void 0!==s])})).then((([e,t])=>Promise.all([e,t||r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=a();return n[JSON.stringify(e)]=t,s().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=a();delete t[JSON.stringify(e)],s().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{s().removeItem(r)}))}}function s(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,n={miss:()=>Promise.resolve()})=>r.get(e,a,n).catch((()=>s({caches:t}).get(e,a,n))),set:(e,a)=>r.set(e,a).catch((()=>s({caches:t}).set(e,a))),delete:e=>r.delete(e).catch((()=>s({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>s({caches:t}).clear()))}}function a(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=s();return o.then((e=>a.miss(e))).then((()=>o))},set:(r,s)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const n=12e4;function o(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>n},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=n}}}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class c extends Error{constructor(e,t){super(e),i(this,"name","AlgoliaError"),t&&(this.name=t)}}class u extends c{constructor(e,t,r){super(e,r),i(this,"stackTrace",void 0),this.stackTrace=t}}class l extends u{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",e,"RetryError")}}class d extends u{constructor(e,t,r){super(e,r,"ApiError"),i(this,"status",void 0),this.status=t}}class h extends c{constructor(e,t){super(e,"DeserializationError"),i(this,"response",void 0),this.response=t}}function p(e,t,r){const s=function(e){const t=e=>"[object Object]"===Object.prototype.toString.call(e)||"[object Array]"===Object.prototype.toString.call(e);return Object.keys(e).map((r=>`${r}=${t(e[r])?JSON.stringify(e[r]):e[r]}`)).join("&")}(r);let a=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return s.length&&(a+=`?${s}`),a}function m(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function f({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:n,requester:i,requestsCache:c,responsesCache:u}){async function f(c,u,f=!0){const g=[],y=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,u),b=function(e,t,r){const s={Accept:"application/json",...e,...t,...r},a={};return Object.keys(s).forEach((e=>{const t=s[e];a[e.toLowerCase()]=t})),a}(r,c.headers,u.headers),P="GET"===c.method?{...c.data,...u.data}:{},O={"x-algolia-agent":a.value,...s,...c.queryParameters,...P};if(u&&u.queryParameters)for(const e of Object.keys(u.queryParameters))u.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(u.queryParameters[e])?O[e]=u.queryParameters[e].toString():O[e]=u.queryParameters[e];let v=0;const w=async(e,r)=>{const s=e.pop();if(void 0===s)throw new l(function(e){return e.map((e=>m(e)))}(g));let a=u.timeout;void 0===a&&(a=f?n.read:n.write);const P={data:y,headers:b,method:c.method,url:p(s,c.path,O),connectTimeout:r(v,n.connect),responseTimeout:r(v,a)},q=t=>{const r={request:P,response:t,host:s,triesLeft:e.length};return g.push(r),r},T=await i.send(P);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&0==~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(T)){const a=q(T);return T.isTimedOut&&v++,console.log("Retryable failure",m(a)),await t.set(s,o(s,T.isTimedOut?"timed out":"down")),w(e,r)}if(function({status:e}){return 2==~~(e/100)}(T))return function(e){try{return JSON.parse(e.content)}catch(t){throw new h(t.message,e)}}(T);throw q(T),function({content:e,status:t},r){let s=e;try{s=JSON.parse(e).message}catch(e){}return new d(s,t,r)}(T,g)},q=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),T=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(o(e))))))),s=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),n=[...s,...a];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(q);return w([...T.hosts].reverse(),T.getTimeout)}return{hostsCache:t,requester:i,timeouts:n,algoliaAgent:a,baseHeaders:r,baseQueryParameters:s,hosts:e,request:function(e,t={}){const a=e.useReadTransporter||"GET"===e.method;if(!a)return f(e,t,a);const n=()=>f(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return u.get(o,(()=>c.get(o,(()=>c.set(o,n()).then((e=>Promise.all([c.delete(o),e])),(e=>Promise.all([c.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>u.set(o,e)})},requestsCache:c,responsesCache:u}}function g({algoliaAgents:e,client:t,version:r}){const s=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>s.add(e))),s}function y(e,t){if(null==e)return{};var r,s,a=function(e,t){if(null==e)return{};var r,s,a={},n=Object.keys(e);for(s=0;s<n.length;s++)r=n[s],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s<n.length;s++)r=n[s],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var b=["appId","apiKey","authMode","algoliaAgents","region"];function P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,s)}return r}function O(e){for(var r=1;r<arguments.length;r++){var s=null!=arguments[r]?arguments[r]:{};r%2?P(Object(s),!0).forEach((function(r){t(e,r,s[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):P(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}var v="5.0.0-alpha.2",w=["de","us"];function q(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,s)}return r}e.abtestingClient=function(e,n,o,i){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!n||"string"!=typeof n)throw new Error("`apiKey` is missing.");if(o&&("string"!=typeof o||!w.includes(o)))throw new Error("`region` must be one of the following: ".concat(w.join(", ")));return function(e){var t,r=e.appId,s=e.apiKey,a=e.authMode,n=e.algoliaAgents,o=e.region,i=y(e,b),c=function(e,t,r="WithinHeaders"){const s={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?s:{},queryParameters:()=>"WithinQueryParameters"===r?s:{}}}(r,s,a),u=f(O(O({hosts:(t=o,[{url:t?"analytics.{region}.algolia.com".replace("{region}",t):"analytics.algolia.com",accept:"readWrite",protocol:"https"}])},i),{},{algoliaAgent:g({algoliaAgents:n,client:"Abtesting",version:v}),baseHeaders:O(O({"content-type":"text/plain"},c.headers()),i.baseHeaders),baseQueryParameters:O(O({},c.queryParameters()),i.baseQueryParameters)}));return{transporter:u,get _ua(){return u.algoliaAgent.value},addAlgoliaAgent:function(e,t){u.algoliaAgent.add({segment:e,version:t})},addABTests:function(e,t){if(!e)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!e.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!e.variant)throw new Error("Parameter `addABTestsRequest.variant` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");var r={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return u.request(r,t)},del:function(e,t){var r=e.path,s=e.parameters;if(!r)throw new Error("Parameter `path` is required when calling `del`.");var a={method:"DELETE",path:"/1{path}".replace("{path}",r),queryParameters:s||{},headers:{}};return u.request(a,t)},deleteABTest:function(e,t){var r=e.id;if(!r)throw new Error("Parameter `id` is required when calling `deleteABTest`.");var s={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(s,t)},get:function(e,t){var r=e.path,s=e.parameters;if(!r)throw new Error("Parameter `path` is required when calling `get`.");var a={method:"GET",path:"/1{path}".replace("{path}",r),queryParameters:s||{},headers:{}};return u.request(a,t)},getABTest:function(e,t){var r=e.id;if(!r)throw new Error("Parameter `id` is required when calling `getABTest`.");var s={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(s,t)},listABTests:function(e,t){var r=e.offset,s=e.limit,a={};void 0!==r&&(a.offset=r.toString()),void 0!==s&&(a.limit=s.toString());var n={method:"GET",path:"/2/abtests",queryParameters:a,headers:{}};return u.request(n,t)},post:function(e,t){var r=e.path,s=e.parameters,a=e.body;if(!r)throw new Error("Parameter `path` is required when calling `post`.");var n={method:"POST",path:"/1{path}".replace("{path}",r),queryParameters:s||{},headers:{},data:a||{}};return u.request(n,t)},put:function(e,t){var r=e.path,s=e.parameters,a=e.body;if(!r)throw new Error("Parameter `path` is required when calling `put`.");var n={method:"PUT",path:"/1{path}".replace("{path}",r),queryParameters:s||{},headers:{},data:a||{}};return u.request(n,t)},stopABTest:function(e,t){var r=e.id;if(!r)throw new Error("Parameter `id` is required when calling `stopABTest`.");var s={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(s,t)}}}(function(e){for(var r=1;r<arguments.length;r++){var s=null!=arguments[r]?arguments[r]:{};r%2?q(Object(s),!0).forEach((function(r){t(e,r,s[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):q(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}({appId:e,apiKey:n,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const s=(e,s)=>setTimeout((()=>{r.abort(),t({status:0,content:s,isTimedOut:!0})}),e),a=s(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:a(),requestsCache:a({serializable:!1}),hostsCache:s({caches:[r({key:"".concat(v,"-").concat(e)}),a()]})},i))},e.apiClientVersion=v}));
/*! client-abtesting.umd.js | 5.0.0-alpha.3 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/client-abtesting"]={})}(this,(function(e){"use strict";function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e){let t;const r=`algolia-client-js-${e.key}`;function s(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(s().getItem(r)||"{}")}return{get:(e,t,r={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{const r=JSON.stringify(e),s=a()[r];return Promise.all([s||t(),void 0!==s])})).then((([e,t])=>Promise.all([e,t||r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=a();return n[JSON.stringify(e)]=t,s().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=a();delete t[JSON.stringify(e)],s().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{s().removeItem(r)}))}}function s(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,n={miss:()=>Promise.resolve()})=>r.get(e,a,n).catch((()=>s({caches:t}).get(e,a,n))),set:(e,a)=>r.set(e,a).catch((()=>s({caches:t}).set(e,a))),delete:e=>r.delete(e).catch((()=>s({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>s({caches:t}).clear()))}}function a(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=s();return o.then((e=>a.miss(e))).then((()=>o))},set:(r,s)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const n=12e4;function o(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>n},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=n}}}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class c extends Error{constructor(e,t){super(e),i(this,"name","AlgoliaError"),t&&(this.name=t)}}class u extends c{constructor(e,t,r){super(e,r),i(this,"stackTrace",void 0),this.stackTrace=t}}class l extends u{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",e,"RetryError")}}class d extends u{constructor(e,t,r){super(e,r,"ApiError"),i(this,"status",void 0),this.status=t}}class h extends c{constructor(e,t){super(e,"DeserializationError"),i(this,"response",void 0),this.response=t}}function p(e,t,r){const s=function(e){const t=e=>"[object Object]"===Object.prototype.toString.call(e)||"[object Array]"===Object.prototype.toString.call(e);return Object.keys(e).map((r=>`${r}=${t(e[r])?JSON.stringify(e[r]):e[r]}`)).join("&")}(r);let a=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return s.length&&(a+=`?${s}`),a}function m(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function f({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:n,requester:i,requestsCache:c,responsesCache:u}){async function f(c,u,f=!0){const g=[],y=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,u),b=function(e,t,r){const s={Accept:"application/json",...e,...t,...r},a={};return Object.keys(s).forEach((e=>{const t=s[e];a[e.toLowerCase()]=t})),a}(r,c.headers,u.headers),P="GET"===c.method?{...c.data,...u.data}:{},O={"x-algolia-agent":a.value,...s,...c.queryParameters,...P};if(u&&u.queryParameters)for(const e of Object.keys(u.queryParameters))u.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(u.queryParameters[e])?O[e]=u.queryParameters[e].toString():O[e]=u.queryParameters[e];let v=0;const w=async(e,r)=>{const s=e.pop();if(void 0===s)throw new l(function(e){return e.map((e=>m(e)))}(g));let a=u.timeout;void 0===a&&(a=f?n.read:n.write);const P={data:y,headers:b,method:c.method,url:p(s,c.path,O),connectTimeout:r(v,n.connect),responseTimeout:r(v,a)},q=t=>{const r={request:P,response:t,host:s,triesLeft:e.length};return g.push(r),r},T=await i.send(P);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&0==~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(T)){const a=q(T);return T.isTimedOut&&v++,console.log("Retryable failure",m(a)),await t.set(s,o(s,T.isTimedOut?"timed out":"down")),w(e,r)}if(function({status:e}){return 2==~~(e/100)}(T))return function(e){try{return JSON.parse(e.content)}catch(t){throw new h(t.message,e)}}(T);throw q(T),function({content:e,status:t},r){let s=e;try{s=JSON.parse(e).message}catch(e){}return new d(s,t,r)}(T,g)},q=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),T=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(o(e))))))),s=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),n=[...s,...a];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(q);return w([...T.hosts].reverse(),T.getTimeout)}return{hostsCache:t,requester:i,timeouts:n,algoliaAgent:a,baseHeaders:r,baseQueryParameters:s,hosts:e,request:function(e,t={}){const a=e.useReadTransporter||"GET"===e.method;if(!a)return f(e,t,a);const n=()=>f(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return u.get(o,(()=>c.get(o,(()=>c.set(o,n()).then((e=>Promise.all([c.delete(o),e])),(e=>Promise.all([c.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>u.set(o,e)})},requestsCache:c,responsesCache:u}}function g({algoliaAgents:e,client:t,version:r}){const s=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>s.add(e))),s}function y(e,t){if(null==e)return{};var r,s,a=function(e,t){if(null==e)return{};var r,s,a={},n=Object.keys(e);for(s=0;s<n.length;s++)r=n[s],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s<n.length;s++)r=n[s],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var b=["appId","apiKey","authMode","algoliaAgents","region"];function P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,s)}return r}function O(e){for(var r=1;r<arguments.length;r++){var s=null!=arguments[r]?arguments[r]:{};r%2?P(Object(s),!0).forEach((function(r){t(e,r,s[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):P(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}var v="5.0.0-alpha.3",w=["de","us"];function q(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,s)}return r}e.abtestingClient=function(e,n,o,i){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!n||"string"!=typeof n)throw new Error("`apiKey` is missing.");if(o&&("string"!=typeof o||!w.includes(o)))throw new Error("`region` must be one of the following: ".concat(w.join(", ")));return function(e){var t,r=e.appId,s=e.apiKey,a=e.authMode,n=e.algoliaAgents,o=e.region,i=y(e,b),c=function(e,t,r="WithinHeaders"){const s={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?s:{},queryParameters:()=>"WithinQueryParameters"===r?s:{}}}(r,s,a),u=f(O(O({hosts:(t=o,[{url:t?"analytics.{region}.algolia.com".replace("{region}",t):"analytics.algolia.com",accept:"readWrite",protocol:"https"}])},i),{},{algoliaAgent:g({algoliaAgents:n,client:"Abtesting",version:v}),baseHeaders:O(O({"content-type":"text/plain"},c.headers()),i.baseHeaders),baseQueryParameters:O(O({},c.queryParameters()),i.baseQueryParameters)}));return{transporter:u,get _ua(){return u.algoliaAgent.value},addAlgoliaAgent:function(e,t){u.algoliaAgent.add({segment:e,version:t})},addABTests:function(e,t){if(!e)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!e.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!e.variant)throw new Error("Parameter `addABTestsRequest.variant` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");var r={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return u.request(r,t)},del:function(e,t){var r=e.path,s=e.parameters;if(!r)throw new Error("Parameter `path` is required when calling `del`.");var a={method:"DELETE",path:"/1{path}".replace("{path}",r),queryParameters:s||{},headers:{}};return u.request(a,t)},deleteABTest:function(e,t){var r=e.id;if(!r)throw new Error("Parameter `id` is required when calling `deleteABTest`.");var s={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(s,t)},get:function(e,t){var r=e.path,s=e.parameters;if(!r)throw new Error("Parameter `path` is required when calling `get`.");var a={method:"GET",path:"/1{path}".replace("{path}",r),queryParameters:s||{},headers:{}};return u.request(a,t)},getABTest:function(e,t){var r=e.id;if(!r)throw new Error("Parameter `id` is required when calling `getABTest`.");var s={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(s,t)},listABTests:function(e,t){var r=e.offset,s=e.limit,a={};void 0!==r&&(a.offset=r.toString()),void 0!==s&&(a.limit=s.toString());var n={method:"GET",path:"/2/abtests",queryParameters:a,headers:{}};return u.request(n,t)},post:function(e,t){var r=e.path,s=e.parameters,a=e.body;if(!r)throw new Error("Parameter `path` is required when calling `post`.");var n={method:"POST",path:"/1{path}".replace("{path}",r),queryParameters:s||{},headers:{},data:a||{}};return u.request(n,t)},put:function(e,t){var r=e.path,s=e.parameters,a=e.body;if(!r)throw new Error("Parameter `path` is required when calling `put`.");var n={method:"PUT",path:"/1{path}".replace("{path}",r),queryParameters:s||{},headers:{},data:a||{}};return u.request(n,t)},stopABTest:function(e,t){var r=e.id;if(!r)throw new Error("Parameter `id` is required when calling `stopABTest`.");var s={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(s,t)}}}(function(e){for(var r=1;r<arguments.length;r++){var s=null!=arguments[r]?arguments[r]:{};r%2?q(Object(s),!0).forEach((function(r){t(e,r,s[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):q(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}({appId:e,apiKey:n,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const s=(e,s)=>setTimeout((()=>{r.abort(),t({status:0,content:s,isTimedOut:!0})}),e),a=s(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:a(),requestsCache:a({serializable:!1}),hostsCache:s({caches:[r({key:"".concat(v,"-").concat(e)}),a()]})},i))},e.apiClientVersion=v}));

@@ -7,3 +7,3 @@ import type { CreateClientOptions, RequestOptions } from '@algolia/client-common';

import type { ListABTestsResponse } from '../model/listABTestsResponse';
export declare const apiClientVersion = "5.0.0-alpha.2";
export declare const apiClientVersion = "5.0.0-alpha.3";
export declare const REGIONS: readonly ["de", "us"];

@@ -10,0 +10,0 @@ export declare type Region = typeof REGIONS[number];

@@ -10,2 +10,3 @@ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.

abTestID: number;
/**

@@ -15,2 +16,3 @@ * A/B test significance based on click data. Should be > 0.95 to be considered significant (no matter which variant is winning).

clickSignificance: number;
/**

@@ -20,2 +22,3 @@ * A/B test significance based on conversion data. Should be > 0.95 to be considered significant (no matter which variant is winning).

conversionSignificance: number;
/**

@@ -25,2 +28,3 @@ * End date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ.

endAt: string;
/**

@@ -30,2 +34,3 @@ * Update date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ.

updatedAt: string;
/**

@@ -35,2 +40,3 @@ * Creation date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ.

createdAt: string;
/**

@@ -40,2 +46,3 @@ * A/B test name.

name: string;
/**

@@ -45,2 +52,3 @@ * Status of the A/B test.

status: string;
/**

@@ -47,0 +55,0 @@ * List of A/B test variant.

@@ -8,2 +8,3 @@ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.

index: string;
/**

@@ -13,2 +14,3 @@ * The A/B test ID.

abTestID: number;
/**

@@ -15,0 +17,0 @@ * TaskID of the task to wait for.

@@ -8,2 +8,3 @@ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.

index: string;
/**

@@ -13,2 +14,3 @@ * The traffic percentage for the A/B test.

trafficPercentage: number;
/**

@@ -15,0 +17,0 @@ * The A/B test description.

@@ -10,2 +10,3 @@ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.

name: string;
/**

@@ -15,2 +16,3 @@ * List of 2 variants for the A/B test.

variant: AddABTestsVariant[];
/**

@@ -17,0 +19,0 @@ * End date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ.

@@ -10,2 +10,3 @@ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.

abtests: ABTest[];
/**

@@ -15,2 +16,3 @@ * Number of A/B tests found for the app.

count: number;
/**

@@ -17,0 +19,0 @@ * Number of A/B tests retrievable.

@@ -8,2 +8,3 @@ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.

averageClickPosition: number;
/**

@@ -13,2 +14,3 @@ * Distinct click count for the variant.

clickCount: number;
/**

@@ -18,2 +20,3 @@ * Click through rate for the variant.

clickThroughRate: number;
/**

@@ -23,2 +26,3 @@ * Distinct conversion count for the variant.

conversionCount: number;
/**

@@ -28,2 +32,3 @@ * Conversion rate for the variant.

conversionRate: number;
/**

@@ -33,2 +38,3 @@ * The A/B test description.

description: string;
/**

@@ -38,2 +44,3 @@ * The index performing the A/B test.

index: string;
/**

@@ -43,2 +50,3 @@ * The number of occurrences.

noResultCount: number;
/**

@@ -48,2 +56,3 @@ * The number of search during the A/B test.

searchCount: number;
/**

@@ -53,2 +62,3 @@ * The number of tracked search click.

trackedSearchCount: number;
/**

@@ -58,2 +68,3 @@ * The traffic percentage for the A/B test.

trafficPercentage: number;
/**

@@ -60,0 +71,0 @@ * The number of user during the A/B test.

{
"name": "@algolia/client-abtesting",
"version": "5.0.0-alpha.2",
"version": "5.0.0-alpha.3",
"description": "JavaScript client for client-abtesting",

@@ -24,5 +24,5 @@ "repository": "algolia/algoliasearch-client-javascript",

"dependencies": {
"@algolia/client-common": "5.0.0-alpha.2",
"@algolia/requester-browser-xhr": "5.0.0-alpha.2",
"@algolia/requester-node-http": "5.0.0-alpha.2"
"@algolia/client-common": "5.0.0-alpha.3",
"@algolia/requester-browser-xhr": "5.0.0-alpha.3",
"@algolia/requester-node-http": "5.0.0-alpha.3"
},

@@ -29,0 +29,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc