New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

apollo-link-algolia

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-link-algolia - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

package.json
{
"name": "apollo-link-algolia",
"version": "0.0.1",
"version": "0.0.2",
"description": "Query Algoila with Apollo",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -1,6 +0,24 @@

# This is heavly work in progress!
## Apollo-link-algolia
apollo-link-algolia provides you a simple way to query Algolia in graphQL with [Apollo-client](https://www.apollographql.com/client/) **without building a graphQL server**
**This is heavly work in progress!**
### Example
apollo-link-algolia provides you a simple way to query Algolia in graphQL with [apollo-client](https://www.apollographql.com/client/) **without building a graphQL server**.
Currently, we support features below:
1. **Query parameters**: list of supported parametes can be checked [here](https://github.com/algolia/algoliasearch-helper-js#query-parameters).
## Contents
* [Installation](#installation)
* [Example](#example)
## Installation
``` shell
npm i apollo-link-algolia --save
```
or
``` shell
yarn add apollo-link-algolia -P
```
## Example
```js

@@ -7,0 +25,0 @@ const LOCATIONS_QUERY = gql`

@@ -7,2 +7,38 @@ import algoliasearchHelper from 'algoliasearch-helper'

const parameters = [
'advancedSyntax',
'allowTyposOnNumericTokens',
'analytics',
'analyticsTags',
'aroundLatLng',
'aroundLatLngViaIP',
'aroundPrecision',
'aroundRadius',
'attributesToHighlight',
'attributesToRetrieve',
'attributesToSnippet',
'disjunctiveFacets',
'distinct',
'facets',
'getRankingInfo',
'hitsPerPage',
'ignorePlurals',
'insideBoundingBox',
'insidePolygon',
'maxValuesPerFacet',
'minimumAroundRadius',
'minWordSizefor1Typo',
'minWordSizefor2Typos',
'optionalWords',
'page',
'query',
'queryType',
'removeWordsIfNoResults',
'replaceSynonymsInHighlight',
'restrictSearchableAttributes',
'synonyms',
'tagFilters',
'typoTolerance'
]
const resolver = (fieldName, root, args, context, info) => {

@@ -12,3 +48,3 @@ const { directives } = info

if (!directives.algolia.index) {
throw new Error('Algolia index name is required');
throw new Error('Algolia index name is required')
}

@@ -18,14 +54,8 @@

if (directives.algolia.query) {
helper.setQuery(directives.algolia.query)
}
parameters.forEach(parameter => {
if (parameter in directives.algolia) {
helper.setQueryParameter(parameter, directives.algolia[parameter])
}
})
if (directives.algolia.aroundLatLng) {
helper.setQueryParameter('aroundLatLng', directives.algolia.aroundLatLng)
}
if (directives.algolia.aroundRadius) {
helper.setQueryParameter('aroundRadius', directives.algolia.aroundRadius)
}
return helper.searchOnce()

@@ -53,4 +83,2 @@ }

console.log(operation)
return new Observable(observer => {

@@ -57,0 +85,0 @@ graphql(

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