( credentialId: string, workspaceId: string, needle: string )
| 193 | } |
| 194 | |
| 195 | async function clearInWorkflowCheckpoints( |
| 196 | credentialId: string, |
| 197 | workspaceId: string, |
| 198 | needle: string |
| 199 | ): Promise<void> { |
| 200 | const rows = await db |
| 201 | .select({ |
| 202 | id: schema.workflowCheckpoints.id, |
| 203 | workflowState: schema.workflowCheckpoints.workflowState, |
| 204 | }) |
| 205 | .from(schema.workflowCheckpoints) |
| 206 | .innerJoin(schema.workflow, eq(schema.workflow.id, schema.workflowCheckpoints.workflowId)) |
| 207 | .where( |
| 208 | and( |
| 209 | eq(schema.workflow.workspaceId, workspaceId), |
| 210 | sql`${schema.workflowCheckpoints.workflowState}::text LIKE ${needle}` |
| 211 | ) |
| 212 | ) |
| 213 | |
| 214 | for (const row of rows) { |
| 215 | const next = clearCredentialInValue(row.workflowState, credentialId) |
| 216 | if (next.changed) { |
| 217 | await db |
| 218 | .update(schema.workflowCheckpoints) |
| 219 | .set({ workflowState: next.value, updatedAt: new Date() }) |
| 220 | .where(eq(schema.workflowCheckpoints.id, row.id)) |
| 221 | } |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | async function clearInKnowledgeConnectors(credentialId: string): Promise<void> { |
| 226 | await db |
no test coverage detected