@stryke/capnp 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/capnpc.cjs +62 -30
- package/bin/capnpc.js +62 -30
- package/dist/chunk-3IOIINHW.js +895 -0
- package/dist/chunk-3ZOLKZQQ.cjs +895 -0
- package/dist/chunk-55455L4M.cjs +4103 -0
- package/dist/chunk-5VHN3KGS.js +3305 -0
- package/dist/chunk-CCU32X36.js +15 -0
- package/dist/chunk-GWW6WBAL.js +4103 -0
- package/dist/chunk-IBMXNAOT.cjs +4877 -0
- package/dist/chunk-KXWOF6H4.cjs +3305 -0
- package/dist/chunk-N2KNXTXN.js +4877 -0
- package/dist/chunk-R2JXWA7Q.cjs +15 -0
- package/dist/compile.cjs +7 -72
- package/dist/compile.d.cts +3 -3
- package/dist/compile.d.ts +3 -3
- package/dist/compile.js +6 -71
- package/dist/helpers.cjs +4 -49
- package/dist/helpers.d.cts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/helpers.js +3 -48
- package/dist/index.cjs +138 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +138 -4
- package/dist/rpc.cjs +6 -117
- package/dist/rpc.js +5 -116
- package/dist/types.cjs +3 -8
- package/dist/types.d.cts +13 -4
- package/dist/types.d.ts +13 -4
- package/dist/types.js +3 -8
- package/dts/index.d.cts +14 -5
- package/dts/index.d.ts +14 -5
- package/package.json +4 -4
- package/schemas/persistent.cjs +20 -20
- package/schemas/persistent.js +1 -1
- package/schemas/rpc-twoparty.cjs +32 -32
- package/schemas/rpc-twoparty.js +1 -1
- package/schemas/rpc.cjs +495 -495
- package/schemas/rpc.js +1 -1
- package/schemas/schema.cjs +675 -675
- package/schemas/schema.js +1 -1
- /package/schemas/{chunk-ZGPCLBI4.cjs → chunk-BM2HWFSD.cjs} +0 -0
- /package/schemas/{chunk-3CJYH45H.js → chunk-TAKPBFYZ.js} +0 -0
|
@@ -0,0 +1,4877 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16; var _class17; var _class18; var _class19; var _class20; var _class21; var _class22; var _class23; var _class24; var _class25; var _class26; var _class27; var _class28; var _class29; var _class30; var _class31; var _class32; var _class33; var _class34; var _class35; var _class36; var _class37; var _class38; var _class39; var _class40; var _class41; var _class42; var _class43; var _class44; var _class45;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
var _chunkKXWOF6H4cjs = require('./chunk-KXWOF6H4.cjs');
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs');
|
|
128
|
+
|
|
129
|
+
// ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=503a440bd2bef41c0cb22819bc4ced5a7f04993fb999f0d944e284220f14916b_typescript@5.9.2/node_modules/capnp-es/dist/shared/capnp-es.UAt3nLGq.mjs
|
|
130
|
+
var Interface = (_class = class extends _chunkKXWOF6H4cjs.Pointer {
|
|
131
|
+
static {
|
|
132
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Interface");
|
|
133
|
+
}
|
|
134
|
+
static __initStatic() {this._capnp = {
|
|
135
|
+
displayName: "Interface"
|
|
136
|
+
}}
|
|
137
|
+
static __initStatic2() {this.getCapID = getCapID}
|
|
138
|
+
static __initStatic3() {this.getAsInterface = getAsInterface}
|
|
139
|
+
static __initStatic4() {this.isInterface = isInterface}
|
|
140
|
+
static __initStatic5() {this.getClient = getClient}
|
|
141
|
+
constructor(segment, byteOffset, depthLimit = _chunkKXWOF6H4cjs.MAX_DEPTH) {
|
|
142
|
+
super(segment, byteOffset, depthLimit);
|
|
143
|
+
}
|
|
144
|
+
static fromPointer(p) {
|
|
145
|
+
return getAsInterface(p);
|
|
146
|
+
}
|
|
147
|
+
getCapId() {
|
|
148
|
+
return getCapID(this);
|
|
149
|
+
}
|
|
150
|
+
getClient() {
|
|
151
|
+
return getClient(this);
|
|
152
|
+
}
|
|
153
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
154
|
+
return _chunkKXWOF6H4cjs.format.call(void 0,
|
|
155
|
+
"Interface_%d@%a,%d,limit:%x",
|
|
156
|
+
this.segment.id,
|
|
157
|
+
this.byteOffset,
|
|
158
|
+
this.getCapId(),
|
|
159
|
+
this._capnp.depthLimit
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
}, _class.__initStatic(), _class.__initStatic2(), _class.__initStatic3(), _class.__initStatic4(), _class.__initStatic5(), _class);
|
|
163
|
+
function getAsInterface(p) {
|
|
164
|
+
if (_chunkKXWOF6H4cjs.getTargetPointerType.call(void 0, p) === _chunkKXWOF6H4cjs.PointerType.OTHER) {
|
|
165
|
+
return new Interface(p.segment, p.byteOffset, p._capnp.depthLimit);
|
|
166
|
+
}
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, getAsInterface, "getAsInterface");
|
|
170
|
+
function isInterface(p) {
|
|
171
|
+
return _chunkKXWOF6H4cjs.getTargetPointerType.call(void 0, p) === _chunkKXWOF6H4cjs.PointerType.OTHER;
|
|
172
|
+
}
|
|
173
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, isInterface, "isInterface");
|
|
174
|
+
function getCapID(i) {
|
|
175
|
+
if (i.segment.getUint32(i.byteOffset) !== _chunkKXWOF6H4cjs.PointerType.OTHER) {
|
|
176
|
+
return -1;
|
|
177
|
+
}
|
|
178
|
+
return i.segment.getUint32(i.byteOffset + 4);
|
|
179
|
+
}
|
|
180
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, getCapID, "getCapID");
|
|
181
|
+
function getClient(i) {
|
|
182
|
+
const capID = getCapID(i);
|
|
183
|
+
const { capTable } = i.segment.message._capnp;
|
|
184
|
+
if (!capTable) {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
return capTable[capID];
|
|
188
|
+
}
|
|
189
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, getClient, "getClient");
|
|
190
|
+
function isFuncCall(call) {
|
|
191
|
+
return !isDataCall(call);
|
|
192
|
+
}
|
|
193
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, isFuncCall, "isFuncCall");
|
|
194
|
+
function isDataCall(call) {
|
|
195
|
+
return !!call.params;
|
|
196
|
+
}
|
|
197
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, isDataCall, "isDataCall");
|
|
198
|
+
function copyCall(call) {
|
|
199
|
+
if (isDataCall(call)) {
|
|
200
|
+
return call;
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
method: call.method,
|
|
204
|
+
params: placeParams(call, void 0)
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, copyCall, "copyCall");
|
|
208
|
+
function placeParams(call, contentPtr) {
|
|
209
|
+
if (isDataCall(call)) {
|
|
210
|
+
return call.params;
|
|
211
|
+
}
|
|
212
|
+
let p;
|
|
213
|
+
if (contentPtr) {
|
|
214
|
+
p = new call.method.ParamsClass(
|
|
215
|
+
contentPtr.segment,
|
|
216
|
+
contentPtr.byteOffset,
|
|
217
|
+
contentPtr._capnp.depthLimit
|
|
218
|
+
);
|
|
219
|
+
} else {
|
|
220
|
+
const msg = new (0, _chunkKXWOF6H4cjs.Message)();
|
|
221
|
+
p = new call.method.ParamsClass(msg.getSegment(0), 0);
|
|
222
|
+
}
|
|
223
|
+
_chunkKXWOF6H4cjs.initStruct.call(void 0, call.method.ParamsClass._capnp.size, p);
|
|
224
|
+
if (call.paramsFunc) {
|
|
225
|
+
call.paramsFunc(p);
|
|
226
|
+
}
|
|
227
|
+
return p;
|
|
228
|
+
}
|
|
229
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, placeParams, "placeParams");
|
|
230
|
+
function pointerToStruct(p) {
|
|
231
|
+
if (_chunkKXWOF6H4cjs.getTargetPointerType.call(void 0, p) === _chunkKXWOF6H4cjs.PointerType.STRUCT) {
|
|
232
|
+
return new (0, _chunkKXWOF6H4cjs.Struct)(
|
|
233
|
+
p.segment,
|
|
234
|
+
p.byteOffset,
|
|
235
|
+
p._capnp.depthLimit,
|
|
236
|
+
p._capnp.compositeIndex
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, pointerToStruct, "pointerToStruct");
|
|
242
|
+
function transformPtr(p, transform) {
|
|
243
|
+
if (transform.length === 0) {
|
|
244
|
+
return p;
|
|
245
|
+
}
|
|
246
|
+
let s = pointerToStruct(p);
|
|
247
|
+
if (!s) {
|
|
248
|
+
return p;
|
|
249
|
+
}
|
|
250
|
+
for (const op of transform) {
|
|
251
|
+
s = _chunkKXWOF6H4cjs.getPointer.call(void 0, op.field, s);
|
|
252
|
+
}
|
|
253
|
+
return s;
|
|
254
|
+
}
|
|
255
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, transformPtr, "transformPtr");
|
|
256
|
+
var Deferred = class _Deferred {
|
|
257
|
+
static {
|
|
258
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Deferred");
|
|
259
|
+
}
|
|
260
|
+
static fromPromise(p) {
|
|
261
|
+
const d = new _Deferred();
|
|
262
|
+
p.then(d.resolve, d.reject);
|
|
263
|
+
return d;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
constructor() {
|
|
269
|
+
this.promise = new Promise((a, b) => {
|
|
270
|
+
this.resolve = a;
|
|
271
|
+
this.reject = b;
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
var ImmediateAnswer = class extends _chunkKXWOF6H4cjs.FixedAnswer {
|
|
276
|
+
static {
|
|
277
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "ImmediateAnswer");
|
|
278
|
+
}
|
|
279
|
+
constructor(s) {
|
|
280
|
+
super();
|
|
281
|
+
this.s = s;
|
|
282
|
+
}
|
|
283
|
+
structSync() {
|
|
284
|
+
return this.s;
|
|
285
|
+
}
|
|
286
|
+
findClient(transform) {
|
|
287
|
+
const p = transformPtr(this.s, transform);
|
|
288
|
+
return _chunkKXWOF6H4cjs.getInterfaceClientOrNull.call(void 0, p);
|
|
289
|
+
}
|
|
290
|
+
pipelineCall(transform, call) {
|
|
291
|
+
return this.findClient(transform).call(call);
|
|
292
|
+
}
|
|
293
|
+
pipelineClose(transform) {
|
|
294
|
+
this.findClient(transform).close();
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
var Queue = (_class2 = class {
|
|
298
|
+
static {
|
|
299
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Queue");
|
|
300
|
+
}
|
|
301
|
+
// creates a new queue that starts with n elements.
|
|
302
|
+
// The interface's length must not change over the course of
|
|
303
|
+
// the queue's usage.
|
|
304
|
+
constructor(q, n) {;_class2.prototype.__init.call(this);
|
|
305
|
+
this.q = q;
|
|
306
|
+
this.n = n;
|
|
307
|
+
this.cap = q.len();
|
|
308
|
+
}
|
|
309
|
+
__init() {this.start = 0}
|
|
310
|
+
|
|
311
|
+
// len returns the length of the queue. This is different from the underlying
|
|
312
|
+
// interface's length, which is the queue's capacity.
|
|
313
|
+
len() {
|
|
314
|
+
return this.n;
|
|
315
|
+
}
|
|
316
|
+
// push reserves space for an element on the queue, returning its index.
|
|
317
|
+
// if the queue is full, push returns -1.
|
|
318
|
+
push() {
|
|
319
|
+
if (this.n >= this.cap) {
|
|
320
|
+
return -1;
|
|
321
|
+
}
|
|
322
|
+
const i = (this.start + this.n) % this.cap;
|
|
323
|
+
this.n++;
|
|
324
|
+
return i;
|
|
325
|
+
}
|
|
326
|
+
// front returns the index of the front of the queue, or -1 if the queue is empty.
|
|
327
|
+
front() {
|
|
328
|
+
if (this.n === 0) {
|
|
329
|
+
return -1;
|
|
330
|
+
}
|
|
331
|
+
return this.start;
|
|
332
|
+
}
|
|
333
|
+
// pop pops an element from the queue, returning whether it succeeded.
|
|
334
|
+
pop() {
|
|
335
|
+
if (this.n === 0) {
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
this.q.clear(this.start);
|
|
339
|
+
this.start = (this.start + 1) % this.cap;
|
|
340
|
+
this.n--;
|
|
341
|
+
return true;
|
|
342
|
+
}
|
|
343
|
+
}, _class2);
|
|
344
|
+
var EmbargoClient = class {
|
|
345
|
+
static {
|
|
346
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "EmbargoClient");
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
constructor(client, queue) {
|
|
352
|
+
this._client = client;
|
|
353
|
+
this.calls = queue.copy();
|
|
354
|
+
this.q = new Queue(this.calls, this.calls.len());
|
|
355
|
+
this.flushQueue();
|
|
356
|
+
}
|
|
357
|
+
flushQueue() {
|
|
358
|
+
let c = null;
|
|
359
|
+
{
|
|
360
|
+
const i = this.q.front();
|
|
361
|
+
if (i !== -1) {
|
|
362
|
+
c = this.calls.data[i];
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
while (c && c.call) {
|
|
366
|
+
const ans = this._client.call(c.call);
|
|
367
|
+
void (async (f, ans2) => {
|
|
368
|
+
try {
|
|
369
|
+
f.fulfill(await ans2.struct());
|
|
370
|
+
} catch (error_) {
|
|
371
|
+
f.reject(error_);
|
|
372
|
+
}
|
|
373
|
+
})(c.f, ans);
|
|
374
|
+
this.q.pop();
|
|
375
|
+
{
|
|
376
|
+
const i = this.q.front();
|
|
377
|
+
c = i === -1 ? null : this.calls.data[i];
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
// client returns the underlying client if the embargo has
|
|
382
|
+
// been lifted and null otherwise
|
|
383
|
+
client() {
|
|
384
|
+
return this.isPassthrough() ? this._client : null;
|
|
385
|
+
}
|
|
386
|
+
isPassthrough() {
|
|
387
|
+
return this.q.len() === 0;
|
|
388
|
+
}
|
|
389
|
+
// call either queues a call to the underlying client or starts a
|
|
390
|
+
// call if the embargo has been lifted
|
|
391
|
+
call(call) {
|
|
392
|
+
if (this.isPassthrough()) {
|
|
393
|
+
return this._client.call(call);
|
|
394
|
+
}
|
|
395
|
+
return this.push(call);
|
|
396
|
+
}
|
|
397
|
+
push(_call) {
|
|
398
|
+
const f = new Fulfiller();
|
|
399
|
+
const call = copyCall(_call);
|
|
400
|
+
const i = this.q.push();
|
|
401
|
+
if (i === -1) {
|
|
402
|
+
return new (0, _chunkKXWOF6H4cjs.ErrorAnswer)(new Error(_chunkKXWOF6H4cjs.RPC_CALL_QUEUE_FULL));
|
|
403
|
+
}
|
|
404
|
+
this.calls.data[i] = {
|
|
405
|
+
call,
|
|
406
|
+
f
|
|
407
|
+
};
|
|
408
|
+
return f;
|
|
409
|
+
}
|
|
410
|
+
close() {
|
|
411
|
+
while (this.q.len() > 0) {
|
|
412
|
+
const first = this.calls.data[this.q.front()];
|
|
413
|
+
if (!first) {
|
|
414
|
+
throw new Error(_chunkKXWOF6H4cjs.INVARIANT_UNREACHABLE_CODE);
|
|
415
|
+
}
|
|
416
|
+
first.f.reject(new Error(_chunkKXWOF6H4cjs.RPC_QUEUE_CALL_CANCEL));
|
|
417
|
+
this.q.pop();
|
|
418
|
+
}
|
|
419
|
+
this._client.close();
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
var Ecalls = class _Ecalls {
|
|
423
|
+
static {
|
|
424
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Ecalls");
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
constructor(data) {
|
|
428
|
+
this.data = data;
|
|
429
|
+
}
|
|
430
|
+
static copyOf(data) {
|
|
431
|
+
return new _Ecalls([...data]);
|
|
432
|
+
}
|
|
433
|
+
len() {
|
|
434
|
+
return this.data.length;
|
|
435
|
+
}
|
|
436
|
+
clear(i) {
|
|
437
|
+
this.data[i] = null;
|
|
438
|
+
}
|
|
439
|
+
copy() {
|
|
440
|
+
return _Ecalls.copyOf(this.data);
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
var callQueueSize = 64;
|
|
444
|
+
var Fulfiller = (_class3 = class _Fulfiller {constructor() { _class3.prototype.__init2.call(this);_class3.prototype.__init3.call(this);_class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this); }
|
|
445
|
+
static {
|
|
446
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Fulfiller");
|
|
447
|
+
}
|
|
448
|
+
__init2() {this.resolved = false}
|
|
449
|
+
|
|
450
|
+
__init3() {this.queue = []}
|
|
451
|
+
__init4() {this.queueCap = callQueueSize}
|
|
452
|
+
__init5() {this.deferred = new Deferred()}
|
|
453
|
+
fulfill(s) {
|
|
454
|
+
this.answer = new ImmediateAnswer(s);
|
|
455
|
+
const queues = this.emptyQueue(s);
|
|
456
|
+
const msgcap = s.segment.message._capnp;
|
|
457
|
+
if (!msgcap.capTable) {
|
|
458
|
+
msgcap.capTable = [];
|
|
459
|
+
}
|
|
460
|
+
const ctab = msgcap.capTable;
|
|
461
|
+
for (const _capIdx of Object.keys(queues)) {
|
|
462
|
+
const capIdx = +_capIdx;
|
|
463
|
+
const q = queues[capIdx];
|
|
464
|
+
const client = ctab[capIdx];
|
|
465
|
+
if (!client) {
|
|
466
|
+
throw new Error(_chunkKXWOF6H4cjs.INVARIANT_UNREACHABLE_CODE);
|
|
467
|
+
}
|
|
468
|
+
ctab[capIdx] = new EmbargoClient(client, q);
|
|
469
|
+
}
|
|
470
|
+
this.deferred.resolve(s);
|
|
471
|
+
}
|
|
472
|
+
reject(err) {
|
|
473
|
+
this.deferred.reject(err);
|
|
474
|
+
}
|
|
475
|
+
peek() {
|
|
476
|
+
return this.answer;
|
|
477
|
+
}
|
|
478
|
+
async struct() {
|
|
479
|
+
return await this.deferred.promise;
|
|
480
|
+
}
|
|
481
|
+
// pipelineCall calls pipelineCall on the fulfilled answer or
|
|
482
|
+
// queues the call if f has not been fulfilled
|
|
483
|
+
pipelineCall(transform, call) {
|
|
484
|
+
{
|
|
485
|
+
const a = this.peek();
|
|
486
|
+
if (a) {
|
|
487
|
+
return a.pipelineCall(transform, call);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
if (this.queue.length === this.queueCap) {
|
|
491
|
+
return new (0, _chunkKXWOF6H4cjs.ErrorAnswer)(new Error(_chunkKXWOF6H4cjs.RPC_CALL_QUEUE_FULL));
|
|
492
|
+
}
|
|
493
|
+
const cc = copyCall(call);
|
|
494
|
+
const g = new _Fulfiller();
|
|
495
|
+
this.queue.push({
|
|
496
|
+
call: cc,
|
|
497
|
+
f: g,
|
|
498
|
+
transform
|
|
499
|
+
});
|
|
500
|
+
return g;
|
|
501
|
+
}
|
|
502
|
+
// pipelineClose waits until f is resolved and then calls
|
|
503
|
+
// pipelineClose on the fulfilled answer
|
|
504
|
+
// FIXME: should this be async?
|
|
505
|
+
pipelineClose(transform) {
|
|
506
|
+
const onFinally = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, () => {
|
|
507
|
+
if (this.answer) {
|
|
508
|
+
this.answer.pipelineClose(transform);
|
|
509
|
+
}
|
|
510
|
+
}, "onFinally");
|
|
511
|
+
this.deferred.promise.then(onFinally, onFinally);
|
|
512
|
+
}
|
|
513
|
+
// emptyQueue splits the queue by which capability it targets and
|
|
514
|
+
// drops any invalid calls. Once this function returns, f.queue will
|
|
515
|
+
// be nil.
|
|
516
|
+
emptyQueue(s) {
|
|
517
|
+
const qs = {};
|
|
518
|
+
for (let i = 0; i < this.queue.length; i++) {
|
|
519
|
+
const pc = this.queue[i];
|
|
520
|
+
let c;
|
|
521
|
+
try {
|
|
522
|
+
c = transformPtr(s, pc.transform);
|
|
523
|
+
} catch (error_) {
|
|
524
|
+
pc.f.reject(error_);
|
|
525
|
+
continue;
|
|
526
|
+
}
|
|
527
|
+
const iface = Interface.fromPointer(c);
|
|
528
|
+
if (!iface) {
|
|
529
|
+
pc.f.reject(new Error(_chunkKXWOF6H4cjs.RPC_NULL_CLIENT));
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
532
|
+
const cn = iface.getCapId();
|
|
533
|
+
if (!qs[cn]) {
|
|
534
|
+
qs[cn] = new Ecalls([]);
|
|
535
|
+
}
|
|
536
|
+
qs[cn].data.push(pc);
|
|
537
|
+
}
|
|
538
|
+
this.queue = [];
|
|
539
|
+
return qs;
|
|
540
|
+
}
|
|
541
|
+
}, _class3);
|
|
542
|
+
var PipelineClient = class {
|
|
543
|
+
static {
|
|
544
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "PipelineClient");
|
|
545
|
+
}
|
|
546
|
+
constructor(pipeline) {
|
|
547
|
+
this.pipeline = pipeline;
|
|
548
|
+
}
|
|
549
|
+
transform() {
|
|
550
|
+
return this.pipeline.transform();
|
|
551
|
+
}
|
|
552
|
+
call(call) {
|
|
553
|
+
return this.pipeline.answer.pipelineCall(this.transform(), call);
|
|
554
|
+
}
|
|
555
|
+
close() {
|
|
556
|
+
this.pipeline.answer.pipelineClose(this.transform());
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
var Pipeline = class _Pipeline {
|
|
560
|
+
static {
|
|
561
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Pipeline");
|
|
562
|
+
}
|
|
563
|
+
// Returns a new Pipeline based on an answer
|
|
564
|
+
constructor(ResultsClass, answer, op, parent) {
|
|
565
|
+
this.ResultsClass = ResultsClass;
|
|
566
|
+
this.answer = answer;
|
|
567
|
+
this.parent = parent;
|
|
568
|
+
this.op = op || { field: 0 };
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
// transform returns the operations needed to transform the root answer
|
|
573
|
+
// into the value p represents.
|
|
574
|
+
transform() {
|
|
575
|
+
const xform = [];
|
|
576
|
+
for (let q = this; q.parent; q = q.parent) {
|
|
577
|
+
xform.unshift(q.op);
|
|
578
|
+
}
|
|
579
|
+
return xform;
|
|
580
|
+
}
|
|
581
|
+
// Struct waits until the answer is resolved and returns the struct
|
|
582
|
+
// this pipeline represents.
|
|
583
|
+
async struct() {
|
|
584
|
+
const s = await this.answer.struct();
|
|
585
|
+
const t = transformPtr(s, this.transform());
|
|
586
|
+
if (!t) {
|
|
587
|
+
if (this.op.defaultValue) {
|
|
588
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, this.op.defaultValue, t);
|
|
589
|
+
} else {
|
|
590
|
+
_chunkKXWOF6H4cjs.initStruct.call(void 0, this.ResultsClass._capnp.size, t);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
return _chunkKXWOF6H4cjs.getAs.call(void 0, this.ResultsClass, t);
|
|
594
|
+
}
|
|
595
|
+
// client returns the client version of this pipeline
|
|
596
|
+
client() {
|
|
597
|
+
if (!this.pipelineClient) {
|
|
598
|
+
this.pipelineClient = new PipelineClient(this);
|
|
599
|
+
}
|
|
600
|
+
return this.pipelineClient;
|
|
601
|
+
}
|
|
602
|
+
// getPipeline returns a derived pipeline which yields the pointer field given
|
|
603
|
+
getPipeline(ResultsClass, off, defaultValue) {
|
|
604
|
+
return new _Pipeline(
|
|
605
|
+
ResultsClass,
|
|
606
|
+
this.answer,
|
|
607
|
+
{ field: off, defaultValue },
|
|
608
|
+
this
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
var MethodError = class extends Error {
|
|
613
|
+
static {
|
|
614
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "MethodError");
|
|
615
|
+
}
|
|
616
|
+
constructor(method, message) {
|
|
617
|
+
super(
|
|
618
|
+
_chunkKXWOF6H4cjs.format.call(void 0,
|
|
619
|
+
_chunkKXWOF6H4cjs.RPC_METHOD_ERROR,
|
|
620
|
+
method.interfaceName,
|
|
621
|
+
method.methodName,
|
|
622
|
+
message
|
|
623
|
+
)
|
|
624
|
+
);
|
|
625
|
+
this.method = method;
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
var Registry = (_class4 = class {
|
|
629
|
+
static {
|
|
630
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Registry");
|
|
631
|
+
}
|
|
632
|
+
static __initStatic6() {this.interfaces = /* @__PURE__ */ new Map()}
|
|
633
|
+
static register(id, def) {
|
|
634
|
+
this.interfaces.set(id, def);
|
|
635
|
+
}
|
|
636
|
+
static lookup(id) {
|
|
637
|
+
return this.interfaces.get(id);
|
|
638
|
+
}
|
|
639
|
+
}, _class4.__initStatic6(), _class4);
|
|
640
|
+
var Server = class {
|
|
641
|
+
static {
|
|
642
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Server");
|
|
643
|
+
}
|
|
644
|
+
constructor(target, methods) {
|
|
645
|
+
this.target = target;
|
|
646
|
+
this.methods = methods;
|
|
647
|
+
}
|
|
648
|
+
startCall(call) {
|
|
649
|
+
const msg = new (0, _chunkKXWOF6H4cjs.Message)();
|
|
650
|
+
const results = msg.initRoot(call.method.ResultsClass);
|
|
651
|
+
call.serverMethod.impl.call(this.target, call.params, results).then(() => call.answer.fulfill(results)).catch((error_) => call.answer.reject(error_));
|
|
652
|
+
}
|
|
653
|
+
call(call) {
|
|
654
|
+
const serverMethod = this.methods[call.method.methodId];
|
|
655
|
+
if (!serverMethod) {
|
|
656
|
+
return new (0, _chunkKXWOF6H4cjs.ErrorAnswer)(
|
|
657
|
+
new MethodError(call.method, _chunkKXWOF6H4cjs.RPC_METHOD_NOT_IMPLEMENTED)
|
|
658
|
+
);
|
|
659
|
+
}
|
|
660
|
+
const serverCall = {
|
|
661
|
+
...copyCall(call),
|
|
662
|
+
answer: new Fulfiller(),
|
|
663
|
+
serverMethod
|
|
664
|
+
};
|
|
665
|
+
this.startCall(serverCall);
|
|
666
|
+
return serverCall.answer;
|
|
667
|
+
}
|
|
668
|
+
close() {
|
|
669
|
+
}
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
// ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=503a440bd2bef41c0cb22819bc4ced5a7f04993fb999f0d944e284220f14916b_typescript@5.9.2/node_modules/capnp-es/dist/capnp/rpc.mjs
|
|
673
|
+
var _capnpFileId = BigInt("0xb312981b2552a250");
|
|
674
|
+
var Message_Which = {
|
|
675
|
+
/**
|
|
676
|
+
* The sender previously received this message from the peer but didn't understand it or doesn't
|
|
677
|
+
* yet implement the functionality that was requested. So, the sender is echoing the message
|
|
678
|
+
* back. In some cases, the receiver may be able to recover from this by pretending the sender
|
|
679
|
+
* had taken some appropriate "null" action.
|
|
680
|
+
*
|
|
681
|
+
* For example, say `resolve` is received by a level 0 implementation (because a previous call
|
|
682
|
+
* or return happened to contain a promise). The level 0 implementation will echo it back as
|
|
683
|
+
* `unimplemented`. The original sender can then simply release the cap to which the promise
|
|
684
|
+
* had resolved, thus avoiding a leak.
|
|
685
|
+
*
|
|
686
|
+
* For any message type that introduces a question, if the message comes back unimplemented,
|
|
687
|
+
* the original sender may simply treat it as if the question failed with an exception.
|
|
688
|
+
*
|
|
689
|
+
* In cases where there is no sensible way to react to an `unimplemented` message (without
|
|
690
|
+
* resource leaks or other serious problems), the connection may need to be aborted. This is
|
|
691
|
+
* a gray area; different implementations may take different approaches.
|
|
692
|
+
*
|
|
693
|
+
*/
|
|
694
|
+
UNIMPLEMENTED: 0,
|
|
695
|
+
/**
|
|
696
|
+
* Sent when a connection is being aborted due to an unrecoverable error. This could be e.g.
|
|
697
|
+
* because the sender received an invalid or nonsensical message or because the sender had an
|
|
698
|
+
* internal error. The sender will shut down the outgoing half of the connection after `abort`
|
|
699
|
+
* and will completely close the connection shortly thereafter (it's up to the sender how much
|
|
700
|
+
* of a time buffer they want to offer for the client to receive the `abort` before the
|
|
701
|
+
* connection is reset).
|
|
702
|
+
*
|
|
703
|
+
*/
|
|
704
|
+
ABORT: 1,
|
|
705
|
+
/**
|
|
706
|
+
* Request the peer's bootstrap interface.
|
|
707
|
+
*
|
|
708
|
+
*/
|
|
709
|
+
BOOTSTRAP: 8,
|
|
710
|
+
/**
|
|
711
|
+
* Begin a method call.
|
|
712
|
+
*
|
|
713
|
+
*/
|
|
714
|
+
CALL: 2,
|
|
715
|
+
/**
|
|
716
|
+
* Complete a method call.
|
|
717
|
+
*
|
|
718
|
+
*/
|
|
719
|
+
RETURN: 3,
|
|
720
|
+
/**
|
|
721
|
+
* Release a returned answer / cancel a call.
|
|
722
|
+
*
|
|
723
|
+
*/
|
|
724
|
+
FINISH: 4,
|
|
725
|
+
/**
|
|
726
|
+
* Resolve a previously-sent promise.
|
|
727
|
+
*
|
|
728
|
+
*/
|
|
729
|
+
RESOLVE: 5,
|
|
730
|
+
/**
|
|
731
|
+
* Release a capability so that the remote object can be deallocated.
|
|
732
|
+
*
|
|
733
|
+
*/
|
|
734
|
+
RELEASE: 6,
|
|
735
|
+
/**
|
|
736
|
+
* Lift an embargo used to enforce E-order over promise resolution.
|
|
737
|
+
*
|
|
738
|
+
*/
|
|
739
|
+
DISEMBARGO: 13,
|
|
740
|
+
/**
|
|
741
|
+
* Obsolete request to save a capability, resulting in a SturdyRef. This has been replaced
|
|
742
|
+
* by the `Persistent` interface defined in `persistent.capnp`. This operation was never
|
|
743
|
+
* implemented.
|
|
744
|
+
*
|
|
745
|
+
*/
|
|
746
|
+
OBSOLETE_SAVE: 7,
|
|
747
|
+
/**
|
|
748
|
+
* Obsolete way to delete a SturdyRef. This operation was never implemented.
|
|
749
|
+
*
|
|
750
|
+
*/
|
|
751
|
+
OBSOLETE_DELETE: 9,
|
|
752
|
+
/**
|
|
753
|
+
* Provide a capability to a third party.
|
|
754
|
+
*
|
|
755
|
+
*/
|
|
756
|
+
PROVIDE: 10,
|
|
757
|
+
/**
|
|
758
|
+
* Accept a capability provided by a third party.
|
|
759
|
+
*
|
|
760
|
+
*/
|
|
761
|
+
ACCEPT: 11,
|
|
762
|
+
/**
|
|
763
|
+
* Directly connect to the common root of two or more proxied caps.
|
|
764
|
+
*
|
|
765
|
+
*/
|
|
766
|
+
JOIN: 12
|
|
767
|
+
};
|
|
768
|
+
var Message2 = (_class5 = class _Message extends _chunkKXWOF6H4cjs.Struct {
|
|
769
|
+
static {
|
|
770
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Message");
|
|
771
|
+
}
|
|
772
|
+
static __initStatic7() {this.UNIMPLEMENTED = Message_Which.UNIMPLEMENTED}
|
|
773
|
+
static __initStatic8() {this.ABORT = Message_Which.ABORT}
|
|
774
|
+
static __initStatic9() {this.BOOTSTRAP = Message_Which.BOOTSTRAP}
|
|
775
|
+
static __initStatic10() {this.CALL = Message_Which.CALL}
|
|
776
|
+
static __initStatic11() {this.RETURN = Message_Which.RETURN}
|
|
777
|
+
static __initStatic12() {this.FINISH = Message_Which.FINISH}
|
|
778
|
+
static __initStatic13() {this.RESOLVE = Message_Which.RESOLVE}
|
|
779
|
+
static __initStatic14() {this.RELEASE = Message_Which.RELEASE}
|
|
780
|
+
static __initStatic15() {this.DISEMBARGO = Message_Which.DISEMBARGO}
|
|
781
|
+
static __initStatic16() {this.OBSOLETE_SAVE = Message_Which.OBSOLETE_SAVE}
|
|
782
|
+
static __initStatic17() {this.OBSOLETE_DELETE = Message_Which.OBSOLETE_DELETE}
|
|
783
|
+
static __initStatic18() {this.PROVIDE = Message_Which.PROVIDE}
|
|
784
|
+
static __initStatic19() {this.ACCEPT = Message_Which.ACCEPT}
|
|
785
|
+
static __initStatic20() {this.JOIN = Message_Which.JOIN}
|
|
786
|
+
static __initStatic21() {this._capnp = {
|
|
787
|
+
displayName: "Message",
|
|
788
|
+
id: "91b79f1f808db032",
|
|
789
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(8, 1)
|
|
790
|
+
}}
|
|
791
|
+
_adoptUnimplemented(value) {
|
|
792
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 0, this);
|
|
793
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
794
|
+
}
|
|
795
|
+
_disownUnimplemented() {
|
|
796
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.unimplemented);
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* The sender previously received this message from the peer but didn't understand it or doesn't
|
|
800
|
+
* yet implement the functionality that was requested. So, the sender is echoing the message
|
|
801
|
+
* back. In some cases, the receiver may be able to recover from this by pretending the sender
|
|
802
|
+
* had taken some appropriate "null" action.
|
|
803
|
+
*
|
|
804
|
+
* For example, say `resolve` is received by a level 0 implementation (because a previous call
|
|
805
|
+
* or return happened to contain a promise). The level 0 implementation will echo it back as
|
|
806
|
+
* `unimplemented`. The original sender can then simply release the cap to which the promise
|
|
807
|
+
* had resolved, thus avoiding a leak.
|
|
808
|
+
*
|
|
809
|
+
* For any message type that introduces a question, if the message comes back unimplemented,
|
|
810
|
+
* the original sender may simply treat it as if the question failed with an exception.
|
|
811
|
+
*
|
|
812
|
+
* In cases where there is no sensible way to react to an `unimplemented` message (without
|
|
813
|
+
* resource leaks or other serious problems), the connection may need to be aborted. This is
|
|
814
|
+
* a gray area; different implementations may take different approaches.
|
|
815
|
+
*
|
|
816
|
+
*/
|
|
817
|
+
get unimplemented() {
|
|
818
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "unimplemented", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 0, this);
|
|
819
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, _Message, this);
|
|
820
|
+
}
|
|
821
|
+
_hasUnimplemented() {
|
|
822
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
823
|
+
}
|
|
824
|
+
_initUnimplemented() {
|
|
825
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 0, this);
|
|
826
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, _Message, this);
|
|
827
|
+
}
|
|
828
|
+
get _isUnimplemented() {
|
|
829
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 0;
|
|
830
|
+
}
|
|
831
|
+
set unimplemented(value) {
|
|
832
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 0, this);
|
|
833
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
834
|
+
}
|
|
835
|
+
_adoptAbort(value) {
|
|
836
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 1, this);
|
|
837
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
838
|
+
}
|
|
839
|
+
_disownAbort() {
|
|
840
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.abort);
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Sent when a connection is being aborted due to an unrecoverable error. This could be e.g.
|
|
844
|
+
* because the sender received an invalid or nonsensical message or because the sender had an
|
|
845
|
+
* internal error. The sender will shut down the outgoing half of the connection after `abort`
|
|
846
|
+
* and will completely close the connection shortly thereafter (it's up to the sender how much
|
|
847
|
+
* of a time buffer they want to offer for the client to receive the `abort` before the
|
|
848
|
+
* connection is reset).
|
|
849
|
+
*
|
|
850
|
+
*/
|
|
851
|
+
get abort() {
|
|
852
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "abort", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 1, this);
|
|
853
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, Exception, this);
|
|
854
|
+
}
|
|
855
|
+
_hasAbort() {
|
|
856
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
857
|
+
}
|
|
858
|
+
_initAbort() {
|
|
859
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 1, this);
|
|
860
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, Exception, this);
|
|
861
|
+
}
|
|
862
|
+
get _isAbort() {
|
|
863
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 1;
|
|
864
|
+
}
|
|
865
|
+
set abort(value) {
|
|
866
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 1, this);
|
|
867
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
868
|
+
}
|
|
869
|
+
_adoptBootstrap(value) {
|
|
870
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 8, this);
|
|
871
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
872
|
+
}
|
|
873
|
+
_disownBootstrap() {
|
|
874
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.bootstrap);
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* Request the peer's bootstrap interface.
|
|
878
|
+
*
|
|
879
|
+
*/
|
|
880
|
+
get bootstrap() {
|
|
881
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "bootstrap", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 8, this);
|
|
882
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, Bootstrap, this);
|
|
883
|
+
}
|
|
884
|
+
_hasBootstrap() {
|
|
885
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
886
|
+
}
|
|
887
|
+
_initBootstrap() {
|
|
888
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 8, this);
|
|
889
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, Bootstrap, this);
|
|
890
|
+
}
|
|
891
|
+
get _isBootstrap() {
|
|
892
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 8;
|
|
893
|
+
}
|
|
894
|
+
set bootstrap(value) {
|
|
895
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 8, this);
|
|
896
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
897
|
+
}
|
|
898
|
+
_adoptCall(value) {
|
|
899
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 2, this);
|
|
900
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
901
|
+
}
|
|
902
|
+
_disownCall() {
|
|
903
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.call);
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* Begin a method call.
|
|
907
|
+
*
|
|
908
|
+
*/
|
|
909
|
+
get call() {
|
|
910
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "call", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 2, this);
|
|
911
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, Call, this);
|
|
912
|
+
}
|
|
913
|
+
_hasCall() {
|
|
914
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
915
|
+
}
|
|
916
|
+
_initCall() {
|
|
917
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 2, this);
|
|
918
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, Call, this);
|
|
919
|
+
}
|
|
920
|
+
get _isCall() {
|
|
921
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 2;
|
|
922
|
+
}
|
|
923
|
+
set call(value) {
|
|
924
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 2, this);
|
|
925
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
926
|
+
}
|
|
927
|
+
_adoptReturn(value) {
|
|
928
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 3, this);
|
|
929
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
930
|
+
}
|
|
931
|
+
_disownReturn() {
|
|
932
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.return);
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* Complete a method call.
|
|
936
|
+
*
|
|
937
|
+
*/
|
|
938
|
+
get return() {
|
|
939
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "return", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 3, this);
|
|
940
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, Return, this);
|
|
941
|
+
}
|
|
942
|
+
_hasReturn() {
|
|
943
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
944
|
+
}
|
|
945
|
+
_initReturn() {
|
|
946
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 3, this);
|
|
947
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, Return, this);
|
|
948
|
+
}
|
|
949
|
+
get _isReturn() {
|
|
950
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 3;
|
|
951
|
+
}
|
|
952
|
+
set return(value) {
|
|
953
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 3, this);
|
|
954
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
955
|
+
}
|
|
956
|
+
_adoptFinish(value) {
|
|
957
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 4, this);
|
|
958
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
959
|
+
}
|
|
960
|
+
_disownFinish() {
|
|
961
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.finish);
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* Release a returned answer / cancel a call.
|
|
965
|
+
*
|
|
966
|
+
*/
|
|
967
|
+
get finish() {
|
|
968
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "finish", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 4, this);
|
|
969
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, Finish, this);
|
|
970
|
+
}
|
|
971
|
+
_hasFinish() {
|
|
972
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
973
|
+
}
|
|
974
|
+
_initFinish() {
|
|
975
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 4, this);
|
|
976
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, Finish, this);
|
|
977
|
+
}
|
|
978
|
+
get _isFinish() {
|
|
979
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 4;
|
|
980
|
+
}
|
|
981
|
+
set finish(value) {
|
|
982
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 4, this);
|
|
983
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
984
|
+
}
|
|
985
|
+
_adoptResolve(value) {
|
|
986
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 5, this);
|
|
987
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
988
|
+
}
|
|
989
|
+
_disownResolve() {
|
|
990
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.resolve);
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* Resolve a previously-sent promise.
|
|
994
|
+
*
|
|
995
|
+
*/
|
|
996
|
+
get resolve() {
|
|
997
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "resolve", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 5, this);
|
|
998
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, Resolve, this);
|
|
999
|
+
}
|
|
1000
|
+
_hasResolve() {
|
|
1001
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1002
|
+
}
|
|
1003
|
+
_initResolve() {
|
|
1004
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 5, this);
|
|
1005
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, Resolve, this);
|
|
1006
|
+
}
|
|
1007
|
+
get _isResolve() {
|
|
1008
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 5;
|
|
1009
|
+
}
|
|
1010
|
+
set resolve(value) {
|
|
1011
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 5, this);
|
|
1012
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1013
|
+
}
|
|
1014
|
+
_adoptRelease(value) {
|
|
1015
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 6, this);
|
|
1016
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1017
|
+
}
|
|
1018
|
+
_disownRelease() {
|
|
1019
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.release);
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Release a capability so that the remote object can be deallocated.
|
|
1023
|
+
*
|
|
1024
|
+
*/
|
|
1025
|
+
get release() {
|
|
1026
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "release", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 6, this);
|
|
1027
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, Release, this);
|
|
1028
|
+
}
|
|
1029
|
+
_hasRelease() {
|
|
1030
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1031
|
+
}
|
|
1032
|
+
_initRelease() {
|
|
1033
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 6, this);
|
|
1034
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, Release, this);
|
|
1035
|
+
}
|
|
1036
|
+
get _isRelease() {
|
|
1037
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 6;
|
|
1038
|
+
}
|
|
1039
|
+
set release(value) {
|
|
1040
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 6, this);
|
|
1041
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1042
|
+
}
|
|
1043
|
+
_adoptDisembargo(value) {
|
|
1044
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 13, this);
|
|
1045
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1046
|
+
}
|
|
1047
|
+
_disownDisembargo() {
|
|
1048
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.disembargo);
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Lift an embargo used to enforce E-order over promise resolution.
|
|
1052
|
+
*
|
|
1053
|
+
*/
|
|
1054
|
+
get disembargo() {
|
|
1055
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "disembargo", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 13, this);
|
|
1056
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, Disembargo, this);
|
|
1057
|
+
}
|
|
1058
|
+
_hasDisembargo() {
|
|
1059
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1060
|
+
}
|
|
1061
|
+
_initDisembargo() {
|
|
1062
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 13, this);
|
|
1063
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, Disembargo, this);
|
|
1064
|
+
}
|
|
1065
|
+
get _isDisembargo() {
|
|
1066
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 13;
|
|
1067
|
+
}
|
|
1068
|
+
set disembargo(value) {
|
|
1069
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 13, this);
|
|
1070
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1071
|
+
}
|
|
1072
|
+
_adoptObsoleteSave(value) {
|
|
1073
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 7, this);
|
|
1074
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1075
|
+
}
|
|
1076
|
+
_disownObsoleteSave() {
|
|
1077
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.obsoleteSave);
|
|
1078
|
+
}
|
|
1079
|
+
/**
|
|
1080
|
+
* Obsolete request to save a capability, resulting in a SturdyRef. This has been replaced
|
|
1081
|
+
* by the `Persistent` interface defined in `persistent.capnp`. This operation was never
|
|
1082
|
+
* implemented.
|
|
1083
|
+
*
|
|
1084
|
+
*/
|
|
1085
|
+
get obsoleteSave() {
|
|
1086
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "obsoleteSave", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 7, this);
|
|
1087
|
+
return _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this);
|
|
1088
|
+
}
|
|
1089
|
+
_hasObsoleteSave() {
|
|
1090
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1091
|
+
}
|
|
1092
|
+
get _isObsoleteSave() {
|
|
1093
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 7;
|
|
1094
|
+
}
|
|
1095
|
+
set obsoleteSave(value) {
|
|
1096
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 7, this);
|
|
1097
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1098
|
+
}
|
|
1099
|
+
_adoptObsoleteDelete(value) {
|
|
1100
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 9, this);
|
|
1101
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1102
|
+
}
|
|
1103
|
+
_disownObsoleteDelete() {
|
|
1104
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.obsoleteDelete);
|
|
1105
|
+
}
|
|
1106
|
+
/**
|
|
1107
|
+
* Obsolete way to delete a SturdyRef. This operation was never implemented.
|
|
1108
|
+
*
|
|
1109
|
+
*/
|
|
1110
|
+
get obsoleteDelete() {
|
|
1111
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "obsoleteDelete", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 9, this);
|
|
1112
|
+
return _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this);
|
|
1113
|
+
}
|
|
1114
|
+
_hasObsoleteDelete() {
|
|
1115
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1116
|
+
}
|
|
1117
|
+
get _isObsoleteDelete() {
|
|
1118
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 9;
|
|
1119
|
+
}
|
|
1120
|
+
set obsoleteDelete(value) {
|
|
1121
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 9, this);
|
|
1122
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1123
|
+
}
|
|
1124
|
+
_adoptProvide(value) {
|
|
1125
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 10, this);
|
|
1126
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1127
|
+
}
|
|
1128
|
+
_disownProvide() {
|
|
1129
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.provide);
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Provide a capability to a third party.
|
|
1133
|
+
*
|
|
1134
|
+
*/
|
|
1135
|
+
get provide() {
|
|
1136
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "provide", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 10, this);
|
|
1137
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, Provide, this);
|
|
1138
|
+
}
|
|
1139
|
+
_hasProvide() {
|
|
1140
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1141
|
+
}
|
|
1142
|
+
_initProvide() {
|
|
1143
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 10, this);
|
|
1144
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, Provide, this);
|
|
1145
|
+
}
|
|
1146
|
+
get _isProvide() {
|
|
1147
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 10;
|
|
1148
|
+
}
|
|
1149
|
+
set provide(value) {
|
|
1150
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 10, this);
|
|
1151
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1152
|
+
}
|
|
1153
|
+
_adoptAccept(value) {
|
|
1154
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 11, this);
|
|
1155
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1156
|
+
}
|
|
1157
|
+
_disownAccept() {
|
|
1158
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.accept);
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Accept a capability provided by a third party.
|
|
1162
|
+
*
|
|
1163
|
+
*/
|
|
1164
|
+
get accept() {
|
|
1165
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "accept", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 11, this);
|
|
1166
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, Accept, this);
|
|
1167
|
+
}
|
|
1168
|
+
_hasAccept() {
|
|
1169
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1170
|
+
}
|
|
1171
|
+
_initAccept() {
|
|
1172
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 11, this);
|
|
1173
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, Accept, this);
|
|
1174
|
+
}
|
|
1175
|
+
get _isAccept() {
|
|
1176
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 11;
|
|
1177
|
+
}
|
|
1178
|
+
set accept(value) {
|
|
1179
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 11, this);
|
|
1180
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1181
|
+
}
|
|
1182
|
+
_adoptJoin(value) {
|
|
1183
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 12, this);
|
|
1184
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1185
|
+
}
|
|
1186
|
+
_disownJoin() {
|
|
1187
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.join);
|
|
1188
|
+
}
|
|
1189
|
+
/**
|
|
1190
|
+
* Directly connect to the common root of two or more proxied caps.
|
|
1191
|
+
*
|
|
1192
|
+
*/
|
|
1193
|
+
get join() {
|
|
1194
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "join", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 12, this);
|
|
1195
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, Join, this);
|
|
1196
|
+
}
|
|
1197
|
+
_hasJoin() {
|
|
1198
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1199
|
+
}
|
|
1200
|
+
_initJoin() {
|
|
1201
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 12, this);
|
|
1202
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, Join, this);
|
|
1203
|
+
}
|
|
1204
|
+
get _isJoin() {
|
|
1205
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 12;
|
|
1206
|
+
}
|
|
1207
|
+
set join(value) {
|
|
1208
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 12, this);
|
|
1209
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1210
|
+
}
|
|
1211
|
+
toString() {
|
|
1212
|
+
return "Message_" + super.toString();
|
|
1213
|
+
}
|
|
1214
|
+
which() {
|
|
1215
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this);
|
|
1216
|
+
}
|
|
1217
|
+
}, _class5.__initStatic7(), _class5.__initStatic8(), _class5.__initStatic9(), _class5.__initStatic10(), _class5.__initStatic11(), _class5.__initStatic12(), _class5.__initStatic13(), _class5.__initStatic14(), _class5.__initStatic15(), _class5.__initStatic16(), _class5.__initStatic17(), _class5.__initStatic18(), _class5.__initStatic19(), _class5.__initStatic20(), _class5.__initStatic21(), _class5);
|
|
1218
|
+
var Bootstrap = (_class6 = class extends _chunkKXWOF6H4cjs.Struct {
|
|
1219
|
+
static {
|
|
1220
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Bootstrap");
|
|
1221
|
+
}
|
|
1222
|
+
static __initStatic22() {this._capnp = {
|
|
1223
|
+
displayName: "Bootstrap",
|
|
1224
|
+
id: "e94ccf8031176ec4",
|
|
1225
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(8, 1)
|
|
1226
|
+
}}
|
|
1227
|
+
/**
|
|
1228
|
+
* A new question ID identifying this request, which will eventually receive a Return message
|
|
1229
|
+
* containing the restored capability.
|
|
1230
|
+
*
|
|
1231
|
+
*/
|
|
1232
|
+
get questionId() {
|
|
1233
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 0, this);
|
|
1234
|
+
}
|
|
1235
|
+
set questionId(value) {
|
|
1236
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 0, value, this);
|
|
1237
|
+
}
|
|
1238
|
+
_adoptDeprecatedObjectId(value) {
|
|
1239
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1240
|
+
}
|
|
1241
|
+
_disownDeprecatedObjectId() {
|
|
1242
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.deprecatedObjectId);
|
|
1243
|
+
}
|
|
1244
|
+
/**
|
|
1245
|
+
* ** DEPRECATED **
|
|
1246
|
+
*
|
|
1247
|
+
* A Vat may export multiple bootstrap interfaces. In this case, `deprecatedObjectId` specifies
|
|
1248
|
+
* which one to return. If this pointer is null, then the default bootstrap interface is returned.
|
|
1249
|
+
*
|
|
1250
|
+
* As of version 0.5, use of this field is deprecated. If a service wants to export multiple
|
|
1251
|
+
* bootstrap interfaces, it should instead define a single bootstrap interface that has methods
|
|
1252
|
+
* that return each of the other interfaces.
|
|
1253
|
+
*
|
|
1254
|
+
* **History**
|
|
1255
|
+
*
|
|
1256
|
+
* In the first version of Cap'n Proto RPC (0.4.x) the `Bootstrap` message was called `Restore`.
|
|
1257
|
+
* At the time, it was thought that this would eventually serve as the way to restore SturdyRefs
|
|
1258
|
+
* (level 2). Meanwhile, an application could offer its "main" interface on a well-known
|
|
1259
|
+
* (non-secret) SturdyRef.
|
|
1260
|
+
*
|
|
1261
|
+
* Since level 2 RPC was not implemented at the time, the `Restore` message was in practice only
|
|
1262
|
+
* used to obtain the main interface. Since most applications had only one main interface that
|
|
1263
|
+
* they wanted to restore, they tended to designate this with a null `objectId`.
|
|
1264
|
+
*
|
|
1265
|
+
* Unfortunately, the earliest version of the EZ RPC interfaces set a precedent of exporting
|
|
1266
|
+
* multiple main interfaces by allowing them to be exported under string names. In this case,
|
|
1267
|
+
* `objectId` was a Text value specifying the name.
|
|
1268
|
+
*
|
|
1269
|
+
* All of this proved problematic for several reasons:
|
|
1270
|
+
*
|
|
1271
|
+
* - The arrangement assumed that a client wishing to restore a SturdyRef would know exactly what
|
|
1272
|
+
* machine to connect to and would be able to immediately restore a SturdyRef on connection.
|
|
1273
|
+
* However, in practice, the ability to restore SturdyRefs is itself a capability that may
|
|
1274
|
+
* require going through an authentication process to obtain. Thus, it makes more sense to
|
|
1275
|
+
* define a "restorer service" as a full Cap'n Proto interface. If this restorer interface is
|
|
1276
|
+
* offered as the vat's bootstrap interface, then this is equivalent to the old arrangement.
|
|
1277
|
+
*
|
|
1278
|
+
* - Overloading "Restore" for the purpose of obtaining well-known capabilities encouraged the
|
|
1279
|
+
* practice of exporting singleton services with string names. If singleton services are desired,
|
|
1280
|
+
* it is better to have one main interface that has methods that can be used to obtain each
|
|
1281
|
+
* service, in order to get all the usual benefits of schemas and type checking.
|
|
1282
|
+
*
|
|
1283
|
+
* - Overloading "Restore" also had a security problem: Often, "main" or "well-known"
|
|
1284
|
+
* capabilities exported by a vat are in fact not public: they are intended to be accessed only
|
|
1285
|
+
* by clients who are capable of forming a connection to the vat. This can lead to trouble if
|
|
1286
|
+
* the client itself has other clients and wishes to forward some `Restore` requests from those
|
|
1287
|
+
* external clients -- it has to be very careful not to allow through `Restore` requests
|
|
1288
|
+
* addressing the default capability.
|
|
1289
|
+
*
|
|
1290
|
+
* For example, consider the case of a sandboxed Sandstorm application and its supervisor. The
|
|
1291
|
+
* application exports a default capability to its supervisor that provides access to
|
|
1292
|
+
* functionality that only the supervisor is supposed to access. Meanwhile, though, applications
|
|
1293
|
+
* may publish other capabilities that may be persistent, in which case the application needs
|
|
1294
|
+
* to field `Restore` requests that could come from anywhere. These requests of course have to
|
|
1295
|
+
* pass through the supervisor, as all communications with the outside world must. But, the
|
|
1296
|
+
* supervisor has to be careful not to honor an external request addressing the application's
|
|
1297
|
+
* default capability, since this capability is privileged. Unfortunately, the default
|
|
1298
|
+
* capability cannot be given an unguessable name, because then the supervisor itself would not
|
|
1299
|
+
* be able to address it!
|
|
1300
|
+
*
|
|
1301
|
+
* As of Cap'n Proto 0.5, `Restore` has been renamed to `Bootstrap` and is no longer planned for
|
|
1302
|
+
* use in restoring SturdyRefs.
|
|
1303
|
+
*
|
|
1304
|
+
* Note that 0.4 also defined a message type called `Delete` that, like `Restore`, addressed a
|
|
1305
|
+
* SturdyRef, but indicated that the client would not restore the ref again in the future. This
|
|
1306
|
+
* operation was never implemented, so it was removed entirely. If a "delete" operation is desired,
|
|
1307
|
+
* it should exist as a method on the same interface that handles restoring SturdyRefs. However,
|
|
1308
|
+
* the utility of such an operation is questionable. You wouldn't be able to rely on it for
|
|
1309
|
+
* garbage collection since a client could always disappear permanently without remembering to
|
|
1310
|
+
* delete all its SturdyRefs, thus leaving them dangling forever. Therefore, it is advisable to
|
|
1311
|
+
* design systems such that SturdyRefs never represent "owned" pointers.
|
|
1312
|
+
*
|
|
1313
|
+
* For example, say a SturdyRef points to an image file hosted on some server. That image file
|
|
1314
|
+
* should also live inside a collection (a gallery, perhaps) hosted on the same server, owned by
|
|
1315
|
+
* a user who can delete the image at any time. If the user deletes the image, the SturdyRef
|
|
1316
|
+
* stops working. On the other hand, if the SturdyRef is discarded, this has no effect on the
|
|
1317
|
+
* existence of the image in its collection.
|
|
1318
|
+
*
|
|
1319
|
+
*/
|
|
1320
|
+
get deprecatedObjectId() {
|
|
1321
|
+
return _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this);
|
|
1322
|
+
}
|
|
1323
|
+
_hasDeprecatedObjectId() {
|
|
1324
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1325
|
+
}
|
|
1326
|
+
set deprecatedObjectId(value) {
|
|
1327
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1328
|
+
}
|
|
1329
|
+
toString() {
|
|
1330
|
+
return "Bootstrap_" + super.toString();
|
|
1331
|
+
}
|
|
1332
|
+
}, _class6.__initStatic22(), _class6);
|
|
1333
|
+
var Call_SendResultsTo_Which = {
|
|
1334
|
+
/**
|
|
1335
|
+
* Send the return message back to the caller (the usual).
|
|
1336
|
+
*
|
|
1337
|
+
*/
|
|
1338
|
+
CALLER: 0,
|
|
1339
|
+
/**
|
|
1340
|
+
* **(level 1)**
|
|
1341
|
+
*
|
|
1342
|
+
* Don't actually return the results to the sender. Instead, hold on to them and await
|
|
1343
|
+
* instructions from the sender regarding what to do with them. In particular, the sender
|
|
1344
|
+
* may subsequently send a `Return` for some other call (which the receiver had previously made
|
|
1345
|
+
* to the sender) with `takeFromOtherQuestion` set. The results from this call are then used
|
|
1346
|
+
* as the results of the other call.
|
|
1347
|
+
*
|
|
1348
|
+
* When `yourself` is used, the receiver must still send a `Return` for the call, but sets the
|
|
1349
|
+
* field `resultsSentElsewhere` in that `Return` rather than including the results.
|
|
1350
|
+
*
|
|
1351
|
+
* This feature can be used to implement tail calls in which a call from Vat A to Vat B ends up
|
|
1352
|
+
* returning the result of a call from Vat B back to Vat A.
|
|
1353
|
+
*
|
|
1354
|
+
* In particular, the most common use case for this feature is when Vat A makes a call to a
|
|
1355
|
+
* promise in Vat B, and then that promise ends up resolving to a capability back in Vat A.
|
|
1356
|
+
* Vat B must forward all the queued calls on that promise back to Vat A, but can set `yourself`
|
|
1357
|
+
* in the calls so that the results need not pass back through Vat B.
|
|
1358
|
+
*
|
|
1359
|
+
* For example:
|
|
1360
|
+
* - Alice, in Vat A, calls foo() on Bob in Vat B.
|
|
1361
|
+
* - Alice makes a pipelined call bar() on the promise returned by foo().
|
|
1362
|
+
* - Later on, Bob resolves the promise from foo() to point at Carol, who lives in Vat A (next
|
|
1363
|
+
* to Alice).
|
|
1364
|
+
* - Vat B dutifully forwards the bar() call to Carol. Let us call this forwarded call bar'().
|
|
1365
|
+
* Notice that bar() and bar'() are travelling in opposite directions on the same network
|
|
1366
|
+
* link.
|
|
1367
|
+
* - The `Call` for bar'() has `sendResultsTo` set to `yourself`.
|
|
1368
|
+
* - Vat B sends a `Return` for bar() with `takeFromOtherQuestion` set in place of the results,
|
|
1369
|
+
* with the value set to the question ID of bar'(). Vat B does not wait for bar'() to return,
|
|
1370
|
+
* as doing so would introduce unnecessary round trip latency.
|
|
1371
|
+
* - Vat A receives bar'() and delivers it to Carol.
|
|
1372
|
+
* - When bar'() returns, Vat A sends a `Return` for bar'() to Vat B, with `resultsSentElsewhere`
|
|
1373
|
+
* set in place of results.
|
|
1374
|
+
* - Vat A sends a `Finish` for the bar() call to Vat B.
|
|
1375
|
+
* - Vat B receives the `Finish` for bar() and sends a `Finish` for bar'().
|
|
1376
|
+
*
|
|
1377
|
+
*/
|
|
1378
|
+
YOURSELF: 1,
|
|
1379
|
+
/**
|
|
1380
|
+
* **(level 3)**
|
|
1381
|
+
*
|
|
1382
|
+
* The call's result should be returned to a different vat. The receiver (the callee) expects
|
|
1383
|
+
* to receive an `Accept` message from the indicated vat, and should return the call's result
|
|
1384
|
+
* to it, rather than to the sender of the `Call`.
|
|
1385
|
+
*
|
|
1386
|
+
* This operates much like `yourself`, above, except that Carol is in a separate Vat C. `Call`
|
|
1387
|
+
* messages are sent from Vat A -> Vat B and Vat B -> Vat C. A `Return` message is sent from
|
|
1388
|
+
* Vat B -> Vat A that contains `acceptFromThirdParty` in place of results. When Vat A sends
|
|
1389
|
+
* an `Accept` to Vat C, it receives back a `Return` containing the call's actual result. Vat C
|
|
1390
|
+
* also sends a `Return` to Vat B with `resultsSentElsewhere`.
|
|
1391
|
+
*
|
|
1392
|
+
*/
|
|
1393
|
+
THIRD_PARTY: 2
|
|
1394
|
+
};
|
|
1395
|
+
var Call_SendResultsTo = (_class7 = class extends _chunkKXWOF6H4cjs.Struct {
|
|
1396
|
+
static {
|
|
1397
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Call_SendResultsTo");
|
|
1398
|
+
}
|
|
1399
|
+
static __initStatic23() {this.CALLER = Call_SendResultsTo_Which.CALLER}
|
|
1400
|
+
static __initStatic24() {this.YOURSELF = Call_SendResultsTo_Which.YOURSELF}
|
|
1401
|
+
static __initStatic25() {this.THIRD_PARTY = Call_SendResultsTo_Which.THIRD_PARTY}
|
|
1402
|
+
static __initStatic26() {this._capnp = {
|
|
1403
|
+
displayName: "sendResultsTo",
|
|
1404
|
+
id: "dae8b0f61aab5f99",
|
|
1405
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(24, 3)
|
|
1406
|
+
}}
|
|
1407
|
+
get _isCaller() {
|
|
1408
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 6, this) === 0;
|
|
1409
|
+
}
|
|
1410
|
+
set caller(_) {
|
|
1411
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 6, 0, this);
|
|
1412
|
+
}
|
|
1413
|
+
get _isYourself() {
|
|
1414
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 6, this) === 1;
|
|
1415
|
+
}
|
|
1416
|
+
set yourself(_) {
|
|
1417
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 6, 1, this);
|
|
1418
|
+
}
|
|
1419
|
+
_adoptThirdParty(value) {
|
|
1420
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 6, 2, this);
|
|
1421
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 2, this));
|
|
1422
|
+
}
|
|
1423
|
+
_disownThirdParty() {
|
|
1424
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.thirdParty);
|
|
1425
|
+
}
|
|
1426
|
+
/**
|
|
1427
|
+
* **(level 3)**
|
|
1428
|
+
*
|
|
1429
|
+
* The call's result should be returned to a different vat. The receiver (the callee) expects
|
|
1430
|
+
* to receive an `Accept` message from the indicated vat, and should return the call's result
|
|
1431
|
+
* to it, rather than to the sender of the `Call`.
|
|
1432
|
+
*
|
|
1433
|
+
* This operates much like `yourself`, above, except that Carol is in a separate Vat C. `Call`
|
|
1434
|
+
* messages are sent from Vat A -> Vat B and Vat B -> Vat C. A `Return` message is sent from
|
|
1435
|
+
* Vat B -> Vat A that contains `acceptFromThirdParty` in place of results. When Vat A sends
|
|
1436
|
+
* an `Accept` to Vat C, it receives back a `Return` containing the call's actual result. Vat C
|
|
1437
|
+
* also sends a `Return` to Vat B with `resultsSentElsewhere`.
|
|
1438
|
+
*
|
|
1439
|
+
*/
|
|
1440
|
+
get thirdParty() {
|
|
1441
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "thirdParty", _chunkKXWOF6H4cjs.getUint16.call(void 0, 6, this), 2, this);
|
|
1442
|
+
return _chunkKXWOF6H4cjs.getPointer.call(void 0, 2, this);
|
|
1443
|
+
}
|
|
1444
|
+
_hasThirdParty() {
|
|
1445
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 2, this));
|
|
1446
|
+
}
|
|
1447
|
+
get _isThirdParty() {
|
|
1448
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 6, this) === 2;
|
|
1449
|
+
}
|
|
1450
|
+
set thirdParty(value) {
|
|
1451
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 6, 2, this);
|
|
1452
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 2, this));
|
|
1453
|
+
}
|
|
1454
|
+
toString() {
|
|
1455
|
+
return "Call_SendResultsTo_" + super.toString();
|
|
1456
|
+
}
|
|
1457
|
+
which() {
|
|
1458
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 6, this);
|
|
1459
|
+
}
|
|
1460
|
+
}, _class7.__initStatic23(), _class7.__initStatic24(), _class7.__initStatic25(), _class7.__initStatic26(), _class7);
|
|
1461
|
+
var Call = (_class8 = class _Call extends _chunkKXWOF6H4cjs.Struct {
|
|
1462
|
+
static {
|
|
1463
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Call");
|
|
1464
|
+
}
|
|
1465
|
+
static __initStatic27() {this._capnp = {
|
|
1466
|
+
displayName: "Call",
|
|
1467
|
+
id: "836a53ce789d4cd4",
|
|
1468
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(24, 3),
|
|
1469
|
+
defaultAllowThirdPartyTailCall: _chunkKXWOF6H4cjs.getBitMask.call(void 0, false, 0),
|
|
1470
|
+
defaultNoPromisePipelining: _chunkKXWOF6H4cjs.getBitMask.call(void 0, false, 1),
|
|
1471
|
+
defaultOnlyPromisePipeline: _chunkKXWOF6H4cjs.getBitMask.call(void 0, false, 2)
|
|
1472
|
+
}}
|
|
1473
|
+
/**
|
|
1474
|
+
* A number, chosen by the caller, that identifies this call in future messages. This number
|
|
1475
|
+
* must be different from all other calls originating from the same end of the connection (but
|
|
1476
|
+
* may overlap with question IDs originating from the opposite end). A fine strategy is to use
|
|
1477
|
+
* sequential question IDs, but the recipient should not assume this.
|
|
1478
|
+
*
|
|
1479
|
+
* A question ID can be reused once both:
|
|
1480
|
+
* - A matching Return has been received from the callee.
|
|
1481
|
+
* - A matching Finish has been sent from the caller.
|
|
1482
|
+
*
|
|
1483
|
+
*/
|
|
1484
|
+
get questionId() {
|
|
1485
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 0, this);
|
|
1486
|
+
}
|
|
1487
|
+
set questionId(value) {
|
|
1488
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 0, value, this);
|
|
1489
|
+
}
|
|
1490
|
+
_adoptTarget(value) {
|
|
1491
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1492
|
+
}
|
|
1493
|
+
_disownTarget() {
|
|
1494
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.target);
|
|
1495
|
+
}
|
|
1496
|
+
/**
|
|
1497
|
+
* The object that should receive this call.
|
|
1498
|
+
*
|
|
1499
|
+
*/
|
|
1500
|
+
get target() {
|
|
1501
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, MessageTarget, this);
|
|
1502
|
+
}
|
|
1503
|
+
_hasTarget() {
|
|
1504
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1505
|
+
}
|
|
1506
|
+
_initTarget() {
|
|
1507
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, MessageTarget, this);
|
|
1508
|
+
}
|
|
1509
|
+
set target(value) {
|
|
1510
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1511
|
+
}
|
|
1512
|
+
/**
|
|
1513
|
+
* The type ID of the interface being called. Each capability may implement multiple interfaces.
|
|
1514
|
+
*
|
|
1515
|
+
*/
|
|
1516
|
+
get interfaceId() {
|
|
1517
|
+
return _chunkKXWOF6H4cjs.getUint64.call(void 0, 8, this);
|
|
1518
|
+
}
|
|
1519
|
+
set interfaceId(value) {
|
|
1520
|
+
_chunkKXWOF6H4cjs.setUint64.call(void 0, 8, value, this);
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* The ordinal number of the method to call within the requested interface.
|
|
1524
|
+
*
|
|
1525
|
+
*/
|
|
1526
|
+
get methodId() {
|
|
1527
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this);
|
|
1528
|
+
}
|
|
1529
|
+
set methodId(value) {
|
|
1530
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 4, value, this);
|
|
1531
|
+
}
|
|
1532
|
+
/**
|
|
1533
|
+
* Indicates whether or not the receiver is allowed to send a `Return` containing
|
|
1534
|
+
* `acceptFromThirdParty`. Level 3 implementations should set this true. Otherwise, the callee
|
|
1535
|
+
* will have to proxy the return in the case of a tail call to a third-party vat.
|
|
1536
|
+
*
|
|
1537
|
+
*/
|
|
1538
|
+
get allowThirdPartyTailCall() {
|
|
1539
|
+
return _chunkKXWOF6H4cjs.getBit.call(void 0, 128, this, _Call._capnp.defaultAllowThirdPartyTailCall);
|
|
1540
|
+
}
|
|
1541
|
+
set allowThirdPartyTailCall(value) {
|
|
1542
|
+
_chunkKXWOF6H4cjs.setBit.call(void 0, 128, value, this, _Call._capnp.defaultAllowThirdPartyTailCall);
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* If true, the sender promises that it won't make any promise-pipelined calls on the results of
|
|
1546
|
+
* this call. If it breaks this promise, the receiver may throw an arbitrary error from such
|
|
1547
|
+
* calls.
|
|
1548
|
+
*
|
|
1549
|
+
* The receiver may use this as an optimization, by skipping the bookkeeping needed for pipelining
|
|
1550
|
+
* when no pipelined calls are expected. The sender typically sets this to false when the method's
|
|
1551
|
+
* schema does not specify any return capabilities.
|
|
1552
|
+
*
|
|
1553
|
+
*/
|
|
1554
|
+
get noPromisePipelining() {
|
|
1555
|
+
return _chunkKXWOF6H4cjs.getBit.call(void 0, 129, this, _Call._capnp.defaultNoPromisePipelining);
|
|
1556
|
+
}
|
|
1557
|
+
set noPromisePipelining(value) {
|
|
1558
|
+
_chunkKXWOF6H4cjs.setBit.call(void 0, 129, value, this, _Call._capnp.defaultNoPromisePipelining);
|
|
1559
|
+
}
|
|
1560
|
+
/**
|
|
1561
|
+
* If true, the sender only plans to use this call to make pipelined calls. The receiver need not
|
|
1562
|
+
* send a `Return` message (but is still allowed to do so).
|
|
1563
|
+
*
|
|
1564
|
+
* Since the sender does not know whether a `Return` will be sent, it must release all state
|
|
1565
|
+
* related to the call when it sends `Finish`. However, in the case that the callee does not
|
|
1566
|
+
* recognize this hint and chooses to send a `Return`, then technically the caller is not allowed
|
|
1567
|
+
* to reuse the question ID until it receives said `Return`. This creates a conundrum: How does
|
|
1568
|
+
* the caller decide when it's OK to reuse the ID? To sidestep the problem, the C++ implementation
|
|
1569
|
+
* uses high-numbered IDs (with the high-order bit set) for such calls, and cycles through the
|
|
1570
|
+
* IDs in order. If all 2^31 IDs in this space are used without ever seeing a `Return`, then the
|
|
1571
|
+
* implementation assumes that the other end is in fact honoring the hint, and the ID counter is
|
|
1572
|
+
* allowed to loop around. If a `Return` is ever seen when `onlyPromisePipeline` was set, then
|
|
1573
|
+
* the implementation stops using this hint.
|
|
1574
|
+
*
|
|
1575
|
+
*/
|
|
1576
|
+
get onlyPromisePipeline() {
|
|
1577
|
+
return _chunkKXWOF6H4cjs.getBit.call(void 0, 130, this, _Call._capnp.defaultOnlyPromisePipeline);
|
|
1578
|
+
}
|
|
1579
|
+
set onlyPromisePipeline(value) {
|
|
1580
|
+
_chunkKXWOF6H4cjs.setBit.call(void 0, 130, value, this, _Call._capnp.defaultOnlyPromisePipeline);
|
|
1581
|
+
}
|
|
1582
|
+
_adoptParams(value) {
|
|
1583
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 1, this));
|
|
1584
|
+
}
|
|
1585
|
+
_disownParams() {
|
|
1586
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.params);
|
|
1587
|
+
}
|
|
1588
|
+
/**
|
|
1589
|
+
* The call parameters. `params.content` is a struct whose fields correspond to the parameters of
|
|
1590
|
+
* the method.
|
|
1591
|
+
*
|
|
1592
|
+
*/
|
|
1593
|
+
get params() {
|
|
1594
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 1, Payload, this);
|
|
1595
|
+
}
|
|
1596
|
+
_hasParams() {
|
|
1597
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 1, this));
|
|
1598
|
+
}
|
|
1599
|
+
_initParams() {
|
|
1600
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 1, Payload, this);
|
|
1601
|
+
}
|
|
1602
|
+
set params(value) {
|
|
1603
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 1, this));
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* Where should the return message be sent?
|
|
1607
|
+
*
|
|
1608
|
+
*/
|
|
1609
|
+
get sendResultsTo() {
|
|
1610
|
+
return _chunkKXWOF6H4cjs.getAs.call(void 0, Call_SendResultsTo, this);
|
|
1611
|
+
}
|
|
1612
|
+
_initSendResultsTo() {
|
|
1613
|
+
return _chunkKXWOF6H4cjs.getAs.call(void 0, Call_SendResultsTo, this);
|
|
1614
|
+
}
|
|
1615
|
+
toString() {
|
|
1616
|
+
return "Call_" + super.toString();
|
|
1617
|
+
}
|
|
1618
|
+
}, _class8.__initStatic27(), _class8);
|
|
1619
|
+
var Return_Which = {
|
|
1620
|
+
/**
|
|
1621
|
+
* Equal to the QuestionId of the corresponding `Call` message.
|
|
1622
|
+
*
|
|
1623
|
+
*/
|
|
1624
|
+
RESULTS: 0,
|
|
1625
|
+
/**
|
|
1626
|
+
* If true, all capabilities that were in the params should be considered released. The sender
|
|
1627
|
+
* must not send separate `Release` messages for them. Level 0 implementations in particular
|
|
1628
|
+
* should always set this true. This defaults true because if level 0 implementations forget to
|
|
1629
|
+
* set it they'll never notice (just silently leak caps), but if level >=1 implementations forget
|
|
1630
|
+
* to set it to false they'll quickly get errors.
|
|
1631
|
+
*
|
|
1632
|
+
* The receiver should act as if the sender had sent a release message with count=1 for each
|
|
1633
|
+
* CapDescriptor in the original Call message.
|
|
1634
|
+
*
|
|
1635
|
+
*/
|
|
1636
|
+
EXCEPTION: 1,
|
|
1637
|
+
/**
|
|
1638
|
+
* The result.
|
|
1639
|
+
*
|
|
1640
|
+
* For regular method calls, `results.content` points to the result struct.
|
|
1641
|
+
*
|
|
1642
|
+
* For a `Return` in response to an `Accept` or `Bootstrap`, `results` contains a single
|
|
1643
|
+
* capability (rather than a struct), and `results.content` is just a capability pointer with
|
|
1644
|
+
* index 0. A `Finish` is still required in this case.
|
|
1645
|
+
*
|
|
1646
|
+
*/
|
|
1647
|
+
CANCELED: 2,
|
|
1648
|
+
/**
|
|
1649
|
+
* Indicates that the call failed and explains why.
|
|
1650
|
+
*
|
|
1651
|
+
*/
|
|
1652
|
+
RESULTS_SENT_ELSEWHERE: 3,
|
|
1653
|
+
/**
|
|
1654
|
+
* Indicates that the call was canceled due to the caller sending a Finish message
|
|
1655
|
+
* before the call had completed.
|
|
1656
|
+
*
|
|
1657
|
+
*/
|
|
1658
|
+
TAKE_FROM_OTHER_QUESTION: 4,
|
|
1659
|
+
/**
|
|
1660
|
+
* This is set when returning from a `Call` that had `sendResultsTo` set to something other
|
|
1661
|
+
* than `caller`.
|
|
1662
|
+
*
|
|
1663
|
+
* It doesn't matter too much when this is sent, as the receiver doesn't need to do anything
|
|
1664
|
+
* with it, but the C++ implementation appears to wait for the call to finish before sending
|
|
1665
|
+
* this.
|
|
1666
|
+
*
|
|
1667
|
+
*/
|
|
1668
|
+
ACCEPT_FROM_THIRD_PARTY: 5
|
|
1669
|
+
};
|
|
1670
|
+
var Return = (_class9 = class _Return extends _chunkKXWOF6H4cjs.Struct {
|
|
1671
|
+
static {
|
|
1672
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Return");
|
|
1673
|
+
}
|
|
1674
|
+
static __initStatic28() {this.RESULTS = Return_Which.RESULTS}
|
|
1675
|
+
static __initStatic29() {this.EXCEPTION = Return_Which.EXCEPTION}
|
|
1676
|
+
static __initStatic30() {this.CANCELED = Return_Which.CANCELED}
|
|
1677
|
+
static __initStatic31() {this.RESULTS_SENT_ELSEWHERE = Return_Which.RESULTS_SENT_ELSEWHERE}
|
|
1678
|
+
static __initStatic32() {this.TAKE_FROM_OTHER_QUESTION = Return_Which.TAKE_FROM_OTHER_QUESTION}
|
|
1679
|
+
static __initStatic33() {this.ACCEPT_FROM_THIRD_PARTY = Return_Which.ACCEPT_FROM_THIRD_PARTY}
|
|
1680
|
+
static __initStatic34() {this._capnp = {
|
|
1681
|
+
displayName: "Return",
|
|
1682
|
+
id: "9e19b28d3db3573a",
|
|
1683
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(16, 1),
|
|
1684
|
+
defaultReleaseParamCaps: _chunkKXWOF6H4cjs.getBitMask.call(void 0, true, 0),
|
|
1685
|
+
defaultNoFinishNeeded: _chunkKXWOF6H4cjs.getBitMask.call(void 0, false, 1)
|
|
1686
|
+
}}
|
|
1687
|
+
/**
|
|
1688
|
+
* Equal to the QuestionId of the corresponding `Call` message.
|
|
1689
|
+
*
|
|
1690
|
+
*/
|
|
1691
|
+
get answerId() {
|
|
1692
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 0, this);
|
|
1693
|
+
}
|
|
1694
|
+
set answerId(value) {
|
|
1695
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 0, value, this);
|
|
1696
|
+
}
|
|
1697
|
+
/**
|
|
1698
|
+
* If true, all capabilities that were in the params should be considered released. The sender
|
|
1699
|
+
* must not send separate `Release` messages for them. Level 0 implementations in particular
|
|
1700
|
+
* should always set this true. This defaults true because if level 0 implementations forget to
|
|
1701
|
+
* set it they'll never notice (just silently leak caps), but if level >=1 implementations forget
|
|
1702
|
+
* to set it to false they'll quickly get errors.
|
|
1703
|
+
*
|
|
1704
|
+
* The receiver should act as if the sender had sent a release message with count=1 for each
|
|
1705
|
+
* CapDescriptor in the original Call message.
|
|
1706
|
+
*
|
|
1707
|
+
*/
|
|
1708
|
+
get releaseParamCaps() {
|
|
1709
|
+
return _chunkKXWOF6H4cjs.getBit.call(void 0, 32, this, _Return._capnp.defaultReleaseParamCaps);
|
|
1710
|
+
}
|
|
1711
|
+
set releaseParamCaps(value) {
|
|
1712
|
+
_chunkKXWOF6H4cjs.setBit.call(void 0, 32, value, this, _Return._capnp.defaultReleaseParamCaps);
|
|
1713
|
+
}
|
|
1714
|
+
/**
|
|
1715
|
+
* If true, the sender does not need the receiver to send a `Finish` message; its answer table
|
|
1716
|
+
* entry has already been cleaned up. This implies that the results do not contain any
|
|
1717
|
+
* capabilities, since the `Finish` message would normally release those capabilities from
|
|
1718
|
+
* promise pipelining responsibility. The caller may still send a `Finish` message if it wants,
|
|
1719
|
+
* which will be silently ignored by the callee.
|
|
1720
|
+
*
|
|
1721
|
+
*/
|
|
1722
|
+
get noFinishNeeded() {
|
|
1723
|
+
return _chunkKXWOF6H4cjs.getBit.call(void 0, 33, this, _Return._capnp.defaultNoFinishNeeded);
|
|
1724
|
+
}
|
|
1725
|
+
set noFinishNeeded(value) {
|
|
1726
|
+
_chunkKXWOF6H4cjs.setBit.call(void 0, 33, value, this, _Return._capnp.defaultNoFinishNeeded);
|
|
1727
|
+
}
|
|
1728
|
+
_adoptResults(value) {
|
|
1729
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 6, 0, this);
|
|
1730
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1731
|
+
}
|
|
1732
|
+
_disownResults() {
|
|
1733
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.results);
|
|
1734
|
+
}
|
|
1735
|
+
/**
|
|
1736
|
+
* The result.
|
|
1737
|
+
*
|
|
1738
|
+
* For regular method calls, `results.content` points to the result struct.
|
|
1739
|
+
*
|
|
1740
|
+
* For a `Return` in response to an `Accept` or `Bootstrap`, `results` contains a single
|
|
1741
|
+
* capability (rather than a struct), and `results.content` is just a capability pointer with
|
|
1742
|
+
* index 0. A `Finish` is still required in this case.
|
|
1743
|
+
*
|
|
1744
|
+
*/
|
|
1745
|
+
get results() {
|
|
1746
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "results", _chunkKXWOF6H4cjs.getUint16.call(void 0, 6, this), 0, this);
|
|
1747
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, Payload, this);
|
|
1748
|
+
}
|
|
1749
|
+
_hasResults() {
|
|
1750
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1751
|
+
}
|
|
1752
|
+
_initResults() {
|
|
1753
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 6, 0, this);
|
|
1754
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, Payload, this);
|
|
1755
|
+
}
|
|
1756
|
+
get _isResults() {
|
|
1757
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 6, this) === 0;
|
|
1758
|
+
}
|
|
1759
|
+
set results(value) {
|
|
1760
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 6, 0, this);
|
|
1761
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1762
|
+
}
|
|
1763
|
+
_adoptException(value) {
|
|
1764
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 6, 1, this);
|
|
1765
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1766
|
+
}
|
|
1767
|
+
_disownException() {
|
|
1768
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.exception);
|
|
1769
|
+
}
|
|
1770
|
+
/**
|
|
1771
|
+
* Indicates that the call failed and explains why.
|
|
1772
|
+
*
|
|
1773
|
+
*/
|
|
1774
|
+
get exception() {
|
|
1775
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "exception", _chunkKXWOF6H4cjs.getUint16.call(void 0, 6, this), 1, this);
|
|
1776
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, Exception, this);
|
|
1777
|
+
}
|
|
1778
|
+
_hasException() {
|
|
1779
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1780
|
+
}
|
|
1781
|
+
_initException() {
|
|
1782
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 6, 1, this);
|
|
1783
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, Exception, this);
|
|
1784
|
+
}
|
|
1785
|
+
get _isException() {
|
|
1786
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 6, this) === 1;
|
|
1787
|
+
}
|
|
1788
|
+
set exception(value) {
|
|
1789
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 6, 1, this);
|
|
1790
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1791
|
+
}
|
|
1792
|
+
get _isCanceled() {
|
|
1793
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 6, this) === 2;
|
|
1794
|
+
}
|
|
1795
|
+
set canceled(_) {
|
|
1796
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 6, 2, this);
|
|
1797
|
+
}
|
|
1798
|
+
get _isResultsSentElsewhere() {
|
|
1799
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 6, this) === 3;
|
|
1800
|
+
}
|
|
1801
|
+
set resultsSentElsewhere(_) {
|
|
1802
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 6, 3, this);
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* The sender has also sent (before this message) a `Call` with the given question ID and with
|
|
1806
|
+
* `sendResultsTo.yourself` set, and the results of that other call should be used as the
|
|
1807
|
+
* results here. `takeFromOtherQuestion` can only used once per question.
|
|
1808
|
+
*
|
|
1809
|
+
*/
|
|
1810
|
+
get takeFromOtherQuestion() {
|
|
1811
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "takeFromOtherQuestion", _chunkKXWOF6H4cjs.getUint16.call(void 0, 6, this), 4, this);
|
|
1812
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 8, this);
|
|
1813
|
+
}
|
|
1814
|
+
get _isTakeFromOtherQuestion() {
|
|
1815
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 6, this) === 4;
|
|
1816
|
+
}
|
|
1817
|
+
set takeFromOtherQuestion(value) {
|
|
1818
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 6, 4, this);
|
|
1819
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 8, value, this);
|
|
1820
|
+
}
|
|
1821
|
+
_adoptAcceptFromThirdParty(value) {
|
|
1822
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 6, 5, this);
|
|
1823
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1824
|
+
}
|
|
1825
|
+
_disownAcceptFromThirdParty() {
|
|
1826
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.acceptFromThirdParty);
|
|
1827
|
+
}
|
|
1828
|
+
/**
|
|
1829
|
+
* **(level 3)**
|
|
1830
|
+
*
|
|
1831
|
+
* The caller should contact a third-party vat to pick up the results. An `Accept` message
|
|
1832
|
+
* sent to the vat will return the result. This pairs with `Call.sendResultsTo.thirdParty`.
|
|
1833
|
+
* It should only be used if the corresponding `Call` had `allowThirdPartyTailCall` set.
|
|
1834
|
+
*
|
|
1835
|
+
*/
|
|
1836
|
+
get acceptFromThirdParty() {
|
|
1837
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "acceptFromThirdParty", _chunkKXWOF6H4cjs.getUint16.call(void 0, 6, this), 5, this);
|
|
1838
|
+
return _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this);
|
|
1839
|
+
}
|
|
1840
|
+
_hasAcceptFromThirdParty() {
|
|
1841
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1842
|
+
}
|
|
1843
|
+
get _isAcceptFromThirdParty() {
|
|
1844
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 6, this) === 5;
|
|
1845
|
+
}
|
|
1846
|
+
set acceptFromThirdParty(value) {
|
|
1847
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 6, 5, this);
|
|
1848
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
1849
|
+
}
|
|
1850
|
+
toString() {
|
|
1851
|
+
return "Return_" + super.toString();
|
|
1852
|
+
}
|
|
1853
|
+
which() {
|
|
1854
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 6, this);
|
|
1855
|
+
}
|
|
1856
|
+
}, _class9.__initStatic28(), _class9.__initStatic29(), _class9.__initStatic30(), _class9.__initStatic31(), _class9.__initStatic32(), _class9.__initStatic33(), _class9.__initStatic34(), _class9);
|
|
1857
|
+
var Finish = (_class10 = class _Finish extends _chunkKXWOF6H4cjs.Struct {
|
|
1858
|
+
static {
|
|
1859
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Finish");
|
|
1860
|
+
}
|
|
1861
|
+
static __initStatic35() {this._capnp = {
|
|
1862
|
+
displayName: "Finish",
|
|
1863
|
+
id: "d37d2eb2c2f80e63",
|
|
1864
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(8, 0),
|
|
1865
|
+
defaultReleaseResultCaps: _chunkKXWOF6H4cjs.getBitMask.call(void 0, true, 0),
|
|
1866
|
+
defaultRequireEarlyCancellationWorkaround: _chunkKXWOF6H4cjs.getBitMask.call(void 0, true, 1)
|
|
1867
|
+
}}
|
|
1868
|
+
/**
|
|
1869
|
+
* ID of the call whose result is to be released.
|
|
1870
|
+
*
|
|
1871
|
+
*/
|
|
1872
|
+
get questionId() {
|
|
1873
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 0, this);
|
|
1874
|
+
}
|
|
1875
|
+
set questionId(value) {
|
|
1876
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 0, value, this);
|
|
1877
|
+
}
|
|
1878
|
+
/**
|
|
1879
|
+
* If true, all capabilities that were in the results should be considered released. The sender
|
|
1880
|
+
* must not send separate `Release` messages for them. Level 0 implementations in particular
|
|
1881
|
+
* should always set this true. This defaults true because if level 0 implementations forget to
|
|
1882
|
+
* set it they'll never notice (just silently leak caps), but if level >=1 implementations forget
|
|
1883
|
+
* set it false they'll quickly get errors.
|
|
1884
|
+
*
|
|
1885
|
+
*/
|
|
1886
|
+
get releaseResultCaps() {
|
|
1887
|
+
return _chunkKXWOF6H4cjs.getBit.call(void 0, 32, this, _Finish._capnp.defaultReleaseResultCaps);
|
|
1888
|
+
}
|
|
1889
|
+
set releaseResultCaps(value) {
|
|
1890
|
+
_chunkKXWOF6H4cjs.setBit.call(void 0, 32, value, this, _Finish._capnp.defaultReleaseResultCaps);
|
|
1891
|
+
}
|
|
1892
|
+
/**
|
|
1893
|
+
* If true, if the RPC system receives this Finish message before the original call has even been
|
|
1894
|
+
* delivered, it should defer cancellation util after delivery. In particular, this gives the
|
|
1895
|
+
* destination object a chance to opt out of cancellation, e.g. as controlled by the
|
|
1896
|
+
* `allowCancellation` annotation defined in `c++.capnp`.
|
|
1897
|
+
*
|
|
1898
|
+
* This is a work-around. Versions 1.0 and up of Cap'n Proto always set this to false. However,
|
|
1899
|
+
* older versions of Cap'n Proto unintentionally exhibited this errant behavior by default, and
|
|
1900
|
+
* as a result programs built with older versions could be inadvertently relying on their peers
|
|
1901
|
+
* to implement the behavior. The purpose of this flag is to let newer versions know when the
|
|
1902
|
+
* peer is an older version, so that it can attempt to work around the issue.
|
|
1903
|
+
*
|
|
1904
|
+
* See also comments in handleFinish() in rpc.c++ for more details.
|
|
1905
|
+
*
|
|
1906
|
+
*/
|
|
1907
|
+
get requireEarlyCancellationWorkaround() {
|
|
1908
|
+
return _chunkKXWOF6H4cjs.getBit.call(void 0, 33, this, _Finish._capnp.defaultRequireEarlyCancellationWorkaround);
|
|
1909
|
+
}
|
|
1910
|
+
set requireEarlyCancellationWorkaround(value) {
|
|
1911
|
+
_chunkKXWOF6H4cjs.setBit.call(void 0, 33, value, this, _Finish._capnp.defaultRequireEarlyCancellationWorkaround);
|
|
1912
|
+
}
|
|
1913
|
+
toString() {
|
|
1914
|
+
return "Finish_" + super.toString();
|
|
1915
|
+
}
|
|
1916
|
+
}, _class10.__initStatic35(), _class10);
|
|
1917
|
+
var Resolve_Which = {
|
|
1918
|
+
/**
|
|
1919
|
+
* The ID of the promise to be resolved.
|
|
1920
|
+
*
|
|
1921
|
+
* Unlike all other instances of `ExportId` sent from the exporter, the `Resolve` message does
|
|
1922
|
+
* _not_ increase the reference count of `promiseId`. In fact, it is expected that the receiver
|
|
1923
|
+
* will release the export soon after receiving `Resolve`, and the sender will not send this
|
|
1924
|
+
* `ExportId` again until it has been released and recycled.
|
|
1925
|
+
*
|
|
1926
|
+
* When an export ID sent over the wire (e.g. in a `CapDescriptor`) is indicated to be a promise,
|
|
1927
|
+
* this indicates that the sender will follow up at some point with a `Resolve` message. If the
|
|
1928
|
+
* same `promiseId` is sent again before `Resolve`, still only one `Resolve` is sent. If the
|
|
1929
|
+
* same ID is sent again later _after_ a `Resolve`, it can only be because the export's
|
|
1930
|
+
* reference count hit zero in the meantime and the ID was re-assigned to a new export, therefore
|
|
1931
|
+
* this later promise does _not_ correspond to the earlier `Resolve`.
|
|
1932
|
+
*
|
|
1933
|
+
* If a promise ID's reference count reaches zero before a `Resolve` is sent, the `Resolve`
|
|
1934
|
+
* message may or may not still be sent (the `Resolve` may have already been in-flight when
|
|
1935
|
+
* `Release` was sent, but if the `Release` is received before `Resolve` then there is no longer
|
|
1936
|
+
* any reason to send a `Resolve`). Thus a `Resolve` may be received for a promise of which
|
|
1937
|
+
* the receiver has no knowledge, because it already released it earlier. In this case, the
|
|
1938
|
+
* receiver should simply release the capability to which the promise resolved.
|
|
1939
|
+
*
|
|
1940
|
+
*/
|
|
1941
|
+
CAP: 0,
|
|
1942
|
+
/**
|
|
1943
|
+
* The object to which the promise resolved.
|
|
1944
|
+
*
|
|
1945
|
+
* The sender promises that from this point forth, until `promiseId` is released, it shall
|
|
1946
|
+
* simply forward all messages to the capability designated by `cap`. This is true even if
|
|
1947
|
+
* `cap` itself happens to designate another promise, and that other promise later resolves --
|
|
1948
|
+
* messages sent to `promiseId` shall still go to that other promise, not to its resolution.
|
|
1949
|
+
* This is important in the case that the receiver of the `Resolve` ends up sending a
|
|
1950
|
+
* `Disembargo` message towards `promiseId` in order to control message ordering -- that
|
|
1951
|
+
* `Disembargo` really needs to reflect back to exactly the object designated by `cap` even
|
|
1952
|
+
* if that object is itself a promise.
|
|
1953
|
+
*
|
|
1954
|
+
*/
|
|
1955
|
+
EXCEPTION: 1
|
|
1956
|
+
};
|
|
1957
|
+
var Resolve = (_class11 = class extends _chunkKXWOF6H4cjs.Struct {
|
|
1958
|
+
static {
|
|
1959
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Resolve");
|
|
1960
|
+
}
|
|
1961
|
+
static __initStatic36() {this.CAP = Resolve_Which.CAP}
|
|
1962
|
+
static __initStatic37() {this.EXCEPTION = Resolve_Which.EXCEPTION}
|
|
1963
|
+
static __initStatic38() {this._capnp = {
|
|
1964
|
+
displayName: "Resolve",
|
|
1965
|
+
id: "bbc29655fa89086e",
|
|
1966
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(8, 1)
|
|
1967
|
+
}}
|
|
1968
|
+
/**
|
|
1969
|
+
* The ID of the promise to be resolved.
|
|
1970
|
+
*
|
|
1971
|
+
* Unlike all other instances of `ExportId` sent from the exporter, the `Resolve` message does
|
|
1972
|
+
* _not_ increase the reference count of `promiseId`. In fact, it is expected that the receiver
|
|
1973
|
+
* will release the export soon after receiving `Resolve`, and the sender will not send this
|
|
1974
|
+
* `ExportId` again until it has been released and recycled.
|
|
1975
|
+
*
|
|
1976
|
+
* When an export ID sent over the wire (e.g. in a `CapDescriptor`) is indicated to be a promise,
|
|
1977
|
+
* this indicates that the sender will follow up at some point with a `Resolve` message. If the
|
|
1978
|
+
* same `promiseId` is sent again before `Resolve`, still only one `Resolve` is sent. If the
|
|
1979
|
+
* same ID is sent again later _after_ a `Resolve`, it can only be because the export's
|
|
1980
|
+
* reference count hit zero in the meantime and the ID was re-assigned to a new export, therefore
|
|
1981
|
+
* this later promise does _not_ correspond to the earlier `Resolve`.
|
|
1982
|
+
*
|
|
1983
|
+
* If a promise ID's reference count reaches zero before a `Resolve` is sent, the `Resolve`
|
|
1984
|
+
* message may or may not still be sent (the `Resolve` may have already been in-flight when
|
|
1985
|
+
* `Release` was sent, but if the `Release` is received before `Resolve` then there is no longer
|
|
1986
|
+
* any reason to send a `Resolve`). Thus a `Resolve` may be received for a promise of which
|
|
1987
|
+
* the receiver has no knowledge, because it already released it earlier. In this case, the
|
|
1988
|
+
* receiver should simply release the capability to which the promise resolved.
|
|
1989
|
+
*
|
|
1990
|
+
*/
|
|
1991
|
+
get promiseId() {
|
|
1992
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 0, this);
|
|
1993
|
+
}
|
|
1994
|
+
set promiseId(value) {
|
|
1995
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 0, value, this);
|
|
1996
|
+
}
|
|
1997
|
+
_adoptCap(value) {
|
|
1998
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 4, 0, this);
|
|
1999
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2000
|
+
}
|
|
2001
|
+
_disownCap() {
|
|
2002
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.cap);
|
|
2003
|
+
}
|
|
2004
|
+
/**
|
|
2005
|
+
* The object to which the promise resolved.
|
|
2006
|
+
*
|
|
2007
|
+
* The sender promises that from this point forth, until `promiseId` is released, it shall
|
|
2008
|
+
* simply forward all messages to the capability designated by `cap`. This is true even if
|
|
2009
|
+
* `cap` itself happens to designate another promise, and that other promise later resolves --
|
|
2010
|
+
* messages sent to `promiseId` shall still go to that other promise, not to its resolution.
|
|
2011
|
+
* This is important in the case that the receiver of the `Resolve` ends up sending a
|
|
2012
|
+
* `Disembargo` message towards `promiseId` in order to control message ordering -- that
|
|
2013
|
+
* `Disembargo` really needs to reflect back to exactly the object designated by `cap` even
|
|
2014
|
+
* if that object is itself a promise.
|
|
2015
|
+
*
|
|
2016
|
+
*/
|
|
2017
|
+
get cap() {
|
|
2018
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "cap", _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this), 0, this);
|
|
2019
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, CapDescriptor, this);
|
|
2020
|
+
}
|
|
2021
|
+
_hasCap() {
|
|
2022
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2023
|
+
}
|
|
2024
|
+
_initCap() {
|
|
2025
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 4, 0, this);
|
|
2026
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, CapDescriptor, this);
|
|
2027
|
+
}
|
|
2028
|
+
get _isCap() {
|
|
2029
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this) === 0;
|
|
2030
|
+
}
|
|
2031
|
+
set cap(value) {
|
|
2032
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 4, 0, this);
|
|
2033
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2034
|
+
}
|
|
2035
|
+
_adoptException(value) {
|
|
2036
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 4, 1, this);
|
|
2037
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2038
|
+
}
|
|
2039
|
+
_disownException() {
|
|
2040
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.exception);
|
|
2041
|
+
}
|
|
2042
|
+
/**
|
|
2043
|
+
* Indicates that the promise was broken.
|
|
2044
|
+
*
|
|
2045
|
+
*/
|
|
2046
|
+
get exception() {
|
|
2047
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "exception", _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this), 1, this);
|
|
2048
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, Exception, this);
|
|
2049
|
+
}
|
|
2050
|
+
_hasException() {
|
|
2051
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2052
|
+
}
|
|
2053
|
+
_initException() {
|
|
2054
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 4, 1, this);
|
|
2055
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, Exception, this);
|
|
2056
|
+
}
|
|
2057
|
+
get _isException() {
|
|
2058
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this) === 1;
|
|
2059
|
+
}
|
|
2060
|
+
set exception(value) {
|
|
2061
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 4, 1, this);
|
|
2062
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2063
|
+
}
|
|
2064
|
+
toString() {
|
|
2065
|
+
return "Resolve_" + super.toString();
|
|
2066
|
+
}
|
|
2067
|
+
which() {
|
|
2068
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this);
|
|
2069
|
+
}
|
|
2070
|
+
}, _class11.__initStatic36(), _class11.__initStatic37(), _class11.__initStatic38(), _class11);
|
|
2071
|
+
var Release = (_class12 = class extends _chunkKXWOF6H4cjs.Struct {
|
|
2072
|
+
static {
|
|
2073
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Release");
|
|
2074
|
+
}
|
|
2075
|
+
static __initStatic39() {this._capnp = {
|
|
2076
|
+
displayName: "Release",
|
|
2077
|
+
id: "ad1a6c0d7dd07497",
|
|
2078
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(8, 0)
|
|
2079
|
+
}}
|
|
2080
|
+
/**
|
|
2081
|
+
* What to release.
|
|
2082
|
+
*
|
|
2083
|
+
*/
|
|
2084
|
+
get id() {
|
|
2085
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 0, this);
|
|
2086
|
+
}
|
|
2087
|
+
set id(value) {
|
|
2088
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 0, value, this);
|
|
2089
|
+
}
|
|
2090
|
+
/**
|
|
2091
|
+
* The amount by which to decrement the reference count. The export is only actually released
|
|
2092
|
+
* when the reference count reaches zero.
|
|
2093
|
+
*
|
|
2094
|
+
*/
|
|
2095
|
+
get referenceCount() {
|
|
2096
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 4, this);
|
|
2097
|
+
}
|
|
2098
|
+
set referenceCount(value) {
|
|
2099
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 4, value, this);
|
|
2100
|
+
}
|
|
2101
|
+
toString() {
|
|
2102
|
+
return "Release_" + super.toString();
|
|
2103
|
+
}
|
|
2104
|
+
}, _class12.__initStatic39(), _class12);
|
|
2105
|
+
var Disembargo_Context_Which = {
|
|
2106
|
+
/**
|
|
2107
|
+
* The sender is requesting a disembargo on a promise that is known to resolve back to a
|
|
2108
|
+
* capability hosted by the sender. As soon as the receiver has echoed back all pipelined calls
|
|
2109
|
+
* on this promise, it will deliver the Disembargo back to the sender with `receiverLoopback`
|
|
2110
|
+
* set to the same value as `senderLoopback`. This value is chosen by the sender, and since
|
|
2111
|
+
* it is also consumed be the sender, the sender can use whatever strategy it wants to make sure
|
|
2112
|
+
* the value is unambiguous.
|
|
2113
|
+
*
|
|
2114
|
+
* The receiver must verify that the target capability actually resolves back to the sender's
|
|
2115
|
+
* vat. Otherwise, the sender has committed a protocol error and should be disconnected.
|
|
2116
|
+
*
|
|
2117
|
+
*/
|
|
2118
|
+
SENDER_LOOPBACK: 0,
|
|
2119
|
+
/**
|
|
2120
|
+
* The receiver previously sent a `senderLoopback` Disembargo towards a promise resolving to
|
|
2121
|
+
* this capability, and that Disembargo is now being echoed back.
|
|
2122
|
+
*
|
|
2123
|
+
*/
|
|
2124
|
+
RECEIVER_LOOPBACK: 1,
|
|
2125
|
+
/**
|
|
2126
|
+
* **(level 3)**
|
|
2127
|
+
*
|
|
2128
|
+
* The sender is requesting a disembargo on a promise that is known to resolve to a third-party
|
|
2129
|
+
* capability that the sender is currently in the process of accepting (using `Accept`).
|
|
2130
|
+
* The receiver of this `Disembargo` has an outstanding `Provide` on said capability. The
|
|
2131
|
+
* receiver should now send a `Disembargo` with `provide` set to the question ID of that
|
|
2132
|
+
* `Provide` message.
|
|
2133
|
+
*
|
|
2134
|
+
* See `Accept.embargo` for an example.
|
|
2135
|
+
*
|
|
2136
|
+
*/
|
|
2137
|
+
ACCEPT: 2,
|
|
2138
|
+
/**
|
|
2139
|
+
* **(level 3)**
|
|
2140
|
+
*
|
|
2141
|
+
* The sender is requesting a disembargo on a capability currently being provided to a third
|
|
2142
|
+
* party. The question ID identifies the `Provide` message previously sent by the sender to
|
|
2143
|
+
* this capability. On receipt, the receiver (the capability host) shall release the embargo
|
|
2144
|
+
* on the `Accept` message that it has received from the third party. See `Accept.embargo` for
|
|
2145
|
+
* an example.
|
|
2146
|
+
*
|
|
2147
|
+
*/
|
|
2148
|
+
PROVIDE: 3
|
|
2149
|
+
};
|
|
2150
|
+
var Disembargo_Context = (_class13 = class extends _chunkKXWOF6H4cjs.Struct {
|
|
2151
|
+
static {
|
|
2152
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Disembargo_Context");
|
|
2153
|
+
}
|
|
2154
|
+
static __initStatic40() {this.SENDER_LOOPBACK = Disembargo_Context_Which.SENDER_LOOPBACK}
|
|
2155
|
+
static __initStatic41() {this.RECEIVER_LOOPBACK = Disembargo_Context_Which.RECEIVER_LOOPBACK}
|
|
2156
|
+
static __initStatic42() {this.ACCEPT = Disembargo_Context_Which.ACCEPT}
|
|
2157
|
+
static __initStatic43() {this.PROVIDE = Disembargo_Context_Which.PROVIDE}
|
|
2158
|
+
static __initStatic44() {this._capnp = {
|
|
2159
|
+
displayName: "context",
|
|
2160
|
+
id: "d562b4df655bdd4d",
|
|
2161
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(8, 1)
|
|
2162
|
+
}}
|
|
2163
|
+
/**
|
|
2164
|
+
* The sender is requesting a disembargo on a promise that is known to resolve back to a
|
|
2165
|
+
* capability hosted by the sender. As soon as the receiver has echoed back all pipelined calls
|
|
2166
|
+
* on this promise, it will deliver the Disembargo back to the sender with `receiverLoopback`
|
|
2167
|
+
* set to the same value as `senderLoopback`. This value is chosen by the sender, and since
|
|
2168
|
+
* it is also consumed be the sender, the sender can use whatever strategy it wants to make sure
|
|
2169
|
+
* the value is unambiguous.
|
|
2170
|
+
*
|
|
2171
|
+
* The receiver must verify that the target capability actually resolves back to the sender's
|
|
2172
|
+
* vat. Otherwise, the sender has committed a protocol error and should be disconnected.
|
|
2173
|
+
*
|
|
2174
|
+
*/
|
|
2175
|
+
get senderLoopback() {
|
|
2176
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "senderLoopback", _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this), 0, this);
|
|
2177
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 0, this);
|
|
2178
|
+
}
|
|
2179
|
+
get _isSenderLoopback() {
|
|
2180
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this) === 0;
|
|
2181
|
+
}
|
|
2182
|
+
set senderLoopback(value) {
|
|
2183
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 4, 0, this);
|
|
2184
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 0, value, this);
|
|
2185
|
+
}
|
|
2186
|
+
/**
|
|
2187
|
+
* The receiver previously sent a `senderLoopback` Disembargo towards a promise resolving to
|
|
2188
|
+
* this capability, and that Disembargo is now being echoed back.
|
|
2189
|
+
*
|
|
2190
|
+
*/
|
|
2191
|
+
get receiverLoopback() {
|
|
2192
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "receiverLoopback", _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this), 1, this);
|
|
2193
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 0, this);
|
|
2194
|
+
}
|
|
2195
|
+
get _isReceiverLoopback() {
|
|
2196
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this) === 1;
|
|
2197
|
+
}
|
|
2198
|
+
set receiverLoopback(value) {
|
|
2199
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 4, 1, this);
|
|
2200
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 0, value, this);
|
|
2201
|
+
}
|
|
2202
|
+
get _isAccept() {
|
|
2203
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this) === 2;
|
|
2204
|
+
}
|
|
2205
|
+
set accept(_) {
|
|
2206
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 4, 2, this);
|
|
2207
|
+
}
|
|
2208
|
+
/**
|
|
2209
|
+
* **(level 3)**
|
|
2210
|
+
*
|
|
2211
|
+
* The sender is requesting a disembargo on a capability currently being provided to a third
|
|
2212
|
+
* party. The question ID identifies the `Provide` message previously sent by the sender to
|
|
2213
|
+
* this capability. On receipt, the receiver (the capability host) shall release the embargo
|
|
2214
|
+
* on the `Accept` message that it has received from the third party. See `Accept.embargo` for
|
|
2215
|
+
* an example.
|
|
2216
|
+
*
|
|
2217
|
+
*/
|
|
2218
|
+
get provide() {
|
|
2219
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "provide", _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this), 3, this);
|
|
2220
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 0, this);
|
|
2221
|
+
}
|
|
2222
|
+
get _isProvide() {
|
|
2223
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this) === 3;
|
|
2224
|
+
}
|
|
2225
|
+
set provide(value) {
|
|
2226
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 4, 3, this);
|
|
2227
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 0, value, this);
|
|
2228
|
+
}
|
|
2229
|
+
toString() {
|
|
2230
|
+
return "Disembargo_Context_" + super.toString();
|
|
2231
|
+
}
|
|
2232
|
+
which() {
|
|
2233
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this);
|
|
2234
|
+
}
|
|
2235
|
+
}, _class13.__initStatic40(), _class13.__initStatic41(), _class13.__initStatic42(), _class13.__initStatic43(), _class13.__initStatic44(), _class13);
|
|
2236
|
+
var Disembargo = (_class14 = class extends _chunkKXWOF6H4cjs.Struct {
|
|
2237
|
+
static {
|
|
2238
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Disembargo");
|
|
2239
|
+
}
|
|
2240
|
+
static __initStatic45() {this._capnp = {
|
|
2241
|
+
displayName: "Disembargo",
|
|
2242
|
+
id: "f964368b0fbd3711",
|
|
2243
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(8, 1)
|
|
2244
|
+
}}
|
|
2245
|
+
_adoptTarget(value) {
|
|
2246
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2247
|
+
}
|
|
2248
|
+
_disownTarget() {
|
|
2249
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.target);
|
|
2250
|
+
}
|
|
2251
|
+
/**
|
|
2252
|
+
* What is to be disembargoed.
|
|
2253
|
+
*
|
|
2254
|
+
*/
|
|
2255
|
+
get target() {
|
|
2256
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, MessageTarget, this);
|
|
2257
|
+
}
|
|
2258
|
+
_hasTarget() {
|
|
2259
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2260
|
+
}
|
|
2261
|
+
_initTarget() {
|
|
2262
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, MessageTarget, this);
|
|
2263
|
+
}
|
|
2264
|
+
set target(value) {
|
|
2265
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2266
|
+
}
|
|
2267
|
+
get context() {
|
|
2268
|
+
return _chunkKXWOF6H4cjs.getAs.call(void 0, Disembargo_Context, this);
|
|
2269
|
+
}
|
|
2270
|
+
_initContext() {
|
|
2271
|
+
return _chunkKXWOF6H4cjs.getAs.call(void 0, Disembargo_Context, this);
|
|
2272
|
+
}
|
|
2273
|
+
toString() {
|
|
2274
|
+
return "Disembargo_" + super.toString();
|
|
2275
|
+
}
|
|
2276
|
+
}, _class14.__initStatic45(), _class14);
|
|
2277
|
+
var Provide = (_class15 = class extends _chunkKXWOF6H4cjs.Struct {
|
|
2278
|
+
static {
|
|
2279
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Provide");
|
|
2280
|
+
}
|
|
2281
|
+
static __initStatic46() {this._capnp = {
|
|
2282
|
+
displayName: "Provide",
|
|
2283
|
+
id: "9c6a046bfbc1ac5a",
|
|
2284
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(8, 2)
|
|
2285
|
+
}}
|
|
2286
|
+
/**
|
|
2287
|
+
* Question ID to be held open until the recipient has received the capability. A result will be
|
|
2288
|
+
* returned once the third party has successfully received the capability. The sender must at some
|
|
2289
|
+
* point send a `Finish` message as with any other call, and that message can be used to cancel the
|
|
2290
|
+
* whole operation.
|
|
2291
|
+
*
|
|
2292
|
+
*/
|
|
2293
|
+
get questionId() {
|
|
2294
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 0, this);
|
|
2295
|
+
}
|
|
2296
|
+
set questionId(value) {
|
|
2297
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 0, value, this);
|
|
2298
|
+
}
|
|
2299
|
+
_adoptTarget(value) {
|
|
2300
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2301
|
+
}
|
|
2302
|
+
_disownTarget() {
|
|
2303
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.target);
|
|
2304
|
+
}
|
|
2305
|
+
/**
|
|
2306
|
+
* What is to be provided to the third party.
|
|
2307
|
+
*
|
|
2308
|
+
*/
|
|
2309
|
+
get target() {
|
|
2310
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, MessageTarget, this);
|
|
2311
|
+
}
|
|
2312
|
+
_hasTarget() {
|
|
2313
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2314
|
+
}
|
|
2315
|
+
_initTarget() {
|
|
2316
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, MessageTarget, this);
|
|
2317
|
+
}
|
|
2318
|
+
set target(value) {
|
|
2319
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2320
|
+
}
|
|
2321
|
+
_adoptRecipient(value) {
|
|
2322
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 1, this));
|
|
2323
|
+
}
|
|
2324
|
+
_disownRecipient() {
|
|
2325
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.recipient);
|
|
2326
|
+
}
|
|
2327
|
+
/**
|
|
2328
|
+
* Identity of the third party that is expected to pick up the capability.
|
|
2329
|
+
*
|
|
2330
|
+
*/
|
|
2331
|
+
get recipient() {
|
|
2332
|
+
return _chunkKXWOF6H4cjs.getPointer.call(void 0, 1, this);
|
|
2333
|
+
}
|
|
2334
|
+
_hasRecipient() {
|
|
2335
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 1, this));
|
|
2336
|
+
}
|
|
2337
|
+
set recipient(value) {
|
|
2338
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 1, this));
|
|
2339
|
+
}
|
|
2340
|
+
toString() {
|
|
2341
|
+
return "Provide_" + super.toString();
|
|
2342
|
+
}
|
|
2343
|
+
}, _class15.__initStatic46(), _class15);
|
|
2344
|
+
var Accept = (_class16 = class extends _chunkKXWOF6H4cjs.Struct {
|
|
2345
|
+
static {
|
|
2346
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Accept");
|
|
2347
|
+
}
|
|
2348
|
+
static __initStatic47() {this._capnp = {
|
|
2349
|
+
displayName: "Accept",
|
|
2350
|
+
id: "d4c9b56290554016",
|
|
2351
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(8, 1)
|
|
2352
|
+
}}
|
|
2353
|
+
/**
|
|
2354
|
+
* A new question ID identifying this accept message, which will eventually receive a Return
|
|
2355
|
+
* message containing the provided capability (or the call result in the case of a redirected
|
|
2356
|
+
* return).
|
|
2357
|
+
*
|
|
2358
|
+
*/
|
|
2359
|
+
get questionId() {
|
|
2360
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 0, this);
|
|
2361
|
+
}
|
|
2362
|
+
set questionId(value) {
|
|
2363
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 0, value, this);
|
|
2364
|
+
}
|
|
2365
|
+
_adoptProvision(value) {
|
|
2366
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2367
|
+
}
|
|
2368
|
+
_disownProvision() {
|
|
2369
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.provision);
|
|
2370
|
+
}
|
|
2371
|
+
/**
|
|
2372
|
+
* Identifies the provided object to be picked up.
|
|
2373
|
+
*
|
|
2374
|
+
*/
|
|
2375
|
+
get provision() {
|
|
2376
|
+
return _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this);
|
|
2377
|
+
}
|
|
2378
|
+
_hasProvision() {
|
|
2379
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2380
|
+
}
|
|
2381
|
+
set provision(value) {
|
|
2382
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2383
|
+
}
|
|
2384
|
+
/**
|
|
2385
|
+
* If true, this accept shall be temporarily embargoed. The resulting `Return` will not be sent,
|
|
2386
|
+
* and any pipelined calls will not be delivered, until the embargo is released. The receiver
|
|
2387
|
+
* (the capability host) will expect the provider (the vat that sent the `Provide` message) to
|
|
2388
|
+
* eventually send a `Disembargo` message with the field `context.provide` set to the question ID
|
|
2389
|
+
* of the original `Provide` message. At that point, the embargo is released and the queued
|
|
2390
|
+
* messages are delivered.
|
|
2391
|
+
*
|
|
2392
|
+
* For example:
|
|
2393
|
+
* - Alice, in Vat A, holds a promise P, which currently points toward Vat B.
|
|
2394
|
+
* - Alice calls foo() on P. The `Call` message is sent to Vat B.
|
|
2395
|
+
* - The promise P in Vat B ends up resolving to Carol, in Vat C.
|
|
2396
|
+
* - Vat B sends a `Provide` message to Vat C, identifying Vat A as the recipient.
|
|
2397
|
+
* - Vat B sends a `Resolve` message to Vat A, indicating that the promise has resolved to a
|
|
2398
|
+
* `ThirdPartyCapId` identifying Carol in Vat C.
|
|
2399
|
+
* - Vat A sends an `Accept` message to Vat C to pick up the capability. Since Vat A knows that
|
|
2400
|
+
* it has an outstanding call to the promise, it sets `embargo` to `true` in the `Accept`
|
|
2401
|
+
* message.
|
|
2402
|
+
* - Vat A sends a `Disembargo` message to Vat B on promise P, with `context.accept` set.
|
|
2403
|
+
* - Alice makes a call bar() to promise P, which is now pointing towards Vat C. Alice doesn't
|
|
2404
|
+
* know anything about the mechanics of promise resolution happening under the hood, but she
|
|
2405
|
+
* expects that bar() will be delivered after foo() because that is the order in which she
|
|
2406
|
+
* initiated the calls.
|
|
2407
|
+
* - Vat A sends the bar() call to Vat C, as a pipelined call on the result of the `Accept` (which
|
|
2408
|
+
* hasn't returned yet, due to the embargo). Since calls to the newly-accepted capability
|
|
2409
|
+
* are embargoed, Vat C does not deliver the call yet.
|
|
2410
|
+
* - At some point, Vat B forwards the foo() call from the beginning of this example on to Vat C.
|
|
2411
|
+
* - Vat B forwards the `Disembargo` from Vat A on to vat C. It sets `context.provide` to the
|
|
2412
|
+
* question ID of the `Provide` message it had sent previously.
|
|
2413
|
+
* - Vat C receives foo() before `Disembargo`, thus allowing it to correctly deliver foo()
|
|
2414
|
+
* before delivering bar().
|
|
2415
|
+
* - Vat C receives `Disembargo` from Vat B. It can now send a `Return` for the `Accept` from
|
|
2416
|
+
* Vat A, as well as deliver bar().
|
|
2417
|
+
*
|
|
2418
|
+
*/
|
|
2419
|
+
get embargo() {
|
|
2420
|
+
return _chunkKXWOF6H4cjs.getBit.call(void 0, 32, this);
|
|
2421
|
+
}
|
|
2422
|
+
set embargo(value) {
|
|
2423
|
+
_chunkKXWOF6H4cjs.setBit.call(void 0, 32, value, this);
|
|
2424
|
+
}
|
|
2425
|
+
toString() {
|
|
2426
|
+
return "Accept_" + super.toString();
|
|
2427
|
+
}
|
|
2428
|
+
}, _class16.__initStatic47(), _class16);
|
|
2429
|
+
var Join = (_class17 = class extends _chunkKXWOF6H4cjs.Struct {
|
|
2430
|
+
static {
|
|
2431
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Join");
|
|
2432
|
+
}
|
|
2433
|
+
static __initStatic48() {this._capnp = {
|
|
2434
|
+
displayName: "Join",
|
|
2435
|
+
id: "fbe1980490e001af",
|
|
2436
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(8, 2)
|
|
2437
|
+
}}
|
|
2438
|
+
/**
|
|
2439
|
+
* Question ID used to respond to this Join. (Note that this ID only identifies one part of the
|
|
2440
|
+
* request for one hop; each part has a different ID and relayed copies of the request have
|
|
2441
|
+
* (probably) different IDs still.)
|
|
2442
|
+
*
|
|
2443
|
+
* The receiver will reply with a `Return` whose `results` is a JoinResult. This `JoinResult`
|
|
2444
|
+
* is relayed from the joined object's host, possibly with transformation applied as needed
|
|
2445
|
+
* by the network.
|
|
2446
|
+
*
|
|
2447
|
+
* Like any return, the result must be released using a `Finish`. However, this release
|
|
2448
|
+
* should not occur until the joiner has either successfully connected to the joined object.
|
|
2449
|
+
* Vats relaying a `Join` message similarly must not release the result they receive until the
|
|
2450
|
+
* return they relayed back towards the joiner has itself been released. This allows the
|
|
2451
|
+
* joined object's host to detect when the Join operation is canceled before completing -- if
|
|
2452
|
+
* it receives a `Finish` for one of the join results before the joiner successfully
|
|
2453
|
+
* connects. It can then free any resources it had allocated as part of the join.
|
|
2454
|
+
*
|
|
2455
|
+
*/
|
|
2456
|
+
get questionId() {
|
|
2457
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 0, this);
|
|
2458
|
+
}
|
|
2459
|
+
set questionId(value) {
|
|
2460
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 0, value, this);
|
|
2461
|
+
}
|
|
2462
|
+
_adoptTarget(value) {
|
|
2463
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2464
|
+
}
|
|
2465
|
+
_disownTarget() {
|
|
2466
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.target);
|
|
2467
|
+
}
|
|
2468
|
+
/**
|
|
2469
|
+
* The capability to join.
|
|
2470
|
+
*
|
|
2471
|
+
*/
|
|
2472
|
+
get target() {
|
|
2473
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, MessageTarget, this);
|
|
2474
|
+
}
|
|
2475
|
+
_hasTarget() {
|
|
2476
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2477
|
+
}
|
|
2478
|
+
_initTarget() {
|
|
2479
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, MessageTarget, this);
|
|
2480
|
+
}
|
|
2481
|
+
set target(value) {
|
|
2482
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2483
|
+
}
|
|
2484
|
+
_adoptKeyPart(value) {
|
|
2485
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 1, this));
|
|
2486
|
+
}
|
|
2487
|
+
_disownKeyPart() {
|
|
2488
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.keyPart);
|
|
2489
|
+
}
|
|
2490
|
+
/**
|
|
2491
|
+
* A part of the join key. These combine to form the complete join key, which is used to establish
|
|
2492
|
+
* a direct connection.
|
|
2493
|
+
*
|
|
2494
|
+
*/
|
|
2495
|
+
get keyPart() {
|
|
2496
|
+
return _chunkKXWOF6H4cjs.getPointer.call(void 0, 1, this);
|
|
2497
|
+
}
|
|
2498
|
+
_hasKeyPart() {
|
|
2499
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 1, this));
|
|
2500
|
+
}
|
|
2501
|
+
set keyPart(value) {
|
|
2502
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 1, this));
|
|
2503
|
+
}
|
|
2504
|
+
toString() {
|
|
2505
|
+
return "Join_" + super.toString();
|
|
2506
|
+
}
|
|
2507
|
+
}, _class17.__initStatic48(), _class17);
|
|
2508
|
+
var MessageTarget_Which = {
|
|
2509
|
+
/**
|
|
2510
|
+
* This message is to a capability or promise previously imported by the caller (exported by
|
|
2511
|
+
* the receiver).
|
|
2512
|
+
*
|
|
2513
|
+
*/
|
|
2514
|
+
IMPORTED_CAP: 0,
|
|
2515
|
+
/**
|
|
2516
|
+
* This message is to a capability that is expected to be returned by another call that has not
|
|
2517
|
+
* yet been completed.
|
|
2518
|
+
*
|
|
2519
|
+
* At level 0, this is supported only for addressing the result of a previous `Bootstrap`, so
|
|
2520
|
+
* that initial startup doesn't require a round trip.
|
|
2521
|
+
*
|
|
2522
|
+
*/
|
|
2523
|
+
PROMISED_ANSWER: 1
|
|
2524
|
+
};
|
|
2525
|
+
var MessageTarget = (_class18 = class extends _chunkKXWOF6H4cjs.Struct {
|
|
2526
|
+
static {
|
|
2527
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "MessageTarget");
|
|
2528
|
+
}
|
|
2529
|
+
static __initStatic49() {this.IMPORTED_CAP = MessageTarget_Which.IMPORTED_CAP}
|
|
2530
|
+
static __initStatic50() {this.PROMISED_ANSWER = MessageTarget_Which.PROMISED_ANSWER}
|
|
2531
|
+
static __initStatic51() {this._capnp = {
|
|
2532
|
+
displayName: "MessageTarget",
|
|
2533
|
+
id: "95bc14545813fbc1",
|
|
2534
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(8, 1)
|
|
2535
|
+
}}
|
|
2536
|
+
/**
|
|
2537
|
+
* This message is to a capability or promise previously imported by the caller (exported by
|
|
2538
|
+
* the receiver).
|
|
2539
|
+
*
|
|
2540
|
+
*/
|
|
2541
|
+
get importedCap() {
|
|
2542
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "importedCap", _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this), 0, this);
|
|
2543
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 0, this);
|
|
2544
|
+
}
|
|
2545
|
+
get _isImportedCap() {
|
|
2546
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this) === 0;
|
|
2547
|
+
}
|
|
2548
|
+
set importedCap(value) {
|
|
2549
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 4, 0, this);
|
|
2550
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 0, value, this);
|
|
2551
|
+
}
|
|
2552
|
+
_adoptPromisedAnswer(value) {
|
|
2553
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 4, 1, this);
|
|
2554
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2555
|
+
}
|
|
2556
|
+
_disownPromisedAnswer() {
|
|
2557
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.promisedAnswer);
|
|
2558
|
+
}
|
|
2559
|
+
/**
|
|
2560
|
+
* This message is to a capability that is expected to be returned by another call that has not
|
|
2561
|
+
* yet been completed.
|
|
2562
|
+
*
|
|
2563
|
+
* At level 0, this is supported only for addressing the result of a previous `Bootstrap`, so
|
|
2564
|
+
* that initial startup doesn't require a round trip.
|
|
2565
|
+
*
|
|
2566
|
+
*/
|
|
2567
|
+
get promisedAnswer() {
|
|
2568
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "promisedAnswer", _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this), 1, this);
|
|
2569
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, PromisedAnswer, this);
|
|
2570
|
+
}
|
|
2571
|
+
_hasPromisedAnswer() {
|
|
2572
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2573
|
+
}
|
|
2574
|
+
_initPromisedAnswer() {
|
|
2575
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 4, 1, this);
|
|
2576
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, PromisedAnswer, this);
|
|
2577
|
+
}
|
|
2578
|
+
get _isPromisedAnswer() {
|
|
2579
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this) === 1;
|
|
2580
|
+
}
|
|
2581
|
+
set promisedAnswer(value) {
|
|
2582
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 4, 1, this);
|
|
2583
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2584
|
+
}
|
|
2585
|
+
toString() {
|
|
2586
|
+
return "MessageTarget_" + super.toString();
|
|
2587
|
+
}
|
|
2588
|
+
which() {
|
|
2589
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this);
|
|
2590
|
+
}
|
|
2591
|
+
}, _class18.__initStatic49(), _class18.__initStatic50(), _class18.__initStatic51(), _class18);
|
|
2592
|
+
var Payload = (_class19 = class _Payload extends _chunkKXWOF6H4cjs.Struct {
|
|
2593
|
+
static {
|
|
2594
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Payload");
|
|
2595
|
+
}
|
|
2596
|
+
static __initStatic52() {this._capnp = {
|
|
2597
|
+
displayName: "Payload",
|
|
2598
|
+
id: "9a0e61223d96743b",
|
|
2599
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(0, 2)
|
|
2600
|
+
}}
|
|
2601
|
+
|
|
2602
|
+
_adoptContent(value) {
|
|
2603
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2604
|
+
}
|
|
2605
|
+
_disownContent() {
|
|
2606
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.content);
|
|
2607
|
+
}
|
|
2608
|
+
/**
|
|
2609
|
+
* Some Cap'n Proto data structure. Capability pointers embedded in this structure index into
|
|
2610
|
+
* `capTable`.
|
|
2611
|
+
*
|
|
2612
|
+
*/
|
|
2613
|
+
get content() {
|
|
2614
|
+
return _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this);
|
|
2615
|
+
}
|
|
2616
|
+
_hasContent() {
|
|
2617
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2618
|
+
}
|
|
2619
|
+
set content(value) {
|
|
2620
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2621
|
+
}
|
|
2622
|
+
_adoptCapTable(value) {
|
|
2623
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 1, this));
|
|
2624
|
+
}
|
|
2625
|
+
_disownCapTable() {
|
|
2626
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.capTable);
|
|
2627
|
+
}
|
|
2628
|
+
/**
|
|
2629
|
+
* Descriptors corresponding to the cap pointers in `content`.
|
|
2630
|
+
*
|
|
2631
|
+
*/
|
|
2632
|
+
get capTable() {
|
|
2633
|
+
return _chunkKXWOF6H4cjs.getList.call(void 0, 1, _Payload._CapTable, this);
|
|
2634
|
+
}
|
|
2635
|
+
_hasCapTable() {
|
|
2636
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 1, this));
|
|
2637
|
+
}
|
|
2638
|
+
_initCapTable(length) {
|
|
2639
|
+
return _chunkKXWOF6H4cjs.initList.call(void 0, 1, _Payload._CapTable, length, this);
|
|
2640
|
+
}
|
|
2641
|
+
set capTable(value) {
|
|
2642
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 1, this));
|
|
2643
|
+
}
|
|
2644
|
+
toString() {
|
|
2645
|
+
return "Payload_" + super.toString();
|
|
2646
|
+
}
|
|
2647
|
+
}, _class19.__initStatic52(), _class19);
|
|
2648
|
+
var CapDescriptor_Which = {
|
|
2649
|
+
/**
|
|
2650
|
+
* There is no capability here. This `CapDescriptor` should not appear in the payload content.
|
|
2651
|
+
* A `none` CapDescriptor can be generated when an application inserts a capability into a
|
|
2652
|
+
* message and then later changes its mind and removes it -- rewriting all of the other
|
|
2653
|
+
* capability pointers may be hard, so instead a tombstone is left, similar to the way a removed
|
|
2654
|
+
* struct or list instance is zeroed out of the message but the space is not reclaimed.
|
|
2655
|
+
* Hopefully this is unusual.
|
|
2656
|
+
*
|
|
2657
|
+
*/
|
|
2658
|
+
NONE: 0,
|
|
2659
|
+
/**
|
|
2660
|
+
* The ID of a capability in the sender's export table (receiver's import table). It may be a
|
|
2661
|
+
* newly allocated table entry, or an existing entry (increments the reference count).
|
|
2662
|
+
*
|
|
2663
|
+
*/
|
|
2664
|
+
SENDER_HOSTED: 1,
|
|
2665
|
+
/**
|
|
2666
|
+
* A promise that the sender will resolve later. The sender will send exactly one Resolve
|
|
2667
|
+
* message at a future point in time to replace this promise. Note that even if the same
|
|
2668
|
+
* `senderPromise` is received multiple times, only one `Resolve` is sent to cover all of
|
|
2669
|
+
* them. If `senderPromise` is released before the `Resolve` is sent, the sender (of this
|
|
2670
|
+
* `CapDescriptor`) may choose not to send the `Resolve` at all.
|
|
2671
|
+
*
|
|
2672
|
+
*/
|
|
2673
|
+
SENDER_PROMISE: 2,
|
|
2674
|
+
/**
|
|
2675
|
+
* A capability (or promise) previously exported by the receiver (imported by the sender).
|
|
2676
|
+
*
|
|
2677
|
+
*/
|
|
2678
|
+
RECEIVER_HOSTED: 3,
|
|
2679
|
+
/**
|
|
2680
|
+
* A capability expected to be returned in the results of a currently-outstanding call posed
|
|
2681
|
+
* by the sender.
|
|
2682
|
+
*
|
|
2683
|
+
*/
|
|
2684
|
+
RECEIVER_ANSWER: 4,
|
|
2685
|
+
/**
|
|
2686
|
+
* **(level 3)**
|
|
2687
|
+
*
|
|
2688
|
+
* A capability that lives in neither the sender's nor the receiver's vat. The sender needs
|
|
2689
|
+
* to form a direct connection to a third party to pick up the capability.
|
|
2690
|
+
*
|
|
2691
|
+
* Level 1 and 2 implementations that receive a `thirdPartyHosted` may simply send calls to its
|
|
2692
|
+
* `vine` instead.
|
|
2693
|
+
*
|
|
2694
|
+
*/
|
|
2695
|
+
THIRD_PARTY_HOSTED: 5
|
|
2696
|
+
};
|
|
2697
|
+
var CapDescriptor = (_class20 = class _CapDescriptor extends _chunkKXWOF6H4cjs.Struct {
|
|
2698
|
+
static {
|
|
2699
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "CapDescriptor");
|
|
2700
|
+
}
|
|
2701
|
+
static __initStatic53() {this.NONE = CapDescriptor_Which.NONE}
|
|
2702
|
+
static __initStatic54() {this.SENDER_HOSTED = CapDescriptor_Which.SENDER_HOSTED}
|
|
2703
|
+
static __initStatic55() {this.SENDER_PROMISE = CapDescriptor_Which.SENDER_PROMISE}
|
|
2704
|
+
static __initStatic56() {this.RECEIVER_HOSTED = CapDescriptor_Which.RECEIVER_HOSTED}
|
|
2705
|
+
static __initStatic57() {this.RECEIVER_ANSWER = CapDescriptor_Which.RECEIVER_ANSWER}
|
|
2706
|
+
static __initStatic58() {this.THIRD_PARTY_HOSTED = CapDescriptor_Which.THIRD_PARTY_HOSTED}
|
|
2707
|
+
static __initStatic59() {this._capnp = {
|
|
2708
|
+
displayName: "CapDescriptor",
|
|
2709
|
+
id: "8523ddc40b86b8b0",
|
|
2710
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(8, 1),
|
|
2711
|
+
defaultAttachedFd: _chunkKXWOF6H4cjs.getUint8Mask.call(void 0, 255)
|
|
2712
|
+
}}
|
|
2713
|
+
get _isNone() {
|
|
2714
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 0;
|
|
2715
|
+
}
|
|
2716
|
+
set none(_) {
|
|
2717
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 0, this);
|
|
2718
|
+
}
|
|
2719
|
+
/**
|
|
2720
|
+
* The ID of a capability in the sender's export table (receiver's import table). It may be a
|
|
2721
|
+
* newly allocated table entry, or an existing entry (increments the reference count).
|
|
2722
|
+
*
|
|
2723
|
+
*/
|
|
2724
|
+
get senderHosted() {
|
|
2725
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "senderHosted", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 1, this);
|
|
2726
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 4, this);
|
|
2727
|
+
}
|
|
2728
|
+
get _isSenderHosted() {
|
|
2729
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 1;
|
|
2730
|
+
}
|
|
2731
|
+
set senderHosted(value) {
|
|
2732
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 1, this);
|
|
2733
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 4, value, this);
|
|
2734
|
+
}
|
|
2735
|
+
/**
|
|
2736
|
+
* A promise that the sender will resolve later. The sender will send exactly one Resolve
|
|
2737
|
+
* message at a future point in time to replace this promise. Note that even if the same
|
|
2738
|
+
* `senderPromise` is received multiple times, only one `Resolve` is sent to cover all of
|
|
2739
|
+
* them. If `senderPromise` is released before the `Resolve` is sent, the sender (of this
|
|
2740
|
+
* `CapDescriptor`) may choose not to send the `Resolve` at all.
|
|
2741
|
+
*
|
|
2742
|
+
*/
|
|
2743
|
+
get senderPromise() {
|
|
2744
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "senderPromise", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 2, this);
|
|
2745
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 4, this);
|
|
2746
|
+
}
|
|
2747
|
+
get _isSenderPromise() {
|
|
2748
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 2;
|
|
2749
|
+
}
|
|
2750
|
+
set senderPromise(value) {
|
|
2751
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 2, this);
|
|
2752
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 4, value, this);
|
|
2753
|
+
}
|
|
2754
|
+
/**
|
|
2755
|
+
* A capability (or promise) previously exported by the receiver (imported by the sender).
|
|
2756
|
+
*
|
|
2757
|
+
*/
|
|
2758
|
+
get receiverHosted() {
|
|
2759
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "receiverHosted", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 3, this);
|
|
2760
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 4, this);
|
|
2761
|
+
}
|
|
2762
|
+
get _isReceiverHosted() {
|
|
2763
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 3;
|
|
2764
|
+
}
|
|
2765
|
+
set receiverHosted(value) {
|
|
2766
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 3, this);
|
|
2767
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 4, value, this);
|
|
2768
|
+
}
|
|
2769
|
+
_adoptReceiverAnswer(value) {
|
|
2770
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 4, this);
|
|
2771
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2772
|
+
}
|
|
2773
|
+
_disownReceiverAnswer() {
|
|
2774
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.receiverAnswer);
|
|
2775
|
+
}
|
|
2776
|
+
/**
|
|
2777
|
+
* A capability expected to be returned in the results of a currently-outstanding call posed
|
|
2778
|
+
* by the sender.
|
|
2779
|
+
*
|
|
2780
|
+
*/
|
|
2781
|
+
get receiverAnswer() {
|
|
2782
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "receiverAnswer", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 4, this);
|
|
2783
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, PromisedAnswer, this);
|
|
2784
|
+
}
|
|
2785
|
+
_hasReceiverAnswer() {
|
|
2786
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2787
|
+
}
|
|
2788
|
+
_initReceiverAnswer() {
|
|
2789
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 4, this);
|
|
2790
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, PromisedAnswer, this);
|
|
2791
|
+
}
|
|
2792
|
+
get _isReceiverAnswer() {
|
|
2793
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 4;
|
|
2794
|
+
}
|
|
2795
|
+
set receiverAnswer(value) {
|
|
2796
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 4, this);
|
|
2797
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2798
|
+
}
|
|
2799
|
+
_adoptThirdPartyHosted(value) {
|
|
2800
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 5, this);
|
|
2801
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2802
|
+
}
|
|
2803
|
+
_disownThirdPartyHosted() {
|
|
2804
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.thirdPartyHosted);
|
|
2805
|
+
}
|
|
2806
|
+
/**
|
|
2807
|
+
* **(level 3)**
|
|
2808
|
+
*
|
|
2809
|
+
* A capability that lives in neither the sender's nor the receiver's vat. The sender needs
|
|
2810
|
+
* to form a direct connection to a third party to pick up the capability.
|
|
2811
|
+
*
|
|
2812
|
+
* Level 1 and 2 implementations that receive a `thirdPartyHosted` may simply send calls to its
|
|
2813
|
+
* `vine` instead.
|
|
2814
|
+
*
|
|
2815
|
+
*/
|
|
2816
|
+
get thirdPartyHosted() {
|
|
2817
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "thirdPartyHosted", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 5, this);
|
|
2818
|
+
return _chunkKXWOF6H4cjs.getStruct.call(void 0, 0, ThirdPartyCapDescriptor, this);
|
|
2819
|
+
}
|
|
2820
|
+
_hasThirdPartyHosted() {
|
|
2821
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2822
|
+
}
|
|
2823
|
+
_initThirdPartyHosted() {
|
|
2824
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 5, this);
|
|
2825
|
+
return _chunkKXWOF6H4cjs.initStructAt.call(void 0, 0, ThirdPartyCapDescriptor, this);
|
|
2826
|
+
}
|
|
2827
|
+
get _isThirdPartyHosted() {
|
|
2828
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 5;
|
|
2829
|
+
}
|
|
2830
|
+
set thirdPartyHosted(value) {
|
|
2831
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 5, this);
|
|
2832
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2833
|
+
}
|
|
2834
|
+
/**
|
|
2835
|
+
* If the RPC message in which this CapDescriptor was delivered also had file descriptors
|
|
2836
|
+
* attached, and `fd` is a valid index into the list of attached file descriptors, then
|
|
2837
|
+
* that file descriptor should be attached to this capability. If `attachedFd` is out-of-bounds
|
|
2838
|
+
* for said list, then no FD is attached.
|
|
2839
|
+
*
|
|
2840
|
+
* For example, if the RPC message arrived over a Unix socket, then file descriptors may be
|
|
2841
|
+
* attached by sending an SCM_RIGHTS ancillary message attached to the data bytes making up the
|
|
2842
|
+
* raw message. Receivers who wish to opt into FD passing should arrange to receive SCM_RIGHTS
|
|
2843
|
+
* whenever receiving an RPC message. Senders who wish to send FDs need not verify whether the
|
|
2844
|
+
* receiver knows how to receive them, because the operating system will automatically discard
|
|
2845
|
+
* ancillary messages like SCM_RIGHTS if the receiver doesn't ask to receive them, including
|
|
2846
|
+
* automatically closing any FDs.
|
|
2847
|
+
*
|
|
2848
|
+
* It is up to the application protocol to define what capabilities are expected to have file
|
|
2849
|
+
* descriptors attached, and what those FDs mean. But, for example, an application could use this
|
|
2850
|
+
* to open a file on disk and then transmit the open file descriptor to a sandboxed process that
|
|
2851
|
+
* does not otherwise have permission to access the filesystem directly. This is usually an
|
|
2852
|
+
* optimization: the sending process could instead provide an RPC interface supporting all the
|
|
2853
|
+
* operations needed (such as reading and writing a file), but by passing the file descriptor
|
|
2854
|
+
* directly, the recipient can often perform operations much more efficiently. Application
|
|
2855
|
+
* designers are encouraged to provide such RPC interfaces and automatically fall back to them
|
|
2856
|
+
* when FD passing is not available, so that the application can still work when the parties are
|
|
2857
|
+
* remote over a network.
|
|
2858
|
+
*
|
|
2859
|
+
* An attached FD is most often associated with a `senderHosted` descriptor. It could also make
|
|
2860
|
+
* sense in the case of `thirdPartyHosted`: in this case, the sender is forwarding the FD that
|
|
2861
|
+
* they received from the third party, so that the receiver can start using it without first
|
|
2862
|
+
* interacting with the third party. This is an optional optimization -- the middleman may choose
|
|
2863
|
+
* not to forward capabilities, in which case the receiver will need to complete the handshake
|
|
2864
|
+
* with the third party directly before receiving the FD. If an implementation receives a second
|
|
2865
|
+
* attached FD after having already received one previously (e.g. both in a `thirdPartyHosted`
|
|
2866
|
+
* CapDescriptor and then later again when receiving the final capability directly from the
|
|
2867
|
+
* third party), the implementation should discard the later FD and stick with the original. At
|
|
2868
|
+
* present, there is no known reason why other capability types (e.g. `receiverHosted`) would want
|
|
2869
|
+
* to carry an attached FD, but we reserve the right to define a meaning for this in the future.
|
|
2870
|
+
*
|
|
2871
|
+
* Each file descriptor attached to the message must be used in no more than one CapDescriptor,
|
|
2872
|
+
* so that the receiver does not need to use dup() or refcounting to handle the possibility of
|
|
2873
|
+
* multiple capabilities using the same descriptor. If multiple CapDescriptors do point to the
|
|
2874
|
+
* same FD index, then the receiver can arbitrarily choose which capability ends up having the
|
|
2875
|
+
* FD attached.
|
|
2876
|
+
*
|
|
2877
|
+
* To mitigate DoS attacks, RPC implementations should limit the number of FDs they are willing to
|
|
2878
|
+
* receive in a single message to a small value. If a message happens to contain more than that,
|
|
2879
|
+
* the list is truncated. Moreover, in some cases, FD passing needs to be blocked entirely for
|
|
2880
|
+
* security or implementation reasons, in which case the list may be truncated to zero. Hence,
|
|
2881
|
+
* `attachedFd` might point past the end of the list, which the implementation should treat as if
|
|
2882
|
+
* no FD was attached at all.
|
|
2883
|
+
*
|
|
2884
|
+
* The type of this field was chosen to be UInt8 because Linux supports sending only a maximum
|
|
2885
|
+
* of 253 file descriptors in an SCM_RIGHTS message anyway, and CapDescriptor had two bytes of
|
|
2886
|
+
* padding left -- so after adding this, there is still one byte for a future feature.
|
|
2887
|
+
* Conveniently, this also means we're able to use 0xff as the default value, which will always
|
|
2888
|
+
* be out-of-range (of course, the implementation should explicitly enforce that 255 descriptors
|
|
2889
|
+
* cannot be sent at once, rather than relying on Linux to do so).
|
|
2890
|
+
*
|
|
2891
|
+
*/
|
|
2892
|
+
get attachedFd() {
|
|
2893
|
+
return _chunkKXWOF6H4cjs.getUint8.call(void 0, 2, this, _CapDescriptor._capnp.defaultAttachedFd);
|
|
2894
|
+
}
|
|
2895
|
+
set attachedFd(value) {
|
|
2896
|
+
_chunkKXWOF6H4cjs.setUint8.call(void 0, 2, value, this, _CapDescriptor._capnp.defaultAttachedFd);
|
|
2897
|
+
}
|
|
2898
|
+
toString() {
|
|
2899
|
+
return "CapDescriptor_" + super.toString();
|
|
2900
|
+
}
|
|
2901
|
+
which() {
|
|
2902
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this);
|
|
2903
|
+
}
|
|
2904
|
+
}, _class20.__initStatic53(), _class20.__initStatic54(), _class20.__initStatic55(), _class20.__initStatic56(), _class20.__initStatic57(), _class20.__initStatic58(), _class20.__initStatic59(), _class20);
|
|
2905
|
+
var PromisedAnswer_Op_Which = {
|
|
2906
|
+
/**
|
|
2907
|
+
* Does nothing. This member is mostly defined so that we can make `Op` a union even
|
|
2908
|
+
* though (as of this writing) only one real operation is defined.
|
|
2909
|
+
*
|
|
2910
|
+
*/
|
|
2911
|
+
NOOP: 0,
|
|
2912
|
+
/**
|
|
2913
|
+
* Get a pointer field within a struct. The number is an index into the pointer section, NOT
|
|
2914
|
+
* a field ordinal, so that the receiver does not need to understand the schema.
|
|
2915
|
+
*
|
|
2916
|
+
*/
|
|
2917
|
+
GET_POINTER_FIELD: 1
|
|
2918
|
+
};
|
|
2919
|
+
var PromisedAnswer_Op = (_class21 = class extends _chunkKXWOF6H4cjs.Struct {
|
|
2920
|
+
static {
|
|
2921
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "PromisedAnswer_Op");
|
|
2922
|
+
}
|
|
2923
|
+
static __initStatic60() {this.NOOP = PromisedAnswer_Op_Which.NOOP}
|
|
2924
|
+
static __initStatic61() {this.GET_POINTER_FIELD = PromisedAnswer_Op_Which.GET_POINTER_FIELD}
|
|
2925
|
+
static __initStatic62() {this._capnp = {
|
|
2926
|
+
displayName: "Op",
|
|
2927
|
+
id: "f316944415569081",
|
|
2928
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(8, 0)
|
|
2929
|
+
}}
|
|
2930
|
+
get _isNoop() {
|
|
2931
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 0;
|
|
2932
|
+
}
|
|
2933
|
+
set noop(_) {
|
|
2934
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 0, this);
|
|
2935
|
+
}
|
|
2936
|
+
/**
|
|
2937
|
+
* Get a pointer field within a struct. The number is an index into the pointer section, NOT
|
|
2938
|
+
* a field ordinal, so that the receiver does not need to understand the schema.
|
|
2939
|
+
*
|
|
2940
|
+
*/
|
|
2941
|
+
get getPointerField() {
|
|
2942
|
+
_chunkKXWOF6H4cjs.testWhich.call(void 0, "getPointerField", _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this), 1, this);
|
|
2943
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 2, this);
|
|
2944
|
+
}
|
|
2945
|
+
get _isGetPointerField() {
|
|
2946
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this) === 1;
|
|
2947
|
+
}
|
|
2948
|
+
set getPointerField(value) {
|
|
2949
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 0, 1, this);
|
|
2950
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 2, value, this);
|
|
2951
|
+
}
|
|
2952
|
+
toString() {
|
|
2953
|
+
return "PromisedAnswer_Op_" + super.toString();
|
|
2954
|
+
}
|
|
2955
|
+
which() {
|
|
2956
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 0, this);
|
|
2957
|
+
}
|
|
2958
|
+
}, _class21.__initStatic60(), _class21.__initStatic61(), _class21.__initStatic62(), _class21);
|
|
2959
|
+
var PromisedAnswer = (_class22 = class _PromisedAnswer extends _chunkKXWOF6H4cjs.Struct {
|
|
2960
|
+
static {
|
|
2961
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "PromisedAnswer");
|
|
2962
|
+
}
|
|
2963
|
+
static __initStatic63() {this.Op = PromisedAnswer_Op}
|
|
2964
|
+
static __initStatic64() {this._capnp = {
|
|
2965
|
+
displayName: "PromisedAnswer",
|
|
2966
|
+
id: "d800b1d6cd6f1ca0",
|
|
2967
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(8, 1)
|
|
2968
|
+
}}
|
|
2969
|
+
|
|
2970
|
+
/**
|
|
2971
|
+
* ID of the question (in the sender's question table / receiver's answer table) whose answer is
|
|
2972
|
+
* expected to contain the capability.
|
|
2973
|
+
*
|
|
2974
|
+
*/
|
|
2975
|
+
get questionId() {
|
|
2976
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 0, this);
|
|
2977
|
+
}
|
|
2978
|
+
set questionId(value) {
|
|
2979
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 0, value, this);
|
|
2980
|
+
}
|
|
2981
|
+
_adoptTransform(value) {
|
|
2982
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2983
|
+
}
|
|
2984
|
+
_disownTransform() {
|
|
2985
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.transform);
|
|
2986
|
+
}
|
|
2987
|
+
/**
|
|
2988
|
+
* Operations / transformations to apply to the result in order to get the capability actually
|
|
2989
|
+
* being addressed. E.g. if the result is a struct and you want to call a method on a capability
|
|
2990
|
+
* pointed to by a field of the struct, you need a `getPointerField` op.
|
|
2991
|
+
*
|
|
2992
|
+
*/
|
|
2993
|
+
get transform() {
|
|
2994
|
+
return _chunkKXWOF6H4cjs.getList.call(void 0, 0, _PromisedAnswer._Transform, this);
|
|
2995
|
+
}
|
|
2996
|
+
_hasTransform() {
|
|
2997
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
2998
|
+
}
|
|
2999
|
+
_initTransform(length) {
|
|
3000
|
+
return _chunkKXWOF6H4cjs.initList.call(void 0, 0, _PromisedAnswer._Transform, length, this);
|
|
3001
|
+
}
|
|
3002
|
+
set transform(value) {
|
|
3003
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
3004
|
+
}
|
|
3005
|
+
toString() {
|
|
3006
|
+
return "PromisedAnswer_" + super.toString();
|
|
3007
|
+
}
|
|
3008
|
+
}, _class22.__initStatic63(), _class22.__initStatic64(), _class22);
|
|
3009
|
+
var ThirdPartyCapDescriptor = (_class23 = class extends _chunkKXWOF6H4cjs.Struct {
|
|
3010
|
+
static {
|
|
3011
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "ThirdPartyCapDescriptor");
|
|
3012
|
+
}
|
|
3013
|
+
static __initStatic65() {this._capnp = {
|
|
3014
|
+
displayName: "ThirdPartyCapDescriptor",
|
|
3015
|
+
id: "d37007fde1f0027d",
|
|
3016
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(8, 1)
|
|
3017
|
+
}}
|
|
3018
|
+
_adoptId(value) {
|
|
3019
|
+
_chunkKXWOF6H4cjs.adopt.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
3020
|
+
}
|
|
3021
|
+
_disownId() {
|
|
3022
|
+
return _chunkKXWOF6H4cjs.disown.call(void 0, this.id);
|
|
3023
|
+
}
|
|
3024
|
+
/**
|
|
3025
|
+
* Identifies the third-party host and the specific capability to accept from it.
|
|
3026
|
+
*
|
|
3027
|
+
*/
|
|
3028
|
+
get id() {
|
|
3029
|
+
return _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this);
|
|
3030
|
+
}
|
|
3031
|
+
_hasId() {
|
|
3032
|
+
return !_chunkKXWOF6H4cjs.isNull.call(void 0, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
3033
|
+
}
|
|
3034
|
+
set id(value) {
|
|
3035
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, _chunkKXWOF6H4cjs.getPointer.call(void 0, 0, this));
|
|
3036
|
+
}
|
|
3037
|
+
/**
|
|
3038
|
+
* A proxy for the third-party object exported by the sender. In CapTP terminology this is called
|
|
3039
|
+
* a "vine", because it is an indirect reference to the third-party object that snakes through the
|
|
3040
|
+
* sender vat. This serves two purposes:
|
|
3041
|
+
*
|
|
3042
|
+
* * Level 1 and 2 implementations that don't understand how to connect to a third party may
|
|
3043
|
+
* simply send calls to the vine. Such calls will be forwarded to the third-party by the
|
|
3044
|
+
* sender.
|
|
3045
|
+
*
|
|
3046
|
+
* * Level 3 implementations must release the vine only once they have successfully picked up the
|
|
3047
|
+
* object from the third party. This ensures that the capability is not released by the sender
|
|
3048
|
+
* prematurely.
|
|
3049
|
+
*
|
|
3050
|
+
* The sender will close the `Provide` request that it has sent to the third party as soon as
|
|
3051
|
+
* it receives either a `Call` or a `Release` message directed at the vine.
|
|
3052
|
+
*
|
|
3053
|
+
*/
|
|
3054
|
+
get vineId() {
|
|
3055
|
+
return _chunkKXWOF6H4cjs.getUint32.call(void 0, 0, this);
|
|
3056
|
+
}
|
|
3057
|
+
set vineId(value) {
|
|
3058
|
+
_chunkKXWOF6H4cjs.setUint32.call(void 0, 0, value, this);
|
|
3059
|
+
}
|
|
3060
|
+
toString() {
|
|
3061
|
+
return "ThirdPartyCapDescriptor_" + super.toString();
|
|
3062
|
+
}
|
|
3063
|
+
}, _class23.__initStatic65(), _class23);
|
|
3064
|
+
var Exception_Type = {
|
|
3065
|
+
/**
|
|
3066
|
+
* A generic problem occurred, and it is believed that if the operation were repeated without
|
|
3067
|
+
* any change in the state of the world, the problem would occur again.
|
|
3068
|
+
*
|
|
3069
|
+
* A client might respond to this error by logging it for investigation by the developer and/or
|
|
3070
|
+
* displaying it to the user.
|
|
3071
|
+
*
|
|
3072
|
+
*/
|
|
3073
|
+
FAILED: 0,
|
|
3074
|
+
/**
|
|
3075
|
+
* The request was rejected due to a temporary lack of resources.
|
|
3076
|
+
*
|
|
3077
|
+
* Examples include:
|
|
3078
|
+
* - There's not enough CPU time to keep up with incoming requests, so some are rejected.
|
|
3079
|
+
* - The server ran out of RAM or disk space during the request.
|
|
3080
|
+
* - The operation timed out (took significantly longer than it should have).
|
|
3081
|
+
*
|
|
3082
|
+
* A client might respond to this error by scheduling to retry the operation much later. The
|
|
3083
|
+
* client should NOT retry again immediately since this would likely exacerbate the problem.
|
|
3084
|
+
*
|
|
3085
|
+
*/
|
|
3086
|
+
OVERLOADED: 1,
|
|
3087
|
+
/**
|
|
3088
|
+
* The method failed because a connection to some necessary capability was lost.
|
|
3089
|
+
*
|
|
3090
|
+
* Examples include:
|
|
3091
|
+
* - The client introduced the server to a third-party capability, the connection to that third
|
|
3092
|
+
* party was subsequently lost, and then the client requested that the server use the dead
|
|
3093
|
+
* capability for something.
|
|
3094
|
+
* - The client previously requested that the server obtain a capability from some third party.
|
|
3095
|
+
* The server returned a capability to an object wrapping the third-party capability. Later,
|
|
3096
|
+
* the server's connection to the third party was lost.
|
|
3097
|
+
* - The capability has been revoked. Revocation does not necessarily mean that the client is
|
|
3098
|
+
* no longer authorized to use the capability; it is often used simply as a way to force the
|
|
3099
|
+
* client to repeat the setup process, perhaps to efficiently move them to a new back-end or
|
|
3100
|
+
* get them to recognize some other change that has occurred.
|
|
3101
|
+
*
|
|
3102
|
+
* A client should normally respond to this error by releasing all capabilities it is currently
|
|
3103
|
+
* holding related to the one it called and then re-creating them by restoring SturdyRefs and/or
|
|
3104
|
+
* repeating the method calls used to create them originally. In other words, disconnect and
|
|
3105
|
+
* start over. This should in turn cause the server to obtain a new copy of the capability that
|
|
3106
|
+
* it lost, thus making everything work.
|
|
3107
|
+
*
|
|
3108
|
+
* If the client receives another `disconnected` error in the process of rebuilding the
|
|
3109
|
+
* capability and retrying the call, it should treat this as an `overloaded` error: the network
|
|
3110
|
+
* is currently unreliable, possibly due to load or other temporary issues.
|
|
3111
|
+
*
|
|
3112
|
+
*/
|
|
3113
|
+
DISCONNECTED: 2,
|
|
3114
|
+
/**
|
|
3115
|
+
* The server doesn't implement the requested method. If there is some other method that the
|
|
3116
|
+
* client could call (perhaps an older and/or slower interface), it should try that instead.
|
|
3117
|
+
* Otherwise, this should be treated like `failed`.
|
|
3118
|
+
*
|
|
3119
|
+
*/
|
|
3120
|
+
UNIMPLEMENTED: 3
|
|
3121
|
+
};
|
|
3122
|
+
var Exception = (_class24 = class extends _chunkKXWOF6H4cjs.Struct {
|
|
3123
|
+
static {
|
|
3124
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Exception");
|
|
3125
|
+
}
|
|
3126
|
+
static __initStatic66() {this.Type = Exception_Type}
|
|
3127
|
+
static __initStatic67() {this._capnp = {
|
|
3128
|
+
displayName: "Exception",
|
|
3129
|
+
id: "d625b7063acf691a",
|
|
3130
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(8, 2)
|
|
3131
|
+
}}
|
|
3132
|
+
/**
|
|
3133
|
+
* Human-readable failure description.
|
|
3134
|
+
*
|
|
3135
|
+
*/
|
|
3136
|
+
get reason() {
|
|
3137
|
+
return _chunkKXWOF6H4cjs.getText.call(void 0, 0, this);
|
|
3138
|
+
}
|
|
3139
|
+
set reason(value) {
|
|
3140
|
+
_chunkKXWOF6H4cjs.setText.call(void 0, 0, value, this);
|
|
3141
|
+
}
|
|
3142
|
+
/**
|
|
3143
|
+
* The type of the error. The purpose of this enum is not to describe the error itself, but
|
|
3144
|
+
* rather to describe how the client might want to respond to the error.
|
|
3145
|
+
*
|
|
3146
|
+
*/
|
|
3147
|
+
get type() {
|
|
3148
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 4, this);
|
|
3149
|
+
}
|
|
3150
|
+
set type(value) {
|
|
3151
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 4, value, this);
|
|
3152
|
+
}
|
|
3153
|
+
/**
|
|
3154
|
+
* OBSOLETE. Ignore.
|
|
3155
|
+
*
|
|
3156
|
+
*/
|
|
3157
|
+
get obsoleteIsCallersFault() {
|
|
3158
|
+
return _chunkKXWOF6H4cjs.getBit.call(void 0, 0, this);
|
|
3159
|
+
}
|
|
3160
|
+
set obsoleteIsCallersFault(value) {
|
|
3161
|
+
_chunkKXWOF6H4cjs.setBit.call(void 0, 0, value, this);
|
|
3162
|
+
}
|
|
3163
|
+
/**
|
|
3164
|
+
* OBSOLETE. See `type` instead.
|
|
3165
|
+
*
|
|
3166
|
+
*/
|
|
3167
|
+
get obsoleteDurability() {
|
|
3168
|
+
return _chunkKXWOF6H4cjs.getUint16.call(void 0, 2, this);
|
|
3169
|
+
}
|
|
3170
|
+
set obsoleteDurability(value) {
|
|
3171
|
+
_chunkKXWOF6H4cjs.setUint16.call(void 0, 2, value, this);
|
|
3172
|
+
}
|
|
3173
|
+
/**
|
|
3174
|
+
* Stack trace text from the remote server. The format is not specified. By default,
|
|
3175
|
+
* implementations do not provide stack traces; the application must explicitly enable them
|
|
3176
|
+
* when desired.
|
|
3177
|
+
*
|
|
3178
|
+
*/
|
|
3179
|
+
get trace() {
|
|
3180
|
+
return _chunkKXWOF6H4cjs.getText.call(void 0, 1, this);
|
|
3181
|
+
}
|
|
3182
|
+
set trace(value) {
|
|
3183
|
+
_chunkKXWOF6H4cjs.setText.call(void 0, 1, value, this);
|
|
3184
|
+
}
|
|
3185
|
+
toString() {
|
|
3186
|
+
return "Exception_" + super.toString();
|
|
3187
|
+
}
|
|
3188
|
+
}, _class24.__initStatic66(), _class24.__initStatic67(), _class24);
|
|
3189
|
+
Payload._CapTable = _chunkKXWOF6H4cjs.CompositeList.call(void 0, CapDescriptor);
|
|
3190
|
+
PromisedAnswer._Transform = _chunkKXWOF6H4cjs.CompositeList.call(void 0, PromisedAnswer_Op);
|
|
3191
|
+
|
|
3192
|
+
// ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=503a440bd2bef41c0cb22819bc4ced5a7f04993fb999f0d944e284220f14916b_typescript@5.9.2/node_modules/capnp-es/dist/index.mjs
|
|
3193
|
+
var Void = (_class25 = class extends _chunkKXWOF6H4cjs.Struct {
|
|
3194
|
+
static {
|
|
3195
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Void");
|
|
3196
|
+
}
|
|
3197
|
+
static __initStatic68() {this._capnp = {
|
|
3198
|
+
displayName: "Void",
|
|
3199
|
+
id: "0",
|
|
3200
|
+
size: new (0, _chunkKXWOF6H4cjs.ObjectSize)(0, 0)
|
|
3201
|
+
}}
|
|
3202
|
+
}, _class25.__initStatic68(), _class25);
|
|
3203
|
+
var utils = {
|
|
3204
|
+
__proto__: null,
|
|
3205
|
+
PointerAllocationResult: _chunkKXWOF6H4cjs.PointerAllocationResult,
|
|
3206
|
+
add: _chunkKXWOF6H4cjs.add,
|
|
3207
|
+
adopt: _chunkKXWOF6H4cjs.adopt,
|
|
3208
|
+
checkDataBounds: _chunkKXWOF6H4cjs.checkDataBounds,
|
|
3209
|
+
checkPointerBounds: _chunkKXWOF6H4cjs.checkPointerBounds,
|
|
3210
|
+
copyFrom: _chunkKXWOF6H4cjs.copyFrom,
|
|
3211
|
+
copyFromInterface: _chunkKXWOF6H4cjs.copyFromInterface,
|
|
3212
|
+
copyFromList: _chunkKXWOF6H4cjs.copyFromList,
|
|
3213
|
+
copyFromStruct: _chunkKXWOF6H4cjs.copyFromStruct,
|
|
3214
|
+
disown: _chunkKXWOF6H4cjs.disown,
|
|
3215
|
+
dump: _chunkKXWOF6H4cjs.dump,
|
|
3216
|
+
erase: _chunkKXWOF6H4cjs.erase,
|
|
3217
|
+
erasePointer: _chunkKXWOF6H4cjs.erasePointer,
|
|
3218
|
+
followFar: _chunkKXWOF6H4cjs.followFar,
|
|
3219
|
+
followFars: _chunkKXWOF6H4cjs.followFars,
|
|
3220
|
+
getAs: _chunkKXWOF6H4cjs.getAs,
|
|
3221
|
+
getBit: _chunkKXWOF6H4cjs.getBit,
|
|
3222
|
+
getCapabilityId: _chunkKXWOF6H4cjs.getCapabilityId,
|
|
3223
|
+
getContent: _chunkKXWOF6H4cjs.getContent,
|
|
3224
|
+
getData: _chunkKXWOF6H4cjs.getData,
|
|
3225
|
+
getDataSection: _chunkKXWOF6H4cjs.getDataSection,
|
|
3226
|
+
getFarSegmentId: _chunkKXWOF6H4cjs.getFarSegmentId,
|
|
3227
|
+
getFloat32: _chunkKXWOF6H4cjs.getFloat32,
|
|
3228
|
+
getFloat64: _chunkKXWOF6H4cjs.getFloat64,
|
|
3229
|
+
getInt16: _chunkKXWOF6H4cjs.getInt16,
|
|
3230
|
+
getInt32: _chunkKXWOF6H4cjs.getInt32,
|
|
3231
|
+
getInt64: _chunkKXWOF6H4cjs.getInt64,
|
|
3232
|
+
getInt8: _chunkKXWOF6H4cjs.getInt8,
|
|
3233
|
+
getInterfaceClientOrNull: _chunkKXWOF6H4cjs.getInterfaceClientOrNull,
|
|
3234
|
+
getInterfaceClientOrNullAt: _chunkKXWOF6H4cjs.getInterfaceClientOrNullAt,
|
|
3235
|
+
getInterfacePointer: _chunkKXWOF6H4cjs.getInterfacePointer,
|
|
3236
|
+
getList: _chunkKXWOF6H4cjs.getList,
|
|
3237
|
+
getListByteLength: _chunkKXWOF6H4cjs.getListByteLength,
|
|
3238
|
+
getListElementByteLength: _chunkKXWOF6H4cjs.getListElementByteLength,
|
|
3239
|
+
getListElementSize: _chunkKXWOF6H4cjs.getListElementSize,
|
|
3240
|
+
getListLength: _chunkKXWOF6H4cjs.getListLength,
|
|
3241
|
+
getOffsetWords: _chunkKXWOF6H4cjs.getOffsetWords,
|
|
3242
|
+
getPointer: _chunkKXWOF6H4cjs.getPointer,
|
|
3243
|
+
getPointerAs: _chunkKXWOF6H4cjs.getPointerAs,
|
|
3244
|
+
getPointerSection: _chunkKXWOF6H4cjs.getPointerSection,
|
|
3245
|
+
getPointerType: _chunkKXWOF6H4cjs.getPointerType,
|
|
3246
|
+
getSize: _chunkKXWOF6H4cjs.getSize,
|
|
3247
|
+
getStruct: _chunkKXWOF6H4cjs.getStruct,
|
|
3248
|
+
getStructDataWords: _chunkKXWOF6H4cjs.getStructDataWords,
|
|
3249
|
+
getStructPointerLength: _chunkKXWOF6H4cjs.getStructPointerLength,
|
|
3250
|
+
getStructSize: _chunkKXWOF6H4cjs.getStructSize,
|
|
3251
|
+
getTargetCompositeListSize: _chunkKXWOF6H4cjs.getTargetCompositeListSize,
|
|
3252
|
+
getTargetCompositeListTag: _chunkKXWOF6H4cjs.getTargetCompositeListTag,
|
|
3253
|
+
getTargetListElementSize: _chunkKXWOF6H4cjs.getTargetListElementSize,
|
|
3254
|
+
getTargetListLength: _chunkKXWOF6H4cjs.getTargetListLength,
|
|
3255
|
+
getTargetPointerType: _chunkKXWOF6H4cjs.getTargetPointerType,
|
|
3256
|
+
getTargetStructSize: _chunkKXWOF6H4cjs.getTargetStructSize,
|
|
3257
|
+
getText: _chunkKXWOF6H4cjs.getText,
|
|
3258
|
+
getUint16: _chunkKXWOF6H4cjs.getUint16,
|
|
3259
|
+
getUint32: _chunkKXWOF6H4cjs.getUint32,
|
|
3260
|
+
getUint64: _chunkKXWOF6H4cjs.getUint64,
|
|
3261
|
+
getUint8: _chunkKXWOF6H4cjs.getUint8,
|
|
3262
|
+
initData: _chunkKXWOF6H4cjs.initData,
|
|
3263
|
+
initList: _chunkKXWOF6H4cjs.initList,
|
|
3264
|
+
initPointer: _chunkKXWOF6H4cjs.initPointer,
|
|
3265
|
+
initStruct: _chunkKXWOF6H4cjs.initStruct,
|
|
3266
|
+
initStructAt: _chunkKXWOF6H4cjs.initStructAt,
|
|
3267
|
+
isDoubleFar: _chunkKXWOF6H4cjs.isDoubleFar,
|
|
3268
|
+
isNull: _chunkKXWOF6H4cjs.isNull,
|
|
3269
|
+
relocateTo: _chunkKXWOF6H4cjs.relocateTo,
|
|
3270
|
+
resize: _chunkKXWOF6H4cjs.resize,
|
|
3271
|
+
setBit: _chunkKXWOF6H4cjs.setBit,
|
|
3272
|
+
setFarPointer: _chunkKXWOF6H4cjs.setFarPointer,
|
|
3273
|
+
setFloat32: _chunkKXWOF6H4cjs.setFloat32,
|
|
3274
|
+
setFloat64: _chunkKXWOF6H4cjs.setFloat64,
|
|
3275
|
+
setInt16: _chunkKXWOF6H4cjs.setInt16,
|
|
3276
|
+
setInt32: _chunkKXWOF6H4cjs.setInt32,
|
|
3277
|
+
setInt64: _chunkKXWOF6H4cjs.setInt64,
|
|
3278
|
+
setInt8: _chunkKXWOF6H4cjs.setInt8,
|
|
3279
|
+
setInterfacePointer: _chunkKXWOF6H4cjs.setInterfacePointer,
|
|
3280
|
+
setListPointer: _chunkKXWOF6H4cjs.setListPointer,
|
|
3281
|
+
setStructPointer: _chunkKXWOF6H4cjs.setStructPointer,
|
|
3282
|
+
setText: _chunkKXWOF6H4cjs.setText,
|
|
3283
|
+
setUint16: _chunkKXWOF6H4cjs.setUint16,
|
|
3284
|
+
setUint32: _chunkKXWOF6H4cjs.setUint32,
|
|
3285
|
+
setUint64: _chunkKXWOF6H4cjs.setUint64,
|
|
3286
|
+
setUint8: _chunkKXWOF6H4cjs.setUint8,
|
|
3287
|
+
testWhich: _chunkKXWOF6H4cjs.testWhich,
|
|
3288
|
+
trackPointerAllocation: _chunkKXWOF6H4cjs.trackPointerAllocation,
|
|
3289
|
+
validate: _chunkKXWOF6H4cjs.validate
|
|
3290
|
+
};
|
|
3291
|
+
function PointerList(PointerClass) {
|
|
3292
|
+
return (_class26 = class extends _chunkKXWOF6H4cjs.List {
|
|
3293
|
+
static __initStatic69() {this._capnp = {
|
|
3294
|
+
displayName: `List<${PointerClass._capnp.displayName}>`,
|
|
3295
|
+
size: _chunkKXWOF6H4cjs.ListElementSize.POINTER
|
|
3296
|
+
}}
|
|
3297
|
+
get(index) {
|
|
3298
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3299
|
+
return new PointerClass(
|
|
3300
|
+
c.segment,
|
|
3301
|
+
c.byteOffset + index * 8,
|
|
3302
|
+
this._capnp.depthLimit - 1
|
|
3303
|
+
);
|
|
3304
|
+
}
|
|
3305
|
+
set(index, value) {
|
|
3306
|
+
_chunkKXWOF6H4cjs.copyFrom.call(void 0, value, this.get(index));
|
|
3307
|
+
}
|
|
3308
|
+
[Symbol.toStringTag]() {
|
|
3309
|
+
return `Pointer_${super.toString()},cls:${PointerClass.toString()}`;
|
|
3310
|
+
}
|
|
3311
|
+
}, _class26.__initStatic69(), _class26);
|
|
3312
|
+
}
|
|
3313
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, PointerList, "PointerList");
|
|
3314
|
+
var AnyPointerList = PointerList(_chunkKXWOF6H4cjs.Pointer);
|
|
3315
|
+
var BoolList = (_class27 = class extends _chunkKXWOF6H4cjs.List {
|
|
3316
|
+
static {
|
|
3317
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "BoolList");
|
|
3318
|
+
}
|
|
3319
|
+
static __initStatic70() {this._capnp = {
|
|
3320
|
+
displayName: "List<boolean>",
|
|
3321
|
+
size: _chunkKXWOF6H4cjs.ListElementSize.BIT
|
|
3322
|
+
}}
|
|
3323
|
+
get(index) {
|
|
3324
|
+
const bitMask = 1 << index % 8;
|
|
3325
|
+
const byteOffset = index >>> 3;
|
|
3326
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3327
|
+
const v = c.segment.getUint8(c.byteOffset + byteOffset);
|
|
3328
|
+
return (v & bitMask) !== 0;
|
|
3329
|
+
}
|
|
3330
|
+
set(index, value) {
|
|
3331
|
+
const bitMask = 1 << index % 8;
|
|
3332
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3333
|
+
const byteOffset = c.byteOffset + (index >>> 3);
|
|
3334
|
+
const v = c.segment.getUint8(byteOffset);
|
|
3335
|
+
c.segment.setUint8(byteOffset, value ? v | bitMask : v & ~bitMask);
|
|
3336
|
+
}
|
|
3337
|
+
[Symbol.toStringTag]() {
|
|
3338
|
+
return `Bool_${super.toString()}`;
|
|
3339
|
+
}
|
|
3340
|
+
}, _class27.__initStatic70(), _class27);
|
|
3341
|
+
var DataList = PointerList(_chunkKXWOF6H4cjs.Data);
|
|
3342
|
+
var Float32List = (_class28 = class extends _chunkKXWOF6H4cjs.List {
|
|
3343
|
+
static {
|
|
3344
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Float32List");
|
|
3345
|
+
}
|
|
3346
|
+
static __initStatic71() {this._capnp = {
|
|
3347
|
+
displayName: "List<Float32>",
|
|
3348
|
+
size: _chunkKXWOF6H4cjs.ListElementSize.BYTE_4
|
|
3349
|
+
}}
|
|
3350
|
+
get(index) {
|
|
3351
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3352
|
+
return c.segment.getFloat32(c.byteOffset + index * 4);
|
|
3353
|
+
}
|
|
3354
|
+
set(index, value) {
|
|
3355
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3356
|
+
c.segment.setFloat32(c.byteOffset + index * 4, value);
|
|
3357
|
+
}
|
|
3358
|
+
[Symbol.toStringTag]() {
|
|
3359
|
+
return `Float32_${super.toString()}`;
|
|
3360
|
+
}
|
|
3361
|
+
}, _class28.__initStatic71(), _class28);
|
|
3362
|
+
var Float64List = (_class29 = class extends _chunkKXWOF6H4cjs.List {
|
|
3363
|
+
static {
|
|
3364
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Float64List");
|
|
3365
|
+
}
|
|
3366
|
+
static __initStatic72() {this._capnp = {
|
|
3367
|
+
displayName: "List<Float64>",
|
|
3368
|
+
size: _chunkKXWOF6H4cjs.ListElementSize.BYTE_8
|
|
3369
|
+
}}
|
|
3370
|
+
get(index) {
|
|
3371
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3372
|
+
return c.segment.getFloat64(c.byteOffset + index * 8);
|
|
3373
|
+
}
|
|
3374
|
+
set(index, value) {
|
|
3375
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3376
|
+
c.segment.setFloat64(c.byteOffset + index * 8, value);
|
|
3377
|
+
}
|
|
3378
|
+
[Symbol.toStringTag]() {
|
|
3379
|
+
return `Float64_${super.toString()}`;
|
|
3380
|
+
}
|
|
3381
|
+
}, _class29.__initStatic72(), _class29);
|
|
3382
|
+
var Int8List = (_class30 = class extends _chunkKXWOF6H4cjs.List {
|
|
3383
|
+
static {
|
|
3384
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Int8List");
|
|
3385
|
+
}
|
|
3386
|
+
static __initStatic73() {this._capnp = {
|
|
3387
|
+
displayName: "List<Int8>",
|
|
3388
|
+
size: _chunkKXWOF6H4cjs.ListElementSize.BYTE
|
|
3389
|
+
}}
|
|
3390
|
+
get(index) {
|
|
3391
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3392
|
+
return c.segment.getInt8(c.byteOffset + index);
|
|
3393
|
+
}
|
|
3394
|
+
set(index, value) {
|
|
3395
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3396
|
+
c.segment.setInt8(c.byteOffset + index, value);
|
|
3397
|
+
}
|
|
3398
|
+
[Symbol.toStringTag]() {
|
|
3399
|
+
return `Int8_${super.toString()}`;
|
|
3400
|
+
}
|
|
3401
|
+
}, _class30.__initStatic73(), _class30);
|
|
3402
|
+
var Int16List = (_class31 = class extends _chunkKXWOF6H4cjs.List {
|
|
3403
|
+
static {
|
|
3404
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Int16List");
|
|
3405
|
+
}
|
|
3406
|
+
static __initStatic74() {this._capnp = {
|
|
3407
|
+
displayName: "List<Int16>",
|
|
3408
|
+
size: _chunkKXWOF6H4cjs.ListElementSize.BYTE_2
|
|
3409
|
+
}}
|
|
3410
|
+
get(index) {
|
|
3411
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3412
|
+
return c.segment.getInt16(c.byteOffset + index * 2);
|
|
3413
|
+
}
|
|
3414
|
+
set(index, value) {
|
|
3415
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3416
|
+
c.segment.setInt16(c.byteOffset + index * 2, value);
|
|
3417
|
+
}
|
|
3418
|
+
[Symbol.toStringTag]() {
|
|
3419
|
+
return `Int16_${super.toString()}`;
|
|
3420
|
+
}
|
|
3421
|
+
}, _class31.__initStatic74(), _class31);
|
|
3422
|
+
var Int32List = (_class32 = class extends _chunkKXWOF6H4cjs.List {
|
|
3423
|
+
static {
|
|
3424
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Int32List");
|
|
3425
|
+
}
|
|
3426
|
+
static __initStatic75() {this._capnp = {
|
|
3427
|
+
displayName: "List<Int32>",
|
|
3428
|
+
size: _chunkKXWOF6H4cjs.ListElementSize.BYTE_4
|
|
3429
|
+
}}
|
|
3430
|
+
get(index) {
|
|
3431
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3432
|
+
return c.segment.getInt32(c.byteOffset + index * 4);
|
|
3433
|
+
}
|
|
3434
|
+
set(index, value) {
|
|
3435
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3436
|
+
c.segment.setInt32(c.byteOffset + index * 4, value);
|
|
3437
|
+
}
|
|
3438
|
+
[Symbol.toStringTag]() {
|
|
3439
|
+
return `Int32_${super.toString()}`;
|
|
3440
|
+
}
|
|
3441
|
+
}, _class32.__initStatic75(), _class32);
|
|
3442
|
+
var Int64List = (_class33 = class extends _chunkKXWOF6H4cjs.List {
|
|
3443
|
+
static {
|
|
3444
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Int64List");
|
|
3445
|
+
}
|
|
3446
|
+
static __initStatic76() {this._capnp = {
|
|
3447
|
+
displayName: "List<Int64>",
|
|
3448
|
+
size: _chunkKXWOF6H4cjs.ListElementSize.BYTE_8
|
|
3449
|
+
}}
|
|
3450
|
+
get(index) {
|
|
3451
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3452
|
+
return c.segment.getInt64(c.byteOffset + index * 8);
|
|
3453
|
+
}
|
|
3454
|
+
set(index, value) {
|
|
3455
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3456
|
+
c.segment.setInt64(c.byteOffset + index * 8, value);
|
|
3457
|
+
}
|
|
3458
|
+
[Symbol.toStringTag]() {
|
|
3459
|
+
return `Int64_${super.toString()}`;
|
|
3460
|
+
}
|
|
3461
|
+
}, _class33.__initStatic76(), _class33);
|
|
3462
|
+
var InterfaceList = PointerList(Interface);
|
|
3463
|
+
var TextList = (_class34 = class extends _chunkKXWOF6H4cjs.List {
|
|
3464
|
+
static {
|
|
3465
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "TextList");
|
|
3466
|
+
}
|
|
3467
|
+
static __initStatic77() {this._capnp = {
|
|
3468
|
+
displayName: "List<Text>",
|
|
3469
|
+
size: _chunkKXWOF6H4cjs.ListElementSize.POINTER
|
|
3470
|
+
}}
|
|
3471
|
+
get(index) {
|
|
3472
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3473
|
+
c.byteOffset += index * 8;
|
|
3474
|
+
return _chunkKXWOF6H4cjs.Text.fromPointer(c).get(0);
|
|
3475
|
+
}
|
|
3476
|
+
set(index, value) {
|
|
3477
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3478
|
+
c.byteOffset += index * 8;
|
|
3479
|
+
_chunkKXWOF6H4cjs.Text.fromPointer(c).set(0, value);
|
|
3480
|
+
}
|
|
3481
|
+
[Symbol.toStringTag]() {
|
|
3482
|
+
return `Text_${super.toString()}`;
|
|
3483
|
+
}
|
|
3484
|
+
}, _class34.__initStatic77(), _class34);
|
|
3485
|
+
var Uint8List = (_class35 = class extends _chunkKXWOF6H4cjs.List {
|
|
3486
|
+
static {
|
|
3487
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Uint8List");
|
|
3488
|
+
}
|
|
3489
|
+
static __initStatic78() {this._capnp = {
|
|
3490
|
+
displayName: "List<Uint8>",
|
|
3491
|
+
size: _chunkKXWOF6H4cjs.ListElementSize.BYTE
|
|
3492
|
+
}}
|
|
3493
|
+
get(index) {
|
|
3494
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3495
|
+
return c.segment.getUint8(c.byteOffset + index);
|
|
3496
|
+
}
|
|
3497
|
+
set(index, value) {
|
|
3498
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3499
|
+
c.segment.setUint8(c.byteOffset + index, value);
|
|
3500
|
+
}
|
|
3501
|
+
[Symbol.toStringTag]() {
|
|
3502
|
+
return `Uint8_${super.toString()}`;
|
|
3503
|
+
}
|
|
3504
|
+
}, _class35.__initStatic78(), _class35);
|
|
3505
|
+
var Uint16List = (_class36 = class extends _chunkKXWOF6H4cjs.List {
|
|
3506
|
+
static {
|
|
3507
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Uint16List");
|
|
3508
|
+
}
|
|
3509
|
+
static __initStatic79() {this._capnp = {
|
|
3510
|
+
displayName: "List<Uint16>",
|
|
3511
|
+
size: _chunkKXWOF6H4cjs.ListElementSize.BYTE_2
|
|
3512
|
+
}}
|
|
3513
|
+
get(index) {
|
|
3514
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3515
|
+
return c.segment.getUint16(c.byteOffset + index * 2);
|
|
3516
|
+
}
|
|
3517
|
+
set(index, value) {
|
|
3518
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3519
|
+
c.segment.setUint16(c.byteOffset + index * 2, value);
|
|
3520
|
+
}
|
|
3521
|
+
[Symbol.toStringTag]() {
|
|
3522
|
+
return `Uint16_${super.toString()}`;
|
|
3523
|
+
}
|
|
3524
|
+
}, _class36.__initStatic79(), _class36);
|
|
3525
|
+
var Uint32List = (_class37 = class extends _chunkKXWOF6H4cjs.List {
|
|
3526
|
+
static {
|
|
3527
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Uint32List");
|
|
3528
|
+
}
|
|
3529
|
+
static __initStatic80() {this._capnp = {
|
|
3530
|
+
displayName: "List<Uint32>",
|
|
3531
|
+
size: _chunkKXWOF6H4cjs.ListElementSize.BYTE_4
|
|
3532
|
+
}}
|
|
3533
|
+
get(index) {
|
|
3534
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3535
|
+
return c.segment.getUint32(c.byteOffset + index * 4);
|
|
3536
|
+
}
|
|
3537
|
+
set(index, value) {
|
|
3538
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3539
|
+
c.segment.setUint32(c.byteOffset + index * 4, value);
|
|
3540
|
+
}
|
|
3541
|
+
[Symbol.toStringTag]() {
|
|
3542
|
+
return `Uint32_${super.toString()}`;
|
|
3543
|
+
}
|
|
3544
|
+
}, _class37.__initStatic80(), _class37);
|
|
3545
|
+
var Uint64List = (_class38 = class extends _chunkKXWOF6H4cjs.List {
|
|
3546
|
+
static {
|
|
3547
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Uint64List");
|
|
3548
|
+
}
|
|
3549
|
+
static __initStatic81() {this._capnp = {
|
|
3550
|
+
displayName: "List<Uint64>",
|
|
3551
|
+
size: _chunkKXWOF6H4cjs.ListElementSize.BYTE_8
|
|
3552
|
+
}}
|
|
3553
|
+
get(index) {
|
|
3554
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3555
|
+
return c.segment.getUint64(c.byteOffset + index * 8);
|
|
3556
|
+
}
|
|
3557
|
+
set(index, value) {
|
|
3558
|
+
const c = _chunkKXWOF6H4cjs.getContent.call(void 0, this);
|
|
3559
|
+
c.segment.setUint64(c.byteOffset + index * 8, value);
|
|
3560
|
+
}
|
|
3561
|
+
[Symbol.toStringTag]() {
|
|
3562
|
+
return `Uint64_${super.toString()}`;
|
|
3563
|
+
}
|
|
3564
|
+
}, _class38.__initStatic81(), _class38);
|
|
3565
|
+
var VoidList = PointerList(Void);
|
|
3566
|
+
function isSameClient(c, d) {
|
|
3567
|
+
const norm = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (c2) => {
|
|
3568
|
+
return c2;
|
|
3569
|
+
}, "norm");
|
|
3570
|
+
return norm(c) === norm(d);
|
|
3571
|
+
}
|
|
3572
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, isSameClient, "isSameClient");
|
|
3573
|
+
function clientFromResolution(transform, obj, err) {
|
|
3574
|
+
if (err) {
|
|
3575
|
+
return new (0, _chunkKXWOF6H4cjs.ErrorClient)(err);
|
|
3576
|
+
}
|
|
3577
|
+
if (!obj) {
|
|
3578
|
+
return new (0, _chunkKXWOF6H4cjs.ErrorClient)(new Error(`null obj!`));
|
|
3579
|
+
}
|
|
3580
|
+
const out = transformPtr(obj, transform);
|
|
3581
|
+
return _chunkKXWOF6H4cjs.getInterfaceClientOrNull.call(void 0, out);
|
|
3582
|
+
}
|
|
3583
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, clientFromResolution, "clientFromResolution");
|
|
3584
|
+
var IDGen = (_class39 = class {constructor() { _class39.prototype.__init6.call(this);_class39.prototype.__init7.call(this); }
|
|
3585
|
+
static {
|
|
3586
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "IDGen");
|
|
3587
|
+
}
|
|
3588
|
+
__init6() {this.i = 0}
|
|
3589
|
+
__init7() {this.free = []}
|
|
3590
|
+
next() {
|
|
3591
|
+
return _nullishCoalesce(this.free.pop(), () => ( this.i++));
|
|
3592
|
+
}
|
|
3593
|
+
remove(i) {
|
|
3594
|
+
this.free.push(i);
|
|
3595
|
+
}
|
|
3596
|
+
}, _class39);
|
|
3597
|
+
var Ref = class {
|
|
3598
|
+
static {
|
|
3599
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Ref");
|
|
3600
|
+
}
|
|
3601
|
+
constructor(rc, finalize) {
|
|
3602
|
+
this.rc = rc;
|
|
3603
|
+
const closeState = { closed: false };
|
|
3604
|
+
this.closeState = closeState;
|
|
3605
|
+
finalize(this, () => {
|
|
3606
|
+
if (!closeState.closed) {
|
|
3607
|
+
closeState.closed = true;
|
|
3608
|
+
rc.decref();
|
|
3609
|
+
}
|
|
3610
|
+
});
|
|
3611
|
+
}
|
|
3612
|
+
|
|
3613
|
+
call(cl) {
|
|
3614
|
+
return this.rc.call(cl);
|
|
3615
|
+
}
|
|
3616
|
+
client() {
|
|
3617
|
+
return this.rc._client;
|
|
3618
|
+
}
|
|
3619
|
+
close() {
|
|
3620
|
+
if (!this.closeState.closed) {
|
|
3621
|
+
this.closeState.closed = true;
|
|
3622
|
+
this.rc.decref();
|
|
3623
|
+
}
|
|
3624
|
+
}
|
|
3625
|
+
};
|
|
3626
|
+
var RefCount = class _RefCount {
|
|
3627
|
+
static {
|
|
3628
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "RefCount");
|
|
3629
|
+
}
|
|
3630
|
+
|
|
3631
|
+
|
|
3632
|
+
|
|
3633
|
+
constructor(c, _finalize) {
|
|
3634
|
+
this._client = c;
|
|
3635
|
+
this.finalize = _finalize;
|
|
3636
|
+
this.refs = 1;
|
|
3637
|
+
}
|
|
3638
|
+
// New creates a reference counter and the first client reference.
|
|
3639
|
+
static new(c, finalize) {
|
|
3640
|
+
const rc = new _RefCount(c, finalize);
|
|
3641
|
+
const ref = rc.newRef();
|
|
3642
|
+
return [rc, ref];
|
|
3643
|
+
}
|
|
3644
|
+
call(cl) {
|
|
3645
|
+
return this._client.call(cl);
|
|
3646
|
+
}
|
|
3647
|
+
client() {
|
|
3648
|
+
return this._client;
|
|
3649
|
+
}
|
|
3650
|
+
close() {
|
|
3651
|
+
this._client.close();
|
|
3652
|
+
}
|
|
3653
|
+
ref() {
|
|
3654
|
+
if (this.refs <= 0) {
|
|
3655
|
+
return new (0, _chunkKXWOF6H4cjs.ErrorClient)(new Error(_chunkKXWOF6H4cjs.RPC_ZERO_REF));
|
|
3656
|
+
}
|
|
3657
|
+
this.refs++;
|
|
3658
|
+
return this.newRef();
|
|
3659
|
+
}
|
|
3660
|
+
newRef() {
|
|
3661
|
+
return new Ref(this, this.finalize);
|
|
3662
|
+
}
|
|
3663
|
+
decref() {
|
|
3664
|
+
this.refs--;
|
|
3665
|
+
if (this.refs === 0) {
|
|
3666
|
+
this._client.close();
|
|
3667
|
+
}
|
|
3668
|
+
}
|
|
3669
|
+
};
|
|
3670
|
+
var RPCError = class extends Error {
|
|
3671
|
+
static {
|
|
3672
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "RPCError");
|
|
3673
|
+
}
|
|
3674
|
+
constructor(exception) {
|
|
3675
|
+
super(_chunkKXWOF6H4cjs.format.call(void 0, _chunkKXWOF6H4cjs.RPC_ERROR, exception.reason));
|
|
3676
|
+
this.exception = exception;
|
|
3677
|
+
}
|
|
3678
|
+
};
|
|
3679
|
+
function toException(exc, err) {
|
|
3680
|
+
if (err instanceof RPCError) {
|
|
3681
|
+
exc.reason = err.exception.reason;
|
|
3682
|
+
exc.type = err.exception.type;
|
|
3683
|
+
return;
|
|
3684
|
+
}
|
|
3685
|
+
exc.reason = err.message;
|
|
3686
|
+
exc.type = Exception.Type.FAILED;
|
|
3687
|
+
}
|
|
3688
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, toException, "toException");
|
|
3689
|
+
function newMessage() {
|
|
3690
|
+
return new (0, _chunkKXWOF6H4cjs.Message)().initRoot(Message2);
|
|
3691
|
+
}
|
|
3692
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, newMessage, "newMessage");
|
|
3693
|
+
function newFinishMessage(questionID, release) {
|
|
3694
|
+
const m = newMessage();
|
|
3695
|
+
const f = m._initFinish();
|
|
3696
|
+
f.questionId = questionID;
|
|
3697
|
+
f.releaseResultCaps = release;
|
|
3698
|
+
return m;
|
|
3699
|
+
}
|
|
3700
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, newFinishMessage, "newFinishMessage");
|
|
3701
|
+
function newUnimplementedMessage(m) {
|
|
3702
|
+
const n = newMessage();
|
|
3703
|
+
n.unimplemented = m;
|
|
3704
|
+
return n;
|
|
3705
|
+
}
|
|
3706
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, newUnimplementedMessage, "newUnimplementedMessage");
|
|
3707
|
+
function newReturnMessage(id) {
|
|
3708
|
+
const m = newMessage();
|
|
3709
|
+
const ret = m._initReturn();
|
|
3710
|
+
ret.answerId = id;
|
|
3711
|
+
return m;
|
|
3712
|
+
}
|
|
3713
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, newReturnMessage, "newReturnMessage");
|
|
3714
|
+
function setReturnException(ret, err) {
|
|
3715
|
+
const exc = ret._initException();
|
|
3716
|
+
toException(exc, err);
|
|
3717
|
+
return exc;
|
|
3718
|
+
}
|
|
3719
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, setReturnException, "setReturnException");
|
|
3720
|
+
function newDisembargoMessage(which, id) {
|
|
3721
|
+
const m = newMessage();
|
|
3722
|
+
const dis = m._initDisembargo();
|
|
3723
|
+
const ctx = dis._initContext();
|
|
3724
|
+
switch (which) {
|
|
3725
|
+
case Disembargo_Context_Which.SENDER_LOOPBACK: {
|
|
3726
|
+
ctx.senderLoopback = id;
|
|
3727
|
+
break;
|
|
3728
|
+
}
|
|
3729
|
+
case Disembargo_Context_Which.RECEIVER_LOOPBACK: {
|
|
3730
|
+
ctx.receiverLoopback = id;
|
|
3731
|
+
break;
|
|
3732
|
+
}
|
|
3733
|
+
default: {
|
|
3734
|
+
throw new Error(_chunkKXWOF6H4cjs.INVARIANT_UNREACHABLE_CODE);
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
return m;
|
|
3738
|
+
}
|
|
3739
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, newDisembargoMessage, "newDisembargoMessage");
|
|
3740
|
+
function transformToPromisedAnswer(answer, transform) {
|
|
3741
|
+
const opList = answer._initTransform(transform.length);
|
|
3742
|
+
for (const [i, op] of transform.entries()) {
|
|
3743
|
+
opList.get(i).getPointerField = op.field;
|
|
3744
|
+
}
|
|
3745
|
+
}
|
|
3746
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, transformToPromisedAnswer, "transformToPromisedAnswer");
|
|
3747
|
+
function promisedAnswerOpsToTransform(list) {
|
|
3748
|
+
const transform = [];
|
|
3749
|
+
for (const op of list) {
|
|
3750
|
+
switch (op.which()) {
|
|
3751
|
+
case PromisedAnswer_Op.GET_POINTER_FIELD: {
|
|
3752
|
+
transform.push({
|
|
3753
|
+
field: op.getPointerField
|
|
3754
|
+
});
|
|
3755
|
+
break;
|
|
3756
|
+
}
|
|
3757
|
+
case PromisedAnswer_Op.NOOP: {
|
|
3758
|
+
break;
|
|
3759
|
+
}
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3762
|
+
return transform;
|
|
3763
|
+
}
|
|
3764
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, promisedAnswerOpsToTransform, "promisedAnswerOpsToTransform");
|
|
3765
|
+
var QuestionState = /* @__PURE__ */ ((QuestionState2) => {
|
|
3766
|
+
QuestionState2[QuestionState2["IN_PROGRESS"] = 0] = "IN_PROGRESS";
|
|
3767
|
+
QuestionState2[QuestionState2["RESOLVED"] = 1] = "RESOLVED";
|
|
3768
|
+
QuestionState2[QuestionState2["CANCELED"] = 2] = "CANCELED";
|
|
3769
|
+
return QuestionState2;
|
|
3770
|
+
})(QuestionState || {});
|
|
3771
|
+
var Question = (_class40 = class {
|
|
3772
|
+
static {
|
|
3773
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Question");
|
|
3774
|
+
}
|
|
3775
|
+
constructor(conn, id, method) {;_class40.prototype.__init8.call(this);_class40.prototype.__init9.call(this);_class40.prototype.__init10.call(this);_class40.prototype.__init11.call(this);
|
|
3776
|
+
this.conn = conn;
|
|
3777
|
+
this.id = id;
|
|
3778
|
+
this.method = method;
|
|
3779
|
+
}
|
|
3780
|
+
__init8() {this.paramCaps = []}
|
|
3781
|
+
__init9() {this.state = 0}
|
|
3782
|
+
|
|
3783
|
+
|
|
3784
|
+
__init10() {this.derived = []}
|
|
3785
|
+
__init11() {this.deferred = new Deferred()}
|
|
3786
|
+
async struct() {
|
|
3787
|
+
return await this.deferred.promise;
|
|
3788
|
+
}
|
|
3789
|
+
// start signals the question has been sent
|
|
3790
|
+
start() {
|
|
3791
|
+
}
|
|
3792
|
+
// fulfill is called to resolve a question successfully.
|
|
3793
|
+
// The caller must be holding onto q.conn.mu.
|
|
3794
|
+
fulfill(obj) {
|
|
3795
|
+
if (this.state !== 0) {
|
|
3796
|
+
throw new Error(_chunkKXWOF6H4cjs.RPC_FULFILL_ALREADY_CALLED);
|
|
3797
|
+
}
|
|
3798
|
+
if (this.method) {
|
|
3799
|
+
this.obj = _chunkKXWOF6H4cjs.getAs.call(void 0, this.method.ResultsClass, obj);
|
|
3800
|
+
} else {
|
|
3801
|
+
this.obj = obj;
|
|
3802
|
+
}
|
|
3803
|
+
this.state = 1;
|
|
3804
|
+
this.deferred.resolve(this.obj);
|
|
3805
|
+
}
|
|
3806
|
+
// reject is called to resolve a question with failure
|
|
3807
|
+
reject(err) {
|
|
3808
|
+
if (!err) {
|
|
3809
|
+
throw new Error(`Question.reject called with null`);
|
|
3810
|
+
}
|
|
3811
|
+
if (this.state !== 0) {
|
|
3812
|
+
throw new Error(`Question.reject called more than once`);
|
|
3813
|
+
}
|
|
3814
|
+
this.err = err;
|
|
3815
|
+
this.state = 1;
|
|
3816
|
+
this.deferred.reject(err);
|
|
3817
|
+
}
|
|
3818
|
+
// cancel is called to resolve a question with cancellation.
|
|
3819
|
+
cancel(err) {
|
|
3820
|
+
if (this.state === 0) {
|
|
3821
|
+
this.err = err;
|
|
3822
|
+
this.state = 2;
|
|
3823
|
+
this.deferred.reject(err);
|
|
3824
|
+
return true;
|
|
3825
|
+
}
|
|
3826
|
+
return false;
|
|
3827
|
+
}
|
|
3828
|
+
pipelineCall(transform, call) {
|
|
3829
|
+
if (this.conn.findQuestion(this.id) !== this) {
|
|
3830
|
+
if (this.state === 0) {
|
|
3831
|
+
throw new Error(`question popped but not done`);
|
|
3832
|
+
}
|
|
3833
|
+
const client = clientFromResolution(transform, this.obj, this.err);
|
|
3834
|
+
return client.call(call);
|
|
3835
|
+
}
|
|
3836
|
+
const pipeq = this.conn.newQuestion(call.method);
|
|
3837
|
+
const msg = newMessage();
|
|
3838
|
+
const msgCall = msg._initCall();
|
|
3839
|
+
msgCall.questionId = pipeq.id;
|
|
3840
|
+
msgCall.interfaceId = call.method.interfaceId;
|
|
3841
|
+
msgCall.methodId = call.method.methodId;
|
|
3842
|
+
const target = msgCall._initTarget();
|
|
3843
|
+
const a = target._initPromisedAnswer();
|
|
3844
|
+
a.questionId = this.id;
|
|
3845
|
+
transformToPromisedAnswer(a, transform);
|
|
3846
|
+
const payload = msgCall._initParams();
|
|
3847
|
+
this.conn.fillParams(payload, call);
|
|
3848
|
+
this.conn.sendMessage(msg);
|
|
3849
|
+
this.addPromise(transform);
|
|
3850
|
+
return pipeq;
|
|
3851
|
+
}
|
|
3852
|
+
addPromise(transform) {
|
|
3853
|
+
for (const d of this.derived) {
|
|
3854
|
+
if (transformsEqual(transform, d)) {
|
|
3855
|
+
return;
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
this.derived.push(transform);
|
|
3859
|
+
}
|
|
3860
|
+
pipelineClose() {
|
|
3861
|
+
throw new Error(_chunkKXWOF6H4cjs.NOT_IMPLEMENTED);
|
|
3862
|
+
}
|
|
3863
|
+
}, _class40);
|
|
3864
|
+
function transformsEqual(t, u) {
|
|
3865
|
+
if (t.length !== u.length) {
|
|
3866
|
+
return false;
|
|
3867
|
+
}
|
|
3868
|
+
for (const [i, element_] of t.entries()) {
|
|
3869
|
+
if (element_.field !== u[i].field) {
|
|
3870
|
+
return false;
|
|
3871
|
+
}
|
|
3872
|
+
}
|
|
3873
|
+
return true;
|
|
3874
|
+
}
|
|
3875
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, transformsEqual, "transformsEqual");
|
|
3876
|
+
var Qcalls = class _Qcalls {
|
|
3877
|
+
static {
|
|
3878
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Qcalls");
|
|
3879
|
+
}
|
|
3880
|
+
constructor(data) {
|
|
3881
|
+
this.data = data;
|
|
3882
|
+
}
|
|
3883
|
+
static copyOf(data) {
|
|
3884
|
+
return new _Qcalls([...data]);
|
|
3885
|
+
}
|
|
3886
|
+
len() {
|
|
3887
|
+
return this.data.length;
|
|
3888
|
+
}
|
|
3889
|
+
clear(i) {
|
|
3890
|
+
this.data[i] = null;
|
|
3891
|
+
}
|
|
3892
|
+
copy() {
|
|
3893
|
+
return _Qcalls.copyOf(this.data);
|
|
3894
|
+
}
|
|
3895
|
+
};
|
|
3896
|
+
function joinAnswer(fl, answer) {
|
|
3897
|
+
answer.struct().then((obj) => {
|
|
3898
|
+
fl.fulfill(obj);
|
|
3899
|
+
}).catch((error_) => {
|
|
3900
|
+
fl.reject(error_);
|
|
3901
|
+
});
|
|
3902
|
+
}
|
|
3903
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, joinAnswer, "joinAnswer");
|
|
3904
|
+
var callQueueSize2 = 64;
|
|
3905
|
+
var QueueClient = class {
|
|
3906
|
+
static {
|
|
3907
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "QueueClient");
|
|
3908
|
+
}
|
|
3909
|
+
constructor(conn, client, calls) {
|
|
3910
|
+
this.conn = conn;
|
|
3911
|
+
this._client = client;
|
|
3912
|
+
this.calls = Qcalls.copyOf(calls);
|
|
3913
|
+
this.q = new Queue(this.calls, callQueueSize2);
|
|
3914
|
+
}
|
|
3915
|
+
|
|
3916
|
+
|
|
3917
|
+
|
|
3918
|
+
pushCall(call) {
|
|
3919
|
+
const f = new Fulfiller();
|
|
3920
|
+
try {
|
|
3921
|
+
call = copyCall(call);
|
|
3922
|
+
} catch (error_) {
|
|
3923
|
+
return new (0, _chunkKXWOF6H4cjs.ErrorAnswer)(error_);
|
|
3924
|
+
}
|
|
3925
|
+
const i = this.q.push();
|
|
3926
|
+
if (i === -1) {
|
|
3927
|
+
return new (0, _chunkKXWOF6H4cjs.ErrorAnswer)(new Error(_chunkKXWOF6H4cjs.RPC_CALL_QUEUE_FULL));
|
|
3928
|
+
}
|
|
3929
|
+
this.calls.data[i] = {
|
|
3930
|
+
call,
|
|
3931
|
+
f
|
|
3932
|
+
};
|
|
3933
|
+
return f;
|
|
3934
|
+
}
|
|
3935
|
+
pushEmbargo(id, tgt) {
|
|
3936
|
+
const i = this.q.push();
|
|
3937
|
+
if (i === -1) {
|
|
3938
|
+
throw new Error(_chunkKXWOF6H4cjs.RPC_CALL_QUEUE_FULL);
|
|
3939
|
+
}
|
|
3940
|
+
this.calls.data[i] = {
|
|
3941
|
+
embargoID: id,
|
|
3942
|
+
embargoTarget: tgt
|
|
3943
|
+
};
|
|
3944
|
+
}
|
|
3945
|
+
flushQueue() {
|
|
3946
|
+
let c = null;
|
|
3947
|
+
{
|
|
3948
|
+
const i = this.q.front();
|
|
3949
|
+
if (i !== -1) {
|
|
3950
|
+
c = this.calls.data[i];
|
|
3951
|
+
}
|
|
3952
|
+
}
|
|
3953
|
+
while (c) {
|
|
3954
|
+
this.handle(c);
|
|
3955
|
+
this.q.pop();
|
|
3956
|
+
{
|
|
3957
|
+
const i = this.q.front();
|
|
3958
|
+
c = i === -1 ? null : this.calls.data[i];
|
|
3959
|
+
}
|
|
3960
|
+
}
|
|
3961
|
+
}
|
|
3962
|
+
handle(c) {
|
|
3963
|
+
if (!c) {
|
|
3964
|
+
return;
|
|
3965
|
+
}
|
|
3966
|
+
if (isRemoteCall(c)) {
|
|
3967
|
+
const answer = this._client.call(c.call);
|
|
3968
|
+
joinAnswer(c.a, answer);
|
|
3969
|
+
} else if (isLocalCall(c)) {
|
|
3970
|
+
const answer = this._client.call(c.call);
|
|
3971
|
+
joinAnswer(c.f, answer);
|
|
3972
|
+
} else if (isDisembargo(c)) {
|
|
3973
|
+
const msg = newDisembargoMessage(
|
|
3974
|
+
Disembargo_Context_Which.RECEIVER_LOOPBACK,
|
|
3975
|
+
c.embargoID
|
|
3976
|
+
);
|
|
3977
|
+
msg.disembargo.target = c.embargoTarget;
|
|
3978
|
+
this.conn.sendMessage(msg);
|
|
3979
|
+
}
|
|
3980
|
+
}
|
|
3981
|
+
isPassthrough() {
|
|
3982
|
+
return this.q.len() === 0;
|
|
3983
|
+
}
|
|
3984
|
+
call(call) {
|
|
3985
|
+
if (this.isPassthrough()) {
|
|
3986
|
+
return this._client.call(call);
|
|
3987
|
+
}
|
|
3988
|
+
return this.pushCall(call);
|
|
3989
|
+
}
|
|
3990
|
+
// close releases any resources associated with this client.
|
|
3991
|
+
// No further calls to the client should be made after calling Close.
|
|
3992
|
+
close() {
|
|
3993
|
+
}
|
|
3994
|
+
};
|
|
3995
|
+
var AnswerEntry = (_class41 = class {
|
|
3996
|
+
static {
|
|
3997
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "AnswerEntry");
|
|
3998
|
+
}
|
|
3999
|
+
|
|
4000
|
+
|
|
4001
|
+
__init12() {this.resultCaps = []}
|
|
4002
|
+
__init13() {this.done = false}
|
|
4003
|
+
|
|
4004
|
+
|
|
4005
|
+
__init14() {this.deferred = new Deferred()}
|
|
4006
|
+
__init15() {this.queue = []}
|
|
4007
|
+
constructor(conn, id) {;_class41.prototype.__init12.call(this);_class41.prototype.__init13.call(this);_class41.prototype.__init14.call(this);_class41.prototype.__init15.call(this);
|
|
4008
|
+
this.conn = conn;
|
|
4009
|
+
this.id = id;
|
|
4010
|
+
}
|
|
4011
|
+
// fulfill is called to resolve an answer successfully.
|
|
4012
|
+
fulfill(obj) {
|
|
4013
|
+
if (this.done) {
|
|
4014
|
+
throw new Error(`answer.fulfill called more than once`);
|
|
4015
|
+
}
|
|
4016
|
+
this.done = true;
|
|
4017
|
+
this.obj = obj;
|
|
4018
|
+
const retmsg = newReturnMessage(this.id);
|
|
4019
|
+
const ret = retmsg.return;
|
|
4020
|
+
const payload = ret._initResults();
|
|
4021
|
+
payload.content = obj;
|
|
4022
|
+
let firstErr;
|
|
4023
|
+
try {
|
|
4024
|
+
this.conn.makeCapTable(ret.segment, (len) => payload._initCapTable(len));
|
|
4025
|
+
this.deferred.resolve(obj);
|
|
4026
|
+
this.conn.sendMessage(retmsg);
|
|
4027
|
+
} catch (error_) {
|
|
4028
|
+
if (!firstErr) {
|
|
4029
|
+
firstErr = error_;
|
|
4030
|
+
}
|
|
4031
|
+
}
|
|
4032
|
+
const [queues, queuesErr] = this.emptyQueue(obj);
|
|
4033
|
+
if (queuesErr && !firstErr) {
|
|
4034
|
+
firstErr = queuesErr;
|
|
4035
|
+
}
|
|
4036
|
+
const objcap = obj.segment.message._capnp;
|
|
4037
|
+
if (!objcap.capTable) {
|
|
4038
|
+
objcap.capTable = [];
|
|
4039
|
+
}
|
|
4040
|
+
for (const capIdxStr of Object.keys(queues)) {
|
|
4041
|
+
const capIdx = Number(capIdxStr);
|
|
4042
|
+
const q = queues[capIdx];
|
|
4043
|
+
if (objcap.capTable === null) throw new Error(_chunkKXWOF6H4cjs.INVARIANT_UNREACHABLE_CODE);
|
|
4044
|
+
objcap.capTable[capIdx] = new QueueClient(
|
|
4045
|
+
this.conn,
|
|
4046
|
+
objcap.capTable[capIdx],
|
|
4047
|
+
q
|
|
4048
|
+
);
|
|
4049
|
+
}
|
|
4050
|
+
if (firstErr) {
|
|
4051
|
+
throw firstErr;
|
|
4052
|
+
}
|
|
4053
|
+
}
|
|
4054
|
+
// reject is called to resolve an answer with failure.
|
|
4055
|
+
reject(err) {
|
|
4056
|
+
if (!err) {
|
|
4057
|
+
throw new Error(`answer.reject called with nil`);
|
|
4058
|
+
}
|
|
4059
|
+
if (this.done) {
|
|
4060
|
+
throw new Error(`answer.reject claled more than once`);
|
|
4061
|
+
}
|
|
4062
|
+
const m = newReturnMessage(this.id);
|
|
4063
|
+
const mret = m.return;
|
|
4064
|
+
setReturnException(mret, err);
|
|
4065
|
+
this.err = err;
|
|
4066
|
+
this.done = true;
|
|
4067
|
+
this.deferred.reject(err);
|
|
4068
|
+
let firstErr;
|
|
4069
|
+
try {
|
|
4070
|
+
this.conn.sendMessage(m);
|
|
4071
|
+
} catch (error_) {
|
|
4072
|
+
firstErr = error_;
|
|
4073
|
+
}
|
|
4074
|
+
for (let i = 0; i < this.queue.length; i++) {
|
|
4075
|
+
const qa = this.queue[i];
|
|
4076
|
+
try {
|
|
4077
|
+
if (qa.qcall && isRemoteCall(qa.qcall)) {
|
|
4078
|
+
qa.qcall.a.reject(err);
|
|
4079
|
+
}
|
|
4080
|
+
} catch (error_) {
|
|
4081
|
+
if (!firstErr) {
|
|
4082
|
+
firstErr = error_;
|
|
4083
|
+
}
|
|
4084
|
+
}
|
|
4085
|
+
}
|
|
4086
|
+
this.queue = [];
|
|
4087
|
+
if (firstErr) {
|
|
4088
|
+
throw firstErr;
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4091
|
+
// emptyQueue splits the queue by which capability it targets
|
|
4092
|
+
// and drops any invalid calls. Once this function returns,
|
|
4093
|
+
// this.queue will be empty.
|
|
4094
|
+
emptyQueue(obj) {
|
|
4095
|
+
let firstErr;
|
|
4096
|
+
const qs = {};
|
|
4097
|
+
for (let i = 0; i < this.queue.length; i++) {
|
|
4098
|
+
const pc = this.queue[i];
|
|
4099
|
+
if (!isRemoteCall(pc.qcall)) {
|
|
4100
|
+
continue;
|
|
4101
|
+
}
|
|
4102
|
+
if (!pc.qcall.a) {
|
|
4103
|
+
continue;
|
|
4104
|
+
}
|
|
4105
|
+
let c;
|
|
4106
|
+
try {
|
|
4107
|
+
c = transformPtr(obj, pc.transform);
|
|
4108
|
+
} catch (error_) {
|
|
4109
|
+
try {
|
|
4110
|
+
pc.qcall.a.reject(error_);
|
|
4111
|
+
} catch (error_2) {
|
|
4112
|
+
if (!firstErr) {
|
|
4113
|
+
firstErr = error_2;
|
|
4114
|
+
}
|
|
4115
|
+
}
|
|
4116
|
+
continue;
|
|
4117
|
+
}
|
|
4118
|
+
const ci = Interface.fromPointer(c);
|
|
4119
|
+
if (!ci) {
|
|
4120
|
+
try {
|
|
4121
|
+
pc.qcall.a.reject(new Error(_chunkKXWOF6H4cjs.RPC_NULL_CLIENT));
|
|
4122
|
+
} catch (error_) {
|
|
4123
|
+
if (!firstErr) {
|
|
4124
|
+
firstErr = error_;
|
|
4125
|
+
}
|
|
4126
|
+
}
|
|
4127
|
+
continue;
|
|
4128
|
+
}
|
|
4129
|
+
const cn = ci.getCapId();
|
|
4130
|
+
if (!qs[cn]) {
|
|
4131
|
+
qs[cn] = [];
|
|
4132
|
+
}
|
|
4133
|
+
qs[cn].push(pc.qcall);
|
|
4134
|
+
}
|
|
4135
|
+
this.queue = [];
|
|
4136
|
+
return [qs, firstErr];
|
|
4137
|
+
}
|
|
4138
|
+
queueCall(call, transform, a) {
|
|
4139
|
+
if (this.queue.length >= callQueueSize2) {
|
|
4140
|
+
throw new Error(_chunkKXWOF6H4cjs.RPC_CALL_QUEUE_FULL);
|
|
4141
|
+
}
|
|
4142
|
+
const qcall = {
|
|
4143
|
+
a,
|
|
4144
|
+
call: copyCall(call)
|
|
4145
|
+
};
|
|
4146
|
+
const pcall = {
|
|
4147
|
+
qcall,
|
|
4148
|
+
transform
|
|
4149
|
+
};
|
|
4150
|
+
this.queue.push(pcall);
|
|
4151
|
+
}
|
|
4152
|
+
}, _class41);
|
|
4153
|
+
function isRemoteCall(a) {
|
|
4154
|
+
return !!a.a;
|
|
4155
|
+
}
|
|
4156
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, isRemoteCall, "isRemoteCall");
|
|
4157
|
+
function isLocalCall(a) {
|
|
4158
|
+
return !!a.f;
|
|
4159
|
+
}
|
|
4160
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, isLocalCall, "isLocalCall");
|
|
4161
|
+
function isDisembargo(a) {
|
|
4162
|
+
return !!a.embargoTarget;
|
|
4163
|
+
}
|
|
4164
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, isDisembargo, "isDisembargo");
|
|
4165
|
+
var ImportClient = (_class42 = class {
|
|
4166
|
+
static {
|
|
4167
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "ImportClient");
|
|
4168
|
+
}
|
|
4169
|
+
constructor(conn, id) {;_class42.prototype.__init16.call(this);
|
|
4170
|
+
this.conn = conn;
|
|
4171
|
+
this.id = id;
|
|
4172
|
+
}
|
|
4173
|
+
__init16() {this.closed = false}
|
|
4174
|
+
call(cl) {
|
|
4175
|
+
if (this.closed) {
|
|
4176
|
+
return new (0, _chunkKXWOF6H4cjs.ErrorAnswer)(new Error(_chunkKXWOF6H4cjs.RPC_IMPORT_CLOSED));
|
|
4177
|
+
}
|
|
4178
|
+
const q = this.conn.newQuestion(cl.method);
|
|
4179
|
+
const msg = newMessage();
|
|
4180
|
+
const msgCall = msg._initCall();
|
|
4181
|
+
msgCall.questionId = q.id;
|
|
4182
|
+
msgCall.interfaceId = cl.method.interfaceId;
|
|
4183
|
+
msgCall.methodId = cl.method.methodId;
|
|
4184
|
+
const target = msgCall._initTarget();
|
|
4185
|
+
target.importedCap = this.id;
|
|
4186
|
+
const payload = msgCall._initParams();
|
|
4187
|
+
this.conn.fillParams(payload, cl);
|
|
4188
|
+
this.conn.sendMessage(msg);
|
|
4189
|
+
return q;
|
|
4190
|
+
}
|
|
4191
|
+
close() {
|
|
4192
|
+
}
|
|
4193
|
+
}, _class42);
|
|
4194
|
+
var LocalAnswerClient = class {
|
|
4195
|
+
static {
|
|
4196
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "LocalAnswerClient");
|
|
4197
|
+
}
|
|
4198
|
+
constructor(a, transform) {
|
|
4199
|
+
this.a = a;
|
|
4200
|
+
this.transform = transform;
|
|
4201
|
+
}
|
|
4202
|
+
call(call) {
|
|
4203
|
+
if (this.a.done) {
|
|
4204
|
+
return clientFromResolution(this.transform, this.a.obj, this.a.err).call(
|
|
4205
|
+
call
|
|
4206
|
+
);
|
|
4207
|
+
}
|
|
4208
|
+
return new Fulfiller();
|
|
4209
|
+
}
|
|
4210
|
+
close() {
|
|
4211
|
+
throw new Error(_chunkKXWOF6H4cjs.NOT_IMPLEMENTED);
|
|
4212
|
+
}
|
|
4213
|
+
};
|
|
4214
|
+
var ConnWeakRefRegistry = globalThis.FinalizationRegistry ? new FinalizationRegistry((cb) => cb()) : void 0;
|
|
4215
|
+
var ConDefaultFinalize = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (obj, finalizer) => {
|
|
4216
|
+
_optionalChain([ConnWeakRefRegistry, 'optionalAccess', _2 => _2.register, 'call', _3 => _3(obj, finalizer)]);
|
|
4217
|
+
}, "ConDefaultFinalize");
|
|
4218
|
+
var Conn = (_class43 = class {
|
|
4219
|
+
static {
|
|
4220
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Conn");
|
|
4221
|
+
}
|
|
4222
|
+
/**
|
|
4223
|
+
* Create a new connection
|
|
4224
|
+
* @param transport The transport used to receive/send messages.
|
|
4225
|
+
* @param finalize Weak reference implementation. Compatible with
|
|
4226
|
+
* the 'weak' module on node.js (just add weak as a dependency and pass
|
|
4227
|
+
* require("weak")), but alternative implementations can be provided for
|
|
4228
|
+
* other platforms like Electron. Defaults to using FinalizationRegistry if
|
|
4229
|
+
* available.
|
|
4230
|
+
* @returns A new connection.
|
|
4231
|
+
*/
|
|
4232
|
+
constructor(transport, finalize = ConDefaultFinalize) {;_class43.prototype.__init17.call(this);_class43.prototype.__init18.call(this);_class43.prototype.__init19.call(this);_class43.prototype.__init20.call(this);_class43.prototype.__init21.call(this);_class43.prototype.__init22.call(this);_class43.prototype.__init23.call(this);
|
|
4233
|
+
this.transport = transport;
|
|
4234
|
+
this.finalize = finalize;
|
|
4235
|
+
this.startWork();
|
|
4236
|
+
}
|
|
4237
|
+
__init17() {this.questionID = new IDGen()}
|
|
4238
|
+
__init18() {this.questions = []}
|
|
4239
|
+
__init19() {this.answers = {}}
|
|
4240
|
+
__init20() {this.exportID = new IDGen()}
|
|
4241
|
+
__init21() {this.exports = []}
|
|
4242
|
+
__init22() {this.imports = {}}
|
|
4243
|
+
|
|
4244
|
+
|
|
4245
|
+
__init23() {this.working = false}
|
|
4246
|
+
bootstrap(InterfaceClass) {
|
|
4247
|
+
const q = this.newQuestion();
|
|
4248
|
+
const msg = newMessage();
|
|
4249
|
+
const boot = msg._initBootstrap();
|
|
4250
|
+
boot.questionId = q.id;
|
|
4251
|
+
this.sendMessage(msg);
|
|
4252
|
+
return new InterfaceClass.Client(new Pipeline(_chunkKXWOF6H4cjs.AnyStruct, q).client());
|
|
4253
|
+
}
|
|
4254
|
+
initMain(InterfaceClass, target) {
|
|
4255
|
+
this.main = new InterfaceClass.Server(target);
|
|
4256
|
+
this.addExport(this.main);
|
|
4257
|
+
}
|
|
4258
|
+
startWork() {
|
|
4259
|
+
this.work().catch((error_) => {
|
|
4260
|
+
if (this.onError) {
|
|
4261
|
+
this.onError(error_);
|
|
4262
|
+
} else if (error_ !== void 0) {
|
|
4263
|
+
throw error_;
|
|
4264
|
+
}
|
|
4265
|
+
});
|
|
4266
|
+
}
|
|
4267
|
+
sendReturnException(id, err) {
|
|
4268
|
+
const m = newReturnMessage(id);
|
|
4269
|
+
setReturnException(m.return, err);
|
|
4270
|
+
this.sendMessage(m);
|
|
4271
|
+
}
|
|
4272
|
+
handleBootstrapMessage(m) {
|
|
4273
|
+
const boot = m.bootstrap;
|
|
4274
|
+
const id = boot.questionId;
|
|
4275
|
+
const ret = newReturnMessage(id);
|
|
4276
|
+
ret.return.releaseParamCaps = false;
|
|
4277
|
+
const a = this.insertAnswer(id);
|
|
4278
|
+
if (a === null) {
|
|
4279
|
+
return this.sendReturnException(id, new Error(_chunkKXWOF6H4cjs.RPC_QUESTION_ID_REUSED));
|
|
4280
|
+
}
|
|
4281
|
+
if (this.main === void 0) {
|
|
4282
|
+
return a.reject(new Error(_chunkKXWOF6H4cjs.RPC_NO_MAIN_INTERFACE));
|
|
4283
|
+
}
|
|
4284
|
+
const msg = new (0, _chunkKXWOF6H4cjs.Message)();
|
|
4285
|
+
msg.addCap(this.main);
|
|
4286
|
+
a.fulfill(new Interface(msg.getSegment(0), 0));
|
|
4287
|
+
}
|
|
4288
|
+
handleFinishMessage(m) {
|
|
4289
|
+
const { finish } = m;
|
|
4290
|
+
const id = finish.questionId;
|
|
4291
|
+
const a = this.popAnswer(id);
|
|
4292
|
+
if (a === null) {
|
|
4293
|
+
throw new Error(_chunkKXWOF6H4cjs.format.call(void 0, _chunkKXWOF6H4cjs.RPC_FINISH_UNKNOWN_ANSWER, id));
|
|
4294
|
+
}
|
|
4295
|
+
if (finish.releaseResultCaps) {
|
|
4296
|
+
const caps = a.resultCaps;
|
|
4297
|
+
let i = caps.length;
|
|
4298
|
+
while (--i >= 0) {
|
|
4299
|
+
this.releaseExport(i, 1);
|
|
4300
|
+
}
|
|
4301
|
+
}
|
|
4302
|
+
}
|
|
4303
|
+
handleMessage(m) {
|
|
4304
|
+
switch (m.which()) {
|
|
4305
|
+
case Message2.UNIMPLEMENTED: {
|
|
4306
|
+
break;
|
|
4307
|
+
}
|
|
4308
|
+
case Message2.BOOTSTRAP: {
|
|
4309
|
+
this.handleBootstrapMessage(m);
|
|
4310
|
+
break;
|
|
4311
|
+
}
|
|
4312
|
+
case Message2.ABORT: {
|
|
4313
|
+
this.shutdown(new RPCError(m.abort));
|
|
4314
|
+
break;
|
|
4315
|
+
}
|
|
4316
|
+
case Message2.FINISH: {
|
|
4317
|
+
this.handleFinishMessage(m);
|
|
4318
|
+
break;
|
|
4319
|
+
}
|
|
4320
|
+
case Message2.RETURN: {
|
|
4321
|
+
this.handleReturnMessage(m);
|
|
4322
|
+
break;
|
|
4323
|
+
}
|
|
4324
|
+
case Message2.CALL: {
|
|
4325
|
+
this.handleCallMessage(m);
|
|
4326
|
+
break;
|
|
4327
|
+
}
|
|
4328
|
+
}
|
|
4329
|
+
}
|
|
4330
|
+
handleReturnMessage(m) {
|
|
4331
|
+
const ret = m.return;
|
|
4332
|
+
const id = ret.answerId;
|
|
4333
|
+
const q = this.popQuestion(id);
|
|
4334
|
+
if (!q) {
|
|
4335
|
+
throw new Error(_chunkKXWOF6H4cjs.format.call(void 0, _chunkKXWOF6H4cjs.RPC_RETURN_FOR_UNKNOWN_QUESTION, id));
|
|
4336
|
+
}
|
|
4337
|
+
if (ret.releaseParamCaps) {
|
|
4338
|
+
for (let i = 0; i < q.paramCaps.length; i++) {
|
|
4339
|
+
this.releaseExport(id, 1);
|
|
4340
|
+
}
|
|
4341
|
+
}
|
|
4342
|
+
let releaseResultCaps = true;
|
|
4343
|
+
switch (ret.which()) {
|
|
4344
|
+
case Return.RESULTS: {
|
|
4345
|
+
releaseResultCaps = false;
|
|
4346
|
+
const { results } = ret;
|
|
4347
|
+
this.populateMessageCapTable(results);
|
|
4348
|
+
const { content } = results;
|
|
4349
|
+
q.fulfill(content);
|
|
4350
|
+
break;
|
|
4351
|
+
}
|
|
4352
|
+
case Return.EXCEPTION: {
|
|
4353
|
+
const exc = ret.exception;
|
|
4354
|
+
const err = q.method ? new MethodError(q.method, exc.reason) : new RPCError(exc);
|
|
4355
|
+
q.reject(err);
|
|
4356
|
+
break;
|
|
4357
|
+
}
|
|
4358
|
+
}
|
|
4359
|
+
const fin = newFinishMessage(id, releaseResultCaps);
|
|
4360
|
+
this.sendMessage(fin);
|
|
4361
|
+
}
|
|
4362
|
+
handleCallMessage(m) {
|
|
4363
|
+
const mcall = m.call;
|
|
4364
|
+
const mt = mcall.target;
|
|
4365
|
+
if (mt.which() !== MessageTarget.IMPORTED_CAP && mt.which() !== MessageTarget.PROMISED_ANSWER) {
|
|
4366
|
+
const um = newUnimplementedMessage(m);
|
|
4367
|
+
this.sendMessage(um);
|
|
4368
|
+
return;
|
|
4369
|
+
}
|
|
4370
|
+
const mparams = mcall.params;
|
|
4371
|
+
try {
|
|
4372
|
+
this.populateMessageCapTable(mparams);
|
|
4373
|
+
} catch (e2) {
|
|
4374
|
+
const um = newUnimplementedMessage(m);
|
|
4375
|
+
this.sendMessage(um);
|
|
4376
|
+
return;
|
|
4377
|
+
}
|
|
4378
|
+
const id = mcall.questionId;
|
|
4379
|
+
const a = this.insertAnswer(id);
|
|
4380
|
+
if (!a) {
|
|
4381
|
+
throw new Error(_chunkKXWOF6H4cjs.format.call(void 0, _chunkKXWOF6H4cjs.RPC_QUESTION_ID_REUSED, id));
|
|
4382
|
+
}
|
|
4383
|
+
const interfaceDef = Registry.lookup(mcall.interfaceId);
|
|
4384
|
+
if (!interfaceDef) {
|
|
4385
|
+
const um = newUnimplementedMessage(m);
|
|
4386
|
+
this.sendMessage(um);
|
|
4387
|
+
return;
|
|
4388
|
+
}
|
|
4389
|
+
const method = interfaceDef.methods[mcall.methodId];
|
|
4390
|
+
if (!method) {
|
|
4391
|
+
const um = newUnimplementedMessage(m);
|
|
4392
|
+
this.sendMessage(um);
|
|
4393
|
+
return;
|
|
4394
|
+
}
|
|
4395
|
+
const paramContent = mparams.content;
|
|
4396
|
+
const call = {
|
|
4397
|
+
method,
|
|
4398
|
+
params: _chunkKXWOF6H4cjs.getAs.call(void 0, method.ParamsClass, paramContent)
|
|
4399
|
+
};
|
|
4400
|
+
try {
|
|
4401
|
+
this.routeCallMessage(a, mt, call);
|
|
4402
|
+
} catch (error_) {
|
|
4403
|
+
a.reject(error_);
|
|
4404
|
+
}
|
|
4405
|
+
}
|
|
4406
|
+
routeCallMessage(result, mt, cl) {
|
|
4407
|
+
switch (mt.which()) {
|
|
4408
|
+
case MessageTarget.IMPORTED_CAP: {
|
|
4409
|
+
const id = mt.importedCap;
|
|
4410
|
+
const e = this.findExport(id);
|
|
4411
|
+
if (!e) {
|
|
4412
|
+
throw new Error(_chunkKXWOF6H4cjs.RPC_BAD_TARGET);
|
|
4413
|
+
}
|
|
4414
|
+
const answer = this.call(e.client, cl);
|
|
4415
|
+
joinAnswer(result, answer);
|
|
4416
|
+
break;
|
|
4417
|
+
}
|
|
4418
|
+
case MessageTarget.PROMISED_ANSWER: {
|
|
4419
|
+
const mpromise = mt.promisedAnswer;
|
|
4420
|
+
const id = mpromise.questionId;
|
|
4421
|
+
if (id === result.id) {
|
|
4422
|
+
throw new Error(_chunkKXWOF6H4cjs.RPC_BAD_TARGET);
|
|
4423
|
+
}
|
|
4424
|
+
const pa = this.answers[id];
|
|
4425
|
+
if (!pa) {
|
|
4426
|
+
throw new Error(_chunkKXWOF6H4cjs.RPC_BAD_TARGET);
|
|
4427
|
+
}
|
|
4428
|
+
const mtrans = mpromise.transform;
|
|
4429
|
+
const transform = promisedAnswerOpsToTransform(mtrans);
|
|
4430
|
+
if (pa.done) {
|
|
4431
|
+
const { obj, err } = pa;
|
|
4432
|
+
const client = clientFromResolution(transform, obj, err);
|
|
4433
|
+
const answer = this.call(client, cl);
|
|
4434
|
+
joinAnswer(result, answer);
|
|
4435
|
+
} else {
|
|
4436
|
+
pa.queueCall(cl, transform, result);
|
|
4437
|
+
}
|
|
4438
|
+
break;
|
|
4439
|
+
}
|
|
4440
|
+
default: {
|
|
4441
|
+
throw new Error(_chunkKXWOF6H4cjs.INVARIANT_UNREACHABLE_CODE);
|
|
4442
|
+
}
|
|
4443
|
+
}
|
|
4444
|
+
}
|
|
4445
|
+
populateMessageCapTable(payload) {
|
|
4446
|
+
const msg = payload.segment.message;
|
|
4447
|
+
const ctab = payload.capTable;
|
|
4448
|
+
for (const desc of ctab) {
|
|
4449
|
+
switch (desc.which()) {
|
|
4450
|
+
case CapDescriptor.NONE: {
|
|
4451
|
+
msg.addCap(null);
|
|
4452
|
+
break;
|
|
4453
|
+
}
|
|
4454
|
+
case CapDescriptor.SENDER_HOSTED: {
|
|
4455
|
+
const id = desc.senderHosted;
|
|
4456
|
+
const client = this.addImport(id);
|
|
4457
|
+
msg.addCap(client);
|
|
4458
|
+
break;
|
|
4459
|
+
}
|
|
4460
|
+
case CapDescriptor.SENDER_PROMISE: {
|
|
4461
|
+
const id = desc.senderPromise;
|
|
4462
|
+
const client = this.addImport(id);
|
|
4463
|
+
msg.addCap(client);
|
|
4464
|
+
break;
|
|
4465
|
+
}
|
|
4466
|
+
case CapDescriptor.RECEIVER_HOSTED: {
|
|
4467
|
+
const id = desc.receiverHosted;
|
|
4468
|
+
const e = this.findExport(id);
|
|
4469
|
+
if (!e) {
|
|
4470
|
+
throw new Error(_chunkKXWOF6H4cjs.format.call(void 0, _chunkKXWOF6H4cjs.RPC_UNKNOWN_EXPORT_ID, id));
|
|
4471
|
+
}
|
|
4472
|
+
msg.addCap(e.rc.ref());
|
|
4473
|
+
break;
|
|
4474
|
+
}
|
|
4475
|
+
case CapDescriptor.RECEIVER_ANSWER: {
|
|
4476
|
+
const recvAns = desc.receiverAnswer;
|
|
4477
|
+
const id = recvAns.questionId;
|
|
4478
|
+
const a = this.answers[id];
|
|
4479
|
+
if (!a) {
|
|
4480
|
+
throw new Error(_chunkKXWOF6H4cjs.format.call(void 0, _chunkKXWOF6H4cjs.RPC_UNKNOWN_ANSWER_ID, id));
|
|
4481
|
+
}
|
|
4482
|
+
const recvTransform = recvAns.transform;
|
|
4483
|
+
const transform = promisedAnswerOpsToTransform(recvTransform);
|
|
4484
|
+
msg.addCap(answerPipelineClient(a, transform));
|
|
4485
|
+
break;
|
|
4486
|
+
}
|
|
4487
|
+
default: {
|
|
4488
|
+
throw new Error(_chunkKXWOF6H4cjs.format.call(void 0, _chunkKXWOF6H4cjs.RPC_UNKNOWN_CAP_DESCRIPTOR, desc.which()));
|
|
4489
|
+
}
|
|
4490
|
+
}
|
|
4491
|
+
}
|
|
4492
|
+
}
|
|
4493
|
+
addImport(id) {
|
|
4494
|
+
const importEntry = this.imports[id];
|
|
4495
|
+
if (importEntry) {
|
|
4496
|
+
importEntry.refs++;
|
|
4497
|
+
return importEntry.rc.ref();
|
|
4498
|
+
}
|
|
4499
|
+
const client = new ImportClient(this, id);
|
|
4500
|
+
const [rc, ref] = RefCount.new(client, this.finalize);
|
|
4501
|
+
this.imports[id] = {
|
|
4502
|
+
rc,
|
|
4503
|
+
refs: 1
|
|
4504
|
+
};
|
|
4505
|
+
return ref;
|
|
4506
|
+
}
|
|
4507
|
+
findExport(id) {
|
|
4508
|
+
if (id > this.exports.length) {
|
|
4509
|
+
return null;
|
|
4510
|
+
}
|
|
4511
|
+
return this.exports[id];
|
|
4512
|
+
}
|
|
4513
|
+
addExport(client) {
|
|
4514
|
+
for (let i = 0; i < this.exports.length; i++) {
|
|
4515
|
+
const e = this.exports[i];
|
|
4516
|
+
if (e && isSameClient(e.rc._client, client)) {
|
|
4517
|
+
e.wireRefs++;
|
|
4518
|
+
return i;
|
|
4519
|
+
}
|
|
4520
|
+
}
|
|
4521
|
+
const id = this.exportID.next();
|
|
4522
|
+
const [rc, ref] = RefCount.new(client, this.finalize);
|
|
4523
|
+
const _export = {
|
|
4524
|
+
client: ref,
|
|
4525
|
+
id,
|
|
4526
|
+
rc,
|
|
4527
|
+
wireRefs: 1
|
|
4528
|
+
};
|
|
4529
|
+
if (id === this.exports.length) {
|
|
4530
|
+
this.exports.push(_export);
|
|
4531
|
+
} else {
|
|
4532
|
+
this.exports[id] = _export;
|
|
4533
|
+
}
|
|
4534
|
+
return id;
|
|
4535
|
+
}
|
|
4536
|
+
releaseExport(id, refs) {
|
|
4537
|
+
const e = this.findExport(id);
|
|
4538
|
+
if (!e) {
|
|
4539
|
+
return;
|
|
4540
|
+
}
|
|
4541
|
+
e.wireRefs -= refs;
|
|
4542
|
+
if (e.wireRefs > 0) {
|
|
4543
|
+
return;
|
|
4544
|
+
}
|
|
4545
|
+
if (e.wireRefs < 0) {
|
|
4546
|
+
this.error(`warning: export ${id} has negative refcount (${e.wireRefs})`);
|
|
4547
|
+
}
|
|
4548
|
+
e.client.close();
|
|
4549
|
+
this.exports[id] = null;
|
|
4550
|
+
this.exportID.remove(id);
|
|
4551
|
+
}
|
|
4552
|
+
error(s) {
|
|
4553
|
+
console.error(s);
|
|
4554
|
+
}
|
|
4555
|
+
newQuestion(method) {
|
|
4556
|
+
const id = this.questionID.next();
|
|
4557
|
+
const q = new Question(this, id, method);
|
|
4558
|
+
if (id === this.questions.length) {
|
|
4559
|
+
this.questions.push(q);
|
|
4560
|
+
} else {
|
|
4561
|
+
this.questions[id] = q;
|
|
4562
|
+
}
|
|
4563
|
+
return q;
|
|
4564
|
+
}
|
|
4565
|
+
findQuestion(id) {
|
|
4566
|
+
if (id > this.questions.length) {
|
|
4567
|
+
return null;
|
|
4568
|
+
}
|
|
4569
|
+
return this.questions[id];
|
|
4570
|
+
}
|
|
4571
|
+
popQuestion(id) {
|
|
4572
|
+
const q = this.findQuestion(id);
|
|
4573
|
+
if (!q) {
|
|
4574
|
+
return q;
|
|
4575
|
+
}
|
|
4576
|
+
this.questions[id] = null;
|
|
4577
|
+
this.questionID.remove(id);
|
|
4578
|
+
return q;
|
|
4579
|
+
}
|
|
4580
|
+
// TODO: cancel context?
|
|
4581
|
+
insertAnswer(id) {
|
|
4582
|
+
if (this.answers[id]) {
|
|
4583
|
+
return null;
|
|
4584
|
+
}
|
|
4585
|
+
const a = new AnswerEntry(this, id);
|
|
4586
|
+
this.answers[id] = a;
|
|
4587
|
+
return a;
|
|
4588
|
+
}
|
|
4589
|
+
popAnswer(id) {
|
|
4590
|
+
const a = this.answers[id];
|
|
4591
|
+
delete this.answers[id];
|
|
4592
|
+
return a;
|
|
4593
|
+
}
|
|
4594
|
+
shutdown(_err) {
|
|
4595
|
+
this.transport.close();
|
|
4596
|
+
}
|
|
4597
|
+
call(client, call) {
|
|
4598
|
+
return client.call(call);
|
|
4599
|
+
}
|
|
4600
|
+
fillParams(payload, cl) {
|
|
4601
|
+
const params = placeParams(cl, payload.content);
|
|
4602
|
+
payload.content = params;
|
|
4603
|
+
this.makeCapTable(
|
|
4604
|
+
payload.segment,
|
|
4605
|
+
(length) => payload._initCapTable(length)
|
|
4606
|
+
);
|
|
4607
|
+
}
|
|
4608
|
+
makeCapTable(s, init) {
|
|
4609
|
+
const msgtab = s.message._capnp.capTable;
|
|
4610
|
+
if (!msgtab) {
|
|
4611
|
+
return;
|
|
4612
|
+
}
|
|
4613
|
+
const t = init(msgtab.length);
|
|
4614
|
+
for (const [i, client] of msgtab.entries()) {
|
|
4615
|
+
const desc = t.get(i);
|
|
4616
|
+
if (!client) {
|
|
4617
|
+
desc.none = true;
|
|
4618
|
+
continue;
|
|
4619
|
+
}
|
|
4620
|
+
this.descriptorForClient(desc, client);
|
|
4621
|
+
}
|
|
4622
|
+
}
|
|
4623
|
+
// descriptorForClient fills desc for client, adding it to the export
|
|
4624
|
+
// table if necessary. The caller must be holding onto c.mu.
|
|
4625
|
+
descriptorForClient(desc, _client) {
|
|
4626
|
+
{
|
|
4627
|
+
dig: for (let client = _client; ; ) {
|
|
4628
|
+
if (client instanceof ImportClient) {
|
|
4629
|
+
if (client.conn !== this) {
|
|
4630
|
+
break dig;
|
|
4631
|
+
}
|
|
4632
|
+
desc.receiverHosted = client.id;
|
|
4633
|
+
return;
|
|
4634
|
+
} else if (client instanceof Ref) {
|
|
4635
|
+
client = client.client();
|
|
4636
|
+
} else if (client instanceof PipelineClient) {
|
|
4637
|
+
const p = client.pipeline;
|
|
4638
|
+
const ans = p.answer;
|
|
4639
|
+
const transform = p.transform();
|
|
4640
|
+
if (ans instanceof _chunkKXWOF6H4cjs.FixedAnswer) {
|
|
4641
|
+
let s;
|
|
4642
|
+
let err;
|
|
4643
|
+
try {
|
|
4644
|
+
s = ans.structSync();
|
|
4645
|
+
} catch (error_) {
|
|
4646
|
+
err = error_;
|
|
4647
|
+
}
|
|
4648
|
+
client = clientFromResolution(transform, s, err);
|
|
4649
|
+
} else if (ans instanceof Question) {
|
|
4650
|
+
if (ans.state !== QuestionState.IN_PROGRESS) {
|
|
4651
|
+
client = clientFromResolution(transform, ans.obj, ans.err);
|
|
4652
|
+
continue;
|
|
4653
|
+
}
|
|
4654
|
+
if (ans.conn !== this) {
|
|
4655
|
+
break dig;
|
|
4656
|
+
}
|
|
4657
|
+
const a = desc._initReceiverAnswer();
|
|
4658
|
+
a.questionId = ans.id;
|
|
4659
|
+
transformToPromisedAnswer(a, p.transform());
|
|
4660
|
+
return;
|
|
4661
|
+
} else {
|
|
4662
|
+
break dig;
|
|
4663
|
+
}
|
|
4664
|
+
} else {
|
|
4665
|
+
break dig;
|
|
4666
|
+
}
|
|
4667
|
+
}
|
|
4668
|
+
}
|
|
4669
|
+
const id = this.addExport(_client);
|
|
4670
|
+
desc.senderHosted = id;
|
|
4671
|
+
}
|
|
4672
|
+
sendMessage(msg) {
|
|
4673
|
+
this.transport.sendMessage(msg);
|
|
4674
|
+
}
|
|
4675
|
+
async work() {
|
|
4676
|
+
this.working = true;
|
|
4677
|
+
while (this.working) {
|
|
4678
|
+
try {
|
|
4679
|
+
const m = await this.transport.recvMessage();
|
|
4680
|
+
this.handleMessage(m);
|
|
4681
|
+
} catch (error_) {
|
|
4682
|
+
if (error_ !== void 0) {
|
|
4683
|
+
throw error_;
|
|
4684
|
+
}
|
|
4685
|
+
this.working = false;
|
|
4686
|
+
}
|
|
4687
|
+
}
|
|
4688
|
+
}
|
|
4689
|
+
}, _class43);
|
|
4690
|
+
function answerPipelineClient(a, transform) {
|
|
4691
|
+
return new LocalAnswerClient(a, transform);
|
|
4692
|
+
}
|
|
4693
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, answerPipelineClient, "answerPipelineClient");
|
|
4694
|
+
var DeferredTransport = (_class44 = class {constructor() { _class44.prototype.__init24.call(this);_class44.prototype.__init25.call(this);_class44.prototype.__init26.call(this); }
|
|
4695
|
+
static {
|
|
4696
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "DeferredTransport");
|
|
4697
|
+
}
|
|
4698
|
+
|
|
4699
|
+
__init24() {this.closed = false}
|
|
4700
|
+
close() {
|
|
4701
|
+
this.closed = true;
|
|
4702
|
+
_optionalChain([this, 'access', _13 => _13.d, 'optionalAccess', _14 => _14.reject, 'call', _15 => _15()]);
|
|
4703
|
+
}
|
|
4704
|
+
recvMessage() {
|
|
4705
|
+
if (this.closed) {
|
|
4706
|
+
return Promise.reject();
|
|
4707
|
+
}
|
|
4708
|
+
if (this.d) {
|
|
4709
|
+
this.d.reject();
|
|
4710
|
+
}
|
|
4711
|
+
this.d = new Deferred();
|
|
4712
|
+
return this.d.promise;
|
|
4713
|
+
}
|
|
4714
|
+
__init25() {this.reject = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (err) => {
|
|
4715
|
+
_optionalChain([this, 'access', _16 => _16.d, 'optionalAccess', _17 => _17.reject, 'call', _18 => _18(err)]);
|
|
4716
|
+
}, "reject")}
|
|
4717
|
+
__init26() {this.resolve = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (buf) => {
|
|
4718
|
+
try {
|
|
4719
|
+
_optionalChain([this, 'access', _19 => _19.d, 'optionalAccess', _20 => _20.resolve, 'call', _21 => _21(new (0, _chunkKXWOF6H4cjs.Message)(buf, false).getRoot(Message2))]);
|
|
4720
|
+
} catch (error_) {
|
|
4721
|
+
_optionalChain([this, 'access', _22 => _22.d, 'optionalAccess', _23 => _23.reject, 'call', _24 => _24(error_)]);
|
|
4722
|
+
}
|
|
4723
|
+
}, "resolve")}
|
|
4724
|
+
}, _class44);
|
|
4725
|
+
|
|
4726
|
+
// src/rpc.ts
|
|
4727
|
+
var _worker_threads = require('worker_threads');
|
|
4728
|
+
var MessageChannelTransport = class extends DeferredTransport {
|
|
4729
|
+
static {
|
|
4730
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "MessageChannelTransport");
|
|
4731
|
+
}
|
|
4732
|
+
|
|
4733
|
+
constructor(port) {
|
|
4734
|
+
super(), this.port = port, this.close = () => {
|
|
4735
|
+
this.port.off("message", this.resolve);
|
|
4736
|
+
this.port.off("messageerror", this.reject);
|
|
4737
|
+
this.port.off("close", this.close);
|
|
4738
|
+
this.port.close();
|
|
4739
|
+
super.close();
|
|
4740
|
+
};
|
|
4741
|
+
this.port.on("message", this.resolve);
|
|
4742
|
+
this.port.on("messageerror", this.reject);
|
|
4743
|
+
this.port.on("close", this.close);
|
|
4744
|
+
}
|
|
4745
|
+
|
|
4746
|
+
sendMessage(msg) {
|
|
4747
|
+
const m = new (0, _chunkKXWOF6H4cjs.Message)();
|
|
4748
|
+
m.setRoot(msg);
|
|
4749
|
+
const buf = m.toArrayBuffer();
|
|
4750
|
+
this.port.postMessage(buf, [
|
|
4751
|
+
buf
|
|
4752
|
+
]);
|
|
4753
|
+
}
|
|
4754
|
+
};
|
|
4755
|
+
var CapnpRPC = (_class45 = class {constructor() { _class45.prototype.__init27.call(this);_class45.prototype.__init28.call(this);_class45.prototype.__init29.call(this); }
|
|
4756
|
+
static {
|
|
4757
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, this, "CapnpRPC");
|
|
4758
|
+
}
|
|
4759
|
+
/**
|
|
4760
|
+
* A queue for deferred connections that are waiting to be accepted.
|
|
4761
|
+
*
|
|
4762
|
+
* @remarks
|
|
4763
|
+
* This is used to manage incoming connections when the accept method is called.
|
|
4764
|
+
*/
|
|
4765
|
+
__init27() {this.acceptQueue = new Array()}
|
|
4766
|
+
/**
|
|
4767
|
+
* A map of connections by their ID.
|
|
4768
|
+
*
|
|
4769
|
+
* @remarks
|
|
4770
|
+
* This is used to manage multiple connections and allows for easy retrieval by ID.
|
|
4771
|
+
*/
|
|
4772
|
+
__init28() {this.connections = {}}
|
|
4773
|
+
/**
|
|
4774
|
+
* A queue for connections that are waiting to be accepted.
|
|
4775
|
+
*
|
|
4776
|
+
* @remarks
|
|
4777
|
+
* This is used to manage incoming connections when the accept method is called.
|
|
4778
|
+
*/
|
|
4779
|
+
__init29() {this.connectQueue = new Array()}
|
|
4780
|
+
/**
|
|
4781
|
+
* Creates a new {@link Conn} instance.
|
|
4782
|
+
*
|
|
4783
|
+
* @remarks
|
|
4784
|
+
* This class is used to manage connections and accept incoming connections using the {@link MessageChannel} API.
|
|
4785
|
+
*/
|
|
4786
|
+
connect(id = 0) {
|
|
4787
|
+
if (this.connections[id] !== void 0) {
|
|
4788
|
+
return this.connections[id];
|
|
4789
|
+
}
|
|
4790
|
+
const ch = new (0, _worker_threads.MessageChannel)();
|
|
4791
|
+
const conn = new Conn(new MessageChannelTransport(ch.port1));
|
|
4792
|
+
const accept = this.acceptQueue.pop();
|
|
4793
|
+
this.connections[id] = conn;
|
|
4794
|
+
if (accept === void 0) {
|
|
4795
|
+
this.connectQueue.push(ch.port2);
|
|
4796
|
+
} else {
|
|
4797
|
+
accept.resolve(new Conn(new MessageChannelTransport(ch.port2)));
|
|
4798
|
+
}
|
|
4799
|
+
return conn;
|
|
4800
|
+
}
|
|
4801
|
+
/**
|
|
4802
|
+
* Accepts a connection from the connect queue.
|
|
4803
|
+
*
|
|
4804
|
+
* @returns A promise that resolves to a Conn instance when a connection is accepted.
|
|
4805
|
+
* @throws If no connections are available in the connect queue.
|
|
4806
|
+
*/
|
|
4807
|
+
async accept() {
|
|
4808
|
+
const port2 = this.connectQueue.pop();
|
|
4809
|
+
if (port2 !== void 0) {
|
|
4810
|
+
return Promise.resolve(new Conn(new MessageChannelTransport(port2)));
|
|
4811
|
+
}
|
|
4812
|
+
const deferred = new Deferred();
|
|
4813
|
+
this.acceptQueue.push(deferred);
|
|
4814
|
+
return deferred.promise;
|
|
4815
|
+
}
|
|
4816
|
+
/**
|
|
4817
|
+
* Closes all connections and clears the queues.
|
|
4818
|
+
*
|
|
4819
|
+
* @remarks
|
|
4820
|
+
* This method will reject all pending accept promises and close all
|
|
4821
|
+
* connections in the connect queue.
|
|
4822
|
+
*/
|
|
4823
|
+
close() {
|
|
4824
|
+
let i = this.acceptQueue.length;
|
|
4825
|
+
while (--i >= 0) {
|
|
4826
|
+
_optionalChain([this, 'access', _25 => _25.acceptQueue, 'access', _26 => _26[i], 'optionalAccess', _27 => _27.reject, 'call', _28 => _28()]);
|
|
4827
|
+
}
|
|
4828
|
+
i = this.connectQueue.length;
|
|
4829
|
+
while (--i >= 0) {
|
|
4830
|
+
this.connectQueue[i].close();
|
|
4831
|
+
}
|
|
4832
|
+
for (const id in this.connections) {
|
|
4833
|
+
_optionalChain([this, 'access', _29 => _29.connections, 'access', _30 => _30[id], 'optionalAccess', _31 => _31.shutdown, 'call', _32 => _32()]);
|
|
4834
|
+
}
|
|
4835
|
+
this.acceptQueue.length = 0;
|
|
4836
|
+
this.connectQueue.length = 0;
|
|
4837
|
+
this.connections = {};
|
|
4838
|
+
}
|
|
4839
|
+
}, _class45);
|
|
4840
|
+
|
|
4841
|
+
|
|
4842
|
+
|
|
4843
|
+
|
|
4844
|
+
|
|
4845
|
+
|
|
4846
|
+
|
|
4847
|
+
|
|
4848
|
+
|
|
4849
|
+
|
|
4850
|
+
|
|
4851
|
+
|
|
4852
|
+
|
|
4853
|
+
|
|
4854
|
+
|
|
4855
|
+
|
|
4856
|
+
|
|
4857
|
+
|
|
4858
|
+
|
|
4859
|
+
|
|
4860
|
+
|
|
4861
|
+
|
|
4862
|
+
|
|
4863
|
+
|
|
4864
|
+
|
|
4865
|
+
|
|
4866
|
+
|
|
4867
|
+
|
|
4868
|
+
|
|
4869
|
+
|
|
4870
|
+
|
|
4871
|
+
|
|
4872
|
+
|
|
4873
|
+
|
|
4874
|
+
|
|
4875
|
+
|
|
4876
|
+
|
|
4877
|
+
exports.Interface = Interface; exports.isFuncCall = isFuncCall; exports.isDataCall = isDataCall; exports.copyCall = copyCall; exports.placeParams = placeParams; exports.Deferred = Deferred; exports.Pipeline = Pipeline; exports.Registry = Registry; exports.Server = Server; exports.Void = Void; exports.utils = utils; exports.PointerList = PointerList; exports.AnyPointerList = AnyPointerList; exports.BoolList = BoolList; exports.DataList = DataList; exports.Float32List = Float32List; exports.Float64List = Float64List; exports.Int8List = Int8List; exports.Int16List = Int16List; exports.Int32List = Int32List; exports.Int64List = Int64List; exports.InterfaceList = InterfaceList; exports.TextList = TextList; exports.Uint8List = Uint8List; exports.Uint16List = Uint16List; exports.Uint32List = Uint32List; exports.Uint64List = Uint64List; exports.VoidList = VoidList; exports.isSameClient = isSameClient; exports.clientFromResolution = clientFromResolution; exports.Conn = Conn; exports.answerPipelineClient = answerPipelineClient; exports.DeferredTransport = DeferredTransport; exports.MessageChannelTransport = MessageChannelTransport; exports.CapnpRPC = CapnpRPC;
|