Skip to content

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.

// Get a table client (tableId is a UUIDv7 without dashes)
const Users = eidos.space.table("01935b4c9d2e7f8a0b1c2d3e4f5a6b7c")
// CRUD operations
await Users.create({ data: { name: "John Doe", age: 25 } })
await Users.findMany({ where: { age: { gte: 18 } } })

Create a single record. Auto-generates _id if not provided.

async create(args: {
data: Record<string, any>
}): Promise<Record<string, any> & { _id: string }>

Batch create multiple records.

async createMany(args: {
data: Record<string, any>[]
skipDuplicates?: boolean
}): Promise<{ count: number }>

Find a single record by _id.

async findUnique(args: {
where: { _id: string }
}): Promise<Record<string, any> | null>

Find the first matching record.

async findFirst(args: {
where?: Record<string, any>
orderBy?: Record<string, 'asc' | 'desc'>
}): Promise<Record<string, any> | null>

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:

OperatorDescriptionExample
equalsExact match{ name: { equals: "John" } }
notNot equal{ status: { not: "deleted" } }
gtGreater than{ age: { gt: 18 } }
gteGreater than or equal{ age: { gte: 18 } }
ltLess than{ age: { lt: 65 } }
lteLess than or equal{ age: { lte: 65 } }
containsContains substring{ name: { contains: "Jo" } }
startsWithStarts with{ email: { startsWith: "admin" } }
endsWithEnds with{ email: { endsWith: "@gmail.com" } }
inIn array{ status: { in: ["active", "pending"] } }
notInNot in array{ status: { notIn: ["deleted"] } }

Count matching records.

async count(args?: {
where?: Record<string, any>
}): Promise<number>

Update a single record by _id.

async update(args: {
where: { _id: string }
data: Record<string, any>
}): Promise<Record<string, any> | null>

Batch update multiple records matching criteria.

async updateMany(args: {
where: Record<string, any>
data: Record<string, any>
}): Promise<{ count: number }>

Delete a single record by _id.

async delete(args: {
where: { _id: string }
}): Promise<Record<string, any> | null>

Batch delete multiple records matching criteria.

async deleteMany(args?: {
where?: Record<string, any>
}): Promise<{ count: number }>