1.1.4 • Published 5 months ago
lighthouse-private-markets-sdk v1.1.4
Lighthouse JS SDK
Lighthouse is an AI-powered platform that automates the entire venture capital deal flow cycle—from sourcing to due diligence. Our platform empowers investors with real-time insights and seamless workflows, helping VCs identify and evaluate high-potential startups more efficiently. Visit us at https://trylighthouse.vc to learn more.
Installation
Using npm:
npm i lighthouse-private-markets-sdk
Using yarn:
yarn add lighthouse-private-markets-sdk
Quick Start
JavaScript (CommonJS)
const { Lighthouse } = require('lighthouse-private-markets-sdk');
// Initialize the client
const lighthouse = new Lighthouse('your-api-key');
// Simple query example
async function getStartups() {
try {
const { data, error } = await lighthouse
.from('startups')
.select('*')
.limit(10);
if (error) throw error;
console.log('Startups:', data);
} catch (err) {
console.error('Error:', err.message);
}
}
JavaScript (ES Modules)
import { Lighthouse } from 'lighthouse-private-markets-sdk';
// Initialize the client
const lighthouse = new Lighthouse('your-api-key');
// Using async/await with try/catch
async function getStartup() {
try {
const { data, error } = await lighthouse
.from('startups')
.select('name, valuation, founded_date')
.eq('id', 123)
.single();
if (error) throw error;
console.log('Startup:', data);
} catch (err) {
console.error('Error:', err.message);
}
}
Common Query Examples
Select Single Record
// Get a specific startup
const { data, error } = await lighthouse
.from('startups')
.select('*')
.eq('id', 123)
.single();
Filter Records
// Get all startups valued over $1M
const { data, error } = await lighthouse
.from('startups')
.select('name, valuation')
.gte('valuation', 1000000)
.order('valuation', { ascending: false });
Select with Relationships
// Get startups with their founders
const { data, error } = await lighthouse
.from('startups')
.select('name, founders (name, role)');
Pagination
// Get 10 records with offset
const { data, error } = await lighthouse
.from('startups')
.select('*')
.range(0, 9);
Full Text Search
// Search startups by name
const { data, error } = await lighthouse
.from('startups')
.select('*')
.textSearch('name', 'tech');
Available Methods
Basic Filters
select(*columns: str)
: Choose specific fields to returnsingle()
: Request a single recordeq(column: str, value: Any)
: Equal to filterneq(column: str, value: Any)
: Not equal to filtergt(column: str, value: Any)
: Greater than filterlt(column: str, value: Any)
: Less than filtergte(column: str, value: Any)
: Greater than or equal to filterlte(column: str, value: Any)
: Less than or equal to filteris(column: str, value: Any)
: 'IS' filterin(column: str, values: Array<Any>)
: 'IN' filter for array of values
Text Search
like(column: str, pattern: str)
: Pattern matching (case sensitive)ilike(column: str, pattern: str)
: Pattern matching (case insensitive)textSearch(column: str, query: str)
: Full text search
Array/JSON Operations
contains(column: str, value: Array<Any> | string | Object)
: Check if array/json contains valuecontainedBy(column: str, value: Array<Any> | string | Object)
: Check if contained by valueoverlaps(column: str, values: Array<Any>)
: Overlaps with values
Result Modification
order(column: str, options: { ascending: boolean })
: Sort resultslimit(size: number)
: Limit number of rowsrange(start: number, end: number)
: Get a range of rowsoffset(size: number)
: Set the starting row index
Logical Operations
not()
: Negate the next filteror(filters: string)
: OR conditionmatch(query: Object)
: Match multiple columnsfilter(column: str, operator: str, value: Any)
: Apply a custom filter
Output Format
csv()
: Return results as CSVexplain()
: Get query explanation
Error Handling
const { data, error } = await lighthouse
.from('startups')
.select('*');
if (error) {
console.error('Error:', error);
}
// Process your data
console.log(data);