@agoric/internal 0.2.2-dev-263cf78.0 → 0.2.2-dev-c05c56e.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.2.2-dev-263cf78.0+263cf78",
3
+ "version": "0.2.2-dev-c05c56e.0+c05c56e",
4
4
  "description": "Externally unsupported utilities internal to agoric-sdk",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "263cf78ba3cc0400eb8c9a8c635f9ac205d36c82"
40
+ "gitHead": "c05c56e9a9131a727843890ce2a60d350a07272d"
41
41
  }
@@ -3,10 +3,10 @@ import { spawnSync } from 'child_process';
3
3
  import { createRequire } from 'module';
4
4
 
5
5
  const BUNDLE_SOURCE_PROGRAM = 'bundle-source';
6
- const require = createRequire(import.meta.url);
6
+ const req = createRequire(import.meta.url);
7
7
 
8
8
  export const createBundlesFromAbsolute = async sourceBundles => {
9
- const prog = require.resolve(`.bin/${BUNDLE_SOURCE_PROGRAM}`);
9
+ const prog = req.resolve(`.bin/${BUNDLE_SOURCE_PROGRAM}`);
10
10
 
11
11
  const cacheToArgs = new Map();
12
12
  for (const [srcPath, bundlePath] of sourceBundles) {
@@ -35,7 +35,7 @@ export const createBundlesFromAbsolute = async sourceBundles => {
35
35
 
36
36
  export const createBundles = async (sourceBundles, dirname = '.') => {
37
37
  const absBundleSources = sourceBundles.map(([srcPath, bundlePath]) => [
38
- require.resolve(srcPath, { paths: [dirname] }),
38
+ req.resolve(srcPath, { paths: [dirname] }),
39
39
  path.resolve(dirname, bundlePath),
40
40
  ]);
41
41
  return createBundlesFromAbsolute(absBundleSources);
@@ -54,7 +54,7 @@ export const extractProposalBundles = async (
54
54
  const install = async (src, bundleName) => {
55
55
  if (bundleName) {
56
56
  const bundlePath = path.resolve(home, bundleName);
57
- const srcPath = require.resolve(src, { paths: [home] });
57
+ const srcPath = req.resolve(src, { paths: [home] });
58
58
  if (toBundle.has(bundlePath)) {
59
59
  const oldSrc = toBundle.get(bundlePath);
60
60
  assert.equal(
@@ -27,6 +27,7 @@ export function makeChainStorageRoot(handleStorageMessage: (message: StorageMess
27
27
  export function makeStorageNodeChild(storageNodeRef: import('@endo/far').ERef<StorageNode | null>, childName: string): Promise<StorageNode>;
28
28
  /** @type {(name: string) => void} */
29
29
  export const assertPathSegment: (name: string) => void;
30
+ export function makeMarshallToStorage(storageNode: import('@endo/far').ERef<StorageNode>, marshaller: import('@endo/far').ERef<Marshaller>): (value: unknown) => Promise<void>;
30
31
  /**
31
32
  * Must match the switch in vstorage.go using `vstorageMessage` type
32
33
  */
@@ -1 +1 @@
1
- {"version":3,"file":"lib-chainStorage.d.ts","sourceRoot":"","sources":["lib-chainStorage.js"],"names":[],"mappings":"AAuDA;;;;;GAKG;AAEH;;;;;;;GAOG;AACH,qEALqB,cAAc,KAAK,GAAG,YAChC,MAAM;;4BA+DhB;AAUD;;;;;;;;GAQG;AACH,qDAJW,OAAO,WAAW,EAAE,IAAI,CAAC,WAAW,QAAE,aACtC,MAAM,GACJ,QAAQ,WAAW,CAAC,CAMhC;AAxGD,qCAAqC;AACrC,uCADkB,MAAM,KAAK,IAAI,CAI/B;;;;mCAMW,KAAK,GAAG,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAE,SAAS,GAAG,QAAQ,GAAE,MAAM;;;;6BAC9E;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC;yBApDzD,WAAW,cAAc,eAAe,EAAE,WAAW,CAAC;2BACtD,KAAK,UAAU,EAAE,aAAa,CAAC;;;;;eAM/B,MAAM;iBACN,MAAM;qBACN,MAAM;;;;;;;;;;;;;;;qBAaC,MAAM,KAAK,QAAQ,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E,OAAO,CAAA;KAAC,KAAK,WAAW;;;;;;aAKhE,MAAM,QAAQ,MAAM,CAAC;;;;iBACrB,WAAW,CAAC,aAAa,CAAC;;;;qBAC1B,MAAM,YAAY"}
@@ -152,3 +152,19 @@ export async function makeStorageNodeChild(storageNodeRef, childName) {
152
152
  return E(storageNode).makeChildNode(childName);
153
153
  }
154
154
  harden(makeStorageNodeChild);
155
+
156
+ /**
157
+ *
158
+ * @param {import('@endo/far').ERef<StorageNode>} storageNode
159
+ * @param {import('@endo/far').ERef<Marshaller>} marshaller
160
+ * @returns {(value: unknown) => Promise<void>}
161
+ */
162
+ export const makeMarshallToStorage = (storageNode, marshaller) => {
163
+ return value =>
164
+ E(marshaller)
165
+ .serialize(value)
166
+ .then(serialized => {
167
+ const encoded = JSON.stringify(serialized);
168
+ return E(storageNode).setValue(encoded);
169
+ });
170
+ };