(
ref: ConnectionRef,
input: UpdateConnectionInput,
)
| 3486 | findConnectionRow(ref).pipe(Effect.map((row) => (row ? rowToConnection(row) : null))); |
| 3487 | |
| 3488 | const connectionsUpdate = ( |
| 3489 | ref: ConnectionRef, |
| 3490 | input: UpdateConnectionInput, |
| 3491 | ): Effect.Effect<Connection, ConnectionNotFoundError | StorageFailure> => |
| 3492 | Effect.gen(function* () { |
| 3493 | const row = yield* findConnectionRow(ref); |
| 3494 | if (!row) { |
| 3495 | return yield* new ConnectionNotFoundError({ |
| 3496 | owner: ref.owner, |
| 3497 | integration: ref.integration, |
| 3498 | name: ref.name, |
| 3499 | }); |
| 3500 | } |
| 3501 | const set: Record<string, unknown> = { updated_at: new Date() }; |
| 3502 | if (input.description !== undefined) set.description = input.description; |
| 3503 | if (input.identityLabel !== undefined) set.identity_label = input.identityLabel; |
| 3504 | yield* core.updateMany("connection", { |
| 3505 | where: (b: AnyCb) => |
| 3506 | b.and( |
| 3507 | byOwner(ref.owner)(b), |
| 3508 | b("integration", "=", String(ref.integration)), |
| 3509 | b("name", "=", String(ref.name)), |
| 3510 | ), |
| 3511 | set, |
| 3512 | }); |
| 3513 | const updated = yield* findConnectionRow(ref); |
| 3514 | return rowToConnection(updated ?? row); |
| 3515 | }); |
| 3516 | |
| 3517 | const connectionsRemove = ( |
| 3518 | ref: ConnectionRef, |
no test coverage detected