MCPcopy Index your code
hub / github.com/simstudioai/sim / materializeTables

Method materializeTables

apps/sim/lib/copilot/vfs/workspace-vfs.ts:1493–1527  ·  view source on GitHub ↗

* Materialize tables using the shared listTables function. * Returns a summary for WORKSPACE.md generation.

(workspaceId: string)

Source from the content-addressed store, hash-verified

1491 * Returns a summary for WORKSPACE.md generation.
1492 */
1493 private async materializeTables(workspaceId: string): Promise<WorkspaceMdData['tables']> {
1494 try {
1495 const tables = await listTables(workspaceId)
1496
1497 for (const table of tables) {
1498 const safeName = sanitizeName(table.name)
1499 this.files.set(
1500 `tables/${safeName}/meta.json`,
1501 serializeTableMeta({
1502 id: table.id,
1503 name: table.name,
1504 description: table.description,
1505 schema: table.schema,
1506 rowCount: table.rowCount,
1507 maxRows: table.maxRows,
1508 createdAt: table.createdAt,
1509 updatedAt: table.updatedAt,
1510 })
1511 )
1512 }
1513
1514 return tables.map((t) => ({
1515 id: t.id,
1516 name: t.name,
1517 description: t.description,
1518 rowCount: t.rowCount,
1519 }))
1520 } catch (err) {
1521 logger.warn('Failed to materialize tables', {
1522 workspaceId,
1523 error: toError(err).message,
1524 })
1525 return []
1526 }
1527 }
1528
1529 /**
1530 * Materialize workspace files (already uses listWorkspaceFiles).

Callers 1

materializeMethod · 0.95

Calls 6

listTablesFunction · 0.90
serializeTableMetaFunction · 0.90
toErrorFunction · 0.90
sanitizeNameFunction · 0.70
setMethod · 0.65
warnMethod · 0.65

Tested by

no test coverage detected