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

Function getTemplatesForBlock

apps/sim/blocks/registry.ts:135–156  ·  view source on GitHub ↗
(type: string)

Source from the content-addressed store, hash-verified

133 * cluster rendering.
134 */
135export function getTemplatesForBlock(type: string): ScopedBlockTemplate[] {
136 const base = stripVersionSuffix(type)
137 const collected: ScopedBlockTemplate[] = []
138 for (const [ownerType, meta] of Object.entries(BLOCK_META_REGISTRY)) {
139 if (!meta.templates) continue
140 const ownerBase = stripVersionSuffix(ownerType)
141 const isOwnerMatch = ownerBase === base
142 for (const template of meta.templates) {
143 const isAlsoMatch =
144 template.alsoIntegrations?.includes(base) || template.alsoIntegrations?.includes(type)
145 if (!isOwnerMatch && !isAlsoMatch) continue
146 const others: string[] = []
147 if (!isOwnerMatch) others.push(ownerBase)
148 for (const also of template.alsoIntegrations ?? []) {
149 const alsoBase = stripVersionSuffix(also)
150 if (alsoBase !== base && !others.includes(alsoBase)) others.push(alsoBase)
151 }
152 collected.push({ ...template, otherBlockTypes: others })
153 }
154 }
155 return collected
156}
157
158/**
159 * Popular, ready-to-add skills for a block type. Curated skills live on the

Callers 2

IntegrationPageFunction · 0.90
IntegrationBlockDetailFunction · 0.90

Calls 2

stripVersionSuffixFunction · 0.90
pushMethod · 0.45

Tested by

no test coverage detected