flipper-plugin-lib
Version:
Library containing common Flipper plugin installation utilities
33 lines • 1.2 kB
JavaScript
;
/**
* 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
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNpmHostedPlugins = void 0;
const algoliasearch_1 = __importDefault(require("algoliasearch"));
const ALGOLIA_APPLICATION_ID = 'OFCNCOG2CU';
const ALGOLIA_API_KEY = 'f54e21fa3a2a0160595bb058179bfb1e';
function provideSearchIndex() {
const client = (0, algoliasearch_1.default)(ALGOLIA_APPLICATION_ID, ALGOLIA_API_KEY);
return client.initIndex('npm-search');
}
async function getNpmHostedPlugins(args = {}) {
const index = provideSearchIndex();
args = Object.assign({
query: '',
filters: 'keywords:flipper-plugin',
hitsPerPage: 50,
}, args);
const { hits } = await index.search(args.query || '', args);
return hits;
}
exports.getNpmHostedPlugins = getNpmHostedPlugins;
//# sourceMappingURL=getNpmHostedPlugins.js.map