@agoric/vats 0.15.2-dev-b5a2ed1.0 → 0.15.2-dev-3da32ff.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.
package/src/types.d.ts CHANGED
@@ -1,129 +1,109 @@
1
- export type EOnly<T> = import('@endo/far').EOnly<T>;
2
- export type Board = ReturnType<ReturnType<typeof import('./lib-board.js').prepareBoardKit>>['board'];
1
+ /* eslint-disable no-use-before-define */
2
+
3
+ export type Board = ReturnType<
4
+ ReturnType<typeof import('./lib-board.js').prepareBoardKit>
5
+ >['board'];
6
+
3
7
  /**
4
8
  * read-only access to a node in a name hierarchy
5
9
  *
6
- * NOTE: We need to return arrays, not iterables, because even if marshal could
7
- * allow passing a remote iterable, there would be an inordinate number of
8
- * round trips for the contents of even the simplest nameHub.
10
+ * NOTE: We need to return arrays, not iterables, because even if marshal could
11
+ * allow passing a remote iterable, there would be an inordinate number of round
12
+ * trips for the contents of even the simplest nameHub.
9
13
  */
10
14
  export type NameHub = {
11
- has: (key: string) => boolean;
12
- /**
13
- * Look up a path of keys
14
- * starting from the current NameHub. Wait on any reserved promises.
15
- */
16
- lookup: (...path: string[]) => Promise<any>;
17
- /**
18
- * get
19
- * all the entries available in the current NameHub
20
- */
21
- entries: (includeReserved?: boolean) => [string, unknown][];
22
- /**
23
- * get all names available in the current
24
- * NameHub
25
- */
26
- keys: () => string[];
27
- /**
28
- * get all values available in the current
29
- * NameHub
30
- */
31
- values: () => unknown[];
15
+ has: (key: string) => boolean;
16
+ /**
17
+ * Look up a path of keys starting from the current NameHub. Wait on any
18
+ * reserved promises.
19
+ */
20
+ lookup: (...path: string[]) => Promise<any>;
21
+ /** get all the entries available in the current NameHub */
22
+ entries: (includeReserved?: boolean) => [string, unknown][];
23
+ /** get all names available in the current NameHub */
24
+ keys: () => string[];
25
+ /** get all values available in the current NameHub */
26
+ values: () => unknown[];
32
27
  };
33
- /**
34
- * write access to a node in a name hierarchy
35
- */
28
+
29
+ /** write access to a node in a name hierarchy */
36
30
  export type NameAdmin = {
37
- provideChild: (key: string, reserved?: string[]) => Promise<NameHubKit>;
38
- /**
39
- * Mark a key as reserved;
40
- * will return a promise that is fulfilled when the key is updated (or
41
- * rejected when deleted). If the key was already set it does nothing.
42
- */
43
- reserve: (key: string) => Promise<void>;
44
- /**
45
- * Update if not already updated. Return existing value, or newValue if not
46
- * existing.
47
- */
48
- default: <T>(key: string, newValue: T, newAdmin?: NameAdmin) => T;
49
- /**
50
- * Update only if already initialized. Reject if not.
51
- */
52
- set: (key: string, newValue: unknown, newAdmin?: NameAdmin) => void;
53
- /**
54
- * Fulfill an outstanding reserved promise (if any) to the newValue and set the
55
- * key to the newValue. If newAdmin is provided, set that to return via
56
- * lookupAdmin.
57
- */
58
- update: (key: string, newValue: unknown, newAdmin?: NameAdmin) => void;
59
- /**
60
- * Look up the
61
- * `newAdmin` from the path of keys starting from the current NameAdmin. Wait
62
- * on any reserved promises.
63
- */
64
- lookupAdmin: (...path: string[]) => Promise<NameAdmin>;
65
- /**
66
- * Delete a value and reject an
67
- * outstanding reserved promise (if any).
68
- */
69
- delete: (key: string) => void;
70
- /**
71
- * get the NameHub corresponding to the
72
- * current NameAdmin
73
- */
74
- readonly: () => NameHub;
75
- onUpdate: (fn: undefined | NameHubUpdateHandler) => void;
31
+ provideChild: (key: string, reserved?: string[]) => Promise<NameHubKit>;
32
+ /**
33
+ * Mark a key as reserved; will return a promise that is fulfilled when the
34
+ * key is updated (or rejected when deleted). If the key was already set it
35
+ * does nothing.
36
+ */
37
+ reserve: (key: string) => Promise<void>;
38
+ /**
39
+ * Update if not already updated. Return existing value, or newValue if not
40
+ * existing.
41
+ */
42
+ default: <T>(key: string, newValue: T, newAdmin?: NameAdmin) => T;
43
+ /** Update only if already initialized. Reject if not. */
44
+ set: (key: string, newValue: unknown, newAdmin?: NameAdmin) => void;
45
+ /**
46
+ * Fulfill an outstanding reserved promise (if any) to the newValue and set
47
+ * the key to the newValue. If newAdmin is provided, set that to return via
48
+ * lookupAdmin.
49
+ */
50
+ update: (key: string, newValue: unknown, newAdmin?: NameAdmin) => void;
51
+ /**
52
+ * Look up the `newAdmin` from the path of keys starting from the current
53
+ * NameAdmin. Wait on any reserved promises.
54
+ */
55
+ lookupAdmin: (...path: string[]) => Promise<NameAdmin>;
56
+ /** Delete a value and reject an outstanding reserved promise (if any). */
57
+ delete: (key: string) => void;
58
+ /** get the NameHub corresponding to the current NameAdmin */
59
+ readonly: () => NameHub;
60
+ onUpdate: (fn: undefined | NameHubUpdateHandler) => void;
76
61
  };
62
+
77
63
  export type NameHubUpdateHandler = {
78
- write: (entries: [string, unknown][]) => void;
64
+ write: (entries: [string, unknown][]) => void;
79
65
  };
80
- /**
81
- * a node in a name hierarchy
82
- */
66
+
67
+ /** a node in a name hierarchy */
83
68
  export type NameHubKit = {
84
- /**
85
- * read access
86
- */
87
- nameHub: NameHub;
88
- /**
89
- * write access
90
- */
91
- nameAdmin: NameAdmin;
69
+ /** read access */
70
+ nameHub: NameHub;
71
+ /** write access */
72
+ nameAdmin: NameAdmin;
92
73
  };
74
+
93
75
  export type MyAddressNameAdmin = NameAdmin & {
94
- getMyAddress(): string;
76
+ getMyAddress(): string;
95
77
  };
96
78
  export type NamesByAddressAdmin = NameAdmin & {
97
- provideChild(addr: string, reserved?: string[]): Promise<{
98
- nameHub: NameHub;
99
- nameAdmin: MyAddressNameAdmin;
100
- }>;
101
- lookupAdmin(addr: string): Promise<MyAddressNameAdmin>;
79
+ provideChild(
80
+ addr: string,
81
+ reserved?: string[],
82
+ ): Promise<{
83
+ nameHub: NameHub;
84
+ nameAdmin: MyAddressNameAdmin;
85
+ }>;
86
+ lookupAdmin(addr: string): Promise<MyAddressNameAdmin>;
102
87
  };
103
- /**
104
- * An object that can receive messages from the
105
- * bridge device
106
- */
88
+
89
+ /** An object that can receive messages from the bridge device */
107
90
  export type BridgeHandler = {
108
- /**
109
- * Handle an inbound message
110
- */
111
- fromBridge: (obj: any) => Promise<void>;
91
+ /** Handle an inbound message */
92
+ fromBridge: (obj: any) => Promise<void>;
112
93
  };
113
- /**
114
- * An object which handles messages for a
115
- * specific bridge
116
- */
94
+
95
+ /** An object which handles messages for a specific bridge */
117
96
  export type ScopedBridgeManager = {
118
- toBridge: (obj: any) => Promise<any>;
119
- fromBridge: (obj: any) => Promise<void>;
120
- initHandler: (handler: ERef<BridgeHandler>) => void;
121
- setHandler: (handler: ERef<BridgeHandler>) => void;
97
+ toBridge: (obj: any) => Promise<any>;
98
+ fromBridge: (obj: any) => Promise<void>;
99
+ initHandler: (handler: ERef<BridgeHandler>) => void;
100
+ setHandler: (handler: ERef<BridgeHandler>) => void;
122
101
  };
123
- /**
124
- * The object to manage this bridge
125
- */
102
+
103
+ /** The object to manage this bridge */
126
104
  export type BridgeManager = {
127
- register: (bridgeId: string, handler?: ERef<BridgeHandler | undefined>) => ScopedBridgeManager;
105
+ register: (
106
+ bridgeId: string,
107
+ handler?: ERef<BridgeHandler | undefined>,
108
+ ) => ScopedBridgeManager;
128
109
  };
129
- //# sourceMappingURL=types.d.ts.map
package/src/types.js CHANGED
@@ -1,101 +1,2 @@
1
- // @ts-check
2
-
1
+ // Empty JS file to correspond with types.d.ts
3
2
  export {};
4
-
5
- /**
6
- * @template T
7
- * @typedef {import('@endo/far').EOnly<T>} EOnly
8
- */
9
-
10
- /**
11
- * @typedef {ReturnType<
12
- * ReturnType<typeof import('./lib-board.js').prepareBoardKit>
13
- * >['board']} Board
14
- */
15
-
16
- /**
17
- * @typedef {object} NameHub read-only access to a node in a name hierarchy
18
- *
19
- * NOTE: We need to return arrays, not iterables, because even if marshal could
20
- * allow passing a remote iterable, there would be an inordinate number of
21
- * round trips for the contents of even the simplest nameHub.
22
- * @property {(key: string) => boolean} has
23
- * @property {(...path: string[]) => Promise<any>} lookup Look up a path of keys
24
- * starting from the current NameHub. Wait on any reserved promises.
25
- * @property {(includeReserved?: boolean) => [string, unknown][]} entries get
26
- * all the entries available in the current NameHub
27
- * @property {() => string[]} keys get all names available in the current
28
- * NameHub
29
- * @property {() => unknown[]} values get all values available in the current
30
- * NameHub
31
- */
32
-
33
- /**
34
- * @typedef {object} NameAdmin write access to a node in a name hierarchy
35
- * @property {(key: string, reserved?: string[]) => Promise<NameHubKit>} provideChild
36
- * @property {(key: string) => Promise<void>} reserve Mark a key as reserved;
37
- * will return a promise that is fulfilled when the key is updated (or
38
- * rejected when deleted). If the key was already set it does nothing.
39
- * @property {<T>(key: string, newValue: T, newAdmin?: NameAdmin) => T} default
40
- * Update if not already updated. Return existing value, or newValue if not
41
- * existing.
42
- * @property {(key: string, newValue: unknown, newAdmin?: NameAdmin) => void} set
43
- * Update only if already initialized. Reject if not.
44
- * @property {(key: string, newValue: unknown, newAdmin?: NameAdmin) => void} update
45
- * Fulfill an outstanding reserved promise (if any) to the newValue and set the
46
- * key to the newValue. If newAdmin is provided, set that to return via
47
- * lookupAdmin.
48
- * @property {(...path: string[]) => Promise<NameAdmin>} lookupAdmin Look up the
49
- * `newAdmin` from the path of keys starting from the current NameAdmin. Wait
50
- * on any reserved promises.
51
- * @property {(key: string) => void} delete Delete a value and reject an
52
- * outstanding reserved promise (if any).
53
- * @property {() => NameHub} readonly get the NameHub corresponding to the
54
- * current NameAdmin
55
- * @property {(fn: undefined | NameHubUpdateHandler) => void} onUpdate
56
- *
57
- * @typedef {{ write: (entries: [string, unknown][]) => void }} NameHubUpdateHandler
58
- */
59
-
60
- /**
61
- * @typedef {object} NameHubKit a node in a name hierarchy
62
- * @property {NameHub} nameHub read access
63
- * @property {NameAdmin} nameAdmin write access
64
- */
65
-
66
- /** @typedef {NameAdmin & { getMyAddress(): string }} MyAddressNameAdmin */
67
- /**
68
- * @typedef {NameAdmin & {
69
- * provideChild(
70
- * addr: string,
71
- * reserved?: string[],
72
- * ): Promise<{
73
- * nameHub: NameHub;
74
- * nameAdmin: MyAddressNameAdmin;
75
- * }>;
76
- * lookupAdmin(addr: string): Promise<MyAddressNameAdmin>;
77
- * }} NamesByAddressAdmin
78
- */
79
-
80
- /**
81
- * @typedef {object} BridgeHandler An object that can receive messages from the
82
- * bridge device
83
- * @property {(obj: any) => Promise<void>} fromBridge Handle an inbound message
84
- */
85
-
86
- /**
87
- * @typedef {object} ScopedBridgeManager An object which handles messages for a
88
- * specific bridge
89
- * @property {(obj: any) => Promise<any>} toBridge
90
- * @property {(obj: any) => Promise<void>} fromBridge
91
- * @property {(handler: ERef<BridgeHandler>) => void} initHandler
92
- * @property {(handler: ERef<BridgeHandler>) => void} setHandler
93
- */
94
-
95
- /**
96
- * @typedef {object} BridgeManager The object to manage this bridge
97
- * @property {(
98
- * bridgeId: string,
99
- * handler?: ERef<BridgeHandler | undefined>,
100
- * ) => ScopedBridgeManager} register
101
- */
@@ -39,7 +39,7 @@ const prepareSpecializedNameAdmin = zone => {
39
39
  * @param {string} address
40
40
  * @param {string[]} [reserved]
41
41
  * @returns {Promise<{
42
- * nameHub: NameHub;
42
+ * nameHub: import('./types.js').NameHub;
43
43
  * nameAdmin: import('./types.js').MyAddressNameAdmin;
44
44
  * }>}
45
45
  */
@@ -1 +1 @@
1
- {"version":3,"file":"boot-test-utils.d.ts","sourceRoot":"","sources":["boot-test-utils.js"],"names":[],"mappings":";;;;;;;;;;;AAkCO,6BAAqB;AAE5B,qBAAqB;AAErB,yBAFW,MAAM,CAEgB;AAE1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCH;AAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiEN;AAEM,iDAON;mDAlJkD,2BAA2B;4CAClC,oBAAoB;6CACnB,qBAAqB;2CACvB,mBAAmB;6CACjB,qBAAqB;+CACnB,uBAAuB;sDAChB,8BAA8B;oDAChC,4BAA4B;2CACrC,mBAAmB"}
1
+ {"version":3,"file":"boot-test-utils.d.ts","sourceRoot":"","sources":["boot-test-utils.js"],"names":[],"mappings":";;;;;;;;;;;AAkCO,6BAAqB;AAE5B,qBAAqB;AACrB,yBADW,MAAM,CACgB;AAE1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCH;AAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiEN;AAEM,iDAON;mDAjJkD,2BAA2B;4CAClC,oBAAoB;6CACnB,qBAAqB;2CACvB,mBAAmB;6CACjB,qBAAqB;+CACnB,uBAAuB;sDAChB,8BAA8B;oDAChC,4BAA4B;2CACrC,mBAAmB"}
@@ -35,7 +35,6 @@ export const vatRoots = {
35
35
  export const noop = () => {};
36
36
 
37
37
  /** @type {DProxy} */
38
- // @ts-expect-error cast
39
38
  export const mockDProxy = d => d;
40
39
 
41
40
  export const makeMock = log =>
package/tsconfig.json CHANGED
@@ -9,6 +9,7 @@
9
9
  "*.js",
10
10
  "scripts/**/*.js",
11
11
  "src/**/*.js",
12
+ "src/**/*.d.ts",
12
13
  "test/**/*.js",
13
14
  "tools/**/*.js",
14
15
  ],