(params: {
workspaceId: string
removedKeys: string[]
})
| 314 | * Use this instead of `syncWorkspaceEnvCredentials` when the caller knows exactly which keys were deleted. |
| 315 | */ |
| 316 | export async function deleteWorkspaceEnvCredentials(params: { |
| 317 | workspaceId: string |
| 318 | removedKeys: string[] |
| 319 | }): Promise<void> { |
| 320 | const { workspaceId, removedKeys } = params |
| 321 | const keys = removedKeys.filter(Boolean) |
| 322 | if (keys.length === 0) return |
| 323 | |
| 324 | await db |
| 325 | .delete(credential) |
| 326 | .where( |
| 327 | and( |
| 328 | eq(credential.workspaceId, workspaceId), |
| 329 | eq(credential.type, 'env_workspace'), |
| 330 | inArray(credential.envKey, keys) |
| 331 | ) |
| 332 | ) |
| 333 | } |
| 334 | |
| 335 | export async function syncPersonalEnvCredentialsForUser(params: { |
| 336 | userId: string |
no test coverage detected