@agoric/internal 0.3.3-dev-776528e.0.776528e → 0.3.3-dev-cbcea8c.0.cbcea8c

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-776528e.0.776528e",
3
+ "version": "0.3.3-dev-cbcea8c.0.cbcea8c",
4
4
  "description": "Externally unsupported utilities internal to agoric-sdk",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,28 +24,28 @@
24
24
  "lint:types": "yarn run -T tsgo --tsBuildInfoFile tsconfig.tsgo.tsbuildinfo"
25
25
  },
26
26
  "dependencies": {
27
- "@agoric/base-zone": "0.1.1-dev-776528e.0.776528e",
27
+ "@agoric/base-zone": "0.1.1-dev-cbcea8c.0.cbcea8c",
28
28
  "@endo/cache-map": "^1.1.0",
29
- "@endo/common": "^1.2.13",
30
- "@endo/compartment-mapper": "^1.6.3",
31
- "@endo/errors": "^1.2.13",
32
- "@endo/eventual-send": "^1.3.4",
29
+ "@endo/common": "^1.4.0",
30
+ "@endo/compartment-mapper": "^2.3.0",
31
+ "@endo/errors": "^1.3.1",
32
+ "@endo/eventual-send": "^1.5.0",
33
33
  "@endo/far": "^1.1.14",
34
- "@endo/init": "^1.1.12",
35
- "@endo/marshal": "^1.8.0",
36
- "@endo/nat": "^5.1.3",
37
- "@endo/pass-style": "^1.6.3",
38
- "@endo/patterns": "^1.7.0",
39
- "@endo/promise-kit": "^1.1.13",
40
- "@endo/stream": "^1.2.13",
34
+ "@endo/init": "^1.1.13",
35
+ "@endo/marshal": "^1.10.0",
36
+ "@endo/nat": "^5.2.0",
37
+ "@endo/pass-style": "^1.8.1",
38
+ "@endo/patterns": "^1.9.1",
39
+ "@endo/promise-kit": "^1.2.1",
40
+ "@endo/stream": "^1.3.1",
41
41
  "import-meta-resolve": "^4.1.0",
42
42
  "jessie.js": "^0.3.4"
43
43
  },
44
44
  "devDependencies": {
45
- "@agoric/cosmic-proto": "0.4.1-dev-776528e.0.776528e",
46
- "@endo/exo": "^1.5.12",
47
- "@endo/init": "^1.1.12",
48
- "@endo/ses-ava": "^1.3.2",
45
+ "@agoric/cosmic-proto": "0.4.1-dev-cbcea8c.0.cbcea8c",
46
+ "@endo/exo": "^1.7.0",
47
+ "@endo/init": "^1.1.13",
48
+ "@endo/ses-ava": "^1.4.2",
49
49
  "@fast-check/ava": "^3.0.1",
50
50
  "ava": "^7.0.0",
51
51
  "tsd": "^0.33.0"
@@ -70,5 +70,5 @@
70
70
  "typeCoverage": {
71
71
  "atLeast": 92.84
72
72
  },
73
- "gitHead": "776528eb7ca6f31911f2ca21a9702e20fdca2595"
73
+ "gitHead": "cbcea8c2415f2c9c4bc1ea9ff90730f2773bafaa"
74
74
  }
package/src/callback.d.ts CHANGED
@@ -12,7 +12,7 @@ export function prepareAttenuator<M extends PropertyKey>(zone: Zone, methodNames
12
12
  target?: any;
13
13
  isSync?: boolean | undefined;
14
14
  overrides?: { [K_1 in M]?: Callback<any> | null | undefined; } | undefined;
15
- }) => import("@endo/exo").Guarded<{ [K_2 in M]: (this: any, ...args: any[]) => any; }>;
15
+ }) => import("@endo/exo").Guarded<{ [K_2 in M]: (this: any, ...args: any[]) => any; }, InterfaceGuard>;
16
16
  export function prepareGuardedAttenuator<G extends InterfaceGuard>(zone: Zone, interfaceGuard: G, opts?: {
17
17
  tag?: string | undefined;
18
18
  }): MakeAttenuator<any>;
@@ -1 +1 @@
1
- {"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["callback.js"],"names":[],"mappings":"AAuDO,yBALgC,CAAC,SAA3B,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAI,YAC3B,aAAa,CAAC,CAAC,WACf,UAAU,CAAC,CAAC,CAAC,GACX,UAAU,CAAC,CAAC,CAAC,CAQzB;AAWM,sBALgC,CAAC,SAA3B,CAAE,GAAG,IAAI,EAAE,GAAG,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E,CAAC,GAAG,CAAC,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,GAC/D,CAAE,WAAY,CAAC,eACG,CAAC,SAAT,GAAG,EAAG,eACT,CAAC,cACD,CAAC,YACD,CAAC,GACC,SAAS,CAAC,CAAC,CAWvB;AAOM,qCAHI,GAAG,GACD,QAAQ,IAAI,SAAS,GAAG,CAAC,CAcrC;AAgBM,kCAVoB,CAAC,SAAd,WAAY,QACf,IAAI,eACJ,CAAC,EAAE,4BAEX;IAEU,cAAc,qBADrB,CAAC;IAGkB,GAAG;CAC3B;aAiEc,GAAG;;;uDAtDgB,GAAG,WAAW,GAAG,EAAE,KAAK,GAAG,qBAyF5D;AAYM,yCANuB,CAAC,SAAlB,cAAgB,QAClB,IAAI,kBACJ,CAAC,SAET;IAAsB,GAAG;CAAC,GAQT,cAAc,CAAC,GAAG,CAAC,CACtC;2BAxSsB,CAAC,SAAX,OAAS,IACT,CACZ,GAAO,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,KACtD,QAAQ,CAAC,CAAC;kCAdwB,YAAY;8BAAZ,YAAY;0BAP/B,WAAW;0BAGX,mBAAmB;iCAEZ,gBAAgB;oCADb,gBAAgB;6BAHvB,WAAW;6BACX,WAAW"}
package/src/callback.js CHANGED
@@ -261,6 +261,7 @@ export const prepareAttenuator = (
261
261
  */
262
262
  const makeAttenuator = zone.exoClass(
263
263
  tag,
264
+ // @ts-expect-error optional InterfaceGuard doesn't match either overload
264
265
  interfaceGuard,
265
266
  /**
266
267
  * @param {object} opts
@@ -10,17 +10,11 @@
10
10
  * @param {boolean} [rootOptions.sequence] employ a wrapping structure that
11
11
  * preserves each value set within a single block, and default child nodes to
12
12
  * do the same
13
+ * @returns {StorageNode}
13
14
  */
14
15
  export function makeChainStorageRoot(handleStorageMessage: (message: StorageMessage) => any, rootPath: string, rootOptions?: {
15
16
  sequence?: boolean | undefined;
16
- }): import("@endo/exo").Guarded<{
17
- getPath(): string;
18
- getStoreKey(): Promise<VStorageKey>;
19
- makeChildNode(name: string, childNodeOptions?: {
20
- sequence?: boolean;
21
- }): StorageNode;
22
- setValue(value: string): Promise<void>;
23
- }>;
17
+ }): StorageNode;
24
18
  /**
25
19
  * Convenience function for returning a storage node at or under its input,
26
20
  * falling back to an inert object with the correct interface (but incomplete
@@ -32,22 +26,28 @@ export function makeChainStorageRoot(handleStorageMessage: (message: StorageMess
32
26
  */
33
27
  export function makeStorageNodeChild(storageNodeRef: ERef<Remote<StorageNode> | null>, childName: string): Promise<Remote<StorageNode>>;
34
28
  /**
29
+ * @import {RemotableBrand} from '@endo/eventual-send';
35
30
  * @import {ERef} from '@endo/far';
36
31
  * @import {Marshal, Passable} from '@endo/marshal';
37
- * @import {Remote, ERemote, TypedPattern} from './types.js';
32
+ * @import {Remote, ERemote} from './types.js';
38
33
  * @import {EMarshaller} from './marshal/wrap-marshaller.js';
39
34
  * @import {Zone} from '@agoric/base-zone';
40
35
  * @import {Callback} from './types.js';
36
+ * @import {CastedPattern} from '@endo/patterns';
37
+ * @import {MatcherOf} from '@endo/patterns';
41
38
  */
42
39
  /** @typedef {Marshal<unknown>} Marshaller */
43
40
  /** @typedef {Pick<Marshaller, 'fromCapData'>} Unserializer */
44
41
  /**
45
42
  * Defined by vstorageStoreKey in vstorage.go
46
43
  *
44
+ * The backend provides all properties but for mock data flexibility we allow
45
+ * some to be optional in the JS typedef.
46
+ *
47
47
  * @typedef VStorageKey
48
48
  * @property {string} storeName
49
49
  * @property {string} storeSubkey
50
- * @property {string} dataPrefixBytes
50
+ * @property {string} [dataPrefixBytes]
51
51
  * @property {string} [noDataValue]
52
52
  */
53
53
  /**
@@ -57,31 +57,27 @@ export function makeStorageNodeChild(storageNodeRef: ERef<Remote<StorageNode> |
57
57
  * (decimal representation of a natural number)
58
58
  * @property {T[]} values
59
59
  */
60
- /** @type {TypedPattern<StreamCell>} */
61
- export const StreamCellShape: TypedPattern<StreamCell>;
60
+ /** @type {CastedPattern<StreamCell>} */
61
+ export const StreamCellShape: CastedPattern<StreamCell>;
62
62
  export function isStreamCell(cell: any): cell is StreamCell;
63
63
  /** @type {(name: string) => void} */
64
64
  export const assertPathSegment: (name: string) => void;
65
- export function prepareChainStorageNode(zone: Zone): (messenger: Callback<(message: StorageMessage) => any>, path: string, args_2?: {
66
- sequence?: boolean | undefined;
67
- } | undefined) => import("@endo/exo").Guarded<{
68
- getPath(): string;
69
- getStoreKey(): Promise<VStorageKey>;
70
- makeChildNode(name: string, childNodeOptions?: {
71
- sequence?: boolean;
72
- }): StorageNode;
73
- setValue(value: string): Promise<void>;
74
- }>;
65
+ export function prepareChainStorageNode(zone: Zone): (messenger: Callback<(message: StorageMessage) => any>, path: string, options?: {
66
+ sequence?: boolean;
67
+ }) => StorageNode;
75
68
  export function makeSerializeToStorage(storageNode: ERemote<StorageNode>, marshaller: ERemote<EMarshaller>): (value: Passable) => Promise<void>;
76
69
  export type Marshaller = Marshal<unknown>;
77
70
  export type Unserializer = Pick<Marshaller, "fromCapData">;
78
71
  /**
79
72
  * Defined by vstorageStoreKey in vstorage.go
73
+ *
74
+ * The backend provides all properties but for mock data flexibility we allow
75
+ * some to be optional in the JS typedef.
80
76
  */
81
77
  export type VStorageKey = {
82
78
  storeName: string;
83
79
  storeSubkey: string;
84
- dataPrefixBytes: string;
80
+ dataPrefixBytes?: string | undefined;
85
81
  noDataValue?: string | undefined;
86
82
  };
87
83
  export type StreamCell<T = unknown> = {
@@ -101,25 +97,12 @@ export type StreamCell<T = unknown> = {
101
97
  * Vstorage is a hierarchical externally-reachable storage structure that
102
98
  * identifies children by restricted ASCII name and is associated with arbitrary
103
99
  * string-valued data for each node, defaulting to the empty string.
100
+ *
101
+ * Defined as an interface in ./types.ts so its per-property documentation
102
+ * survives declaration emit. Re-exported here as an alias so existing
103
+ * `from '@agoric/internal/src/lib-chainStorage.js'` importers keep working.
104
104
  */
105
- export type StorageNode = {
106
- /**
107
- * publishes some data
108
- */
109
- setValue: (data: string) => Promise<void>;
110
- /**
111
- * the chain storage path at which the node was
112
- * constructed
113
- */
114
- getPath: () => string;
115
- /**
116
- * DEPRECATED use getPath
117
- */
118
- getStoreKey: () => Promise<VStorageKey>;
119
- makeChildNode: (subPath: string, options?: {
120
- sequence?: boolean;
121
- }) => StorageNode;
122
- };
105
+ export type StorageNode = import("./types.js").StorageNode;
123
106
  export type StoredFacet = {
124
107
  /**
125
108
  * the chain storage path at which the
@@ -172,7 +155,7 @@ export type StorageMessage = {
172
155
  };
173
156
  import type { Remote } from './types.js';
174
157
  import type { ERef } from '@endo/far';
175
- import type { TypedPattern } from './types.js';
158
+ import type { CastedPattern } from '@endo/patterns';
176
159
  import type { Zone } from '@agoric/base-zone';
177
160
  import type { Callback } from './types.js';
178
161
  import type { ERemote } from './types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"lib-chainStorage.d.ts","sourceRoot":"","sources":["lib-chainStorage.js"],"names":[],"mappings":"AAiPA;;;;;;;;;;;;GAYG;AACH,2DATW,CAAC,OAAO,EAAE,cAAc,KAAK,GAAG,YAGhC,MAAM,gBAEd;IAA8B,QAAQ;CAGxC;;mBAnEqB,OAAO,CAAC,WAAW,CAAC;wBAWzB,MAAM,qBACO;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GACtC,WAAW;oBAYA,MAAM,GAAK,OAAO,CAAC,IAAI,CAAC;GAqDhD;AAcD;;;;;;;;GAQG;AACH,qDAJW,KAAK,OAAO,WAAW,CAAC,GAAG,IAAI,CAAC,aAChC,MAAM,GACJ,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAMxC;AA3RD;;;;;;;GAOG;AAEH,6CAA6C;AAC7C,8DAA8D;AAE9D;;;;;;;;GAQG;AAEH;;;;;;GAMG;AAEH,uCAAuC;AACvC,8BADW,aAAa,UAAU,CAAC,CAIhC;AAwCI,mCAHI,GAAG,GACD,IAAI,IAAI,UAAU,CAOa;AAmB5C,q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IAAI,CAAC,CAQ9C;yBAtTa,QAAQ,OAAO,CAAC;2BAChB,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC;;;;;;;;eAS/B,MAAM;iBACN,MAAM;;;;uBAMN,CAAC;;;;;iBAED,MAAM;YAEN,CAAC,EAAE;;;;;;;;;;;;;;;;0BAwBJ,OAAO,YAAY,EAAE,WAAW;;;;;;aA6C/B,MAAM,OAAO,CAAC,MAAM,CAAC;;;;iBAErB,WAAW,CAAC,aAAa,CAAC;;;;;qBAC1B,MAAM,YAAY;;;;;4CAqBnB,KAAK,GACX,aAAa,GACb,KAAK,GACL,UAAU,GACV,SAAS,GACT,QAAQ,GACR,MAAM;;;;gDAGA,KAAK,GAAG,kBAAkB,GAAG,QAAQ;;;;mCAGrC,6BAA6B,GACnC,iCAAiC;;;;0CAG3B,CAAC,IAAI,EAAE,MAAM,CAAC;;;;2BAEd,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;;;;8CAErC,YAAY,EAAE;;;;6BAEd;IACJ,MAAM,EAAE,6BAA6B,CAAC;IACtC,IAAI,EAAE,2BAA2B,CAAC;CACnC,GACD;IACE,MAAM,EAAE,iCAAiC,CAAC;IAC1C,IAAI,EAAE,+BAA+B,CAAC;CACvC;4BAvJ0B,YAAY;0BAFvB,WAAW;mCAMF,gBAAgB;0BAFzB,mBAAmB;8BACf,YAAY;6BAHL,YAAY;iCAChB,8BAA8B;8BAFxB,eAAe;6BAAf,eAAe"}
@@ -7,12 +7,15 @@ import { makeHeapZone } from '@agoric/base-zone/heap.js';
7
7
  import * as cb from './callback.js';
8
8
 
9
9
  /**
10
+ * @import {RemotableBrand} from '@endo/eventual-send';
10
11
  * @import {ERef} from '@endo/far';
11
12
  * @import {Marshal, Passable} from '@endo/marshal';
12
- * @import {Remote, ERemote, TypedPattern} from './types.js';
13
+ * @import {Remote, ERemote} from './types.js';
13
14
  * @import {EMarshaller} from './marshal/wrap-marshaller.js';
14
15
  * @import {Zone} from '@agoric/base-zone';
15
16
  * @import {Callback} from './types.js';
17
+ * @import {CastedPattern} from '@endo/patterns';
18
+ * @import {MatcherOf} from '@endo/patterns';
16
19
  */
17
20
 
18
21
  /** @typedef {Marshal<unknown>} Marshaller */
@@ -21,10 +24,13 @@ import * as cb from './callback.js';
21
24
  /**
22
25
  * Defined by vstorageStoreKey in vstorage.go
23
26
  *
27
+ * The backend provides all properties but for mock data flexibility we allow
28
+ * some to be optional in the JS typedef.
29
+ *
24
30
  * @typedef VStorageKey
25
31
  * @property {string} storeName
26
32
  * @property {string} storeSubkey
27
- * @property {string} dataPrefixBytes
33
+ * @property {string} [dataPrefixBytes]
28
34
  * @property {string} [noDataValue]
29
35
  */
30
36
 
@@ -36,12 +42,13 @@ import * as cb from './callback.js';
36
42
  * @property {T[]} values
37
43
  */
38
44
 
39
- /** @type {TypedPattern<StreamCell>} */
45
+ /** @type {CastedPattern<StreamCell>} */
40
46
  export const StreamCellShape = harden({
41
47
  blockHeight: M.string(),
42
48
  values: M.array(),
43
49
  });
44
50
 
51
+ // eslint-disable-next-line @agoric/group-jsdoc-imports, @agoric/no-typedef-import -- top level import would conflict
45
52
  /**
46
53
  * This represents a node in an IAVL tree.
47
54
  *
@@ -52,24 +59,35 @@ export const StreamCellShape = harden({
52
59
  * identifies children by restricted ASCII name and is associated with arbitrary
53
60
  * string-valued data for each node, defaulting to the empty string.
54
61
  *
55
- * @typedef {object} StorageNode
56
- * @property {(data: string) => Promise<void>} setValue publishes some data
57
- * @property {() => string} getPath the chain storage path at which the node was
58
- * constructed
59
- * @property {() => Promise<VStorageKey>} getStoreKey DEPRECATED use getPath
60
- * @property {(
61
- * subPath: string,
62
- * options?: { sequence?: boolean },
63
- * ) => StorageNode} makeChildNode
62
+ * Defined as an interface in ./types.ts so its per-property documentation
63
+ * survives declaration emit. Re-exported here as an alias so existing
64
+ * `from '@agoric/internal/src/lib-chainStorage.js'` importers keep working.
65
+ *
66
+ * @typedef {import('./types.js').StorageNode} StorageNode
64
67
  */
65
68
 
66
69
  const ChainStorageNodeI = M.interface('StorageNode', {
67
70
  setValue: M.callWhen(M.string()).returns(),
68
71
  getPath: M.call().returns(M.string()),
69
- getStoreKey: M.callWhen().returns(M.record()),
72
+ getStoreKey: M.callWhen().returns(
73
+ M.splitRecord(
74
+ {
75
+ storeName: M.string(),
76
+ storeSubkey: M.string(),
77
+ },
78
+ {
79
+ dataPrefixBytes: M.string(),
80
+ noDataValue: M.string(),
81
+ },
82
+ ),
83
+ ),
70
84
  makeChildNode: M.call(M.string())
71
85
  .optional(M.splitRecord({}, { sequence: M.boolean() }, {}))
72
- .returns(M.remotable('StorageNode')),
86
+ .returns(
87
+ /** @type {MatcherOf<'remotable', StorageNode>} */ (
88
+ M.remotable('StorageNode')
89
+ ),
90
+ ),
73
91
  });
74
92
 
75
93
  /**
@@ -148,6 +166,11 @@ harden(assertPathSegment);
148
166
 
149
167
  /**
150
168
  * @param {Zone} zone
169
+ * @returns {(
170
+ * messenger: Callback<(message: StorageMessage) => any>,
171
+ * path: string,
172
+ * options?: { sequence?: boolean },
173
+ * ) => StorageNode}
151
174
  */
152
175
  export const prepareChainStorageNode = zone => {
153
176
  /**
@@ -251,6 +274,7 @@ const makeHeapChainStorageNode = prepareChainStorageNode(makeHeapZone());
251
274
  * @param {boolean} [rootOptions.sequence] employ a wrapping structure that
252
275
  * preserves each value set within a single block, and default child nodes to
253
276
  * do the same
277
+ * @returns {StorageNode}
254
278
  */
255
279
  export function makeChainStorageRoot(
256
280
  handleStorageMessage,
@@ -24,14 +24,7 @@ export function makeAsyncQueue<T>(): {
24
24
  export function makeFakeStorageKit(rootPath: string, rootOptions?: Parameters<typeof makeChainStorageRoot>[2], { eachMessage }?: {
25
25
  eachMessage?: (m: StorageMessage) => void;
26
26
  }): {
27
- rootNode: import("@endo/exo").Guarded<{
28
- getPath(): string;
29
- getStoreKey(): Promise<VStorageKey>;
30
- makeChildNode(name: string, childNodeOptions?: {
31
- sequence?: boolean;
32
- }): StorageNode;
33
- setValue(value: string): Promise<void>;
34
- }>;
27
+ rootNode: import("./types.js").StorageNode;
35
28
  data: Map<string, string>;
36
29
  updateNewCellBlockHeight: (blockHeight?: number) => void;
37
30
  getValues: (path: string) => string[];
@@ -70,7 +63,7 @@ export type MockChainStorageRootMethods = {
70
63
  export type MockChainStorageRoot = StorageNode & MockChainStorageRootMethods;
71
64
  import { makeChainStorageRoot } from './lib-chainStorage.js';
72
65
  import type { StorageMessage } from './lib-chainStorage.js';
73
- import type { StorageNode } from './lib-chainStorage.js';
74
66
  import type { ExecutionContext } from 'ava';
75
67
  import type { Marshaller } from './lib-chainStorage.js';
68
+ import type { StorageNode } from './lib-chainStorage.js';
76
69
  //# sourceMappingURL=storage-test-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage-test-utils.d.ts","sourceRoot":"","sources":["storage-test-utils.js"],"names":[],"mappings":"AA0BO,yCAHI,MAAM,UACN,MAAM,0GAGC;AAElB;;;GAGG;AACH;;;;;EAEG;;eAMU,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO;mBAEzB,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM;;AA8CjC,8CAtBuB,GAAG,KAAK,GAAG,CAsB+B;AAa1D,+BAFM,CAAC;oBASA,CAAC;;;;;EA6Bd;AAWM,6CAJI,MAAM,gBACN,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,oBAC1C;IAAE,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAA;CAAE;;;;;oBAwD3B,CAAC;;;;UA4FT,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;;sBAd3B,MAAM,KACJ,MAAM,EAAE;;0BA/FP,cAAc;;;2IAAd,cAAc;;;;EAkH7B;AAoBM,4CADO,oBAAoB,CA2BjC;AAUM,yCAPI,iBAAiB,OAAO,CAAC,WACzB,oBAAoB,GAAG,cAAc,QACrC,CAAC;IAAE,IAA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O,CAAC,WACzB,oBAAoB,GAAG,cAAc,QACrC,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GAC9D,CAAK;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,EAAE,CAAC,GAAG;IAChD,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;CACpC,iBAoDL;6BAxGa,UAAU,CAAC,OAAO,kBAAkB,CAAC;;;;;;;;aAIrC,CACT,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,UAAU,EACvB,KAAK,CAAC,EAAE,MAAM,KACX,OAAO;UAKD,MAAM,MAAM,EAAE;;mCAEd,WAAW,GAAG,2BAA2B;qCAxTJ,uBAAuB;oCAOU,uBAAuB;sCACxE,KAAK;gCAD4C,uBAAuB;iCAAvB,uBAAuB"}
@@ -1,9 +1,5 @@
1
- /**
2
- * @import {MustMatch, PatternType, TypedPattern} from './types.js';
3
- */
4
- /** @type {MustMatch} */
5
- export const mustMatch: MustMatch;
6
- export function cast<M>(specimen: unknown, patt: TypedPattern<M>): M;
7
- import type { MustMatch } from './types.js';
8
- import type { TypedPattern } from './types.js';
1
+ export { mustMatch };
2
+ export function cast<M>(specimen: unknown, patt: CastedPattern<M>): M;
3
+ import { mustMatch } from '@endo/patterns';
4
+ import type { CastedPattern } from '@endo/patterns';
9
5
  //# sourceMappingURL=typeCheck.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typeCheck.d.ts","sourceRoot":"","sources":["typeCheck.js"],"names":[],"mappings":"AAGA;;GAEG;AAEH,wBAAwB;AACxB,wBADW,SAAS,CACuB;AAQpC,qBALM,CAAC,YACH,OAAO,QACP,aAAa,CAAC,CAAC,GACb,CAAC,CAQb;+BAlBsD,YAAY;kCAAZ,YAAY"}
1
+ {"version":3,"file":"typeCheck.d.ts","sourceRoot":"","sources":["typeCheck.js"],"names":[],"mappings":";AAqBO,qBALM,CAAC,YACH,OAAO,QACP,cAAc,CAAC,CAAC,GACd,CAAC,CAUb;0BA5ByB,gBAAgB;mCAGV,gBAAgB"}
package/src/typeCheck.js CHANGED
@@ -1,17 +1,22 @@
1
1
  // @ts-check
2
- import { mustMatch as typelessMustMatch } from '@endo/patterns';
2
+ import { mustMatch } from '@endo/patterns';
3
3
 
4
4
  /**
5
- * @import {MustMatch, PatternType, TypedPattern} from './types.js';
5
+ * @import {CastedPattern} from '@endo/patterns';
6
6
  */
7
7
 
8
- /** @type {MustMatch} */
9
- export const mustMatch = typelessMustMatch;
8
+ /**
9
+ * Re-exported from `@endo/patterns`, which now narrows `specimen` to the
10
+ * pattern's type. Prefer importing `mustMatch` from `@endo/patterns` directly.
11
+ *
12
+ * @deprecated import from `@endo/patterns` instead
13
+ */
14
+ export { mustMatch };
10
15
 
11
16
  /**
12
17
  * @template M
13
18
  * @param {unknown} specimen
14
- * @param {TypedPattern<M>} patt
19
+ * @param {CastedPattern<M>} patt
15
20
  * @returns {M}
16
21
  */
17
22
  export const cast = (specimen, patt) => {
@@ -19,5 +24,7 @@ export const cast = (specimen, patt) => {
19
24
  // type but a function can't both narrow and return a type. That is by design:
20
25
  // https://github.com/microsoft/TypeScript/issues/34636#issuecomment-545025916
21
26
  mustMatch(specimen, patt);
22
- return specimen;
27
+ // The assertion narrows `specimen`, but inside this generic body TS keeps an
28
+ // `unknown extends M` conditional that doesn't collapse to `M`, so re-assert.
29
+ return /** @type {M} */ (specimen);
23
30
  };
@@ -1,7 +1,7 @@
1
1
  /**
2
- * @import {TypedPattern} from './types.js';
2
+ * @import {CastedPattern} from '@endo/patterns';
3
3
  */
4
- export const StorageNodeShape: import("@endo/patterns").Matcher;
4
+ export const StorageNodeShape: import("@endo/patterns").MatcherOf<"remotable", any>;
5
5
  /** To be used only for 'helper' facets where the calls are from trusted code. */
6
6
  export const UnguardedHelperI: import("@endo/patterns").InterfaceGuard<any>;
7
7
  /**
@@ -10,14 +10,14 @@ export const UnguardedHelperI: import("@endo/patterns").InterfaceGuard<any>;
10
10
  * either a JS number or a stringified JS bigint.
11
11
  */
12
12
  /**
13
- * @type {TypedPattern<BridgeBigInt>}
13
+ * @type {CastedPattern<BridgeBigInt>}
14
14
  */
15
- export const BridgeBigIntShape: TypedPattern<BridgeBigInt>;
15
+ export const BridgeBigIntShape: CastedPattern<BridgeBigInt>;
16
16
  /**
17
17
  * Ensure that callees passed a
18
18
  * bridge message that was serialised from a Golang int64 or uint64 accept
19
19
  * either a JS number or a stringified JS bigint.
20
20
  */
21
21
  export type BridgeBigInt = number | `${bigint}`;
22
- import type { TypedPattern } from './types.js';
22
+ import type { CastedPattern } from '@endo/patterns';
23
23
  //# sourceMappingURL=typeGuards.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH,gEAA2D;AAE3D,iFAAiF;AACjF,4EAKE;AAEF;;;;GAIG;AAEH;;GAEG;AACH,gCAFU,aAAa,YAAY,CAAC,CAE0B;;;;;;2BARjD,MAAM,GAAG,GAAG,MAAM,EAAE;kCAdF,YAAY"}
1
+ {"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH,oFAA2D;AAE3D,iFAAiF;AACjF,4EAKE;AAEF;;;;GAIG;AAEH;;GAEG;AACH,gCAFU,cAAc,YAAY,CAAC,CAEyB;;;;;;2BARjD,MAAM,GAAG,GAAG,MAAM,EAAE;mCAdD,gBAAgB"}
package/src/typeGuards.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import { M } from '@endo/patterns';
4
4
 
5
5
  /**
6
- * @import {TypedPattern} from './types.js';
6
+ * @import {CastedPattern} from '@endo/patterns';
7
7
  */
8
8
 
9
9
  export const StorageNodeShape = M.remotable('StorageNode');
@@ -23,6 +23,6 @@ export const UnguardedHelperI = M.interface(
23
23
  */
24
24
 
25
25
  /**
26
- * @type {TypedPattern<BridgeBigInt>}
26
+ * @type {CastedPattern<BridgeBigInt>}
27
27
  */
28
28
  export const BridgeBigIntShape = M.or(M.number(), M.string());
package/src/types.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { ERef, RemotableBrand } from '@endo/eventual-send';
2
2
  import type { Primitive, RemotableObject } from '@endo/pass-style';
3
- import type { Pattern } from '@endo/patterns';
3
+ import type { CastedPattern } from '@endo/patterns';
4
4
  import type { Callable } from './ses-utils.js';
5
+ import type { VStorageKey } from './lib-chainStorage.js';
5
6
  /**
6
7
  * A mapping of a tuple type (as from `Parameters<...>`) into a corresponding
7
8
  * object type with named fields.
@@ -79,22 +80,33 @@ export type Remote<Primary, Local = DataOnly<Primary>> = Primary | RemotableBran
79
80
  * near or marshalled. @see {ERef} and @see {Remote}.
80
81
  */
81
82
  export type ERemote<Primary, Local = DataOnly<Primary>> = ERef<Remote<Primary, Local>>;
82
- declare const validatedType: 'Symbol(validatedType)';
83
83
  /**
84
- * Tag a pattern with the static type it represents.
84
+ * Tag a pattern with the static type it represents. Endo's `mustMatch` and
85
+ * `matches` narrow a specimen to this type.
86
+ *
87
+ * @deprecated Use {@link CastedPattern} from `@endo/patterns` directly.
85
88
  */
86
- export type TypedPattern<T> = Pattern & {
87
- [validatedType]?: T;
88
- };
89
- export declare type PatternType<TM extends TypedPattern<any>> = TM extends TypedPattern<infer T> ? T : never;
89
+ export type TypedPattern<T> = CastedPattern<T>;
90
+ export type { TraceLogger } from './debug.js';
90
91
  /**
91
- * Returning normally indicates success. Match failure is indicated by
92
- * throwing.
92
+ * This represents a node in an IAVL tree.
93
93
  *
94
- * Note: remotables can only be matched as "remotable", not the specific kind.
94
+ * The active implementation is x/vstorage, an Agoric extension of the Cosmos
95
+ * SDK.
95
96
  *
96
- * @see {endoMustMatch} for the implementation. This one has a type annotation to narrow if the pattern is a TypedPattern.
97
+ * Vstorage is a hierarchical externally-reachable storage structure that
98
+ * identifies children by restricted ASCII name and is associated with arbitrary
99
+ * string-valued data for each node, defaulting to the empty string.
97
100
  */
98
- export declare type MustMatch = <P extends Pattern>(specimen: unknown, pattern: P, label?: string | number) => asserts specimen is P extends TypedPattern<any> ? PatternType<P> : unknown;
99
- export type { TraceLogger } from './debug.js';
101
+ export interface StorageNode extends RemotableObject {
102
+ /** publishes some data */
103
+ setValue: (data: string) => Promise<void>;
104
+ /** the chain storage path at which the node was constructed */
105
+ getPath: () => string;
106
+ /** @deprecated use getPath */
107
+ getStoreKey: () => Promise<VStorageKey>;
108
+ makeChildNode: (subPath: string, options?: {
109
+ sequence?: boolean;
110
+ }) => StorageNode;
111
+ }
100
112
  //# sourceMappingURL=types.d.ts.map
@@ -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,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnE,OAAO,KAAK,EAA8B,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,SAAS,OAAO,EAAE,EAChC,KAAK,SAAS,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,EAAE,MAAM,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,IACjE;KAAG,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,EAAE,MAAM,GAAG,EAAE,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;CAAE,CAAC;AAEvE;;;GAGG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,C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AK,CAAC,CACvB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;AAE/C,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD,0BAA0B;IAC1B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,+DAA+D;IAC/D,OAAO,EAAE,MAAM,MAAM,CAAC;IACtB,8BAA8B;IAC9B,WAAW,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IACxC,aAAa,EAAE,CACb,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAC7B,WAAW,CAAC;CAClB"}
package/src/types.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /* eslint-disable max-classes-per-file */
2
2
 
3
3
 
4
+
4
5
 
5
- // eslint-disable-next-line @typescript-eslint/no-unused-vars -- used in JSDoc
6
-
7
6
 
7
+
8
8
 
9
9
  /**
10
10
  * A mapping of a tuple type (as from `Parameters<...>`) into a corresponding
@@ -123,51 +123,35 @@
123
123
 
124
124
 
125
125
 
126
- /*
127
- * Stop-gap until https://github.com/Agoric/agoric-sdk/issues/6160
128
- * explictly specify the type that the Pattern will verify through a match.
129
- *
130
- * TODO move all this pattern typing stuff to @endo/patterns
131
- *
132
- * CAVEAT: We use a constant string here to avoid exposing a `unique symbol`
133
- * type publicly, such as with:
134
- *
135
- * @example
136
- * declare const mySymbol: unique symbol;
137
- *
138
- * Without this workaround, we've observed errors when using at least
139
- * `typescript@5.9.3`'s `tsc` to generate declaration files (.d.ts) for
140
- * consumers of modules that in turn import the declaration:
141
- *
142
- * @example
143
- * error TS9006: Declaration emit for this file requires using private name
144
- * 'tag' from module '.../internal/src/tagged"'. An explicit
145
- * type annotation may unblock declaration emit.
146
- */
147
- // declare const validatedType: unique symbol;
148
-
149
-
150
126
  /**
151
- * Tag a pattern with the static type it represents.
127
+ * Tag a pattern with the static type it represents. Endo's `mustMatch` and
128
+ * `matches` narrow a specimen to this type.
129
+ *
130
+ * @deprecated Use {@link CastedPattern} from `@endo/patterns` directly.
152
131
  */
153
-
154
-
155
-
156
132
 
157
133
 
158
- // TODO make Endo's mustMatch do this
134
+
135
+
159
136
  /**
160
- * Returning normally indicates success. Match failure is indicated by
161
- * throwing.
137
+ * This represents a node in an IAVL tree.
162
138
  *
163
- * Note: remotables can only be matched as "remotable", not the specific kind.
139
+ * The active implementation is x/vstorage, an Agoric extension of the Cosmos
140
+ * SDK.
164
141
  *
165
- * @see {endoMustMatch} for the implementation. This one has a type annotation to narrow if the pattern is a TypedPattern.
142
+ * Vstorage is a hierarchical externally-reachable storage structure that
143
+ * identifies children by restricted ASCII name and is associated with arbitrary
144
+ * string-valued data for each node, defaulting to the empty string.
166
145
  */
167
-
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
168
154
 
169
-
170
-
171
-
172
-
173
-
155
+
156
+
157
+
@@ -1,7 +1,7 @@
1
1
  export namespace UpgradeDisconnectionShape {
2
2
  let name: string;
3
- let upgradeMessage: import("@endo/patterns").Matcher;
4
- let incarnationNumber: import("@endo/patterns").Matcher;
3
+ let upgradeMessage: import("@endo/patterns").MatcherOf<"string", string>;
4
+ let incarnationNumber: import("@endo/patterns").MatcherOf<"number", number>;
5
5
  }
6
6
  export function makeUpgradeDisconnection(upgradeMessage: string, toIncarnationNumber: number): UpgradeDisconnection;
7
7
  export function isUpgradeDisconnection(reason: any): reason is UpgradeDisconnection;