( credentialId: string, workspaceId: string, needle: string )
| 163 | } |
| 164 | |
| 165 | async function clearInPausedExecutions( |
| 166 | credentialId: string, |
| 167 | workspaceId: string, |
| 168 | needle: string |
| 169 | ): Promise<void> { |
| 170 | const rows = await db |
| 171 | .select({ |
| 172 | id: schema.pausedExecutions.id, |
| 173 | executionSnapshot: schema.pausedExecutions.executionSnapshot, |
| 174 | }) |
| 175 | .from(schema.pausedExecutions) |
| 176 | .innerJoin(schema.workflow, eq(schema.workflow.id, schema.pausedExecutions.workflowId)) |
| 177 | .where( |
| 178 | and( |
| 179 | eq(schema.workflow.workspaceId, workspaceId), |
| 180 | sql`${schema.pausedExecutions.executionSnapshot}::text LIKE ${needle}` |
| 181 | ) |
| 182 | ) |
| 183 | |
| 184 | for (const row of rows) { |
| 185 | const next = clearCredentialInValue(row.executionSnapshot, credentialId) |
| 186 | if (next.changed) { |
| 187 | await db |
| 188 | .update(schema.pausedExecutions) |
| 189 | .set({ executionSnapshot: next.value, updatedAt: new Date() }) |
| 190 | .where(eq(schema.pausedExecutions.id, row.id)) |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | async function clearInWorkflowCheckpoints( |
| 196 | credentialId: string, |
no test coverage detected