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

Function blockExistsInDeployment

apps/sim/lib/workflows/persistence/utils.ts:75–101  ·  view source on GitHub ↗
(
  workflowId: string,
  blockId: string
)

Source from the content-addressed store, hash-verified

73}
74
75export async function blockExistsInDeployment(
76 workflowId: string,
77 blockId: string
78): Promise<boolean> {
79 try {
80 const [result] = await db
81 .select({ state: workflowDeploymentVersion.state })
82 .from(workflowDeploymentVersion)
83 .where(
84 and(
85 eq(workflowDeploymentVersion.workflowId, workflowId),
86 eq(workflowDeploymentVersion.isActive, true)
87 )
88 )
89 .limit(1)
90
91 if (!result?.state) {
92 return false
93 }
94
95 const state = result.state as WorkflowState
96 return !!state.blocks?.[blockId]
97 } catch (error) {
98 logger.error(`Error checking block ${blockId} in deployment for workflow ${workflowId}:`, error)
99 return false
100 }
101}
102
103const DEPLOYED_STATE_CACHE_MAX_ENTRIES = 500
104const DEPLOYED_STATE_CACHE_TTL_MS = 5 * 60 * 1000

Callers 2

handleWebhookPostFunction · 0.90

Calls 2

errorMethod · 0.80
eqFunction · 0.50

Tested by

no test coverage detected