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

Function get

packages/rpc/src/sync-driver.test.ts:66–85  ·  view source on GitHub ↗
(target, prop, receiver)

Source from the content-addressed store, hash-verified

64 let disposeCount = 0;
65 const wrapped = new Proxy(rpc as object, {
66 get(target, prop, receiver) {
67 if (prop === "fetchChanges") {
68 return async (...args: Parameters<SyncRPC["fetchChanges"]>) => {
69 const real = await Reflect.get(target, prop, receiver).call(target, ...args);
70 return {
71 ...real,
72 ...(opts.appliedPushCursor !== undefined
73 ? { appliedPushCursor: opts.appliedPushCursor }
74 : {}),
75 [Symbol.dispose]() {
76 disposeCount += 1;
77 },
78 };
79 };
80 }
81 if (prop === "hasObjects" && opts.failHasObjects) {
82 return async () => [];
83 }
84 return Reflect.get(target, prop, receiver);
85 },
86 }) as SyncRPC;
87 return { rpc: wrapped, disposeCount: () => disposeCount };
88}

Callers

nothing calls this directly

Calls 5

readFetchCursorFunction · 0.90
writeFileSyncMethod · 0.80
callMethod · 0.65
getMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected