UNPKG

@n8n/n8n-nodes-langchain

Version:

![Banner image](https://user-images.githubusercontent.com/10284570/173569848-c624317f-42b1-45a6-ab09-f0ea3c247648.png)

82 lines 3.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.pineconeIndexSearch = pineconeIndexSearch; exports.supabaseTableNameSearch = supabaseTableNameSearch; exports.qdrantCollectionsSearch = qdrantCollectionsSearch; exports.milvusCollectionsSearch = milvusCollectionsSearch; exports.weaviateCollectionsSearch = weaviateCollectionsSearch; const pinecone_1 = require("@pinecone-database/pinecone"); const milvus2_sdk_node_1 = require("@zilliz/milvus2-sdk-node"); const n8n_workflow_1 = require("n8n-workflow"); const Qdrant_utils_1 = require("../../VectorStoreQdrant/Qdrant.utils"); const Weaviate_utils_1 = require("../../VectorStoreWeaviate/Weaviate.utils"); async function pineconeIndexSearch() { const credentials = await this.getCredentials('pineconeApi'); const client = new pinecone_1.Pinecone({ apiKey: credentials.apiKey, }); const indexes = await client.listIndexes(); const results = (indexes.indexes ?? []).map((index) => ({ name: index.name, value: index.name, })); return { results }; } async function supabaseTableNameSearch() { const credentials = await this.getCredentials('supabaseApi'); const results = []; if (typeof credentials.host !== 'string') { throw new n8n_workflow_1.ApplicationError('Expected Supabase credentials host to be a string'); } const { paths } = (await this.helpers.requestWithAuthentication.call(this, 'supabaseApi', { headers: { Prefer: 'return=representation', }, method: 'GET', uri: `${credentials.host}/rest/v1/`, json: true, })); for (const path of Object.keys(paths)) { if (path === '/') continue; results.push({ name: path.replace('/', ''), value: path.replace('/', ''), }); } return { results }; } async function qdrantCollectionsSearch() { const credentials = await this.getCredentials('qdrantApi'); const client = (0, Qdrant_utils_1.createQdrantClient)(credentials); const response = await client.getCollections(); const results = response.collections.map((collection) => ({ name: collection.name, value: collection.name, })); return { results }; } async function milvusCollectionsSearch() { const credentials = await this.getCredentials('milvusApi'); const client = new milvus2_sdk_node_1.MilvusClient({ address: credentials.baseUrl, token: `${credentials.username}:${credentials.password}`, }); const response = await client.listCollections(); const results = response.data.map((collection) => ({ name: collection.name, value: collection.name, })); return { results }; } async function weaviateCollectionsSearch() { const credentials = await this.getCredentials('weaviateApi'); const client = await (0, Weaviate_utils_1.createWeaviateClient)(credentials); const collections = await client.collections.listAll(); const results = collections.map((collection) => ({ name: collection.name, value: collection.name, })); return { results }; } //# sourceMappingURL=listSearch.js.map