(
ref: ConnectionRef,
input: UpdateConnectionInput,
)
| 2979 | findConnectionRow(ref).pipe(Effect.map((row) => (row ? rowToConnection(row) : null))); |
| 2980 | |
| 2981 | const connectionsUpdate = ( |
| 2982 | ref: ConnectionRef, |
| 2983 | input: UpdateConnectionInput, |
| 2984 | ): Effect.Effect<Connection, ConnectionNotFoundError | StorageFailure> => |
| 2985 | Effect.gen(function* () { |
| 2986 | const row = yield* findConnectionRow(ref); |
| 2987 | if (!row) { |
| 2988 | return yield* new ConnectionNotFoundError({ |
| 2989 | owner: ref.owner, |
| 2990 | integration: ref.integration, |
| 2991 | name: ref.name, |
| 2992 | }); |
| 2993 | } |
| 2994 | const set: Record<string, unknown> = { updated_at: new Date() }; |
| 2995 | if (input.description !== undefined) set.description = input.description; |
| 2996 | if (input.identityLabel !== undefined) set.identity_label = input.identityLabel; |
| 2997 | yield* core.updateMany("connection", { |
| 2998 | where: (b: AnyCb) => |
| 2999 | b.and( |
| 3000 | byOwner(ref.owner)(b), |
| 3001 | b("integration", "=", String(ref.integration)), |
| 3002 | b("name", "=", String(ref.name)), |
| 3003 | ), |
| 3004 | set, |
| 3005 | }); |
| 3006 | const updated = yield* findConnectionRow(ref); |
| 3007 | return rowToConnection(updated ?? row); |
| 3008 | }); |
| 3009 | |
| 3010 | const connectionsRemove = ( |
| 3011 | ref: ConnectionRef, |
no test coverage detected