MCPcopy Index your code
hub / github.com/CopilotKit/CopilotKit / #guardMutation

Method #guardMutation

packages/angular/src/lib/threads.ts:518–529  ·  view source on GitHub ↗

* Wraps a mutation so that, when thread mutations are unavailable on the * connected runtime, the call rejects with a descriptive error instead of * issuing a request doomed to fail.

(
    mutationsError: () => Error | null,
    mutation: (threadId: string, name: string) => Promise<void>,
  )

Source from the content-addressed store, hash-verified

516 * issuing a request doomed to fail.
517 */
518 #guardMutation(
519 mutationsError: () => Error | null,
520 mutation: (threadId: string, name: string) => Promise<void>,
521 ): (threadId: string, name?: string) => Promise<void> {
522 return (threadId: string, name = "") => {
523 const error = mutationsError();
524 if (error) {
525 return Promise.reject(error);
526 }
527 return mutation(threadId, name);
528 };
529 }
530}
531
532/**

Callers 1

constructorMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected