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

Function call

src/core.ts:1628–1648  ·  view source on GitHub ↗
(path: PropertyPath, args: RpcPayload)

Source from the content-addressed store, hash-verified

1626 protected abstract getValue(): {value: unknown, owner: RpcPayload | null};
1627
1628 call(path: PropertyPath, args: RpcPayload): StubHook {
1629 try {
1630 let {value, owner} = this.getValue();
1631 let followResult = followPath(value, undefined, path, owner);
1632
1633 if (followResult.hook) {
1634 return followResult.hook.call(followResult.remainingPath, args);
1635 }
1636
1637 // It's a local function.
1638 if (typeof followResult.value != "function") {
1639 throw new TypeError(`'${path.join('.')}' is not a function.`);
1640 }
1641 let promise = args.deliverCall(followResult.value, followResult.parent);
1642 return new PromiseStubHook(promise.then(payload => {
1643 return new PayloadStubHook(payload);
1644 }));
1645 } catch (err) {
1646 return new ErrorStubHook(err);
1647 }
1648 }
1649
1650 map(path: PropertyPath, captures: StubHook[], instructions: unknown[]): StubHook {
1651 try {

Callers

nothing calls this directly

Calls 5

followPathFunction · 0.85
deliverCallMethod · 0.80
thenMethod · 0.80
getValueMethod · 0.65
callMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…