* Serialize a SubBlockConfig for the VFS component schema. * Strips functions and UI-only fields. Includes static options arrays.
(sb: SubBlockConfig)
| 386 | * Strips functions and UI-only fields. Includes static options arrays. |
| 387 | */ |
| 388 | function 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 |
no outgoing calls
no test coverage detected