Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@algolia/recommend

Package Overview
Dependencies
Maintainers
3
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/recommend - npm Package Compare versions

Comparing version 5.0.0-alpha.50 to 5.0.0-alpha.51

2

dist/model/advancedSyntaxFeatures.d.ts

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

export declare type AdvancedSyntaxFeatures = 'exactPhrase' | 'excludeWords';
export type AdvancedSyntaxFeatures = 'exactPhrase' | 'excludeWords';
//# sourceMappingURL=advancedSyntaxFeatures.d.ts.map

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

export declare type AlternativesAsExact = 'ignorePlurals' | 'multiWordsSynonym' | 'singleWordSynonym';
export type AlternativesAsExact = 'ignorePlurals' | 'multiWordsSynonym' | 'singleWordSynonym';
//# sourceMappingURL=alternativesAsExact.d.ts.map

@@ -5,3 +5,3 @@ import type { AroundRadiusAll } from './aroundRadiusAll';

*/
export declare type AroundRadius = AroundRadiusAll | number;
export type AroundRadius = AroundRadiusAll | number;
//# sourceMappingURL=aroundRadius.d.ts.map

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

export declare type AroundRadiusAll = 'all';
export type AroundRadiusAll = 'all';
//# sourceMappingURL=aroundRadiusAll.d.ts.map
import type { RecommendationModels } from './recommendationModels';
export declare type BaseRecommendationRequest = {
export type BaseRecommendationRequest = {
model: RecommendationModels;

@@ -4,0 +4,0 @@ /**

import type { SearchParamsObject } from './searchParamsObject';
export declare type BaseRecommendRequest = {
export type BaseRecommendRequest = {
/**

@@ -4,0 +4,0 @@ * The Algolia index name.

import type { BaseSearchParamsWithoutQuery } from './baseSearchParamsWithoutQuery';
import type { SearchParamsQuery } from './searchParamsQuery';
export declare type BaseSearchParams = BaseSearchParamsWithoutQuery & SearchParamsQuery;
export type BaseSearchParams = BaseSearchParamsWithoutQuery & SearchParamsQuery;
//# sourceMappingURL=baseSearchParams.d.ts.map

@@ -7,3 +7,3 @@ import type { AroundRadius } from './aroundRadius';

import type { TagFilters } from './tagFilters';
export declare type BaseSearchParamsWithoutQuery = {
export type BaseSearchParamsWithoutQuery = {
/**

@@ -10,0 +10,0 @@ * Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results.

import type { FacetsStats } from './facetsStats';
import type { RenderingContent } from './renderingContent';
export declare type BaseSearchResponse = {
export type BaseSearchResponse = {
/**

@@ -5,0 +5,0 @@ * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID.

import type { TrendingModels } from './trendingModels';
export declare type BaseTrendingRequest = {
export type BaseTrendingRequest = {
model: TrendingModels;

@@ -4,0 +4,0 @@ /**

/**
* Properties for the `del` method.
*/
export declare type DelProps = {
export type DelProps = {
/**

@@ -17,3 +17,3 @@ * The path of the API endpoint to target, anything after the /1 needs to be specified.

*/
export declare type GetProps = {
export type GetProps = {
/**

@@ -31,3 +31,3 @@ * The path of the API endpoint to target, anything after the /1 needs to be specified.

*/
export declare type PostProps = {
export type PostProps = {
/**

@@ -49,3 +49,3 @@ * The path of the API endpoint to target, anything after the /1 needs to be specified.

*/
export declare type PutProps = {
export type PutProps = {
/**

@@ -52,0 +52,0 @@ * The path of the API endpoint to target, anything after the /1 needs to be specified.

/**
* Enables de-duplication or grouping of results.
*/
export declare type Distinct = boolean | number;
export type Distinct = boolean | number;
//# sourceMappingURL=distinct.d.ts.map
/**
* Error.
*/
export declare type ErrorBase = Record<string, any> & {
export type ErrorBase = Record<string, any> & {
message?: string;
};
//# sourceMappingURL=errorBase.d.ts.map
/**
* Controls how the exact ranking criterion is computed when the query contains only one word.
*/
export declare type ExactOnSingleWordQuery = 'attribute' | 'none' | 'word';
export type ExactOnSingleWordQuery = 'attribute' | 'none' | 'word';
//# sourceMappingURL=exactOnSingleWordQuery.d.ts.map

@@ -5,3 +5,3 @@ import type { MixedSearchFilters } from './mixedSearchFilters';

*/
export declare type FacetFilters = MixedSearchFilters[] | string;
export type FacetFilters = MixedSearchFilters[] | string;
//# sourceMappingURL=facetFilters.d.ts.map

@@ -6,3 +6,3 @@ import type { Facets } from './facets';

*/
export declare type FacetOrdering = {
export type FacetOrdering = {
facets?: Facets;

@@ -9,0 +9,0 @@ /**

/**
* The ordering of facets (widgets).
*/
export declare type Facets = {
export type Facets = {
/**

@@ -6,0 +6,0 @@ * Pinned order of facet lists.

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

export declare type FacetsStats = {
export type FacetsStats = {
/**

@@ -3,0 +3,0 @@ * The minimum value in the result set.

@@ -5,3 +5,3 @@ import type { RecommendationsRequest } from './recommendationsRequest';

*/
export declare type GetRecommendationsParams = {
export type GetRecommendationsParams = {
/**

@@ -8,0 +8,0 @@ * The `getRecommendations` requests.

import type { RecommendationsResponse } from './recommendationsResponse';
export declare type GetRecommendationsResponse = {
export type GetRecommendationsResponse = {
results?: RecommendationsResponse[];
};
//# sourceMappingURL=getRecommendationsResponse.d.ts.map
import type { HighlightResultOption } from './highlightResultOption';
export declare type HighlightResult = HighlightResultOption | HighlightResultOption[];
export type HighlightResult = HighlightResultOption | HighlightResultOption[];
//# sourceMappingURL=highlightResult.d.ts.map

@@ -5,3 +5,3 @@ import type { MatchLevel } from './matchLevel';

*/
export declare type HighlightResultOption = {
export type HighlightResultOption = {
/**

@@ -8,0 +8,0 @@ * Markup text with occurrences highlighted.

/**
* Treats singular, plurals, and other forms of declensions as matching terms. IgnorePlurals is used in conjunction with the queryLanguages setting. List: language ISO codes for which ignoring plurals should be enabled. This list will override any values that you may have set in queryLanguages. True: enables the ignore plurals functionality, where singulars and plurals are considered equivalent (foot = feet). The languages supported here are either every language (this is the default, see list of languages below), or those set by queryLanguages. False: disables ignore plurals, where singulars and plurals are not considered the same for matching purposes (foot will not find feet).
*/
export declare type IgnorePlurals = string[] | boolean;
export type IgnorePlurals = string[] | boolean;
//# sourceMappingURL=ignorePlurals.d.ts.map

@@ -11,3 +11,3 @@ import type { AdvancedSyntaxFeatures } from './advancedSyntaxFeatures';

import type { TypoTolerance } from './typoTolerance';
export declare type IndexSettingsAsSearchParams = {
export type IndexSettingsAsSearchParams = {
/**

@@ -14,0 +14,0 @@ * The complete list of attributes that will be used for faceting.

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

export declare type MatchedGeoLocation = {
export type MatchedGeoLocation = {
/**

@@ -3,0 +3,0 @@ * Latitude of the matched location.

/**
* Indicates how well the attribute matched the search query.
*/
export declare type MatchLevel = 'full' | 'none' | 'partial';
export type MatchLevel = 'full' | 'none' | 'partial';
//# sourceMappingURL=matchLevel.d.ts.map

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

export declare type MixedSearchFilters = string[] | string;
export type MixedSearchFilters = string[] | string;
//# sourceMappingURL=mixedSearchFilters.d.ts.map

@@ -5,3 +5,3 @@ import type { MixedSearchFilters } from './mixedSearchFilters';

*/
export declare type NumericFilters = MixedSearchFilters[] | string;
export type NumericFilters = MixedSearchFilters[] | string;
//# sourceMappingURL=numericFilters.d.ts.map

@@ -5,3 +5,3 @@ import type { MixedSearchFilters } from './mixedSearchFilters';

*/
export declare type OptionalFilters = MixedSearchFilters[] | string;
export type OptionalFilters = MixedSearchFilters[] | string;
//# sourceMappingURL=optionalFilters.d.ts.map

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

export declare type Personalization = {
export type Personalization = {
/**

@@ -3,0 +3,0 @@ * The score of the filters.

/**
* Controls if and how query words are interpreted as prefixes.
*/
export declare type QueryType = 'prefixAll' | 'prefixLast' | 'prefixNone';
export type QueryType = 'prefixAll' | 'prefixLast' | 'prefixNone';
//# sourceMappingURL=queryType.d.ts.map
import type { MatchedGeoLocation } from './matchedGeoLocation';
import type { Personalization } from './personalization';
export declare type RankingInfo = {
export type RankingInfo = {
/**

@@ -5,0 +5,0 @@ * This field is reserved for advanced usage.

/**
* The recommendation model to use.
*/
export declare type RecommendationModels = 'bought-together' | 'related-products';
export type RecommendationModels = 'bought-together' | 'related-products';
//# sourceMappingURL=recommendationModels.d.ts.map
import type { BaseRecommendRequest } from './baseRecommendRequest';
import type { BaseRecommendationRequest } from './baseRecommendationRequest';
export declare type RecommendationRequest = BaseRecommendationRequest & BaseRecommendRequest;
export type RecommendationRequest = BaseRecommendationRequest & BaseRecommendRequest;
//# sourceMappingURL=recommendationRequest.d.ts.map
import type { RecommendationRequest } from './recommendationRequest';
import type { TrendingRequest } from './trendingRequest';
export declare type RecommendationsRequest = RecommendationRequest | TrendingRequest;
export type RecommendationsRequest = RecommendationRequest | TrendingRequest;
//# sourceMappingURL=recommendationsRequest.d.ts.map
import type { BaseSearchResponse } from './baseSearchResponse';
import type { RecommendHits } from './recommendHits';
export declare type RecommendationsResponse = BaseSearchResponse & RecommendHits;
export type RecommendationsResponse = BaseSearchResponse & RecommendHits;
//# sourceMappingURL=recommendationsResponse.d.ts.map

@@ -7,3 +7,3 @@ import type { HighlightResult } from './highlightResult';

*/
export declare type RecommendHit = Record<string, any> & {
export type RecommendHit = Record<string, any> & {
/**

@@ -10,0 +10,0 @@ * Unique identifier of the object.

import type { RecommendHit } from './recommendHit';
export declare type RecommendHits = {
export type RecommendHits = {
hits: RecommendHit[];
};
//# sourceMappingURL=recommendHits.d.ts.map
/**
* Removes stop (common) words from the query before executing it. RemoveStopWords is used in conjunction with the queryLanguages setting. List: language ISO codes for which ignoring plurals should be enabled. This list will override any values that you may have set in queryLanguages. True: enables the stop word functionality, ensuring that stop words are removed from consideration in a search. The languages supported here are either every language, or those set by queryLanguages. False: disables stop word functionality, allowing stop words to be taken into account in a search.
*/
export declare type RemoveStopWords = string[] | boolean;
export type RemoveStopWords = string[] | boolean;
//# sourceMappingURL=removeStopWords.d.ts.map
/**
* Selects a strategy to remove words from the query when it doesn\'t match any hits.
*/
export declare type RemoveWordsIfNoResults = 'allOptional' | 'firstWords' | 'lastWords' | 'none';
export type RemoveWordsIfNoResults = 'allOptional' | 'firstWords' | 'lastWords' | 'none';
//# sourceMappingURL=removeWordsIfNoResults.d.ts.map

@@ -5,5 +5,5 @@ import type { FacetOrdering } from './facetOrdering';

*/
export declare type RenderingContent = {
export type RenderingContent = {
facetOrdering?: FacetOrdering;
};
//# sourceMappingURL=renderingContent.d.ts.map

@@ -5,3 +5,3 @@ import type { MixedSearchFilters } from './mixedSearchFilters';

*/
export declare type ReRankingApplyFilter = MixedSearchFilters[] | string;
export type ReRankingApplyFilter = MixedSearchFilters[] | string;
//# sourceMappingURL=reRankingApplyFilter.d.ts.map
import type { BaseSearchParams } from './baseSearchParams';
import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams';
export declare type SearchParamsObject = BaseSearchParams & IndexSettingsAsSearchParams;
export type SearchParamsObject = BaseSearchParams & IndexSettingsAsSearchParams;
//# sourceMappingURL=searchParamsObject.d.ts.map

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

export declare type SearchParamsQuery = {
export type SearchParamsQuery = {
/**

@@ -3,0 +3,0 @@ * The text to search in the index.

import type { SnippetResultOption } from './snippetResultOption';
export declare type SnippetResult = SnippetResultOption | SnippetResultOption[];
export type SnippetResult = SnippetResultOption | SnippetResultOption[];
//# sourceMappingURL=snippetResult.d.ts.map

@@ -5,3 +5,3 @@ import type { MatchLevel } from './matchLevel';

*/
export declare type SnippetResultOption = {
export type SnippetResultOption = {
/**

@@ -8,0 +8,0 @@ * Markup text with occurrences highlighted.

/**
* How to display the remaining items. - `count`: facet count (descending). - `alpha`: alphabetical (ascending). - `hidden`: show only pinned values.
*/
export declare type SortRemainingBy = 'alpha' | 'count' | 'hidden';
export type SortRemainingBy = 'alpha' | 'count' | 'hidden';
//# sourceMappingURL=sortRemainingBy.d.ts.map

@@ -5,3 +5,3 @@ import type { MixedSearchFilters } from './mixedSearchFilters';

*/
export declare type TagFilters = MixedSearchFilters[] | string;
export type TagFilters = MixedSearchFilters[] | string;
//# sourceMappingURL=tagFilters.d.ts.map
/**
* The trending model to use.
*/
export declare type TrendingModels = 'trending-facets' | 'trending-items';
export type TrendingModels = 'trending-facets' | 'trending-items';
//# sourceMappingURL=trendingModels.d.ts.map
import type { BaseRecommendRequest } from './baseRecommendRequest';
import type { BaseTrendingRequest } from './baseTrendingRequest';
export declare type TrendingRequest = BaseRecommendRequest & BaseTrendingRequest;
export type TrendingRequest = BaseRecommendRequest & BaseTrendingRequest;
//# sourceMappingURL=trendingRequest.d.ts.map

@@ -5,3 +5,3 @@ import type { TypoToleranceEnum } from './typoToleranceEnum';

*/
export declare type TypoTolerance = TypoToleranceEnum | boolean;
export type TypoTolerance = TypoToleranceEnum | boolean;
//# sourceMappingURL=typoTolerance.d.ts.map

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

export declare type TypoToleranceEnum = 'min' | 'strict';
export type TypoToleranceEnum = 'min' | 'strict';
//# sourceMappingURL=typoToleranceEnum.d.ts.map
import type { SortRemainingBy } from './sortRemainingBy';
export declare type Value = {
export type Value = {
/**

@@ -4,0 +4,0 @@ * Pinned order of facet lists.

@@ -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.50';
const apiClientVersion = '5.0.0-alpha.51';
function getDefaultHosts(appId) {

@@ -12,0 +12,0 @@ return [

@@ -676,3 +676,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.50';
const apiClientVersion = '5.0.0-alpha.51';
function getDefaultHosts(appId) {

@@ -679,0 +679,0 @@ return [

@@ -5,3 +5,3 @@ import { createAuth, createTransporter, getAlgoliaAgent, shuffle, 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.50';
const apiClientVersion = '5.0.0-alpha.51';
function getDefaultHosts(appId) {

@@ -8,0 +8,0 @@ return [

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

/*! recommend.umd.js | 5.0.0-alpha.50 | © 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/recommend"]={})}(this,(function(e){"use strict";function t(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 o=a();return o[JSON.stringify(e)]=t,s().setItem(r,JSON.stringify(o)),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 r(e){const t=[...e.caches],s=t.shift();return void 0===s?{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,o={miss:()=>Promise.resolve()})=>s.get(e,a,o).catch((()=>r({caches:t}).get(e,a,o))),set:(e,a)=>s.set(e,a).catch((()=>r({caches:t}).set(e,a))),delete:e=>s.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>s.clear().catch((()=>r({caches:t}).clear()))}}function s(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const o=JSON.stringify(r);if(o in t)return Promise.resolve(e.serializable?JSON.parse(t[o]):t[o]);const n=s();return n.then((e=>a.miss(e))).then((()=>n))},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 a=12e4;function o(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>a},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=a}}}function n(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class i extends Error{constructor(e,t){super(e),n(this,"name","AlgoliaError"),t&&(this.name=t)}}class c extends i{constructor(e,t,r){super(e,r),n(this,"stackTrace",void 0),this.stackTrace=t}}class u extends c{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",e,"RetryError")}}class l extends c{constructor(e,t,r,s="ApiError"){super(e,r,s),n(this,"status",void 0),this.status=t}}class d extends i{constructor(e,t){super(e,"DeserializationError"),n(this,"response",void 0),this.response=t}}class m extends l{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),n(this,"error",void 0),this.error=r}}function h(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}=${encodeURIComponent(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 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:s,algoliaAgent:a,timeouts:n,requester:i,requestsCache:c,responsesCache:g}){async function f(c,g,f=!0){const y=[],P=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,g),v=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,g.headers),w="GET"===c.method?{...c.data,...g.data}:{},b={...s,...c.queryParameters,...w};if(a.value&&(b["x-algolia-agent"]=a.value),g&&g.queryParameters)for(const e of Object.keys(g.queryParameters))g.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(g.queryParameters[e])?b[e]=g.queryParameters[e].toString():b[e]=g.queryParameters[e];let q=0;const O=async(e,r)=>{const s=e.pop();if(void 0===s)throw new u(function(e){return e.map((e=>p(e)))}(y));let a=g.timeout;void 0===a&&(a=f?n.read:n.write);const w={data:P,headers:v,method:c.method,url:h(s,c.path,b),connectTimeout:r(q,n.connect),responseTimeout:r(q,a)},T=t=>{const r={request:w,response:t,host:s,triesLeft:e.length};return y.push(r),r},S=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)}(S)){const a=T(S);return S.isTimedOut&&q++,console.log("Retryable failure",p(a)),await t.set(s,o(s,S.isTimedOut?"timed out":"down")),O(e,r)}if(function({status:e}){return 2==~~(e/100)}(S))return function(e){try{return JSON.parse(e.content)}catch(t){throw new d(t.message,e)}}(S);throw T(S),function({content:e,status:t},r){try{const s=JSON.parse(e);return"error"in s?new m(s.message,t,s.error,r):new l(s.message,t,r)}catch(e){}return new l(e,t,r)}(S,y)},T=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),S=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}}(T);return O([...S.hosts].reverse(),S.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 o=()=>f(e,t);if(!0!==(t.cacheable||e.cacheable))return o();const n={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return g.get(n,(()=>c.get(n,(()=>c.set(n,o()).then((e=>Promise.all([c.delete(n),e])),(e=>Promise.all([c.delete(n),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>g.set(n,e)})},requestsCache:c,responsesCache:g}}function f({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}const y="5.0.0-alpha.50";function P(e){return[{url:`${e}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${e}.algolia.net`,accept:"write",protocol:"https"}].concat(function(e){const t=e;for(let r=e.length-1;r>0;r--){const s=Math.floor(Math.random()*(r+1)),a=e[r];t[r]=e[s],t[s]=a}return t}([{url:`${e}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}e.apiClientVersion=y,e.recommendClient=function(e,a,o){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!a||"string"!=typeof a)throw new Error("`apiKey` is missing.");return function({appId:e,apiKey:t,authMode:r,algoliaAgents:s,...a}){const o=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:{}}}(e,t,r),n=g({hosts:P(e),...a,algoliaAgent:f({algoliaAgents:s,client:"Recommend",version:y}),baseHeaders:{"content-type":"text/plain",...o.headers(),...a.baseHeaders},baseQueryParameters:{...o.queryParameters(),...a.baseQueryParameters}});return{transporter:n,appId:e,clearCache:()=>Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then((()=>{})),get _ua(){return n.algoliaAgent.value},addAlgoliaAgent(e,t){n.algoliaAgent.add({segment:e,version:t})},del({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `del`.");const s={method:"DELETE",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return n.request(s,r)},get({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `get`.");const s={method:"GET",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return n.request(s,r)},getRecommendations(e,t){if(!e)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!e.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");const r={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return n.request(r,t)},post({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `post`.");const a={method:"POST",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return n.request(a,s)},put({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `put`.");const a={method:"PUT",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return n.request(a,s)}}}({appId:e,apiKey:a,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 o;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===o&&(clearTimeout(a),o=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(o),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(o),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:r({caches:[t({key:`5.0.0-alpha.50-${e}`}),s()]}),...o})}}));
/*! recommend.umd.js | 5.0.0-alpha.51 | © 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/recommend"]={})}(this,(function(e){"use strict";function t(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 o=a();return o[JSON.stringify(e)]=t,s().setItem(r,JSON.stringify(o)),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 r(e){const t=[...e.caches],s=t.shift();return void 0===s?{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,o={miss:()=>Promise.resolve()})=>s.get(e,a,o).catch((()=>r({caches:t}).get(e,a,o))),set:(e,a)=>s.set(e,a).catch((()=>r({caches:t}).set(e,a))),delete:e=>s.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>s.clear().catch((()=>r({caches:t}).clear()))}}function s(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const o=JSON.stringify(r);if(o in t)return Promise.resolve(e.serializable?JSON.parse(t[o]):t[o]);const n=s();return n.then((e=>a.miss(e))).then((()=>n))},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 a=12e4;function o(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>a},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=a}}}function n(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class i extends Error{constructor(e,t){super(e),n(this,"name","AlgoliaError"),t&&(this.name=t)}}class c extends i{constructor(e,t,r){super(e,r),n(this,"stackTrace",void 0),this.stackTrace=t}}class u extends c{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",e,"RetryError")}}class l extends c{constructor(e,t,r,s="ApiError"){super(e,r,s),n(this,"status",void 0),this.status=t}}class d extends i{constructor(e,t){super(e,"DeserializationError"),n(this,"response",void 0),this.response=t}}class m extends l{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),n(this,"error",void 0),this.error=r}}function h(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}=${encodeURIComponent(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 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:s,algoliaAgent:a,timeouts:n,requester:i,requestsCache:c,responsesCache:g}){async function f(c,g,f=!0){const y=[],P=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,g),v=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,g.headers),w="GET"===c.method?{...c.data,...g.data}:{},b={...s,...c.queryParameters,...w};if(a.value&&(b["x-algolia-agent"]=a.value),g&&g.queryParameters)for(const e of Object.keys(g.queryParameters))g.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(g.queryParameters[e])?b[e]=g.queryParameters[e].toString():b[e]=g.queryParameters[e];let q=0;const O=async(e,r)=>{const s=e.pop();if(void 0===s)throw new u(function(e){return e.map((e=>p(e)))}(y));let a=g.timeout;void 0===a&&(a=f?n.read:n.write);const w={data:P,headers:v,method:c.method,url:h(s,c.path,b),connectTimeout:r(q,n.connect),responseTimeout:r(q,a)},T=t=>{const r={request:w,response:t,host:s,triesLeft:e.length};return y.push(r),r},S=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)}(S)){const a=T(S);return S.isTimedOut&&q++,console.log("Retryable failure",p(a)),await t.set(s,o(s,S.isTimedOut?"timed out":"down")),O(e,r)}if(function({status:e}){return 2==~~(e/100)}(S))return function(e){try{return JSON.parse(e.content)}catch(t){throw new d(t.message,e)}}(S);throw T(S),function({content:e,status:t},r){try{const s=JSON.parse(e);return"error"in s?new m(s.message,t,s.error,r):new l(s.message,t,r)}catch(e){}return new l(e,t,r)}(S,y)},T=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),S=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}}(T);return O([...S.hosts].reverse(),S.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 o=()=>f(e,t);if(!0!==(t.cacheable||e.cacheable))return o();const n={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return g.get(n,(()=>c.get(n,(()=>c.set(n,o()).then((e=>Promise.all([c.delete(n),e])),(e=>Promise.all([c.delete(n),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>g.set(n,e)})},requestsCache:c,responsesCache:g}}function f({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}const y=1e3,P=2e3,v=3e4;const w="5.0.0-alpha.51";function b(e){return[{url:`${e}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${e}.algolia.net`,accept:"write",protocol:"https"}].concat(function(e){const t=e;for(let r=e.length-1;r>0;r--){const s=Math.floor(Math.random()*(r+1)),a=e[r];t[r]=e[s],t[s]=a}return t}([{url:`${e}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}e.apiClientVersion=w,e.recommendClient=function(e,a,o){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!a||"string"!=typeof a)throw new Error("`apiKey` is missing.");return function({appId:e,apiKey:t,authMode:r,algoliaAgents:s,...a}){const o=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:{}}}(e,t,r),n=g({hosts:b(e),...a,algoliaAgent:f({algoliaAgents:s,client:"Recommend",version:w}),baseHeaders:{"content-type":"text/plain",...o.headers(),...a.baseHeaders},baseQueryParameters:{...o.queryParameters(),...a.baseQueryParameters}});return{transporter:n,appId:e,clearCache:()=>Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then((()=>{})),get _ua(){return n.algoliaAgent.value},addAlgoliaAgent(e,t){n.algoliaAgent.add({segment:e,version:t})},del({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `del`.");const s={method:"DELETE",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return n.request(s,r)},get({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `get`.");const s={method:"GET",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return n.request(s,r)},getRecommendations(e,t){if(!e)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!e.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");const r={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return n.request(r,t)},post({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `post`.");const a={method:"POST",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return n.request(a,s)},put({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `put`.");const a={method:"PUT",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return n.request(a,s)}}}({appId:e,apiKey:a,timeouts:{connect:y,read:P,write:v},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 o;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===o&&(clearTimeout(a),o=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(o),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(o),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:r({caches:[t({key:`${w}-${e}`}),s()]}),...o})}}));

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

import type { GetRecommendationsResponse } from '../model/getRecommendationsResponse';
export declare const apiClientVersion = "5.0.0-alpha.50";
export declare const apiClientVersion = "5.0.0-alpha.51";
export declare function createRecommendClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): {

@@ -82,3 +82,3 @@ transporter: import("@algolia/client-common").Transporter;

*/
export declare type RecommendClient = ReturnType<typeof createRecommendClient>;
export type RecommendClient = ReturnType<typeof createRecommendClient>;
//# sourceMappingURL=recommendClient.d.ts.map
{
"name": "@algolia/recommend",
"version": "5.0.0-alpha.50",
"version": "5.0.0-alpha.51",
"description": "JavaScript client for recommend",

@@ -41,10 +41,10 @@ "repository": "algolia/algoliasearch-client-javascript",

"dependencies": {
"@algolia/client-common": "5.0.0-alpha.50",
"@algolia/requester-browser-xhr": "5.0.0-alpha.50",
"@algolia/requester-node-http": "5.0.0-alpha.50"
"@algolia/client-common": "5.0.0-alpha.51",
"@algolia/requester-browser-xhr": "5.0.0-alpha.51",
"@algolia/requester-node-http": "5.0.0-alpha.51"
},
"devDependencies": {
"@types/node": "16.18.12",
"@types/node": "18.14.2",
"rollup": "2.79.1",
"typescript": "4.8.3"
"typescript": "4.9.5"
},

@@ -51,0 +51,0 @@ "engines": {

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

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

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

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

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

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