(
ref: ConnectionRef,
input: UpdateConnectionInput,
)
| 3060 | findConnectionRow(ref).pipe(Effect.map((row) => (row ? rowToConnection(row) : null))); |
| 3061 | |
| 3062 | const connectionsUpdate = ( |
| 3063 | ref: ConnectionRef, |
| 3064 | input: UpdateConnectionInput, |
| 3065 | ): Effect.Effect<Connection, ConnectionNotFoundError | StorageFailure> => |
| 3066 | Effect.gen(function* () { |
| 3067 | const row = yield* findConnectionRow(ref); |
| 3068 | if (!row) { |
| 3069 | return yield* new ConnectionNotFoundError({ |
| 3070 | owner: ref.owner, |
| 3071 | integration: ref.integration, |
| 3072 | name: ref.name, |
| 3073 | }); |
| 3074 | } |
| 3075 | const set: Record<string, unknown> = { updated_at: new Date() }; |
| 3076 | if (input.description !== undefined) set.description = input.description; |
| 3077 | if (input.identityLabel !== undefined) set.identity_label = input.identityLabel; |
| 3078 | yield* core.updateMany("connection", { |
| 3079 | where: (b: AnyCb) => |
| 3080 | b.and( |
| 3081 | byOwner(ref.owner)(b), |
| 3082 | b("integration", "=", String(ref.integration)), |
| 3083 | b("name", "=", String(ref.name)), |
| 3084 | ), |
| 3085 | set, |
| 3086 | }); |
| 3087 | const updated = yield* findConnectionRow(ref); |
| 3088 | return rowToConnection(updated ?? row); |
| 3089 | }); |
| 3090 | |
| 3091 | const connectionsRemove = ( |
| 3092 | ref: ConnectionRef, |
no test coverage detected