@agoric/internal 0.3.3-dev-c132a31.0 → 0.3.3-dev-72d3ed2.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-c132a31.0+c132a31",
3
+ "version": "0.3.3-dev-72d3ed2.0+72d3ed2",
4
4
  "description": "Externally unsupported utilities internal to agoric-sdk",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -20,8 +20,9 @@
20
20
  "lint:types": "tsc"
21
21
  },
22
22
  "dependencies": {
23
- "@agoric/assert": "0.6.1-dev-c132a31.0+c132a31",
24
- "@agoric/base-zone": "0.1.1-dev-c132a31.0+c132a31",
23
+ "@agoric/assert": "0.6.1-dev-72d3ed2.0+72d3ed2",
24
+ "@agoric/base-zone": "0.1.1-dev-72d3ed2.0+72d3ed2",
25
+ "@endo/common": "^1.0.2",
25
26
  "@endo/far": "^1.0.2",
26
27
  "@endo/init": "^1.0.2",
27
28
  "@endo/marshal": "^1.1.0",
@@ -52,5 +53,5 @@
52
53
  "typeCoverage": {
53
54
  "atLeast": 92.28
54
55
  },
55
- "gitHead": "c132a3157a735d1e4d5c0c06dae3ed95e260dd79"
56
+ "gitHead": "72d3ed240566a07914f1c511eeb2ad2f5d76e260"
56
57
  }
@@ -1,6 +1,5 @@
1
1
  export const AG_COSMOS_INIT: "AG_COSMOS_INIT";
2
2
  export const SWING_STORE_EXPORT: "SWING_STORE_EXPORT";
3
- export const ENACTED_UPGRADE: "ENACTED_UPGRADE";
4
3
  export const BEGIN_BLOCK: "BEGIN_BLOCK";
5
4
  export const CALCULATE_FEES_IN_BEANS: "CALCULATE_FEES_IN_BEANS";
6
5
  export const CORE_EVAL: "CORE_EVAL";
@@ -1 +1 @@
1
- {"version":3,"file":"action-types.d.ts","sourceRoot":"","sources":["action-types.js"],"names":[],"mappings":"AAEA,8CAA+C;AAC/C,sDAAuD;AACvD,gDAAiD;AACjD,wCAAyC;AACzC,gEAAiE;AACjE,oCAAqC;AACrC,gDAAiD;AACjD,oCAAqC;AACrC,0CAA2C;AAC3C,sDAAuD;AACvD,oCAAqC;AACrC,kDAAmD;AACnD,0DAA2D;AAC3D,4CAA6C;AAC7C,wDAAyD;AACzD,8CAA+C"}
1
+ {"version":3,"file":"action-types.d.ts","sourceRoot":"","sources":["action-types.js"],"names":[],"mappings":"AAEA,8CAA+C;AAC/C,sDAAuD;AACvD,wCAAyC;AACzC,gEAAiE;AACjE,oCAAqC;AACrC,gDAAiD;AACjD,oCAAqC;AACrC,0CAA2C;AAC3C,sDAAuD;AACvD,oCAAqC;AACrC,kDAAmD;AACnD,0DAA2D;AAC3D,4CAA6C;AAC7C,wDAAyD;AACzD,8CAA+C"}
@@ -2,7 +2,6 @@
2
2
 
3
3
  export const AG_COSMOS_INIT = 'AG_COSMOS_INIT';
4
4
  export const SWING_STORE_EXPORT = 'SWING_STORE_EXPORT';
5
- export const ENACTED_UPGRADE = 'ENACTED_UPGRADE';
6
5
  export const BEGIN_BLOCK = 'BEGIN_BLOCK';
7
6
  export const CALCULATE_FEES_IN_BEANS = 'CALCULATE_FEES_IN_BEANS';
8
7
  export const CORE_EVAL = 'CORE_EVAL';
package/src/index.d.ts CHANGED
@@ -3,4 +3,6 @@ export * from "./debug.js";
3
3
  export * from "./utils.js";
4
4
  export * from "./method-tools.js";
5
5
  export * from "./typeGuards.js";
6
+ export { objectMap } from "@endo/common/object-map.js";
7
+ export { fromUniqueEntries } from "@endo/common/from-unique-entries.js";
6
8
  //# sourceMappingURL=index.d.ts.map
package/src/index.js CHANGED
@@ -7,3 +7,6 @@ export * from './debug.js';
7
7
  export * from './utils.js';
8
8
  export * from './method-tools.js';
9
9
  export * from './typeGuards.js';
10
+
11
+ export { objectMap } from '@endo/common/object-map.js';
12
+ export { fromUniqueEntries } from '@endo/common/from-unique-entries.js';
package/src/utils.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export const BASIS_POINTS: 10000n;
2
- export function fromUniqueEntries<K, V>(allEntries: Iterable<[K, V]>): {};
3
- export { objectMap } from "@endo/patterns";
2
+ /** @template T @typedef {import('@endo/eventual-send').ERef<T>} ERef<T> */
4
3
  /**
5
4
  * @template T
6
5
  * @typedef {{[KeyType in keyof T]: T[KeyType]} & {}} Simplify
@@ -38,7 +37,8 @@ export function PromiseAllOrErrors<T>(items: readonly (T | PromiseLike<T>)[]): P
38
37
  * trier: () => Promise<T>,
39
38
  * finalizer: (error?: unknown) => Promise<void>,
40
39
  * ) => Promise<T>}
41
- */ export const aggregateTryFinally: <T>(trier: () => Promise<T>, finalizer: (error?: unknown) => Promise<void>) => Promise<T>;
40
+ */
41
+ export const aggregateTryFinally: <T>(trier: () => Promise<T>, finalizer: (error?: unknown) => Promise<void>) => Promise<T>;
42
42
  export function assertAllDefined<T extends Record<string, unknown>>(obj: T): asserts obj is AllDefined<T>;
43
43
  export const forever: AsyncIterable<undefined>;
44
44
  export function whileTrue<T>(produce: () => T): AsyncIterable<Awaited<T>>;
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AAYA,kCAAoC;AAEpC,2EAA2E;AAE3E;;;;;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;AACH,mFAHwB,OAAO,KAAK,QAAQ,IAAI,CAAC,gBAa7C;AAgBG,0GAUN;AAQD,+CAAoD;AAU7C,0EAUH;AAUG,0EAaH;AAEJ,oDAAoD;AACpD,uDAAqE;AAErE,2GAA2G;AAC3G,+GAIE;AAWK,sGAFI,MAAM,mCA4FhB;;;;sBA1SyB,OAAO,qBAAqB,EAAE,IAAI,CAAC,CAAC,CAAC;;;;;;iCAUxC,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
@@ -4,10 +4,9 @@
4
4
  import { deeplyFulfilled, isObject } from '@endo/marshal';
5
5
  import { makePromiseKit } from '@endo/promise-kit';
6
6
  import { makeQueue } from '@endo/stream';
7
- import { asyncGenerate, makeSet } from 'jessie.js';
7
+ import { asyncGenerate } from 'jessie.js';
8
8
 
9
9
  const { fromEntries, keys, values } = Object;
10
- const { ownKeys } = Reflect;
11
10
 
12
11
  const { quote: q, Fail } = assert;
13
12
 
@@ -15,34 +14,6 @@ export const BASIS_POINTS = 10_000n;
15
14
 
16
15
  /** @template T @typedef {import('@endo/eventual-send').ERef<T>} ERef<T> */
17
16
 
18
- /**
19
- * Throws if multiple entries use the same property name. Otherwise acts
20
- * like `Object.fromEntries` but hardens the result.
21
- * Use it to protect from property names computed from user-provided data.
22
- *
23
- * @template K,V
24
- * @param {Iterable<[K,V]>} allEntries
25
- * @returns {{[k: K]: V}}
26
- */
27
- export const fromUniqueEntries = allEntries => {
28
- const entriesArray = [...allEntries];
29
- const result = harden(fromEntries(entriesArray));
30
- if (ownKeys(result).length === entriesArray.length) {
31
- return result;
32
- }
33
- const names = makeSet();
34
- for (const [name, _] of entriesArray) {
35
- if (names.has(name)) {
36
- Fail`collision on property name ${q(name)}: ${entriesArray}`;
37
- }
38
- names.add(name);
39
- }
40
- throw Fail`internal: failed to create object from unique entries`;
41
- };
42
- harden(fromUniqueEntries);
43
-
44
- export { objectMap } from '@endo/patterns';
45
-
46
17
  /**
47
18
  * @template T
48
19
  * @typedef {{[KeyType in keyof T]: T[KeyType]} & {}} Simplify
@@ -140,7 +111,8 @@ export const PromiseAllOrErrors = async items => {
140
111
  * trier: () => Promise<T>,
141
112
  * finalizer: (error?: unknown) => Promise<void>,
142
113
  * ) => Promise<T>}
143
- */ export const aggregateTryFinally = async (trier, finalizer) =>
114
+ */
115
+ export const aggregateTryFinally = async (trier, finalizer) =>
144
116
  trier().then(
145
117
  async result => finalizer().then(() => result),
146
118
  async tryError =>
@@ -166,7 +138,6 @@ export const PromiseAllOrErrors = async items => {
166
138
  * @throws if any value in the object entries is not defined
167
139
  * @returns {asserts obj is AllDefined<T>}
168
140
  */
169
-
170
141
  export const assertAllDefined = obj => {
171
142
  const missing = [];
172
143
  for (const [key, val] of Object.entries(obj)) {