Skip to content

Schema SDK

The eidos.space.schema object provides methods for managing the lifecycle of tables, fields, and views.

Create a new table with specified fields.

async createTable(input: CreateTableInput): Promise<TableInfo>

Example:

const table = await eidos.space.schema.createTable({
name: "Tasks",
fields: [
{ name: "Priority", columnName: "priority", type: "select", property: {
options: [{ name: "High", color: "red" }, { name: "Low", color: "blue" }]
}},
{ name: "Deadline", columnName: "deadline", type: "date" }
]
})
console.log("Created table ID:", table.id)

Get detailed information about a specific table.

async getTable(tableId: string): Promise<TableInfo>

Example:

const tableInfo = await eidos.space.schema.getTable("table_id_here")
console.log(`Table ${tableInfo.name} has ${tableInfo.fields.length} fields.`)

List all tables in the current space.

async listTables(): Promise<TableListItem[]>

Example:

const tables = await eidos.space.schema.listTables()
tables.forEach(t => console.log(`${t.name} (${t.id})`))

Update table metadata (e.g., rename).

async updateTable(tableId: string, input: UpdateTableInput): Promise<TableInfo>

Example:

await eidos.space.schema.updateTable("table_id", { name: "New Name" })

Permanently delete a table.

async deleteTable(tableId: string): Promise<boolean>

Add a new field to an existing table.

async addField(tableId: string, input: CreateFieldInput): Promise<FieldInfo>

Example:

await eidos.space.schema.addField("table_id", {
name: "New Field",
columnName: "new_field",
type: "text"
})

Update field metadata.

async updateField(tableId: string, columnName: string, input: UpdateFieldInput): Promise<FieldInfo>

Example:

await eidos.space.schema.updateField("table_id", "priority", {
name: "Task Priority"
})

Delete a field from a table.

async deleteField(tableId: string, columnName: string): Promise<boolean>

Create a new view for a table.

async createView(tableId: string, input: CreateViewInput): Promise<ViewInfo>

Example:

await eidos.space.schema.createView("table_id", {
name: "My Kanban",
type: "kanban"
})

List all views for a table.

async listViews(tableId: string): Promise<ViewInfo[]>

Delete a view.

async deleteView(tableId: string, viewId: string): Promise<boolean>