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

@algolia/recommend-core

Package Overview
Dependencies
Maintainers
83
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/recommend-core - npm Package Compare versions

Comparing version 1.12.1 to 1.13.0

2

dist/esm/version.d.ts

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

export declare const version = "1.12.1";
export declare const version = "1.13.0";

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

export const version = '1.12.1';
export const version = '1.13.0';

@@ -1,3 +0,3 @@

/*! @algolia/recommend-core 1.12.1 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/recommend */
!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-core"]={})}(this,(function(e){"use strict";function t({hits:e,maxRecommendations:t,nrOfObjs:n}){const o={};e.forEach((e=>{e.forEach(((e,t)=>{o[e.objectID]?o[e.objectID]={indexSum:o[e.objectID].indexSum+t,nr:o[e.objectID].nr+1}:o[e.objectID]={indexSum:t,nr:1}}))}));const m=((e,t)=>{const n=[];for(const o of Object.keys(e))e[o].nr<2&&(e[o].indexSum+=100),n.push({objectID:o,avgOfIndices:e[o].indexSum/t});return n.sort(((e,t)=>e.avgOfIndices>t.avgOfIndices?1:-1))})(o,n);return m.reduce(((t,n)=>{const o=e.flat().find((e=>e.objectID===n.objectID));return o?t.concat(o):t}),[]).slice(0,t&&t>0?t:void 0)}function n({hits:e,maxRecommendations:t}){return function(e,t){const n=[...t];return n.sort(e),n}(((e,t)=>(e._score||0)>(t._score||0)?-1:1),e).slice(0,t&&t>0?t:void 0)}const o="1.12.1";e.getBatchRecommendations=async function({keys:e,queries:m,recommendClient:a}){a.addAlgoliaAgent("recommend-core",o);const r=await a.getRecommendations(m);let s=0,c=0;const i={};return e.forEach((e=>{const{model:o}=JSON.parse(e.key);c+=e.value;const{maxRecommendations:a,transformItems:d=(e=>e)}=m[s],l=r?.results?.slice(s,c);s+=e.value;let h=[],u=[];"trending-facets"===o?u=l.map((e=>e.hits)).flat():h="trending-items"===o?n({maxRecommendations:a,hits:l.map((e=>e.hits)).flat()}):t({maxRecommendations:a,hits:l.map((e=>e.hits)),nrOfObjs:e.value}),h=d(h),i[e.key]={recommendations:h,trendingFacets:u}})),i},e.getFrequentlyBoughtTogether=function({objectIDs:e,recommendClient:n,transformItems:m=(e=>e),indexName:a,maxRecommendations:r,queryParameters:s,threshold:c}){const i=e.map((e=>({indexName:a,maxRecommendations:r,objectID:e,queryParameters:s,threshold:c})));return n.addAlgoliaAgent("recommend-core",o),n.getFrequentlyBoughtTogether(i).then((n=>t({maxRecommendations:r,hits:n.results.map((e=>e.hits)),nrOfObjs:e.length}))).then((e=>({recommendations:m(e)})))},e.getLookingSimilar=function({objectIDs:e,recommendClient:n,transformItems:m=(e=>e),fallbackParameters:a,indexName:r,maxRecommendations:s,queryParameters:c,threshold:i}){const d=e.map((e=>({fallbackParameters:a,indexName:r,maxRecommendations:s,objectID:e,queryParameters:c,threshold:i})));return n.addAlgoliaAgent("recommend-core",o),n.getLookingSimilar(d).then((n=>t({maxRecommendations:s,hits:n.results.map((e=>e.hits)),nrOfObjs:e.length}))).then((e=>({recommendations:m(e)})))},e.getRecommendations=function({objectIDs:e,recommendClient:n,transformItems:m=(e=>e),fallbackParameters:a,indexName:r,maxRecommendations:s,model:c,queryParameters:i,threshold:d}){const l=e.map((e=>({fallbackParameters:a,indexName:r,maxRecommendations:s,model:c,objectID:e,queryParameters:i,threshold:d})));return n.addAlgoliaAgent("recommend-core",o),n.getRecommendations(l).then((n=>t({maxRecommendations:s,hits:n.results.map((e=>e.hits)),nrOfObjs:e.length}))).then((e=>({recommendations:m(e)})))},e.getRecommendedForYou=function({indexName:e,threshold:t,queryParameters:n,recommendClient:m,maxRecommendations:a,transformItems:r=(e=>e)}){m.addAlgoliaAgent("recommend-core",o);const s=[{indexName:e,threshold:t,queryParameters:n,maxRecommendations:a}];return m.getRecommendedForYou(s).then((e=>({recommendations:r(e.results.map((e=>e.hits)).flat())})))},e.getRelatedProducts=function({objectIDs:e,recommendClient:n,transformItems:m=(e=>e),fallbackParameters:a,indexName:r,maxRecommendations:s,queryParameters:c,threshold:i}){const d=e.map((e=>({fallbackParameters:a,indexName:r,maxRecommendations:s,objectID:e,queryParameters:c,threshold:i})));return n.addAlgoliaAgent("recommend-core",o),n.getRelatedProducts(d).then((n=>t({maxRecommendations:s,hits:n.results.map((e=>e.hits)),nrOfObjs:e.length}))).then((e=>({recommendations:m(e)})))},e.getTrendingFacets=function({recommendClient:e,transformItems:t=(e=>e),indexName:m,maxRecommendations:a,threshold:r,facetName:s}){const c={indexName:m,maxRecommendations:a,threshold:r,facetName:s};return e.addAlgoliaAgent("recommend-core",o),e.getTrendingFacets([c]).then((e=>n({maxRecommendations:a,hits:e.results.map((e=>e.hits)).flat()}))).then((e=>({recommendations:t(e)})))},e.getTrendingItems=function({recommendClient:e,transformItems:t=(e=>e),fallbackParameters:m,indexName:a,maxRecommendations:r,queryParameters:s,threshold:c,facetName:i,facetValue:d}){const l={fallbackParameters:m,indexName:a,maxRecommendations:r,queryParameters:s,threshold:c,facetName:i,facetValue:d};return e.addAlgoliaAgent("recommend-core",o),e.getTrendingItems([l]).then((e=>{return n({maxRecommendations:r,hits:(t="objectID",o=e.results.map((e=>e.hits)).flat(),[...new Map(o.map((e=>[e[t],e]))).values()])});var t,o})).then((e=>({recommendations:t(e)})))}}));
/*! @algolia/recommend-core 1.13.0 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/recommend */
!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-core"]={})}(this,(function(e){"use strict";function t({hits:e,maxRecommendations:t,nrOfObjs:n}){const o={};e.forEach((e=>{e.forEach(((e,t)=>{o[e.objectID]?o[e.objectID]={indexSum:o[e.objectID].indexSum+t,nr:o[e.objectID].nr+1}:o[e.objectID]={indexSum:t,nr:1}}))}));const m=((e,t)=>{const n=[];for(const o of Object.keys(e))e[o].nr<2&&(e[o].indexSum+=100),n.push({objectID:o,avgOfIndices:e[o].indexSum/t});return n.sort(((e,t)=>e.avgOfIndices>t.avgOfIndices?1:-1))})(o,n);return m.reduce(((t,n)=>{const o=e.flat().find((e=>e.objectID===n.objectID));return o?t.concat(o):t}),[]).slice(0,t&&t>0?t:void 0)}function n({hits:e,maxRecommendations:t}){return function(e,t){const n=[...t];return n.sort(e),n}(((e,t)=>(e._score||0)>(t._score||0)?-1:1),e).slice(0,t&&t>0?t:void 0)}const o="1.13.0";e.getBatchRecommendations=async function({keys:e,queries:m,recommendClient:a}){a.addAlgoliaAgent("recommend-core",o);const r=await a.getRecommendations(m);let s=0,c=0;const i={};return e.forEach((e=>{const{model:o}=JSON.parse(e.key);c+=e.value;const{maxRecommendations:a,transformItems:d=(e=>e)}=m[s],l=r?.results?.slice(s,c);s+=e.value;let h=[],u=[];"trending-facets"===o?u=l.map((e=>e.hits)).flat():h="trending-items"===o?n({maxRecommendations:a,hits:l.map((e=>e.hits)).flat()}):t({maxRecommendations:a,hits:l.map((e=>e.hits)),nrOfObjs:e.value}),h=d(h),i[e.key]={recommendations:h,trendingFacets:u}})),i},e.getFrequentlyBoughtTogether=function({objectIDs:e,recommendClient:n,transformItems:m=(e=>e),indexName:a,maxRecommendations:r,queryParameters:s,threshold:c}){const i=e.map((e=>({indexName:a,maxRecommendations:r,objectID:e,queryParameters:s,threshold:c})));return n.addAlgoliaAgent("recommend-core",o),n.getFrequentlyBoughtTogether(i).then((n=>t({maxRecommendations:r,hits:n.results.map((e=>e.hits)),nrOfObjs:e.length}))).then((e=>({recommendations:m(e)})))},e.getLookingSimilar=function({objectIDs:e,recommendClient:n,transformItems:m=(e=>e),fallbackParameters:a,indexName:r,maxRecommendations:s,queryParameters:c,threshold:i}){const d=e.map((e=>({fallbackParameters:a,indexName:r,maxRecommendations:s,objectID:e,queryParameters:c,threshold:i})));return n.addAlgoliaAgent("recommend-core",o),n.getLookingSimilar(d).then((n=>t({maxRecommendations:s,hits:n.results.map((e=>e.hits)),nrOfObjs:e.length}))).then((e=>({recommendations:m(e)})))},e.getRecommendations=function({objectIDs:e,recommendClient:n,transformItems:m=(e=>e),fallbackParameters:a,indexName:r,maxRecommendations:s,model:c,queryParameters:i,threshold:d}){const l=e.map((e=>({fallbackParameters:a,indexName:r,maxRecommendations:s,model:c,objectID:e,queryParameters:i,threshold:d})));return n.addAlgoliaAgent("recommend-core",o),n.getRecommendations(l).then((n=>t({maxRecommendations:s,hits:n.results.map((e=>e.hits)),nrOfObjs:e.length}))).then((e=>({recommendations:m(e)})))},e.getRecommendedForYou=function({indexName:e,threshold:t,queryParameters:n,recommendClient:m,maxRecommendations:a,transformItems:r=(e=>e)}){m.addAlgoliaAgent("recommend-core",o);const s=[{indexName:e,threshold:t,queryParameters:n,maxRecommendations:a}];return m.getRecommendedForYou(s).then((e=>({recommendations:r(e.results.map((e=>e.hits)).flat())})))},e.getRelatedProducts=function({objectIDs:e,recommendClient:n,transformItems:m=(e=>e),fallbackParameters:a,indexName:r,maxRecommendations:s,queryParameters:c,threshold:i}){const d=e.map((e=>({fallbackParameters:a,indexName:r,maxRecommendations:s,objectID:e,queryParameters:c,threshold:i})));return n.addAlgoliaAgent("recommend-core",o),n.getRelatedProducts(d).then((n=>t({maxRecommendations:s,hits:n.results.map((e=>e.hits)),nrOfObjs:e.length}))).then((e=>({recommendations:m(e)})))},e.getTrendingFacets=function({recommendClient:e,transformItems:t=(e=>e),indexName:m,maxRecommendations:a,threshold:r,facetName:s}){const c={indexName:m,maxRecommendations:a,threshold:r,facetName:s};return e.addAlgoliaAgent("recommend-core",o),e.getTrendingFacets([c]).then((e=>n({maxRecommendations:a,hits:e.results.map((e=>e.hits)).flat()}))).then((e=>({recommendations:t(e)})))},e.getTrendingItems=function({recommendClient:e,transformItems:t=(e=>e),fallbackParameters:m,indexName:a,maxRecommendations:r,queryParameters:s,threshold:c,facetName:i,facetValue:d}){const l={fallbackParameters:m,indexName:a,maxRecommendations:r,queryParameters:s,threshold:c,facetName:i,facetValue:d};return e.addAlgoliaAgent("recommend-core",o),e.getTrendingItems([l]).then((e=>{return n({maxRecommendations:r,hits:(t="objectID",o=e.results.map((e=>e.hits)).flat(),[...new Map(o.map((e=>[e[t],e]))).values()])});var t,o})).then((e=>({recommendations:t(e)})))}}));
//# sourceMappingURL=index.js.map
{
"name": "@algolia/recommend-core",
"version": "1.12.1",
"version": "1.13.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/algolia/recommend",

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