MCPcopy Create free account
hub / github.com/cloudflare/computer / #resolveBackendId

Method #resolveBackendId

packages/computer/src/workspace.ts:746–757  ·  view source on GitHub ↗
(id: string | undefined)

Source from the content-addressed store, hash-verified

744 // workspace; throws on an unknown id. Omitted ids fall through
745 // to the first backend in the list (the default).
746 #resolveBackendId(id: string | undefined): string | undefined {
747 if (this.#registeredBackendIds.size === 0) return undefined;
748 const target = id ?? this.#defaultBackendId;
749 if (target === undefined) return undefined;
750 if (!this.#registeredBackendIds.has(target)) {
751 throw new Error(
752 `Workspace: no backend with id ${JSON.stringify(target)}. ` +
753 `Configured backends: ${[...this.#registeredBackendIds].map((key) => JSON.stringify(key)).join(", ") || "<none>"}.`,
754 );
755 }
756 return target;
757 }
758
759 #resolveCommandBackendId(id: string | undefined): string | undefined {
760 const target = id ?? this.#defaultCommandBackendId;

Callers 3

runtimeMethod · 0.95
readyMethod · 0.95
#serializeMethod · 0.95

Calls 1

hasMethod · 0.80

Tested by

no test coverage detected