@agoric/internal 0.3.3-dev-9986152.0 → 0.3.3-dev-aedfac6.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/package.json +3 -3
- package/src/callback.d.ts +8 -8
- package/src/callback.d.ts.map +1 -1
- package/src/callback.js +12 -12
- package/src/types.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/internal",
|
|
3
|
-
"version": "0.3.3-dev-
|
|
3
|
+
"version": "0.3.3-dev-aedfac6.0+aedfac6",
|
|
4
4
|
"description": "Externally unsupported utilities internal to agoric-sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"lint:types": "tsc"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@agoric/base-zone": "0.1.1-dev-
|
|
23
|
+
"@agoric/base-zone": "0.1.1-dev-aedfac6.0+aedfac6",
|
|
24
24
|
"@endo/common": "^1.2.4",
|
|
25
25
|
"@endo/errors": "^1.2.4",
|
|
26
26
|
"@endo/far": "^1.1.4",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"typeCoverage": {
|
|
60
60
|
"atLeast": 93.82
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "aedfac6ea5fd276a4f64a327cad18d3633901547"
|
|
63
63
|
}
|
package/src/callback.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export function callSync<I extends (...args:
|
|
2
|
-
export function callE<I extends (...args:
|
|
3
|
-
export function makeSyncFunctionCallback<I extends (...args:
|
|
4
|
-
export function makeFunctionCallback<I extends (...args:
|
|
5
|
-
export function makeSyncMethodCallback<I extends (...args:
|
|
6
|
-
export function makeMethodCallback<I extends (...args:
|
|
1
|
+
export function callSync<I extends (...args: any[]) => any>(callback: SyncCallback<I>, ...args: Parameters<I>): ReturnType<I>;
|
|
2
|
+
export function callE<I extends (...args: any[]) => any>(callback: Callback<I>, ...args: Parameters<I>): Promise<Awaited<ReturnType<I>>>;
|
|
3
|
+
export function makeSyncFunctionCallback<I extends (...args: any[]) => any, T extends (...args: [...B, ...Parameters<I>]) => ReturnType<I> = I, B extends any[] = []>(target: T, ...bound: B): SyncCallback<I>;
|
|
4
|
+
export function makeFunctionCallback<I extends (...args: any[]) => any, T extends ERef<(...args: [...B, ...Parameters<I>]) => ReturnType<I>> = ERef<I>, B extends any[] = []>(target: T, ...bound: B): Callback<I>;
|
|
5
|
+
export function makeSyncMethodCallback<I extends (...args: any[]) => any, P extends PropertyKey, T extends { [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>; } = { [x in P]: I; }, B extends any[] = []>(target: T, methodName: P, ...bound: B): SyncCallback<I>;
|
|
6
|
+
export function makeMethodCallback<I extends (...args: any[]) => any, P extends PropertyKey, T extends ERef<{ [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>; }> = ERef<{ [x in P]: I; }>, B extends any[] = []>(target: T, methodName: P, ...bound: B): Callback<I>;
|
|
7
7
|
export function isCallback(callback: any): callback is Callback<any>;
|
|
8
8
|
export function prepareAttenuator<M extends PropertyKey>(zone: import("@agoric/base-zone").Zone, methodNames: M[], { interfaceGuard, tag }?: {
|
|
9
9
|
interfaceGuard?: import("@endo/patterns").InterfaceGuard<{ [K in M]: import("@endo/patterns").MethodGuard; }> | undefined;
|
|
@@ -12,7 +12,7 @@ export function prepareAttenuator<M extends PropertyKey>(zone: import("@agoric/b
|
|
|
12
12
|
target?: any;
|
|
13
13
|
isSync?: boolean | undefined;
|
|
14
14
|
overrides?: { [K_1 in M]?: Callback<any> | null | undefined; } | undefined;
|
|
15
|
-
}) => import("@endo/exo").Guarded<{ [K_2 in M]: (this: any, ...args:
|
|
15
|
+
}) => import("@endo/exo").Guarded<{ [K_2 in M]: (this: any, ...args: any[]) => any; }>;
|
|
16
16
|
export function prepareGuardedAttenuator<G extends import("@endo/patterns").InterfaceGuard>(zone: import("@agoric/base-zone").Zone, interfaceGuard: G, opts?: {
|
|
17
17
|
tag?: string | undefined;
|
|
18
18
|
} | undefined): MakeAttenuator<any>;
|
|
@@ -23,7 +23,7 @@ export type MakeAttenuator<T extends import("@endo/exo").Methods> = (...args: Pa
|
|
|
23
23
|
target?: any;
|
|
24
24
|
isSync?: boolean | undefined;
|
|
25
25
|
overrides?: { [K_1 in M]?: Callback<any> | null | undefined; } | undefined;
|
|
26
|
-
}) => import("@endo/exo").Guarded<{ [K_2 in M]: (this: any, ...args:
|
|
26
|
+
}) => import("@endo/exo").Guarded<{ [K_2 in M]: (this: any, ...args: any[]) => any; }>)>>) => import("@endo/exo").Farable<T>;
|
|
27
27
|
import type { SyncCallback } from './types.js';
|
|
28
28
|
import type { Callback } from './types.js';
|
|
29
29
|
import type { ERef } from '@endo/far';
|
package/src/callback.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["callback.js"],"names":[],"mappings":"AAgDO,
|
|
1
|
+
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["callback.js"],"names":[],"mappings":"AAgDO,yBALgC,CAAC,SAA3B,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAI,YAC3B,aAAa,CAAC,CAAC,WACf,UAAU,CAAC,CAAC,CAAC,GACX,UAAU,CAAC,CAAC,CAAC,CAQzB;AAWM,sBALgC,CAAC,SAA3B,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAI,YAC3B,SAAS,CAAC,CAAC,WACX,UAAU,CAAC,CAAC,CAAC,GACX,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAQ3C;AAaM,yCAPgC,CAAC,SAA3B,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAI,EAC+B,CAAC,SA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C,GACC,SAAS,CAAC,CAAC,CAUvB;AAOM,qCAHI,GAAG,GACD,QAAQ,IAAI,SAAS,GAAG,CAAC,CAcrC;AAiBM,kCAXoB,CAAC,SAAd,WAAY,QACf,OAAO,mBAAmB,EAAE,IAAI,eAEhC,CAAC,EAAE,4BAEX;IAEU,cAAc,8CADrB,CAAC;IAGkB,GAAG;CAC3B;aAgEc,GAAG;;;uDArDgB,GAAG,WAAW,GAAG,EAAE,KAAK,GAAG,KAwF5D;AAYM,yCANgD,CAAC,SAA3C,OAAQ,gBAAgB,EAAE,cAAe,QAC3C,OAAO,mBAAmB,EAAE,IAAI,kBAChC,CAAC;;gBAUQ,cAAc,CAAC,GAAG,CAAC,CACtC;2BAvS0C,CAAC,SAA/B,OAAQ,WAAW,EAAE,OAAQ,IAC7B,CACZ,GAAO,IAAI,EAAE,UAAU,CAAC,UAAU,GAqKR,CAAC,SAAd,WAAY,QACf,OAAO,mBAAmB,EAAE,IAAI,eAEhC,CAAC,EAAE,4BAEX;IAEU,cAAc,8CADrB,CAAC;IAGkB,GAAG;CAC3B;aAgEc,GAAG;;;uDArDgB,GAAG,WAAW,GAAG,EAAE,KAAK,GAAG,MA1LP,CAAC,KAC/C,OAAO,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;kCAdI,YAAY;8BAAZ,YAAY;0BAD9B,WAAW"}
|
package/src/callback.js
CHANGED
|
@@ -41,7 +41,7 @@ const isPropertyKey = key => {
|
|
|
41
41
|
/**
|
|
42
42
|
* Synchronously call a callback.
|
|
43
43
|
*
|
|
44
|
-
* @template {(...args:
|
|
44
|
+
* @template {(...args: any[]) => any} I
|
|
45
45
|
* @param {SyncCallback<I>} callback
|
|
46
46
|
* @param {Parameters<I>} args
|
|
47
47
|
* @returns {ReturnType<I>}
|
|
@@ -58,7 +58,7 @@ harden(callSync);
|
|
|
58
58
|
/**
|
|
59
59
|
* Eventual send to a callback.
|
|
60
60
|
*
|
|
61
|
-
* @template {(...args:
|
|
61
|
+
* @template {(...args: any[]) => any} I
|
|
62
62
|
* @param {Callback<I>} callback
|
|
63
63
|
* @param {Parameters<I>} args
|
|
64
64
|
* @returns {Promise<Awaited<ReturnType<I>>>}
|
|
@@ -75,9 +75,9 @@ harden(callE);
|
|
|
75
75
|
/**
|
|
76
76
|
* Create a callback from a near function.
|
|
77
77
|
*
|
|
78
|
-
* @template {(...args:
|
|
78
|
+
* @template {(...args: any[]) => any} I
|
|
79
79
|
* @template {(...args: [...B, ...Parameters<I>]) => ReturnType<I>} [T=I]
|
|
80
|
-
* @template {
|
|
80
|
+
* @template {any[]} [B=[]]
|
|
81
81
|
* @param {T} target
|
|
82
82
|
* @param {B} bound
|
|
83
83
|
* @returns {SyncCallback<I>}
|
|
@@ -94,9 +94,9 @@ harden(makeSyncFunctionCallback);
|
|
|
94
94
|
/**
|
|
95
95
|
* Create a callback from a potentially far function.
|
|
96
96
|
*
|
|
97
|
-
* @template {(...args:
|
|
97
|
+
* @template {(...args: any[]) => any} I
|
|
98
98
|
* @template {ERef<(...args: [...B, ...Parameters<I>]) => ReturnType<I>>} [T=ERef<I>]
|
|
99
|
-
* @template {
|
|
99
|
+
* @template {any[]} [B=[]]
|
|
100
100
|
* @param {T} target
|
|
101
101
|
* @param {B} bound
|
|
102
102
|
* @returns {Callback<I>}
|
|
@@ -113,12 +113,12 @@ harden(makeFunctionCallback);
|
|
|
113
113
|
/**
|
|
114
114
|
* Create a callback from a near method.
|
|
115
115
|
*
|
|
116
|
-
* @template {(...args:
|
|
116
|
+
* @template {(...args: any[]) => any} I
|
|
117
117
|
* @template {PropertyKey} P
|
|
118
118
|
* @template {{
|
|
119
119
|
* [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>;
|
|
120
120
|
* }} [T={ [x in P]: I }]
|
|
121
|
-
* @template {
|
|
121
|
+
* @template {any[]} [B=[]]
|
|
122
122
|
* @param {T} target
|
|
123
123
|
* @param {P} methodName
|
|
124
124
|
* @param {B} bound
|
|
@@ -139,12 +139,12 @@ harden(makeSyncMethodCallback);
|
|
|
139
139
|
/**
|
|
140
140
|
* Create a callback from a potentially far method.
|
|
141
141
|
*
|
|
142
|
-
* @template {(...args:
|
|
142
|
+
* @template {(...args: any[]) => any} I
|
|
143
143
|
* @template {PropertyKey} P
|
|
144
144
|
* @template {ERef<{
|
|
145
145
|
* [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>;
|
|
146
146
|
* }>} [T=ERef<{ [x in P]: I }>]
|
|
147
|
-
* @template {
|
|
147
|
+
* @template {any[]} [B=[]]
|
|
148
148
|
* @param {T} target
|
|
149
149
|
* @param {P} methodName
|
|
150
150
|
* @param {B} bound
|
|
@@ -200,11 +200,11 @@ export const prepareAttenuator = (
|
|
|
200
200
|
{ interfaceGuard, tag = 'Attenuator' } = {},
|
|
201
201
|
) => {
|
|
202
202
|
/**
|
|
203
|
-
* @typedef {(this: any, ...args:
|
|
203
|
+
* @typedef {(this: any, ...args: any[]) => any} Method
|
|
204
204
|
*
|
|
205
205
|
* @typedef {{ [K in M]?: Callback<any> | null }} Overrides
|
|
206
206
|
*
|
|
207
|
-
* @typedef {{ [K in M]: (this: any, ...args:
|
|
207
|
+
* @typedef {{ [K in M]: (this: any, ...args: any[]) => any }} Methods
|
|
208
208
|
*/
|
|
209
209
|
const methods = /** @type {Methods} */ (
|
|
210
210
|
fromEntries(
|
package/src/types.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type TotalMap<K, V> = Omit<Map<K, V>, 'get'> & {
|
|
|
14
14
|
export type TotalMapFrom<M extends Map> =
|
|
15
15
|
M extends Map<infer K, infer V> ? TotalMap<K, V> : never;
|
|
16
16
|
|
|
17
|
-
export declare class Callback<I extends (...args:
|
|
17
|
+
export declare class Callback<I extends (...args: any[]) => any> {
|
|
18
18
|
private iface: I;
|
|
19
19
|
|
|
20
20
|
public target: any;
|