(
ref: ConnectionRef,
input: UpdateConnectionInput,
)
| 2603 | findConnectionRow(ref).pipe(Effect.map((row) => (row ? rowToConnection(row) : null))); |
| 2604 | |
| 2605 | const connectionsUpdate = ( |
| 2606 | ref: ConnectionRef, |
| 2607 | input: UpdateConnectionInput, |
| 2608 | ): Effect.Effect<Connection, ConnectionNotFoundError | StorageFailure> => |
| 2609 | Effect.gen(function* () { |
| 2610 | const row = yield* findConnectionRow(ref); |
| 2611 | if (!row) { |
| 2612 | return yield* new ConnectionNotFoundError({ |
| 2613 | owner: ref.owner, |
| 2614 | integration: ref.integration, |
| 2615 | name: ref.name, |
| 2616 | }); |
| 2617 | } |
| 2618 | const set: Record<string, unknown> = { updated_at: new Date() }; |
| 2619 | if (input.description !== undefined) set.description = input.description; |
| 2620 | if (input.identityLabel !== undefined) set.identity_label = input.identityLabel; |
| 2621 | yield* core.updateMany("connection", { |
| 2622 | where: (b: AnyCb) => |
| 2623 | b.and( |
| 2624 | byOwner(ref.owner)(b), |
| 2625 | b("integration", "=", String(ref.integration)), |
| 2626 | b("name", "=", String(ref.name)), |
| 2627 | ), |
| 2628 | set, |
| 2629 | }); |
| 2630 | const updated = yield* findConnectionRow(ref); |
| 2631 | return rowToConnection(updated ?? row); |
| 2632 | }); |
| 2633 | |
| 2634 | const connectionsRemove = ( |
| 2635 | ref: ConnectionRef, |
no test coverage detected