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

Function createBlock

apps/sim/executor/utils/start-block.test.ts:11–33  ·  view source on GitHub ↗
(
  type: string,
  id = type,
  options?: { subBlocks?: Record<string, unknown> }
)

Source from the content-addressed store, hash-verified

9import type { SerializedBlock } from '@/serializer/types'
10
11function createBlock(
12 type: string,
13 id = type,
14 options?: { subBlocks?: Record<string, unknown> }
15): SerializedBlock {
16 return {
17 id,
18 position: { x: 0, y: 0 },
19 config: {
20 tool: type,
21 params: options?.subBlocks?.inputFormat ? { inputFormat: options.subBlocks.inputFormat } : {},
22 },
23 inputs: {},
24 outputs: {},
25 metadata: {
26 id: type,
27 name: `block-${type}`,
28 category: 'triggers',
29 ...(options?.subBlocks ? { subBlocks: options.subBlocks } : {}),
30 } as SerializedBlock['metadata'] & { subBlocks?: Record<string, unknown> },
31 enabled: true,
32 }
33}
34
35describe('start-block utilities', () => {
36 it.concurrent('buildResolutionFromBlock returns null when metadata id missing', () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected