Schema SDK
The eidos.space.schema object provides methods for managing the lifecycle of tables, fields, and views.
Table Operations
Section titled “Table Operations”createTable(input)
Section titled “createTable(input)”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)getTable(tableId)
Section titled “getTable(tableId)”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.`)listTables()
Section titled “listTables()”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})`))updateTable(tableId, input)
Section titled “updateTable(tableId, input)”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" })deleteTable(tableId)
Section titled “deleteTable(tableId)”Permanently delete a table.
async deleteTable(tableId: string): Promise<boolean>Field Operations
Section titled “Field Operations”addField(tableId, input)
Section titled “addField(tableId, input)”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"})updateField(tableId, columnName, input)
Section titled “updateField(tableId, columnName, input)”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"})deleteField(tableId, columnName)
Section titled “deleteField(tableId, columnName)”Delete a field from a table.
async deleteField(tableId: string, columnName: string): Promise<boolean>View Operations
Section titled “View Operations”createView(tableId, input)
Section titled “createView(tableId, input)”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"})listViews(tableId)
Section titled “listViews(tableId)”List all views for a table.
async listViews(tableId: string): Promise<ViewInfo[]>deleteView(tableId, viewId)
Section titled “deleteView(tableId, viewId)”Delete a view.
async deleteView(tableId: string, viewId: string): Promise<boolean>