@agoric/async-flow 0.1.1-calypso-dev-84eb287.0

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/LICENSE +201 -0
  3. package/README.md +40 -0
  4. package/docs/async-flow-states.key +0 -0
  5. package/docs/async-flow-states.md +15 -0
  6. package/docs/async-flow-states.png +0 -0
  7. package/index.d.ts +3 -0
  8. package/index.d.ts.map +1 -0
  9. package/index.js +2 -0
  10. package/package.json +66 -0
  11. package/src/async-flow.d.ts +94 -0
  12. package/src/async-flow.d.ts.map +1 -0
  13. package/src/async-flow.js +520 -0
  14. package/src/bijection.d.ts +31 -0
  15. package/src/bijection.d.ts.map +1 -0
  16. package/src/bijection.js +207 -0
  17. package/src/convert.d.ts +6 -0
  18. package/src/convert.d.ts.map +1 -0
  19. package/src/convert.js +133 -0
  20. package/src/endowments.d.ts +16 -0
  21. package/src/endowments.d.ts.map +1 -0
  22. package/src/endowments.js +292 -0
  23. package/src/ephemera.d.ts +3 -0
  24. package/src/ephemera.d.ts.map +1 -0
  25. package/src/ephemera.js +39 -0
  26. package/src/equate.d.ts +2 -0
  27. package/src/equate.d.ts.map +1 -0
  28. package/src/equate.js +123 -0
  29. package/src/log-store.d.ts +27 -0
  30. package/src/log-store.d.ts.map +1 -0
  31. package/src/log-store.js +169 -0
  32. package/src/replay-membrane.d.ts +40 -0
  33. package/src/replay-membrane.d.ts.map +1 -0
  34. package/src/replay-membrane.js +752 -0
  35. package/src/type-guards.d.ts +4 -0
  36. package/src/type-guards.d.ts.map +1 -0
  37. package/src/type-guards.js +68 -0
  38. package/src/types.d.ts +67 -0
  39. package/src/types.d.ts.map +1 -0
  40. package/src/types.js +196 -0
  41. package/test/async-flow-crank.test.js +102 -0
  42. package/test/async-flow-early-completion.test.js +203 -0
  43. package/test/async-flow-no-this.js +65 -0
  44. package/test/async-flow.test.js +383 -0
  45. package/test/bad-host.test.js +210 -0
  46. package/test/bijection.test.js +124 -0
  47. package/test/convert.test.js +132 -0
  48. package/test/endowments.test.js +157 -0
  49. package/test/equate.test.js +120 -0
  50. package/test/log-store.test.js +120 -0
  51. package/test/prepare-test-env-ava.js +28 -0
  52. package/test/replay-membrane-eventual.test.js +217 -0
  53. package/test/replay-membrane-settlement.test.js +173 -0
  54. package/test/replay-membrane-zombie.test.js +187 -0
  55. package/test/replay-membrane.test.js +297 -0
  56. package/tsconfig.build.json +11 -0
  57. package/tsconfig.json +13 -0
  58. package/typedoc.json +8 -0
@@ -0,0 +1,520 @@
1
+ import { annotateError, Fail, makeError, q, X } from '@endo/errors';
2
+ import { E } from '@endo/eventual-send';
3
+ import { M } from '@endo/patterns';
4
+ import { makeScalarWeakMapStore } from '@agoric/store';
5
+ import {
6
+ prepareVowTools,
7
+ toPassableCap,
8
+ ReactionGuard,
9
+ VowShape,
10
+ } from '@agoric/vow';
11
+ import { makeReplayMembrane } from './replay-membrane.js';
12
+ import { prepareLogStore } from './log-store.js';
13
+ import { prepareBijection } from './bijection.js';
14
+ import { prepareEndowmentTools } from './endowments.js';
15
+ import { LogEntryShape, FlowStateShape } from './type-guards.js';
16
+
17
+ /**
18
+ * @import {WeakMapStore} from '@agoric/store'
19
+ * @import {Zone} from '@agoric/base-zone'
20
+ * @import {FlowState, GuestAsyncFunc, HostAsyncFuncWrapper, PreparationOptions} from '../src/types.js'
21
+ * @import {ReplayMembrane} from '../src/replay-membrane.js'
22
+ */
23
+
24
+ const { defineProperties } = Object;
25
+
26
+ const AsyncFlowIKit = harden({
27
+ flow: M.interface('Flow', {
28
+ getFlowState: M.call().returns(FlowStateShape),
29
+ restart: M.call().optional(M.boolean()).returns(),
30
+ wake: M.call().returns(),
31
+ getOutcome: M.call().returns(VowShape),
32
+ dump: M.call().returns(M.arrayOf(LogEntryShape)),
33
+ getOptFatalProblem: M.call().returns(M.opt(M.error())),
34
+ }),
35
+ admin: M.interface('FlowAdmin', {
36
+ reset: M.call().returns(),
37
+ complete: M.call().returns(),
38
+ panic: M.call(M.error()).returns(M.not(M.any())), // only throws
39
+ }),
40
+ wakeWatcher: M.interface('WakeWatcher', {
41
+ onFulfilled: ReactionGuard,
42
+ onRejected: ReactionGuard,
43
+ }),
44
+ });
45
+
46
+ const AdminAsyncFlowI = M.interface('AsyncFlowAdmin', {
47
+ getFailures: M.call().returns(M.mapOf(M.remotable('asyncFlow'), M.error())),
48
+ wakeAll: M.call().returns(),
49
+ getFlowForOutcomeVow: M.call(VowShape).returns(M.opt(M.remotable('flow'))),
50
+ });
51
+
52
+ /**
53
+ * @param {Zone} outerZone
54
+ * @param {PreparationOptions} [outerOptions]
55
+ */
56
+ export const prepareAsyncFlowTools = (outerZone, outerOptions = {}) => {
57
+ const {
58
+ vowTools = prepareVowTools(outerZone),
59
+ makeLogStore = prepareLogStore(outerZone),
60
+ endowmentTools: { prepareEndowment, unwrap } = prepareEndowmentTools(
61
+ outerZone,
62
+ { vowTools },
63
+ ),
64
+ makeBijection = prepareBijection(outerZone, unwrap),
65
+ } = outerOptions;
66
+ const { watch, makeVowKit } = vowTools;
67
+
68
+ const failures = outerZone.mapStore('asyncFuncFailures', {
69
+ keyShape: M.remotable('flow'), // flowState === 'Failed'
70
+ valueShape: M.error(),
71
+ });
72
+
73
+ const eagerWakers = outerZone.setStore(`asyncFuncEagerWakers`, {
74
+ keyShape: M.remotable('flow'), // flowState !== 'Done'
75
+ });
76
+
77
+ /** @type WeakMapStore<AsyncFlow, ReplayMembrane> */
78
+ const membraneMap = makeScalarWeakMapStore('membraneFor', {
79
+ keyShape: M.remotable('flow'),
80
+ valueShape: M.remotable('membrane'),
81
+ });
82
+
83
+ const hasMembrane = flow => membraneMap.has(flow);
84
+ const getMembrane = flow => membraneMap.get(flow);
85
+ const initMembrane = (flow, membrane) => membraneMap.init(flow, membrane);
86
+ const deleteMembrane = flow => membraneMap.delete(flow);
87
+
88
+ /**
89
+ * So we can give out wrapper functions easily and recover flow objects
90
+ * for their activations later.
91
+ */
92
+ const flowForOutcomeVowKey = outerZone.mapStore('flowForOutcomeVow', {
93
+ keyShape: M.remotable('toPassableCap'),
94
+ valueShape: M.remotable('flow'), // flowState !== 'Done'
95
+ });
96
+
97
+ /**
98
+ * @param {Zone} zone
99
+ * @param {string} tag
100
+ * @param {GuestAsyncFunc} guestAsyncFunc
101
+ * @param {{ startEager?: boolean }} [options]
102
+ */
103
+ const prepareAsyncFlowKit = (zone, tag, guestAsyncFunc, options = {}) => {
104
+ typeof guestAsyncFunc === 'function' ||
105
+ Fail`guestAsyncFunc must be a callable function ${guestAsyncFunc}`;
106
+ const {
107
+ // May change default to false, once instances reliably wake up
108
+ startEager = true,
109
+ } = options;
110
+
111
+ const internalMakeAsyncFlowKit = zone.exoClassKit(
112
+ tag,
113
+ AsyncFlowIKit,
114
+ activationArgs => {
115
+ harden(activationArgs);
116
+ const log = makeLogStore();
117
+ const bijection = makeBijection();
118
+
119
+ return {
120
+ activationArgs, // replay starts by reactivating with these
121
+ log, // log to be accumulated or replayed
122
+ bijection, // membrane's guest-host mapping
123
+ outcomeKit: makeVowKit(), // outcome of activation as host vow
124
+ isDone: false, // persistently done
125
+ };
126
+ },
127
+ {
128
+ flow: {
129
+ /**
130
+ * @returns {FlowState}
131
+ */
132
+ getFlowState() {
133
+ const { state, facets } = this;
134
+ const { log, outcomeKit, isDone } = state;
135
+ const { flow } = facets;
136
+
137
+ if (isDone) {
138
+ !hasMembrane(flow) ||
139
+ Fail`Done flow must drop membrane ${flow} ${getMembrane(flow)}`;
140
+ !failures.has(flow) ||
141
+ Fail`Done flow must not be in failures ${flow} ${failures.get(flow)}`;
142
+ !eagerWakers.has(flow) ||
143
+ Fail`Done flow must not be in eagerWakers ${flow}`;
144
+ !flowForOutcomeVowKey.has(outcomeKit.vow) ||
145
+ Fail`Done flow must drop flow lookup from vow ${outcomeKit.vow}`;
146
+ (log.getIndex() === 0 && log.getLength() === 0) ||
147
+ Fail`Done flow must empty log ${flow} ${log}`;
148
+ return 'Done';
149
+ }
150
+ if (failures.has(flow)) {
151
+ return 'Failed';
152
+ }
153
+ if (!hasMembrane(flow)) {
154
+ log.getIndex() === 0 ||
155
+ Fail`Sleeping flow must play from log start ${flow} ${log.getIndex()}`;
156
+ return 'Sleeping';
157
+ }
158
+ if (log.isReplaying()) {
159
+ return 'Replaying';
160
+ }
161
+ return 'Running';
162
+ },
163
+
164
+ /**
165
+ * Calls the guest function, either for the initial run or at the
166
+ * start of a replay.
167
+ *
168
+ * @param {boolean} [eager]
169
+ */
170
+ restart(eager = startEager) {
171
+ const { state, facets } = this;
172
+ const { activationArgs, log, bijection, outcomeKit } = state;
173
+ const { flow, admin, wakeWatcher } = facets;
174
+
175
+ const startFlowState = flow.getFlowState();
176
+
177
+ startFlowState !== 'Done' ||
178
+ // separate line so I can set a breakpoint
179
+ Fail`Cannot restart a done flow ${flow}`;
180
+
181
+ admin.reset();
182
+ if (eager) {
183
+ eagerWakers.add(flow);
184
+ } else if (eagerWakers.has(flow)) {
185
+ eagerWakers.delete(flow);
186
+ }
187
+
188
+ const watchWake = vowish => {
189
+ // Extra paranoid because we're getting
190
+ // "promise watcher must be a virtual object"
191
+ // in the general vicinity.
192
+ zone.isStorable(vowish) ||
193
+ Fail`vowish must be storable in this zone (usually, must be durable): ${vowish}`;
194
+ zone.isStorable(wakeWatcher) ||
195
+ Fail`wakeWatcher must be storable in this zone (usually, must be durable): ${wakeWatcher}`;
196
+ watch(vowish, wakeWatcher);
197
+ };
198
+ const panic = err => admin.panic(err);
199
+ const membrane = makeReplayMembrane({
200
+ log,
201
+ bijection,
202
+ vowTools,
203
+ watchWake,
204
+ panic,
205
+ });
206
+ initMembrane(flow, membrane);
207
+ const guestArgs = membrane.hostToGuest(activationArgs);
208
+
209
+ const flowState = flow.getFlowState();
210
+ flowState === 'Running' ||
211
+ flowState === 'Replaying' ||
212
+ Fail`Restarted flow must be Running or Replaying ${flow}`;
213
+
214
+ // In case some host vows were settled before the guest makes
215
+ // the first call to a host object.
216
+ membrane.wake();
217
+
218
+ // We do *not* call the guestAsyncFunc by having the membrane make
219
+ // a host wrapper for the function. Rather, we special case this
220
+ // host-to-guest call by "manually" sending the arguments through
221
+ // and calling the guest function ourselves. Likewise, we
222
+ // special case the handling of the guestResultP, rather than
223
+ // ask the membrane to make a host vow for a guest promise.
224
+ // To support this special casing, we store additional replay
225
+ // data in this internal flow instance -- the host activationArgs
226
+ // and the host outcome vow kit.
227
+ const guestResultP = (async () =>
228
+ // async IFFE ensures guestResultP is a fresh promise
229
+ guestAsyncFunc(...guestArgs))();
230
+
231
+ if (flow.getFlowState() !== 'Failed') {
232
+ // If the flow fails, that resets the bijection. Without this
233
+ // gating condition, the next line could grow the bijection
234
+ // of a failed flow, subverting other gating checks on bijection
235
+ // membership.
236
+ const g = bijection.unwrapInit(guestResultP, outcomeKit.vow);
237
+ g === guestResultP ||
238
+ Fail`internal: promises should not be unwrapped ${g}`;
239
+ }
240
+ // log is driven at first by guestAyncFunc interaction through the
241
+ // membrane with the host activationArgs. At the end of its first
242
+ // turn, it returns a promise for its eventual guest result.
243
+ // It then proceeds to interact with the host through the membrane
244
+ // in further turns by `await`ing (or otherwise registering)
245
+ // on host vows turned into guest promises, and by calling
246
+ // the guest presence of other host objects.
247
+ //
248
+ // `bijection.hasGuest(guestResultP)` can be false in a delayed
249
+ // guest - to - host settling from a previous run.
250
+ // In that case, the bijection was reset and all guest caps
251
+ // created in the previous run were unregistered,
252
+ // including `guestResultP`.
253
+ void E.when(
254
+ guestResultP,
255
+ gFulfillment => {
256
+ if (bijection.hasGuest(guestResultP)) {
257
+ outcomeKit.resolver.resolve(
258
+ membrane.guestToHost(gFulfillment),
259
+ );
260
+ admin.complete();
261
+ }
262
+ },
263
+ guestReason => {
264
+ // The `guestResultP` might be a failure thrown by `panic`
265
+ // indicating a failure to replay. In that case, we must not
266
+ // settle the outcomeVow, since the outcome vow only represents
267
+ // the settled result of the async function itself.
268
+ // Fortunately, `panic` resets the bijection, again resulting
269
+ // in the `guestResultP` being absent from the bijection,
270
+ // so this leave the outcome vow unsettled, as it must.
271
+ if (bijection.hasGuest(guestResultP)) {
272
+ outcomeKit.resolver.reject(membrane.guestToHost(guestReason));
273
+ admin.complete();
274
+ }
275
+ },
276
+ );
277
+ },
278
+ wake() {
279
+ const { facets } = this;
280
+ const { flow } = facets;
281
+
282
+ const flowState = flow.getFlowState();
283
+ switch (flowState) {
284
+ case 'Done':
285
+ case 'Failed': {
286
+ return;
287
+ }
288
+ case 'Running':
289
+ case 'Replaying': {
290
+ // Safe to call membrane wake for a replaying or running flow
291
+ // because it is idempotent. membrane.wake already has reentrancy
292
+ // protection. Aside from harmless reentrancy, calling
293
+ // membrane.wake won't cause it to do anything that it would
294
+ // not have done on its own.
295
+ //
296
+ // An interesting edge case is that when the guest proceeds
297
+ // from a top-level doReturn or doThrow, while we're still in
298
+ // the guest turn, if somehow flow.wake were to be called then,
299
+ // and if the next thing in the replay log was a `doCall`
300
+ // (a future feature), then the `doCall` would call the guest
301
+ // while it was still in the middle of a "past" turn. However,
302
+ // this cannot happen because `flow` is host-side. For it to
303
+ // be called while the guest is active, the membrane's
304
+ // `callStack` would not be empty. membrane.wake checks and
305
+ // already throws an error in that case.
306
+ //
307
+ // More important, during a replay, no guest action can actually
308
+ // call host functions at all. Rather, the host is fully
309
+ // emulated from the log. So this case cannot arise.
310
+ //
311
+ // This analysis *assumes* that the guest function has no access
312
+ // to the flow outside the membrane, i.e., the "closed guest"
313
+ // assumption.
314
+ getMembrane(flow).wake();
315
+ return;
316
+ }
317
+ case 'Sleeping': {
318
+ flow.restart();
319
+ return;
320
+ }
321
+ default: {
322
+ // Should be a at-ts-expect-error that this case is unreachable
323
+ // which TS clearly knows anyway because it thinks the following
324
+ // `flowState` variable in this context has type `never`.
325
+ throw Fail`unexpected flowState ${q(flowState)}`;
326
+ }
327
+ }
328
+ },
329
+ getOutcome() {
330
+ const { state } = this;
331
+ const { outcomeKit } = state;
332
+ return outcomeKit.vow;
333
+ },
334
+ dump() {
335
+ const { state } = this;
336
+ const { log } = state;
337
+
338
+ return log.dump();
339
+ },
340
+ getOptFatalProblem() {
341
+ const { facets } = this;
342
+ const { flow } = facets;
343
+
344
+ return failures.has(flow) ? failures.get(flow) : undefined;
345
+ },
346
+ },
347
+ admin: {
348
+ reset() {
349
+ const { state, facets } = this;
350
+ const { bijection, log } = state;
351
+ const { flow } = facets;
352
+ !state.isDone || Fail`Cannot reset a done flow`;
353
+
354
+ if (failures.has(flow)) {
355
+ failures.delete(flow);
356
+ }
357
+ if (hasMembrane(flow)) {
358
+ getMembrane(flow).stop();
359
+ deleteMembrane(flow);
360
+ }
361
+ log.reset();
362
+ bijection.reset();
363
+ },
364
+ complete() {
365
+ const { state, facets } = this;
366
+ const { log } = state;
367
+ const { flow, admin } = facets;
368
+
369
+ admin.reset();
370
+ if (eagerWakers.has(flow)) {
371
+ eagerWakers.delete(flow);
372
+ }
373
+ flowForOutcomeVowKey.delete(toPassableCap(flow.getOutcome()));
374
+ state.isDone = true;
375
+ log.dispose();
376
+ flow.getFlowState() === 'Done' ||
377
+ Fail`Complete flow must be Done ${flow}`;
378
+ },
379
+ panic(fatalProblem) {
380
+ const { state, facets } = this;
381
+ const { bijection, log } = state;
382
+ const { flow } = facets;
383
+
384
+ if (failures.has(flow)) {
385
+ const prevErr = failures.get(flow);
386
+ annotateError(
387
+ prevErr,
388
+ X`doubly failed somehow with ${fatalProblem}`,
389
+ );
390
+ // prevErr likely to be the more relevant diagnostic to report
391
+ fatalProblem = prevErr;
392
+ } else {
393
+ failures.init(flow, fatalProblem);
394
+ }
395
+
396
+ if (hasMembrane(flow)) {
397
+ getMembrane(flow).stop();
398
+ deleteMembrane(flow);
399
+ }
400
+ log.reset();
401
+ bijection.reset();
402
+
403
+ flow.getFlowState() === 'Failed' ||
404
+ Fail`Panicked flow must be Failed ${flow}`;
405
+
406
+ // This is not an expected throw, so in theory arbitrary chaos
407
+ // may ensue from throwing it. But at this point
408
+ // we should have successfully isolated this activation from
409
+ // having any observable effects on the host, aside from
410
+ // console logging and
411
+ // resource exhaustion, including infinite loops
412
+ const err = makeError(
413
+ X`In a Failed state: see getFailures() or getOptFatalProblem() for more information`,
414
+ );
415
+ annotateError(err, X`due to ${fatalProblem}`);
416
+ throw err;
417
+ },
418
+ },
419
+ wakeWatcher: {
420
+ onFulfilled(_fulfillment) {
421
+ const { facets } = this;
422
+ facets.flow.wake();
423
+ },
424
+ onRejected(_fulfillment) {
425
+ const { facets } = this;
426
+ facets.flow.wake();
427
+ },
428
+ },
429
+ },
430
+ );
431
+ const makeAsyncFlowKit = activationArgs => {
432
+ const asyncFlowKit = internalMakeAsyncFlowKit(activationArgs);
433
+ const { flow } = asyncFlowKit;
434
+
435
+ const vow = flow.getOutcome();
436
+ flowForOutcomeVowKey.init(toPassableCap(vow), flow);
437
+ flow.restart();
438
+ return asyncFlowKit;
439
+ };
440
+ return harden(makeAsyncFlowKit);
441
+ };
442
+
443
+ /**
444
+ * @param {Zone} zone
445
+ * @param {string} tag
446
+ * @param {GuestAsyncFunc} guestFunc
447
+ * @param {{ startEager?: boolean }} [options]
448
+ * @returns {HostAsyncFuncWrapper}
449
+ */
450
+ const asyncFlow = (zone, tag, guestFunc, options = undefined) => {
451
+ const makeAsyncFlowKit = prepareAsyncFlowKit(zone, tag, guestFunc, options);
452
+ const hostFuncName = `${tag}_hostFlow`;
453
+ const wrapperFunc = {
454
+ [hostFuncName](...args) {
455
+ const { flow } = makeAsyncFlowKit(args);
456
+ return flow.getOutcome();
457
+ },
458
+ }[hostFuncName];
459
+ defineProperties(wrapperFunc, {
460
+ length: { value: guestFunc.length },
461
+ });
462
+ return harden(wrapperFunc);
463
+ };
464
+
465
+ const adminAsyncFlow = outerZone.exo('AdminAsyncFlow', AdminAsyncFlowI, {
466
+ getFailures() {
467
+ return failures.snapshot();
468
+ },
469
+ wakeAll() {
470
+ // [...stuff.keys()] in order to snapshot before iterating
471
+ const failuresToRestart = [...failures.keys()];
472
+ const flowsToWake = [...eagerWakers.keys()];
473
+ for (const flow of failuresToRestart) {
474
+ flow.restart();
475
+ }
476
+ for (const flow of flowsToWake) {
477
+ flow.wake();
478
+ }
479
+ },
480
+ getFlowForOutcomeVow(outcomeVow) {
481
+ return flowForOutcomeVowKey.get(toPassableCap(outcomeVow));
482
+ },
483
+ });
484
+
485
+ // Cannot call this until everything is prepared, so postpone to a later
486
+ // turn. (Ideally, we'd postpone to a later crank because prepares are
487
+ // allowed anytime in the first crank. But there's currently no pleasant
488
+ // way to postpone to a later crank.)
489
+ // See https://github.com/Agoric/agoric-sdk/issues/9377
490
+ const allWokenP = E.when(null, () => adminAsyncFlow.wakeAll());
491
+
492
+ return harden({
493
+ prepareAsyncFlowKit,
494
+ asyncFlow,
495
+ adminAsyncFlow,
496
+ allWokenP,
497
+ prepareEndowment,
498
+ });
499
+ };
500
+ harden(prepareAsyncFlowTools);
501
+
502
+ /**
503
+ * @typedef {ReturnType<prepareAsyncFlowTools>} AsyncFlowTools
504
+ */
505
+
506
+ /**
507
+ * @typedef {AsyncFlowTools['adminAsyncFlow']} AdminAsyncFlow
508
+ */
509
+
510
+ /**
511
+ * @typedef {ReturnType<AsyncFlowTools['prepareAsyncFlowKit']>} MakeAsyncFlowKit
512
+ */
513
+
514
+ /**
515
+ * @typedef {ReturnType<MakeAsyncFlowKit>} AsyncFlowKit
516
+ */
517
+
518
+ /**
519
+ * @typedef {AsyncFlowKit['flow']} AsyncFlow
520
+ */
@@ -0,0 +1,31 @@
1
+ export function prepareBijection(zone: Zone, unwrap?: ((hostWrapper: PassableCap | Vow, guestWrapper: PassableCap) => unknown) | undefined): () => import("@endo/exo").Guarded<{
2
+ reset(): void;
3
+ unwrapInit(g: any, h: any): unknown;
4
+ hasGuest(g: any): boolean;
5
+ hasHost(h: any): boolean;
6
+ has(g: any, h: any): boolean;
7
+ guestToHost(g: any): any;
8
+ hostToGuest(h: any): any;
9
+ }>;
10
+ export type VowishStore = ReturnType<(name: string) => {
11
+ init: (k: any, v: any) => void;
12
+ has: (k: any) => boolean;
13
+ get: (k: any) => any;
14
+ } & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
15
+ init: (k: any, v: any) => void;
16
+ has: (k: any) => boolean;
17
+ get: (k: any) => any;
18
+ }>>;
19
+ export type Bijection = ReturnType<ReturnType<(zone: Zone, unwrap?: ((hostWrapper: PassableCap | Vow, guestWrapper: PassableCap) => unknown) | undefined) => () => import("@endo/exo").Guarded<{
20
+ reset(): void;
21
+ unwrapInit(g: any, h: any): unknown;
22
+ hasGuest(g: any): boolean;
23
+ hasHost(h: any): boolean;
24
+ has(g: any, h: any): boolean;
25
+ guestToHost(g: any): any;
26
+ hostToGuest(h: any): any;
27
+ }>>>;
28
+ import type { Zone } from '@agoric/base-zone';
29
+ import type { PassableCap } from '@endo/pass-style';
30
+ import type { Vow } from '@agoric/vow';
31
+ //# sourceMappingURL=bijection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bijection.d.ts","sourceRoot":"","sources":["bijection.js"],"names":[],"mappings":"AA+GO,uCAJI,IAAI,0BACU,WAAW,GAAG,GAAG,gBAAgB,WAAW,KAAK,OAAO;;;;;;;;GA6FhF;0BAtIa,UAAU,QAhCb,MAAM;;;;;;;;GAgCwB;wBA0I5B,UAAU,CAAC,UAAU,QAlGvB,IAAI,0BACU,WAAW,GAAG,GAAG,gBAAgB,WAAW,KAAK,OAAO;;;;;;;;GAiG7B,CAAC;0BArM9B,mBAAmB;iCADZ,kBAAkB;yBAE1B,aAAa"}