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

Method sendMap

src/rpc.ts:824–849  ·  view source on GitHub ↗
(id: ImportId, path: PropertyPath, captures: StubHook[], instructions: unknown[])

Source from the content-addressed store, hash-verified

822 }
823
824 sendMap(id: ImportId, path: PropertyPath, captures: StubHook[], instructions: unknown[])
825 : RpcImportHook {
826 if (this.abortReason) {
827 for (let cap of captures) {
828 cap.dispose();
829 }
830 throw this.abortReason;
831 }
832
833 let devaluedCaptures = captures.map(hook => {
834 let importId = this.getImport(hook);
835 if (importId !== undefined) {
836 return ["import", importId];
837 } else {
838 return ["export", this.exportStub(hook)];
839 }
840 });
841
842 let value = ["remap", id, path, devaluedCaptures, instructions];
843
844 this.send(["push", value]);
845
846 let entry = new ImportTableEntry(this, this.imports.length, false);
847 this.imports.push(entry);
848 return new RpcImportHook(/*isPromise=*/true, entry);
849 }
850
851 sendPull(id: ImportId) {
852 if (this.abortReason) throw this.abortReason;

Callers 2

mapMethod · 0.80
mapMethod · 0.80

Calls 5

getImportMethod · 0.95
exportStubMethod · 0.95
sendMethod · 0.95
disposeMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected