@endo/eventual-send 1.2.2 → 1.2.4
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 +11 -9
- package/src/E.d.ts +21 -24
- package/src/E.d.ts.map +1 -1
- package/src/E.js +2 -2
- package/src/handled-promise.d.ts.map +1 -1
- package/src/handled-promise.js +2 -2
- package/src/message-breakpoints.d.ts +3 -3
- package/src/no-shim.d.ts +17 -7
- package/src/no-shim.d.ts.map +1 -1
- package/src/no-shim.js +4 -0
- package/src/postponed.d.ts +1 -1
- package/src/track-turns.d.ts.map +1 -1
- package/src/track-turns.js +8 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@endo/eventual-send",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "Extend a Promise class to implement the eventual-send API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/no-shim.js",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"test:xs": "exit 0",
|
|
11
11
|
"build": "exit 0",
|
|
12
12
|
"clean": "git clean -f '*.d.ts*'",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
13
|
+
"prepack": "tsc --build tsconfig.build.json",
|
|
14
|
+
"postpack": "git clean -f '*.d.ts*'",
|
|
15
15
|
"lint-fix": "yarn lint:eslint --fix && yarn lint:types",
|
|
16
16
|
"lint-check": "yarn lint",
|
|
17
17
|
"lint": "yarn lint:types && yarn lint:eslint",
|
|
@@ -36,13 +36,14 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://github.com/endojs/endo#readme",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@endo/env-options": "^1.1.
|
|
39
|
+
"@endo/env-options": "^1.1.5"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@endo/lockdown": "^1.0.
|
|
43
|
-
"ava": "^6.1.
|
|
42
|
+
"@endo/lockdown": "^1.0.9",
|
|
43
|
+
"ava": "^6.1.3",
|
|
44
44
|
"c8": "^7.14.0",
|
|
45
|
-
"tsd": "^0.30.7"
|
|
45
|
+
"tsd": "^0.30.7",
|
|
46
|
+
"typescript": "5.5.2"
|
|
46
47
|
},
|
|
47
48
|
"keywords": [
|
|
48
49
|
"eventual send",
|
|
@@ -65,12 +66,13 @@
|
|
|
65
66
|
},
|
|
66
67
|
"ava": {
|
|
67
68
|
"files": [
|
|
68
|
-
"test/**/test
|
|
69
|
+
"test/**/test-*.*",
|
|
70
|
+
"test/**/*.test.*"
|
|
69
71
|
],
|
|
70
72
|
"timeout": "2m"
|
|
71
73
|
},
|
|
72
74
|
"typeCoverage": {
|
|
73
75
|
"atLeast": 77.81
|
|
74
76
|
},
|
|
75
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "444c81ad3ecc1b0a449023a9c65e9be2fa17db21"
|
|
76
78
|
}
|
package/src/E.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export default makeE;
|
|
2
|
-
export type EProxy = ReturnType<(HandledPromise: {
|
|
3
|
-
new <R>(executor: import("./handled-promise.js").HandledExecutor<R>, unfulfilledHandler?: import("./handled-promise.js").Handler<Promise<unknown>> | undefined): Promise<R>;
|
|
4
|
-
prototype: Promise<unknown>;
|
|
5
|
-
} & PromiseConstructor & import("./handled-promise.js").HandledPromiseStaticMethods) => (<T>(x: T) => ECallableOrMethods<RemoteFunctions<T>>) & {
|
|
2
|
+
export type EProxy = ReturnType<(HandledPromise: import("./types").HandledPromiseConstructor) => (<T>(x: T) => ECallableOrMethods<RemoteFunctions<T>>) & {
|
|
6
3
|
/**
|
|
7
4
|
* E.get(x) returns a proxy on which you can get arbitrary properties.
|
|
8
5
|
* Each of these properties returns a promise for the property. The promise
|
|
@@ -14,7 +11,7 @@ export type EProxy = ReturnType<(HandledPromise: {
|
|
|
14
11
|
* @returns {EGetters<LocalRecord<T>>} property get proxy
|
|
15
12
|
* @readonly
|
|
16
13
|
*/
|
|
17
|
-
readonly get: <
|
|
14
|
+
readonly get: <T>(x: T) => EGetters<LocalRecord<T>>;
|
|
18
15
|
/**
|
|
19
16
|
* E.resolve(x) converts x to a handled promise. It is
|
|
20
17
|
* shorthand for HandledPromise.resolve(x)
|
|
@@ -26,8 +23,8 @@ export type EProxy = ReturnType<(HandledPromise: {
|
|
|
26
23
|
*/
|
|
27
24
|
readonly resolve: {
|
|
28
25
|
(): Promise<void>;
|
|
29
|
-
<
|
|
30
|
-
<
|
|
26
|
+
<T>(value: T): Promise<Awaited<T>>;
|
|
27
|
+
<T>(value: T | PromiseLike<T>): Promise<Awaited<T>>;
|
|
31
28
|
};
|
|
32
29
|
/**
|
|
33
30
|
* E.sendOnly returns a proxy similar to E, but for which the results
|
|
@@ -38,7 +35,7 @@ export type EProxy = ReturnType<(HandledPromise: {
|
|
|
38
35
|
* @returns {ESendOnlyCallableOrMethods<RemoteFunctions<T>>} method/function call proxy
|
|
39
36
|
* @readonly
|
|
40
37
|
*/
|
|
41
|
-
readonly sendOnly: <
|
|
38
|
+
readonly sendOnly: <T>(x: T) => ESendOnlyCallableOrMethods<RemoteFunctions<T>>;
|
|
42
39
|
/**
|
|
43
40
|
* E.when(x, res, rej) is equivalent to
|
|
44
41
|
* HandledPromise.resolve(x).then(res, rej)
|
|
@@ -51,26 +48,26 @@ export type EProxy = ReturnType<(HandledPromise: {
|
|
|
51
48
|
* @returns {Promise<U>}
|
|
52
49
|
* @readonly
|
|
53
50
|
*/
|
|
54
|
-
readonly when: <
|
|
51
|
+
readonly when: <T, U = T>(x: T | PromiseLike<T>, onfulfilled?: ((value: T) => ERef<U>) | undefined, onrejected?: ((reason: any) => ERef<U>) | undefined) => Promise<U>;
|
|
55
52
|
}>;
|
|
56
53
|
/**
|
|
57
54
|
* Creates a type that accepts both near and marshalled references that were
|
|
58
55
|
* returned from `Remotable` or `Far`, and also promises for such references.
|
|
59
56
|
*/
|
|
60
|
-
export type FarRef<Primary, Local = DataOnly<Primary>> = ERef<Local & import(
|
|
57
|
+
export type FarRef<Primary, Local = DataOnly<Primary>> = ERef<Local & import("./types").RemotableBrand<Local, Primary>>;
|
|
61
58
|
/**
|
|
62
59
|
* `DataOnly<T>` means to return a record type `T2` consisting only of
|
|
63
60
|
* properties that are *not* functions.
|
|
64
61
|
*/
|
|
65
|
-
export type DataOnly<T> = Omit<T, FilteredKeys<T, import(
|
|
62
|
+
export type DataOnly<T> = Omit<T, FilteredKeys<T, import("./types").Callable>>;
|
|
66
63
|
export type ERef<T> = PromiseLike<T> | T;
|
|
67
64
|
export type ECallable<T extends import("./types").Callable> = (ReturnType<T> extends PromiseLike<infer U> ? T : (...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>>);
|
|
68
65
|
export type EMethods<T> = { readonly [P in keyof T]: T[P] extends import("./types").Callable ? ECallable<T[P]> : never; };
|
|
69
66
|
export type EGetters<T> = { readonly [P in keyof T]: T[P] extends PromiseLike<infer U> ? T[P] : Promise<Awaited<T[P]>>; };
|
|
70
67
|
export type ESendOnlyCallable<T extends import("./types").Callable> = (...args: Parameters<T>) => Promise<void>;
|
|
71
68
|
export type ESendOnlyMethods<T> = { readonly [P in keyof T]: T[P] extends import("./types").Callable ? ESendOnlyCallable<T[P]> : never; };
|
|
72
|
-
export type ESendOnlyCallableOrMethods<T> = (T extends import(
|
|
73
|
-
export type ECallableOrMethods<T> = (T extends import(
|
|
69
|
+
export type ESendOnlyCallableOrMethods<T> = (T extends import("./types").Callable ? ESendOnlyCallable<T> & ESendOnlyMethods<Required<T>> : ESendOnlyMethods<Required<T>>);
|
|
70
|
+
export type ECallableOrMethods<T> = (T extends import("./types").Callable ? ECallable<T> & EMethods<Required<T>> : EMethods<Required<T>>);
|
|
74
71
|
/**
|
|
75
72
|
* Return a union of property names/symbols/numbers P for which the record element T[P]'s type extends U.
|
|
76
73
|
*
|
|
@@ -86,25 +83,25 @@ export type FilteredKeys<T, U> = { [P in keyof T]: T[P] extends U ? P : never; }
|
|
|
86
83
|
* `PickCallable<T>` means to return a single root callable or a record type
|
|
87
84
|
* consisting only of properties that are functions.
|
|
88
85
|
*/
|
|
89
|
-
export type PickCallable<T> = (T extends import(
|
|
86
|
+
export type PickCallable<T> = (T extends import("./types").Callable ? (...args: Parameters<T>) => ReturnType<T> : Pick<T, FilteredKeys<T, import("./types").Callable>>);
|
|
90
87
|
/**
|
|
91
88
|
* `RemoteFunctions<T>` means to return the functions and properties that are remotely callable.
|
|
92
89
|
*/
|
|
93
|
-
export type RemoteFunctions<T> = T extends import("./types").RemotableBrand<infer L, infer R> ? PickCallable<R> : Awaited<T> extends import("./types").RemotableBrand<infer
|
|
94
|
-
export type LocalRecord<T> = T extends import("./types").RemotableBrand<infer L, infer R> ? L : Awaited<T> extends import("./types").RemotableBrand<infer
|
|
90
|
+
export type RemoteFunctions<T> = (T extends import("./types").RemotableBrand<infer L, infer R> ? PickCallable<R> : Awaited<T> extends import("./types").RemotableBrand<infer L, infer R> ? PickCallable<R> : T extends PromiseLike<infer U> ? Awaited<T> : T);
|
|
91
|
+
export type LocalRecord<T> = (T extends import("./types").RemotableBrand<infer L, infer R> ? L : Awaited<T> extends import("./types").RemotableBrand<infer L, infer R> ? L : T extends PromiseLike<infer U> ? Awaited<T> : T);
|
|
95
92
|
export type EPromiseKit<R = unknown> = {
|
|
96
93
|
promise: Promise<R>;
|
|
97
|
-
settler: import(
|
|
94
|
+
settler: import("./types").Settler<R>;
|
|
98
95
|
};
|
|
99
96
|
/**
|
|
100
97
|
* Type for an object that must only be invoked with E. It supports a given
|
|
101
98
|
* interface but declares all the functions as asyncable.
|
|
102
99
|
*/
|
|
103
|
-
export type EOnly<T> = T extends import("./types").Callable ? (...args: Parameters<T>) => ERef<Awaited<EOnly<ReturnType<T>>>> : T extends Record<PropertyKey, import("./types").Callable> ? { [K in keyof T]: T[K] extends import("./types").Callable ? (...args: Parameters<T[K]>) => ERef<Awaited<EOnly<ReturnType<T[K]>>>> : T[K]; } : T;
|
|
100
|
+
export type EOnly<T> = (T extends import("./types").Callable ? (...args: Parameters<T>) => ERef<Awaited<EOnly<ReturnType<T>>>> : T extends Record<PropertyKey, import("./types").Callable> ? { [K in keyof T]: T[K] extends import("./types").Callable ? (...args: Parameters<T[K]>) => ERef<Awaited<EOnly<ReturnType<T[K]>>>> : T[K]; } : T);
|
|
104
101
|
/**
|
|
105
102
|
* @param {import('./types').HandledPromiseConstructor} HandledPromise
|
|
106
103
|
*/
|
|
107
|
-
declare function makeE(HandledPromise: import(
|
|
104
|
+
declare function makeE(HandledPromise: import("./types").HandledPromiseConstructor): (<T>(x: T) => ECallableOrMethods<RemoteFunctions<T>>) & {
|
|
108
105
|
/**
|
|
109
106
|
* E.get(x) returns a proxy on which you can get arbitrary properties.
|
|
110
107
|
* Each of these properties returns a promise for the property. The promise
|
|
@@ -116,7 +113,7 @@ declare function makeE(HandledPromise: import('./types').HandledPromiseConstruct
|
|
|
116
113
|
* @returns {EGetters<LocalRecord<T>>} property get proxy
|
|
117
114
|
* @readonly
|
|
118
115
|
*/
|
|
119
|
-
readonly get: <
|
|
116
|
+
readonly get: <T>(x: T) => EGetters<LocalRecord<T>>;
|
|
120
117
|
/**
|
|
121
118
|
* E.resolve(x) converts x to a handled promise. It is
|
|
122
119
|
* shorthand for HandledPromise.resolve(x)
|
|
@@ -128,8 +125,8 @@ declare function makeE(HandledPromise: import('./types').HandledPromiseConstruct
|
|
|
128
125
|
*/
|
|
129
126
|
readonly resolve: {
|
|
130
127
|
(): Promise<void>;
|
|
131
|
-
<
|
|
132
|
-
<
|
|
128
|
+
<T>(value: T): Promise<Awaited<T>>;
|
|
129
|
+
<T>(value: T | PromiseLike<T>): Promise<Awaited<T>>;
|
|
133
130
|
};
|
|
134
131
|
/**
|
|
135
132
|
* E.sendOnly returns a proxy similar to E, but for which the results
|
|
@@ -140,7 +137,7 @@ declare function makeE(HandledPromise: import('./types').HandledPromiseConstruct
|
|
|
140
137
|
* @returns {ESendOnlyCallableOrMethods<RemoteFunctions<T>>} method/function call proxy
|
|
141
138
|
* @readonly
|
|
142
139
|
*/
|
|
143
|
-
readonly sendOnly: <
|
|
140
|
+
readonly sendOnly: <T>(x: T) => ESendOnlyCallableOrMethods<RemoteFunctions<T>>;
|
|
144
141
|
/**
|
|
145
142
|
* E.when(x, res, rej) is equivalent to
|
|
146
143
|
* HandledPromise.resolve(x).then(res, rej)
|
|
@@ -153,6 +150,6 @@ declare function makeE(HandledPromise: import('./types').HandledPromiseConstruct
|
|
|
153
150
|
* @returns {Promise<U>}
|
|
154
151
|
* @readonly
|
|
155
152
|
*/
|
|
156
|
-
readonly when: <
|
|
153
|
+
readonly when: <T, U = T>(x: T | PromiseLike<T>, onfulfilled?: ((value: T) => ERef<U>) | undefined, onrejected?: ((reason: any) => ERef<U>) | undefined) => Promise<U>;
|
|
157
154
|
};
|
|
158
155
|
//# sourceMappingURL=E.d.ts.map
|
package/src/E.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"E.d.ts","sourceRoot":"","sources":["E.js"],"names":[],"mappings":";qBAoPc,UAAU
|
|
1
|
+
{"version":3,"file":"E.d.ts","sourceRoot":"","sources":["E.js"],"names":[],"mappings":";qBAoPc,UAAU,kBAhFb,OAAO,SAAS,EAAE,yBAAyB,OAUnC,CAAC,KACH,CAAC,KACC,kBAAkB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAIjD;;;;;;;;;;OAUG;mBAJU,CAAC,KACH,CAAC,KACC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAQrC;;;;;;;;OAQG;;;;;;IAGH;;;;;;;;OAQG;wBAJU,CAAC,KACH,CAAC,KACC,0BAA0B,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAQ3D;;;;;;;;;;;OAWG;oBAPU,CAAC,EACA,CAAC,SACJ,CAAC,GAAC,WAAW,CAAC,CAAC,CAAC,yBACR,CAAC,KAAK,IAAI,CAAC,CAAC,CA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,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAIjD;;;;;;;;;;OAUG;mBAJU,CAAC,KACH,CAAC,KACC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAQrC;;;;;;;;OAQG;;;;;;IAGH;;;;;;;;OAQG;wBAJU,CAAC,KACH,CAAC,KACC,0BAA0B,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAQ3D;;;;;;;;;;;OAWG;oBAPU,CAAC,EACA,CAAC,SACJ,CAAC,GAAC,WAAW,CAAC,CAAC,CAAC,yBACR,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,sCACZ,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,kBACtB,OAAO,CAAC,CAAC,CAAC;EAU9B"}
|
package/src/E.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { trackTurns } from './track-turns.js';
|
|
2
2
|
import { makeMessageBreakpointTester } from './message-breakpoints.js';
|
|
3
3
|
|
|
4
|
-
const { details: X, quote: q, Fail } = assert;
|
|
4
|
+
const { details: X, quote: q, Fail, error: makeError } = assert;
|
|
5
5
|
const { assign, create } = Object;
|
|
6
6
|
|
|
7
7
|
const onSend = makeMessageBreakpointTester('ENDO_SEND_BREAKPOINTS');
|
|
@@ -52,7 +52,7 @@ const makeEProxyHandler = (recipient, HandledPromise) =>
|
|
|
52
52
|
if (this !== receiver) {
|
|
53
53
|
// Reject the async function call
|
|
54
54
|
return HandledPromise.reject(
|
|
55
|
-
|
|
55
|
+
makeError(
|
|
56
56
|
X`Unexpected receiver for "${q(propertyKey)}" method of E(${q(
|
|
57
57
|
recipient,
|
|
58
58
|
)})`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handled-promise.d.ts","sourceRoot":"","sources":["handled-promise.js"],"names":[],"mappings":"AAyDO;
|
|
1
|
+
{"version":3,"file":"handled-promise.d.ts","sourceRoot":"","sources":["handled-promise.js"],"names":[],"mappings":"AAyDO;SAsIe,C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ponedHandler } from './postponed.js';
|
|
11
11
|
|
|
12
|
-
const { Fail, details: X, quote: q } = assert;
|
|
12
|
+
const { Fail, details: X, quote: q, note: annotateError } = assert;
|
|
13
13
|
|
|
14
14
|
const {
|
|
15
15
|
create,
|
|
@@ -337,7 +337,7 @@ export const makeHandledPromise = () => {
|
|
|
337
337
|
handledResolve(resolvedTarget);
|
|
338
338
|
return resolvedTarget;
|
|
339
339
|
} catch (e) {
|
|
340
|
-
|
|
340
|
+
annotateError(e, X`during resolveWithPresence`);
|
|
341
341
|
handledReject(e);
|
|
342
342
|
throw e;
|
|
343
343
|
}
|
|
@@ -6,14 +6,14 @@ export function makeMessageBreakpointTester(optionName: string): MessageBreakpoi
|
|
|
6
6
|
* prefix. For objects defined with `Far` this is the first argument,
|
|
7
7
|
* known as the `farName`. For exos, this is the tag.
|
|
8
8
|
*/
|
|
9
|
-
export type MatchStringTag = string |
|
|
9
|
+
export type MatchStringTag = string | "*";
|
|
10
10
|
/**
|
|
11
11
|
* A star `'*'` matches any method name. Otherwise, the string is
|
|
12
12
|
* matched against the method name. Currently, this is only an exact match.
|
|
13
13
|
* However, beware that we may introduce a string syntax for
|
|
14
14
|
* symbol method names.
|
|
15
15
|
*/
|
|
16
|
-
export type MatchMethodName = string |
|
|
16
|
+
export type MatchMethodName = string | "*";
|
|
17
17
|
/**
|
|
18
18
|
* A star `'*'` will always breakpoint. Otherwise, the string
|
|
19
19
|
* must be a non-negative integer. Once that is zero, always breakpoint.
|
|
@@ -21,7 +21,7 @@ export type MatchMethodName = string | '*';
|
|
|
21
21
|
* In other words, the countdown represents the number of
|
|
22
22
|
* breakpoint occurrences to skip before actually breakpointing.
|
|
23
23
|
*/
|
|
24
|
-
export type MatchCountdown = number |
|
|
24
|
+
export type MatchCountdown = number | "*";
|
|
25
25
|
/**
|
|
26
26
|
* This is the external JSON representation, in which
|
|
27
27
|
* - the outer property name is the class-like tag or '*',
|
package/src/no-shim.d.ts
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
export const E: (<T>(x: T) =>
|
|
2
|
-
readonly get: <
|
|
1
|
+
export const E: (<T>(x: T) => ECallableOrMethods<RemoteFunctions<T>>) & {
|
|
2
|
+
readonly get: <T>(x: T) => EGetters<LocalRecord<T>>;
|
|
3
3
|
readonly resolve: {
|
|
4
4
|
(): Promise<void>;
|
|
5
|
-
<
|
|
6
|
-
<
|
|
5
|
+
<T>(value: T): Promise<Awaited<T>>;
|
|
6
|
+
<T>(value: T | PromiseLike<T>): Promise<Awaited<T>>;
|
|
7
7
|
};
|
|
8
|
-
readonly sendOnly: <
|
|
9
|
-
readonly when: <
|
|
8
|
+
readonly sendOnly: <T>(x: T) => ESendOnlyCallableOrMethods<RemoteFunctions<T>>;
|
|
9
|
+
readonly when: <T, U = T>(x: T | PromiseLike<T>, onfulfilled?: ((value: T) => ERef<U>) | undefined, onrejected?: ((reason: any) => ERef<U>) | undefined) => Promise<U>;
|
|
10
10
|
};
|
|
11
11
|
export { hp as HandledPromise };
|
|
12
12
|
export * from "./exports.js";
|
|
13
|
+
import type { ECallableOrMethods } from './E.js';
|
|
14
|
+
import type { RemoteFunctions } from './E.js';
|
|
15
|
+
import type { EGetters } from './E.js';
|
|
16
|
+
import type { LocalRecord } from './E.js';
|
|
17
|
+
import type { ESendOnlyCallableOrMethods } from './E.js';
|
|
18
|
+
import type { ERef } from './E.js';
|
|
19
|
+
/** @import {Handler, HandledExecutor} from './handled-promise.js' */
|
|
20
|
+
/** @import {ECallableOrMethods, EGetters, ERef, ERemoteFunctions, ESendOnlyCallableOrMethods, LocalRecord, RemoteFunctions} from './E.js' */
|
|
13
21
|
declare const hp: {
|
|
14
|
-
new <R>(executor:
|
|
22
|
+
new <R>(executor: HandledExecutor<R>, unfulfilledHandler?: Handler<Promise<unknown>>): Promise<R>;
|
|
15
23
|
prototype: Promise<unknown>;
|
|
16
24
|
} & PromiseConstructor & import("./handled-promise.js").HandledPromiseStaticMethods;
|
|
25
|
+
import type { HandledExecutor } from './handled-promise.js';
|
|
26
|
+
import type { Handler } from './handled-promise.js';
|
|
17
27
|
//# sourceMappingURL=no-shim.d.ts.map
|
package/src/no-shim.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-shim.d.ts","sourceRoot":"","sources":["no-shim.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"no-shim.d.ts","sourceRoot":"","sources":["no-shim.js"],"names":[],"mappings":"AAOA;;;;;;;;;EAA2B;;;wCAHuG,QAAQ;qCAAR,QAAQ;8BAAR,QAAQ;iCAAR,QAAQ;gDAAR,QAAQ;0BAAR,QAAQ;AAD1I,qEAAqE;AACrE,6IAA6I;AAE7I;;;oFAA0B;qCAHkB,sBAAsB;6BAAtB,sBAAsB"}
|
package/src/no-shim.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import makeE from './E.js';
|
|
2
2
|
|
|
3
|
+
// XXX module exports for HandledPromise fail if these aren't in scope
|
|
4
|
+
/** @import {Handler, HandledExecutor} from './handled-promise.js' */
|
|
5
|
+
/** @import {ECallableOrMethods, EGetters, ERef, ERemoteFunctions, ESendOnlyCallableOrMethods, LocalRecord, RemoteFunctions} from './E.js' */
|
|
6
|
+
|
|
3
7
|
const hp = HandledPromise;
|
|
4
8
|
export const E = makeE(hp);
|
|
5
9
|
export { hp as HandledPromise };
|
package/src/postponed.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function makePostponedHandler(HandledPromise: import(
|
|
1
|
+
export function makePostponedHandler(HandledPromise: import("./types").HandledPromiseConstructor): [Required<import("./types").Handler<any>>, () => void];
|
|
2
2
|
//# sourceMappingURL=postponed.d.ts.map
|
package/src/track-turns.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track-turns.d.ts","sourceRoot":"","sources":["track-turns.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"track-turns.d.ts","sourceRoot":"","sources":["track-turns.js"],"names":[],"mappings":"AA2FO,2BAJwB,CAAC,SAAlB,aAAa,EAAG,SACnB,CAAC,GACC,CAAC,CAmBb;;;;;4BAMY,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,GAAG,SAAS"}
|
package/src/track-turns.js
CHANGED
|
@@ -5,7 +5,10 @@ import {
|
|
|
5
5
|
} from '@endo/env-options';
|
|
6
6
|
|
|
7
7
|
// NOTE: We can't import these because they're not in scope before lockdown.
|
|
8
|
-
//
|
|
8
|
+
// We also cannot currently import them because it would create a cyclic
|
|
9
|
+
// dependency, though this is more easily fixed.
|
|
10
|
+
// import { assert, X, Fail } from '@endo/errors';
|
|
11
|
+
// See also https://github.com/Agoric/agoric-sdk/issues/9515
|
|
9
12
|
|
|
10
13
|
// WARNING: Global Mutable State!
|
|
11
14
|
// This state is communicated to `assert` that makes it available to the
|
|
@@ -33,7 +36,7 @@ const ENABLED =
|
|
|
33
36
|
|
|
34
37
|
const addRejectionNote = detailsNote => reason => {
|
|
35
38
|
if (reason instanceof Error) {
|
|
36
|
-
assert.note(reason, detailsNote);
|
|
39
|
+
globalThis.assert.note(reason, detailsNote);
|
|
37
40
|
}
|
|
38
41
|
if (VERBOSE) {
|
|
39
42
|
console.log('REJECTED at top of event loop', reason);
|
|
@@ -52,7 +55,7 @@ const wrapFunction =
|
|
|
52
55
|
result = func(...args);
|
|
53
56
|
} catch (err) {
|
|
54
57
|
if (err instanceof Error) {
|
|
55
|
-
assert.note(
|
|
58
|
+
globalThis.assert.note(
|
|
56
59
|
err,
|
|
57
60
|
X`Thrown from: ${hiddenPriorError}:${hiddenCurrentTurn}.${hiddenCurrentEvent}`,
|
|
58
61
|
);
|
|
@@ -90,14 +93,14 @@ export const trackTurns = funcs => {
|
|
|
90
93
|
if (!ENABLED || typeof globalThis === 'undefined' || !globalThis.assert) {
|
|
91
94
|
return funcs;
|
|
92
95
|
}
|
|
93
|
-
const { details: X } = assert;
|
|
96
|
+
const { details: X, note: annotateError } = globalThis.assert;
|
|
94
97
|
|
|
95
98
|
hiddenCurrentEvent += 1;
|
|
96
99
|
const sendingError = Error(
|
|
97
100
|
`Event: ${hiddenCurrentTurn}.${hiddenCurrentEvent}`,
|
|
98
101
|
);
|
|
99
102
|
if (hiddenPriorError !== undefined) {
|
|
100
|
-
|
|
103
|
+
annotateError(sendingError, X`Caused by: ${hiddenPriorError}`);
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
return /** @type {T} */ (
|