@agoric/internal 0.2.2-dev-0ce9545.0 → 0.2.2-dev-0fc1914.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-0ce9545.0+0ce9545",
3
+ "version": "0.2.2-dev-0fc1914.0+0fc1914",
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 -p jsconfig.json"
21
21
  },
22
22
  "dependencies": {
23
- "@agoric/zone": "0.1.1-dev-0ce9545.0+0ce9545",
23
+ "@agoric/zone": "0.1.1-dev-0fc1914.0+0fc1914",
24
24
  "@endo/far": "^0.2.18",
25
25
  "@endo/marshal": "^0.8.5",
26
26
  "@endo/patterns": "^0.2.2",
@@ -42,5 +42,5 @@
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  },
45
- "gitHead": "0ce9545041d41022e605b48da6d2561287591c54"
45
+ "gitHead": "0fc1914edf1440ceeaa8c7c0ede955a60723e446"
46
46
  }
package/src/callback.d.ts CHANGED
@@ -5,26 +5,18 @@ export function makeFunctionCallback<I extends (...args: unknown[]) => any, T ex
5
5
  export function makeSyncMethodCallback<I extends (...args: unknown[]) => any, P extends PropertyKey, T extends { [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>; } = { [x_1 in P]: I; }, B extends unknown[] = []>(target: T, methodName: P, ...bound: B): import("./types").SyncCallback<I>;
6
6
  export function makeMethodCallback<I extends (...args: unknown[]) => any, P extends PropertyKey, T extends import("@endo/far").ERef<{ [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>; }> = import("@endo/far").ERef<{ [x_1 in P]: I; }>, B extends unknown[] = []>(target: T, methodName: P, ...bound: B): import("./types").Callback<I>;
7
7
  export function isCallback(callback: any): callback is import("./types").Callback<any>;
8
- export function prepareAttenuator<Methods extends {
9
- [x: string]: (this: any, ...args: unknown[]) => any;
10
- [x: number]: (this: any, ...args: unknown[]) => any;
11
- [x: symbol]: (this: any, ...args: unknown[]) => any;
12
- }>(zone: import('@agoric/zone').Zone, methodNames: (keyof Methods)[], { interfaceGuard, tag }?: {
8
+ export function prepareAttenuator<M extends PropertyKey>(zone: import('@agoric/zone').Zone, methodNames: M[], { interfaceGuard, tag }?: {
13
9
  interfaceGuard?: InterfaceGuard | undefined;
14
10
  tag?: string | undefined;
15
11
  }): (args_0: {
16
12
  target?: any;
17
13
  isSync?: boolean | undefined;
18
- overrides?: { [K in keyof Methods]?: import("./types").Callback<any> | null | undefined; } | undefined;
19
- }) => Methods & import("@endo/eventual-send").RemotableBrand<{}, Methods>;
20
- export function prepareGuardedAttenuator<Methods extends {
21
- [x: string]: (this: any, ...args: unknown[]) => any;
22
- [x: number]: (this: any, ...args: unknown[]) => any;
23
- [x: symbol]: (this: any, ...args: unknown[]) => any;
24
- }>(zone: import('@agoric/zone').Zone, interfaceGuard: InterfaceGuard, opts?: {
14
+ overrides?: { [K in M]?: import("./types").Callback<any> | null | undefined; } | undefined;
15
+ }) => { [K_1 in M]: (this: any, ...args: unknown[]) => any; } & import("@endo/eventual-send").RemotableBrand<{}, { [K_1 in M]: (this: any, ...args: unknown[]) => any; }>;
16
+ export function prepareGuardedAttenuator(zone: import('@agoric/zone').Zone, interfaceGuard: InterfaceGuard, opts?: {
25
17
  tag?: string | undefined;
26
- } | undefined): AttenuatorMaker<Methods>;
27
- export type AttenuatorMaker<T> = AttenuatorMaker<T>;
18
+ } | undefined): MakeAttenuator<any>;
19
+ export type MakeAttenuator<T> = MakeAttenuator<T>;
28
20
  export type Callback<I extends (...args: unknown[]) => any> = import('./types').Callback<I>;
29
21
  export type SyncCallback<I extends (...args: unknown[]) => any> = import('./types').SyncCallback<I>;
30
22
  export type Farable<T> = import('@endo/eventual-send').RemotableBrand<{}, T> & T;
@@ -1 +1 @@
1
- {"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["callback.js"],"names":[],"mappings":"AAuDO,6CALiB,OAAO,EAAE,KAAK,GAAG,sFAWxC;AAWM,0CALiB,OAAO,EAAE,KAAK,GAAG,oGAWxC;AAaM,6DAPiB,OAAO,EAAE,KAAK,GAAG,2JAaxC;AAeM,yDATiB,OAAO,EAAE,KAAK,GAAG,2MAexC;AAiBM,2DAXiB,OAAO,EAAE,KAAK,GAAG,iOAoBxC;AAiBM,uDAXiB,OAAO,EAAE,KAAK,GAAG,iRAmBxC;AAOM,qCAHI,GAAG,+CAeb;AAcM;wBARoC,GAAG,WAAW,OAAO,EAAE,KAAK,GAAG;wBAA/B,GAAG,WAAW,OAAO,EAAE,KAAK,GAAG;wBAA/B,GAAG,WAAW,OAAO,EAAE,KAAK,GAAG;SAC/D,OAAO,cAAc,EAAE,IAAI;IAGL,cAAc;IAEtB,GAAG;;aAmEb,GAAG;;;0EAoCjB;AAYM;wBANoC,GAAG,WAAW,OAAO,EAAE,KAAK,GAAG;wBAA/B,GAAG,WAAW,OAAO,EAAE,KAAK,GAAG;wBAA/B,GAAG,WAAW,OAAO,EAAE,KAAK,GAAG;SAC/D,OAAO,cAAc,EAAE,IAAI,kBAC3B,cAAc;;yCAUxB;;yCA7SuB,OAAO,EAAE,KAAK,GAAG,IAC5B,OAAO,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;6CAIlB,OAAO,EAAE,KAAK,GAAG,IAC5B,OAAO,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;yBAGpB,OAAO,qBAAqB,EAAE,cAAc,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC"}
1
+ {"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["callback.js"],"names":[],"mappings":"AAuDO,6CALiB,OAAO,EAAE,KAAK,GAAG,sFAWxC;AAWM,0CALiB,OAAO,EAAE,KAAK,GAAG,oGAWxC;AAaM,6DAPiB,OAAO,EAAE,KAAK,GAAG,2JAaxC;AAeM,yDATiB,OAAO,EAAE,KAAK,GAAG,2MAexC;AAiBM,2DAXiB,OAAO,EAAE,KAAK,GAAG,iOAoBxC;AAiBM,uDAXiB,OAAO,EAAE,KAAK,GAAG,iRAmBxC;AAOM,qCAHI,GAAG,+CAeb;AAcM,+DAPI,OAAO,cAAc,EAAE,IAAI;IAGL,cAAc;IAEtB,GAAG;;aAoEb,GAAG;;;2BA1DgB,GAAG,WAAW,OAAO,EAAE,KAAK,GAAG,4EAA/B,GAAG,WAAW,OAAO,EAAE,KAAK,GAAG,KA8FhE;AAWM,+CALI,OAAO,cAAc,EAAE,IAAI,kBAC3B,cAAc;;oCAYxB;;yCA/SuB,OAAO,EAAE,KAAK,GAAG,IAC5B,OAAO,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;6CAIlB,OAAO,EAAE,KAAK,GAAG,IAC5B,OAAO,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;yBAGpB,OAAO,qBAAqB,EAAE,cAAc,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC"}
package/src/callback.js CHANGED
@@ -14,7 +14,7 @@ const ownKeys =
14
14
 
15
15
  /**
16
16
  * @template T
17
- * @typedef {(...args: Parameters<ReturnType<prepareAttenuator>>) => Farable<T>} AttenuatorMaker
17
+ * @typedef {(...args: Parameters<ReturnType<prepareAttenuator>>) => Farable<T>} MakeAttenuator
18
18
  */
19
19
 
20
20
  /**
@@ -192,9 +192,9 @@ harden(isCallback);
192
192
  /**
193
193
  * Prepare an attenuator class whose methods can be redirected via callbacks.
194
194
  *
195
- * @template {{ [K in PropertyKey]: (this: any, ...args: unknown[]) => any}} Methods
195
+ * @template {PropertyKey} M
196
196
  * @param {import('@agoric/zone').Zone} zone The zone in which to allocate attenuators.
197
- * @param {(keyof Methods)[]} methodNames Methods to forward.
197
+ * @param {M[]} methodNames Methods to forward.
198
198
  * @param {object} opts
199
199
  * @param {InterfaceGuard} [opts.interfaceGuard] An interface guard for the
200
200
  * new attenuator.
@@ -207,7 +207,8 @@ export const prepareAttenuator = (
207
207
  ) => {
208
208
  /**
209
209
  * @typedef {(this: any, ...args: unknown[]) => any} Method
210
- * @typedef {{ [K in keyof Methods]?: Callback<any> | null}} Overrides
210
+ * @typedef {{ [K in M]?: Callback<any> | null}} Overrides
211
+ * @typedef {{ [K in M]: (this: any, ...args: unknown[]) => any }} Methods
211
212
  */
212
213
  const methods = /** @type {Methods} */ (
213
214
  fromEntries(
@@ -307,7 +308,6 @@ harden(prepareAttenuator);
307
308
  /**
308
309
  * Prepare an attenuator whose methodNames are derived from the interfaceGuard.
309
310
  *
310
- * @template {{ [K in PropertyKey]: (this: any, ...args: unknown[]) => any}} Methods
311
311
  * @param {import('@agoric/zone').Zone} zone
312
312
  * @param {InterfaceGuard} interfaceGuard
313
313
  * @param {object} [opts]
@@ -316,8 +316,10 @@ harden(prepareAttenuator);
316
316
  export const prepareGuardedAttenuator = (zone, interfaceGuard, opts = {}) => {
317
317
  const { methodGuards } = interfaceGuard;
318
318
  const methodNames = ownKeys(methodGuards);
319
- return /** @type {AttenuatorMaker<Methods>} */ (
320
- prepareAttenuator(zone, methodNames, { ...opts, interfaceGuard })
321
- );
319
+ const makeAttenuator = prepareAttenuator(zone, methodNames, {
320
+ ...opts,
321
+ interfaceGuard,
322
+ });
323
+ return /** @type {MakeAttenuator<any>} */ (makeAttenuator);
322
324
  };
323
325
  harden(prepareGuardedAttenuator);
@@ -38,9 +38,9 @@ export function makeFakeStorageKit(rootPath: string, rootOptions?: [handleStorag
38
38
  export function makeMockChainStorageRoot(): {
39
39
  /**
40
40
  * Defaults to deserializing slot references into plain Remotable
41
- * objects, but if supplied with a different marshaller, it could
42
- * produce Remotables with e.g. the slot string embedded in the
43
- * iface.
41
+ * objects having the specified interface name (as from `Far(iface)`),
42
+ * but can accept a different marshaller for producing Remotables
43
+ * that e.g. embed the slot string in their iface name.
44
44
  *
45
45
  * @param {string} path
46
46
  * @param {import('./lib-chainStorage.js').Marshaller} marshaller
@@ -57,9 +57,9 @@ export function makeMockChainStorageRoot(): {
57
57
  } & import("@endo/eventual-send").RemotableBrand<{}, {
58
58
  /**
59
59
  * Defaults to deserializing slot references into plain Remotable
60
- * objects, but if supplied with a different marshaller, it could
61
- * produce Remotables with e.g. the slot string embedded in the
62
- * iface.
60
+ * objects having the specified interface name (as from `Far(iface)`),
61
+ * but can accept a different marshaller for producing Remotables
62
+ * that e.g. embed the slot string in their iface name.
63
63
  *
64
64
  * @param {string} path
65
65
  * @param {import('./lib-chainStorage.js').Marshaller} marshaller
@@ -140,9 +140,9 @@ export const makeMockChainStorageRoot = () => {
140
140
  ...bindAllMethods(rootNode),
141
141
  /**
142
142
  * Defaults to deserializing slot references into plain Remotable
143
- * objects, but if supplied with a different marshaller, it could
144
- * produce Remotables with e.g. the slot string embedded in the
145
- * iface.
143
+ * objects having the specified interface name (as from `Far(iface)`),
144
+ * but can accept a different marshaller for producing Remotables
145
+ * that e.g. embed the slot string in their iface name.
146
146
  *
147
147
  * @param {string} path
148
148
  * @param {import('./lib-chainStorage.js').Marshaller} marshaller