@agoric/internal 0.3.3-dev-60cffcf.0 → 0.3.3-dev-cc2bf0b.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/index.d.ts +1 -0
- package/src/index.js +3 -0
- package/src/types.d.ts +37 -0
- package/src/types.js +2 -0
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-cc2bf0b.0+cc2bf0b",
|
|
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-cc2bf0b.0+cc2bf0b",
|
|
24
|
+
"@agoric/base-zone": "0.1.1-dev-cc2bf0b.0+cc2bf0b",
|
|
25
25
|
"@endo/common": "^1.2.2",
|
|
26
26
|
"@endo/far": "^1.1.2",
|
|
27
27
|
"@endo/init": "^1.1.2",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"typeCoverage": {
|
|
60
60
|
"atLeast": 93.81
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "cc2bf0bb431aa64c601628f53cf191fcc84c5750"
|
|
63
63
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ 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 * from "./types.js";
|
|
6
7
|
export { objectMap } from "@endo/common/object-map.js";
|
|
7
8
|
export { fromUniqueEntries } from "@endo/common/from-unique-entries.js";
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
package/src/index.js
CHANGED
|
@@ -8,5 +8,8 @@ export * from './utils.js';
|
|
|
8
8
|
export * from './method-tools.js';
|
|
9
9
|
export * from './typeGuards.js';
|
|
10
10
|
|
|
11
|
+
// eslint-disable-next-line import/export -- just types
|
|
12
|
+
export * from './types.js';
|
|
13
|
+
|
|
11
14
|
export { objectMap } from '@endo/common/object-map.js';
|
|
12
15
|
export { fromUniqueEntries } from '@endo/common/from-unique-entries.js';
|
package/src/types.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/* eslint-disable max-classes-per-file */
|
|
2
|
+
import type { Callable, RemotableBrand } from '@endo/eventual-send';
|
|
3
|
+
import type { Primitive } from '@endo/pass-style';
|
|
4
|
+
|
|
2
5
|
export declare class Callback<I extends (...args: unknown[]) => any> {
|
|
3
6
|
private iface: I;
|
|
4
7
|
|
|
@@ -18,3 +21,37 @@ export declare class SyncCallback<
|
|
|
18
21
|
|
|
19
22
|
public isSync: true;
|
|
20
23
|
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
Returns a boolean for whether the given type is primitive value or primitive type.
|
|
27
|
+
|
|
28
|
+
@example
|
|
29
|
+
```
|
|
30
|
+
IsPrimitive<'string'>
|
|
31
|
+
//=> true
|
|
32
|
+
|
|
33
|
+
IsPrimitive<string>
|
|
34
|
+
//=> true
|
|
35
|
+
|
|
36
|
+
IsPrimitive<Object>
|
|
37
|
+
//=> false
|
|
38
|
+
```
|
|
39
|
+
*/
|
|
40
|
+
export type IsPrimitive<T> = [T] extends [Primitive] ? true : false;
|
|
41
|
+
|
|
42
|
+
/** Recursively extract the non-callable properties of T */
|
|
43
|
+
export type DataOnly<T> =
|
|
44
|
+
IsPrimitive<T> extends true
|
|
45
|
+
? T
|
|
46
|
+
: T extends Callable
|
|
47
|
+
? never
|
|
48
|
+
: { [P in keyof T as T[P] extends Callable ? never : P]: DataOnly<T[P]> };
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A type that doesn't assume its parameter is local, but is satisfied with both
|
|
52
|
+
* local and remote references. It accepts both near and marshalled references
|
|
53
|
+
* that were returned from `Remotable` or `Far`.
|
|
54
|
+
*/
|
|
55
|
+
export type Remote<Primary, Local = DataOnly<Primary>> =
|
|
56
|
+
| Primary
|
|
57
|
+
| RemotableBrand<Local, Primary>;
|
package/src/types.js
ADDED