UNPKG

@stryke/capnp

Version:

A package to assist in running the Cap'n Proto compiler and creating Cap'n Proto serialization protocol schemas.

1,396 lines (1,394 loc) 147 kB
const require_capnp_es_GpvEvMIK = require('./capnp-es.GpvEvMIK-CZ5ZimCD.cjs'); //#region ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=503a440bd2bef41c0cb22819bc4ced5a7f04993fb999f0d944e284220f14916b_typescript@6.0.3/node_modules/capnp-es/dist/shared/capnp-es.UAt3nLGq.mjs var Interface = class extends require_capnp_es_GpvEvMIK.Pointer { static _capnp = { displayName: "Interface" }; static getCapID = getCapID; static getAsInterface = getAsInterface; static isInterface = isInterface; static getClient = getClient; constructor(segment, byteOffset, depthLimit = require_capnp_es_GpvEvMIK.MAX_DEPTH) { super(segment, byteOffset, depthLimit); } static fromPointer(p) { return getAsInterface(p); } getCapId() { return getCapID(this); } getClient() { return getClient(this); } [Symbol.for("nodejs.util.inspect.custom")]() { return require_capnp_es_GpvEvMIK.format("Interface_%d@%a,%d,limit:%x", this.segment.id, this.byteOffset, this.getCapId(), this._capnp.depthLimit); } }; function getAsInterface(p) { if (require_capnp_es_GpvEvMIK.getTargetPointerType(p) === require_capnp_es_GpvEvMIK.PointerType.OTHER) return new Interface(p.segment, p.byteOffset, p._capnp.depthLimit); return null; } function isInterface(p) { return require_capnp_es_GpvEvMIK.getTargetPointerType(p) === require_capnp_es_GpvEvMIK.PointerType.OTHER; } function getCapID(i) { if (i.segment.getUint32(i.byteOffset) !== require_capnp_es_GpvEvMIK.PointerType.OTHER) return -1; return i.segment.getUint32(i.byteOffset + 4); } function getClient(i) { const capID = getCapID(i); const { capTable } = i.segment.message._capnp; if (!capTable) return null; return capTable[capID]; } function isFuncCall(call) { return !isDataCall(call); } function isDataCall(call) { return !!call.params; } function copyCall(call) { if (isDataCall(call)) return call; return { method: call.method, params: placeParams(call, void 0) }; } function placeParams(call, contentPtr) { if (isDataCall(call)) return call.params; let p; if (contentPtr) p = new call.method.ParamsClass(contentPtr.segment, contentPtr.byteOffset, contentPtr._capnp.depthLimit); else { const msg = new require_capnp_es_GpvEvMIK.Message(); p = new call.method.ParamsClass(msg.getSegment(0), 0); } require_capnp_es_GpvEvMIK.initStruct(call.method.ParamsClass._capnp.size, p); if (call.paramsFunc) call.paramsFunc(p); return p; } function pointerToStruct(p) { if (require_capnp_es_GpvEvMIK.getTargetPointerType(p) === require_capnp_es_GpvEvMIK.PointerType.STRUCT) return new require_capnp_es_GpvEvMIK.Struct(p.segment, p.byteOffset, p._capnp.depthLimit, p._capnp.compositeIndex); return null; } function transformPtr(p, transform) { if (transform.length === 0) return p; let s = pointerToStruct(p); if (!s) return p; for (const op of transform) s = require_capnp_es_GpvEvMIK.getPointer(op.field, s); return s; } var Deferred = class Deferred { static fromPromise(p) { const d = new Deferred(); p.then(d.resolve, d.reject); return d; } promise; reject; resolve; constructor() { this.promise = new Promise((a, b) => { this.resolve = a; this.reject = b; }); } }; var ImmediateAnswer = class extends require_capnp_es_GpvEvMIK.FixedAnswer { constructor(s) { super(); this.s = s; } structSync() { return this.s; } findClient(transform) { return require_capnp_es_GpvEvMIK.getInterfaceClientOrNull(transformPtr(this.s, transform)); } pipelineCall(transform, call) { return this.findClient(transform).call(call); } pipelineClose(transform) { this.findClient(transform).close(); } }; var Queue = class { constructor(q, n) { this.q = q; this.n = n; this.cap = q.len(); } start = 0; cap; len() { return this.n; } push() { if (this.n >= this.cap) return -1; const i = (this.start + this.n) % this.cap; this.n++; return i; } front() { if (this.n === 0) return -1; return this.start; } pop() { if (this.n === 0) return false; this.q.clear(this.start); this.start = (this.start + 1) % this.cap; this.n--; return true; } }; var EmbargoClient = class { _client; q; calls; constructor(client, queue) { this._client = client; this.calls = queue.copy(); this.q = new Queue(this.calls, this.calls.len()); this.flushQueue(); } flushQueue() { let c = null; { const i = this.q.front(); if (i !== -1) c = this.calls.data[i]; } while (c && c.call) { const ans = this._client.call(c.call); (async (f, ans2) => { try { f.fulfill(await ans2.struct()); } catch (error_) { f.reject(error_); } })(c.f, ans); this.q.pop(); { const i = this.q.front(); c = i === -1 ? null : this.calls.data[i]; } } } client() { return this.isPassthrough() ? this._client : null; } isPassthrough() { return this.q.len() === 0; } call(call) { if (this.isPassthrough()) return this._client.call(call); return this.push(call); } push(_call) { const f = new Fulfiller(); const call = copyCall(_call); const i = this.q.push(); if (i === -1) return new require_capnp_es_GpvEvMIK.ErrorAnswer(new Error(require_capnp_es_GpvEvMIK.RPC_CALL_QUEUE_FULL)); this.calls.data[i] = { call, f }; return f; } close() { while (this.q.len() > 0) { const first = this.calls.data[this.q.front()]; if (!first) throw new Error(require_capnp_es_GpvEvMIK.INVARIANT_UNREACHABLE_CODE); first.f.reject(new Error(require_capnp_es_GpvEvMIK.RPC_QUEUE_CALL_CANCEL)); this.q.pop(); } this._client.close(); } }; var Ecalls = class Ecalls { data; constructor(data) { this.data = data; } static copyOf(data) { return new Ecalls([...data]); } len() { return this.data.length; } clear(i) { this.data[i] = null; } copy() { return Ecalls.copyOf(this.data); } }; const callQueueSize$1 = 64; var Fulfiller = class Fulfiller { resolved = false; answer; queue = []; queueCap = callQueueSize$1; deferred = new Deferred(); fulfill(s) { this.answer = new ImmediateAnswer(s); const queues = this.emptyQueue(s); const msgcap = s.segment.message._capnp; if (!msgcap.capTable) msgcap.capTable = []; const ctab = msgcap.capTable; for (const _capIdx of Object.keys(queues)) { const capIdx = +_capIdx; const q = queues[capIdx]; const client = ctab[capIdx]; if (!client) throw new Error(require_capnp_es_GpvEvMIK.INVARIANT_UNREACHABLE_CODE); ctab[capIdx] = new EmbargoClient(client, q); } this.deferred.resolve(s); } reject(err) { this.deferred.reject(err); } peek() { return this.answer; } async struct() { return await this.deferred.promise; } pipelineCall(transform, call) { { const a = this.peek(); if (a) return a.pipelineCall(transform, call); } if (this.queue.length === this.queueCap) return new require_capnp_es_GpvEvMIK.ErrorAnswer(new Error(require_capnp_es_GpvEvMIK.RPC_CALL_QUEUE_FULL)); const cc = copyCall(call); const g = new Fulfiller(); this.queue.push({ call: cc, f: g, transform }); return g; } pipelineClose(transform) { const onFinally = () => { if (this.answer) this.answer.pipelineClose(transform); }; this.deferred.promise.then(onFinally, onFinally); } emptyQueue(s) { const qs = {}; for (let i = 0; i < this.queue.length; i++) { const pc = this.queue[i]; let c; try { c = transformPtr(s, pc.transform); } catch (error_) { pc.f.reject(error_); continue; } const iface = Interface.fromPointer(c); if (!iface) { pc.f.reject(new Error(require_capnp_es_GpvEvMIK.RPC_NULL_CLIENT)); continue; } const cn = iface.getCapId(); if (!qs[cn]) qs[cn] = new Ecalls([]); qs[cn].data.push(pc); } this.queue = []; return qs; } }; var PipelineClient = class { constructor(pipeline) { this.pipeline = pipeline; } transform() { return this.pipeline.transform(); } call(call) { return this.pipeline.answer.pipelineCall(this.transform(), call); } close() { this.pipeline.answer.pipelineClose(this.transform()); } }; var Pipeline = class Pipeline { constructor(ResultsClass, answer, op, parent) { this.ResultsClass = ResultsClass; this.answer = answer; this.parent = parent; this.op = op || { field: 0 }; } op; pipelineClient; transform() { const xform = []; for (let q = this; q.parent; q = q.parent) xform.unshift(q.op); return xform; } async struct() { const t = transformPtr(await this.answer.struct(), this.transform()); if (!t) if (this.op.defaultValue) require_capnp_es_GpvEvMIK.copyFrom(this.op.defaultValue, t); else require_capnp_es_GpvEvMIK.initStruct(this.ResultsClass._capnp.size, t); return require_capnp_es_GpvEvMIK.getAs(this.ResultsClass, t); } client() { if (!this.pipelineClient) this.pipelineClient = new PipelineClient(this); return this.pipelineClient; } getPipeline(ResultsClass, off, defaultValue) { return new Pipeline(ResultsClass, this.answer, { field: off, defaultValue }, this); } }; var MethodError = class extends Error { constructor(method, message) { super(require_capnp_es_GpvEvMIK.format(require_capnp_es_GpvEvMIK.RPC_METHOD_ERROR, method.interfaceName, method.methodName, message)); this.method = method; } }; var Registry = class { static interfaces = /* @__PURE__ */ new Map(); static register(id, def) { this.interfaces.set(id, def); } static lookup(id) { return this.interfaces.get(id); } }; var Server = class { constructor(target, methods) { this.target = target; this.methods = methods; } startCall(call) { const results = new require_capnp_es_GpvEvMIK.Message().initRoot(call.method.ResultsClass); call.serverMethod.impl.call(this.target, call.params, results).then(() => call.answer.fulfill(results)).catch((error_) => call.answer.reject(error_)); } call(call) { const serverMethod = this.methods[call.method.methodId]; if (!serverMethod) return new require_capnp_es_GpvEvMIK.ErrorAnswer(new MethodError(call.method, require_capnp_es_GpvEvMIK.RPC_METHOD_NOT_IMPLEMENTED)); const serverCall = { ...copyCall(call), answer: new Fulfiller(), serverMethod }; this.startCall(serverCall); return serverCall.answer; } close() {} }; //#endregion //#region ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=503a440bd2bef41c0cb22819bc4ced5a7f04993fb999f0d944e284220f14916b_typescript@6.0.3/node_modules/capnp-es/dist/capnp/rpc.mjs const Message_Which = { /** * The sender previously received this message from the peer but didn't understand it or doesn't * yet implement the functionality that was requested. So, the sender is echoing the message * back. In some cases, the receiver may be able to recover from this by pretending the sender * had taken some appropriate "null" action. * * For example, say `resolve` is received by a level 0 implementation (because a previous call * or return happened to contain a promise). The level 0 implementation will echo it back as * `unimplemented`. The original sender can then simply release the cap to which the promise * had resolved, thus avoiding a leak. * * For any message type that introduces a question, if the message comes back unimplemented, * the original sender may simply treat it as if the question failed with an exception. * * In cases where there is no sensible way to react to an `unimplemented` message (without * resource leaks or other serious problems), the connection may need to be aborted. This is * a gray area; different implementations may take different approaches. * */ UNIMPLEMENTED: 0, /** * Sent when a connection is being aborted due to an unrecoverable error. This could be e.g. * because the sender received an invalid or nonsensical message or because the sender had an * internal error. The sender will shut down the outgoing half of the connection after `abort` * and will completely close the connection shortly thereafter (it's up to the sender how much * of a time buffer they want to offer for the client to receive the `abort` before the * connection is reset). * */ ABORT: 1, /** * Request the peer's bootstrap interface. * */ BOOTSTRAP: 8, /** * Begin a method call. * */ CALL: 2, /** * Complete a method call. * */ RETURN: 3, /** * Release a returned answer / cancel a call. * */ FINISH: 4, /** * Resolve a previously-sent promise. * */ RESOLVE: 5, /** * Release a capability so that the remote object can be deallocated. * */ RELEASE: 6, /** * Lift an embargo used to enforce E-order over promise resolution. * */ DISEMBARGO: 13, /** * Obsolete request to save a capability, resulting in a SturdyRef. This has been replaced * by the `Persistent` interface defined in `persistent.capnp`. This operation was never * implemented. * */ OBSOLETE_SAVE: 7, /** * Obsolete way to delete a SturdyRef. This operation was never implemented. * */ OBSOLETE_DELETE: 9, /** * Provide a capability to a third party. * */ PROVIDE: 10, /** * Accept a capability provided by a third party. * */ ACCEPT: 11, /** * Directly connect to the common root of two or more proxied caps. * */ JOIN: 12 }; var Message = class Message extends require_capnp_es_GpvEvMIK.Struct { static UNIMPLEMENTED = Message_Which.UNIMPLEMENTED; static ABORT = Message_Which.ABORT; static BOOTSTRAP = Message_Which.BOOTSTRAP; static CALL = Message_Which.CALL; static RETURN = Message_Which.RETURN; static FINISH = Message_Which.FINISH; static RESOLVE = Message_Which.RESOLVE; static RELEASE = Message_Which.RELEASE; static DISEMBARGO = Message_Which.DISEMBARGO; static OBSOLETE_SAVE = Message_Which.OBSOLETE_SAVE; static OBSOLETE_DELETE = Message_Which.OBSOLETE_DELETE; static PROVIDE = Message_Which.PROVIDE; static ACCEPT = Message_Which.ACCEPT; static JOIN = Message_Which.JOIN; static _capnp = { displayName: "Message", id: "91b79f1f808db032", size: new require_capnp_es_GpvEvMIK.ObjectSize(8, 1) }; _adoptUnimplemented(value) { require_capnp_es_GpvEvMIK.setUint16(0, 0, this); require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _disownUnimplemented() { return require_capnp_es_GpvEvMIK.disown(this.unimplemented); } /** * The sender previously received this message from the peer but didn't understand it or doesn't * yet implement the functionality that was requested. So, the sender is echoing the message * back. In some cases, the receiver may be able to recover from this by pretending the sender * had taken some appropriate "null" action. * * For example, say `resolve` is received by a level 0 implementation (because a previous call * or return happened to contain a promise). The level 0 implementation will echo it back as * `unimplemented`. The original sender can then simply release the cap to which the promise * had resolved, thus avoiding a leak. * * For any message type that introduces a question, if the message comes back unimplemented, * the original sender may simply treat it as if the question failed with an exception. * * In cases where there is no sensible way to react to an `unimplemented` message (without * resource leaks or other serious problems), the connection may need to be aborted. This is * a gray area; different implementations may take different approaches. * */ get unimplemented() { require_capnp_es_GpvEvMIK.testWhich("unimplemented", require_capnp_es_GpvEvMIK.getUint16(0, this), 0, this); return require_capnp_es_GpvEvMIK.getStruct(0, Message, this); } _hasUnimplemented() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(0, this)); } _initUnimplemented() { require_capnp_es_GpvEvMIK.setUint16(0, 0, this); return require_capnp_es_GpvEvMIK.initStructAt(0, Message, this); } get _isUnimplemented() { return require_capnp_es_GpvEvMIK.getUint16(0, this) === 0; } set unimplemented(value) { require_capnp_es_GpvEvMIK.setUint16(0, 0, this); require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _adoptAbort(value) { require_capnp_es_GpvEvMIK.setUint16(0, 1, this); require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _disownAbort() { return require_capnp_es_GpvEvMIK.disown(this.abort); } /** * Sent when a connection is being aborted due to an unrecoverable error. This could be e.g. * because the sender received an invalid or nonsensical message or because the sender had an * internal error. The sender will shut down the outgoing half of the connection after `abort` * and will completely close the connection shortly thereafter (it's up to the sender how much * of a time buffer they want to offer for the client to receive the `abort` before the * connection is reset). * */ get abort() { require_capnp_es_GpvEvMIK.testWhich("abort", require_capnp_es_GpvEvMIK.getUint16(0, this), 1, this); return require_capnp_es_GpvEvMIK.getStruct(0, Exception, this); } _hasAbort() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(0, this)); } _initAbort() { require_capnp_es_GpvEvMIK.setUint16(0, 1, this); return require_capnp_es_GpvEvMIK.initStructAt(0, Exception, this); } get _isAbort() { return require_capnp_es_GpvEvMIK.getUint16(0, this) === 1; } set abort(value) { require_capnp_es_GpvEvMIK.setUint16(0, 1, this); require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _adoptBootstrap(value) { require_capnp_es_GpvEvMIK.setUint16(0, 8, this); require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _disownBootstrap() { return require_capnp_es_GpvEvMIK.disown(this.bootstrap); } /** * Request the peer's bootstrap interface. * */ get bootstrap() { require_capnp_es_GpvEvMIK.testWhich("bootstrap", require_capnp_es_GpvEvMIK.getUint16(0, this), 8, this); return require_capnp_es_GpvEvMIK.getStruct(0, Bootstrap, this); } _hasBootstrap() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(0, this)); } _initBootstrap() { require_capnp_es_GpvEvMIK.setUint16(0, 8, this); return require_capnp_es_GpvEvMIK.initStructAt(0, Bootstrap, this); } get _isBootstrap() { return require_capnp_es_GpvEvMIK.getUint16(0, this) === 8; } set bootstrap(value) { require_capnp_es_GpvEvMIK.setUint16(0, 8, this); require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _adoptCall(value) { require_capnp_es_GpvEvMIK.setUint16(0, 2, this); require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _disownCall() { return require_capnp_es_GpvEvMIK.disown(this.call); } /** * Begin a method call. * */ get call() { require_capnp_es_GpvEvMIK.testWhich("call", require_capnp_es_GpvEvMIK.getUint16(0, this), 2, this); return require_capnp_es_GpvEvMIK.getStruct(0, Call, this); } _hasCall() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(0, this)); } _initCall() { require_capnp_es_GpvEvMIK.setUint16(0, 2, this); return require_capnp_es_GpvEvMIK.initStructAt(0, Call, this); } get _isCall() { return require_capnp_es_GpvEvMIK.getUint16(0, this) === 2; } set call(value) { require_capnp_es_GpvEvMIK.setUint16(0, 2, this); require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _adoptReturn(value) { require_capnp_es_GpvEvMIK.setUint16(0, 3, this); require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _disownReturn() { return require_capnp_es_GpvEvMIK.disown(this.return); } /** * Complete a method call. * */ get return() { require_capnp_es_GpvEvMIK.testWhich("return", require_capnp_es_GpvEvMIK.getUint16(0, this), 3, this); return require_capnp_es_GpvEvMIK.getStruct(0, Return, this); } _hasReturn() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(0, this)); } _initReturn() { require_capnp_es_GpvEvMIK.setUint16(0, 3, this); return require_capnp_es_GpvEvMIK.initStructAt(0, Return, this); } get _isReturn() { return require_capnp_es_GpvEvMIK.getUint16(0, this) === 3; } set return(value) { require_capnp_es_GpvEvMIK.setUint16(0, 3, this); require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _adoptFinish(value) { require_capnp_es_GpvEvMIK.setUint16(0, 4, this); require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _disownFinish() { return require_capnp_es_GpvEvMIK.disown(this.finish); } /** * Release a returned answer / cancel a call. * */ get finish() { require_capnp_es_GpvEvMIK.testWhich("finish", require_capnp_es_GpvEvMIK.getUint16(0, this), 4, this); return require_capnp_es_GpvEvMIK.getStruct(0, Finish, this); } _hasFinish() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(0, this)); } _initFinish() { require_capnp_es_GpvEvMIK.setUint16(0, 4, this); return require_capnp_es_GpvEvMIK.initStructAt(0, Finish, this); } get _isFinish() { return require_capnp_es_GpvEvMIK.getUint16(0, this) === 4; } set finish(value) { require_capnp_es_GpvEvMIK.setUint16(0, 4, this); require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _adoptResolve(value) { require_capnp_es_GpvEvMIK.setUint16(0, 5, this); require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _disownResolve() { return require_capnp_es_GpvEvMIK.disown(this.resolve); } /** * Resolve a previously-sent promise. * */ get resolve() { require_capnp_es_GpvEvMIK.testWhich("resolve", require_capnp_es_GpvEvMIK.getUint16(0, this), 5, this); return require_capnp_es_GpvEvMIK.getStruct(0, Resolve, this); } _hasResolve() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(0, this)); } _initResolve() { require_capnp_es_GpvEvMIK.setUint16(0, 5, this); return require_capnp_es_GpvEvMIK.initStructAt(0, Resolve, this); } get _isResolve() { return require_capnp_es_GpvEvMIK.getUint16(0, this) === 5; } set resolve(value) { require_capnp_es_GpvEvMIK.setUint16(0, 5, this); require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _adoptRelease(value) { require_capnp_es_GpvEvMIK.setUint16(0, 6, this); require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _disownRelease() { return require_capnp_es_GpvEvMIK.disown(this.release); } /** * Release a capability so that the remote object can be deallocated. * */ get release() { require_capnp_es_GpvEvMIK.testWhich("release", require_capnp_es_GpvEvMIK.getUint16(0, this), 6, this); return require_capnp_es_GpvEvMIK.getStruct(0, Release, this); } _hasRelease() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(0, this)); } _initRelease() { require_capnp_es_GpvEvMIK.setUint16(0, 6, this); return require_capnp_es_GpvEvMIK.initStructAt(0, Release, this); } get _isRelease() { return require_capnp_es_GpvEvMIK.getUint16(0, this) === 6; } set release(value) { require_capnp_es_GpvEvMIK.setUint16(0, 6, this); require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _adoptDisembargo(value) { require_capnp_es_GpvEvMIK.setUint16(0, 13, this); require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _disownDisembargo() { return require_capnp_es_GpvEvMIK.disown(this.disembargo); } /** * Lift an embargo used to enforce E-order over promise resolution. * */ get disembargo() { require_capnp_es_GpvEvMIK.testWhich("disembargo", require_capnp_es_GpvEvMIK.getUint16(0, this), 13, this); return require_capnp_es_GpvEvMIK.getStruct(0, Disembargo, this); } _hasDisembargo() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(0, this)); } _initDisembargo() { require_capnp_es_GpvEvMIK.setUint16(0, 13, this); return require_capnp_es_GpvEvMIK.initStructAt(0, Disembargo, this); } get _isDisembargo() { return require_capnp_es_GpvEvMIK.getUint16(0, this) === 13; } set disembargo(value) { require_capnp_es_GpvEvMIK.setUint16(0, 13, this); require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _adoptObsoleteSave(value) { require_capnp_es_GpvEvMIK.setUint16(0, 7, this); require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _disownObsoleteSave() { return require_capnp_es_GpvEvMIK.disown(this.obsoleteSave); } /** * Obsolete request to save a capability, resulting in a SturdyRef. This has been replaced * by the `Persistent` interface defined in `persistent.capnp`. This operation was never * implemented. * */ get obsoleteSave() { require_capnp_es_GpvEvMIK.testWhich("obsoleteSave", require_capnp_es_GpvEvMIK.getUint16(0, this), 7, this); return require_capnp_es_GpvEvMIK.getPointer(0, this); } _hasObsoleteSave() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(0, this)); } get _isObsoleteSave() { return require_capnp_es_GpvEvMIK.getUint16(0, this) === 7; } set obsoleteSave(value) { require_capnp_es_GpvEvMIK.setUint16(0, 7, this); require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _adoptObsoleteDelete(value) { require_capnp_es_GpvEvMIK.setUint16(0, 9, this); require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _disownObsoleteDelete() { return require_capnp_es_GpvEvMIK.disown(this.obsoleteDelete); } /** * Obsolete way to delete a SturdyRef. This operation was never implemented. * */ get obsoleteDelete() { require_capnp_es_GpvEvMIK.testWhich("obsoleteDelete", require_capnp_es_GpvEvMIK.getUint16(0, this), 9, this); return require_capnp_es_GpvEvMIK.getPointer(0, this); } _hasObsoleteDelete() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(0, this)); } get _isObsoleteDelete() { return require_capnp_es_GpvEvMIK.getUint16(0, this) === 9; } set obsoleteDelete(value) { require_capnp_es_GpvEvMIK.setUint16(0, 9, this); require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _adoptProvide(value) { require_capnp_es_GpvEvMIK.setUint16(0, 10, this); require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _disownProvide() { return require_capnp_es_GpvEvMIK.disown(this.provide); } /** * Provide a capability to a third party. * */ get provide() { require_capnp_es_GpvEvMIK.testWhich("provide", require_capnp_es_GpvEvMIK.getUint16(0, this), 10, this); return require_capnp_es_GpvEvMIK.getStruct(0, Provide, this); } _hasProvide() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(0, this)); } _initProvide() { require_capnp_es_GpvEvMIK.setUint16(0, 10, this); return require_capnp_es_GpvEvMIK.initStructAt(0, Provide, this); } get _isProvide() { return require_capnp_es_GpvEvMIK.getUint16(0, this) === 10; } set provide(value) { require_capnp_es_GpvEvMIK.setUint16(0, 10, this); require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _adoptAccept(value) { require_capnp_es_GpvEvMIK.setUint16(0, 11, this); require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _disownAccept() { return require_capnp_es_GpvEvMIK.disown(this.accept); } /** * Accept a capability provided by a third party. * */ get accept() { require_capnp_es_GpvEvMIK.testWhich("accept", require_capnp_es_GpvEvMIK.getUint16(0, this), 11, this); return require_capnp_es_GpvEvMIK.getStruct(0, Accept, this); } _hasAccept() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(0, this)); } _initAccept() { require_capnp_es_GpvEvMIK.setUint16(0, 11, this); return require_capnp_es_GpvEvMIK.initStructAt(0, Accept, this); } get _isAccept() { return require_capnp_es_GpvEvMIK.getUint16(0, this) === 11; } set accept(value) { require_capnp_es_GpvEvMIK.setUint16(0, 11, this); require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _adoptJoin(value) { require_capnp_es_GpvEvMIK.setUint16(0, 12, this); require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _disownJoin() { return require_capnp_es_GpvEvMIK.disown(this.join); } /** * Directly connect to the common root of two or more proxied caps. * */ get join() { require_capnp_es_GpvEvMIK.testWhich("join", require_capnp_es_GpvEvMIK.getUint16(0, this), 12, this); return require_capnp_es_GpvEvMIK.getStruct(0, Join, this); } _hasJoin() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(0, this)); } _initJoin() { require_capnp_es_GpvEvMIK.setUint16(0, 12, this); return require_capnp_es_GpvEvMIK.initStructAt(0, Join, this); } get _isJoin() { return require_capnp_es_GpvEvMIK.getUint16(0, this) === 12; } set join(value) { require_capnp_es_GpvEvMIK.setUint16(0, 12, this); require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } toString() { return "Message_" + super.toString(); } which() { return require_capnp_es_GpvEvMIK.getUint16(0, this); } }; var Bootstrap = class extends require_capnp_es_GpvEvMIK.Struct { static _capnp = { displayName: "Bootstrap", id: "e94ccf8031176ec4", size: new require_capnp_es_GpvEvMIK.ObjectSize(8, 1) }; /** * A new question ID identifying this request, which will eventually receive a Return message * containing the restored capability. * */ get questionId() { return require_capnp_es_GpvEvMIK.getUint32(0, this); } set questionId(value) { require_capnp_es_GpvEvMIK.setUint32(0, value, this); } _adoptDeprecatedObjectId(value) { require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _disownDeprecatedObjectId() { return require_capnp_es_GpvEvMIK.disown(this.deprecatedObjectId); } /** * ** DEPRECATED ** * * A Vat may export multiple bootstrap interfaces. In this case, `deprecatedObjectId` specifies * which one to return. If this pointer is null, then the default bootstrap interface is returned. * * As of version 0.5, use of this field is deprecated. If a service wants to export multiple * bootstrap interfaces, it should instead define a single bootstrap interface that has methods * that return each of the other interfaces. * * **History** * * In the first version of Cap'n Proto RPC (0.4.x) the `Bootstrap` message was called `Restore`. * At the time, it was thought that this would eventually serve as the way to restore SturdyRefs * (level 2). Meanwhile, an application could offer its "main" interface on a well-known * (non-secret) SturdyRef. * * Since level 2 RPC was not implemented at the time, the `Restore` message was in practice only * used to obtain the main interface. Since most applications had only one main interface that * they wanted to restore, they tended to designate this with a null `objectId`. * * Unfortunately, the earliest version of the EZ RPC interfaces set a precedent of exporting * multiple main interfaces by allowing them to be exported under string names. In this case, * `objectId` was a Text value specifying the name. * * All of this proved problematic for several reasons: * * - The arrangement assumed that a client wishing to restore a SturdyRef would know exactly what * machine to connect to and would be able to immediately restore a SturdyRef on connection. * However, in practice, the ability to restore SturdyRefs is itself a capability that may * require going through an authentication process to obtain. Thus, it makes more sense to * define a "restorer service" as a full Cap'n Proto interface. If this restorer interface is * offered as the vat's bootstrap interface, then this is equivalent to the old arrangement. * * - Overloading "Restore" for the purpose of obtaining well-known capabilities encouraged the * practice of exporting singleton services with string names. If singleton services are desired, * it is better to have one main interface that has methods that can be used to obtain each * service, in order to get all the usual benefits of schemas and type checking. * * - Overloading "Restore" also had a security problem: Often, "main" or "well-known" * capabilities exported by a vat are in fact not public: they are intended to be accessed only * by clients who are capable of forming a connection to the vat. This can lead to trouble if * the client itself has other clients and wishes to forward some `Restore` requests from those * external clients -- it has to be very careful not to allow through `Restore` requests * addressing the default capability. * * For example, consider the case of a sandboxed Sandstorm application and its supervisor. The * application exports a default capability to its supervisor that provides access to * functionality that only the supervisor is supposed to access. Meanwhile, though, applications * may publish other capabilities that may be persistent, in which case the application needs * to field `Restore` requests that could come from anywhere. These requests of course have to * pass through the supervisor, as all communications with the outside world must. But, the * supervisor has to be careful not to honor an external request addressing the application's * default capability, since this capability is privileged. Unfortunately, the default * capability cannot be given an unguessable name, because then the supervisor itself would not * be able to address it! * * As of Cap'n Proto 0.5, `Restore` has been renamed to `Bootstrap` and is no longer planned for * use in restoring SturdyRefs. * * Note that 0.4 also defined a message type called `Delete` that, like `Restore`, addressed a * SturdyRef, but indicated that the client would not restore the ref again in the future. This * operation was never implemented, so it was removed entirely. If a "delete" operation is desired, * it should exist as a method on the same interface that handles restoring SturdyRefs. However, * the utility of such an operation is questionable. You wouldn't be able to rely on it for * garbage collection since a client could always disappear permanently without remembering to * delete all its SturdyRefs, thus leaving them dangling forever. Therefore, it is advisable to * design systems such that SturdyRefs never represent "owned" pointers. * * For example, say a SturdyRef points to an image file hosted on some server. That image file * should also live inside a collection (a gallery, perhaps) hosted on the same server, owned by * a user who can delete the image at any time. If the user deletes the image, the SturdyRef * stops working. On the other hand, if the SturdyRef is discarded, this has no effect on the * existence of the image in its collection. * */ get deprecatedObjectId() { return require_capnp_es_GpvEvMIK.getPointer(0, this); } _hasDeprecatedObjectId() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(0, this)); } set deprecatedObjectId(value) { require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } toString() { return "Bootstrap_" + super.toString(); } }; const Call_SendResultsTo_Which = { /** * Send the return message back to the caller (the usual). * */ CALLER: 0, /** * **(level 1)** * * Don't actually return the results to the sender. Instead, hold on to them and await * instructions from the sender regarding what to do with them. In particular, the sender * may subsequently send a `Return` for some other call (which the receiver had previously made * to the sender) with `takeFromOtherQuestion` set. The results from this call are then used * as the results of the other call. * * When `yourself` is used, the receiver must still send a `Return` for the call, but sets the * field `resultsSentElsewhere` in that `Return` rather than including the results. * * This feature can be used to implement tail calls in which a call from Vat A to Vat B ends up * returning the result of a call from Vat B back to Vat A. * * In particular, the most common use case for this feature is when Vat A makes a call to a * promise in Vat B, and then that promise ends up resolving to a capability back in Vat A. * Vat B must forward all the queued calls on that promise back to Vat A, but can set `yourself` * in the calls so that the results need not pass back through Vat B. * * For example: * - Alice, in Vat A, calls foo() on Bob in Vat B. * - Alice makes a pipelined call bar() on the promise returned by foo(). * - Later on, Bob resolves the promise from foo() to point at Carol, who lives in Vat A (next * to Alice). * - Vat B dutifully forwards the bar() call to Carol. Let us call this forwarded call bar'(). * Notice that bar() and bar'() are travelling in opposite directions on the same network * link. * - The `Call` for bar'() has `sendResultsTo` set to `yourself`. * - Vat B sends a `Return` for bar() with `takeFromOtherQuestion` set in place of the results, * with the value set to the question ID of bar'(). Vat B does not wait for bar'() to return, * as doing so would introduce unnecessary round trip latency. * - Vat A receives bar'() and delivers it to Carol. * - When bar'() returns, Vat A sends a `Return` for bar'() to Vat B, with `resultsSentElsewhere` * set in place of results. * - Vat A sends a `Finish` for the bar() call to Vat B. * - Vat B receives the `Finish` for bar() and sends a `Finish` for bar'(). * */ YOURSELF: 1, /** * **(level 3)** * * The call's result should be returned to a different vat. The receiver (the callee) expects * to receive an `Accept` message from the indicated vat, and should return the call's result * to it, rather than to the sender of the `Call`. * * This operates much like `yourself`, above, except that Carol is in a separate Vat C. `Call` * messages are sent from Vat A -> Vat B and Vat B -> Vat C. A `Return` message is sent from * Vat B -> Vat A that contains `acceptFromThirdParty` in place of results. When Vat A sends * an `Accept` to Vat C, it receives back a `Return` containing the call's actual result. Vat C * also sends a `Return` to Vat B with `resultsSentElsewhere`. * */ THIRD_PARTY: 2 }; var Call_SendResultsTo = class extends require_capnp_es_GpvEvMIK.Struct { static CALLER = Call_SendResultsTo_Which.CALLER; static YOURSELF = Call_SendResultsTo_Which.YOURSELF; static THIRD_PARTY = Call_SendResultsTo_Which.THIRD_PARTY; static _capnp = { displayName: "sendResultsTo", id: "dae8b0f61aab5f99", size: new require_capnp_es_GpvEvMIK.ObjectSize(24, 3) }; get _isCaller() { return require_capnp_es_GpvEvMIK.getUint16(6, this) === 0; } set caller(_) { require_capnp_es_GpvEvMIK.setUint16(6, 0, this); } get _isYourself() { return require_capnp_es_GpvEvMIK.getUint16(6, this) === 1; } set yourself(_) { require_capnp_es_GpvEvMIK.setUint16(6, 1, this); } _adoptThirdParty(value) { require_capnp_es_GpvEvMIK.setUint16(6, 2, this); require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(2, this)); } _disownThirdParty() { return require_capnp_es_GpvEvMIK.disown(this.thirdParty); } /** * **(level 3)** * * The call's result should be returned to a different vat. The receiver (the callee) expects * to receive an `Accept` message from the indicated vat, and should return the call's result * to it, rather than to the sender of the `Call`. * * This operates much like `yourself`, above, except that Carol is in a separate Vat C. `Call` * messages are sent from Vat A -> Vat B and Vat B -> Vat C. A `Return` message is sent from * Vat B -> Vat A that contains `acceptFromThirdParty` in place of results. When Vat A sends * an `Accept` to Vat C, it receives back a `Return` containing the call's actual result. Vat C * also sends a `Return` to Vat B with `resultsSentElsewhere`. * */ get thirdParty() { require_capnp_es_GpvEvMIK.testWhich("thirdParty", require_capnp_es_GpvEvMIK.getUint16(6, this), 2, this); return require_capnp_es_GpvEvMIK.getPointer(2, this); } _hasThirdParty() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(2, this)); } get _isThirdParty() { return require_capnp_es_GpvEvMIK.getUint16(6, this) === 2; } set thirdParty(value) { require_capnp_es_GpvEvMIK.setUint16(6, 2, this); require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(2, this)); } toString() { return "Call_SendResultsTo_" + super.toString(); } which() { return require_capnp_es_GpvEvMIK.getUint16(6, this); } }; var Call = class Call extends require_capnp_es_GpvEvMIK.Struct { static _capnp = { displayName: "Call", id: "836a53ce789d4cd4", size: new require_capnp_es_GpvEvMIK.ObjectSize(24, 3), defaultAllowThirdPartyTailCall: require_capnp_es_GpvEvMIK.getBitMask(false, 0), defaultNoPromisePipelining: require_capnp_es_GpvEvMIK.getBitMask(false, 1), defaultOnlyPromisePipeline: require_capnp_es_GpvEvMIK.getBitMask(false, 2) }; /** * A number, chosen by the caller, that identifies this call in future messages. This number * must be different from all other calls originating from the same end of the connection (but * may overlap with question IDs originating from the opposite end). A fine strategy is to use * sequential question IDs, but the recipient should not assume this. * * A question ID can be reused once both: * - A matching Return has been received from the callee. * - A matching Finish has been sent from the caller. * */ get questionId() { return require_capnp_es_GpvEvMIK.getUint32(0, this); } set questionId(value) { require_capnp_es_GpvEvMIK.setUint32(0, value, this); } _adoptTarget(value) { require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } _disownTarget() { return require_capnp_es_GpvEvMIK.disown(this.target); } /** * The object that should receive this call. * */ get target() { return require_capnp_es_GpvEvMIK.getStruct(0, MessageTarget, this); } _hasTarget() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(0, this)); } _initTarget() { return require_capnp_es_GpvEvMIK.initStructAt(0, MessageTarget, this); } set target(value) { require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(0, this)); } /** * The type ID of the interface being called. Each capability may implement multiple interfaces. * */ get interfaceId() { return require_capnp_es_GpvEvMIK.getUint64(8, this); } set interfaceId(value) { require_capnp_es_GpvEvMIK.setUint64(8, value, this); } /** * The ordinal number of the method to call within the requested interface. * */ get methodId() { return require_capnp_es_GpvEvMIK.getUint16(4, this); } set methodId(value) { require_capnp_es_GpvEvMIK.setUint16(4, value, this); } /** * Indicates whether or not the receiver is allowed to send a `Return` containing * `acceptFromThirdParty`. Level 3 implementations should set this true. Otherwise, the callee * will have to proxy the return in the case of a tail call to a third-party vat. * */ get allowThirdPartyTailCall() { return require_capnp_es_GpvEvMIK.getBit(128, this, Call._capnp.defaultAllowThirdPartyTailCall); } set allowThirdPartyTailCall(value) { require_capnp_es_GpvEvMIK.setBit(128, value, this, Call._capnp.defaultAllowThirdPartyTailCall); } /** * If true, the sender promises that it won't make any promise-pipelined calls on the results of * this call. If it breaks this promise, the receiver may throw an arbitrary error from such * calls. * * The receiver may use this as an optimization, by skipping the bookkeeping needed for pipelining * when no pipelined calls are expected. The sender typically sets this to false when the method's * schema does not specify any return capabilities. * */ get noPromisePipelining() { return require_capnp_es_GpvEvMIK.getBit(129, this, Call._capnp.defaultNoPromisePipelining); } set noPromisePipelining(value) { require_capnp_es_GpvEvMIK.setBit(129, value, this, Call._capnp.defaultNoPromisePipelining); } /** * If true, the sender only plans to use this call to make pipelined calls. The receiver need not * send a `Return` message (but is still allowed to do so). * * Since the sender does not know whether a `Return` will be sent, it must release all state * related to the call when it sends `Finish`. However, in the case that the callee does not * recognize this hint and chooses to send a `Return`, then technically the caller is not allowed * to reuse the question ID until it receives said `Return`. This creates a conundrum: How does * the caller decide when it's OK to reuse the ID? To sidestep the problem, the C++ implementation * uses high-numbered IDs (with the high-order bit set) for such calls, and cycles through the * IDs in order. If all 2^31 IDs in this space are used without ever seeing a `Return`, then the * implementation assumes that the other end is in fact honoring the hint, and the ID counter is * allowed to loop around. If a `Return` is ever seen when `onlyPromisePipeline` was set, then * the implementation stops using this hint. * */ get onlyPromisePipeline() { return require_capnp_es_GpvEvMIK.getBit(130, this, Call._capnp.defaultOnlyPromisePipeline); } set onlyPromisePipeline(value) { require_capnp_es_GpvEvMIK.setBit(130, value, this, Call._capnp.defaultOnlyPromisePipeline); } _adoptParams(value) { require_capnp_es_GpvEvMIK.adopt(value, require_capnp_es_GpvEvMIK.getPointer(1, this)); } _disownParams() { return require_capnp_es_GpvEvMIK.disown(this.params); } /** * The call parameters. `params.content` is a struct whose fields correspond to the parameters of * the method. * */ get params() { return require_capnp_es_GpvEvMIK.getStruct(1, Payload, this); } _hasParams() { return !require_capnp_es_GpvEvMIK.isNull(require_capnp_es_GpvEvMIK.getPointer(1, this)); } _initParams() { return require_capnp_es_GpvEvMIK.initStructAt(1, Payload, this); } set params(value) { require_capnp_es_GpvEvMIK.copyFrom(value, require_capnp_es_GpvEvMIK.getPointer(1, this)); } /** * Where should the return message be sent? * */ get sendResultsTo() { return require_capnp_es_GpvEvMIK.getAs(Call_SendResultsTo, this); } _initSendResultsTo() { return require_capnp_es_GpvEvMIK.getAs(Call_SendResultsTo, this); } toString() { return "Call_" + super.toString(); } }; const Return_Which = { /** * Equal to the QuestionId of the corresponding `Call` message. * */ RESULTS: 0, /** * If true, all capabilities that were in the params should be considered released. The sender * must not send separate `Release` messages for them. Level 0 implementations in particular * should always set this true. This defaults true because if level 0 implementations forget to * set it they'll never notice (just silently leak caps), but if level >=1 implementations forget * to set it to false they'll quickly get errors. * * The receiver should act as if the sender had sent a release message with count=1 for each * CapDescriptor in the original Call message. * */ EXCEPTION: 1, /** * The result. * * For regular method calls, `results.content` points to the result struct. * * For a `Return` in response to an `Accept` or `Bootstrap`, `results` contains a single * capability (rather than a struct), and `results.content` is just a capability pointer with * index 0. A `Finish` is still required in this case. * */ CANCELED: 2, /** * Indicates that the call failed and explains why. * */ RESULTS_SENT_ELSEWHERE: 3, /** * Indicates that the call was canceled due to the caller sending a Finish message * before the call had completed. * */ TAKE_FROM_OTHER_QUESTION: 4, /** * This is set when returning from a `Call` that had `sendResultsTo` set to something other * than `caller`. * * It doesn't matter too much when this is sent, as the receiver doesn't need to do anything * with it, but the C++ implementation appears to wait for the call to finish before sending * this. * */ ACCEPT_FROM_THIRD_PARTY: 5 }; var Return = class Return extends require_capnp_es_GpvEvMIK.Struct { static RESULTS = Return_Which.RESULTS; static EXCEPTION = Return_Which.EXCEPTION; static CANCELED = Return_Which.CANCELED; static RESULTS_SENT_ELSEWHERE = Return_Which.RESULTS_SENT_ELSEWHERE; static TAKE_FROM_OTHER_QUESTION = Return_Which.TAKE_FROM_OTHER_QUESTION; static ACCEPT_FROM_THIRD_PARTY = Return_Which.ACCEPT_FROM_THIRD_PARTY; static _capnp = { displayName: "Return", id: "9e19b28d3db3573a", size: new require_capnp_es_GpvEvMIK.ObjectSize(16, 1), defaultReleaseParamCaps: require_capnp_es_GpvEvMIK.getBitMask(true, 0), defaultNoFinishNeeded: require_capnp_es_GpvEvMIK.getBitMask(false, 1) }; /** * Equal to the QuestionId of the corresponding `Call` message. * */ get answerId() { return require_capnp_es_GpvEvMIK.getUint32(0, this); } set answerId(value) { require_capnp_es_GpvEvMIK.setUint32(0, value, this); } /** * If true, all capabilities that were in the params should be considered released. The sender * must not send separate `Release` messages for them. Level 0 implementations in particular * should always set this true. This defaults true because if level 0 implementations forget to * set it they'll never notice (just silently leak caps), but if level >=1 implementations f