UNPKG

@stryke/capnp

Version:

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

210 lines (194 loc) 6.44 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _chunk3Y2DQ67Zcjs = require('./chunk-3Y2DQ67Z.cjs'); var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs'); // schemas/rpc-twoparty.ts var _capnpFileId = BigInt("0xa184c7885cdaf2a1"); var Side = { /** * The object lives on the "server" or "supervisor" end of the connection. Only the * server/supervisor knows how to interpret the ref; to the client, it is opaque. * * Note that containers intending to implement strong confinement should rewrite SturdyRefs * received from the external network before passing them on to the confined app. The confined * app thus does not ever receive the raw bits of the SturdyRef (which it could perhaps * maliciously leak), but instead receives only a thing that it can pass back to the container * later to restore the ref. See: * http://www.erights.org/elib/capability/dist-confine.html * */ SERVER: 0, /** * The object lives on the "client" or "confined app" end of the connection. Only the client * knows how to interpret the ref; to the server/supervisor, it is opaque. Most clients do not * actually know how to persist capabilities at all, so use of this is unusual. * */ CLIENT: 1 }; var VatId = (_class = class extends _chunk3Y2DQ67Zcjs.Struct { static { _chunkUSNT2KNTcjs.__name.call(void 0, this, "VatId"); } static __initStatic() {this._capnp = { displayName: "VatId", id: "d20b909fee733a8e", size: new (0, _chunk3Y2DQ67Zcjs.ObjectSize)(8, 0) }} get side() { return _chunk3Y2DQ67Zcjs.utils.getUint16(0, this); } set side(value) { _chunk3Y2DQ67Zcjs.utils.setUint16(0, value, this); } toString() { return "VatId_" + super.toString(); } }, _class.__initStatic(), _class); var ProvisionId = (_class2 = class extends _chunk3Y2DQ67Zcjs.Struct { static { _chunkUSNT2KNTcjs.__name.call(void 0, this, "ProvisionId"); } static __initStatic2() {this._capnp = { displayName: "ProvisionId", id: "b88d09a9c5f39817", size: new (0, _chunk3Y2DQ67Zcjs.ObjectSize)(8, 0) }} /** * The ID from `JoinKeyPart`. * */ get joinId() { return _chunk3Y2DQ67Zcjs.utils.getUint32(0, this); } set joinId(value) { _chunk3Y2DQ67Zcjs.utils.setUint32(0, value, this); } toString() { return "ProvisionId_" + super.toString(); } }, _class2.__initStatic2(), _class2); var RecipientId = (_class3 = class extends _chunk3Y2DQ67Zcjs.Struct { static { _chunkUSNT2KNTcjs.__name.call(void 0, this, "RecipientId"); } static __initStatic3() {this._capnp = { displayName: "RecipientId", id: "89f389b6fd4082c1", size: new (0, _chunk3Y2DQ67Zcjs.ObjectSize)(0, 0) }} toString() { return "RecipientId_" + super.toString(); } }, _class3.__initStatic3(), _class3); var ThirdPartyCapId = (_class4 = class extends _chunk3Y2DQ67Zcjs.Struct { static { _chunkUSNT2KNTcjs.__name.call(void 0, this, "ThirdPartyCapId"); } static __initStatic4() {this._capnp = { displayName: "ThirdPartyCapId", id: "b47f4979672cb59d", size: new (0, _chunk3Y2DQ67Zcjs.ObjectSize)(0, 0) }} toString() { return "ThirdPartyCapId_" + super.toString(); } }, _class4.__initStatic4(), _class4); var JoinKeyPart = (_class5 = class extends _chunk3Y2DQ67Zcjs.Struct { static { _chunkUSNT2KNTcjs.__name.call(void 0, this, "JoinKeyPart"); } static __initStatic5() {this._capnp = { displayName: "JoinKeyPart", id: "95b29059097fca83", size: new (0, _chunk3Y2DQ67Zcjs.ObjectSize)(8, 0) }} /** * A number identifying this join, chosen by the sender. May be reused once `Finish` messages are * sent corresponding to all of the `Join` messages. * */ get joinId() { return _chunk3Y2DQ67Zcjs.utils.getUint32(0, this); } set joinId(value) { _chunk3Y2DQ67Zcjs.utils.setUint32(0, value, this); } /** * The number of capabilities to be joined. * */ get partCount() { return _chunk3Y2DQ67Zcjs.utils.getUint16(4, this); } set partCount(value) { _chunk3Y2DQ67Zcjs.utils.setUint16(4, value, this); } /** * Which part this request targets -- a number in the range [0, partCount). * */ get partNum() { return _chunk3Y2DQ67Zcjs.utils.getUint16(6, this); } set partNum(value) { _chunk3Y2DQ67Zcjs.utils.setUint16(6, value, this); } toString() { return "JoinKeyPart_" + super.toString(); } }, _class5.__initStatic5(), _class5); var JoinResult = (_class6 = class extends _chunk3Y2DQ67Zcjs.Struct { static { _chunkUSNT2KNTcjs.__name.call(void 0, this, "JoinResult"); } static __initStatic6() {this._capnp = { displayName: "JoinResult", id: "9d263a3630b7ebee", size: new (0, _chunk3Y2DQ67Zcjs.ObjectSize)(8, 1) }} /** * Matches `JoinKeyPart`. * */ get joinId() { return _chunk3Y2DQ67Zcjs.utils.getUint32(0, this); } set joinId(value) { _chunk3Y2DQ67Zcjs.utils.setUint32(0, value, this); } /** * All JoinResults in the set will have the same value for `succeeded`. The receiver actually * implements the join by waiting for all the `JoinKeyParts` and then performing its own join on * them, then going back and answering all the join requests afterwards. * */ get succeeded() { return _chunk3Y2DQ67Zcjs.utils.getBit(32, this); } set succeeded(value) { _chunk3Y2DQ67Zcjs.utils.setBit(32, value, this); } _adoptCap(value) { _chunk3Y2DQ67Zcjs.utils.adopt(value, _chunk3Y2DQ67Zcjs.utils.getPointer(0, this)); } _disownCap() { return _chunk3Y2DQ67Zcjs.utils.disown(this.cap); } /** * One of the JoinResults will have a non-null `cap` which is the joined capability. * */ get cap() { return _chunk3Y2DQ67Zcjs.utils.getPointer(0, this); } _hasCap() { return !_chunk3Y2DQ67Zcjs.utils.isNull(_chunk3Y2DQ67Zcjs.utils.getPointer(0, this)); } set cap(value) { _chunk3Y2DQ67Zcjs.utils.copyFrom(value, _chunk3Y2DQ67Zcjs.utils.getPointer(0, this)); } toString() { return "JoinResult_" + super.toString(); } }, _class6.__initStatic6(), _class6); exports.JoinKeyPart = JoinKeyPart; exports.JoinResult = JoinResult; exports.ProvisionId = ProvisionId; exports.RecipientId = RecipientId; exports.Side = Side; exports.ThirdPartyCapId = ThirdPartyCapId; exports.VatId = VatId; exports._capnpFileId = _capnpFileId;