Update algoliasearch to the latest version � (#772)

Summary:
## The dependency [algoliasearch]() was updated from `3.35.1` to `4.0.0`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

 ---

**Publisher:** [nunomaduro](https://www.npmjs.com/~nunomaduro)
**License:** MIT

[Find out more about this release]().

 ---

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

 ---

Your [Greenkeeper](https://greenkeeper.io) bot 🌴
Pull Request resolved: https://github.com/facebook/flipper/pull/772

Test Plan: Manually tested searching and installing still works.

Reviewed By: jknoxville

Differential Revision: D19690706

Pulled By: passy

fbshipit-source-id: 46cb05fb2c0429c4a1f7fb31a833cd000805825d
This commit is contained in:
greenkeeper[bot]
2020-02-03 14:52:53 -08:00
committed by Facebook Github Bot
parent 96208910ea
commit e48966f529
4 changed files with 134 additions and 95 deletions

View File

@@ -27,7 +27,8 @@ import {
} from 'flipper';
import React, {useCallback, useState, useMemo, useEffect} from 'react';
import {List} from 'immutable';
import algoliasearch from 'algoliasearch';
import {SearchIndex} from 'algoliasearch';
import {SearchResponse} from '@algolia/client-search';
import path from 'path';
import fs from 'fs-extra';
import {reportPlatformFailures, reportUsage} from '../utils/metrics';
@@ -105,7 +106,7 @@ type DispatchFromProps = {
};
type OwnProps = {
searchIndexFactory: () => algoliasearch.Index;
searchIndexFactory: () => SearchIndex;
autoHeight: boolean;
findPluginUpdates: (
currentPlugins: PluginMap,
@@ -353,7 +354,7 @@ function useNPMSearch(
setRestartRequired: (restart: boolean) => void,
query: string,
setQuery: (query: string) => void,
searchClientFactory: () => algoliasearch.Index,
searchClientFactory: () => SearchIndex,
installedPlugins: Map<string, PluginDefinition>,
refreshInstalledPlugins: () => void,
findPluginUpdates: (
@@ -419,11 +420,11 @@ function useNPMSearch(
useEffect(() => {
(async () => {
const {hits} = await reportPlatformFailures(
index.search({
index.search<PluginDefinition>('', {
query,
filters: 'keywords:flipper-plugin',
hitsPerPage: 20,
}),
}) as Promise<SearchResponse<PluginDefinition>>,
`${TAG}:queryIndex`,
);

View File

@@ -12,7 +12,7 @@ import fs from 'fs-extra';
import {homedir} from 'os';
import {PluginMap, PluginDefinition} from '../reducers/pluginManager';
import {PluginManager as PM} from 'live-plugin-manager';
import algoliasearch from 'algoliasearch';
import {default as algoliasearch, SearchIndex} from 'algoliasearch';
import NpmApi, {Package} from 'npm-api';
import semver from 'semver';
@@ -28,7 +28,7 @@ export function providePluginManager(): PM {
}
// TODO(T57014856): This should be private, too.
export function provideSearchIndex(): algoliasearch.Index {
export function provideSearchIndex(): SearchIndex {
const client = algoliasearch(ALGOLIA_APPLICATION_ID, ALGOLIA_API_KEY);
return client.initIndex('npm-search');
}