MCPcopy
hub / github.com/simstudioai/sim / stripColumnIdsFromMetadata

Function stripColumnIdsFromMetadata

apps/sim/lib/table/columns/service.ts:215–238  ·  view source on GitHub ↗

Removes the given column-id keys from a metadata blob (widths/order/pinned).

(
  metadata: TableMetadata | null,
  ids: ReadonlySet<string>
)

Source from the content-addressed store, hash-verified

213
214/** Removes the given column-id keys from a metadata blob (widths/order/pinned). */
215function stripColumnIdsFromMetadata(
216 metadata: TableMetadata | null,
217 ids: ReadonlySet<string>
218): TableMetadata | null {
219 if (!metadata) return metadata
220 let next = metadata
221 if (metadata.columnWidths) {
222 const widths = { ...metadata.columnWidths }
223 let changed = false
224 for (const id of ids)
225 if (id in widths) {
226 delete widths[id]
227 changed = true
228 }
229 if (changed) next = { ...next, columnWidths: widths }
230 }
231 if (metadata.columnOrder?.some((id) => ids.has(id))) {
232 next = { ...next, columnOrder: metadata.columnOrder.filter((id) => !ids.has(id)) }
233 }
234 if (metadata.pinnedColumns?.some((id) => ids.has(id))) {
235 next = { ...next, pinnedColumns: metadata.pinnedColumns.filter((id) => !ids.has(id)) }
236 }
237 return next
238}
239
240/**
241 * Fire-and-forget reclamation of a deleted column's row storage. The column is

Callers 2

deleteColumnFunction · 0.85
deleteColumnsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected