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

@uniformdev/canvas-algolia

Package Overview
Dependencies
Maintainers
10
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uniformdev/canvas-algolia - npm Package Compare versions

Comparing version 16.0.1-nuxt.166 to 16.0.1-nuxt.179

2

dist/index.esm.js

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

"use strict";import{createLimitPolicy as P}from"@uniformdev/canvas";var g=P({throttle:{limit:55,interval:1e3}});function d(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 p({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 E=Object.freeze(["algoliaRecord"]);function N({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:h}){var u;if(w(t)){if(!x(t.value))return null;let y=p({clients:e,parameterName:l,parameterValue:t.value,component:s,context:h}),i=t.value,f=`fetch record: ${t.value.objectIDs.length} entries`;try{return console.time(f),(await y.getObjects(t.value.objectIDs)).results}catch(c){let m=d(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||g}}function w(e){return e.type===E[0]}function x(e){return!(!e||!e.objectIDs||e.objectIDs.length<1)}var v=Object.freeze(["algoliaQuery"]);function T({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:h}){var u;if(R(t)){if(!L(t.value))return null;let y=p({clients:e,parameterName:l,parameterValue:t.value,component:s,context:h}),i=t.value,f=b(i.count),c=Object.getOwnPropertyNames(i.facetsValues).filter(a=>Array.isArray(i.facetsValues[a])).map(a=>i.facetsValues[a].map(A=>`${a}:${A}`)),m=`fetch query: ${f} entries with '${i.searchText}' query and '${JSON.stringify(c)}' facets`;try{return console.time(m),(await y.search(i.searchText,{facetFilters:c,offset:0,length:f})).hits}catch(a){let A=d(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}': ${A}`)}finally{console.timeEnd(m)}}},limitPolicy:r||g}}function R(e){return e.type===v[0]}function L(e){return!(!e||!e.source||typeof e.searchText=="undefined"||typeof e.count=="undefined")}function b(e){return!e||e<1?1:e>1e3?1e3:e}var C=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{C as AlgoliaClientList,v as CANVAS_ALGOLIA_QUERY_PARAMETER_TYPES,E as CANVAS_ALGOLIA_RECORD_PARAMETER_TYPES,T as createAlgoliaQueryEnhancer,N as createAlgoliaRecordEnhancer};
import{createLimitPolicy as P}from"@uniformdev/canvas";var g=P({throttle:{limit:55,interval:1e3}});function d(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 p({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 E=Object.freeze(["algoliaRecord"]);function N({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:h}){var u;if(w(t)){if(!x(t.value))return null;let y=p({clients:e,parameterName:l,parameterValue:t.value,component:s,context:h}),i=t.value,f=`fetch record: ${t.value.objectIDs.length} entries`;try{return console.time(f),(await y.getObjects(t.value.objectIDs)).results}catch(c){let m=d(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||g}}function w(e){return e.type===E[0]}function x(e){return!(!e||!e.objectIDs||e.objectIDs.length<1)}var v=Object.freeze(["algoliaQuery"]);function T({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:h}){var u;if(R(t)){if(!L(t.value))return null;let y=p({clients:e,parameterName:l,parameterValue:t.value,component:s,context:h}),i=t.value,f=b(i.count),c=Object.getOwnPropertyNames(i.facetsValues).filter(a=>Array.isArray(i.facetsValues[a])).map(a=>i.facetsValues[a].map(A=>`${a}:${A}`)),m=`fetch query: ${f} entries with '${i.searchText}' query and '${JSON.stringify(c)}' facets`;try{return console.time(m),(await y.search(i.searchText,{facetFilters:c,offset:0,length:f})).hits}catch(a){let A=d(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}': ${A}`)}finally{console.timeEnd(m)}}},limitPolicy:r||g}}function R(e){return e.type===v[0]}function L(e){return!(!e||!e.source||typeof e.searchText=="undefined"||typeof e.count=="undefined")}function b(e){return!e||e<1?1:e>1e3?1e3:e}var C=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{C as AlgoliaClientList,v as CANVAS_ALGOLIA_QUERY_PARAMETER_TYPES,E as CANVAS_ALGOLIA_RECORD_PARAMETER_TYPES,T as createAlgoliaQueryEnhancer,N as createAlgoliaRecordEnhancer};
{
"name": "@uniformdev/canvas-algolia",
"version": "16.0.1-nuxt.166+ce56da6c5",
"version": "16.0.1-nuxt.179+842199728",
"description": "Algolia data enhancers for Uniform Canvas",

@@ -26,3 +26,3 @@ "license": "SEE LICENSE IN LICENSE.txt",

"dependencies": {
"@uniformdev/canvas": "^16.0.1-nuxt.166+ce56da6c5"
"@uniformdev/canvas": "^16.0.1-nuxt.179+842199728"
},

@@ -41,3 +41,3 @@ "peerDependencies": {

},
"gitHead": "ce56da6c5608c89d33524abf60993a68855afcd2"
"gitHead": "842199728b5d454c2ca7e82ef7d1fd208f835c4e"
}

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