MCPcopy
hub / github.com/cloudflare/capnweb / pullPromise

Function pullPromise

src/core.ts:619–630  ·  view source on GitHub ↗
(promise: RpcPromise)

Source from the content-addressed store, hash-verified

617// Given a promise stub (still wrapped in a Proxy), pull the remote promise and deliver the
618// payload. This is a helper used to implement the then/catch/finally methods of RpcPromise.
619async function pullPromise(promise: RpcPromise): Promise<unknown> {
620 let {hook, pathIfPromise} = promise[RAW_STUB];
621 if (pathIfPromise!.length > 0) {
622 // If this isn't the root promise, we have to clone it and pull the clone. This is a little
623 // weird in terms of disposal: There's no way for the app to dispose/cancel the promise while
624 // waiting because it never actually got a direct disposable reference. It has to dispose
625 // the result.
626 hook = hook.get(pathIfPromise!);
627 }
628 let payload = await hook.pull();
629 return payload.deliverResolve();
630}
631
632// =======================================================================================
633// RpcPayload

Callers 3

thenMethod · 0.85
catchMethod · 0.85
finallyMethod · 0.85

Calls 3

deliverResolveMethod · 0.80
getMethod · 0.45
pullMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…