Table SDK
The eidos.space.table() method provides a Prisma-style API for CRUD (Create, Read, Update, Delete) operations on tables. This is the recommended way to interact with table data.
Basic Usage
Section titled “Basic Usage”// Get a table client (tableId is a UUIDv7 without dashes)const Users = eidos.space.table("01935b4c9d2e7f8a0b1c2d3e4f5a6b7c")
// CRUD operationsawait Users.create({ data: { name: "John Doe", age: 25 } })await Users.findMany({ where: { age: { gte: 18 } } })create(args)
Section titled “create(args)”Create a single record. Auto-generates _id if not provided.
async create(args: { data: Record<string, any>}): Promise<Record<string, any> & { _id: string }>createMany(args)
Section titled “createMany(args)”Batch create multiple records.
async createMany(args: { data: Record<string, any>[] skipDuplicates?: boolean}): Promise<{ count: number }>findUnique(args)
Section titled “findUnique(args)”Find a single record by _id.
async findUnique(args: { where: { _id: string }}): Promise<Record<string, any> | null>findFirst(args)
Section titled “findFirst(args)”Find the first matching record.
async findFirst(args: { where?: Record<string, any> orderBy?: Record<string, 'asc' | 'desc'>}): Promise<Record<string, any> | null>findMany(args)
Section titled “findMany(args)”Query multiple records with filtering, sorting, and pagination.
async findMany(args?: { where?: Record<string, any> orderBy?: Record<string, 'asc' | 'desc'> skip?: number take?: number select?: Record<string, boolean>}): Promise<Record<string, any>[]>Where Clause Operators:
| Operator | Description | Example |
|---|---|---|
equals | Exact match | { name: { equals: "John" } } |
not | Not equal | { status: { not: "deleted" } } |
gt | Greater than | { age: { gt: 18 } } |
gte | Greater than or equal | { age: { gte: 18 } } |
lt | Less than | { age: { lt: 65 } } |
lte | Less than or equal | { age: { lte: 65 } } |
contains | Contains substring | { name: { contains: "Jo" } } |
startsWith | Starts with | { email: { startsWith: "admin" } } |
endsWith | Ends with | { email: { endsWith: "@gmail.com" } } |
in | In array | { status: { in: ["active", "pending"] } } |
notIn | Not in array | { status: { notIn: ["deleted"] } } |
count(args)
Section titled “count(args)”Count matching records.
async count(args?: { where?: Record<string, any>}): Promise<number>update(args)
Section titled “update(args)”Update a single record by _id.
async update(args: { where: { _id: string } data: Record<string, any>}): Promise<Record<string, any> | null>updateMany(args)
Section titled “updateMany(args)”Batch update multiple records matching criteria.
async updateMany(args: { where: Record<string, any> data: Record<string, any>}): Promise<{ count: number }>delete(args)
Section titled “delete(args)”Delete a single record by _id.
async delete(args: { where: { _id: string }}): Promise<Record<string, any> | null>deleteMany(args)
Section titled “deleteMany(args)”Batch delete multiple records matching criteria.
async deleteMany(args?: { where?: Record<string, any>}): Promise<{ count: number }>