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

Function connectionsUpdate

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

Source from the content-addressed store, hash-verified

3079 findConnectionRow(ref).pipe(Effect.map((row) => (row ? rowToConnection(row) : null)));
3080
3081 const connectionsUpdate = (
3082 ref: ConnectionRef,
3083 input: UpdateConnectionInput,
3084 ): Effect.Effect<Connection, ConnectionNotFoundError | StorageFailure> =>
3085 Effect.gen(function* () {
3086 const row = yield* findConnectionRow(ref);
3087 if (!row) {
3088 return yield* new ConnectionNotFoundError({
3089 owner: ref.owner,
3090 integration: ref.integration,
3091 name: ref.name,
3092 });
3093 }
3094 const set: Record<string, unknown> = { updated_at: new Date() };
3095 if (input.description !== undefined) set.description = input.description;
3096 if (input.identityLabel !== undefined) set.identity_label = input.identityLabel;
3097 yield* core.updateMany("connection", {
3098 where: (b: AnyCb) =>
3099 b.and(
3100 byOwner(ref.owner)(b),
3101 b("integration", "=", String(ref.integration)),
3102 b("name", "=", String(ref.name)),
3103 ),
3104 set,
3105 });
3106 const updated = yield* findConnectionRow(ref);
3107 return rowToConnection(updated ?? row);
3108 });
3109
3110 const connectionsRemove = (
3111 ref: ConnectionRef,

Callers 1

createExecutorFunction · 0.85

Calls 3

findConnectionRowFunction · 0.85
byOwnerFunction · 0.85
rowToConnectionFunction · 0.85

Tested by

no test coverage detected