MCPcopy
hub / github.com/simstudioai/sim / clearInDeploymentVersions

Function clearInDeploymentVersions

apps/sim/lib/credentials/deletion.ts:135–163  ·  view source on GitHub ↗
(
  credentialId: string,
  workspaceId: string,
  needle: string
)

Source from the content-addressed store, hash-verified

133}
134
135async function clearInDeploymentVersions(
136 credentialId: string,
137 workspaceId: string,
138 needle: string
139): Promise<void> {
140 const rows = await db
141 .select({
142 id: schema.workflowDeploymentVersion.id,
143 state: schema.workflowDeploymentVersion.state,
144 })
145 .from(schema.workflowDeploymentVersion)
146 .innerJoin(schema.workflow, eq(schema.workflow.id, schema.workflowDeploymentVersion.workflowId))
147 .where(
148 and(
149 eq(schema.workflow.workspaceId, workspaceId),
150 sql`${schema.workflowDeploymentVersion.state}::text LIKE ${needle}`
151 )
152 )
153
154 for (const row of rows) {
155 const next = clearCredentialInValue(row.state, credentialId)
156 if (next.changed) {
157 await db
158 .update(schema.workflowDeploymentVersion)
159 .set({ state: next.value })
160 .where(eq(schema.workflowDeploymentVersion.id, row.id))
161 }
162 }
163}
164
165async function clearInPausedExecutions(
166 credentialId: string,

Callers 1

clearCredentialRefsFunction · 0.85

Calls 3

clearCredentialInValueFunction · 0.85
setMethod · 0.65
eqFunction · 0.50

Tested by

no test coverage detected