Rename second batch for '.ts' files to '.tsx' in plugin-lib dir

Summary: Rename first batch for '.ts' files to '.tsx'

Reviewed By: passy

Differential Revision: D33843245

fbshipit-source-id: 28fd161e258e4d20200620b083aea48f9e58ea64
This commit is contained in:
Anton Kastritskiy
2022-01-31 06:07:21 -08:00
committed by Facebook GitHub Bot
parent 75f874a5dd
commit 69bac4a3d6
11 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import {default as algoliasearch, SearchIndex} from 'algoliasearch';
const ALGOLIA_APPLICATION_ID = 'OFCNCOG2CU';
const ALGOLIA_API_KEY = 'f54e21fa3a2a0160595bb058179bfb1e';
function provideSearchIndex(): SearchIndex {
const client = algoliasearch(ALGOLIA_APPLICATION_ID, ALGOLIA_API_KEY);
return client.initIndex('npm-search');
}
export type NpmPackageDescriptor = {
name: string;
version: string;
};
export type NpmHostedPluginsSearchArgs = {
query?: string;
};
export async function getNpmHostedPlugins(
args: NpmHostedPluginsSearchArgs = {},
): Promise<readonly NpmPackageDescriptor[]> {
const index = provideSearchIndex();
args = Object.assign(
{
query: '',
filters: 'keywords:flipper-plugin',
hitsPerPage: 50,
},
args,
);
const {hits} = await index.search<NpmPackageDescriptor>(
args.query || '',
args,
);
return hits;
}