MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / connectionsUpdate

Function connectionsUpdate

packages/core/sdk/src/executor.ts:4226–4253  ·  view source on GitHub ↗
(
      ref: ConnectionRef,
      input: UpdateConnectionInput,
    )

Source from the content-addressed store, hash-verified

4224 findConnectionRow(ref).pipe(Effect.map((row) => (row ? rowToConnection(row) : null)));
4225
4226 const connectionsUpdate = (
4227 ref: ConnectionRef,
4228 input: UpdateConnectionInput,
4229 ): Effect.Effect<Connection, ConnectionNotFoundError | StorageFailure> =>
4230 Effect.gen(function* () {
4231 const row = yield* findConnectionRow(ref);
4232 if (!row) {
4233 return yield* new ConnectionNotFoundError({
4234 owner: ref.owner,
4235 integration: ref.integration,
4236 name: ref.name,
4237 });
4238 }
4239 const set: Record<string, unknown> = { updated_at: new Date() };
4240 if (input.description !== undefined) set.description = input.description;
4241 if (input.identityLabel !== undefined) set.identity_label = input.identityLabel;
4242 yield* core.updateMany("connection", {
4243 where: (b: AnyCb) =>
4244 b.and(
4245 byOwner(ref.owner)(b),
4246 b("integration", "=", String(ref.integration)),
4247 b("name", "=", String(ref.name)),
4248 ),
4249 set,
4250 });
4251 const updated = yield* findConnectionRow(ref);
4252 return rowToConnection(updated ?? row);
4253 });
4254
4255 const connectionsRemove = (
4256 ref: ConnectionRef,

Callers 1

createExecutorFunction · 0.85

Calls 3

findConnectionRowFunction · 0.85
byOwnerFunction · 0.85
rowToConnectionFunction · 0.85

Tested by

no test coverage detected