@uniformdev/canvas-algolia
Advanced tools
Comparing version 13.0.1-alpha.133 to 13.0.1-alpha.271
@@ -1,1 +0,1 @@ | ||
import{createLimitPolicy as E}from"@uniformdev/canvas";var p=E({throttle:{limit:55,interval:1e3}});function h(e){return typeof e=="string"?e:typeof e=="object"&&e&&"error"in e?e.error:e instanceof Error?e.toString():JSON.stringify(e,null,2)}function y({clients:e,parameterValue:r,parameterName:n,component:o,context:t}){let{source:l="default"}=r,s=e.getClient({source:l,isPreviewClient:t.preview});if(!s)throw new Error(`No Algolia client could be resolved for source key '${l}' referenced in parameter '${n} in component '${o.type}'. Ensure that the 'clients' property you are passing to the enhancer has a client instance registered for the source key.`);return s}var w=Object.freeze(["algoliaRecord"]);function S({clients:e,limitPolicy:r}){if(!e)throw new Error("No Algolia clients were provided to the enhancer. You must provide at least one client via the AlgoliaClientList.");return{enhanceOne:async function({parameter:t,parameterName:l,component:s,context:A}){var u;if(x(t)){if(!v(t.value))return null;let C=y({clients:e,parameterName:l,parameterValue:t.value,component:s,context:A}),i=t.value,f=`fetch record: ${t.value.objectIDs.length} entries`;try{return console.time(f),(await C.getObjects(t.value.objectIDs)).results}catch(c){let m=h(c);throw new Error(`Failed loading Algolia ${t.value.objectIDs.length} entries from source '${(u=i.source)!=null?u:"default"}' referenced in parameter '${l}': ${m}`)}finally{console.timeEnd(f)}}},limitPolicy:r||p}}function x(e){return e.type===w[0]}function v(e){return!(!e||!e.objectIDs||e.objectIDs.length<1)}var L=Object.freeze(["algoliaQuery"]);function j({clients:e,limitPolicy:r}){if(!e)throw new Error("No Algolia clients were provided to the enhancer. You must provide at least one client via the AlgoliaClientList.");return{enhanceOne:async function({parameter:t,parameterName:l,component:s,context:A}){var u;if(R(t)){if(!b(t.value))return null;let C=y({clients:e,parameterName:l,parameterValue:t.value,component:s,context:A}),i=t.value,f=V(i.count),c=Object.getOwnPropertyNames(i.facetsValues).filter(a=>Array.isArray(i.facetsValues[a])).map(a=>i.facetsValues[a].map(P=>`${a}:${P}`)),m=`fetch query: ${f} entries with '${i.searchText}' query and '${JSON.stringify(c)}' facets`;try{return console.time(m),(await C.search(i.searchText,{facetFilters:c,offset:0,length:f})).hits}catch(a){let P=h(a);throw new Error(`Failed loading Algolia entries with '${i.searchText}' query and '${JSON.stringify(c)}' facets from source '${(u=i.source)!=null?u:"default"}' referenced in parameter '${l}': ${P}`)}finally{console.timeEnd(m)}}},limitPolicy:r||p}}function R(e){return e.type===L[0]}function b(e){return!(!e||!e.source||typeof e.searchText=="undefined"||typeof e.count=="undefined")}function V(e){return!e||e<1?1:e>1e3?1e3:e}var $=class{constructor(r){this._clients={},Array.isArray(r)?r.forEach(n=>this.addClient(n)):r&&this.addClient(r)}addClient({source:r="default",client:n,previewClient:o}){if(this._clients[r])throw new Error(`The source ${r} is always registered`);if(!n)throw new Error("You must provide an Algolia client for the AlgoliaClientList");this._clients[r]={client:n,previewClient:o||n}}getClient({source:r="default",isPreviewClient:n}){let o=this._clients[r];if(!!o)return n?o.previewClient:o.client}};export{$ as AlgoliaClientList,L as CANVAS_ALGOLIA_QUERY_PARAMETER_TYPES,w as CANVAS_ALGOLIA_RECORD_PARAMETER_TYPES,j as createAlgoliaQueryEnhancer,S as createAlgoliaRecordEnhancer}; | ||
import{createLimitPolicy as w}from"@uniformdev/canvas";var p=w({throttle:{limit:55,interval:1e3}});function h(e){return typeof e=="string"?e:typeof e=="object"&&e&&"error"in e?e.error:e instanceof Error?e.toString():JSON.stringify(e,null,2)}function y({clients:e,parameterValue:r,parameterName:n,component:o,context:t}){let{source:l="default"}=r,s=e.getClient({source:l,isPreviewClient:t.preview});if(!s)throw new Error(`No Algolia client could be resolved for source key '${l}' referenced in parameter '${n} in component '${o.type}'. Ensure that the 'clients' property you are passing to the enhancer has a client instance registered for the source key.`);return s}var x=Object.freeze(["algoliaRecord"]);function S({clients:e,limitPolicy:r}){if(!e)throw new Error("No Algolia clients were provided to the enhancer. You must provide at least one client via the AlgoliaClientList.");return{enhanceOne:async function({parameter:t,parameterName:l,component:s,context:A}){var u;if(v(t)){if(!R(t.value))return null;let C=y({clients:e,parameterName:l,parameterValue:t.value,component:s,context:A}),i=t.value,f=`fetch record: ${t.value.objectIDs.length} entries`;try{return console.time(f),(await C.getObjects(t.value.objectIDs)).results}catch(c){let m=h(c);throw new Error(`Failed loading Algolia ${t.value.objectIDs.length} entries from source '${(u=i.source)!=null?u:"default"}' referenced in parameter '${l}': ${m}`)}finally{console.timeEnd(f)}}},limitPolicy:r||p}}function v(e){return e.type===x[0]}function R(e){return!(!e||!e.objectIDs||e.objectIDs.length<1)}var L=Object.freeze(["algoliaQuery"]);function j({clients:e,limitPolicy:r}){if(!e)throw new Error("No Algolia clients were provided to the enhancer. You must provide at least one client via the AlgoliaClientList.");return{enhanceOne:async function({parameter:t,parameterName:l,component:s,context:A}){var u;if(b(t)){if(!V(t.value))return null;let C=y({clients:e,parameterName:l,parameterValue:t.value,component:s,context:A}),i=t.value,f=$(i.count),c=Object.getOwnPropertyNames(i.facetsValues).filter(a=>Array.isArray(i.facetsValues[a])).map(a=>i.facetsValues[a].map(P=>`${a}:${P}`)),m=`fetch query: ${f} entries with '${i.searchText}' query and '${JSON.stringify(c)}' facets`;try{return console.time(m),(await C.search(i.searchText,{facetFilters:c,offset:0,length:f})).hits}catch(a){let P=h(a);throw new Error(`Failed loading Algolia entries with '${i.searchText}' query and '${JSON.stringify(c)}' facets from source '${(u=i.source)!=null?u:"default"}' referenced in parameter '${l}': ${P}`)}finally{console.timeEnd(m)}}},limitPolicy:r||p}}function b(e){return e.type===L[0]}function V(e){return!(!e||!e.source||typeof e.searchText=="undefined"||typeof e.count=="undefined")}function $(e){return!e||e<1?1:e>1e3?1e3:e}var E=class{constructor(r){this._clients={},Array.isArray(r)?r.forEach(n=>this.addClient(n)):r&&this.addClient(r)}addClient({source:r="default",client:n,previewClient:o}){if(this._clients[r])throw new Error(`The source ${r} is always registered`);if(!n)throw new Error("You must provide an Algolia client for the AlgoliaClientList");this._clients[r]={client:n,previewClient:o||n}}getClient({source:r="default",isPreviewClient:n}){let o=this._clients[r];if(!!o)return n?o.previewClient:o.client}};export{E as AlgoliaClientList,L as CANVAS_ALGOLIA_QUERY_PARAMETER_TYPES,x as CANVAS_ALGOLIA_RECORD_PARAMETER_TYPES,j as createAlgoliaQueryEnhancer,S as createAlgoliaRecordEnhancer}; |
@@ -1,1 +0,1 @@ | ||
var P=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var V=e=>P(e,"__esModule",{value:!0});var $=(e,r)=>{for(var t in r)P(e,t,{get:r[t],enumerable:!0})},I=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of R(r))!b.call(e,n)&&(t||n!=="default")&&P(e,n,{get:()=>r[n],enumerable:!(i=L(r,n))||i.enumerable});return e};var O=(e=>(r,t)=>e&&e.get(r)||(t=I(V({}),r,1),e&&e.set(r,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var D={};$(D,{AlgoliaClientList:()=>v,CANVAS_ALGOLIA_QUERY_PARAMETER_TYPES:()=>x,CANVAS_ALGOLIA_RECORD_PARAMETER_TYPES:()=>w,createAlgoliaQueryEnhancer:()=>S,createAlgoliaRecordEnhancer:()=>F});var E=require("@uniformdev/canvas"),d=(0,E.createLimitPolicy)({throttle:{limit:55,interval:1e3}});function p(e){return typeof e=="string"?e:typeof e=="object"&&e&&"error"in e?e.error:e instanceof Error?e.toString():JSON.stringify(e,null,2)}function h({clients:e,parameterValue:r,parameterName:t,component:i,context:n}){let{source:l="default"}=r,s=e.getClient({source:l,isPreviewClient:n.preview});if(!s)throw new Error(`No Algolia client could be resolved for source key '${l}' referenced in parameter '${t} in component '${i.type}'. Ensure that the 'clients' property you are passing to the enhancer has a client instance registered for the source key.`);return s}var w=Object.freeze(["algoliaRecord"]);function F({clients:e,limitPolicy:r}){if(!e)throw new Error("No Algolia clients were provided to the enhancer. You must provide at least one client via the AlgoliaClientList.");return{enhanceOne:async function({parameter:n,parameterName:l,component:s,context:y}){var u;if(N(n)){if(!Q(n.value))return null;let A=h({clients:e,parameterName:l,parameterValue:n.value,component:s,context:y}),o=n.value,f=`fetch record: ${n.value.objectIDs.length} entries`;try{return console.time(f),(await A.getObjects(n.value.objectIDs)).results}catch(c){let m=p(c);throw new Error(`Failed loading Algolia ${n.value.objectIDs.length} entries from source '${(u=o.source)!=null?u:"default"}' referenced in parameter '${l}': ${m}`)}finally{console.timeEnd(f)}}},limitPolicy:r||d}}function N(e){return e.type===w[0]}function Q(e){return!(!e||!e.objectIDs||e.objectIDs.length<1)}var x=Object.freeze(["algoliaQuery"]);function S({clients:e,limitPolicy:r}){if(!e)throw new Error("No Algolia clients were provided to the enhancer. You must provide at least one client via the AlgoliaClientList.");return{enhanceOne:async function({parameter:n,parameterName:l,component:s,context:y}){var u;if(T(n)){if(!_(n.value))return null;let A=h({clients:e,parameterName:l,parameterValue:n.value,component:s,context:y}),o=n.value,f=j(o.count),c=Object.getOwnPropertyNames(o.facetsValues).filter(a=>Array.isArray(o.facetsValues[a])).map(a=>o.facetsValues[a].map(C=>`${a}:${C}`)),m=`fetch query: ${f} entries with '${o.searchText}' query and '${JSON.stringify(c)}' facets`;try{return console.time(m),(await A.search(o.searchText,{facetFilters:c,offset:0,length:f})).hits}catch(a){let C=p(a);throw new Error(`Failed loading Algolia entries with '${o.searchText}' query and '${JSON.stringify(c)}' facets from source '${(u=o.source)!=null?u:"default"}' referenced in parameter '${l}': ${C}`)}finally{console.timeEnd(m)}}},limitPolicy:r||d}}function T(e){return e.type===x[0]}function _(e){return!(!e||!e.source||typeof e.searchText=="undefined"||typeof e.count=="undefined")}function j(e){return!e||e<1?1:e>1e3?1e3:e}var v=class{constructor(r){this._clients={},Array.isArray(r)?r.forEach(t=>this.addClient(t)):r&&this.addClient(r)}addClient({source:r="default",client:t,previewClient:i}){if(this._clients[r])throw new Error(`The source ${r} is always registered`);if(!t)throw new Error("You must provide an Algolia client for the AlgoliaClientList");this._clients[r]={client:t,previewClient:i||t}}getClient({source:r="default",isPreviewClient:t}){let i=this._clients[r];if(!!i)return t?i.previewClient:i.client}};module.exports=O(D);0&&(module.exports={AlgoliaClientList,CANVAS_ALGOLIA_QUERY_PARAMETER_TYPES,CANVAS_ALGOLIA_RECORD_PARAMETER_TYPES,createAlgoliaQueryEnhancer,createAlgoliaRecordEnhancer}); | ||
var P=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var V=(e,r)=>{for(var n in r)P(e,n,{get:r[n],enumerable:!0})},$=(e,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of L(r))!b.call(e,t)&&t!==n&&P(e,t,{get:()=>r[t],enumerable:!(i=R(r,t))||i.enumerable});return e};var I=e=>$(P({},"__esModule",{value:!0}),e);var j={};V(j,{AlgoliaClientList:()=>E,CANVAS_ALGOLIA_QUERY_PARAMETER_TYPES:()=>v,CANVAS_ALGOLIA_RECORD_PARAMETER_TYPES:()=>x,createAlgoliaQueryEnhancer:()=>Q,createAlgoliaRecordEnhancer:()=>O});module.exports=I(j);var w=require("@uniformdev/canvas"),d=(0,w.createLimitPolicy)({throttle:{limit:55,interval:1e3}});function p(e){return typeof e=="string"?e:typeof e=="object"&&e&&"error"in e?e.error:e instanceof Error?e.toString():JSON.stringify(e,null,2)}function h({clients:e,parameterValue:r,parameterName:n,component:i,context:t}){let{source:l="default"}=r,s=e.getClient({source:l,isPreviewClient:t.preview});if(!s)throw new Error(`No Algolia client could be resolved for source key '${l}' referenced in parameter '${n} in component '${i.type}'. Ensure that the 'clients' property you are passing to the enhancer has a client instance registered for the source key.`);return s}var x=Object.freeze(["algoliaRecord"]);function O({clients:e,limitPolicy:r}){if(!e)throw new Error("No Algolia clients were provided to the enhancer. You must provide at least one client via the AlgoliaClientList.");return{enhanceOne:async function({parameter:t,parameterName:l,component:s,context:y}){var u;if(F(t)){if(!N(t.value))return null;let A=h({clients:e,parameterName:l,parameterValue:t.value,component:s,context:y}),o=t.value,f=`fetch record: ${t.value.objectIDs.length} entries`;try{return console.time(f),(await A.getObjects(t.value.objectIDs)).results}catch(c){let m=p(c);throw new Error(`Failed loading Algolia ${t.value.objectIDs.length} entries from source '${(u=o.source)!=null?u:"default"}' referenced in parameter '${l}': ${m}`)}finally{console.timeEnd(f)}}},limitPolicy:r||d}}function F(e){return e.type===x[0]}function N(e){return!(!e||!e.objectIDs||e.objectIDs.length<1)}var v=Object.freeze(["algoliaQuery"]);function Q({clients:e,limitPolicy:r}){if(!e)throw new Error("No Algolia clients were provided to the enhancer. You must provide at least one client via the AlgoliaClientList.");return{enhanceOne:async function({parameter:t,parameterName:l,component:s,context:y}){var u;if(S(t)){if(!T(t.value))return null;let A=h({clients:e,parameterName:l,parameterValue:t.value,component:s,context:y}),o=t.value,f=_(o.count),c=Object.getOwnPropertyNames(o.facetsValues).filter(a=>Array.isArray(o.facetsValues[a])).map(a=>o.facetsValues[a].map(C=>`${a}:${C}`)),m=`fetch query: ${f} entries with '${o.searchText}' query and '${JSON.stringify(c)}' facets`;try{return console.time(m),(await A.search(o.searchText,{facetFilters:c,offset:0,length:f})).hits}catch(a){let C=p(a);throw new Error(`Failed loading Algolia entries with '${o.searchText}' query and '${JSON.stringify(c)}' facets from source '${(u=o.source)!=null?u:"default"}' referenced in parameter '${l}': ${C}`)}finally{console.timeEnd(m)}}},limitPolicy:r||d}}function S(e){return e.type===v[0]}function T(e){return!(!e||!e.source||typeof e.searchText=="undefined"||typeof e.count=="undefined")}function _(e){return!e||e<1?1:e>1e3?1e3:e}var E=class{constructor(r){this._clients={},Array.isArray(r)?r.forEach(n=>this.addClient(n)):r&&this.addClient(r)}addClient({source:r="default",client:n,previewClient:i}){if(this._clients[r])throw new Error(`The source ${r} is always registered`);if(!n)throw new Error("You must provide an Algolia client for the AlgoliaClientList");this._clients[r]={client:n,previewClient:i||n}}getClient({source:r="default",isPreviewClient:n}){let i=this._clients[r];if(!!i)return n?i.previewClient:i.client}};0&&(module.exports={AlgoliaClientList,CANVAS_ALGOLIA_QUERY_PARAMETER_TYPES,CANVAS_ALGOLIA_RECORD_PARAMETER_TYPES,createAlgoliaQueryEnhancer,createAlgoliaRecordEnhancer}); |
{ | ||
"name": "@uniformdev/canvas-algolia", | ||
"version": "13.0.1-alpha.133+5e32ce3cd", | ||
"version": "13.0.1-alpha.271+7307a0d06", | ||
"description": "Algolia data enhancers for Uniform Canvas", | ||
@@ -26,3 +26,3 @@ "license": "SEE LICENSE IN LICENSE.txt", | ||
"dependencies": { | ||
"@uniformdev/canvas": "^13.0.1-alpha.133+5e32ce3cd" | ||
"@uniformdev/canvas": "^13.0.1-alpha.271+7307a0d06" | ||
}, | ||
@@ -41,3 +41,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "5e32ce3cd962560af97708369bf4c4c91a0116d1" | ||
"gitHead": "7307a0d061e09506ffeb6a72798a986f0ea2da2c" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
15708