@endo/eventual-send 0.17.0 → 0.17.2
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 +5 -10
- package/src/handled-promise.js +1 -1
- package/src/index.test-d.ts +2 -2
- package/src/track-turns.d.ts.map +1 -1
- package/src/track-turns.js +15 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@endo/eventual-send",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.2",
|
|
4
4
|
"description": "Extend a Promise class to implement the eventual-send API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/no-shim.js",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/endojs/endo#readme",
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@endo/lockdown": "^0.1.
|
|
34
|
-
"@endo/ses-ava": "^0.2.
|
|
33
|
+
"@endo/lockdown": "^0.1.28",
|
|
34
|
+
"@endo/ses-ava": "^0.2.40",
|
|
35
35
|
"ava": "^5.2.0",
|
|
36
36
|
"c8": "^7.7.3",
|
|
37
37
|
"tsd": "^0.24.1"
|
|
@@ -49,14 +49,9 @@
|
|
|
49
49
|
],
|
|
50
50
|
"eslintConfig": {
|
|
51
51
|
"extends": [
|
|
52
|
-
"
|
|
52
|
+
"plugin:@endo/internal"
|
|
53
53
|
]
|
|
54
54
|
},
|
|
55
|
-
"prettier": {
|
|
56
|
-
"arrowParens": "avoid",
|
|
57
|
-
"trailingComma": "all",
|
|
58
|
-
"singleQuote": true
|
|
59
|
-
},
|
|
60
55
|
"publishConfig": {
|
|
61
56
|
"access": "public"
|
|
62
57
|
},
|
|
@@ -66,5 +61,5 @@
|
|
|
66
61
|
],
|
|
67
62
|
"timeout": "2m"
|
|
68
63
|
},
|
|
69
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "38c2c59d6ae8c53f84cd333e6c7828e2d37604e2"
|
|
70
65
|
}
|
package/src/handled-promise.js
CHANGED
package/src/index.test-d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/* eslint-disable @endo/no-polymorphic-call, import/no-extraneous-dependencies, no-restricted-globals
|
|
1
|
+
/* eslint-disable @endo/no-polymorphic-call, import/no-extraneous-dependencies, no-restricted-globals */
|
|
2
2
|
import { expectType } from 'tsd';
|
|
3
3
|
import { E } from '../test/get-hp.js';
|
|
4
4
|
import { DataOnly, ERef } from './index.js';
|
|
5
5
|
|
|
6
6
|
type FarRef<
|
|
7
7
|
Primary,
|
|
8
|
-
Local = DataOnly<Primary
|
|
8
|
+
Local = DataOnly<Primary>,
|
|
9
9
|
> = import('@endo/eventual-send').FarRef<Primary, Local>;
|
|
10
10
|
|
|
11
11
|
// Check the legacy ERef type
|
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":"AAwGO,mEAeN;;;;;uCAnCuB,GAAG,EAAE,KAAK,GAAG"}
|
package/src/track-turns.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* global globalThis */
|
|
2
2
|
// @ts-nocheck
|
|
3
3
|
|
|
4
|
+
const { freeze } = Object;
|
|
5
|
+
|
|
4
6
|
// NOTE: We can't import these because they're not in scope before lockdown.
|
|
5
7
|
// import { assert, details as X, Fail } from '@agoric/assert';
|
|
6
8
|
|
|
@@ -22,12 +24,19 @@ const env = (globalThis.process || {}).env || {};
|
|
|
22
24
|
// Turn on if you seem to be losing error logging at the top of the event loop
|
|
23
25
|
const VERBOSE = (env.DEBUG || '').split(':').includes('track-turns');
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
//
|
|
28
|
-
|
|
27
|
+
const validOptionValues = freeze([undefined, 'enabled', 'disabled']);
|
|
28
|
+
|
|
29
|
+
// Track-turns is enabled by default and can be disabled by an environment
|
|
30
|
+
// option.
|
|
31
|
+
const envOptionValue = env.TRACK_TURNS;
|
|
32
|
+
if (!validOptionValues.includes(envOptionValue)) {
|
|
33
|
+
throw new TypeError(
|
|
34
|
+
`unrecognized TRACK_TURNS ${JSON.stringify(envOptionValue)}`,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
const ENABLED = (envOptionValue || 'disabled') === 'enabled';
|
|
29
38
|
|
|
30
|
-
// We hoist
|
|
39
|
+
// We hoist the following functions out of trackTurns() to discourage the
|
|
31
40
|
// closures from holding onto 'args' or 'func' longer than necessary,
|
|
32
41
|
// which we've seen cause HandledPromise arguments to be retained for
|
|
33
42
|
// a surprisingly long time.
|
|
@@ -66,7 +75,7 @@ const wrapFunction =
|
|
|
66
75
|
// Must capture this now, not when the catch triggers.
|
|
67
76
|
const detailsNote = X`Rejection from: ${hiddenPriorError}:${hiddenCurrentTurn}.${hiddenCurrentEvent}`;
|
|
68
77
|
Promise.resolve(result).catch(addRejectionNote(detailsNote));
|
|
69
|
-
return
|
|
78
|
+
return result;
|
|
70
79
|
} finally {
|
|
71
80
|
hiddenPriorError = undefined;
|
|
72
81
|
}
|