@agoric/async-flow 0.1.1-dev-14afd8f.0.14afd8f → 0.1.1-dev-cbcea8c.0.cbcea8c
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/package.json +15 -15
- package/src/async-flow.d.ts +104 -7
- package/src/async-flow.d.ts.map +1 -1
- package/src/async-flow.js +30 -22
- package/src/bijection.d.ts +13 -5
- package/src/bijection.d.ts.map +1 -1
- package/src/bijection.js +5 -4
- package/src/endowments.d.ts.map +1 -1
- package/src/endowments.js +15 -8
- package/src/log-store.d.ts +316 -30
- package/src/log-store.d.ts.map +1 -1
- package/src/log-store.js +4 -4
- package/src/replay-membrane.js +2 -2
- package/src/type-guards.d.ts +51 -3
- package/src/type-guards.d.ts.map +1 -1
- package/test/log-store.test.js +8 -17
- package/tsconfig.build.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/async-flow",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-cbcea8c.0.cbcea8c",
|
|
4
4
|
"description": "Upgrade async functions at await points by replay",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://github.com/Agoric/agoric-sdk",
|
|
@@ -24,21 +24,21 @@
|
|
|
24
24
|
"author": "Agoric",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@agoric/base-zone": "0.1.1-dev-
|
|
28
|
-
"@agoric/internal": "0.3.3-dev-
|
|
29
|
-
"@agoric/store": "0.9.3-dev-
|
|
30
|
-
"@agoric/vow": "0.1.1-dev-
|
|
31
|
-
"@endo/common": "^1.
|
|
32
|
-
"@endo/errors": "^1.
|
|
33
|
-
"@endo/eventual-send": "^1.
|
|
34
|
-
"@endo/marshal": "^1.
|
|
35
|
-
"@endo/pass-style": "^1.
|
|
36
|
-
"@endo/patterns": "^1.
|
|
37
|
-
"@endo/promise-kit": "^1.1
|
|
27
|
+
"@agoric/base-zone": "0.1.1-dev-cbcea8c.0.cbcea8c",
|
|
28
|
+
"@agoric/internal": "0.3.3-dev-cbcea8c.0.cbcea8c",
|
|
29
|
+
"@agoric/store": "0.9.3-dev-cbcea8c.0.cbcea8c",
|
|
30
|
+
"@agoric/vow": "0.1.1-dev-cbcea8c.0.cbcea8c",
|
|
31
|
+
"@endo/common": "^1.4.0",
|
|
32
|
+
"@endo/errors": "^1.3.1",
|
|
33
|
+
"@endo/eventual-send": "^1.5.0",
|
|
34
|
+
"@endo/marshal": "^1.10.0",
|
|
35
|
+
"@endo/pass-style": "^1.8.1",
|
|
36
|
+
"@endo/patterns": "^1.9.1",
|
|
37
|
+
"@endo/promise-kit": "^1.2.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
41
|
-
"@agoric/zone": "0.2.3-dev-
|
|
40
|
+
"@agoric/swingset-vat": "0.32.3-dev-cbcea8c.0.cbcea8c",
|
|
41
|
+
"@agoric/zone": "0.2.3-dev-cbcea8c.0.cbcea8c",
|
|
42
42
|
"@endo/env-options": "^1.1.11",
|
|
43
43
|
"ava": "^7.0.0",
|
|
44
44
|
"tsd": "^0.33.0"
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"typeCoverage": {
|
|
62
62
|
"atLeast": 77.35
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "cbcea8c2415f2c9c4bc1ea9ff90730f2773bafaa"
|
|
65
65
|
}
|
package/src/async-flow.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ export function prepareAsyncFlowTools(outerZone: Zone, outerOptions?: Preparatio
|
|
|
15
15
|
*/
|
|
16
16
|
restart(eager?: boolean): void;
|
|
17
17
|
wake(): void;
|
|
18
|
-
getOutcome():
|
|
19
|
-
dump(): ([
|
|
18
|
+
getOutcome(): Vow<any>;
|
|
19
|
+
dump(): (any[] | import("@endo/pass-style").Passable[] | (string | number)[] | (import("@endo/pass-style").Passable | Vow)[])[];
|
|
20
20
|
getOptFatalProblem(): any;
|
|
21
21
|
};
|
|
22
22
|
admin: {
|
|
@@ -28,16 +28,112 @@ export function prepareAsyncFlowTools(outerZone: Zone, outerOptions?: Preparatio
|
|
|
28
28
|
onFulfilled(_fulfillment: any): void;
|
|
29
29
|
onRejected(_fulfillment: any): void;
|
|
30
30
|
};
|
|
31
|
+
}, {
|
|
32
|
+
flow: import("@endo/patterns").InterfaceGuard<{
|
|
33
|
+
getFlowState: import("@endo/patterns").MethodGuard<"sync", [], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", ["Running", "Sleeping", "Replaying", "Failed", "Done"]>, import("@endo/patterns").SyncValueGuard>;
|
|
34
|
+
restart: import("@endo/patterns").MethodGuard<"sync", [], [import("@endo/patterns").MatcherOf<"kind", "boolean">], any, import("@endo/patterns").SyncValueGuard>;
|
|
35
|
+
wake: import("@endo/patterns").MethodGuard<"sync", [], import("@endo/patterns").ArgGuard[], any, import("@endo/patterns").SyncValueGuard>;
|
|
36
|
+
getOutcome: import("@endo/patterns").MethodGuard<"sync", [], import("@endo/patterns").ArgGuard[], (string & {
|
|
37
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
38
|
+
}) | (number & {
|
|
39
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
40
|
+
}) | (bigint & {
|
|
41
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
42
|
+
}) | (false & {
|
|
43
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
44
|
+
}) | (true & {
|
|
45
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
46
|
+
}) | (symbol & {
|
|
47
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
48
|
+
}) | (void & {
|
|
49
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
50
|
+
}) | (ArrayBuffer & {
|
|
51
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
52
|
+
}) | (import("@endo/eventual-send").RemotableBrand<any, any> & {
|
|
53
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
54
|
+
}) | (import("@endo/pass-style").RemotableObject<string> & {
|
|
55
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
56
|
+
}) | (import("@endo/pass-style").CopyArrayInterface<import("@endo/pass-style").PassableCap, Error> & {
|
|
57
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
58
|
+
}) | (import("@endo/pass-style").CopyRecordInterface<import("@endo/pass-style").PassableCap, Error> & {
|
|
59
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
60
|
+
}) | (import("@endo/pass-style").CopyTaggedInterface<import("@endo/pass-style").PassableCap, Error> & {
|
|
61
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
62
|
+
}), import("@endo/patterns").SyncValueGuard>;
|
|
63
|
+
dump: import("@endo/patterns").MethodGuard<"sync", [], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"arrayOf", import("@endo/patterns").MatcherOf<"or", [(string | import("@endo/patterns").MatcherOf<"number", number>)[], (string | import("@endo/patterns").MatcherOf<"any", any> | (number & {
|
|
64
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
65
|
+
}) | (bigint & {
|
|
66
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
67
|
+
}) | (false & {
|
|
68
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
69
|
+
}) | (true & {
|
|
70
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
71
|
+
}) | (symbol & {
|
|
72
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
73
|
+
}) | (void & {
|
|
74
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
75
|
+
}) | (ArrayBuffer & {
|
|
76
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
77
|
+
}) | (import("@endo/eventual-send").RemotableBrand<any, any> & {
|
|
78
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
79
|
+
}) | (import("@endo/pass-style").RemotableObject<string> & {
|
|
80
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
81
|
+
}) | (import("@endo/pass-style").CopyArrayInterface<import("@endo/pass-style").PassableCap, Error> & {
|
|
82
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
83
|
+
}) | (import("@endo/pass-style").CopyRecordInterface<import("@endo/pass-style").PassableCap, Error> & {
|
|
84
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
85
|
+
}) | (import("@endo/pass-style").CopyTaggedInterface<import("@endo/pass-style").PassableCap, Error> & {
|
|
86
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
87
|
+
}))[], (string | import("@endo/patterns").MatcherOf<"any", any> | (number & {
|
|
88
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
89
|
+
}) | (bigint & {
|
|
90
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
91
|
+
}) | (false & {
|
|
92
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
93
|
+
}) | (true & {
|
|
94
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
95
|
+
}) | (symbol & {
|
|
96
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
97
|
+
}) | (void & {
|
|
98
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
99
|
+
}) | (ArrayBuffer & {
|
|
100
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
101
|
+
}) | (import("@endo/eventual-send").RemotableBrand<any, any> & {
|
|
102
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
103
|
+
}) | (import("@endo/pass-style").RemotableObject<string> & {
|
|
104
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
105
|
+
}) | (import("@endo/pass-style").CopyArrayInterface<import("@endo/pass-style").PassableCap, Error> & {
|
|
106
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
107
|
+
}) | (import("@endo/pass-style").CopyRecordInterface<import("@endo/pass-style").PassableCap, Error> & {
|
|
108
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
109
|
+
}) | (import("@endo/pass-style").CopyTaggedInterface<import("@endo/pass-style").PassableCap, Error> & {
|
|
110
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
111
|
+
}))[], (string | import("@endo/patterns").MatcherOf<"any", any> | import("@endo/patterns").MatcherOf<"number", number>)[], (string | import("@endo/patterns").MatcherOf<"any", any> | import("@endo/patterns").MatcherOf<"number", number>)[], (string | import("@endo/patterns").MatcherOf<"number", number> | import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>> | import("@endo/patterns").MatcherOf<"arrayOf", import("@endo/patterns").MatcherOf<"any", any>> | import("@endo/patterns").MatcherOf<"or", [import("@endo/patterns").MatcherOf<"or", [import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"symbol", symbol>]>, import("@endo/patterns").MatcherOf<"kind", "undefined">]>)[], (string | import("@endo/patterns").MatcherOf<"number", number> | import("@endo/patterns").MatcherOf<"arrayOf", import("@endo/patterns").MatcherOf<"any", any>> | import("@endo/patterns").MatcherOf<"or", [import("@endo/patterns").MatcherOf<"or", [import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"symbol", symbol>]>, import("@endo/patterns").MatcherOf<"kind", "undefined">]> | import("@endo/patterns").MatcherOf<"or", [import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>>, import("@endo/patterns").CastedPattern<Vow>]>)[], (string | import("@endo/patterns").MatcherOf<"number", number> | import("@endo/patterns").MatcherOf<"arrayOf", import("@endo/patterns").MatcherOf<"any", any>> | import("@endo/patterns").MatcherOf<"or", [import("@endo/patterns").MatcherOf<"or", [import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"symbol", symbol>]>, import("@endo/patterns").MatcherOf<"kind", "undefined">]> | import("@endo/patterns").MatcherOf<"or", [import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>>, import("@endo/patterns").CastedPattern<Vow>]>)[]]>>, import("@endo/patterns").SyncValueGuard>;
|
|
112
|
+
getOptFatalProblem: import("@endo/patterns").MethodGuard<"sync", [], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", [import("@endo/patterns").MatcherOf<"kind", "error">, import("@endo/patterns").MatcherOf<"kind", "undefined">]>, import("@endo/patterns").SyncValueGuard>;
|
|
113
|
+
}>;
|
|
114
|
+
admin: import("@endo/patterns").InterfaceGuard<{
|
|
115
|
+
reset: import("@endo/patterns").MethodGuard<"sync", [], import("@endo/patterns").ArgGuard[], any, import("@endo/patterns").SyncValueGuard>;
|
|
116
|
+
complete: import("@endo/patterns").MethodGuard<"sync", [], import("@endo/patterns").ArgGuard[], any, import("@endo/patterns").SyncValueGuard>;
|
|
117
|
+
panic: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").MatcherOf<"kind", "error">], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"not", any>, import("@endo/patterns").SyncValueGuard>;
|
|
118
|
+
}>;
|
|
119
|
+
wakeWatcher: import("@endo/patterns").InterfaceGuard<{
|
|
120
|
+
onFulfilled: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").RawGuard], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"kind", "undefined">, import("@endo/patterns").RawGuard>;
|
|
121
|
+
onRejected: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").RawGuard], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"kind", "undefined">, import("@endo/patterns").RawGuard>;
|
|
122
|
+
}>;
|
|
31
123
|
}>;
|
|
32
124
|
asyncFlow: <F extends GuestAsyncFunc>(zone: Zone, tag: string, guestFunc: F, options?: {
|
|
33
125
|
startEager?: boolean;
|
|
34
126
|
}) => HostOf<F>;
|
|
35
127
|
adminAsyncFlow: import("@endo/exo").Guarded<{
|
|
36
|
-
getFailures()
|
|
37
|
-
wakeAll()
|
|
38
|
-
getFlowForOutcomeVow(
|
|
39
|
-
}
|
|
40
|
-
|
|
128
|
+
getFailures: () => import("@endo/patterns").CopyMap<any, Error & import("@endo/pass-style").Passable>;
|
|
129
|
+
wakeAll: () => any;
|
|
130
|
+
getFlowForOutcomeVow: (args_0: Vow) => any;
|
|
131
|
+
}, import("@endo/patterns").InterfaceGuard<{
|
|
132
|
+
getFailures: import("@endo/patterns").MethodGuard<"sync", [], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"mapOf", [import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"kind", "error">]>, import("@endo/patterns").SyncValueGuard>;
|
|
133
|
+
wakeAll: import("@endo/patterns").MethodGuard<"sync", [], import("@endo/patterns").ArgGuard[], any, import("@endo/patterns").SyncValueGuard>;
|
|
134
|
+
getFlowForOutcomeVow: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").CastedPattern<Vow>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", [import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"kind", "undefined">]>, import("@endo/patterns").SyncValueGuard>;
|
|
135
|
+
}>>;
|
|
136
|
+
allWokenP: Promise<any>;
|
|
41
137
|
prepareEndowment: (zone: Zone, tag: string, e: unknown) => any;
|
|
42
138
|
};
|
|
43
139
|
export type AsyncFlowTools = ReturnType<typeof prepareAsyncFlowTools>;
|
|
@@ -49,5 +145,6 @@ import type { Zone } from '@agoric/base-zone';
|
|
|
49
145
|
import type { PreparationOptions } from '../src/types.js';
|
|
50
146
|
import type { GuestAsyncFunc } from '../src/types.js';
|
|
51
147
|
import type { FlowState } from '../src/types.js';
|
|
148
|
+
import type { Vow } from '@agoric/vow';
|
|
52
149
|
import type { HostOf } from '../src/types.js';
|
|
53
150
|
//# sourceMappingURL=async-flow.d.ts.map
|
package/src/async-flow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-flow.d.ts","sourceRoot":"","sources":["async-flow.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"async-flow.d.ts","sourceRoot":"","sources":["async-flow.js"],"names":[],"mappings":"AAiDO,iDAHI,IAAI,iBACJ,kBAAkB;gCA+ChB,IAAI,OACJ,MAAM,kBACN,cAAc,YACd;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE;;YA4B3B;;eAEG;4BADU,SAAS;YAkCtB;;;;;eAKG;4BADQ,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAiUI,CAAC,SAAlB,cAAgB,QAClB,IAAI,OACJ,MAAM,aACN,CAAC,YACD;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,KACtB,OAAO,CAAC,CAAC;;;;;;;;;;;;EAyDvB;6BAIY,UAAU,CAAC,OAAO,qBAAqB,CAAC;6BAIxC,cAAc,CAAC,gBAAgB,CAAC;+BAIhC,UAAU,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC;2BAIjD,UAAU,CAAC,gBAAgB,CAAC;wBAI5B,YAAY,CAAC,MAAM,CAAC;0BAziBV,mBAAmB;wCAEoD,iBAAiB;oCAAjB,iBAAiB;+BAAjB,iBAAiB;yBADzF,aAAa;4BAC2D,iBAAiB"}
|
package/src/async-flow.js
CHANGED
|
@@ -13,6 +13,7 @@ import { LogEntryShape, FlowStateShape } from './type-guards.js';
|
|
|
13
13
|
/**
|
|
14
14
|
* @import {WeakMapStore, MapStore} from '@agoric/store'
|
|
15
15
|
* @import {Zone} from '@agoric/base-zone'
|
|
16
|
+
* @import {Vow} from '@agoric/vow'
|
|
16
17
|
* @import {FlowState, GuestAsyncFunc, HostAsyncFuncWrapper, HostOf, PreparationOptions} from '../src/types.js'
|
|
17
18
|
* @import {ReplayMembrane} from '../src/replay-membrane.js'
|
|
18
19
|
*/
|
|
@@ -191,7 +192,9 @@ export const prepareAsyncFlowTools = (outerZone, outerOptions = {}) => {
|
|
|
191
192
|
Fail`wakeWatcher must be storable in this zone (usually, must be durable): ${wakeWatcher}`;
|
|
192
193
|
watch(vowish, wakeWatcher);
|
|
193
194
|
};
|
|
194
|
-
const panic =
|
|
195
|
+
const panic = /** @type {(problem: Error) => never} */ (
|
|
196
|
+
err => admin.panic(err)
|
|
197
|
+
);
|
|
195
198
|
const membrane = makeReplayMembrane({
|
|
196
199
|
log,
|
|
197
200
|
bijection,
|
|
@@ -407,7 +410,9 @@ export const prepareAsyncFlowTools = (outerZone, outerOptions = {}) => {
|
|
|
407
410
|
if (eagerWakers.has(flow)) {
|
|
408
411
|
eagerWakers.delete(flow);
|
|
409
412
|
}
|
|
410
|
-
flowForOutcomeVowKey.delete(
|
|
413
|
+
flowForOutcomeVowKey.delete(
|
|
414
|
+
toPassableCap(/** @type {Vow} */ (flow.getOutcome())),
|
|
415
|
+
);
|
|
411
416
|
state.isDone = true;
|
|
412
417
|
log.dispose();
|
|
413
418
|
flow.getFlowState() === 'Done' ||
|
|
@@ -469,7 +474,7 @@ export const prepareAsyncFlowTools = (outerZone, outerOptions = {}) => {
|
|
|
469
474
|
const asyncFlowKit = internalMakeAsyncFlowKit(activationArgs);
|
|
470
475
|
const { flow } = asyncFlowKit;
|
|
471
476
|
|
|
472
|
-
const vow = flow.getOutcome();
|
|
477
|
+
const vow = /** @type {Vow} */ (flow.getOutcome());
|
|
473
478
|
flowForOutcomeVowKey.init(toPassableCap(vow), flow);
|
|
474
479
|
flow.restart();
|
|
475
480
|
return asyncFlowKit;
|
|
@@ -503,25 +508,28 @@ export const prepareAsyncFlowTools = (outerZone, outerOptions = {}) => {
|
|
|
503
508
|
return harden(wrapperFunc);
|
|
504
509
|
};
|
|
505
510
|
|
|
506
|
-
const adminAsyncFlow =
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
511
|
+
const adminAsyncFlow =
|
|
512
|
+
// @ts-expect-error AdminAsyncFlow guard uses M.raw() defaults
|
|
513
|
+
outerZone.exo('AdminAsyncFlow', AdminAsyncFlowI, {
|
|
514
|
+
getFailures() {
|
|
515
|
+
return failures.snapshot();
|
|
516
|
+
},
|
|
517
|
+
wakeAll() {
|
|
518
|
+
// [...stuff.keys()] in order to snapshot before iterating
|
|
519
|
+
const failuresToRestart = [...failures.keys()];
|
|
520
|
+
const flowsToWake = [...eagerWakers.keys()];
|
|
521
|
+
for (const flow of failuresToRestart) {
|
|
522
|
+
flow.restart();
|
|
523
|
+
}
|
|
524
|
+
for (const flow of flowsToWake) {
|
|
525
|
+
flow.wake();
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
/** @param {Vow} outcomeVow */
|
|
529
|
+
getFlowForOutcomeVow(outcomeVow) {
|
|
530
|
+
return flowForOutcomeVowKey.get(toPassableCap(outcomeVow));
|
|
531
|
+
},
|
|
532
|
+
});
|
|
525
533
|
|
|
526
534
|
// Cannot call this until everything is prepared, so postpone to a later
|
|
527
535
|
// turn. (Ideally, we'd postpone to a later crank because prepares are
|
package/src/bijection.d.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
export function prepareBijection(zone: Zone, unwrap?: (hostWrapper: PassableCap | Vow, guestWrapper: PassableCap) => unknown): () => import("@endo/exo").Guarded<{
|
|
2
2
|
reset(): void;
|
|
3
|
-
unwrapInit(g: any, h:
|
|
3
|
+
unwrapInit(g: any, h: import("@endo/pass-style").Passable): unknown;
|
|
4
4
|
hasGuest(g: any): boolean;
|
|
5
|
-
hasHost(h:
|
|
6
|
-
has(g: any, h:
|
|
5
|
+
hasHost(h: import("@endo/pass-style").Passable): boolean;
|
|
6
|
+
has(g: any, h: import("@endo/pass-style").Passable): boolean;
|
|
7
7
|
guestToHost(g: any): any;
|
|
8
|
-
hostToGuest(h:
|
|
9
|
-
}
|
|
8
|
+
hostToGuest(h: import("@endo/pass-style").Passable): any;
|
|
9
|
+
}, import("@endo/patterns").InterfaceGuard<{
|
|
10
|
+
reset: import("@endo/patterns").MethodGuard<"sync", [], import("@endo/patterns").ArgGuard[], any, import("@endo/patterns").SyncValueGuard>;
|
|
11
|
+
unwrapInit: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").RawGuard, import("@endo/patterns").MatcherOf<"any", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").RawGuard, import("@endo/patterns").SyncValueGuard>;
|
|
12
|
+
hasGuest: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").RawGuard], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"kind", "boolean">, import("@endo/patterns").SyncValueGuard>;
|
|
13
|
+
hasHost: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").MatcherOf<"any", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"kind", "boolean">, import("@endo/patterns").SyncValueGuard>;
|
|
14
|
+
has: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").RawGuard, import("@endo/patterns").MatcherOf<"any", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"kind", "boolean">, import("@endo/patterns").SyncValueGuard>;
|
|
15
|
+
guestToHost: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").RawGuard], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"any", any>, import("@endo/patterns").SyncValueGuard>;
|
|
16
|
+
hostToGuest: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").MatcherOf<"any", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").RawGuard, import("@endo/patterns").SyncValueGuard>;
|
|
17
|
+
}>>;
|
|
10
18
|
export type VowishStore = ReturnType<typeof makeVowishStore>;
|
|
11
19
|
export type Bijection = ReturnType<ReturnType<typeof prepareBijection>>;
|
|
12
20
|
import type { Zone } from '@agoric/base-zone';
|
package/src/bijection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bijection.d.ts","sourceRoot":"","sources":["bijection.js"],"names":[],"mappings":"AA+GO,uCAJI,IAAI,WACJ,CAAC,WAAW,EAAE,WAAW,GAAG,GAAG,EAAE,YAAY,EAAE,WAAW,KAAK,OAAO
|
|
1
|
+
{"version":3,"file":"bijection.d.ts","sourceRoot":"","sources":["bijection.js"],"names":[],"mappings":"AA+GO,uCAJI,IAAI,WACJ,CAAC,WAAW,EAAE,WAAW,GAAG,GAAG,EAAE,YAAY,EAAE,WAAW,KAAK,OAAO;;;;;;;;;;;;;;;;IA8FhF;0BAvIa,UAAU,CAAC,OAAO,eAAe,CAAC;wBA2InC,UAAU,CAAC,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;0BAtMrC,mBAAmB;iCADZ,kBAAkB;yBAE1B,aAAa;AAqBnC;;;;;;GAMG;AACH,uCAFW,MAAM;;;;;;;;GA8BhB"}
|
package/src/bijection.js
CHANGED
|
@@ -113,9 +113,9 @@ export const prepareBijection = (
|
|
|
113
113
|
zone,
|
|
114
114
|
unwrap = (_hostWrapper, guestWrapper) => guestWrapper,
|
|
115
115
|
) => {
|
|
116
|
-
/** @type {Ephemera<
|
|
116
|
+
/** @type {Ephemera<any, VowishStore>} */
|
|
117
117
|
const g2h = makeEphemera(() => makeVowishStore('guestToHost'));
|
|
118
|
-
/** @type {Ephemera<
|
|
118
|
+
/** @type {Ephemera<any, VowishStore>} */
|
|
119
119
|
const h2g = makeEphemera(() => makeVowishStore('hostToGuest'));
|
|
120
120
|
|
|
121
121
|
// Guest arguments and results are now unguarded, i.e., guarded by `M.raw()`,
|
|
@@ -134,7 +134,7 @@ export const prepareBijection = (
|
|
|
134
134
|
const guestToHost = g2h.for(self);
|
|
135
135
|
const hostToGuest = h2g.for(self);
|
|
136
136
|
|
|
137
|
-
const gUnwrapped = unwrap(h, g);
|
|
137
|
+
const gUnwrapped = unwrap(/** @type {any} */ (h), /** @type {any} */ (g));
|
|
138
138
|
!hostToGuest.has(h) ||
|
|
139
139
|
Fail`hostToGuest key already bound: ${h} -> ${hostToGuest.get(h)} vs ${gUnwrapped}`;
|
|
140
140
|
guestToHost.init(gUnwrapped, h);
|
|
@@ -171,7 +171,8 @@ export const prepareBijection = (
|
|
|
171
171
|
const hostToGuest = h2g.for(self);
|
|
172
172
|
|
|
173
173
|
if (guestToHost.has(g)) {
|
|
174
|
-
toPassableCap(guestToHost.get(g)) ===
|
|
174
|
+
toPassableCap(/** @type {any} */ (guestToHost.get(g))) ===
|
|
175
|
+
toPassableCap(/** @type {any} */ (h)) ||
|
|
175
176
|
Fail`internal: g->h ${g} -> ${h} vs ${guestToHost.get(g)}`;
|
|
176
177
|
hostToGuest.get(h) === g ||
|
|
177
178
|
Fail`internal h->g: ${h} -> ${g} vs ${hostToGuest.get(h)}`;
|
package/src/endowments.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endowments.d.ts","sourceRoot":"","sources":["endowments.js"],"names":[],"mappings":"AAiDO;;EASN;AAMM,iDAHI,IAAI,iBACJ,kBAAkB;
|
|
1
|
+
{"version":3,"file":"endowments.d.ts","sourceRoot":"","sources":["endowments.js"],"names":[],"mappings":"AAiDO;;EASN;AAMM,iDAHI,IAAI,iBACJ,kBAAkB;6BA6GhB,IAAI,OACJ,MAAM,KACN,OAAO;;EA8FnB;4BApPY,SAAS,GAAG,UAAU,GAAG,KAAK,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO;6BAwP1E,UAAU,CAAC,OAAO,qBAAqB,CAAC;0BA9P9B,mBAAmB;wCAEL,iBAAiB"}
|
package/src/endowments.js
CHANGED
|
@@ -67,6 +67,7 @@ export const prepareEndowmentTools = (outerZone, outerOptions = {}) => {
|
|
|
67
67
|
const { makeVowKit } = vowTools;
|
|
68
68
|
|
|
69
69
|
const functionUnwrapper = outerZone.exo('FunctionUnwrapper', UnwrapperI, {
|
|
70
|
+
/** @param {any} guestWrapped */
|
|
70
71
|
unwrap(guestWrapped) {
|
|
71
72
|
return Far('UnwrappedFunction', (...args) => guestWrapped.apply(args));
|
|
72
73
|
},
|
|
@@ -77,6 +78,7 @@ export const prepareEndowmentTools = (outerZone, outerOptions = {}) => {
|
|
|
77
78
|
UnwrapperI,
|
|
78
79
|
keys => ({ keys }),
|
|
79
80
|
{
|
|
81
|
+
/** @param {any} guestWrapped */
|
|
80
82
|
unwrap(guestWrapped) {
|
|
81
83
|
const { state } = this;
|
|
82
84
|
const { keys } = state;
|
|
@@ -207,6 +209,7 @@ export const prepareEndowmentTools = (outerZone, outerOptions = {}) => {
|
|
|
207
209
|
case 'function': {
|
|
208
210
|
const f = /** @type {Callable} */ (e);
|
|
209
211
|
const wrapped = zone.exo(tag, FunctionWrapperI, {
|
|
212
|
+
/** @param {any[]} args */
|
|
210
213
|
apply(args) {
|
|
211
214
|
return f(...args);
|
|
212
215
|
},
|
|
@@ -229,14 +232,18 @@ export const prepareEndowmentTools = (outerZone, outerOptions = {}) => {
|
|
|
229
232
|
case 'state': {
|
|
230
233
|
const state = /** @type {Record<PropertyKey, unknown>} */ (e);
|
|
231
234
|
const keys = harden(ownKeys(state));
|
|
232
|
-
const wrapped =
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
235
|
+
const wrapped =
|
|
236
|
+
// @ts-expect-error StateAccessor uses M.raw() defaults
|
|
237
|
+
zone.exo(tag, StateAccessorI, {
|
|
238
|
+
/** @param {PropertyKey} key */
|
|
239
|
+
get(key) {
|
|
240
|
+
return state[key];
|
|
241
|
+
},
|
|
242
|
+
/** @param {PropertyKey} key @param {any} newValue */
|
|
243
|
+
set(key, newValue) {
|
|
244
|
+
state[key] = newValue;
|
|
245
|
+
},
|
|
246
|
+
});
|
|
240
247
|
const stateUnwrapper = makeStateUnwrapper(keys);
|
|
241
248
|
// Need to replace the instance because the keys may be different
|
|
242
249
|
unwrapMapSet(wrapped, stateUnwrapper);
|