@agoric/internal 0.3.3-dev-780a461.0 → 0.3.3-dev-d3ddae6.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-780a461.0+780a461",
3
+ "version": "0.3.3-dev-d3ddae6.0+d3ddae6",
4
4
  "description": "Externally unsupported utilities internal to agoric-sdk",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -20,8 +20,8 @@
20
20
  "lint:types": "tsc"
21
21
  },
22
22
  "dependencies": {
23
- "@agoric/assert": "0.6.1-dev-780a461.0+780a461",
24
- "@agoric/base-zone": "0.1.1-dev-780a461.0+780a461",
23
+ "@agoric/assert": "0.6.1-dev-d3ddae6.0+d3ddae6",
24
+ "@agoric/base-zone": "0.1.1-dev-d3ddae6.0+d3ddae6",
25
25
  "@endo/far": "^1.0.1",
26
26
  "@endo/init": "^1.0.1",
27
27
  "@endo/marshal": "^1.0.1",
@@ -52,5 +52,5 @@
52
52
  "typeCoverage": {
53
53
  "atLeast": 92.28
54
54
  },
55
- "gitHead": "780a4613a6a5f805cedf2686cb2b3c0412f7ffff"
55
+ "gitHead": "d3ddae6fa38b289b415d9f1bbbbd83338ad4aed3"
56
56
  }
package/src/utils.d.ts CHANGED
@@ -1,9 +1,6 @@
1
1
  export const BASIS_POINTS: 10000n;
2
2
  export function fromUniqueEntries<K, V>(allEntries: Iterable<[K, V]>): {};
3
3
  export { objectMap } from "@endo/patterns";
4
- export function listDifference(leftNames: Array<string | symbol>, rightNames: Array<string | symbol>): (string | symbol)[];
5
- export function throwLabeled(innerErr: Error, label: string | number, ErrorConstructor?: ErrorConstructor | undefined): never;
6
- export function applyLabelingError<A, R>(func: (...args: A[]) => R, args: A[], label?: string | number | undefined): R;
7
4
  /**
8
5
  * @template T
9
6
  * @typedef {{[KeyType in keyof T]: T[KeyType]} & {}} Simplify
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AAcA,kCAAoC;AAa7B,0EAcN;;AASM,0CAHI,MAAM,MAAM,GAAG,MAAM,CAAC,cACtB,MAAM,MAAM,GAAG,MAAM,CAAC,uBAKhC;AASM,uCALI,KAAK,SACL,MAAM,GAAC,MAAM,oDAEX,KAAK,CAYjB;AAUM,uHAyBN;AAGD;;;;;GAKG;AAEH;;GAEG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;;;;GAOG;AACH,qGAGE;AAUK,wDAHI,cAAc,YAAY,EAAE,WAAW,CAAC,GAAG;;cACmB,MAAM;GAW9E;AAMM,2CAHI,KAAK,EAAE,uCAcjB;AAOM,4FAeN;AAED;;;;;GAKG,CAAC,mFAFoB,OAAO,KAAK,QAAQ,IAAI,CAAC,gBAY7C;AAiBG,0GAUN;AAQD,+CAAoD;AAU7C,0EAUH;AAUG,0EAaH;AAEJ,oDAAoD;AACpD,uDAAqE;AAErE,2GAA2G;AAC3G,+GAIE;AAWK,sGAFI,MAAM,mCA4FhB;;;;sBAtYyB,OAAO,qBAAqB,EAAE,IAAI,CAAC,CAAC,CAAC;;;;;;iCAsGxC,GAAG,EAAE,KAAK,GAAG;;+BAUvB,CAAC,SAAS,YAAY,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,SAAS,oBAAoB,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AAaA,kCAAoC;AAa7B,0EAcN;;AAKD;;;;;GAKG;AAEH;;GAEG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;;;;GAOG;AACH,qGAGE;AAUK,wDAHI,cAAc,YAAY,EAAE,WAAW,CAAC,GAAG;;cACmB,MAAM;GAW9E;AAMM,2CAHI,KAAK,EAAE,uCAcjB;AAOM,4FAeN;AAED;;;;;GAKG,CAAC,mFAFoB,OAAO,KAAK,QAAQ,IAAI,CAAC,gBAY7C;AAiBG,0GAUN;AAQD,+CAAoD;AAU7C,0EAUH;AAUG,0EAaH;AAEJ,oDAAoD;AACpD,uDAAqE;AAErE,2GAA2G;AAC3G,+GAIE;AAWK,sGAFI,MAAM,mCA4FhB;;;;sBAtUyB,OAAO,qBAAqB,EAAE,IAAI,CAAC,CAAC,CAAC;;;;;;iCAsCxC,GAAG,EAAE,KAAK,GAAG;;+BAUvB,CAAC,SAAS,YAAY,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,SAAS,oBAAoB,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC"}
package/src/utils.js CHANGED
@@ -1,16 +1,15 @@
1
1
  // @ts-check
2
2
  // @jessie-check
3
3
 
4
- import { E } from '@endo/far';
5
4
  import { deeplyFulfilled, isObject } from '@endo/marshal';
6
- import { isPromise, makePromiseKit } from '@endo/promise-kit';
5
+ import { makePromiseKit } from '@endo/promise-kit';
7
6
  import { makeQueue } from '@endo/stream';
8
7
  import { asyncGenerate, makeSet } from 'jessie.js';
9
8
 
10
9
  const { fromEntries, keys, values } = Object;
11
10
  const { ownKeys } = Reflect;
12
11
 
13
- const { details: X, quote: q, Fail } = assert;
12
+ const { quote: q, Fail } = assert;
14
13
 
15
14
  export const BASIS_POINTS = 10_000n;
16
15
 
@@ -44,70 +43,6 @@ harden(fromUniqueEntries);
44
43
 
45
44
  export { objectMap } from '@endo/patterns';
46
45
 
47
- /**
48
- * @param {Array<string | symbol>} leftNames
49
- * @param {Array<string | symbol>} rightNames
50
- */
51
- export const listDifference = (leftNames, rightNames) => {
52
- const rightSet = makeSet(rightNames);
53
- return leftNames.filter(name => !rightSet.has(name));
54
- };
55
- harden(listDifference);
56
-
57
- /**
58
- * @param {Error} innerErr
59
- * @param {string|number} label
60
- * @param {ErrorConstructor} [ErrorConstructor]
61
- * @returns {never}
62
- */
63
- export const throwLabeled = (innerErr, label, ErrorConstructor = undefined) => {
64
- if (typeof label === 'number') {
65
- label = `[${label}]`;
66
- }
67
- const outerErr = assert.error(
68
- `${label}: ${innerErr.message}`,
69
- ErrorConstructor,
70
- );
71
- assert.note(outerErr, X`Caused by ${innerErr}`);
72
- throw outerErr;
73
- };
74
- harden(throwLabeled);
75
-
76
- /**
77
- * @template A,R
78
- * @param {(...args: A[]) => R} func
79
- * @param {A[]} args
80
- * @param {string|number} [label]
81
- * @returns {R}
82
- */
83
- export const applyLabelingError = (func, args, label = undefined) => {
84
- if (label === undefined) {
85
- return func(...args);
86
- }
87
- let result;
88
- try {
89
- result = func(...args);
90
- } catch (err) {
91
- throwLabeled(err, label);
92
- }
93
- if (isPromise(result)) {
94
- // If result is a rejected promise, this will return a promise with a
95
- // different rejection reason. But this confuses TypeScript because it types
96
- // that case as `Promise<never>` which is cool for a promise that will never
97
- // fulfill. But TypeScript doesn't understand that this will only happen
98
- // when `result` was a rejected promise. In only this case `R` should
99
- // already allow `Promise<never>` as a subtype.
100
- /** @type {unknown} */
101
- const relabeled = E.when(result, undefined, reason =>
102
- throwLabeled(reason, label),
103
- );
104
- return /** @type {R} */ (relabeled);
105
- } else {
106
- return result;
107
- }
108
- };
109
- harden(applyLabelingError);
110
-
111
46
  /**
112
47
  * @template T
113
48
  * @typedef {{[KeyType in keyof T]: T[KeyType]} & {}} Simplify