@agoric/internal 0.3.3-dev-cd45c09.0 → 0.3.3-dev-fb620c9.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/internal",
3
- "version": "0.3.3-dev-cd45c09.0+cd45c09",
3
+ "version": "0.3.3-dev-fb620c9.0+fb620c9",
4
4
  "description": "Externally unsupported utilities internal to agoric-sdk",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -20,10 +20,11 @@
20
20
  "lint:types": "tsc"
21
21
  },
22
22
  "dependencies": {
23
- "@agoric/base-zone": "0.1.1-dev-cd45c09.0+cd45c09",
23
+ "@agoric/base-zone": "0.1.1-dev-fb620c9.0+fb620c9",
24
24
  "@endo/common": "^1.2.10",
25
25
  "@endo/compartment-mapper": "^1.6.0",
26
26
  "@endo/errors": "^1.2.10",
27
+ "@endo/eventual-send": "^1.3.1",
27
28
  "@endo/far": "^1.1.11",
28
29
  "@endo/init": "^1.1.9",
29
30
  "@endo/marshal": "^1.6.4",
@@ -36,7 +37,7 @@
36
37
  "jessie.js": "^0.3.4"
37
38
  },
38
39
  "devDependencies": {
39
- "@agoric/cosmic-proto": "0.4.1-dev-cd45c09.0+cd45c09",
40
+ "@agoric/cosmic-proto": "0.4.1-dev-fb620c9.0+fb620c9",
40
41
  "@endo/exo": "^1.5.9",
41
42
  "@endo/init": "^1.1.9",
42
43
  "@fast-check/ava": "^2.0.1",
@@ -63,5 +64,5 @@
63
64
  "typeCoverage": {
64
65
  "atLeast": 92.98
65
66
  },
66
- "gitHead": "cd45c09e3b855745d1e641534f7d547bfa95ad74"
67
+ "gitHead": "fb620c9645318f87ca749aa437e58e5970c19cef"
67
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"method-tools.d.ts","sourceRoot":"","sources":["method-tools.js"],"names":[],"mappings":"AA0CO,+BAJoB,CAAC,SAAd,WAAY,OACf,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GACZ,CAAC,EAAE,CAsBf;AAUM,qCAJoB,CAAC,SAAd,WAAY,OACf,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GACZ,MAAM,EAAE,CAKlB;AA+BI,+BAJiC,CAAC,SAA3B,MAAM,CAAC,WAAW,EAAE,GAAG,CAAE,OAC5B,CAAC,GACC,CAAC,CAiBX"}
1
+ {"version":3,"file":"method-tools.d.ts","sourceRoot":"","sources":["method-tools.js"],"names":[],"mappings":"AAmBO,+BAJoB,CAAC,SAAd,WAAY,OACf,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GACZ,CAAC,EAAE,CAG8B;AAUvC,qCAJoB,CAAC,SAAd,WAAY,OACf,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GACZ,MAAM,EAAE,CAKlB;AA+BI,+BAJiC,CAAC,SAA3B,MAAM,CAAC,WAAW,EAAE,GAAG,CAAE,OAC5B,CAAC,GACC,CAAC,CAiBX"}
@@ -1,66 +1,24 @@
1
1
  // @ts-check
2
- import { isObject } from '@endo/marshal';
2
+ import { getMethodNames as realGetMethodNames } from '@endo/eventual-send/utils.js';
3
3
 
4
4
  /**
5
5
  * @file method-tools use dynamic property lookup, which is not
6
6
  * Jessie-compatible
7
7
  */
8
8
 
9
- const { getPrototypeOf, create, fromEntries, getOwnPropertyDescriptors } =
10
- Object;
11
- const { ownKeys, apply } = Reflect;
12
-
13
- /**
14
- * Prioritize symbols as earlier than strings.
15
- *
16
- * @param {string | symbol} a
17
- * @param {string | symbol} b
18
- * @returns {-1 | 0 | 1}
19
- */
20
- const compareStringified = (a, b) => {
21
- if (typeof a === typeof b) {
22
- const left = String(a);
23
- const right = String(b);
24
- // eslint-disable-next-line no-nested-ternary
25
- return left < right ? -1 : left > right ? 1 : 0;
26
- }
27
- if (typeof a === 'symbol') {
28
- assert(typeof b === 'string');
29
- return -1;
30
- }
31
- assert(typeof a === 'string');
32
- assert(typeof b === 'symbol');
33
- return 1;
34
- };
9
+ const { create, fromEntries } = Object;
10
+ const { apply } = Reflect;
35
11
 
36
12
  /**
37
13
  * TODO Consolidate with the `getMethodNames` in `@endo/eventual-send`
38
14
  *
15
+ * @deprecated Use `getMethodNames` from `@endo/eventual-send/utils.js` instead.
39
16
  * @template {PropertyKey} K
40
17
  * @param {Record<K, any>} val
41
18
  * @returns {K[]}
42
19
  */
43
- export const getMethodNames = val => {
44
- let layer = val;
45
- const names = new Set(); // Set to deduplicate
46
- while (layer !== null && layer !== Object.prototype) {
47
- // be tolerant of non-objects
48
- const descs = getOwnPropertyDescriptors(layer);
49
- const ownNames = /** @type {K[]} */ (ownKeys(descs));
50
- for (const name of ownNames) {
51
- // In case a method is overridden by a non-method,
52
- // test `val[name]` rather than `layer[name]`
53
- if (typeof val[name] === 'function') {
54
- names.add(name);
55
- }
56
- }
57
- if (!isObject(val)) {
58
- break;
59
- }
60
- layer = getPrototypeOf(layer);
61
- }
62
- return harden([...names].sort(compareStringified));
63
- };
20
+ export const getMethodNames = val =>
21
+ /** @type {K[]} */ (realGetMethodNames(val));
64
22
  harden(getMethodNames);
65
23
 
66
24
  /**
@@ -72,7 +30,7 @@ harden(getMethodNames);
72
30
  */
73
31
  export const getStringMethodNames = val =>
74
32
  /** @type {string[]} */ (
75
- getMethodNames(val).filter(name => typeof name === 'string')
33
+ realGetMethodNames(val).filter(name => typeof name === 'string')
76
34
  );
77
35
 
78
36
  /**
@@ -109,7 +67,7 @@ export const bindAllMethods = obj =>
109
67
  create(
110
68
  obj,
111
69
  fromEntries(
112
- getMethodNames(obj).map(name => [
70
+ realGetMethodNames(obj).map(name => [
113
71
  name,
114
72
  {
115
73
  value: (/** @type {unknown[]} */ ...args) =>