MCPcopy Create free account
hub / github.com/cloudflare/computer / wrap

Function wrap

packages/computer/src/runtime/bridge.ts:394–396  ·  view source on GitHub ↗
(type: string, fields: Record<string, unknown>)

Source from the content-addressed store, hash-verified

392
393function encodeBridgeValue(value: unknown): unknown {
394 const wrap = (type: string, fields: Record<string, unknown>) => ({
395 __workspace_codec__: { version: 1, type, ...fields },
396 });
397 if (value instanceof Uint8Array) return wrap("bytes", { data: Array.from(value) });
398 if (Array.isArray(value)) return wrap("array", { items: value.map(encodeBridgeValue) });
399 if (value && typeof value === "object") {

Callers 1

encodeBridgeValueFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected