@agoric/internal 0.3.3-dev-1d5cb99.0 → 0.3.3-dev-8a52ddd.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/internal",
3
- "version": "0.3.3-dev-1d5cb99.0+1d5cb99",
3
+ "version": "0.3.3-dev-8a52ddd.0+8a52ddd",
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": "tsc"
21
21
  },
22
22
  "dependencies": {
23
- "@agoric/base-zone": "0.1.1-dev-1d5cb99.0+1d5cb99",
23
+ "@agoric/base-zone": "0.1.1-dev-8a52ddd.0+8a52ddd",
24
24
  "@endo/common": "^1.2.8",
25
25
  "@endo/errors": "^1.2.8",
26
26
  "@endo/far": "^1.1.9",
@@ -34,7 +34,7 @@
34
34
  "jessie.js": "^0.3.4"
35
35
  },
36
36
  "devDependencies": {
37
- "@agoric/cosmic-proto": "0.4.1-dev-1d5cb99.0+1d5cb99",
37
+ "@agoric/cosmic-proto": "0.4.1-dev-8a52ddd.0+8a52ddd",
38
38
  "@endo/exo": "^1.5.7",
39
39
  "@endo/init": "^1.1.7",
40
40
  "ava": "^5.3.0",
@@ -60,5 +60,5 @@
60
60
  "typeCoverage": {
61
61
  "atLeast": 93.14
62
62
  },
63
- "gitHead": "1d5cb990533dd737923e17c9537fe3963b06d5c5"
63
+ "gitHead": "8a52dddcda0af5eaedeca94bebcffd88bb8eebae"
64
64
  }
@@ -38,7 +38,9 @@ export function documentStorageSchema(t: import("ava").ExecutionContext<unknown>
38
38
  }) & ({
39
39
  pattern: string;
40
40
  replacement: string;
41
- } | {})): Promise<void>;
41
+ } | {}) & {
42
+ showValue?: (v: string) => unknown;
43
+ }): Promise<void>;
42
44
  export type FakeStorageKit = ReturnType<typeof makeFakeStorageKit>;
43
45
  export type MockChainStorageRootMethods = {
44
46
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"storage-test-utils.d.ts","sourceRoot":"","sources":["storage-test-utils.js"],"names":[],"mappings":"AAwBO,yCAHI,MAAM,UACN,MAAM,6GAGC;AAElB;;;GAGG;AACH;;;;;EAEG;AA4CH,8CAtBuB,GAAG,KAAK,GAAG,CAsB+B;AAU1D,6CAHI,MAAM,gBACN,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;;;;;oBA2GjD,CAAA;;;;UAEiB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;;0BAjFxB,cAAc;;;0JAAd,cAAc;;;;EAqF7B;AAoBM,4CADO,oBAAoB,CA6BjC;AAQM,yCALI,OAAO,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,WACvC,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,iBAkCnD;6BAtFa,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;qCAjNJ,uBAAuB;iCAMF,uBAAuB;oCAAvB,uBAAuB;gCAAvB,uBAAuB"}
1
+ {"version":3,"file":"storage-test-utils.d.ts","sourceRoot":"","sources":["storage-test-utils.js"],"names":[],"mappings":"AAyBO,yCAHI,MAAM,UACN,MAAM,6GAGC;AAElB;;;GAGG;AACH;;;;;EAEG;AA4CH,8CAtBuB,GAAG,KAAK,GAAG,CAsB+B;AAU1D,6CAHI,MAAM,gBACN,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;;;;;oBAyGF,CAAC;;;;UAI/B,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;;0BAjFxB,cAAc;;;0JAAd,cAAc;;;;EAqF7B;AAoBM,4CADO,oBAAoB,CA6BjC;AAUM,yCAPI,OAAO,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,WACvC,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,iBAkDL;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;qCAlNJ,uBAAuB;iCAOF,uBAAuB;oCAAvB,uBAAuB;gCAAvB,uBAAuB"}
@@ -7,6 +7,7 @@ import { makeTracer } from './debug.js';
7
7
  import { isStreamCell, makeChainStorageRoot } from './lib-chainStorage.js';
8
8
  import { bindAllMethods } from './method-tools.js';
9
9
  import { eventLoopIteration } from './testing-utils.js';
10
+ import { NonNullish } from './errors.js';
10
11
 
11
12
  /**
12
13
  * @import {TotalMap} from './types.js';
@@ -250,30 +251,48 @@ export const makeMockChainStorageRoot = () => {
250
251
  * @param {import('ava').ExecutionContext<unknown>} t
251
252
  * @param {MockChainStorageRoot | FakeStorageKit} storage
252
253
  * @param {({ note: string } | { node: string; owner: string }) &
253
- * ({ pattern: string; replacement: string } | {})} opts
254
+ * ({ pattern: string; replacement: string } | {}) & {
255
+ * showValue?: (v: string) => unknown;
256
+ * }} opts
254
257
  */
255
258
  export const documentStorageSchema = async (t, storage, opts) => {
256
259
  // chainStorage publication is unsynchronized
257
260
  await eventLoopIteration();
258
261
 
262
+ const getLast = (/** @type {string} */ cell) =>
263
+ JSON.parse(cell).values.at(-1) || assert.fail();
264
+ const { showValue = s => s } = opts;
265
+ /** @type {(d: Map<string, string>, k: string) => unknown} */
266
+ const getBodyDefault = (d, k) => showValue(getLast(NonNullish(d.get(k))));
267
+
259
268
  const [keys, getBody] =
260
269
  'keys' in storage
261
270
  ? [storage.keys(), (/** @type {string} */ k) => storage.getBody(k)]
262
- : [storage.data.keys(), (/** @type {string} */ k) => storage.data.get(k)];
271
+ : [
272
+ storage.data.keys(),
273
+ (/** @type {string} */ k) => getBodyDefault(storage.data, k),
274
+ ];
263
275
 
264
276
  const { pattern, replacement } =
265
277
  'pattern' in opts
266
278
  ? opts
267
279
  : { pattern: 'mockChainStorageRoot.', replacement: 'published.' };
268
- const illustration = [...keys].sort().map(
280
+
281
+ const pruned = [...keys]
282
+ .sort()
283
+ .filter(
284
+ 'node' in opts
285
+ ? key =>
286
+ key
287
+ .replace(pattern, replacement)
288
+ .startsWith(`published.${opts.node}`)
289
+ : _entry => true,
290
+ );
291
+
292
+ const illustration = pruned.map(
269
293
  /** @type {(k: string) => [string, unknown]} */
270
294
  key => [key.replace(pattern, replacement), getBody(key)],
271
295
  );
272
- const pruned = illustration.filter(
273
- 'node' in opts
274
- ? ([key, _]) => key.startsWith(`published.${opts.node}`)
275
- : _entry => true,
276
- );
277
296
 
278
297
  const note =
279
298
  'note' in opts
@@ -283,5 +302,5 @@ export const documentStorageSchema = async (t, storage, opts) => {
283
302
  The example below illustrates the schema of the data published there.
284
303
 
285
304
  See also board marshalling conventions (_to appear_).`;
286
- t.snapshot(pruned, note + boilerplate);
305
+ t.snapshot(illustration, note + boilerplate);
287
306
  };