(
ref: ConnectionRef,
input: UpdateConnectionInput,
)
| 4784 | findConnectionRow(ref).pipe(Effect.map((row) => (row ? rowToConnection(row) : null))); |
| 4785 | |
| 4786 | const connectionsUpdate = ( |
| 4787 | ref: ConnectionRef, |
| 4788 | input: UpdateConnectionInput, |
| 4789 | ): Effect.Effect<Connection, ConnectionNotFoundError | OrgWriteDeniedError | StorageFailure> => |
| 4790 | transaction( |
| 4791 | Effect.gen(function* () { |
| 4792 | yield* guardOrgWrite(ref.owner); |
| 4793 | const row = yield* findConnectionRow(ref); |
| 4794 | if (!row) { |
| 4795 | return yield* new ConnectionNotFoundError({ |
| 4796 | owner: ref.owner, |
| 4797 | integration: ref.integration, |
| 4798 | name: ref.name, |
| 4799 | }); |
| 4800 | } |
| 4801 | const set: Record<string, unknown> = { updated_at: new Date() }; |
| 4802 | if (input.description !== undefined) set.description = input.description; |
| 4803 | if (input.identityLabel !== undefined) set.identity_label = input.identityLabel; |
| 4804 | yield* core.updateMany("connection", { |
| 4805 | where: (b: AnyCb) => |
| 4806 | b.and( |
| 4807 | byOwner(ref.owner)(b), |
| 4808 | b("integration", "=", String(ref.integration)), |
| 4809 | b("name", "=", String(ref.name)), |
| 4810 | ), |
| 4811 | set, |
| 4812 | }); |
| 4813 | const updated = yield* findConnectionRow(ref); |
| 4814 | return rowToConnection(updated ?? row); |
| 4815 | }), |
| 4816 | ); |
| 4817 | |
| 4818 | const connectionsRemove = ( |
| 4819 | ref: ConnectionRef, |
no test coverage detected