@agoric/internal 0.4.0-upgrade-14-dev-0169c7e.0 → 0.4.0-upgrade-16-dev-07b0130.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.
Files changed (86) hide show
  1. package/README.md +7 -2
  2. package/exported.js +2 -0
  3. package/package.json +32 -16
  4. package/src/batched-deliver.d.ts +9 -6
  5. package/src/batched-deliver.d.ts.map +1 -1
  6. package/src/batched-deliver.js +9 -3
  7. package/src/callback.d.ts +23 -16
  8. package/src/callback.d.ts.map +1 -1
  9. package/src/callback.js +35 -39
  10. package/src/chain-storage-paths.d.ts +2 -3
  11. package/src/chain-storage-paths.d.ts.map +1 -1
  12. package/src/chain-storage-paths.js +2 -3
  13. package/src/config.d.ts +23 -12
  14. package/src/config.d.ts.map +1 -1
  15. package/src/config.js +22 -10
  16. package/src/debug.d.ts +1 -1
  17. package/src/index.d.ts +3 -0
  18. package/src/index.js +7 -1
  19. package/src/install-ses-debug.d.ts +2 -0
  20. package/src/install-ses-debug.d.ts.map +1 -0
  21. package/src/install-ses-debug.js +6 -0
  22. package/src/lib-chainStorage.d.ts +42 -52
  23. package/src/lib-chainStorage.d.ts.map +1 -1
  24. package/src/lib-chainStorage.js +82 -74
  25. package/src/lib-nodejs/engine-gc.d.ts +3 -0
  26. package/src/lib-nodejs/engine-gc.d.ts.map +1 -0
  27. package/src/lib-nodejs/engine-gc.js +22 -0
  28. package/src/lib-nodejs/gc-and-finalize.d.ts +2 -0
  29. package/src/lib-nodejs/gc-and-finalize.d.ts.map +1 -0
  30. package/src/lib-nodejs/gc-and-finalize.js +91 -0
  31. package/src/lib-nodejs/spawnSubprocessWorker.d.ts +15 -0
  32. package/src/lib-nodejs/spawnSubprocessWorker.d.ts.map +1 -0
  33. package/src/lib-nodejs/spawnSubprocessWorker.js +89 -0
  34. package/src/lib-nodejs/waitUntilQuiescent.d.ts +2 -0
  35. package/src/lib-nodejs/waitUntilQuiescent.d.ts.map +1 -0
  36. package/src/lib-nodejs/waitUntilQuiescent.js +18 -0
  37. package/src/lib-nodejs/worker-protocol.d.ts +4 -0
  38. package/src/lib-nodejs/worker-protocol.d.ts.map +1 -0
  39. package/src/lib-nodejs/worker-protocol.js +54 -0
  40. package/src/magic-cookie-test-only.js +2 -2
  41. package/src/marshal.d.ts +20 -0
  42. package/src/marshal.d.ts.map +1 -0
  43. package/src/marshal.js +138 -0
  44. package/src/method-tools.d.ts +1 -0
  45. package/src/method-tools.d.ts.map +1 -1
  46. package/src/method-tools.js +29 -16
  47. package/src/netstring.d.ts +24 -0
  48. package/src/netstring.d.ts.map +1 -0
  49. package/src/netstring.js +124 -0
  50. package/src/node/buffer-line-transform.d.ts +17 -13
  51. package/src/node/buffer-line-transform.d.ts.map +1 -1
  52. package/src/node/buffer-line-transform.js +11 -8
  53. package/src/node/fs-stream.d.ts.map +1 -1
  54. package/src/node/fs-stream.js +2 -3
  55. package/src/node/utils.d.ts +9 -0
  56. package/src/node/utils.d.ts.map +1 -0
  57. package/src/node/utils.js +46 -0
  58. package/src/priority-senders.d.ts +1 -1
  59. package/src/priority-senders.d.ts.map +1 -1
  60. package/src/priority-senders.js +7 -3
  61. package/src/queue.d.ts +1 -1
  62. package/src/queue.d.ts.map +1 -1
  63. package/src/queue.js +7 -8
  64. package/src/scratch.d.ts +1 -1
  65. package/src/scratch.d.ts.map +1 -1
  66. package/src/storage-test-utils.d.ts +43 -81
  67. package/src/storage-test-utils.d.ts.map +1 -1
  68. package/src/storage-test-utils.js +103 -40
  69. package/src/tagged.d.ts +155 -0
  70. package/src/testing-utils.d.ts.map +1 -1
  71. package/src/testing-utils.js +7 -5
  72. package/src/tokens.d.ts +34 -0
  73. package/src/tokens.d.ts.map +1 -0
  74. package/src/tokens.js +35 -0
  75. package/src/typeGuards.d.ts +2 -0
  76. package/src/typeGuards.d.ts.map +1 -1
  77. package/src/typeGuards.js +8 -0
  78. package/src/types.d.ts +46 -0
  79. package/src/types.js +2 -0
  80. package/src/upgrade-api.d.ts +13 -4
  81. package/src/upgrade-api.d.ts.map +1 -1
  82. package/src/upgrade-api.js +26 -18
  83. package/src/utils.d.ts +26 -31
  84. package/src/utils.d.ts.map +1 -1
  85. package/src/utils.js +53 -227
  86. package/CHANGELOG.md +0 -137
package/README.md CHANGED
@@ -10,11 +10,16 @@ Like all `@agoric` packages it follows Semantic Versioning. Unlike the others, i
10
10
 
11
11
  # Design
12
12
 
13
- It must be the lowest agoric-sdk package in any import graph. Therefore it must never depend on another agoric-sdk package. If there's a module in an another agoric-package that has no agoric-sdk dependencies, it can be moved into this package.
13
+ It is meant to be a home for modules that have no Agoric-specific dependencies themselves. It does depend on a these other @agoric packages but they are all destined to migrate out of the repo,
14
+
15
+ - base-zone
16
+ - store
17
+ - assert
18
+
19
+ This package may not take dependencies on any others in this repository.
14
20
 
15
21
  It must never export ambient types.
16
22
 
17
23
  It should not be imported by deep imports. Eventually this will be enforced by [`exports`](https://nodejs.org/api/packages.html#exports) but the tooling isn't ready:
18
24
  - https://github.com/import-js/eslint-plugin-import/issues/1810
19
25
  - https://github.com/microsoft/TypeScript/issues/33079 (or some related problem with JSdoc types)
20
-
package/exported.js ADDED
@@ -0,0 +1,2 @@
1
+ // Dummy file for .d.ts twin to declare ambients
2
+ export {};
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@agoric/internal",
3
- "version": "0.4.0-upgrade-14-dev-0169c7e.0+0169c7e",
3
+ "version": "0.4.0-upgrade-16-dev-07b0130.0+07b0130",
4
4
  "description": "Externally unsupported utilities internal to agoric-sdk",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "engines": {
8
- "node": ">=14.15.0"
8
+ "node": "^18.12 || ^20.9"
9
9
  },
10
10
  "scripts": {
11
11
  "build": "exit 0",
12
- "prepack": "tsc --build jsconfig.build.json",
12
+ "prepack": "tsc --build tsconfig.build.json",
13
13
  "postpack": "git clean -f '*.d.ts*'",
14
14
  "test": "ava",
15
15
  "test:nyc": "exit 0",
@@ -17,30 +17,46 @@
17
17
  "lint-fix": "yarn lint:eslint --fix",
18
18
  "lint": "run-s --continue-on-error lint:*",
19
19
  "lint:eslint": "eslint .",
20
- "lint:types": "tsc -p jsconfig.json"
20
+ "lint:types": "tsc"
21
21
  },
22
22
  "dependencies": {
23
- "@agoric/zone": "0.2.3-upgrade-14-dev-0169c7e.0+0169c7e",
24
- "@endo/far": "0.2.18",
25
- "@endo/marshal": "0.8.5",
26
- "@endo/patterns": "0.2.2",
27
- "@endo/promise-kit": "0.2.56",
28
- "@endo/stream": "0.3.25",
23
+ "@agoric/assert": "0.6.1-upgrade-16-dev-07b0130.0+07b0130",
24
+ "@agoric/base-zone": "0.1.1-upgrade-16-dev-07b0130.0+07b0130",
25
+ "@endo/common": "^1.2.2",
26
+ "@endo/far": "^1.1.2",
27
+ "@endo/init": "^1.1.2",
28
+ "@endo/marshal": "^1.5.0",
29
+ "@endo/pass-style": "^1.4.0",
30
+ "@endo/patterns": "^1.4.0",
31
+ "@endo/promise-kit": "^1.1.2",
32
+ "@endo/stream": "^1.2.2",
29
33
  "anylogger": "^0.21.0",
30
- "jessie.js": "^0.3.2"
34
+ "jessie.js": "^0.3.4"
31
35
  },
32
36
  "devDependencies": {
33
- "@endo/init": "0.5.56",
34
- "ava": "^5.2.0",
35
- "tsd": "^0.28.1"
37
+ "@endo/init": "^1.1.2",
38
+ "ava": "^5.3.0",
39
+ "tsd": "^0.30.7"
40
+ },
41
+ "ava": {
42
+ "require": [
43
+ "@endo/init/debug.js"
44
+ ],
45
+ "files": [
46
+ "test/**/*.test.*"
47
+ ]
36
48
  },
37
49
  "author": "Agoric",
38
50
  "license": "Apache-2.0",
39
51
  "files": [
40
- "src"
52
+ "src",
53
+ "exported.js"
41
54
  ],
42
55
  "publishConfig": {
43
56
  "access": "public"
44
57
  },
45
- "gitHead": "0169c7e505099fdcfa8e4d1436e5d3b372f1c320"
58
+ "typeCoverage": {
59
+ "atLeast": 93.89
60
+ },
61
+ "gitHead": "07b01308eaccca903919d495aded620c9849efc7"
46
62
  }
@@ -1,15 +1,18 @@
1
1
  /**
2
- * @typedef {(message: any[], ackNum: number) => void} DeliverMessages
2
+ * @typedef {(message: unknown[], ackNum: number) => Promise<void>} DeliverMessages
3
3
  */
4
4
  /**
5
5
  * @param {DeliverMessages} deliver
6
- * @param {{ clearTimeout: NodeJS.clearTimeout, setTimeout: NodeJS.setTimeout }} io
6
+ * @param {{
7
+ * clearTimeout: import('node:timers').clearTimeout;
8
+ * setTimeout: import('node:timers').setTimeout;
9
+ * }} io
7
10
  * @param {number} batchTimeoutMs
8
11
  */
9
12
  export function makeBatchedDeliver(deliver: DeliverMessages, { clearTimeout, setTimeout }: {
10
- clearTimeout: NodeJS.clearTimeout;
11
- setTimeout: NodeJS.setTimeout;
12
- }, batchTimeoutMs?: number): (newMessages: any[], ackNum: number) => void;
13
+ clearTimeout: typeof globalThis.clearTimeout;
14
+ setTimeout: typeof globalThis.setTimeout;
15
+ }, batchTimeoutMs?: number): (message: unknown[], ackNum: number) => Promise<void>;
13
16
  export const DEFAULT_BATCH_TIMEOUT_MS: 1000;
14
- export type DeliverMessages = (message: any[], ackNum: number) => void;
17
+ export type DeliverMessages = (message: unknown[], ackNum: number) => Promise<void>;
15
18
  //# sourceMappingURL=batched-deliver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"batched-deliver.d.ts","sourceRoot":"","sources":["batched-deliver.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;GAIG;AACH,4CAJW,eAAe,gCACf;IAAE,kCAAkC;IAAC,8BAA6B;CAAE,mBACpE,MAAM,gDAsChB;AA/CD,4CAA6C;wCAGtB,GAAG,EAAE,UAAU,MAAM,KAAK,IAAI"}
1
+ {"version":3,"file":"batched-deliver.d.ts","sourceRoot":"","sources":["batched-deliver.js"],"names":[],"mappings":"AAKA;;GAEG;AAEH;;;;;;;GAOG;AACH,4CAPW,eAAe,gCACf;IACV,YAAgB,EAAE,8BAAkC,CAAC;IACrD,UAAc,EAAE,4BAAgC,CAAC;CAC9C,mBACO,MAAM,aATM,OAAO,EAAE,UAAU,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAiDjE;AApDD,4CAA6C;8BAGhC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC"}
@@ -1,14 +1,18 @@
1
1
  // @jessie-check
2
+ // @ts-check
2
3
 
3
4
  export const DEFAULT_BATCH_TIMEOUT_MS = 1000;
4
5
 
5
6
  /**
6
- * @typedef {(message: any[], ackNum: number) => void} DeliverMessages
7
+ * @typedef {(message: unknown[], ackNum: number) => Promise<void>} DeliverMessages
7
8
  */
8
9
 
9
10
  /**
10
11
  * @param {DeliverMessages} deliver
11
- * @param {{ clearTimeout: NodeJS.clearTimeout, setTimeout: NodeJS.setTimeout }} io
12
+ * @param {{
13
+ * clearTimeout: import('node:timers').clearTimeout;
14
+ * setTimeout: import('node:timers').setTimeout;
15
+ * }} io
12
16
  * @param {number} batchTimeoutMs
13
17
  */
14
18
  export function makeBatchedDeliver(
@@ -16,8 +20,10 @@ export function makeBatchedDeliver(
16
20
  { clearTimeout, setTimeout },
17
21
  batchTimeoutMs = DEFAULT_BATCH_TIMEOUT_MS,
18
22
  ) {
23
+ /** @type {unknown[]} */
19
24
  let batchedMessages = [];
20
25
  let latestAckNum = 0;
26
+ /** @type {NodeJS.Timeout} */
21
27
  let deliverTimeout;
22
28
 
23
29
  /**
@@ -34,7 +40,7 @@ export function makeBatchedDeliver(
34
40
  // Transfer the batched messages to the deliver function.
35
41
  const msgs = batchedMessages;
36
42
  batchedMessages = [];
37
- deliver(msgs, latestAckNum);
43
+ void deliver(msgs, latestAckNum);
38
44
  }, batchTimeoutMs);
39
45
  }
40
46
 
package/src/callback.d.ts CHANGED
@@ -1,23 +1,30 @@
1
- export function callSync<I extends (...args: unknown[]) => any>(callback: import("./types").SyncCallback<I>, ...args: Parameters<I>): ReturnType<I>;
2
- export function callE<I extends (...args: unknown[]) => any>(callback: import("./types").Callback<I>, ...args: Parameters<I>): Promise<Awaited<ReturnType<I>>>;
3
- export function makeSyncFunctionCallback<I extends (...args: unknown[]) => any, T extends (...args: [...B, ...Parameters<I>]) => ReturnType<I> = I, B extends unknown[] = []>(target: T, ...bound: B): import("./types").SyncCallback<I>;
4
- export function makeFunctionCallback<I extends (...args: unknown[]) => any, T extends import("@endo/far").ERef<(...args: [...B, ...Parameters<I>]) => ReturnType<I>> = import("@endo/far").ERef<I>, B extends unknown[] = []>(target: T, ...bound: B): import("./types").Callback<I>;
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
- 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
- export function isCallback(callback: any): callback is import("./types").Callback<any>;
8
- export function prepareAttenuator<M extends PropertyKey>(zone: import('@agoric/zone').Zone, methodNames: M[], { interfaceGuard, tag }?: {
9
- interfaceGuard?: InterfaceGuard | undefined;
1
+ export function callSync<I extends (...args: unknown[]) => any>(callback: SyncCallback<I>, ...args: Parameters<I>): ReturnType<I>;
2
+ export function callE<I extends (...args: unknown[]) => any>(callback: Callback<I>, ...args: Parameters<I>): Promise<Awaited<ReturnType<I>>>;
3
+ export function makeSyncFunctionCallback<I extends (...args: unknown[]) => any, T extends (...args: [...B, ...Parameters<I>]) => ReturnType<I> = I, B extends unknown[] = []>(target: T, ...bound: B): SyncCallback<I>;
4
+ export function makeFunctionCallback<I extends (...args: unknown[]) => any, T extends ERef<(...args: [...B, ...Parameters<I>]) => ReturnType<I>> = ERef<I>, B extends unknown[] = []>(target: T, ...bound: B): Callback<I>;
5
+ export function makeSyncMethodCallback<I extends (...args: unknown[]) => any, P extends PropertyKey, T extends { [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>; } = { [x in P]: I; }, B extends unknown[] = []>(target: T, methodName: P, ...bound: B): SyncCallback<I>;
6
+ export function makeMethodCallback<I extends (...args: unknown[]) => any, P extends PropertyKey, T extends ERef<{ [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>; }> = ERef<{ [x in P]: I; }>, B extends unknown[] = []>(target: T, methodName: P, ...bound: B): Callback<I>;
7
+ export function isCallback(callback: any): callback is Callback<any>;
8
+ export function prepareAttenuator<M extends PropertyKey>(zone: import("@agoric/base-zone").Zone, methodNames: M[], { interfaceGuard, tag }?: {
9
+ interfaceGuard?: import("@endo/patterns").InterfaceGuard<{ [K in M]: import("@endo/patterns").MethodGuard; }> | undefined;
10
10
  tag?: string | undefined;
11
11
  }): (args_0: {
12
12
  target?: any;
13
13
  isSync?: boolean | undefined;
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?: {
14
+ overrides?: { [K_1 in M]?: Callback<any> | null | undefined; } | undefined;
15
+ }) => import("@endo/exo").Guarded<{ [K_2 in M]: (this: any, ...args: unknown[]) => any; }>;
16
+ export function prepareGuardedAttenuator<G extends import("@endo/patterns").InterfaceGuard>(zone: import("@agoric/base-zone").Zone, interfaceGuard: G, opts?: {
17
17
  tag?: string | undefined;
18
18
  } | undefined): MakeAttenuator<any>;
19
- export type MakeAttenuator<T> = MakeAttenuator<T>;
20
- export type Callback<I extends (...args: unknown[]) => any> = import('./types').Callback<I>;
21
- export type SyncCallback<I extends (...args: unknown[]) => any> = import('./types').SyncCallback<I>;
22
- export type Farable<T> = import('@endo/eventual-send').RemotableBrand<{}, T> & T;
19
+ export type MakeAttenuator<T extends import("@endo/exo").Methods> = (...args: Parameters<ReturnType<(<M extends PropertyKey>(zone: import("@agoric/base-zone").Zone, methodNames: M[], { interfaceGuard, tag }?: {
20
+ interfaceGuard?: import("@endo/patterns").InterfaceGuard<{ [K in M]: import("@endo/patterns").MethodGuard; }> | undefined;
21
+ tag?: string | undefined;
22
+ }) => (args_0: {
23
+ target?: any;
24
+ isSync?: boolean | undefined;
25
+ overrides?: { [K_1 in M]?: Callback<any> | null | undefined; } | undefined;
26
+ }) => import("@endo/exo").Guarded<{ [K_2 in M]: (this: any, ...args: unknown[]) => any; }>)>>) => import("@endo/exo").Farable<T>;
27
+ import type { SyncCallback } from './types.js';
28
+ import type { Callback } from './types.js';
29
+ import type { ERef } from '@endo/far';
23
30
  //# sourceMappingURL=callback.d.ts.map
@@ -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,+DAPI,OAAO,cAAc,EAAE,IAAI;IAGL,cAAc;IAEtB,GAAG;;aAkEb,GAAG;;;2BAxDgB,GAAG,WAAW,OAAO,EAAE,KAAK,GAAG,4EAA/B,GAAG,WAAW,OAAO,EAAE,KAAK,GAAG,KA2FhE;AAWM,+CALI,OAAO,cAAc,EAAE,IAAI,kBAC3B,cAAc;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AAC,SAA/B,OAAQ,WAAW,EAAE,OAAQ,IAC7B,CACZ,GAAO,IAAI,EAAE,UAAU,CAAC,UAAU,GAqKR,CAAC,SAAd,WAAY,QACf,OAAO,mBAAmB,EAAE,IAAI,eAEhC,CAAC,EAAE,4BAEX;IAEU,cAAc,8CADrB,CAAC;IAGkB,GAAG;CAC3B;aAkEc,GAAG;;;uDAvDgB,GAAG,WAAW,OAAO,EAAE,KAAK,GAAG,MA1LX,CAAC,KAC/C,OAAO,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;kCAhBI,YAAY;8BAAZ,YAAY;0BAD9B,WAAW"}
package/src/callback.js CHANGED
@@ -1,6 +1,10 @@
1
1
  // @ts-check
2
2
  import { E } from '@endo/far';
3
3
  import { isObject, isPassableSymbol } from '@endo/marshal';
4
+ import { getInterfaceMethodKeys } from '@endo/patterns';
5
+
6
+ /** @import {ERef} from '@endo/far' */
7
+ /** @import {Callback, SyncCallback} from './types.js' */
4
8
 
5
9
  const { Fail, quote: q } = assert;
6
10
 
@@ -8,31 +12,21 @@ const { fromEntries } = Object;
8
12
 
9
13
  const { ownKeys: rawOwnKeys } = Reflect;
10
14
  const ownKeys =
11
- /** @type {<T extends PropertyKey>(obj: {[K in T]?: unknown}) => T[]} */ (
15
+ /** @type {<T extends PropertyKey>(obj: { [K in T]?: unknown }) => T[]} */ (
12
16
  rawOwnKeys
13
17
  );
14
18
 
15
19
  /**
16
- * @template T
17
- * @typedef {(...args: Parameters<ReturnType<prepareAttenuator>>) => Farable<T>} MakeAttenuator
18
- */
19
-
20
- /**
21
- * @template {(...args: unknown[]) => any} I
22
- * @typedef {import('./types').Callback<I>} Callback
23
- */
24
-
25
- /**
26
- * @template {(...args: unknown[]) => any} I
27
- * @typedef {import('./types').SyncCallback<I>} SyncCallback
20
+ * @template {import('@endo/exo').Methods} T
21
+ * @typedef {(
22
+ * ...args: Parameters<ReturnType<prepareAttenuator>>
23
+ * ) => import('@endo/exo').Farable<T>} MakeAttenuator
28
24
  */
29
25
 
30
- /** @template T @typedef {import('@endo/eventual-send').RemotableBrand<{}, T> & T} Farable */
31
-
32
26
  /**
33
27
  * @param {unknown} key
34
28
  * @returns {key is PropertyKey} FIXME: should be just `PropertyKey` but TS
35
- * complains it can't be used as an index type.
29
+ * complains it can't be used as an index type.
36
30
  */
37
31
  const isPropertyKey = key => {
38
32
  switch (typeof key) {
@@ -102,9 +96,7 @@ harden(makeSyncFunctionCallback);
102
96
  * Create a callback from a potentially far function.
103
97
  *
104
98
  * @template {(...args: unknown[]) => any} I
105
- * @template {import('@endo/far').ERef<
106
- * (...args: [...B, ...Parameters<I>]) => ReturnType<I>
107
- * >} [T=import('@endo/far').ERef<I>]
99
+ * @template {ERef<(...args: [...B, ...Parameters<I>]) => ReturnType<I>>} [T=ERef<I>]
108
100
  * @template {unknown[]} [B=[]]
109
101
  * @param {T} target
110
102
  * @param {B} bound
@@ -125,7 +117,7 @@ harden(makeFunctionCallback);
125
117
  * @template {(...args: unknown[]) => any} I
126
118
  * @template {PropertyKey} P
127
119
  * @template {{
128
- * [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>
120
+ * [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>;
129
121
  * }} [T={ [x in P]: I }]
130
122
  * @template {unknown[]} [B=[]]
131
123
  * @param {T} target
@@ -150,9 +142,9 @@ harden(makeSyncMethodCallback);
150
142
  *
151
143
  * @template {(...args: unknown[]) => any} I
152
144
  * @template {PropertyKey} P
153
- * @template {import('@endo/far').ERef<{
154
- * [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>
155
- * }>} [T=import('@endo/far').ERef<{ [x in P]: I }>]
145
+ * @template {ERef<{
146
+ * [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>;
147
+ * }>} [T=ERef<{ [x in P]: I }>]
156
148
  * @template {unknown[]} [B=[]]
157
149
  * @param {T} target
158
150
  * @param {P} methodName
@@ -193,11 +185,14 @@ harden(isCallback);
193
185
  * Prepare an attenuator class whose methods can be redirected via callbacks.
194
186
  *
195
187
  * @template {PropertyKey} M
196
- * @param {import('@agoric/zone').Zone} zone The zone in which to allocate attenuators.
188
+ * @param {import('@agoric/base-zone').Zone} zone The zone in which to allocate
189
+ * attenuators.
197
190
  * @param {M[]} methodNames Methods to forward.
198
191
  * @param {object} opts
199
- * @param {InterfaceGuard} [opts.interfaceGuard] An interface guard for the
200
- * new attenuator.
192
+ * @param {import('@endo/patterns').InterfaceGuard<{
193
+ * [K in M]: import('@endo/patterns').MethodGuard;
194
+ * }>} [opts.interfaceGuard]
195
+ * An interface guard for the new attenuator.
201
196
  * @param {string} [opts.tag] A tag for the new attenuator exoClass.
202
197
  */
203
198
  export const prepareAttenuator = (
@@ -207,7 +202,9 @@ export const prepareAttenuator = (
207
202
  ) => {
208
203
  /**
209
204
  * @typedef {(this: any, ...args: unknown[]) => any} Method
210
- * @typedef {{ [K in M]?: Callback<any> | null}} Overrides
205
+ *
206
+ * @typedef {{ [K in M]?: Callback<any> | null }} Overrides
207
+ *
211
208
  * @typedef {{ [K in M]: (this: any, ...args: unknown[]) => any }} Methods
212
209
  */
213
210
  const methods = /** @type {Methods} */ (
@@ -250,14 +247,13 @@ export const prepareAttenuator = (
250
247
  * and/or individual method override callbacks.
251
248
  *
252
249
  * @param {object} opts
253
- * @param {unknown} [opts.target] The target for any methods that
254
- * weren't specified in `opts.overrides`.
250
+ * @param {unknown} [opts.target] The target for any methods that weren't
251
+ * specified in `opts.overrides`.
255
252
  * @param {boolean} [opts.isSync=false] Whether the target should be treated
256
- * as synchronously available.
257
- * @param {Overrides} [opts.overrides] Set individual
258
- * callbacks for methods (whose names must be defined in the
259
- * `prepareAttenuator` or `prepareGuardedAttenuator` call). Nullish overrides
260
- * mean to throw.
253
+ * as synchronously available.
254
+ * @param {Overrides} [opts.overrides] Set individual callbacks for methods
255
+ * (whose names must be defined in the `prepareAttenuator` or
256
+ * `prepareGuardedAttenuator` call). Nullish overrides mean to throw.
261
257
  */
262
258
  const makeAttenuator = zone.exoClass(
263
259
  tag,
@@ -265,7 +261,7 @@ export const prepareAttenuator = (
265
261
  /**
266
262
  * @param {object} opts
267
263
  * @param {any} [opts.target]
268
- * @param {boolean} [opts.isSync=false]
264
+ * @param {boolean} [opts.isSync]
269
265
  * @param {Overrides} [opts.overrides]
270
266
  */
271
267
  ({
@@ -305,14 +301,14 @@ harden(prepareAttenuator);
305
301
  /**
306
302
  * Prepare an attenuator whose methodNames are derived from the interfaceGuard.
307
303
  *
308
- * @param {import('@agoric/zone').Zone} zone
309
- * @param {InterfaceGuard} interfaceGuard
304
+ * @template {import('@endo/patterns').InterfaceGuard} G
305
+ * @param {import('@agoric/base-zone').Zone} zone
306
+ * @param {G} interfaceGuard
310
307
  * @param {object} [opts]
311
308
  * @param {string} [opts.tag]
312
309
  */
313
310
  export const prepareGuardedAttenuator = (zone, interfaceGuard, opts = {}) => {
314
- const { methodGuards } = interfaceGuard;
315
- const methodNames = ownKeys(methodGuards);
311
+ const methodNames = getInterfaceMethodKeys(interfaceGuard);
316
312
  const makeAttenuator = prepareAttenuator(zone, methodNames, {
317
313
  ...opts,
318
314
  interfaceGuard,
@@ -1,7 +1,6 @@
1
1
  /**
2
- * These identify top-level paths for SwingSet chain storage
3
- * (and serve as prefixes).
4
- * To avoid collisions, they should remain synchronized with
2
+ * These identify top-level paths for SwingSet chain storage (and serve as
3
+ * prefixes). To avoid collisions, they should remain synchronized with
5
4
  * golang/cosmos/x/swingset/keeper/keeper.go
6
5
  */
7
6
  export const ACTION_QUEUE: "actionQueue";
@@ -1 +1 @@
1
- {"version":3,"file":"chain-storage-paths.d.ts","sourceRoot":"","sources":["chain-storage-paths.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,yCAA0C;AAC1C,sDAAuD;AACvD,0DAA2D;AAC3D,sCAAuC;AACvC,8BAA+B;AAC/B,gCAAiC;AACjC,gCAAiC;AACjC,iCAAkC;AAClC,uCAAwC"}
1
+ {"version":3,"file":"chain-storage-paths.d.ts","sourceRoot":"","sources":["chain-storage-paths.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,yCAA0C;AAC1C,sDAAuD;AACvD,0DAA2D;AAC3D,sCAAuC;AACvC,8BAA+B;AAC/B,gCAAiC;AACjC,gCAAiC;AACjC,iCAAkC;AAClC,uCAAwC"}
@@ -1,9 +1,8 @@
1
1
  // @jessie-check
2
2
 
3
3
  /**
4
- * These identify top-level paths for SwingSet chain storage
5
- * (and serve as prefixes).
6
- * To avoid collisions, they should remain synchronized with
4
+ * These identify top-level paths for SwingSet chain storage (and serve as
5
+ * prefixes). To avoid collisions, they should remain synchronized with
7
6
  * golang/cosmos/x/swingset/keeper/keeper.go
8
7
  */
9
8
  export const ACTION_QUEUE = 'actionQueue';
package/src/config.d.ts CHANGED
@@ -1,25 +1,36 @@
1
1
  export namespace BridgeId {
2
- const BANK: string;
3
- const CORE: string;
4
- const DIBC: string;
5
- const STORAGE: string;
6
- const PROVISION: string;
7
- const PROVISION_SMART_WALLET: string;
8
- const WALLET: string;
2
+ let BANK: "bank";
3
+ let CORE: "core";
4
+ let DIBC: "dibc";
5
+ let STORAGE: "storage";
6
+ let PROVISION: "provision";
7
+ let PROVISION_SMART_WALLET: "provisionWallet";
8
+ let VLOCALCHAIN: "vlocalchain";
9
+ let VTRANSFER: "vtransfer";
10
+ let WALLET: "wallet";
11
+ }
12
+ /** @typedef {(typeof BridgeId)[keyof typeof BridgeId]} BridgeIdValue */
13
+ export const VTRANSFER_IBC_EVENT: "VTRANSFER_IBC_EVENT";
14
+ export namespace CosmosInitKeyToBridgeId {
15
+ import vbankPort = BANK;
16
+ export { vbankPort };
17
+ import vibcPort = DIBC;
18
+ export { vibcPort };
9
19
  }
10
20
  export namespace WalletName {
11
- const depositFacet: string;
21
+ let depositFacet: "depositFacet";
12
22
  }
13
23
  export namespace VBankAccount {
14
24
  namespace reserve {
15
- const module: string;
16
- const address: string;
25
+ let module: "vbank/reserve";
26
+ let address: "agoric1ae0lmtzlgrcnla9xjkpaarq5d5dfez63h3nucl";
17
27
  }
18
28
  namespace provision {
19
- const module_1: string;
29
+ let module_1: "vbank/provision";
20
30
  export { module_1 as module };
21
- const address_1: string;
31
+ let address_1: "agoric1megzytg65cyrgzs6fvzxgrcqvwwl7ugpt62346";
22
32
  export { address_1 as address };
23
33
  }
24
34
  }
35
+ export type BridgeIdValue = (typeof BridgeId)[keyof typeof BridgeId];
25
36
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["config.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["config.js"],"names":[],"mappings":";;;;;;;;;;;AA8BA,wEAAwE;AAExE,wDAAyD;;;;;;;;;;;;;;;;;;;;;;4BAF3C,CAAC,OAAO,QAAQ,EAAE,MAAM,OAAO,QAAQ,CAAC"}
package/src/config.js CHANGED
@@ -4,34 +4,46 @@
4
4
  /**
5
5
  * @file
6
6
  *
7
- * Some of this config info may make more sense in a particular package. However
8
- * due to https://github.com/Agoric/agoric-sdk/issues/4620 and our lax package
9
- * dependency graph, sometimes rational placements cause type resolution errors.
7
+ * Some of this config info may make more sense in a particular package. However
8
+ * due to https://github.com/Agoric/agoric-sdk/issues/4620 and our lax package
9
+ * dependency graph, sometimes rational placements cause type resolution
10
+ * errors.
10
11
  *
11
- * So as a work-around some constants that need access from more than one package are placed here.
12
+ * So as a work-around some constants that need access from more than one
13
+ * package are placed here.
12
14
  */
13
15
 
14
16
  /**
15
17
  * Event source ids used by the bridge device.
16
18
  */
17
- export const BridgeId = {
19
+ export const BridgeId = /** @type {const} */ ({
18
20
  BANK: 'bank',
19
21
  CORE: 'core',
20
22
  DIBC: 'dibc',
21
23
  STORAGE: 'storage',
22
24
  PROVISION: 'provision',
23
25
  PROVISION_SMART_WALLET: 'provisionWallet',
26
+ VLOCALCHAIN: 'vlocalchain',
27
+ VTRANSFER: 'vtransfer',
24
28
  WALLET: 'wallet',
25
- };
29
+ });
26
30
  harden(BridgeId);
31
+ /** @typedef {(typeof BridgeId)[keyof typeof BridgeId]} BridgeIdValue */
27
32
 
28
- export const WalletName = {
29
- depositFacet: 'depositFacet',
33
+ export const VTRANSFER_IBC_EVENT = 'VTRANSFER_IBC_EVENT';
34
+
35
+ export const CosmosInitKeyToBridgeId = {
36
+ vbankPort: BridgeId.BANK,
37
+ vibcPort: BridgeId.DIBC,
30
38
  };
39
+
40
+ export const WalletName = /** @type {const} */ ({
41
+ depositFacet: 'depositFacet',
42
+ });
31
43
  harden(WalletName);
32
44
 
33
45
  // defined in golang/cosmos/x/vbank
34
- export const VBankAccount = {
46
+ export const VBankAccount = /** @type {const} */ ({
35
47
  reserve: {
36
48
  module: 'vbank/reserve',
37
49
  address: 'agoric1ae0lmtzlgrcnla9xjkpaarq5d5dfez63h3nucl',
@@ -40,5 +52,5 @@ export const VBankAccount = {
40
52
  module: 'vbank/provision',
41
53
  address: 'agoric1megzytg65cyrgzs6fvzxgrcqvwwl7ugpt62346',
42
54
  },
43
- };
55
+ });
44
56
  harden(VBankAccount);
package/src/debug.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export function makeTracer(name: string, enable?: boolean | 'verbose'): (..._args: any[]) => void;
1
+ export function makeTracer(name: string, enable?: boolean | "verbose"): (..._args: any[]) => void;
2
2
  //# sourceMappingURL=debug.d.ts.map
package/src/index.d.ts CHANGED
@@ -3,4 +3,7 @@ export * from "./debug.js";
3
3
  export * from "./utils.js";
4
4
  export * from "./method-tools.js";
5
5
  export * from "./typeGuards.js";
6
+ export * from "./types.js";
7
+ export { objectMap } from "@endo/common/object-map.js";
8
+ export { fromUniqueEntries } from "@endo/common/from-unique-entries.js";
6
9
  //# sourceMappingURL=index.d.ts.map
package/src/index.js CHANGED
@@ -1,9 +1,15 @@
1
1
  // @jessie-check
2
2
 
3
- /// <reference types="ses"/>
3
+ /// <reference types="ses" />
4
4
 
5
5
  export * from './config.js';
6
6
  export * from './debug.js';
7
7
  export * from './utils.js';
8
8
  export * from './method-tools.js';
9
9
  export * from './typeGuards.js';
10
+
11
+ // eslint-disable-next-line import/export -- just types
12
+ export * from './types.js';
13
+
14
+ export { objectMap } from '@endo/common/object-map.js';
15
+ export { fromUniqueEntries } from '@endo/common/from-unique-entries.js';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=install-ses-debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-ses-debug.d.ts","sourceRoot":"","sources":["install-ses-debug.js"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ // This is like `@endo/init` but sacrificing safety to optimize
2
+ // for debugging and testing. The difference is only the lockdown options.
3
+ // The setting below are *unsafe* and should not be used in contact with
4
+ // genuinely malicious code.
5
+
6
+ import '@endo/init/debug.js';