@agoric/internal 0.3.3-dev-0001c49.0 → 0.3.3-dev-a0953fe.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 +4 -4
- package/src/batched-deliver.d.ts +6 -6
- package/src/batched-deliver.d.ts.map +1 -1
- package/src/batched-deliver.js +3 -3
- package/src/utils.d.ts +1 -1
- package/src/utils.d.ts.map +1 -1
- package/src/utils.js +2 -46
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/internal",
|
|
3
|
-
"version": "0.3.3-dev-
|
|
3
|
+
"version": "0.3.3-dev-a0953fe.0+a0953fe",
|
|
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-
|
|
24
|
-
"@agoric/base-zone": "0.1.1-dev-
|
|
23
|
+
"@agoric/assert": "0.6.1-dev-a0953fe.0+a0953fe",
|
|
24
|
+
"@agoric/base-zone": "0.1.1-dev-a0953fe.0+a0953fe",
|
|
25
25
|
"@endo/far": "^0.2.21",
|
|
26
26
|
"@endo/init": "^0.5.59",
|
|
27
27
|
"@endo/marshal": "^0.8.8",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"typeCoverage": {
|
|
53
53
|
"atLeast": 92.26
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "a0953fe7d6d64fb37d426f69c087aa2d0a7ca4fe"
|
|
56
56
|
}
|
package/src/batched-deliver.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {(message: any[], ackNum: number) => void} DeliverMessages
|
|
2
|
+
* @typedef {(message: any[], ackNum: number) => Promise<void>} DeliverMessages
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* @param {DeliverMessages} deliver
|
|
6
|
-
* @param {{ clearTimeout:
|
|
6
|
+
* @param {{ clearTimeout: import('node:timers').clearTimeout, setTimeout: import('node:timers').setTimeout }} io
|
|
7
7
|
* @param {number} batchTimeoutMs
|
|
8
8
|
*/
|
|
9
9
|
export function makeBatchedDeliver(deliver: DeliverMessages, { clearTimeout, setTimeout }: {
|
|
10
|
-
clearTimeout:
|
|
11
|
-
setTimeout:
|
|
12
|
-
}, batchTimeoutMs?: number): (message: any[], ackNum: number) => void
|
|
10
|
+
clearTimeout: typeof clearTimeout;
|
|
11
|
+
setTimeout: typeof setTimeout;
|
|
12
|
+
}, batchTimeoutMs?: number): (message: any[], ackNum: number) => Promise<void>;
|
|
13
13
|
export const DEFAULT_BATCH_TIMEOUT_MS: 1000;
|
|
14
|
-
export type DeliverMessages = (message: any[], ackNum: number) => void
|
|
14
|
+
export type DeliverMessages = (message: any[], ackNum: number) => Promise<void>;
|
|
15
15
|
//# sourceMappingURL=batched-deliver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batched-deliver.d.ts","sourceRoot":"","sources":["batched-deliver.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;GAIG;AACH,4CAJW,eAAe,gCACf;IAAE,
|
|
1
|
+
{"version":3,"file":"batched-deliver.d.ts","sourceRoot":"","sources":["batched-deliver.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;GAIG;AACH,4CAJW,eAAe,gCACf;IAAE,kCAAiD;IAAC,8BAA4C;CAAE,mBAClG,MAAM,aANM,GAAG,EAAE,UAAU,MAAM,KAAK,QAAQ,IAAI,CAAC,CA4C7D;AA/CD,4CAA6C;wCAGtB,GAAG,EAAE,UAAU,MAAM,KAAK,QAAQ,IAAI,CAAC"}
|
package/src/batched-deliver.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
export const DEFAULT_BATCH_TIMEOUT_MS = 1000;
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @typedef {(message: any[], ackNum: number) => void} DeliverMessages
|
|
6
|
+
* @typedef {(message: any[], ackNum: number) => Promise<void>} DeliverMessages
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @param {DeliverMessages} deliver
|
|
11
|
-
* @param {{ clearTimeout:
|
|
11
|
+
* @param {{ clearTimeout: import('node:timers').clearTimeout, setTimeout: import('node:timers').setTimeout }} io
|
|
12
12
|
* @param {number} batchTimeoutMs
|
|
13
13
|
*/
|
|
14
14
|
export function makeBatchedDeliver(
|
|
@@ -34,7 +34,7 @@ export function makeBatchedDeliver(
|
|
|
34
34
|
// Transfer the batched messages to the deliver function.
|
|
35
35
|
const msgs = batchedMessages;
|
|
36
36
|
batchedMessages = [];
|
|
37
|
-
deliver(msgs, latestAckNum);
|
|
37
|
+
void deliver(msgs, latestAckNum);
|
|
38
38
|
}, batchTimeoutMs);
|
|
39
39
|
}
|
|
40
40
|
|
package/src/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const BASIS_POINTS: 10000n;
|
|
2
2
|
export function fromUniqueEntries<K, V>(allEntries: Iterable<[K, V]>): {};
|
|
3
|
-
export
|
|
3
|
+
export { objectMap } from "@endo/patterns";
|
|
4
4
|
export function listDifference(leftNames: Array<string | symbol>, rightNames: Array<string | symbol>): (string | symbol)[];
|
|
5
5
|
export function throwLabeled(innerErr: Error, label: string | number, ErrorConstructor?: ErrorConstructor | undefined): never;
|
|
6
6
|
export function applyLabelingError<A, R>(func: (...args: A[]) => R, args: A[], label?: string | number | undefined): R;
|
package/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AAcA,kCAAoC;AAa7B,0EAcN
|
|
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"}
|
package/src/utils.js
CHANGED
|
@@ -7,7 +7,7 @@ import { isPromise, makePromiseKit } from '@endo/promise-kit';
|
|
|
7
7
|
import { makeQueue } from '@endo/stream';
|
|
8
8
|
import { asyncGenerate, makeSet } from 'jessie.js';
|
|
9
9
|
|
|
10
|
-
const {
|
|
10
|
+
const { fromEntries, keys, values } = Object;
|
|
11
11
|
const { ownKeys } = Reflect;
|
|
12
12
|
|
|
13
13
|
const { details: X, quote: q, Fail } = assert;
|
|
@@ -42,51 +42,7 @@ export const fromUniqueEntries = allEntries => {
|
|
|
42
42
|
};
|
|
43
43
|
harden(fromUniqueEntries);
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
* By analogy with how `Array.prototype.map` will map the elements of
|
|
47
|
-
* an array to transformed elements of an array of the same shape,
|
|
48
|
-
* `objectMap` will do likewise for the string-named own enumerable
|
|
49
|
-
* properties of an object.
|
|
50
|
-
*
|
|
51
|
-
* Typical usage applies `objectMap` to a CopyRecord, i.e.,
|
|
52
|
-
* an object for which `passStyleOf(original) === 'copyRecord'`. For these,
|
|
53
|
-
* none of the following edge cases arise. The result will be a CopyRecord
|
|
54
|
-
* with exactly the same property names, whose values are the mapped form of
|
|
55
|
-
* the original's values.
|
|
56
|
-
*
|
|
57
|
-
* When the original is not a CopyRecord, some edge cases to be aware of
|
|
58
|
-
* * No matter how mutable the original object, the returned object is
|
|
59
|
-
* hardened.
|
|
60
|
-
* * Only the string-named enumerable own properties of the original
|
|
61
|
-
* are mapped. All other properties are ignored.
|
|
62
|
-
* * If any of the original properties were accessors, `Object.entries`
|
|
63
|
-
* will cause its `getter` to be called and will use the resulting
|
|
64
|
-
* value.
|
|
65
|
-
* * No matter whether the original property was an accessor, writable,
|
|
66
|
-
* or configurable, all the properties of the returned object will be
|
|
67
|
-
* non-writable, non-configurable, data properties.
|
|
68
|
-
* * No matter what the original object may have inherited from, and
|
|
69
|
-
* no matter whether it was a special kind of object such as an array,
|
|
70
|
-
* the returned object will always be a plain object inheriting directly
|
|
71
|
-
* from `Object.prototype` and whose state is only these new mapped
|
|
72
|
-
* own properties.
|
|
73
|
-
*
|
|
74
|
-
* With these differences, even if the original object was not a CopyRecord,
|
|
75
|
-
* if all the mapped values are Passable, then the returned object will be
|
|
76
|
-
* a CopyRecord.
|
|
77
|
-
*
|
|
78
|
-
* @template {Record<string, any>} O
|
|
79
|
-
* @param {O} original
|
|
80
|
-
* @template R map result
|
|
81
|
-
* @param {(value: O[keyof O], key: keyof O) => R} mapFn
|
|
82
|
-
* @returns {{ [P in keyof O]: R}}
|
|
83
|
-
*/
|
|
84
|
-
export const objectMap = (original, mapFn) => {
|
|
85
|
-
const ents = entries(original);
|
|
86
|
-
const mapEnts = ents.map(([k, v]) => [k, mapFn(v, k)]);
|
|
87
|
-
return harden(fromEntries(mapEnts));
|
|
88
|
-
};
|
|
89
|
-
harden(objectMap);
|
|
45
|
+
export { objectMap } from '@endo/patterns';
|
|
90
46
|
|
|
91
47
|
/**
|
|
92
48
|
* @param {Array<string | symbol>} leftNames
|