Socket
Socket
Sign inDemoInstall

@algolia/client-query-suggestions

Package Overview
Dependencies
Maintainers
67
Versions
153
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/client-query-suggestions - 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 { QuerySuggestionsClient, Region } from '../src/querySuggestionsClient';
export { apiClientVersion, QuerySuggestionsClient, } from '../src/querySuggestionsClient';
export * from '../model';
export declare function querySuggestionsClient(appId: string, apiKey: string, region: Region, options?: InitClientOptions): QuerySuggestionsClient;
export declare function querySuggestionsClient(appId: string, apiKey: string, region: Region, options?: ClientOptions): QuerySuggestionsClient;
//# 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 { QuerySuggestionsClient, Region } from '../src/querySuggestionsClient';
export { apiClientVersion, QuerySuggestionsClient, } from '../src/querySuggestionsClient';
export * from '../model';
export declare function querySuggestionsClient(appId: string, apiKey: string, region: Region, options?: InitClientOptions): QuerySuggestionsClient;
export declare function querySuggestionsClient(appId: string, apiKey: string, region: Region, options?: ClientOptions): QuerySuggestionsClient;
//# 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 = ['eu', '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 = ['eu', '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 = ['eu', 'us'];

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

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

/*! client-query-suggestions.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-query-suggestions"]={})}(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 n(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(n().getItem(r)||"{}")}return{get:(e,t,r={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{const r=JSON.stringify(e),n=a()[r];return Promise.all([n||t(),void 0!==n])})).then((([e,t])=>Promise.all([e,t||r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const s=a();return s[JSON.stringify(e)]=t,n().setItem(r,JSON.stringify(s)),t})),delete:e=>Promise.resolve().then((()=>{const t=a();delete t[JSON.stringify(e)],n().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{n().removeItem(r)}))}}function n(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,s={miss:()=>Promise.resolve()})=>r.get(e,a,s).catch((()=>n({caches:t}).get(e,a,s))),set:(e,a)=>r.set(e,a).catch((()=>n({caches:t}).set(e,a))),delete:e=>r.delete(e).catch((()=>n({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>n({caches:t}).clear()))}}function a(e={serializable:!0}){let t={};return{get(r,n,a={miss:()=>Promise.resolve()}){const s=JSON.stringify(r);if(s in t)return Promise.resolve(e.serializable?JSON.parse(t[s]):t[s]);const o=n();return o.then((e=>a.miss(e))).then((()=>o))},set:(r,n)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const s=12e4;function o(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>s},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=s}}}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 m(e,t,r){const n=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 n.length&&(a+=`?${n}`),a}function p(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 g({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:n,algoliaAgent:a,timeouts:s,requester:i,requestsCache:c,responsesCache:u}){async function g(c,u,g=!0){const f=[],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),P=function(e,t,r){const n={Accept:"application/json",...e,...t,...r},a={};return Object.keys(n).forEach((e=>{const t=n[e];a[e.toLowerCase()]=t})),a}(r,c.headers,u.headers),w="GET"===c.method?{...c.data,...u.data}:{},O={"x-algolia-agent":a.value,...n,...c.queryParameters,...w};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 b=0;const v=async(e,r)=>{const n=e.pop();if(void 0===n)throw new l(function(e){return e.map((e=>p(e)))}(f));let a=u.timeout;void 0===a&&(a=g?s.read:s.write);const w={data:y,headers:P,method:c.method,url:m(n,c.path,O),connectTimeout:r(b,s.connect),responseTimeout:r(b,a)},q=t=>{const r={request:w,response:t,host:n,triesLeft:e.length};return f.push(r),r},j=await i.send(w);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)}(j)){const a=q(j);return j.isTimedOut&&b++,console.log("Retryable failure",p(a)),await t.set(n,o(n,j.isTimedOut?"timed out":"down")),v(e,r)}if(function({status:e}){return 2==~~(e/100)}(j))return function(e){try{return JSON.parse(e.content)}catch(t){throw new h(t.message,e)}}(j);throw q(j),function({content:e,status:t},r){let n=e;try{n=JSON.parse(e).message}catch(e){}return new d(n,t,r)}(j,f)},q=e.filter((e=>"readWrite"===e.accept||(g?"read"===e.accept:"write"===e.accept))),j=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(o(e))))))),n=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),s=[...n,...a];return{hosts:s.length>0?s:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(q);return v([...j.hosts].reverse(),j.getTimeout)}return{hostsCache:t,requester:i,timeouts:s,algoliaAgent:a,baseHeaders:r,baseQueryParameters:n,hosts:e,request:function(e,t={}){const a=e.useReadTransporter||"GET"===e.method;if(!a)return g(e,t,a);const s=()=>g(e,t);if(!0!==(t.cacheable||e.cacheable))return s();const o={request:e,requestOptions:t,transporter:{queryParameters:n,headers:r}};return u.get(o,(()=>c.get(o,(()=>c.set(o,s()).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 f({algoliaAgents:e,client:t,version:r}){const n=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=>n.add(e))),n}function y(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var P=["appId","apiKey","authMode","algoliaAgents","region"];function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function O(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?w(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var b="5.0.0-alpha.2",v=["eu","us"];function q(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}e.apiClientVersion=b,e.querySuggestionsClient=function(e,s,o,i){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!s||"string"!=typeof s)throw new Error("`apiKey` is missing.");if(!o)throw new Error("`region` is missing.");if(o&&("string"!=typeof o||!v.includes(o)))throw new Error("`region` must be one of the following: ".concat(v.join(", ")));return function(e){var t,r=e.appId,n=e.apiKey,a=e.authMode,s=e.algoliaAgents,o=e.region,i=y(e,P),c=function(e,t,r="WithinHeaders"){const n={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?n:{},queryParameters:()=>"WithinQueryParameters"===r?n:{}}}(r,n,a),u=g(O(O({hosts:(t=o,[{url:"query-suggestions.{region}.algolia.com".replace("{region}",t),accept:"readWrite",protocol:"https"}])},i),{},{algoliaAgent:f({algoliaAgents:s,client:"QuerySuggestions",version:b}),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})},createConfig:function(e,t){if(!e)throw new Error("Parameter `querySuggestionsIndexWithIndexParam` is required when calling `createConfig`.");var r={method:"POST",path:"/1/configs",queryParameters:{},headers:{},data:e};return u.request(r,t)},del:function(e,t){var r=e.path,n=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:n||{},headers:{}};return u.request(a,t)},deleteConfig:function(e,t){var r=e.indexName;if(!r)throw new Error("Parameter `indexName` is required when calling `deleteConfig`.");var n={method:"DELETE",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(n,t)},get:function(e,t){var r=e.path,n=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:n||{},headers:{}};return u.request(a,t)},getAllConfigs:function(e){var t={method:"GET",path:"/1/configs",queryParameters:{},headers:{}};return u.request(t,e)},getConfig:function(e,t){var r=e.indexName;if(!r)throw new Error("Parameter `indexName` is required when calling `getConfig`.");var n={method:"GET",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(n,t)},getConfigStatus:function(e,t){var r=e.indexName;if(!r)throw new Error("Parameter `indexName` is required when calling `getConfigStatus`.");var n={method:"GET",path:"/1/configs/{indexName}/status".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(n,t)},getLogFile:function(e,t){var r=e.indexName;if(!r)throw new Error("Parameter `indexName` is required when calling `getLogFile`.");var n={method:"GET",path:"/1/logs/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(n,t)},post:function(e,t){var r=e.path,n=e.parameters,a=e.body;if(!r)throw new Error("Parameter `path` is required when calling `post`.");var s={method:"POST",path:"/1{path}".replace("{path}",r),queryParameters:n||{},headers:{},data:a||{}};return u.request(s,t)},put:function(e,t){var r=e.path,n=e.parameters,a=e.body;if(!r)throw new Error("Parameter `path` is required when calling `put`.");var s={method:"PUT",path:"/1{path}".replace("{path}",r),queryParameters:n||{},headers:{},data:a||{}};return u.request(s,t)},updateConfig:function(e,t){var r=e.indexName,n=e.querySuggestionsIndexParam;if(!r)throw new Error("Parameter `indexName` is required when calling `updateConfig`.");if(!n)throw new Error("Parameter `querySuggestionsIndexParam` is required when calling `updateConfig`.");if(!n.sourceIndices)throw new Error("Parameter `querySuggestionsIndexParam.sourceIndices` is required when calling `updateConfig`.");var a={method:"PUT",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n};return u.request(a,t)}}}(function(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?q(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({appId:e,apiKey:s,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 n=(e,n)=>setTimeout((()=>{r.abort(),t({status:0,content:n,isTimedOut:!0})}),e),a=n(e.connectTimeout,"Connection timeout");let s;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===s&&(clearTimeout(a),s=n(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(s),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(s),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:n({caches:[r({key:"".concat(b,"-").concat(e)}),a()]})},i))}}));
/*! client-query-suggestions.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-query-suggestions"]={})}(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 n(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(n().getItem(r)||"{}")}return{get:(e,t,r={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{const r=JSON.stringify(e),n=a()[r];return Promise.all([n||t(),void 0!==n])})).then((([e,t])=>Promise.all([e,t||r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const s=a();return s[JSON.stringify(e)]=t,n().setItem(r,JSON.stringify(s)),t})),delete:e=>Promise.resolve().then((()=>{const t=a();delete t[JSON.stringify(e)],n().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{n().removeItem(r)}))}}function n(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,s={miss:()=>Promise.resolve()})=>r.get(e,a,s).catch((()=>n({caches:t}).get(e,a,s))),set:(e,a)=>r.set(e,a).catch((()=>n({caches:t}).set(e,a))),delete:e=>r.delete(e).catch((()=>n({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>n({caches:t}).clear()))}}function a(e={serializable:!0}){let t={};return{get(r,n,a={miss:()=>Promise.resolve()}){const s=JSON.stringify(r);if(s in t)return Promise.resolve(e.serializable?JSON.parse(t[s]):t[s]);const o=n();return o.then((e=>a.miss(e))).then((()=>o))},set:(r,n)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const s=12e4;function o(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>s},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=s}}}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 m(e,t,r){const n=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 n.length&&(a+=`?${n}`),a}function p(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 g({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:n,algoliaAgent:a,timeouts:s,requester:i,requestsCache:c,responsesCache:u}){async function g(c,u,g=!0){const f=[],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),P=function(e,t,r){const n={Accept:"application/json",...e,...t,...r},a={};return Object.keys(n).forEach((e=>{const t=n[e];a[e.toLowerCase()]=t})),a}(r,c.headers,u.headers),w="GET"===c.method?{...c.data,...u.data}:{},O={"x-algolia-agent":a.value,...n,...c.queryParameters,...w};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 b=0;const v=async(e,r)=>{const n=e.pop();if(void 0===n)throw new l(function(e){return e.map((e=>p(e)))}(f));let a=u.timeout;void 0===a&&(a=g?s.read:s.write);const w={data:y,headers:P,method:c.method,url:m(n,c.path,O),connectTimeout:r(b,s.connect),responseTimeout:r(b,a)},q=t=>{const r={request:w,response:t,host:n,triesLeft:e.length};return f.push(r),r},j=await i.send(w);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)}(j)){const a=q(j);return j.isTimedOut&&b++,console.log("Retryable failure",p(a)),await t.set(n,o(n,j.isTimedOut?"timed out":"down")),v(e,r)}if(function({status:e}){return 2==~~(e/100)}(j))return function(e){try{return JSON.parse(e.content)}catch(t){throw new h(t.message,e)}}(j);throw q(j),function({content:e,status:t},r){let n=e;try{n=JSON.parse(e).message}catch(e){}return new d(n,t,r)}(j,f)},q=e.filter((e=>"readWrite"===e.accept||(g?"read"===e.accept:"write"===e.accept))),j=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(o(e))))))),n=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),s=[...n,...a];return{hosts:s.length>0?s:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(q);return v([...j.hosts].reverse(),j.getTimeout)}return{hostsCache:t,requester:i,timeouts:s,algoliaAgent:a,baseHeaders:r,baseQueryParameters:n,hosts:e,request:function(e,t={}){const a=e.useReadTransporter||"GET"===e.method;if(!a)return g(e,t,a);const s=()=>g(e,t);if(!0!==(t.cacheable||e.cacheable))return s();const o={request:e,requestOptions:t,transporter:{queryParameters:n,headers:r}};return u.get(o,(()=>c.get(o,(()=>c.set(o,s()).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 f({algoliaAgents:e,client:t,version:r}){const n=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=>n.add(e))),n}function y(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var P=["appId","apiKey","authMode","algoliaAgents","region"];function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function O(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?w(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var b="5.0.0-alpha.3",v=["eu","us"];function q(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}e.apiClientVersion=b,e.querySuggestionsClient=function(e,s,o,i){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!s||"string"!=typeof s)throw new Error("`apiKey` is missing.");if(!o)throw new Error("`region` is missing.");if(o&&("string"!=typeof o||!v.includes(o)))throw new Error("`region` must be one of the following: ".concat(v.join(", ")));return function(e){var t,r=e.appId,n=e.apiKey,a=e.authMode,s=e.algoliaAgents,o=e.region,i=y(e,P),c=function(e,t,r="WithinHeaders"){const n={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?n:{},queryParameters:()=>"WithinQueryParameters"===r?n:{}}}(r,n,a),u=g(O(O({hosts:(t=o,[{url:"query-suggestions.{region}.algolia.com".replace("{region}",t),accept:"readWrite",protocol:"https"}])},i),{},{algoliaAgent:f({algoliaAgents:s,client:"QuerySuggestions",version:b}),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})},createConfig:function(e,t){if(!e)throw new Error("Parameter `querySuggestionsIndexWithIndexParam` is required when calling `createConfig`.");var r={method:"POST",path:"/1/configs",queryParameters:{},headers:{},data:e};return u.request(r,t)},del:function(e,t){var r=e.path,n=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:n||{},headers:{}};return u.request(a,t)},deleteConfig:function(e,t){var r=e.indexName;if(!r)throw new Error("Parameter `indexName` is required when calling `deleteConfig`.");var n={method:"DELETE",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(n,t)},get:function(e,t){var r=e.path,n=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:n||{},headers:{}};return u.request(a,t)},getAllConfigs:function(e){var t={method:"GET",path:"/1/configs",queryParameters:{},headers:{}};return u.request(t,e)},getConfig:function(e,t){var r=e.indexName;if(!r)throw new Error("Parameter `indexName` is required when calling `getConfig`.");var n={method:"GET",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(n,t)},getConfigStatus:function(e,t){var r=e.indexName;if(!r)throw new Error("Parameter `indexName` is required when calling `getConfigStatus`.");var n={method:"GET",path:"/1/configs/{indexName}/status".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(n,t)},getLogFile:function(e,t){var r=e.indexName;if(!r)throw new Error("Parameter `indexName` is required when calling `getLogFile`.");var n={method:"GET",path:"/1/logs/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(n,t)},post:function(e,t){var r=e.path,n=e.parameters,a=e.body;if(!r)throw new Error("Parameter `path` is required when calling `post`.");var s={method:"POST",path:"/1{path}".replace("{path}",r),queryParameters:n||{},headers:{},data:a||{}};return u.request(s,t)},put:function(e,t){var r=e.path,n=e.parameters,a=e.body;if(!r)throw new Error("Parameter `path` is required when calling `put`.");var s={method:"PUT",path:"/1{path}".replace("{path}",r),queryParameters:n||{},headers:{},data:a||{}};return u.request(s,t)},updateConfig:function(e,t){var r=e.indexName,n=e.querySuggestionsIndexParam;if(!r)throw new Error("Parameter `indexName` is required when calling `updateConfig`.");if(!n)throw new Error("Parameter `querySuggestionsIndexParam` is required when calling `updateConfig`.");if(!n.sourceIndices)throw new Error("Parameter `querySuggestionsIndexParam.sourceIndices` is required when calling `updateConfig`.");var a={method:"PUT",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n};return u.request(a,t)}}}(function(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?q(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({appId:e,apiKey:s,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 n=(e,n)=>setTimeout((()=>{r.abort(),t({status:0,content:n,isTimedOut:!0})}),e),a=n(e.connectTimeout,"Connection timeout");let s;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===s&&(clearTimeout(a),s=n(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(s),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(s),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:n({caches:[r({key:"".concat(b,"-").concat(e)}),a()]})},i))}}));

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

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

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

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

timestamp: string;
level: LogLevel;
/**

@@ -16,2 +18,3 @@ * Detailed description of what happened.

message: string;
/**

@@ -18,0 +21,0 @@ * Indicates the hierarchy of the records. For example, a record with contextLevel=1 belongs to a preceding record with contextLevel=0.

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

indexName: string;
/**

@@ -15,2 +16,3 @@ * List of source indices used to generate a Query Suggestions index.

sourceIndices: SourceIndexWithReplicas[];
/**

@@ -20,2 +22,3 @@ * De-duplicate singular and plural suggestions. For example, let\'s say your index contains English content, and that two suggestions “shoe” and “shoes” end up in your Query Suggestions index. If the English language is configured, only the most popular of those two suggestions would remain.

languages: string[];
/**

@@ -22,0 +25,0 @@ * List of words and patterns to exclude from the Query Suggestions index.

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

sourceIndices: SourceIndex[];
/**

@@ -15,2 +16,3 @@ * De-duplicate singular and plural suggestions. For example, let\'s say your index contains English content, and that two suggestions “shoe” and “shoes” end up in your Query Suggestions index. If the English language is configured, only the most popular of those two suggestions would remain.

languages?: string[];
/**

@@ -17,0 +19,0 @@ * List of words and patterns to exclude from the Query Suggestions index.

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

indexName: string;
/**

@@ -15,2 +16,3 @@ * List of analytics tags to filter the popular searches per tag.

analyticsTags?: string[];
/**

@@ -20,2 +22,3 @@ * List of facets to define as categories for the query suggestions.

facets?: Array<Record<string, any>>;
/**

@@ -25,2 +28,3 @@ * Minimum number of hits (e.g., matching records in the source index) to generate a suggestions.

minHits?: number;
/**

@@ -30,2 +34,3 @@ * Minimum number of required letters for a suggestion to remain.

minLetters?: number;
/**

@@ -35,2 +40,3 @@ * List of facet attributes used to generate Query Suggestions. The resulting suggestions are every combination of the facets in the nested list (e.g., (facetA and facetB) and facetC).

generate?: string[][];
/**

@@ -37,0 +43,0 @@ * List of external indices to use to generate custom Query Suggestions.

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

query: string;
/**

@@ -10,0 +11,0 @@ * The measure of the suggestion relative popularity.

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

replicas: boolean;
/**

@@ -18,2 +19,3 @@ * Source index name.

indexName: string;
/**

@@ -23,2 +25,3 @@ * List of analytics tags to filter the popular searches per tag.

analyticsTags: string[];
/**

@@ -28,2 +31,3 @@ * List of facets to define as categories for the query suggestions.

facets: Array<Record<string, any>>;
/**

@@ -33,2 +37,3 @@ * Minimum number of hits (e.g., matching records in the source index) to generate a suggestions.

minHits: number;
/**

@@ -38,2 +43,3 @@ * Minimum number of required letters for a suggestion to remain.

minLetters: number;
/**

@@ -43,2 +49,3 @@ * List of facet attributes used to generate Query Suggestions. The resulting suggestions are every combination of the facets in the nested list (e.g., (facetA and facetB) and facetC).

generate: string[][];
/**

@@ -45,0 +52,0 @@ * List of external indices to use to generate custom Query Suggestions.

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

indexName: string;
/**

@@ -13,2 +14,3 @@ * True if the Query Suggestions index is running.

isRunning: boolean;
/**

@@ -15,0 +17,0 @@ * Date and time of the last build.

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

status: number;
/**

@@ -10,0 +11,0 @@ * Message of the response.

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

@@ -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

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