@agoric/vats 0.15.1 → 0.15.2-calypso-dev-84eb287.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 (208) hide show
  1. package/README.md +3 -0
  2. package/index.d.ts +6 -0
  3. package/index.d.ts.map +1 -0
  4. package/index.js +9 -0
  5. package/package.json +43 -48
  6. package/scripts/build-bundles.js +19 -0
  7. package/src/bridge-target.d.ts +193 -0
  8. package/src/bridge-target.d.ts.map +1 -0
  9. package/src/bridge-target.js +316 -0
  10. package/src/bridge.d.ts +14 -4
  11. package/src/bridge.d.ts.map +1 -1
  12. package/src/bridge.js +45 -16
  13. package/src/centralSupply.d.ts +3 -3
  14. package/src/centralSupply.d.ts.map +1 -1
  15. package/src/centralSupply.js +3 -5
  16. package/src/core/README.md +1 -1
  17. package/src/core/basic-behaviors.d.ts +24 -39
  18. package/src/core/basic-behaviors.d.ts.map +1 -1
  19. package/src/core/basic-behaviors.js +63 -63
  20. package/src/core/boot-chain.d.ts +178 -44
  21. package/src/core/boot-chain.d.ts.map +1 -1
  22. package/src/core/boot-chain.js +5 -5
  23. package/src/core/boot-sim.d.ts +5 -43
  24. package/src/core/boot-sim.d.ts.map +1 -1
  25. package/src/core/boot-sim.js +3 -4
  26. package/src/core/boot-solo.d.ts +5 -43
  27. package/src/core/boot-solo.d.ts.map +1 -1
  28. package/src/core/boot-solo.js +4 -5
  29. package/src/core/chain-behaviors.d.ts +10 -26
  30. package/src/core/chain-behaviors.d.ts.map +1 -1
  31. package/src/core/chain-behaviors.js +38 -42
  32. package/src/core/client-behaviors.d.ts +2 -1
  33. package/src/core/client-behaviors.d.ts.map +1 -1
  34. package/src/core/client-behaviors.js +6 -5
  35. package/src/core/core-eval-env.d.ts +40 -0
  36. package/src/core/demoIssuers.d.ts +24 -26
  37. package/src/core/demoIssuers.d.ts.map +1 -1
  38. package/src/core/demoIssuers.js +37 -37
  39. package/src/core/lib-boot.d.ts +17 -53
  40. package/src/core/lib-boot.d.ts.map +1 -1
  41. package/src/core/lib-boot.js +52 -60
  42. package/src/core/promise-space.d.ts +4 -7
  43. package/src/core/promise-space.d.ts.map +1 -1
  44. package/src/core/promise-space.js +15 -16
  45. package/src/core/sim-behaviors.d.ts +3 -3
  46. package/src/core/sim-behaviors.d.ts.map +1 -1
  47. package/src/core/sim-behaviors.js +1 -1
  48. package/src/core/startWalletFactory.d.ts +23 -27
  49. package/src/core/startWalletFactory.d.ts.map +1 -1
  50. package/src/core/startWalletFactory.js +32 -18
  51. package/src/core/types-ambient.d.ts +538 -0
  52. package/src/core/types-ambient.js +1 -0
  53. package/src/core/utils.d.ts +47 -92
  54. package/src/core/utils.d.ts.map +1 -1
  55. package/src/core/utils.js +58 -50
  56. package/src/crc.d.ts +2 -6
  57. package/src/crc.d.ts.map +1 -1
  58. package/src/crc.js +5 -16
  59. package/src/ibc.d.ts +30 -35
  60. package/src/ibc.d.ts.map +1 -1
  61. package/src/ibc.js +740 -491
  62. package/src/lib-board.d.ts +49 -121
  63. package/src/lib-board.d.ts.map +1 -1
  64. package/src/lib-board.js +49 -50
  65. package/src/localchain.d.ts +195 -0
  66. package/src/localchain.d.ts.map +1 -0
  67. package/src/localchain.js +324 -0
  68. package/src/mintHolder.d.ts +6 -4
  69. package/src/mintHolder.d.ts.map +1 -1
  70. package/src/mintHolder.js +19 -21
  71. package/src/nameHub.d.ts +27 -5
  72. package/src/nameHub.d.ts.map +1 -1
  73. package/src/nameHub.js +33 -26
  74. package/src/priceAuthorityRegistry.d.ts +21 -0
  75. package/src/priceAuthorityRegistry.d.ts.map +1 -0
  76. package/src/priceAuthorityRegistry.js +220 -0
  77. package/src/proposals/kread-proposal.d.ts +15 -0
  78. package/src/proposals/kread-proposal.d.ts.map +1 -0
  79. package/src/proposals/kread-proposal.js +24 -0
  80. package/src/proposals/localchain-proposal.d.ts +62 -0
  81. package/src/proposals/localchain-proposal.d.ts.map +1 -0
  82. package/src/proposals/localchain-proposal.js +128 -0
  83. package/src/proposals/localchain-test.d.ts +25 -0
  84. package/src/proposals/localchain-test.d.ts.map +1 -0
  85. package/src/proposals/localchain-test.js +89 -0
  86. package/src/proposals/namesByAddress-fix-proposal.d.ts +22 -0
  87. package/src/proposals/namesByAddress-fix-proposal.d.ts.map +1 -0
  88. package/src/proposals/namesByAddress-fix-proposal.js +55 -0
  89. package/src/proposals/network-proposal.d.ts +23 -8
  90. package/src/proposals/network-proposal.d.ts.map +1 -1
  91. package/src/proposals/network-proposal.js +90 -65
  92. package/src/proposals/probeZcfBundle.d.ts +26 -0
  93. package/src/proposals/probeZcfBundle.d.ts.map +1 -0
  94. package/src/proposals/probeZcfBundle.js +72 -0
  95. package/src/proposals/restart-vats-proposal.d.ts +4 -2
  96. package/src/proposals/restart-vats-proposal.d.ts.map +1 -1
  97. package/src/proposals/restart-vats-proposal.js +20 -8
  98. package/src/proposals/transfer-proposal.d.ts +37 -0
  99. package/src/proposals/transfer-proposal.d.ts.map +1 -0
  100. package/src/proposals/transfer-proposal.js +115 -0
  101. package/src/proposals/upgrade-bank-proposal.d.ts +27 -0
  102. package/src/proposals/upgrade-bank-proposal.d.ts.map +1 -0
  103. package/src/proposals/upgrade-bank-proposal.js +42 -0
  104. package/src/proposals/upgrade-provisionPool-proposal.d.ts +27 -0
  105. package/src/proposals/upgrade-provisionPool-proposal.d.ts.map +1 -0
  106. package/src/proposals/upgrade-provisionPool-proposal.js +67 -0
  107. package/src/proposals/upgrade-zoe-proposal.d.ts +27 -0
  108. package/src/proposals/upgrade-zoe-proposal.d.ts.map +1 -0
  109. package/src/proposals/upgrade-zoe-proposal.js +42 -0
  110. package/src/proposals/vtransfer-echoer.d.ts +24 -0
  111. package/src/proposals/vtransfer-echoer.d.ts.map +1 -0
  112. package/src/proposals/vtransfer-echoer.js +42 -0
  113. package/src/proposals/zcf-only-proposal.d.ts +33 -0
  114. package/src/proposals/zcf-only-proposal.d.ts.map +1 -0
  115. package/src/proposals/zcf-only-proposal.js +36 -0
  116. package/src/proposals/zcf-proposal.d.ts +30 -0
  117. package/src/proposals/zcf-proposal.d.ts.map +1 -0
  118. package/src/proposals/zcf-proposal.js +50 -0
  119. package/src/repl.d.ts +3 -3
  120. package/src/repl.d.ts.map +1 -1
  121. package/src/repl.js +11 -5
  122. package/src/transfer.d.ts +111 -0
  123. package/src/transfer.d.ts.map +1 -0
  124. package/src/transfer.js +260 -0
  125. package/src/types.d.ts +237 -105
  126. package/src/types.js +1 -97
  127. package/src/vat-agoricNames.d.ts +4 -4
  128. package/src/vat-agoricNames.d.ts.map +1 -1
  129. package/src/vat-agoricNames.js +2 -4
  130. package/src/vat-bank.d.ts +217 -149
  131. package/src/vat-bank.d.ts.map +1 -1
  132. package/src/vat-bank.js +96 -68
  133. package/src/vat-board.d.ts +24 -24
  134. package/src/vat-board.d.ts.map +1 -1
  135. package/src/vat-board.js +0 -1
  136. package/src/vat-bridge.d.ts +9 -23
  137. package/src/vat-bridge.d.ts.map +1 -1
  138. package/src/vat-bridge.js +1 -2
  139. package/src/vat-ibc.d.ts +16 -4
  140. package/src/vat-ibc.d.ts.map +1 -1
  141. package/src/vat-ibc.js +20 -9
  142. package/src/vat-localchain.d.ts +37 -0
  143. package/src/vat-localchain.d.ts.map +1 -0
  144. package/src/vat-localchain.js +29 -0
  145. package/src/vat-mints.d.ts +31 -31
  146. package/src/vat-mints.d.ts.map +1 -1
  147. package/src/vat-mints.js +6 -7
  148. package/src/vat-network.d.ts +69 -1
  149. package/src/vat-network.d.ts.map +1 -1
  150. package/src/vat-network.js +45 -3
  151. package/src/vat-priceAuthority.d.ts +4 -4
  152. package/src/vat-priceAuthority.d.ts.map +1 -1
  153. package/src/vat-priceAuthority.js +1 -1
  154. package/src/vat-provisioning.d.ts +6 -6
  155. package/src/vat-provisioning.d.ts.map +1 -1
  156. package/src/vat-provisioning.js +15 -12
  157. package/src/vat-transfer.d.ts +81 -0
  158. package/src/vat-transfer.d.ts.map +1 -0
  159. package/src/vat-transfer.js +63 -0
  160. package/src/vat-zoe.d.ts +4 -1
  161. package/src/vat-zoe.d.ts.map +1 -1
  162. package/src/vat-zoe.js +10 -2
  163. package/src/virtual-purse.d.ts +46 -21
  164. package/src/virtual-purse.d.ts.map +1 -1
  165. package/src/virtual-purse.js +57 -46
  166. package/src/walletFlags.d.ts +2 -2
  167. package/src/walletFlags.js +1 -2
  168. package/tools/bank-utils.d.ts +20 -0
  169. package/tools/bank-utils.d.ts.map +1 -0
  170. package/tools/bank-utils.js +92 -0
  171. package/tools/board-utils.d.ts +39 -0
  172. package/tools/board-utils.d.ts.map +1 -0
  173. package/tools/board-utils.js +92 -0
  174. package/tools/boot-test-utils.d.ts +88 -0
  175. package/tools/boot-test-utils.d.ts.map +1 -0
  176. package/tools/boot-test-utils.js +157 -0
  177. package/tools/fake-bridge.d.ts +18 -0
  178. package/tools/fake-bridge.d.ts.map +1 -0
  179. package/tools/fake-bridge.js +289 -0
  180. package/tools/ibc-utils.d.ts +29 -0
  181. package/tools/ibc-utils.d.ts.map +1 -0
  182. package/tools/ibc-utils.js +115 -0
  183. package/decentral-core-config.json +0 -66
  184. package/decentral-demo-config.json +0 -155
  185. package/decentral-devnet-config.json +0 -216
  186. package/decentral-itest-vaults-config.json +0 -210
  187. package/decentral-main-vaults-config.json +0 -229
  188. package/decentral-test-vaults-config.json +0 -195
  189. package/demo-proposals.json +0 -5
  190. package/exported.js +0 -1
  191. package/jsconfig.build.json +0 -12
  192. package/jsconfig.json +0 -13
  193. package/src/core/types.d.ts +0 -764
  194. package/src/core/types.d.ts.map +0 -1
  195. package/src/core/types.js +0 -347
  196. package/src/provisionPool.d.ts +0 -164
  197. package/src/provisionPool.d.ts.map +0 -1
  198. package/src/provisionPool.js +0 -113
  199. package/src/provisionPoolKit.d.ts +0 -392
  200. package/src/provisionPoolKit.d.ts.map +0 -1
  201. package/src/provisionPoolKit.js +0 -464
  202. package/src/tokens.d.ts +0 -36
  203. package/src/tokens.d.ts.map +0 -1
  204. package/src/tokens.js +0 -37
  205. package/src/types.d.ts.map +0 -1
  206. package/src/vat-sharing.d.ts +0 -54
  207. package/src/vat-sharing.d.ts.map +0 -1
  208. package/src/vat-sharing.js +0 -14
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Vats
2
+
3
+ Builders for Vats on the Agoric chain that aren't contracts.
package/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export * from "./src/types.js";
2
+ export * from "./src/nameHub.js";
3
+ export * from "./src/bridge.js";
4
+ export { makePromiseSpace } from "./src/core/promise-space.js";
5
+ export { makeAgoricNamesAccess } from "./src/core/utils.js";
6
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":""}
package/index.js ADDED
@@ -0,0 +1,9 @@
1
+ // Ambient types
2
+ import './src/core/types-ambient.js';
3
+
4
+ // eslint-disable-next-line import/export -- no named exports
5
+ export * from './src/types.js';
6
+ export * from './src/nameHub.js';
7
+ export * from './src/bridge.js';
8
+ export { makePromiseSpace } from './src/core/promise-space.js';
9
+ export { makeAgoricNamesAccess } from './src/core/utils.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/vats",
3
- "version": "0.15.1",
3
+ "version": "0.15.2-calypso-dev-84eb287.0+84eb287",
4
4
  "description": "Agoric's Vat library",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -8,80 +8,75 @@
8
8
  "scripts": {
9
9
  "build": "yarn build:bundles",
10
10
  "build:bundles": "node scripts/build-bundles.js",
11
- "build:docs": "yarn build:boot-viz && yarn build:boot-viz-gov && yarn build:boot-viz-sim && yarn build:boot-viz-sim-gov",
12
- "build:boot-viz": "node src/authorityViz.js >docs/boot.dot && dot -Tsvg docs/boot.dot >docs/boot.dot.svg",
13
- "build:boot-viz-gov": "node src/authorityViz.js --gov>docs/boot-gov.dot && dot -Tsvg docs/boot-gov.dot >docs/boot-gov.dot.svg",
14
- "build:boot-viz-sim": "node src/authorityViz.js --sim-chain >docs/boot-sim.dot && dot -Tsvg docs/boot-sim.dot >docs/boot-sim.dot.svg",
15
- "build:boot-viz-sim-gov": "node src/authorityViz.js --sim-chain --gov >docs/boot-sim-gov.dot && dot -Tsvg docs/boot-sim-gov.dot >docs/boot-sim-gov.dot.svg",
16
- "build:restart-vats-proposal": "agoric run scripts/restart-vats.js",
17
- "prepack": "tsc --build jsconfig.build.json",
11
+ "prepack": "tsc --build tsconfig.build.json",
18
12
  "postpack": "git clean -f '*.d.ts*'",
19
13
  "test": "ava",
20
14
  "test:c8": "c8 $C8_OPTIONS ava",
21
- "test:xs": "SWINGSET_WORKER_TYPE=xs-worker ava 'test/bootstrapTests/**/test-*.js' 'test/upgrading/**/test-*.js'",
15
+ "test:xs": "exit 0",
22
16
  "lint-fix": "yarn lint:eslint --fix",
23
17
  "lint": "run-s --continue-on-error lint:*",
24
- "lint:types": "tsc -p jsconfig.json",
18
+ "lint:types": "tsc",
25
19
  "lint:eslint": "eslint ."
26
20
  },
27
21
  "keywords": [],
28
22
  "author": "Agoric",
29
23
  "license": "Apache-2.0",
30
24
  "dependencies": {
31
- "@agoric/assert": "^0.6.0",
32
- "@agoric/ertp": "^0.16.2",
33
- "@agoric/governance": "^0.10.3",
34
- "@agoric/inter-protocol": "^0.16.1",
35
- "@agoric/internal": "^0.3.2",
36
- "@agoric/notifier": "^0.6.2",
37
- "@agoric/sharing-service": "^0.2.11",
38
- "@agoric/store": "^0.9.2",
39
- "@agoric/swingset-vat": "^0.32.2",
40
- "@agoric/time": "^0.3.2",
41
- "@agoric/vat-data": "^0.5.2",
42
- "@agoric/zoe": "^0.26.2",
43
- "@agoric/zone": "^0.2.2",
44
- "@endo/far": "^0.2.18",
45
- "@endo/import-bundle": "^0.3.4",
46
- "@endo/init": "^0.5.56",
47
- "@endo/marshal": "^0.8.5",
48
- "@endo/nat": "^4.1.27",
49
- "@endo/promise-kit": "^0.2.56",
50
- "jessie.js": "^0.3.2"
25
+ "@agoric/assert": "0.6.1-calypso-dev-84eb287.0+84eb287",
26
+ "@agoric/cosmic-proto": "0.4.1-calypso-dev-84eb287.0+84eb287",
27
+ "@agoric/ertp": "0.16.3-calypso-dev-84eb287.0+84eb287",
28
+ "@agoric/governance": "0.10.4-calypso-dev-84eb287.0+84eb287",
29
+ "@agoric/internal": "0.3.3-calypso-dev-84eb287.0+84eb287",
30
+ "@agoric/network": "0.1.1-calypso-dev-84eb287.0+84eb287",
31
+ "@agoric/notifier": "0.6.3-calypso-dev-84eb287.0+84eb287",
32
+ "@agoric/store": "0.9.3-calypso-dev-84eb287.0+84eb287",
33
+ "@agoric/swingset-vat": "0.32.3-calypso-dev-84eb287.0+84eb287",
34
+ "@agoric/time": "0.3.3-calypso-dev-84eb287.0+84eb287",
35
+ "@agoric/vat-data": "0.5.3-calypso-dev-84eb287.0+84eb287",
36
+ "@agoric/vow": "0.1.1-calypso-dev-84eb287.0+84eb287",
37
+ "@agoric/zoe": "0.26.3-calypso-dev-84eb287.0+84eb287",
38
+ "@agoric/zone": "0.2.3-calypso-dev-84eb287.0+84eb287",
39
+ "@endo/far": "^1.1.2",
40
+ "@endo/import-bundle": "^1.1.2",
41
+ "@endo/marshal": "^1.5.0",
42
+ "@endo/nat": "^5.0.7",
43
+ "@endo/patterns": "^1.4.0",
44
+ "@endo/promise-kit": "^1.1.2",
45
+ "import-meta-resolve": "^2.2.1",
46
+ "jessie.js": "^0.3.4"
51
47
  },
52
48
  "devDependencies": {
53
- "@agoric/cosmic-swingset": "^0.41.3",
54
- "@agoric/deploy-script-support": "^0.10.3",
55
- "@agoric/smart-wallet": "^0.5.3",
56
- "@agoric/swing-store": "^0.9.1",
57
- "@agoric/swingset-liveslots": "^0.10.2",
58
- "@endo/bundle-source": "^2.5.1",
59
- "@endo/captp": "^3.1.1",
60
- "@endo/stream": "^0.3.25",
61
- "ava": "^5.2.0",
62
- "c8": "^7.13.0",
63
- "import-meta-resolve": "^2.2.1"
49
+ "@agoric/swingset-liveslots": "0.10.3-calypso-dev-84eb287.0+84eb287",
50
+ "@endo/bundle-source": "^3.2.3",
51
+ "@endo/init": "^1.1.2",
52
+ "ava": "^5.3.0",
53
+ "c8": "^9.1.0"
64
54
  },
65
55
  "files": [
66
56
  "CHANGELOG.md",
67
57
  "src/",
68
- "*.json",
69
- "globals.d.ts",
70
- "exported.js"
58
+ "scripts/",
59
+ "tools/",
60
+ "index.*"
71
61
  ],
72
62
  "publishConfig": {
73
63
  "access": "public"
74
64
  },
75
65
  "engines": {
76
- "node": ">=14.15.0"
66
+ "node": "^18.12 || ^20.9"
77
67
  },
78
68
  "ava": {
79
69
  "files": [
80
- "test/**/test-*.js"
70
+ "test/**/*.test.*"
71
+ ],
72
+ "require": [
73
+ "@endo/init/debug.js"
81
74
  ],
82
- "concurrency": 2,
83
75
  "timeout": "20m",
84
76
  "workerThreads": false
85
77
  },
86
- "gitHead": "ba3b776444425bbcb275ce918794d9259f8e15da"
78
+ "typeCoverage": {
79
+ "atLeast": 91.21
80
+ },
81
+ "gitHead": "84eb287915c8255d68e845a9b6e10c790f0d54cb"
87
82
  }
@@ -0,0 +1,19 @@
1
+ #! /usr/bin/env node
2
+ import '@endo/init';
3
+ import { createBundles } from '@agoric/internal/src/node/createBundles.js';
4
+ import url from 'url';
5
+
6
+ const dirname = url.fileURLToPath(new URL('.', import.meta.url));
7
+
8
+ // TODO end inter-package filesystem references https://github.com/Agoric/agoric-sdk/issues/8178
9
+
10
+ const sourceToBundle = [
11
+ ['@agoric/vats/src/centralSupply.js', '../bundles/bundle-centralSupply.js'],
12
+ ['@agoric/vats/src/mintHolder.js', '../bundles/bundle-mintHolder.js'],
13
+ [
14
+ '@agoric/inter-protocol/src/provisionPool.js',
15
+ '../bundles/bundle-provisionPool.js',
16
+ ],
17
+ ];
18
+
19
+ await createBundles(sourceToBundle, dirname);
@@ -0,0 +1,193 @@
1
+ /**
2
+ * @typedef {object} TargetApp an object representing the app that receives
3
+ * upcalls from the low-level TargetHost on the other side of a bridge
4
+ * @property {(obj: MostlyPureData) => Promise<MostlyPureData>} receiveUpcall
5
+ * receive data from the TargetHost, and return a data result
6
+ */
7
+ export const TargetAppI: import("@endo/patterns").InterfaceGuard<{
8
+ receiveUpcall: import("@endo/patterns").MethodGuard;
9
+ }>;
10
+ /**
11
+ * @typedef {object} TargetHost an object representing the host that receives
12
+ * downcalls from the high-level TargetApp over a bridge
13
+ * @property {(obj: MostlyPureData) => Promise<MostlyPureData>} sendDowncall
14
+ * send data to the TargetHost, which returns a data result
15
+ */
16
+ export const TargetHostI: import("@endo/patterns").InterfaceGuard<{
17
+ sendDowncall: import("@endo/patterns").MethodGuard;
18
+ }>;
19
+ /**
20
+ * @typedef {object} AppTransformer an object for replacing a TargetApp,
21
+ * generally with a wrapper that intercepts its inputs and/or results to
22
+ * ensure conformance with a protocol and/or interface (e.g., an active tap
23
+ * can encode results of the wrapped TargetApp into an acknowledgement
24
+ * message)
25
+ * @property {(
26
+ * app: ERef<TargetApp>,
27
+ * targetHost: ERef<TargetHost>,
28
+ * ...args: unknown[]
29
+ * ) => ERef<TargetApp>} wrapApp
30
+ */
31
+ export const AppTransformerI: import("@endo/patterns").InterfaceGuard<{
32
+ wrapApp: import("@endo/patterns").MethodGuard;
33
+ }>;
34
+ /**
35
+ * @typedef {object} TargetRegistration is an ExoClass of its own, and each
36
+ * instance is an attenuation of a BridgeTargetKit `targetRegistry` facet that
37
+ * has access to internal state thereof but has been scoped down to a single
38
+ * target.
39
+ * @property {() => Promise<void>} revoke performs unregistration (and sends the
40
+ * corresponding "BRIDGE_TARGET_UNREGISTER" message to the targetHost).
41
+ * @property {(targetApp: ERef<TargetApp>) => Promise<void>} updateTargetApp
42
+ * replaces the app associated with the target (but with no corresponding
43
+ * message).
44
+ */
45
+ export const TargetRegistrationI: import("@endo/patterns").InterfaceGuard<{
46
+ updateTargetApp: import("@endo/patterns").MethodGuard;
47
+ revoke: import("@endo/patterns").MethodGuard;
48
+ }>;
49
+ export function prepareTargetRegistration(zone: import("@agoric/base-zone").Zone): (target: string, registry: TargetRegistry, args: unknown[] | null) => import("@endo/exo").Guarded<{
50
+ /**
51
+ * Atomically point the registration at a different app.
52
+ *
53
+ * @param {TargetApp} app new app to handle messages for the target
54
+ */
55
+ updateTargetApp(app: TargetApp): Promise<void>;
56
+ /** Atomically delete the registration. */
57
+ revoke(): Promise<void>;
58
+ }>;
59
+ export function prepareBridgeTargetKit(zone: import("@agoric/base-zone").Zone, makeTargetRegistration: ReturnType<typeof prepareTargetRegistration>): (manager: import("./types").ScopedBridgeManager<import("@agoric/internal").BridgeIdValue>, inboundEventType: string, appTransformer?: AppTransformer | undefined) => import("@endo/exo").GuardedKit<{
60
+ bridgeHandler: {
61
+ fromBridge(obj: any): Promise<any>;
62
+ };
63
+ targetHost: {
64
+ sendDowncall(obj: any): Promise<any>;
65
+ };
66
+ targetRegistry: {
67
+ /**
68
+ * Register an app to handle messages for a target.
69
+ *
70
+ * @param {string} target
71
+ * @param {TargetApp} app
72
+ * @param {unknown[]} [args]
73
+ * @returns {Promise<TargetRegistration>} power to set or delete the
74
+ * registration
75
+ */
76
+ register(target: string, app: TargetApp, args?: unknown[] | undefined): Promise<TargetRegistration>;
77
+ /**
78
+ * Update the app that handles messages for a target.
79
+ *
80
+ * @param {string} target
81
+ * @param {TargetApp} app
82
+ * @param {unknown[]} [args]
83
+ * @returns {Promise<void>}
84
+ */
85
+ reregister(target: string, app: TargetApp, args?: unknown[] | undefined): Promise<void>;
86
+ /**
87
+ * Unregister the target, bypassing the attenuated `TargetRegistration`
88
+ * API.
89
+ *
90
+ * @param {string} target
91
+ * @returns {Promise<void>}
92
+ */
93
+ unregister(target: string): Promise<void>;
94
+ };
95
+ }>;
96
+ export function prepareBridgeTargetModule(zone: import("@agoric/base-zone").Zone): {
97
+ makeBridgeTargetKit: (manager: import("./types").ScopedBridgeManager<import("@agoric/internal").BridgeIdValue>, inboundEventType: string, appTransformer?: AppTransformer | undefined) => import("@endo/exo").GuardedKit<{
98
+ bridgeHandler: {
99
+ fromBridge(obj: any): Promise<any>;
100
+ };
101
+ targetHost: {
102
+ sendDowncall(obj: any): Promise<any>;
103
+ };
104
+ targetRegistry: {
105
+ /**
106
+ * Register an app to handle messages for a target.
107
+ *
108
+ * @param {string} target
109
+ * @param {TargetApp} app
110
+ * @param {unknown[]} [args]
111
+ * @returns {Promise<TargetRegistration>} power to set or delete the
112
+ * registration
113
+ */
114
+ register(target: string, app: TargetApp, args?: unknown[] | undefined): Promise<TargetRegistration>;
115
+ /**
116
+ * Update the app that handles messages for a target.
117
+ *
118
+ * @param {string} target
119
+ * @param {TargetApp} app
120
+ * @param {unknown[]} [args]
121
+ * @returns {Promise<void>}
122
+ */
123
+ reregister(target: string, app: TargetApp, args?: unknown[] | undefined): Promise<void>;
124
+ /**
125
+ * Unregister the target, bypassing the attenuated `TargetRegistration`
126
+ * API.
127
+ *
128
+ * @param {string} target
129
+ * @returns {Promise<void>}
130
+ */
131
+ unregister(target: string): Promise<void>;
132
+ };
133
+ }>;
134
+ };
135
+ /**
136
+ * ideally should be PureData, but that type is
137
+ * too restrictive to work out-of-the-box.
138
+ */
139
+ export type MostlyPureData = any;
140
+ /**
141
+ * an object representing the app that receives
142
+ * upcalls from the low-level TargetHost on the other side of a bridge
143
+ */
144
+ export type TargetApp = {
145
+ /**
146
+ * receive data from the TargetHost, and return a data result
147
+ */
148
+ receiveUpcall: (obj: MostlyPureData) => Promise<MostlyPureData>;
149
+ };
150
+ /**
151
+ * an object representing the host that receives
152
+ * downcalls from the high-level TargetApp over a bridge
153
+ */
154
+ export type TargetHost = {
155
+ /**
156
+ * send data to the TargetHost, which returns a data result
157
+ */
158
+ sendDowncall: (obj: MostlyPureData) => Promise<MostlyPureData>;
159
+ };
160
+ /**
161
+ * an object for replacing a TargetApp,
162
+ * generally with a wrapper that intercepts its inputs and/or results to
163
+ * ensure conformance with a protocol and/or interface (e.g., an active tap
164
+ * can encode results of the wrapped TargetApp into an acknowledgement
165
+ * message)
166
+ */
167
+ export type AppTransformer = {
168
+ wrapApp: (app: ERef<TargetApp>, targetHost: ERef<TargetHost>, ...args: unknown[]) => ERef<TargetApp>;
169
+ };
170
+ /**
171
+ * is an ExoClass of its own, and each
172
+ * instance is an attenuation of a BridgeTargetKit `targetRegistry` facet that
173
+ * has access to internal state thereof but has been scoped down to a single
174
+ * target.
175
+ */
176
+ export type TargetRegistration = {
177
+ /**
178
+ * performs unregistration (and sends the
179
+ * corresponding "BRIDGE_TARGET_UNREGISTER" message to the targetHost).
180
+ */
181
+ revoke: () => Promise<void>;
182
+ /**
183
+ * replaces the app associated with the target (but with no corresponding
184
+ * message).
185
+ */
186
+ updateTargetApp: (targetApp: ERef<TargetApp>) => Promise<void>;
187
+ };
188
+ export type TargetRegistry = {
189
+ register: (target: string, targetApp: ERef<TargetApp>, args?: unknown[]) => Promise<TargetRegistration>;
190
+ reregister: (target: string, targetApp: ERef<TargetApp>, args?: unknown[]) => Promise<void>;
191
+ unregister: (target: string) => Promise<void>;
192
+ };
193
+ //# sourceMappingURL=bridge-target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge-target.d.ts","sourceRoot":"","sources":["bridge-target.js"],"names":[],"mappings":"AAYA;;;;;GAKG;AAEH;;GAEG;AAEH;;;;;GAKG;AAEH;;GAEG;AAEH;;;;;;;;;;;GAWG;AAEH;;GAOG;AAEH;;;;;;;;;;GAUG;AAEH;;;GAGG;AA4BI,gDADK,OAAO,mBAAmB,EAAE,IAAI;IAiBtC;;;;OAIG;yBADQ,SAAS;IAapB,0CAA0C;;GAW7C;AAyBI,6CAHI,OAAO,mBAAmB,EAAE,IAAI,0BAChC,UAAU,CAAC,OAAO,yBAAyB,CAAC;;;;;;;;QA6C/C;;;;;;;;WAQG;yBALQ,MAAM,OACN,SAAS,iCAEP,OAAO,CAAC,kBAAkB,CAAC;QAoCxC;;;;;;;WAOG;2BAJQ,MAAM,OACN,SAAS,iCAEP,OAAO,CAAC,IAAI,CAAC;QAyB1B;;;;;;WAMG;2BAFQ,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC;;GAc/B;AAII,gDADK,OAAO,mBAAmB,EAAE,IAAI;;;;;;;;;YA/FpC;;;;;;;;eAQG;6BALQ,MAAM,OACN,SAAS,iCAEP,OAAO,CAAC,kBAAkB,CAAC;YAoCxC;;;;;;;eAOG;+BAJQ,MAAM,OACN,SAAS,iCAEP,OAAO,CAAC,IAAI,CAAC;YAyB1B;;;;;;eAMG;+BAFQ,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC;;;EA0BjC;;;;;6BApTY,GAAG;;;;;;;;;mBASF,CAAC,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,cAAc,CAAC;;;;;;;;;;kBAWhD,CAAC,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,cAAc,CAAC;;;;;;;;;;aAchD,CACb,GAAO,EAAE,IAAI,CAAC,SAAS,CAAC,EACxB,UAAc,EAAE,IAAI,CAAC,UAAU,CAAC,EAChC,GAAO,IAAI,EAAE,OAAO,EAAE,KACf,IAAI,CAAC,SAAS,CAAC;;;;;;;;;;;;;YAiBT,MAAM,OAAO,CAAC,IAAI,CAAC;;;;;qBAEnB,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC;;;cAY7C,CACb,MAAU,EAAE,MAAM,EAClB,SAAa,EAAE,IAAI,CAAC,SAAS,CAAC,EAC9B,IAAQ,CAAC,EAAE,OAAO,EAAE,KACb,OAAO,CAAC,kBAAkB,CAAC;gBACrB,CACb,MAAU,EAAE,MAAM,EAClB,SAAa,EAAE,IAAI,CAAC,SAAS,CAAC,EAC9B,IAAQ,CAAC,EAAE,OAAO,EAAE,KACb,OAAO,CAAC,IAAI,CAAC;gBACP,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC"}