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

Function serializeSubBlock

apps/sim/lib/copilot/vfs/serializers.ts:388–405  ·  view source on GitHub ↗

* Serialize a SubBlockConfig for the VFS component schema. * Strips functions and UI-only fields. Includes static options arrays.

(sb: SubBlockConfig)

Source from the content-addressed store, hash-verified

386 * Strips functions and UI-only fields. Includes static options arrays.
387 */
388function serializeSubBlock(sb: SubBlockConfig): Record<string, unknown> {
389 const result: Record<string, unknown> = {
390 id: sb.id,
391 type: sb.type,
392 }
393 if (sb.title) result.title = sb.title
394 if (sb.required === true) result.required = true
395 if (sb.defaultValue !== undefined) result.defaultValue = sb.defaultValue
396 if (sb.mode) result.mode = sb.mode
397 if (sb.canonicalParamId) result.canonicalParamId = sb.canonicalParamId
398
399 // Include static options arrays for dropdowns
400 if (Array.isArray(sb.options)) {
401 result.options = sb.options
402 }
403
404 return result
405}
406
407/**
408 * Serialize a block schema for VFS components/blocks/{type}.json

Callers 1

serializeBlockSchemaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected