@agoric/internal 0.3.3-dev-eef7b69.0.eef7b69 → 0.3.3-dev-f96725d.0.f96725d
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/tagged.d.ts +21 -1
- package/src/testing-utils.d.ts.map +1 -1
- package/src/testing-utils.js +2 -1
- package/src/types.d.ts +3 -2
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +26 -2
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-f96725d.0.f96725d",
|
|
4
4
|
"description": "Externally unsupported utilities internal to agoric-sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"lint:types": "yarn run -T tsc"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@agoric/base-zone": "0.1.1-dev-
|
|
23
|
+
"@agoric/base-zone": "0.1.1-dev-f96725d.0.f96725d",
|
|
24
24
|
"@endo/cache-map": "^1.1.0",
|
|
25
25
|
"@endo/common": "^1.2.13",
|
|
26
26
|
"@endo/compartment-mapper": "^1.6.3",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"jessie.js": "^0.3.4"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
41
|
+
"@agoric/cosmic-proto": "0.4.1-dev-f96725d.0.f96725d",
|
|
42
42
|
"@endo/exo": "^1.5.12",
|
|
43
43
|
"@endo/init": "^1.1.12",
|
|
44
44
|
"@endo/ses-ava": "^1.3.2",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"typeCoverage": {
|
|
67
67
|
"atLeast": 92.89
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "f96725dc568bd872664f68eb5f60b0853737e166"
|
|
70
70
|
}
|
package/src/tagged.d.ts
CHANGED
|
@@ -3,12 +3,32 @@
|
|
|
3
3
|
// different name to avoid confusion with pass-style "tagged"
|
|
4
4
|
export { Tagged as TypeTag };
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* CAVEAT: We use a constant string here to avoid exposing a `unique symbol`
|
|
8
|
+
* type publicly, such as with:
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* declare const mySymbol: unique symbol;
|
|
12
|
+
*
|
|
13
|
+
* Without this workaround, we've observed errors when using at least
|
|
14
|
+
* `typescript@5.9.3`'s `tsc` to generate declaration files (.d.ts) for
|
|
15
|
+
* consumers of modules that in turn import the declaration:
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* error TS9006: Declaration emit for this file requires using private name
|
|
19
|
+
* 'tag' from module '.../internal/src/tagged"'. An explicit
|
|
20
|
+
* type annotation may unblock declaration emit.
|
|
21
|
+
*/
|
|
22
|
+
// declare const tag: unique symbol;
|
|
23
|
+
declare const tag: 'Symbol(tag)';
|
|
7
24
|
|
|
8
25
|
export type TagContainer<Token> = {
|
|
9
26
|
readonly [tag]: Token;
|
|
10
27
|
};
|
|
11
28
|
|
|
29
|
+
let f: TagContainer<'zot'>;
|
|
30
|
+
f['Symbol(tag)'];
|
|
31
|
+
|
|
12
32
|
type Tag<Token extends PropertyKey, TagMetadata> = TagContainer<{
|
|
13
33
|
[K in Token]: TagMetadata;
|
|
14
34
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing-utils.d.ts","sourceRoot":"","sources":["testing-utils.js"],"names":[],"mappings":"AAeO,mDACwC;AAgBxC,uCAHI,QAAQ,GACN,MAAM,
|
|
1
|
+
{"version":3,"file":"testing-utils.d.ts","sourceRoot":"","sources":["testing-utils.js"],"names":[],"mappings":"AAeO,mDACwC;AAgBxC,uCAHI,QAAQ,GACN,MAAM,CAsBlB;8BA9C2B,eAAe"}
|
package/src/testing-utils.js
CHANGED
|
@@ -35,7 +35,8 @@ export const inspectMapStore = store => {
|
|
|
35
35
|
const obj = {};
|
|
36
36
|
for (const key of store.keys()) {
|
|
37
37
|
const value = store.get(key);
|
|
38
|
-
const hasKeys =
|
|
38
|
+
const hasKeys =
|
|
39
|
+
typeof value === 'object' && value != null && 'keys' in value;
|
|
39
40
|
const index = stringOrTag(key);
|
|
40
41
|
if (hasKeys && 'get' in value) {
|
|
41
42
|
obj[index] = inspectMapStore(value);
|
package/src/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ERef, RemotableBrand } from '@endo/eventual-send';
|
|
2
|
-
import type { Primitive } from '@endo/pass-style';
|
|
2
|
+
import type { Primitive, RemotableObject } from '@endo/pass-style';
|
|
3
3
|
import type { Pattern } from '@endo/patterns';
|
|
4
4
|
import type { Callable } from './ses-utils.js';
|
|
5
5
|
/**
|
|
@@ -50,6 +50,7 @@ export declare class SyncCallback<I extends (...args: unknown[]) => any> extends
|
|
|
50
50
|
* //=> false
|
|
51
51
|
*/
|
|
52
52
|
export type IsPrimitive<T> = [T] extends [Primitive] ? true : false;
|
|
53
|
+
export type IsRemotable<T> = T extends RemotableObject ? true : T extends RemotableBrand<any, any> ? true : false;
|
|
53
54
|
/** Recursively extract the non-callable properties of T */
|
|
54
55
|
export type DataOnly<T> = IsPrimitive<T> extends true ? T : T extends Callable ? never : {
|
|
55
56
|
[P in keyof T as T[P] extends Callable ? never : P]: DataOnly<T[P]>;
|
|
@@ -65,7 +66,7 @@ export type Remote<Primary, Local = DataOnly<Primary>> = Primary | RemotableBran
|
|
|
65
66
|
* near or marshalled. @see {ERef} and @see {Remote}.
|
|
66
67
|
*/
|
|
67
68
|
export type ERemote<Primary, Local = DataOnly<Primary>> = ERef<Remote<Primary, Local>>;
|
|
68
|
-
declare const validatedType:
|
|
69
|
+
declare const validatedType: 'Symbol(validatedType)';
|
|
69
70
|
/**
|
|
70
71
|
* Tag a pattern with the static type it represents.
|
|
71
72
|
*/
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,KAAK,EAA8B,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;GAGG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG;IACpD,6EAA6E;IAC7E,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,IAC9C,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAChB,IAAI,GACJ,MAAM,GACN,OAAO,CAAC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,MAAM,GAAG,MAAM,CA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AC;AAEhF,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable max-classes-per-file */
|
|
2
2
|
import type { ERef, RemotableBrand } from '@endo/eventual-send';
|
|
3
|
-
import type { Primitive } from '@endo/pass-style';
|
|
3
|
+
import type { Primitive, RemotableObject } from '@endo/pass-style';
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- used in JSDoc
|
|
5
5
|
import type { mustMatch as endoMustMatch, Pattern } from '@endo/patterns';
|
|
6
6
|
import type { Callable } from './ses-utils.js';
|
|
@@ -74,6 +74,13 @@ export declare class SyncCallback<
|
|
|
74
74
|
*/
|
|
75
75
|
export type IsPrimitive<T> = [T] extends [Primitive] ? true : false;
|
|
76
76
|
|
|
77
|
+
// XXX https://github.com/endojs/endo/issues/2979
|
|
78
|
+
export type IsRemotable<T> = T extends RemotableObject
|
|
79
|
+
? true
|
|
80
|
+
: T extends RemotableBrand<any, any>
|
|
81
|
+
? true
|
|
82
|
+
: false;
|
|
83
|
+
|
|
77
84
|
/** Recursively extract the non-callable properties of T */
|
|
78
85
|
export type DataOnly<T> =
|
|
79
86
|
IsPrimitive<T> extends true
|
|
@@ -105,8 +112,25 @@ export type ERemote<Primary, Local = DataOnly<Primary>> = ERef<
|
|
|
105
112
|
* explictly specify the type that the Pattern will verify through a match.
|
|
106
113
|
*
|
|
107
114
|
* TODO move all this pattern typing stuff to @endo/patterns
|
|
115
|
+
*
|
|
116
|
+
* CAVEAT: We use a constant string here to avoid exposing a `unique symbol`
|
|
117
|
+
* type publicly, such as with:
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* declare const mySymbol: unique symbol;
|
|
121
|
+
*
|
|
122
|
+
* Without this workaround, we've observed errors when using at least
|
|
123
|
+
* `typescript@5.9.3`'s `tsc` to generate declaration files (.d.ts) for
|
|
124
|
+
* consumers of modules that in turn import the declaration:
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* error TS9006: Declaration emit for this file requires using private name
|
|
128
|
+
* 'tag' from module '.../internal/src/tagged"'. An explicit
|
|
129
|
+
* type annotation may unblock declaration emit.
|
|
108
130
|
*/
|
|
109
|
-
declare const validatedType: unique symbol;
|
|
131
|
+
// declare const validatedType: unique symbol;
|
|
132
|
+
declare const validatedType: 'Symbol(validatedType)';
|
|
133
|
+
|
|
110
134
|
/**
|
|
111
135
|
* Tag a pattern with the static type it represents.
|
|
112
136
|
*/
|