@algolia/recommend 5.0.0-alpha.9 → 5.0.0-alpha.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builds/browser.d.ts +5 -5
- package/dist/builds/node.d.ts +5 -5
- package/dist/model/advancedSyntaxFeatures.d.ts +1 -1
- package/dist/model/advancedSyntaxFeatures.d.ts.map +1 -1
- package/dist/model/alternativesAsExact.d.ts +1 -1
- package/dist/model/alternativesAsExact.d.ts.map +1 -1
- package/dist/model/anchoring.d.ts +5 -0
- package/dist/model/anchoring.d.ts.map +1 -0
- package/dist/model/aroundPrecision.d.ts +6 -0
- package/dist/model/aroundPrecision.d.ts.map +1 -0
- package/dist/model/aroundPrecisionFromValueInner.d.ts +5 -0
- package/dist/model/aroundPrecisionFromValueInner.d.ts.map +1 -0
- package/dist/model/aroundRadius.d.ts +5 -5
- package/dist/model/aroundRadius.d.ts.map +1 -1
- package/dist/model/aroundRadiusAll.d.ts +1 -1
- package/dist/model/aroundRadiusAll.d.ts.map +1 -1
- package/dist/model/automaticFacetFilter.d.ts +18 -0
- package/dist/model/automaticFacetFilter.d.ts.map +1 -0
- package/dist/model/automaticFacetFilters.d.ts +6 -0
- package/dist/model/automaticFacetFilters.d.ts.map +1 -0
- package/dist/model/baseRecommendRequest.d.ts +14 -17
- package/dist/model/baseRecommendRequest.d.ts.map +1 -1
- package/dist/model/baseRecommendationsQuery.d.ts +12 -0
- package/dist/model/baseRecommendationsQuery.d.ts.map +1 -0
- package/dist/model/baseSearchParams.d.ts +3 -3
- package/dist/model/baseSearchParams.d.ts.map +1 -1
- package/dist/model/baseSearchParamsWithoutQuery.d.ts +118 -122
- package/dist/model/baseSearchParamsWithoutQuery.d.ts.map +1 -1
- package/dist/model/baseSearchResponse.d.ts +105 -101
- package/dist/model/baseSearchResponse.d.ts.map +1 -1
- package/dist/model/baseTrendingFacetsQuery.d.ts +9 -0
- package/dist/model/baseTrendingFacetsQuery.d.ts.map +1 -0
- package/dist/model/baseTrendingItemsQuery.d.ts +16 -0
- package/dist/model/baseTrendingItemsQuery.d.ts.map +1 -0
- package/dist/model/clientMethodProps.d.ts +127 -60
- package/dist/model/clientMethodProps.d.ts.map +1 -1
- package/dist/model/condition.d.ts +17 -0
- package/dist/model/condition.d.ts.map +1 -0
- package/dist/model/consequence.d.ts +26 -0
- package/dist/model/consequence.d.ts.map +1 -0
- package/dist/model/consequenceHide.d.ts +10 -0
- package/dist/model/consequenceHide.d.ts.map +1 -0
- package/dist/model/consequenceParams.d.ts +5 -0
- package/dist/model/consequenceParams.d.ts.map +1 -0
- package/dist/model/consequenceQuery.d.ts +6 -0
- package/dist/model/consequenceQuery.d.ts.map +1 -0
- package/dist/model/consequenceQueryObject.d.ts +12 -0
- package/dist/model/consequenceQueryObject.d.ts.map +1 -0
- package/dist/model/deletedAtResponse.d.ts +14 -0
- package/dist/model/deletedAtResponse.d.ts.map +1 -0
- package/dist/model/distinct.d.ts +4 -4
- package/dist/model/distinct.d.ts.map +1 -1
- package/dist/model/edit.d.ts +13 -0
- package/dist/model/edit.d.ts.map +1 -0
- package/dist/model/editType.d.ts +5 -0
- package/dist/model/editType.d.ts.map +1 -0
- package/dist/model/errorBase.d.ts +6 -6
- package/dist/model/errorBase.d.ts.map +1 -1
- package/dist/model/exactOnSingleWordQuery.d.ts +4 -4
- package/dist/model/exactOnSingleWordQuery.d.ts.map +1 -1
- package/dist/model/exhaustive.d.ts +26 -0
- package/dist/model/exhaustive.d.ts.map +1 -0
- package/dist/model/facetFilters.d.ts +5 -5
- package/dist/model/facetFilters.d.ts.map +1 -1
- package/dist/model/facetOrdering.d.ts +12 -12
- package/dist/model/facetOrdering.d.ts.map +1 -1
- package/dist/model/facets.d.ts +9 -9
- package/dist/model/facets.d.ts.map +1 -1
- package/dist/model/facetsStats.d.ts +18 -18
- package/dist/model/facetsStats.d.ts.map +1 -1
- package/dist/model/getRecommendTaskResponse.d.ts +5 -0
- package/dist/model/getRecommendTaskResponse.d.ts.map +1 -0
- package/dist/model/getRecommendationsParams.d.ts +10 -10
- package/dist/model/getRecommendationsParams.d.ts.map +1 -1
- package/dist/model/getRecommendationsResponse.d.ts +4 -4
- package/dist/model/getRecommendationsResponse.d.ts.map +1 -1
- package/dist/model/highlightResult.d.ts +2 -2
- package/dist/model/highlightResult.d.ts.map +1 -1
- package/dist/model/highlightResultOption.d.ts +19 -19
- package/dist/model/highlightResultOption.d.ts.map +1 -1
- package/dist/model/ignorePlurals.d.ts +4 -4
- package/dist/model/ignorePlurals.d.ts.map +1 -1
- package/dist/model/index.d.ts +87 -53
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/indexSettingsAsSearchParams.d.ts +162 -160
- package/dist/model/indexSettingsAsSearchParams.d.ts.map +1 -1
- package/dist/model/matchLevel.d.ts +4 -4
- package/dist/model/matchLevel.d.ts.map +1 -1
- package/dist/model/matchedGeoLocation.d.ts +14 -14
- package/dist/model/matchedGeoLocation.d.ts.map +1 -1
- package/dist/model/mixedSearchFilters.d.ts +1 -1
- package/dist/model/mixedSearchFilters.d.ts.map +1 -1
- package/dist/model/mode.d.ts +5 -0
- package/dist/model/mode.d.ts.map +1 -0
- package/dist/model/numericFilters.d.ts +5 -5
- package/dist/model/numericFilters.d.ts.map +1 -1
- package/dist/model/optionalFilters.d.ts +5 -5
- package/dist/model/optionalFilters.d.ts.map +1 -1
- package/dist/model/params.d.ts +13 -0
- package/dist/model/params.d.ts.map +1 -0
- package/dist/model/personalization.d.ts +14 -14
- package/dist/model/personalization.d.ts.map +1 -1
- package/dist/model/promote.d.ts +4 -0
- package/dist/model/promote.d.ts.map +1 -0
- package/dist/model/promoteObjectID.d.ts +14 -0
- package/dist/model/promoteObjectID.d.ts.map +1 -0
- package/dist/model/promoteObjectIDs.d.ts +14 -0
- package/dist/model/promoteObjectIDs.d.ts.map +1 -0
- package/dist/model/queryType.d.ts +4 -4
- package/dist/model/queryType.d.ts.map +1 -1
- package/dist/model/rankingInfo.d.ts +50 -50
- package/dist/model/rankingInfo.d.ts.map +1 -1
- package/dist/model/reRankingApplyFilter.d.ts +5 -5
- package/dist/model/reRankingApplyFilter.d.ts.map +1 -1
- package/dist/model/recommendHit.d.ts +26 -26
- package/dist/model/recommendHit.d.ts.map +1 -1
- package/dist/model/recommendHits.d.ts +12 -4
- package/dist/model/recommendHits.d.ts.map +1 -1
- package/dist/model/recommendModels.d.ts +2 -0
- package/dist/model/recommendModels.d.ts.map +1 -0
- package/dist/model/recommendationModels.d.ts +4 -4
- package/dist/model/recommendationModels.d.ts.map +1 -1
- package/dist/model/recommendationsQuery.d.ts +4 -0
- package/dist/model/recommendationsQuery.d.ts.map +1 -0
- package/dist/model/recommendationsRequest.d.ts +4 -3
- package/dist/model/recommendationsRequest.d.ts.map +1 -1
- package/dist/model/recommendationsResponse.d.ts +3 -3
- package/dist/model/recommendationsResponse.d.ts.map +1 -1
- package/dist/model/redirect.d.ts +8 -0
- package/dist/model/redirect.d.ts.map +1 -0
- package/dist/model/redirectRuleIndexMetadata.d.ts +21 -0
- package/dist/model/redirectRuleIndexMetadata.d.ts.map +1 -0
- package/dist/model/redirectRuleIndexMetadataData.d.ts +7 -0
- package/dist/model/redirectRuleIndexMetadataData.d.ts.map +1 -0
- package/dist/model/removeStopWords.d.ts +4 -4
- package/dist/model/removeStopWords.d.ts.map +1 -1
- package/dist/model/removeWordsIfNoResults.d.ts +4 -4
- package/dist/model/removeWordsIfNoResults.d.ts.map +1 -1
- package/dist/model/renderingContent.d.ts +7 -7
- package/dist/model/renderingContent.d.ts.map +1 -1
- package/dist/model/ruleResponse.d.ts +27 -0
- package/dist/model/ruleResponse.d.ts.map +1 -0
- package/dist/model/ruleResponseMetadata.d.ts +7 -0
- package/dist/model/ruleResponseMetadata.d.ts.map +1 -0
- package/dist/model/searchParamsObject.d.ts +3 -3
- package/dist/model/searchParamsObject.d.ts.map +1 -1
- package/dist/model/searchParamsQuery.d.ts +6 -6
- package/dist/model/searchParamsQuery.d.ts.map +1 -1
- package/dist/model/searchRecommendRulesParams.d.ts +30 -0
- package/dist/model/searchRecommendRulesParams.d.ts.map +1 -0
- package/dist/model/searchRecommendRulesResponse.d.ts +20 -0
- package/dist/model/searchRecommendRulesResponse.d.ts.map +1 -0
- package/dist/model/semanticSearch.d.ts +10 -0
- package/dist/model/semanticSearch.d.ts.map +1 -0
- package/dist/model/snippetResult.d.ts +2 -2
- package/dist/model/snippetResult.d.ts.map +1 -1
- package/dist/model/snippetResultOption.d.ts +11 -11
- package/dist/model/snippetResultOption.d.ts.map +1 -1
- package/dist/model/sortRemainingBy.d.ts +4 -4
- package/dist/model/sortRemainingBy.d.ts.map +1 -1
- package/dist/model/tagFilters.d.ts +5 -5
- package/dist/model/tagFilters.d.ts.map +1 -1
- package/dist/model/taskStatus.d.ts +5 -0
- package/dist/model/taskStatus.d.ts.map +1 -0
- package/dist/model/trendingFacetsModel.d.ts +5 -0
- package/dist/model/trendingFacetsModel.d.ts.map +1 -0
- package/dist/model/trendingFacetsQuery.d.ts +4 -0
- package/dist/model/trendingFacetsQuery.d.ts.map +1 -0
- package/dist/model/trendingItemsModel.d.ts +5 -0
- package/dist/model/trendingItemsModel.d.ts.map +1 -0
- package/dist/model/trendingItemsQuery.d.ts +4 -0
- package/dist/model/trendingItemsQuery.d.ts.map +1 -0
- package/dist/model/typoTolerance.d.ts +5 -5
- package/dist/model/typoTolerance.d.ts.map +1 -1
- package/dist/model/typoToleranceEnum.d.ts +1 -1
- package/dist/model/typoToleranceEnum.d.ts.map +1 -1
- package/dist/model/value.d.ts +8 -8
- package/dist/model/value.d.ts.map +1 -1
- package/dist/recommend.cjs +381 -0
- package/dist/recommend.esm.browser.js +552 -469
- package/dist/recommend.esm.node.js +370 -235
- package/dist/recommend.umd.js +2 -2
- package/dist/src/recommendClient.d.ts +129 -81
- package/dist/src/recommendClient.d.ts.map +1 -1
- package/index.js +1 -1
- package/model/advancedSyntaxFeatures.ts +1 -1
- package/model/alternativesAsExact.ts +1 -1
- package/model/anchoring.ts +6 -0
- package/model/aroundPrecision.ts +8 -0
- package/model/aroundPrecisionFromValueInner.ts +7 -0
- package/model/aroundRadius.ts +2 -2
- package/model/aroundRadiusAll.ts +1 -1
- package/model/automaticFacetFilter.ts +21 -0
- package/model/automaticFacetFilters.ts +8 -0
- package/model/baseRecommendRequest.ts +5 -11
- package/model/baseRecommendationsQuery.ts +17 -0
- package/model/baseSearchParams.ts +1 -1
- package/model/baseSearchParamsWithoutQuery.ts +40 -45
- package/model/baseSearchResponse.ts +37 -31
- package/model/baseTrendingFacetsQuery.ts +12 -0
- package/model/baseTrendingItemsQuery.ts +22 -0
- package/model/clientMethodProps.ts +83 -11
- package/model/condition.ts +22 -0
- package/model/consequence.ts +32 -0
- package/model/consequenceHide.ts +11 -0
- package/model/consequenceParams.ts +9 -0
- package/model/consequenceQuery.ts +8 -0
- package/model/consequenceQueryObject.ts +15 -0
- package/model/deletedAtResponse.ts +16 -0
- package/model/distinct.ts +2 -2
- package/model/edit.ts +17 -0
- package/model/editType.ts +6 -0
- package/model/errorBase.ts +1 -1
- package/model/exactOnSingleWordQuery.ts +2 -2
- package/model/exhaustive.ts +31 -0
- package/model/facetFilters.ts +2 -2
- package/model/facetOrdering.ts +3 -3
- package/model/facets.ts +2 -2
- package/model/facetsStats.ts +5 -5
- package/model/getRecommendTaskResponse.ts +7 -0
- package/model/getRecommendationsParams.ts +3 -3
- package/model/getRecommendationsResponse.ts +1 -1
- package/model/highlightResult.ts +1 -1
- package/model/highlightResultOption.ts +2 -2
- package/model/ignorePlurals.ts +2 -2
- package/model/index.ts +40 -6
- package/model/indexSettingsAsSearchParams.ts +51 -47
- package/model/matchLevel.ts +1 -1
- package/model/matchedGeoLocation.ts +1 -1
- package/model/mixedSearchFilters.ts +1 -1
- package/model/mode.ts +6 -0
- package/model/numericFilters.ts +2 -2
- package/model/optionalFilters.ts +2 -2
- package/model/params.ts +18 -0
- package/model/personalization.ts +1 -1
- package/model/promote.ts +6 -0
- package/model/promoteObjectID.ts +16 -0
- package/model/promoteObjectIDs.ts +16 -0
- package/model/queryType.ts +2 -2
- package/model/rankingInfo.ts +1 -1
- package/model/reRankingApplyFilter.ts +2 -2
- package/model/recommendHit.ts +4 -4
- package/model/recommendHits.ts +11 -1
- package/model/recommendModels.ts +7 -0
- package/model/recommendationModels.ts +2 -2
- package/model/recommendationsQuery.ts +7 -0
- package/model/recommendationsRequest.ts +8 -4
- package/model/recommendationsResponse.ts +1 -1
- package/model/redirect.ts +10 -0
- package/model/redirectRuleIndexMetadata.ts +27 -0
- package/model/redirectRuleIndexMetadataData.ts +8 -0
- package/model/removeStopWords.ts +2 -2
- package/model/removeWordsIfNoResults.ts +2 -2
- package/model/renderingContent.ts +2 -2
- package/model/ruleResponse.ts +34 -0
- package/model/ruleResponseMetadata.ts +8 -0
- package/model/searchParamsObject.ts +1 -1
- package/model/searchParamsQuery.ts +2 -2
- package/model/searchRecommendRulesParams.ts +36 -0
- package/model/searchRecommendRulesResponse.ts +25 -0
- package/model/semanticSearch.ts +11 -0
- package/model/snippetResult.ts +1 -1
- package/model/snippetResultOption.ts +2 -2
- package/model/sortRemainingBy.ts +2 -2
- package/model/tagFilters.ts +2 -2
- package/model/taskStatus.ts +6 -0
- package/model/trendingFacetsModel.ts +6 -0
- package/model/trendingFacetsQuery.ts +7 -0
- package/model/trendingItemsModel.ts +6 -0
- package/model/trendingItemsQuery.ts +6 -0
- package/model/typoTolerance.ts +2 -2
- package/model/typoToleranceEnum.ts +1 -1
- package/model/value.ts +1 -1
- package/package.json +30 -13
- package/dist/model/baseRecommendationRequest.d.ts +0 -9
- package/dist/model/baseRecommendationRequest.d.ts.map +0 -1
- package/dist/model/baseTrendingRequest.d.ts +0 -13
- package/dist/model/baseTrendingRequest.d.ts.map +0 -1
- package/dist/model/recommendationRequest.d.ts +0 -4
- package/dist/model/recommendationRequest.d.ts.map +0 -1
- package/dist/model/trendingModels.d.ts +0 -5
- package/dist/model/trendingModels.d.ts.map +0 -1
- package/dist/model/trendingRequest.d.ts +0 -4
- package/dist/model/trendingRequest.d.ts.map +0 -1
- package/dist/recommend.cjs.js +0 -248
- package/model/baseRecommendationRequest.ts +0 -12
- package/model/baseTrendingRequest.ts +0 -17
- package/model/recommendationRequest.ts +0 -7
- package/model/trendingModels.ts +0 -6
- package/model/trendingRequest.ts +0 -6
package/dist/recommend.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! recommend.umd.js | 5.0.0-alpha.
|
|
2
|
-
!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 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){super(e,r,"ApiError"),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}}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}=${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 p({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:n,requester:i,requestsCache:c,responsesCache:p}){async function g(c,p,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,p),P=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,p.headers),w="GET"===c.method?{...c.data,...p.data}:{},q={...s,...c.queryParameters,...w};if(a.value&&(q["x-algolia-agent"]=a.value),p&&p.queryParameters)for(const e of Object.keys(p.queryParameters))p.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(p.queryParameters[e])?q[e]=p.queryParameters[e].toString():q[e]=p.queryParameters[e];let v=0;const b=async(e,r)=>{const s=e.pop();if(void 0===s)throw new u(function(e){return e.map((e=>m(e)))}(f));let a=p.timeout;void 0===a&&(a=g?n.read:n.write);const w={data:y,headers:P,method:c.method,url:h(s,c.path,q),connectTimeout:r(v,n.connect),responseTimeout:r(v,a)},O=t=>{const r={request:w,response:t,host:s,triesLeft:e.length};return f.push(r),r},T=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)}(T)){const a=O(T);return T.isTimedOut&&v++,console.log("Retryable failure",m(a)),await t.set(s,o(s,T.isTimedOut?"timed out":"down")),b(e,r)}if(function({status:e}){return 2==~~(e/100)}(T))return function(e){try{return JSON.parse(e.content)}catch(t){throw new d(t.message,e)}}(T);throw O(T),function({content:e,status:t},r){let s=e;try{s=JSON.parse(e).message}catch(e){}return new l(s,t,r)}(T,f)},O=e.filter((e=>"readWrite"===e.accept||(g?"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}}(O);return b([...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 g(e,t,a);const o=()=>g(e,t);if(!0!==(t.cacheable||e.cacheable))return o();const n={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return p.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=>p.set(n,e)})},requestsCache:c,responsesCache:p}}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}const f="5.0.0-alpha.9";function y(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=f,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=p({hosts:y(e),...a,algoliaAgent:g({algoliaAgents:s,client:"Recommend",version:f}),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.9-${e}`}),s()]}),...o})}}));
|
|
1
|
+
/*! recommend.umd.js | 5.0.0-alpha.90 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
|
|
2
|
+
!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 a(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function o(){return JSON.parse(a().getItem(r)||"{}")}return{get:(e,t,r={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{const r=JSON.stringify(e),a=o()[r];return Promise.all([a||t(),void 0!==a])})).then((([e,t])=>Promise.all([e,t||r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const s=o();return s[JSON.stringify(e)]=t,a().setItem(r,JSON.stringify(s)),t})),delete:e=>Promise.resolve().then((()=>{const t=o();delete t[JSON.stringify(e)],a().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(r)}))}}function r(e){const t=[...e.caches],a=t.shift();return void 0===a?{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,o,s={miss:()=>Promise.resolve()})=>a.get(e,o,s).catch((()=>r({caches:t}).get(e,o,s))),set:(e,o)=>a.set(e,o).catch((()=>r({caches:t}).set(e,o))),delete:e=>a.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>a.clear().catch((()=>r({caches:t}).clear()))}}function a(e={serializable:!0}){let t={};return{get(r,a,o={miss:()=>Promise.resolve()}){const s=JSON.stringify(r);if(s in t)return Promise.resolve(e.serializable?JSON.parse(t[s]):t[s]);const n=a();return n.then((e=>o.miss(e))).then((()=>n))},set:(r,a)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const o=12e4;function s(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>o},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=o}}}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 a=r.call(e,t||"default");if("object"!=typeof a)return a;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 l extends c{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",e,"RetryError")}}class u extends c{constructor(e,t,r,a="ApiError"){super(e,r,a),n(this,"status",void 0),this.status=t}}class m extends i{constructor(e,t){super(e,"DeserializationError"),n(this,"response",void 0),this.response=t}}class d extends u{constructor(e,t,r,a){super(e,t,a,"DetailedApiError"),n(this,"error",void 0),this.error=r}}function h(e,t,r){const a=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 o=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return a.length&&(o+=`?${a}`),o}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:a,algoliaAgent:o,timeouts:n,requester:i,requestsCache:c,responsesCache:g}){async function f(c,g,f=!0){const w=[],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,g),P=function(e,t,r){const a={Accept:"application/json",...e,...t,...r},o={};return Object.keys(a).forEach((e=>{const t=a[e];o[e.toLowerCase()]=t})),o}(r,c.headers,g.headers),q="GET"===c.method?{...c.data,...g.data}:{},b={...a,...c.queryParameters,...q};if(o.value&&(b["x-algolia-agent"]=o.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 v=0;const R=async(e,r)=>{const a=e.pop();if(void 0===a)throw new l(function(e){return e.map((e=>p(e)))}(w));let o=g.timeout;void 0===o&&(o=f?n.read:n.write);const q={data:y,headers:P,method:c.method,url:h(a,c.path,b),connectTimeout:r(v,n.connect),responseTimeout:r(v,o)},T=t=>{const r={request:q,response:t,host:a,triesLeft:e.length};return w.push(r),r},E=await i.send(q);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)}(E)){const o=T(E);return E.isTimedOut&&v++,console.log("Retryable failure",p(o)),await t.set(a,s(a,E.isTimedOut?"timed out":"down")),R(e,r)}if(function({status:e}){return 2==~~(e/100)}(E))return function(e){try{return JSON.parse(e.content)}catch(t){throw new m(t.message,e)}}(E);throw T(E),function({content:e,status:t},r){try{const a=JSON.parse(e);return"error"in a?new d(a.message,t,a.error,r):new u(a.message,t,r)}catch(e){}return new u(e,t,r)}(E,w)},T=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),E=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(s(e))))))),a=r.filter((e=>e.isUp())),o=r.filter((e=>e.isTimedOut())),n=[...a,...o];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===o.length&&0===e?1:o.length+3+e)*t}}(T);return R([...E.hosts].reverse(),E.getTimeout)}return{hostsCache:t,requester:i,timeouts:n,algoliaAgent:o,baseHeaders:r,baseQueryParameters:a,hosts:e,request:function(e,t={}){const o=e.useReadTransporter||"GET"===e.method;if(!o)return f(e,t,o);const s=()=>f(e,t);if(!0!==(t.cacheable||e.cacheable))return s();const n={request:e,requestOptions:t,transporter:{queryParameters:a,headers:r}};return g.get(n,(()=>c.get(n,(()=>c.set(n,s()).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 a=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=>a.add(e))),a}const w="5.0.0-alpha.90";function y(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 a=Math.floor(Math.random()*(r+1)),o=e[r];t[r]=e[a],t[a]=o}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,o,s){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!o||"string"!=typeof o)throw new Error("`apiKey` is missing.");return function({appId:e,apiKey:t,authMode:r,algoliaAgents:a,...o}){const s=function(e,t,r="WithinHeaders"){const a={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?a:{},queryParameters:()=>"WithinQueryParameters"===r?a:{}}}(e,t,r),n=g({hosts:y(e),...o,algoliaAgent:f({algoliaAgents:a,client:"Recommend",version:w}),baseHeaders:{"content-type":"text/plain",...s.headers(),...o.baseHeaders},baseQueryParameters:{...s.queryParameters(),...o.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 a={method:"DELETE",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return n.request(a,r)},deleteRecommendRule({indexName:e,model:t,objectID:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteRecommendRule`.");if(!t)throw new Error("Parameter `model` is required when calling `deleteRecommendRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteRecommendRule`.");const o={method:"DELETE",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{model}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return n.request(o,a)},get({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `get`.");const a={method:"GET",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return n.request(a,r)},getRecommendRule({indexName:e,model:t,objectID:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `getRecommendRule`.");if(!t)throw new Error("Parameter `model` is required when calling `getRecommendRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getRecommendRule`.");const o={method:"GET",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{model}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return n.request(o,a)},getRecommendStatus({indexName:e,model:t,taskID:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `getRecommendStatus`.");if(!t)throw new Error("Parameter `model` is required when calling `getRecommendStatus`.");if(!r)throw new Error("Parameter `taskID` is required when calling `getRecommendStatus`.");const o={method:"GET",path:"/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}",encodeURIComponent(e)).replace("{model}",encodeURIComponent(t)).replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return n.request(o,a)},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},a){if(!e)throw new Error("Parameter `path` is required when calling `post`.");const o={method:"POST",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return n.request(o,a)},put({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `put`.");const o={method:"PUT",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return n.request(o,a)},searchRecommendRules({indexName:e,model:t,searchRecommendRulesParams:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `searchRecommendRules`.");if(!t)throw new Error("Parameter `model` is required when calling `searchRecommendRules`.");const o={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}",encodeURIComponent(e)).replace("{model}",encodeURIComponent(t)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return n.request(o,a)}}}({appId:e,apiKey: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 a=(e,a)=>setTimeout((()=>{r.abort(),t({status:0,content:a,isTimedOut:!0})}),e),o=a(e.connectTimeout,"Connection timeout");let s;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===s&&(clearTimeout(o),s=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(o),clearTimeout(s),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(o),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:r({caches:[t({key:`${w}-${e}`}),a()]}),...s})}}));
|
|
@@ -1,82 +1,130 @@
|
|
|
1
|
-
import type { CreateClientOptions, RequestOptions } from '@algolia/client-common';
|
|
2
|
-
import type { DelProps, GetProps, PostProps, PutProps } from '../model/clientMethodProps';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* @
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* @
|
|
59
|
-
* @param
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
*
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* @
|
|
70
|
-
* @param
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
*
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
1
|
+
import type { CreateClientOptions, RequestOptions } from '@algolia/client-common';
|
|
2
|
+
import type { DelProps, DeleteRecommendRuleProps, GetProps, GetRecommendRuleProps, GetRecommendStatusProps, PostProps, PutProps, SearchRecommendRulesProps } from '../model/clientMethodProps';
|
|
3
|
+
import type { DeletedAtResponse } from '../model/deletedAtResponse';
|
|
4
|
+
import type { GetRecommendTaskResponse } from '../model/getRecommendTaskResponse';
|
|
5
|
+
import type { GetRecommendationsParams } from '../model/getRecommendationsParams';
|
|
6
|
+
import type { GetRecommendationsResponse } from '../model/getRecommendationsResponse';
|
|
7
|
+
import type { RuleResponse } from '../model/ruleResponse';
|
|
8
|
+
import type { SearchRecommendRulesResponse } from '../model/searchRecommendRulesResponse';
|
|
9
|
+
export declare const apiClientVersion = "5.0.0-alpha.90";
|
|
10
|
+
export declare function createRecommendClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): {
|
|
11
|
+
transporter: import("@algolia/client-common").Transporter;
|
|
12
|
+
/**
|
|
13
|
+
* The `appId` currently in use.
|
|
14
|
+
*/
|
|
15
|
+
appId: string;
|
|
16
|
+
/**
|
|
17
|
+
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
18
|
+
*/
|
|
19
|
+
clearCache(): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
22
|
+
*/
|
|
23
|
+
readonly _ua: string;
|
|
24
|
+
/**
|
|
25
|
+
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
|
|
26
|
+
*
|
|
27
|
+
* @param segment - The algolia agent (user-agent) segment to add.
|
|
28
|
+
* @param version - The version of the agent.
|
|
29
|
+
*/
|
|
30
|
+
addAlgoliaAgent(segment: string, version?: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
33
|
+
*
|
|
34
|
+
* @summary Send requests to the Algolia REST API.
|
|
35
|
+
* @param del - The del object.
|
|
36
|
+
* @param del.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
37
|
+
* @param del.parameters - Query parameters to apply to the current query.
|
|
38
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
39
|
+
*/
|
|
40
|
+
del({ path, parameters }: DelProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
|
|
41
|
+
/**
|
|
42
|
+
* Delete a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/).
|
|
43
|
+
*
|
|
44
|
+
* @summary Delete a Recommend rule.
|
|
45
|
+
* @param deleteRecommendRule - The deleteRecommendRule object.
|
|
46
|
+
* @param deleteRecommendRule.indexName - Index on which to perform the request.
|
|
47
|
+
* @param deleteRecommendRule.model - [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
|
|
48
|
+
* @param deleteRecommendRule.objectID - Unique record (object) identifier.
|
|
49
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
50
|
+
*/
|
|
51
|
+
deleteRecommendRule({ indexName, model, objectID }: DeleteRecommendRuleProps, requestOptions?: RequestOptions): Promise<DeletedAtResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
54
|
+
*
|
|
55
|
+
* @summary Send requests to the Algolia REST API.
|
|
56
|
+
* @param get - The get object.
|
|
57
|
+
* @param get.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
58
|
+
* @param get.parameters - Query parameters to apply to the current query.
|
|
59
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
60
|
+
*/
|
|
61
|
+
get({ path, parameters }: GetProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
|
|
62
|
+
/**
|
|
63
|
+
* Return a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/).
|
|
64
|
+
*
|
|
65
|
+
* @summary Get a Recommend rule.
|
|
66
|
+
* @param getRecommendRule - The getRecommendRule object.
|
|
67
|
+
* @param getRecommendRule.indexName - Index on which to perform the request.
|
|
68
|
+
* @param getRecommendRule.model - [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
|
|
69
|
+
* @param getRecommendRule.objectID - Unique record (object) identifier.
|
|
70
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
71
|
+
*/
|
|
72
|
+
getRecommendRule({ indexName, model, objectID }: GetRecommendRuleProps, requestOptions?: RequestOptions): Promise<RuleResponse>;
|
|
73
|
+
/**
|
|
74
|
+
* Some operations, such as deleting a Recommend rule, will respond with a `taskID` value. Use this value here to check the status of that task.
|
|
75
|
+
*
|
|
76
|
+
* @summary Get a Recommend task\'s status.
|
|
77
|
+
* @param getRecommendStatus - The getRecommendStatus object.
|
|
78
|
+
* @param getRecommendStatus.indexName - Index on which to perform the request.
|
|
79
|
+
* @param getRecommendStatus.model - [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
|
|
80
|
+
* @param getRecommendStatus.taskID - Unique identifier of a task. Numeric value (up to 64bits).
|
|
81
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
82
|
+
*/
|
|
83
|
+
getRecommendStatus({ indexName, model, taskID }: GetRecommendStatusProps, requestOptions?: RequestOptions): Promise<GetRecommendTaskResponse>;
|
|
84
|
+
/**
|
|
85
|
+
* Returns results from either recommendation or trending models: - **Recommendations** are provided by the [Related Products](https://www.algolia.com/doc/guides/algolia-recommend/overview/#related-products-and-related-content) and [Frequently Bought Together](https://www.algolia.com/doc/guides/algolia-recommend/overview/#frequently-bought-together) models - **Trending** models are [Trending Items and Trending Facet Values](https://www.algolia.com/doc/guides/algolia-recommend/overview/#trending-items-and-trending-facet-values).
|
|
86
|
+
*
|
|
87
|
+
* @summary Get recommendations and trending items.
|
|
88
|
+
* @param getRecommendationsParams - The getRecommendationsParams object.
|
|
89
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
90
|
+
*/
|
|
91
|
+
getRecommendations(getRecommendationsParams: GetRecommendationsParams, requestOptions?: RequestOptions): Promise<GetRecommendationsResponse>;
|
|
92
|
+
/**
|
|
93
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
94
|
+
*
|
|
95
|
+
* @summary Send requests to the Algolia REST API.
|
|
96
|
+
* @param post - The post object.
|
|
97
|
+
* @param post.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
98
|
+
* @param post.parameters - Query parameters to apply to the current query.
|
|
99
|
+
* @param post.body - Parameters to send with the custom request.
|
|
100
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
101
|
+
*/
|
|
102
|
+
post({ path, parameters, body }: PostProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
|
|
103
|
+
/**
|
|
104
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
105
|
+
*
|
|
106
|
+
* @summary Send requests to the Algolia REST API.
|
|
107
|
+
* @param put - The put object.
|
|
108
|
+
* @param put.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
109
|
+
* @param put.parameters - Query parameters to apply to the current query.
|
|
110
|
+
* @param put.body - Parameters to send with the custom request.
|
|
111
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
112
|
+
*/
|
|
113
|
+
put({ path, parameters, body }: PutProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
|
|
114
|
+
/**
|
|
115
|
+
* List [Recommend rules](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/).
|
|
116
|
+
*
|
|
117
|
+
* @summary List Recommend rules.
|
|
118
|
+
* @param searchRecommendRules - The searchRecommendRules object.
|
|
119
|
+
* @param searchRecommendRules.indexName - Index on which to perform the request.
|
|
120
|
+
* @param searchRecommendRules.model - [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
|
|
121
|
+
* @param searchRecommendRules.searchRecommendRulesParams - The searchRecommendRulesParams object.
|
|
122
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
123
|
+
*/
|
|
124
|
+
searchRecommendRules({ indexName, model, searchRecommendRulesParams, }: SearchRecommendRulesProps, requestOptions?: RequestOptions): Promise<SearchRecommendRulesResponse>;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* The client type.
|
|
128
|
+
*/
|
|
129
|
+
export type RecommendClient = ReturnType<typeof createRecommendClient>;
|
|
82
130
|
//# sourceMappingURL=recommendClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recommendClient.d.ts","sourceRoot":"","sources":["../../src/recommendClient.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,mBAAmB,EAInB,cAAc,EAEf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,
|
|
1
|
+
{"version":3,"file":"recommendClient.d.ts","sourceRoot":"","sources":["../../src/recommendClient.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,mBAAmB,EAInB,cAAc,EAEf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EACV,QAAQ,EACR,wBAAwB,EACxB,QAAQ,EACR,qBAAqB,EACrB,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,yBAAyB,EAC1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACtF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAE1F,eAAO,MAAM,gBAAgB,mBAAmB,CAAC;AAsCjD,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,YAAY,EACpB,QAAQ,EACR,aAAa,EACb,GAAG,OAAO,EACX,EAAE,mBAAmB;;IAwBlB;;OAEG;;IAGH;;OAEG;kBACW,QAAQ,IAAI,CAAC;IAO3B;;OAEG;;IAKH;;;;;OAKG;6BACsB,MAAM,YAAY,MAAM,GAAG,IAAI;IAIxD;;;;;;;;OAQG;8BAEqB,QAAQ,mBACb,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAmB/B;;;;;;;;;OASG;wDAE+B,wBAAwB,mBACvC,cAAc,GAC9B,QAAQ,iBAAiB,CAAC;IAqC7B;;;;;;;;OAQG;8BAEqB,QAAQ,mBACb,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAmB/B;;;;;;;;;OASG;qDAE+B,qBAAqB,mBACpC,cAAc,GAC9B,QAAQ,YAAY,CAAC;IAqCxB;;;;;;;;;OASG;qDAE6B,uBAAuB,mBACpC,cAAc,GAC9B,QAAQ,wBAAwB,CAAC;IAoCpC;;;;;;OAMG;iDAEyB,wBAAwB,mBACjC,cAAc,GAC9B,QAAQ,0BAA0B,CAAC;IA8BtC;;;;;;;;;OASG;qCAE2B,SAAS,mBACpB,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAoB/B;;;;;;;;;OASG;oCAE2B,QAAQ,mBACnB,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAoB/B;;;;;;;;;OASG;4EAME,yBAAyB,mBACX,cAAc,GAC9B,QAAQ,4BAA4B,CAAC;EAiC3C;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-commonjs,import/extensions
|
|
2
|
-
module.exports = require('./dist/recommend.cjs
|
|
2
|
+
module.exports = require('./dist/recommend.cjs');
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
export type AdvancedSyntaxFeatures = 'exactPhrase' | 'excludeWords';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
export type AlternativesAsExact =
|
|
4
4
|
| 'ignorePlurals'
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Whether the pattern parameter matches the beginning (`startsWith`) or end (`endsWith`) of the query string, is an exact match (`is`), or a partial match (`contains`).
|
|
5
|
+
*/
|
|
6
|
+
export type Anchoring = 'contains' | 'endsWith' | 'is' | 'startsWith';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
import type { AroundPrecisionFromValueInner } from './aroundPrecisionFromValueInner';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Precision of a geographical search (in meters), to [group results that are more or less the same distance from a central point](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/in-depth/geo-ranking-precision/).
|
|
7
|
+
*/
|
|
8
|
+
export type AroundPrecision = AroundPrecisionFromValueInner[] | number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
export type AroundPrecisionFromValueInner = {
|
|
4
|
+
from?: number;
|
|
5
|
+
|
|
6
|
+
value?: number;
|
|
7
|
+
};
|
package/model/aroundRadius.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import type { AroundRadiusAll } from './aroundRadiusAll';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* [Maximum radius](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#increase-the-search-radius) for a geographical search (in meters).
|
|
7
7
|
*/
|
|
8
8
|
export type AroundRadius = AroundRadiusAll | number;
|
package/model/aroundRadiusAll.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
export type AroundRadiusAll = 'all';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Automatic facet Filter.
|
|
5
|
+
*/
|
|
6
|
+
export type AutomaticFacetFilter = {
|
|
7
|
+
/**
|
|
8
|
+
* Attribute to filter on. This must match a facet placeholder in the Rule\'s pattern.
|
|
9
|
+
*/
|
|
10
|
+
facet: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Score for the filter. Typically used for optional or disjunctive filters.
|
|
14
|
+
*/
|
|
15
|
+
score?: number;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Whether the filter is disjunctive (true) or conjunctive (false).
|
|
19
|
+
*/
|
|
20
|
+
disjunctive?: boolean;
|
|
21
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
import type { AutomaticFacetFilter } from './automaticFacetFilter';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern.
|
|
7
|
+
*/
|
|
8
|
+
export type AutomaticFacetFilters = AutomaticFacetFilter[] | string[];
|
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
import type { SearchParamsObject } from './searchParamsObject';
|
|
1
|
+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
4
2
|
|
|
5
3
|
export type BaseRecommendRequest = {
|
|
6
4
|
/**
|
|
7
|
-
*
|
|
5
|
+
* Algolia index name.
|
|
8
6
|
*/
|
|
9
7
|
indexName: string;
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
|
-
*
|
|
10
|
+
* Recommendations with a confidence score lower than `threshold` won\'t appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are.
|
|
13
11
|
*/
|
|
14
|
-
threshold
|
|
12
|
+
threshold?: number;
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
|
-
*
|
|
15
|
+
* Maximum number of recommendations to retrieve. If 0, all recommendations will be returned.
|
|
18
16
|
*/
|
|
19
17
|
maxRecommendations?: number;
|
|
20
|
-
|
|
21
|
-
queryParameters?: SearchParamsObject;
|
|
22
|
-
|
|
23
|
-
fallbackParameters?: SearchParamsObject;
|
|
24
18
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
import type { RecommendationModels } from './recommendationModels';
|
|
4
|
+
import type { SearchParamsObject } from './searchParamsObject';
|
|
5
|
+
|
|
6
|
+
export type BaseRecommendationsQuery = {
|
|
7
|
+
model: RecommendationModels;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Unique object identifier.
|
|
11
|
+
*/
|
|
12
|
+
objectID: string;
|
|
13
|
+
|
|
14
|
+
queryParameters?: SearchParamsObject;
|
|
15
|
+
|
|
16
|
+
fallbackParameters?: SearchParamsObject;
|
|
17
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import type { BaseSearchParamsWithoutQuery } from './baseSearchParamsWithoutQuery';
|
|
4
4
|
import type { SearchParamsQuery } from './searchParamsQuery';
|