@agoric/internal 0.4.0-u21.0.1 → 0.4.0-u22.1
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 +21 -21
- package/src/callback.d.ts.map +1 -1
- package/src/callback.js +7 -6
- package/src/cli-utils.d.ts +2 -0
- package/src/cli-utils.d.ts.map +1 -0
- package/src/cli-utils.js +21 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/js-utils.js +1 -1
- package/src/ses-utils.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/internal",
|
|
3
|
-
"version": "0.4.0-
|
|
3
|
+
"version": "0.4.0-u22.1",
|
|
4
4
|
"description": "Externally unsupported utilities internal to agoric-sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "exit 0",
|
|
12
12
|
"prepack": "yarn run -T tsc --build tsconfig.build.json",
|
|
13
|
-
"postpack": "git clean -f '*.d
|
|
13
|
+
"postpack": "git clean -f '*.d.*ts*' '*.tsbuildinfo'",
|
|
14
14
|
"test": "ava",
|
|
15
15
|
"test:nyc": "exit 0",
|
|
16
16
|
"test:xs": "exit 0",
|
|
@@ -20,29 +20,29 @@
|
|
|
20
20
|
"lint:types": "yarn run -T tsc"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@agoric/base-zone": "0.
|
|
24
|
-
"@endo/common": "^1.2.
|
|
25
|
-
"@endo/compartment-mapper": "^1.6.
|
|
26
|
-
"@endo/errors": "^1.2.
|
|
27
|
-
"@endo/eventual-send": "^1.3.
|
|
28
|
-
"@endo/far": "^1.1.
|
|
29
|
-
"@endo/init": "^1.1.
|
|
30
|
-
"@endo/marshal": "^1.
|
|
31
|
-
"@endo/nat": "^5.1.
|
|
32
|
-
"@endo/pass-style": "^1.
|
|
33
|
-
"@endo/patterns": "^1.
|
|
34
|
-
"@endo/promise-kit": "^1.1.
|
|
35
|
-
"@endo/stream": "^1.2.
|
|
23
|
+
"@agoric/base-zone": "0.2.0-u22.1",
|
|
24
|
+
"@endo/common": "^1.2.13",
|
|
25
|
+
"@endo/compartment-mapper": "^1.6.3",
|
|
26
|
+
"@endo/errors": "^1.2.13",
|
|
27
|
+
"@endo/eventual-send": "^1.3.4",
|
|
28
|
+
"@endo/far": "^1.1.14",
|
|
29
|
+
"@endo/init": "^1.1.12",
|
|
30
|
+
"@endo/marshal": "^1.8.0",
|
|
31
|
+
"@endo/nat": "^5.1.3",
|
|
32
|
+
"@endo/pass-style": "^1.6.3",
|
|
33
|
+
"@endo/patterns": "^1.7.0",
|
|
34
|
+
"@endo/promise-kit": "^1.1.13",
|
|
35
|
+
"@endo/stream": "^1.2.13",
|
|
36
36
|
"anylogger": "^0.21.0",
|
|
37
37
|
"jessie.js": "^0.3.4"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@agoric/cosmic-proto": "0.5.0-
|
|
41
|
-
"@endo/exo": "^1.5.
|
|
42
|
-
"@endo/init": "^1.1.
|
|
40
|
+
"@agoric/cosmic-proto": "0.5.0-u22.1",
|
|
41
|
+
"@endo/exo": "^1.5.12",
|
|
42
|
+
"@endo/init": "^1.1.12",
|
|
43
43
|
"@fast-check/ava": "^2.0.1",
|
|
44
44
|
"ava": "^5.3.0",
|
|
45
|
-
"tsd": "^0.
|
|
45
|
+
"tsd": "^0.33.0"
|
|
46
46
|
},
|
|
47
47
|
"ava": {
|
|
48
48
|
"require": [
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
64
|
"typeCoverage": {
|
|
65
|
-
"atLeast":
|
|
65
|
+
"atLeast": 93.02
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "83a42d0f343b01448a918631dce159b5bd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AG,CAAC,CAcrC;AAiBM,kCAXoB,CAAC,SAAd,WAAY,QACf,OAAO,mBAAmB,EAAE,IAAI,eAEhC,CAAC,EAAE,4BAEX;IAEU,cAAc,8CADrB,CAAC;IAGkB,GAAG;CAC3B;aAgEc,GAAG;;;uDArDgB,GAAG,WAAW,GAAG,EAAE,KAAK,GAAG,KAwF5D;AAYM,yCANgD,CAAC,SAA3C,OAAQ,gBAAgB,EAAE,cAAe,QAC3C,OAAO,mBAAmB,EAAE,IAAI,kBAChC,CAAC,SAET;IAAsB,GAAG;CAAC,GAQT,cAAc,CAAC,GAAG,CAAC,CACtC;2BAxS0C,CAAC,SAA/B,OAAQ,WAAW,EAAE,OAAQ,IAC7B,CACZ,GAAO,IAAI,EAAE,UAAU,CAAC,UAAU,GAsKR,CAAC,SAAd,WAAY,QACf,OAAO,mBAAmB,EAAE,IAAI,eAEhC,CAAC,EAAE,4BAEX;IAEU,cAAc,8CADrB,CAAC;IAGkB,GAAG;CAC3B;aAgEc,GAAG;;;uDArDgB,GAAG,WAAW,GAAG,EAAE,KAAK,GAAG,MA3LP,CAAC,KAC/C,OAAO,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;kCAdI,YAAY;8BAAZ,YAAY;0BAD9B,WAAW"}
|
package/src/callback.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { Fail, makeError, q } from '@endo/errors';
|
|
3
3
|
import { E } from '@endo/far';
|
|
4
|
-
import {
|
|
4
|
+
import { isPrimitive, isPassableSymbol } from '@endo/pass-style';
|
|
5
5
|
import { getInterfaceMethodKeys } from '@endo/patterns';
|
|
6
6
|
|
|
7
7
|
/** @import {ERef} from '@endo/far' */
|
|
@@ -102,7 +102,7 @@ harden(makeSyncFunctionCallback);
|
|
|
102
102
|
* @returns {Callback<I>}
|
|
103
103
|
*/
|
|
104
104
|
export const makeFunctionCallback = (target, ...bound) => {
|
|
105
|
-
|
|
105
|
+
!isPrimitive(target) ||
|
|
106
106
|
Fail`function callback target must be a function presence: ${target}`;
|
|
107
107
|
/** @type {unknown} */
|
|
108
108
|
const cb = harden({ target, bound });
|
|
@@ -125,7 +125,7 @@ harden(makeFunctionCallback);
|
|
|
125
125
|
* @returns {SyncCallback<I>}
|
|
126
126
|
*/
|
|
127
127
|
export const makeSyncMethodCallback = (target, methodName, ...bound) => {
|
|
128
|
-
|
|
128
|
+
!isPrimitive(target) ||
|
|
129
129
|
Fail`sync method callback target must be an object: ${target}`;
|
|
130
130
|
typeof methodName === 'string' ||
|
|
131
131
|
isPassableSymbol(methodName) ||
|
|
@@ -151,7 +151,8 @@ harden(makeSyncMethodCallback);
|
|
|
151
151
|
* @returns {Callback<I>}
|
|
152
152
|
*/
|
|
153
153
|
export const makeMethodCallback = (target, methodName, ...bound) => {
|
|
154
|
-
|
|
154
|
+
!isPrimitive(target) ||
|
|
155
|
+
Fail`method callback target must be an object: ${target}`;
|
|
155
156
|
typeof methodName === 'string' ||
|
|
156
157
|
isPassableSymbol(methodName) ||
|
|
157
158
|
Fail`method name must be a string or passable symbol: ${methodName}`;
|
|
@@ -166,12 +167,12 @@ harden(makeMethodCallback);
|
|
|
166
167
|
* @returns {callback is Callback<any>}
|
|
167
168
|
*/
|
|
168
169
|
export const isCallback = callback => {
|
|
169
|
-
if (
|
|
170
|
+
if (isPrimitive(callback)) {
|
|
170
171
|
return false;
|
|
171
172
|
}
|
|
172
173
|
const { target, methodName, bound } = callback;
|
|
173
174
|
return (
|
|
174
|
-
|
|
175
|
+
!isPrimitive(target) &&
|
|
175
176
|
(methodName === undefined ||
|
|
176
177
|
typeof methodName === 'string' ||
|
|
177
178
|
isPassableSymbol(methodName)) &&
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-utils.d.ts","sourceRoot":"","sources":["cli-utils.js"],"names":[],"mappings":"AAUO,qCAJI,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,GAErD,MAAM,EAAE,CAYjB"}
|
package/src/cli-utils.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a string-keyed object into an array of CLI options, using each key as
|
|
3
|
+
* the name of a GNU-style long option `--${key}`, ignoring each key with an
|
|
4
|
+
* undefined value and converting boolean values into no-argument `--${key}` or
|
|
5
|
+
* `--no-${key}` options.
|
|
6
|
+
*
|
|
7
|
+
* @param {Record<string, undefined | boolean | string | string[]>} record -
|
|
8
|
+
* e.g. { color: 'blue' }
|
|
9
|
+
* @returns {string[]} - e.g. ['--color', 'blue']
|
|
10
|
+
*/
|
|
11
|
+
export const toCLIOptions = record =>
|
|
12
|
+
Object.entries(record).flatMap(([key, value]) => {
|
|
13
|
+
if (value === undefined) return [];
|
|
14
|
+
if (value === true) return [`--${key}`];
|
|
15
|
+
if (value === false) return [`--no-${key}`];
|
|
16
|
+
if (Array.isArray(value)) {
|
|
17
|
+
// Represent as a repeated option.
|
|
18
|
+
return value.flatMap(v => [`--${key}`, v]);
|
|
19
|
+
}
|
|
20
|
+
return [`--${key}`, value];
|
|
21
|
+
});
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
package/src/js-utils.js
CHANGED
|
@@ -69,7 +69,7 @@ export const deepCopyJsonable = value => JSON.parse(JSON.stringify(value));
|
|
|
69
69
|
* @param {O[K]} value
|
|
70
70
|
* @param {K | undefined} name
|
|
71
71
|
* @param {O | undefined} container
|
|
72
|
-
* @param {(value: O[K], name:
|
|
72
|
+
* @param {(value: O[K], name: string, record: O) => O[K] | M} mapper
|
|
73
73
|
* @returns {O[K] | M | { [K2 in keyof O[K]]: O[K][K2] | M }}
|
|
74
74
|
*/
|
|
75
75
|
const deepMapObjectInternal = (value, name, container, mapper) => {
|
package/src/ses-utils.js
CHANGED
|
@@ -9,7 +9,7 @@ import { objectMap } from '@endo/common/object-map.js';
|
|
|
9
9
|
import { objectMetaMap } from '@endo/common/object-meta-map.js';
|
|
10
10
|
import { fromUniqueEntries } from '@endo/common/from-unique-entries.js';
|
|
11
11
|
import { q, Fail, makeError, annotateError, X } from '@endo/errors';
|
|
12
|
-
import { deeplyFulfilled,
|
|
12
|
+
import { deeplyFulfilled, isPrimitive } from '@endo/pass-style';
|
|
13
13
|
import { makePromiseKit } from '@endo/promise-kit';
|
|
14
14
|
import { makeQueue } from '@endo/stream';
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -71,7 +71,7 @@ harden(makeLimitedConsole);
|
|
|
71
71
|
* @type {<T extends {}>(unfulfilledTerms: T) => Promise<DeeplyAwaited<T>>}
|
|
72
72
|
*/
|
|
73
73
|
export const deeplyFulfilledObject = async obj => {
|
|
74
|
-
|
|
74
|
+
!isPrimitive(obj) || Fail`param must be an object`;
|
|
75
75
|
return deeplyFulfilled(obj);
|
|
76
76
|
};
|
|
77
77
|
|