(
ref: ConnectionRef,
input: UpdateConnectionInput,
)
| 2619 | findConnectionRow(ref).pipe(Effect.map((row) => (row ? rowToConnection(row) : null))); |
| 2620 | |
| 2621 | const connectionsUpdate = ( |
| 2622 | ref: ConnectionRef, |
| 2623 | input: UpdateConnectionInput, |
| 2624 | ): Effect.Effect<Connection, ConnectionNotFoundError | StorageFailure> => |
| 2625 | Effect.gen(function* () { |
| 2626 | const row = yield* findConnectionRow(ref); |
| 2627 | if (!row) { |
| 2628 | return yield* new ConnectionNotFoundError({ |
| 2629 | owner: ref.owner, |
| 2630 | integration: ref.integration, |
| 2631 | name: ref.name, |
| 2632 | }); |
| 2633 | } |
| 2634 | const set: Record<string, unknown> = { updated_at: new Date() }; |
| 2635 | if (input.description !== undefined) set.description = input.description; |
| 2636 | if (input.identityLabel !== undefined) set.identity_label = input.identityLabel; |
| 2637 | yield* core.updateMany("connection", { |
| 2638 | where: (b: AnyCb) => |
| 2639 | b.and( |
| 2640 | byOwner(ref.owner)(b), |
| 2641 | b("integration", "=", String(ref.integration)), |
| 2642 | b("name", "=", String(ref.name)), |
| 2643 | ), |
| 2644 | set, |
| 2645 | }); |
| 2646 | const updated = yield* findConnectionRow(ref); |
| 2647 | return rowToConnection(updated ?? row); |
| 2648 | }); |
| 2649 | |
| 2650 | const connectionsRemove = ( |
| 2651 | ref: ConnectionRef, |
no test coverage detected