@agoric/internal 0.3.3-dev-4687f0d.0 → 0.3.3-dev-0282e58.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-4687f0d.0+4687f0d",
3
+ "version": "0.3.3-dev-0282e58.0+0282e58",
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-4687f0d.0+4687f0d",
24
- "@agoric/base-zone": "0.1.1-dev-4687f0d.0+4687f0d",
23
+ "@agoric/assert": "0.6.1-dev-0282e58.0+0282e58",
24
+ "@agoric/base-zone": "0.1.1-dev-0282e58.0+0282e58",
25
25
  "@endo/common": "^1.2.2",
26
26
  "@endo/far": "^1.1.2",
27
27
  "@endo/init": "^1.1.2",
@@ -58,5 +58,5 @@
58
58
  "typeCoverage": {
59
59
  "atLeast": 93.89
60
60
  },
61
- "gitHead": "4687f0d7dcdb2c3554f327ea54a4eb72f0dda7fb"
61
+ "gitHead": "0282e584c0aeaea977d1ecb5cccdba8173b73bb6"
62
62
  }
@@ -27,6 +27,15 @@ export function makeFakeStorageKit(rootPath: string, rootOptions?: Parameters<ty
27
27
  } | null | undefined;
28
28
  };
29
29
  export function makeMockChainStorageRoot(): MockChainStorageRoot;
30
+ export function documentStorageSchema(t: import("ava").ExecutionContext<unknown>, storage: MockChainStorageRoot | FakeStorageKit, opts: ({
31
+ note: string;
32
+ } | {
33
+ node: string;
34
+ owner: string;
35
+ }) & ({
36
+ pattern: string;
37
+ replacement: string;
38
+ } | {})): Promise<void>;
30
39
  /**
31
40
  * A map corresponding with a total function such that `get(key)` is assumed to
32
41
  * always succeed.
@@ -1 +1 @@
1
- {"version":3,"file":"storage-test-utils.d.ts","sourceRoot":"","sources":["storage-test-utils.js"],"names":[],"mappings":"AAqCO,yCAHI,MAAM,UACN,MAAM,0GAGC;AAElB;;;GAGG;AACH;;;;;EAEG;AA4CH,8CAtBuB,GAAG,KAAK,GAAG,CAsB+B;AAU1D,6CAHI,MAAM,gBACN,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;;;;uDAqGtC;YAAE,QAAS,CAAC,UAAS;SAAE;;;UAIjB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;EAIvC;AAoBM,4CADO,oBAAoB,CA6BjC;;;;;qBAzOe,CAAC,EAAK,CAAC,IADV,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CACtB,CAAC,AADuB,EAClB,CAAC,AADoB,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,CAC1C,CAAC,AAD2C,EACtC,CAAC,AADwC,CAAC,CAAC,CAAC,CAAC,GAAE,GAAG;IACvE,GAAO,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;CACpB;yBAIS,CAAC,IAAD,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK;6BAsLvD,UAAU,CAAC,OAAO,kBAAkB,CAAC;;;;;;;;oBAKxC,MAAM;;;;;2BAEJ,MAAM,KACX,OAAO;UAKD,MAAM,MAAM,EAAE;;;qCAzNuB,uBAAuB;iCAIF,uBAAuB;oCAAvB,uBAAuB"}
1
+ {"version":3,"file":"storage-test-utils.d.ts","sourceRoot":"","sources":["storage-test-utils.js"],"names":[],"mappings":"AAsCO,yCAHI,MAAM,UACN,MAAM,0GAGC;AAElB;;;GAGG;AACH;;;;;EAEG;AA4CH,8CAtBuB,GAAG,KAAK,GAAG,CAsB+B;AAU1D,6CAHI,MAAM,gBACN,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;;;;uDAkGtB;YAAE,QAAS,CAAC,UAAS;SAAE;;;UAOjC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;EAIvC;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;;;;;qBAjRe,CAAC,EAAK,CAAC,IADV,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CACtB,CAAC,AADuB,EAClB,CAAC,AADoB,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,CAC1C,CAAC,AAD2C,EACtC,CAAC,AADwC,CAAC,CAAC,CAAC,CAAC,GAAE,GAAG;IACvE,GAAO,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;CACpB;yBAIS,CAAC,IAAD,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK;6BAsLvD,UAAU,CAAC,OAAO,kBAAkB,CAAC;;;;;;;;oBAKxC,MAAM;;;;;2BAEJ,MAAM,KACX,OAAO;UAKD,MAAM,MAAM,EAAE;;;qCA1NuB,uBAAuB;iCAKF,uBAAuB;oCAAvB,uBAAuB"}
@@ -5,6 +5,7 @@ import { unmarshalFromVstorage } from './marshal.js';
5
5
  import { makeTracer } from './debug.js';
6
6
  import { isStreamCell, makeChainStorageRoot } from './lib-chainStorage.js';
7
7
  import { bindAllMethods } from './method-tools.js';
8
+ import { eventLoopIteration } from './testing-utils.js';
8
9
 
9
10
  /**
10
11
  * @import {Marshaller, StorageEntry, StorageMessage, StorageNode} from './lib-chainStorage.js';
@@ -254,3 +255,43 @@ export const makeMockChainStorageRoot = () => {
254
255
  keys: () => [...data.keys()],
255
256
  });
256
257
  };
258
+
259
+ /**
260
+ * @param {import('ava').ExecutionContext<unknown>} t
261
+ * @param {MockChainStorageRoot | FakeStorageKit} storage
262
+ * @param {({ note: string } | { node: string; owner: string }) &
263
+ * ({ pattern: string; replacement: string } | {})} opts
264
+ */
265
+ export const documentStorageSchema = async (t, storage, opts) => {
266
+ // chainStorage publication is unsynchronized
267
+ await eventLoopIteration();
268
+
269
+ const [keys, getBody] =
270
+ 'keys' in storage
271
+ ? [storage.keys(), (/** @type {string} */ k) => storage.getBody(k)]
272
+ : [storage.data.keys(), (/** @type {string} */ k) => storage.data.get(k)];
273
+
274
+ const { pattern, replacement } =
275
+ 'pattern' in opts
276
+ ? opts
277
+ : { pattern: 'mockChainStorageRoot.', replacement: 'published.' };
278
+ const illustration = [...keys].sort().map(
279
+ /** @type {(k: string) => [string, unknown]} */
280
+ key => [key.replace(pattern, replacement), getBody(key)],
281
+ );
282
+ const pruned = illustration.filter(
283
+ 'node' in opts
284
+ ? ([key, _]) => key.startsWith(`published.${opts.node}`)
285
+ : _entry => true,
286
+ );
287
+
288
+ const note =
289
+ 'note' in opts
290
+ ? opts.note
291
+ : `Under "published", the "${opts.node}" node is delegated to ${opts.owner}.`;
292
+ const boilerplate = `
293
+ The example below illustrates the schema of the data published there.
294
+
295
+ See also board marshalling conventions (_to appear_).`;
296
+ t.snapshot(pruned, note + boilerplate);
297
+ };