@agoric/internal 0.3.3-other-dev-1f26562.0 → 0.3.3-other-dev-3eb1a1d.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/README.md +7 -2
- package/exported.js +2 -0
- package/package.json +35 -17
- package/src/action-types.d.ts +50 -5
- package/src/action-types.d.ts.map +1 -1
- package/src/action-types.js +73 -14
- package/src/batched-deliver.d.ts +9 -6
- package/src/batched-deliver.d.ts.map +1 -1
- package/src/batched-deliver.js +9 -3
- package/src/callback.d.ts +23 -16
- package/src/callback.d.ts.map +1 -1
- package/src/callback.js +48 -55
- package/src/chain-storage-paths.d.ts +2 -3
- package/src/chain-storage-paths.d.ts.map +1 -1
- package/src/chain-storage-paths.js +2 -3
- package/src/chain-utils.d.ts +25 -0
- package/src/chain-utils.d.ts.map +1 -0
- package/src/chain-utils.js +57 -0
- package/src/config.d.ts +24 -12
- package/src/config.d.ts.map +1 -1
- package/src/config.js +21 -10
- package/src/debug.d.ts +1 -1
- package/src/errors.d.ts +2 -0
- package/src/errors.d.ts.map +1 -0
- package/src/errors.js +16 -0
- package/src/index.d.ts +8 -1
- package/src/index.js +12 -2
- package/src/install-ses-debug.d.ts +2 -0
- package/src/install-ses-debug.d.ts.map +1 -0
- package/src/install-ses-debug.js +6 -0
- package/src/js-utils.d.ts +7 -0
- package/src/js-utils.d.ts.map +1 -0
- package/src/js-utils.js +89 -0
- package/src/lib-chainStorage.d.ts +42 -52
- package/src/lib-chainStorage.d.ts.map +1 -1
- package/src/lib-chainStorage.js +88 -77
- package/src/lib-nodejs/engine-gc.d.ts +3 -0
- package/src/lib-nodejs/engine-gc.d.ts.map +1 -0
- package/src/lib-nodejs/engine-gc.js +22 -0
- package/src/lib-nodejs/gc-and-finalize.d.ts +2 -0
- package/src/lib-nodejs/gc-and-finalize.d.ts.map +1 -0
- package/src/lib-nodejs/gc-and-finalize.js +91 -0
- package/src/lib-nodejs/spawnSubprocessWorker.d.ts +15 -0
- package/src/lib-nodejs/spawnSubprocessWorker.d.ts.map +1 -0
- package/src/lib-nodejs/spawnSubprocessWorker.js +89 -0
- package/src/lib-nodejs/waitUntilQuiescent.d.ts +2 -0
- package/src/lib-nodejs/waitUntilQuiescent.d.ts.map +1 -0
- package/src/lib-nodejs/waitUntilQuiescent.js +18 -0
- package/src/lib-nodejs/worker-protocol.d.ts +4 -0
- package/src/lib-nodejs/worker-protocol.d.ts.map +1 -0
- package/src/lib-nodejs/worker-protocol.js +54 -0
- package/src/magic-cookie-test-only.js +2 -2
- package/src/marshal.d.ts +20 -0
- package/src/marshal.d.ts.map +1 -0
- package/src/marshal.js +137 -0
- package/src/method-tools.d.ts +1 -0
- package/src/method-tools.d.ts.map +1 -1
- package/src/method-tools.js +29 -16
- package/src/netstring.d.ts +24 -0
- package/src/netstring.d.ts.map +1 -0
- package/src/netstring.js +124 -0
- package/src/node/buffer-line-transform.d.ts +17 -13
- package/src/node/buffer-line-transform.d.ts.map +1 -1
- package/src/node/buffer-line-transform.js +12 -9
- package/src/node/createBundles.d.ts.map +1 -1
- package/src/node/createBundles.js +12 -3
- package/src/node/fs-stream.d.ts +1 -1
- package/src/node/fs-stream.d.ts.map +1 -1
- package/src/node/fs-stream.js +42 -30
- package/src/node/shutdown.d.ts.map +1 -1
- package/src/node/shutdown.js +0 -1
- package/src/priority-senders.d.ts +1 -1
- package/src/priority-senders.d.ts.map +1 -1
- package/src/priority-senders.js +8 -5
- package/src/queue.d.ts +1 -1
- package/src/queue.d.ts.map +1 -1
- package/src/queue.js +7 -8
- package/src/scratch.d.ts +1 -1
- package/src/scratch.d.ts.map +1 -1
- package/src/ses-utils.d.ts +60 -0
- package/src/ses-utils.d.ts.map +1 -0
- package/src/ses-utils.js +346 -0
- package/src/storage-test-utils.d.ts +41 -84
- package/src/storage-test-utils.d.ts.map +1 -1
- package/src/storage-test-utils.js +169 -116
- package/src/tagged.d.ts +149 -0
- package/src/testing-utils.d.ts +2 -0
- package/src/testing-utils.d.ts.map +1 -1
- package/src/testing-utils.js +44 -5
- package/src/tokens.d.ts +34 -0
- package/src/tokens.d.ts.map +1 -0
- package/src/tokens.js +35 -0
- package/src/typeCheck.d.ts +9 -0
- package/src/typeCheck.d.ts.map +1 -0
- package/src/typeCheck.js +23 -0
- package/src/typeGuards.d.ts +2 -0
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +8 -0
- package/src/types-index.d.ts +1 -0
- package/src/types-index.js +2 -0
- package/src/types.d.ts +71 -18
- package/src/types.d.ts.map +1 -0
- package/src/types.ts +108 -0
- package/src/upgrade-api.d.ts +14 -4
- package/src/upgrade-api.d.ts.map +1 -1
- package/src/upgrade-api.js +50 -18
- package/CHANGELOG.md +0 -106
- package/src/utils.d.ts +0 -67
- package/src/utils.d.ts.map +0 -1
- package/src/utils.js +0 -451
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
|
|
13
|
+
It is meant to be a home for modules that have no dependencies on other packages in this repository, except for the following packages that do not theirselves depend upon any other @agoric packages and may be destined for migration elsewhere:
|
|
14
|
+
|
|
15
|
+
- [base-zone](../base-zone)
|
|
16
|
+
- [store](../store)
|
|
17
|
+
- [cosmic-proto](../cosmic-proto)
|
|
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
package/package.json
CHANGED
|
@@ -1,46 +1,64 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/internal",
|
|
3
|
-
"version": "0.3.3-other-dev-
|
|
3
|
+
"version": "0.3.3-other-dev-3eb1a1d.0+3eb1a1d",
|
|
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": "
|
|
8
|
+
"node": "^18.12 || ^20.9"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "exit 0",
|
|
12
|
-
"prepack": "tsc --build
|
|
13
|
-
"postpack": "git clean -f '*.d.ts*'",
|
|
12
|
+
"prepack": "tsc --build tsconfig.build.json",
|
|
13
|
+
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
|
|
14
14
|
"test": "ava",
|
|
15
15
|
"test:nyc": "exit 0",
|
|
16
16
|
"test:xs": "exit 0",
|
|
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
|
|
20
|
+
"lint:types": "tsc"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@agoric/zone": "0.
|
|
24
|
-
"@endo/
|
|
25
|
-
"@endo/
|
|
26
|
-
"@endo/
|
|
27
|
-
"@endo/
|
|
28
|
-
"@endo/
|
|
23
|
+
"@agoric/base-zone": "0.1.1-other-dev-3eb1a1d.0+3eb1a1d",
|
|
24
|
+
"@endo/common": "^1.2.8",
|
|
25
|
+
"@endo/errors": "^1.2.8",
|
|
26
|
+
"@endo/far": "^1.1.9",
|
|
27
|
+
"@endo/init": "^1.1.7",
|
|
28
|
+
"@endo/marshal": "^1.6.2",
|
|
29
|
+
"@endo/pass-style": "^1.4.7",
|
|
30
|
+
"@endo/patterns": "^1.4.7",
|
|
31
|
+
"@endo/promise-kit": "^1.1.8",
|
|
32
|
+
"@endo/stream": "^1.2.8",
|
|
29
33
|
"anylogger": "^0.21.0",
|
|
30
|
-
"jessie.js": "^0.3.
|
|
34
|
+
"jessie.js": "^0.3.4"
|
|
31
35
|
},
|
|
32
36
|
"devDependencies": {
|
|
33
|
-
"@
|
|
34
|
-
"
|
|
35
|
-
"
|
|
37
|
+
"@agoric/cosmic-proto": "0.4.1-other-dev-3eb1a1d.0+3eb1a1d",
|
|
38
|
+
"@endo/exo": "^1.5.7",
|
|
39
|
+
"@endo/init": "^1.1.7",
|
|
40
|
+
"ava": "^5.3.0",
|
|
41
|
+
"tsd": "^0.31.1"
|
|
42
|
+
},
|
|
43
|
+
"ava": {
|
|
44
|
+
"require": [
|
|
45
|
+
"@endo/init/debug.js"
|
|
46
|
+
],
|
|
47
|
+
"files": [
|
|
48
|
+
"test/**/*.test.*"
|
|
49
|
+
]
|
|
36
50
|
},
|
|
37
51
|
"author": "Agoric",
|
|
38
52
|
"license": "Apache-2.0",
|
|
39
53
|
"files": [
|
|
40
|
-
"src"
|
|
54
|
+
"src",
|
|
55
|
+
"exported.js"
|
|
41
56
|
],
|
|
42
57
|
"publishConfig": {
|
|
43
58
|
"access": "public"
|
|
44
59
|
},
|
|
45
|
-
"
|
|
60
|
+
"typeCoverage": {
|
|
61
|
+
"atLeast": 93.14
|
|
62
|
+
},
|
|
63
|
+
"gitHead": "3eb1a1d2d75b2b4a94807cd3bf759bc9fc531f05"
|
|
46
64
|
}
|
package/src/action-types.d.ts
CHANGED
|
@@ -1,16 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of messages used for communication between a cosmos-sdk blockchain node
|
|
3
|
+
* and its paired swingset VM, especially for the ABCI lifecycle. See:
|
|
4
|
+
*
|
|
5
|
+
* - https://github.com/tendermint/tendermint/blob/v0.34.x/spec/abci/abci.md#block-execution
|
|
6
|
+
* - ../../../golang/cosmos/vm/action.go
|
|
7
|
+
* - ../../../golang/cosmos/app/app.go
|
|
8
|
+
* - ../../../golang/cosmos/x/swingset/abci.go
|
|
9
|
+
* - ../../../golang/cosmos/x/swingset/keeper/swing_store_exports_handler.go
|
|
10
|
+
* - ../../cosmic-swingset/src/chain-main.js
|
|
11
|
+
* - ../../cosmic-swingset/src/launch-chain.js
|
|
12
|
+
*/
|
|
13
|
+
export type SwingsetMessageType = (typeof SwingsetMessageType)[keyof typeof SwingsetMessageType];
|
|
14
|
+
export namespace SwingsetMessageType {
|
|
15
|
+
let AG_COSMOS_INIT: "AG_COSMOS_INIT";
|
|
16
|
+
let BEGIN_BLOCK: "BEGIN_BLOCK";
|
|
17
|
+
let END_BLOCK: "END_BLOCK";
|
|
18
|
+
let COMMIT_BLOCK: "COMMIT_BLOCK";
|
|
19
|
+
let AFTER_COMMIT_BLOCK: "AFTER_COMMIT_BLOCK";
|
|
20
|
+
let SWING_STORE_EXPORT: "SWING_STORE_EXPORT";
|
|
21
|
+
}
|
|
1
22
|
export const AG_COSMOS_INIT: "AG_COSMOS_INIT";
|
|
2
|
-
export const SWING_STORE_EXPORT: "SWING_STORE_EXPORT";
|
|
3
23
|
export const BEGIN_BLOCK: "BEGIN_BLOCK";
|
|
4
|
-
export const CALCULATE_FEES_IN_BEANS: "CALCULATE_FEES_IN_BEANS";
|
|
5
|
-
export const CORE_EVAL: "CORE_EVAL";
|
|
6
|
-
export const DELIVER_INBOUND: "DELIVER_INBOUND";
|
|
7
24
|
export const END_BLOCK: "END_BLOCK";
|
|
8
25
|
export const COMMIT_BLOCK: "COMMIT_BLOCK";
|
|
9
26
|
export const AFTER_COMMIT_BLOCK: "AFTER_COMMIT_BLOCK";
|
|
27
|
+
export const SWING_STORE_EXPORT: "SWING_STORE_EXPORT";
|
|
28
|
+
/**
|
|
29
|
+
* Types of "action" messages consumed by the swingset VM from actionQueue or
|
|
30
|
+
* highPriorityQueue during END_BLOCK. See:
|
|
31
|
+
*
|
|
32
|
+
* - ../../../golang/cosmos/x/swingset/keeper/msg_server.go
|
|
33
|
+
* - ../../../golang/cosmos/x/swingset/keeper/proposal.go
|
|
34
|
+
* - ../../../golang/cosmos/x/vbank/vbank.go
|
|
35
|
+
* - ../../../golang/cosmos/x/vibc/handler.go
|
|
36
|
+
* - ../../../golang/cosmos/x/vibc/keeper/triggers.go
|
|
37
|
+
* - ../../../golang/cosmos/x/vibc/types/ibc_module.go
|
|
38
|
+
*/
|
|
39
|
+
export type QueuedActionType = (typeof QueuedActionType)[keyof typeof QueuedActionType];
|
|
40
|
+
export namespace QueuedActionType {
|
|
41
|
+
let CORE_EVAL: "CORE_EVAL";
|
|
42
|
+
let DELIVER_INBOUND: "DELIVER_INBOUND";
|
|
43
|
+
let IBC_EVENT: "IBC_EVENT";
|
|
44
|
+
let INSTALL_BUNDLE: "INSTALL_BUNDLE";
|
|
45
|
+
let PLEASE_PROVISION: "PLEASE_PROVISION";
|
|
46
|
+
let VBANK_BALANCE_UPDATE: "VBANK_BALANCE_UPDATE";
|
|
47
|
+
let WALLET_ACTION: "WALLET_ACTION";
|
|
48
|
+
let WALLET_SPEND_ACTION: "WALLET_SPEND_ACTION";
|
|
49
|
+
}
|
|
50
|
+
export const CORE_EVAL: "CORE_EVAL";
|
|
51
|
+
export const DELIVER_INBOUND: "DELIVER_INBOUND";
|
|
10
52
|
export const IBC_EVENT: "IBC_EVENT";
|
|
53
|
+
export const INSTALL_BUNDLE: "INSTALL_BUNDLE";
|
|
11
54
|
export const PLEASE_PROVISION: "PLEASE_PROVISION";
|
|
12
55
|
export const VBANK_BALANCE_UPDATE: "VBANK_BALANCE_UPDATE";
|
|
13
56
|
export const WALLET_ACTION: "WALLET_ACTION";
|
|
14
57
|
export const WALLET_SPEND_ACTION: "WALLET_SPEND_ACTION";
|
|
15
|
-
export const
|
|
58
|
+
export const CALCULATE_FEES_IN_BEANS: "CALCULATE_FEES_IN_BEANS";
|
|
59
|
+
export const VTRANSFER_IBC_EVENT: "VTRANSFER_IBC_EVENT";
|
|
60
|
+
export const KERNEL_UPGRADE_EVENTS: "KERNEL_UPGRADE_EVENTS";
|
|
16
61
|
//# sourceMappingURL=action-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-types.d.ts","sourceRoot":"","sources":["action-types.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"action-types.d.ts","sourceRoot":"","sources":["action-types.js"],"names":[],"mappings":";;;;;;;;;;;;kCAcU,CAAC,OAAO,mBAAmB,EAAE,MAAM,OAAO,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;+BAiC9D,CAAC,OAAO,gBAAgB,EAAE,MAAM,OAAO,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;AA0BlE,gEAAiE;AACjE,wDAAyD;AACzD,4DAA6D"}
|
package/src/action-types.js
CHANGED
|
@@ -1,17 +1,76 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Types of messages used for communication between a cosmos-sdk blockchain node
|
|
5
|
+
* and its paired swingset VM, especially for the ABCI lifecycle. See:
|
|
6
|
+
*
|
|
7
|
+
* - https://github.com/tendermint/tendermint/blob/v0.34.x/spec/abci/abci.md#block-execution
|
|
8
|
+
* - ../../../golang/cosmos/vm/action.go
|
|
9
|
+
* - ../../../golang/cosmos/app/app.go
|
|
10
|
+
* - ../../../golang/cosmos/x/swingset/abci.go
|
|
11
|
+
* - ../../../golang/cosmos/x/swingset/keeper/swing_store_exports_handler.go
|
|
12
|
+
* - ../../cosmic-swingset/src/chain-main.js
|
|
13
|
+
* - ../../cosmic-swingset/src/launch-chain.js
|
|
14
|
+
*
|
|
15
|
+
* @enum {(typeof SwingsetMessageType)[keyof typeof SwingsetMessageType]}
|
|
16
|
+
*/
|
|
17
|
+
export const SwingsetMessageType = /** @type {const} */ ({
|
|
18
|
+
AG_COSMOS_INIT: 'AG_COSMOS_INIT', // used to synchronize at process launch
|
|
19
|
+
BEGIN_BLOCK: 'BEGIN_BLOCK',
|
|
20
|
+
END_BLOCK: 'END_BLOCK',
|
|
21
|
+
COMMIT_BLOCK: 'COMMIT_BLOCK',
|
|
22
|
+
AFTER_COMMIT_BLOCK: 'AFTER_COMMIT_BLOCK',
|
|
23
|
+
SWING_STORE_EXPORT: 'SWING_STORE_EXPORT', // used to synchronize data export
|
|
24
|
+
});
|
|
25
|
+
harden(SwingsetMessageType);
|
|
26
|
+
|
|
27
|
+
// TODO: Update all imports to use SwingsetMessageType. But until then...
|
|
28
|
+
export const {
|
|
29
|
+
AG_COSMOS_INIT,
|
|
30
|
+
BEGIN_BLOCK,
|
|
31
|
+
END_BLOCK,
|
|
32
|
+
COMMIT_BLOCK,
|
|
33
|
+
AFTER_COMMIT_BLOCK,
|
|
34
|
+
SWING_STORE_EXPORT,
|
|
35
|
+
} = SwingsetMessageType;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Types of "action" messages consumed by the swingset VM from actionQueue or
|
|
39
|
+
* highPriorityQueue during END_BLOCK. See:
|
|
40
|
+
*
|
|
41
|
+
* - ../../../golang/cosmos/x/swingset/keeper/msg_server.go
|
|
42
|
+
* - ../../../golang/cosmos/x/swingset/keeper/proposal.go
|
|
43
|
+
* - ../../../golang/cosmos/x/vbank/vbank.go
|
|
44
|
+
* - ../../../golang/cosmos/x/vibc/handler.go
|
|
45
|
+
* - ../../../golang/cosmos/x/vibc/keeper/triggers.go
|
|
46
|
+
* - ../../../golang/cosmos/x/vibc/types/ibc_module.go
|
|
47
|
+
*
|
|
48
|
+
* @enum {(typeof QueuedActionType)[keyof typeof QueuedActionType]}
|
|
49
|
+
*/
|
|
50
|
+
export const QueuedActionType = /** @type {const} */ ({
|
|
51
|
+
CORE_EVAL: 'CORE_EVAL',
|
|
52
|
+
DELIVER_INBOUND: 'DELIVER_INBOUND',
|
|
53
|
+
IBC_EVENT: 'IBC_EVENT',
|
|
54
|
+
INSTALL_BUNDLE: 'INSTALL_BUNDLE',
|
|
55
|
+
PLEASE_PROVISION: 'PLEASE_PROVISION',
|
|
56
|
+
VBANK_BALANCE_UPDATE: 'VBANK_BALANCE_UPDATE',
|
|
57
|
+
WALLET_ACTION: 'WALLET_ACTION',
|
|
58
|
+
WALLET_SPEND_ACTION: 'WALLET_SPEND_ACTION',
|
|
59
|
+
});
|
|
60
|
+
harden(QueuedActionType);
|
|
61
|
+
|
|
62
|
+
// TODO: Update all imports to use QueuedActionType. But until then...
|
|
63
|
+
export const {
|
|
64
|
+
CORE_EVAL,
|
|
65
|
+
DELIVER_INBOUND,
|
|
66
|
+
IBC_EVENT,
|
|
67
|
+
INSTALL_BUNDLE,
|
|
68
|
+
PLEASE_PROVISION,
|
|
69
|
+
VBANK_BALANCE_UPDATE,
|
|
70
|
+
WALLET_ACTION,
|
|
71
|
+
WALLET_SPEND_ACTION,
|
|
72
|
+
} = QueuedActionType;
|
|
73
|
+
|
|
6
74
|
export const CALCULATE_FEES_IN_BEANS = 'CALCULATE_FEES_IN_BEANS';
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
9
|
-
export const END_BLOCK = 'END_BLOCK';
|
|
10
|
-
export const COMMIT_BLOCK = 'COMMIT_BLOCK';
|
|
11
|
-
export const AFTER_COMMIT_BLOCK = 'AFTER_COMMIT_BLOCK';
|
|
12
|
-
export const IBC_EVENT = 'IBC_EVENT';
|
|
13
|
-
export const PLEASE_PROVISION = 'PLEASE_PROVISION';
|
|
14
|
-
export const VBANK_BALANCE_UPDATE = 'VBANK_BALANCE_UPDATE';
|
|
15
|
-
export const WALLET_ACTION = 'WALLET_ACTION';
|
|
16
|
-
export const WALLET_SPEND_ACTION = 'WALLET_SPEND_ACTION';
|
|
17
|
-
export const INSTALL_BUNDLE = 'INSTALL_BUNDLE';
|
|
75
|
+
export const VTRANSFER_IBC_EVENT = 'VTRANSFER_IBC_EVENT';
|
|
76
|
+
export const KERNEL_UPGRADE_EVENTS = 'KERNEL_UPGRADE_EVENTS';
|
package/src/batched-deliver.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {(message:
|
|
2
|
+
* @typedef {(message: unknown[], ackNum: number) => Promise<void>} DeliverMessages
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* @param {DeliverMessages} deliver
|
|
6
|
-
* @param {{
|
|
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:
|
|
11
|
-
setTimeout:
|
|
12
|
-
}, batchTimeoutMs?: number): (
|
|
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:
|
|
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":"
|
|
1
|
+
{"version":3,"file":"batched-deliver.d.ts","sourceRoot":"","sources":["batched-deliver.js"],"names":[],"mappings":"AAKA;;GAEG;AAEH;;;;;;;GAOG;AACH,4CAPW,eAAe,gCACf;IACN,YAAY,EAAE,8BAAkC,CAAC;IACjD,UAAU,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"}
|
package/src/batched-deliver.js
CHANGED
|
@@ -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:
|
|
7
|
+
* @typedef {(message: unknown[], ackNum: number) => Promise<void>} DeliverMessages
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @param {DeliverMessages} deliver
|
|
11
|
-
* @param {{
|
|
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:
|
|
2
|
-
export function callE<I extends (...args:
|
|
3
|
-
export function makeSyncFunctionCallback<I extends (...args:
|
|
4
|
-
export function makeFunctionCallback<I extends (...args:
|
|
5
|
-
export function makeSyncMethodCallback<I extends (...args:
|
|
6
|
-
export function makeMethodCallback<I extends (...args:
|
|
7
|
-
export function isCallback(callback: any): callback is
|
|
8
|
-
export function prepareAttenuator<M extends PropertyKey>(zone: import(
|
|
9
|
-
interfaceGuard?: InterfaceGuard | undefined;
|
|
1
|
+
export function callSync<I extends (...args: any[]) => any>(callback: SyncCallback<I>, ...args: Parameters<I>): ReturnType<I>;
|
|
2
|
+
export function callE<I extends (...args: any[]) => any>(callback: Callback<I>, ...args: Parameters<I>): Promise<Awaited<ReturnType<I>>>;
|
|
3
|
+
export function makeSyncFunctionCallback<I extends (...args: any[]) => any, T extends (...args: [...B, ...Parameters<I>]) => ReturnType<I> = I, B extends any[] = []>(target: T, ...bound: B): SyncCallback<I>;
|
|
4
|
+
export function makeFunctionCallback<I extends (...args: any[]) => any, T extends ERef<(...args: [...B, ...Parameters<I>]) => ReturnType<I>> = ERef<I>, B extends any[] = []>(target: T, ...bound: B): Callback<I>;
|
|
5
|
+
export function makeSyncMethodCallback<I extends (...args: any[]) => any, P extends PropertyKey, T extends { [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>; } = { [x in P]: I; }, B extends any[] = []>(target: T, methodName: P, ...bound: B): SyncCallback<I>;
|
|
6
|
+
export function makeMethodCallback<I extends (...args: any[]) => any, P extends PropertyKey, T extends ERef<{ [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>; }> = ERef<{ [x in P]: I; }>, B extends any[] = []>(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?: { [
|
|
15
|
-
}) =>
|
|
16
|
-
export function prepareGuardedAttenuator(zone: import(
|
|
14
|
+
overrides?: { [K_1 in M]?: Callback<any> | null | undefined; } | undefined;
|
|
15
|
+
}) => import("@endo/exo").Guarded<{ [K_2 in M]: (this: any, ...args: any[]) => 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> =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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: any[]) => 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
|
package/src/callback.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["callback.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["callback.js"],"names":[],"mappings":"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"}
|
package/src/callback.js
CHANGED
|
@@ -1,38 +1,31 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
+
import { Fail, makeError, q } from '@endo/errors';
|
|
2
3
|
import { E } from '@endo/far';
|
|
3
4
|
import { isObject, isPassableSymbol } from '@endo/marshal';
|
|
5
|
+
import { getInterfaceMethodKeys } from '@endo/patterns';
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
/** @import {ERef} from '@endo/far' */
|
|
8
|
+
/** @import {Callback, SyncCallback} from './types.js' */
|
|
6
9
|
|
|
7
10
|
const { fromEntries } = Object;
|
|
8
11
|
|
|
9
12
|
const { ownKeys: rawOwnKeys } = Reflect;
|
|
10
13
|
const ownKeys =
|
|
11
|
-
/** @type {<T extends PropertyKey>(obj: {[K in T]?: unknown}) => T[]} */ (
|
|
14
|
+
/** @type {<T extends PropertyKey>(obj: { [K in T]?: unknown }) => T[]} */ (
|
|
12
15
|
rawOwnKeys
|
|
13
16
|
);
|
|
14
17
|
|
|
15
18
|
/**
|
|
16
|
-
* @template T
|
|
17
|
-
* @typedef {(
|
|
19
|
+
* @template {import('@endo/exo').Methods} T
|
|
20
|
+
* @typedef {(
|
|
21
|
+
* ...args: Parameters<ReturnType<prepareAttenuator>>
|
|
22
|
+
* ) => import('@endo/exo').Farable<T>} MakeAttenuator
|
|
18
23
|
*/
|
|
19
24
|
|
|
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
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
/** @template T @typedef {import('@endo/eventual-send').RemotableBrand<{}, T> & T} Farable */
|
|
31
|
-
|
|
32
25
|
/**
|
|
33
26
|
* @param {unknown} key
|
|
34
27
|
* @returns {key is PropertyKey} FIXME: should be just `PropertyKey` but TS
|
|
35
|
-
*
|
|
28
|
+
* complains it can't be used as an index type.
|
|
36
29
|
*/
|
|
37
30
|
const isPropertyKey = key => {
|
|
38
31
|
switch (typeof key) {
|
|
@@ -48,7 +41,7 @@ const isPropertyKey = key => {
|
|
|
48
41
|
/**
|
|
49
42
|
* Synchronously call a callback.
|
|
50
43
|
*
|
|
51
|
-
* @template {(...args:
|
|
44
|
+
* @template {(...args: any[]) => any} I
|
|
52
45
|
* @param {SyncCallback<I>} callback
|
|
53
46
|
* @param {Parameters<I>} args
|
|
54
47
|
* @returns {ReturnType<I>}
|
|
@@ -65,7 +58,7 @@ harden(callSync);
|
|
|
65
58
|
/**
|
|
66
59
|
* Eventual send to a callback.
|
|
67
60
|
*
|
|
68
|
-
* @template {(...args:
|
|
61
|
+
* @template {(...args: any[]) => any} I
|
|
69
62
|
* @param {Callback<I>} callback
|
|
70
63
|
* @param {Parameters<I>} args
|
|
71
64
|
* @returns {Promise<Awaited<ReturnType<I>>>}
|
|
@@ -82,9 +75,9 @@ harden(callE);
|
|
|
82
75
|
/**
|
|
83
76
|
* Create a callback from a near function.
|
|
84
77
|
*
|
|
85
|
-
* @template {(...args:
|
|
78
|
+
* @template {(...args: any[]) => any} I
|
|
86
79
|
* @template {(...args: [...B, ...Parameters<I>]) => ReturnType<I>} [T=I]
|
|
87
|
-
* @template {
|
|
80
|
+
* @template {any[]} [B=[]]
|
|
88
81
|
* @param {T} target
|
|
89
82
|
* @param {B} bound
|
|
90
83
|
* @returns {SyncCallback<I>}
|
|
@@ -101,11 +94,9 @@ harden(makeSyncFunctionCallback);
|
|
|
101
94
|
/**
|
|
102
95
|
* Create a callback from a potentially far function.
|
|
103
96
|
*
|
|
104
|
-
* @template {(...args:
|
|
105
|
-
* @template {
|
|
106
|
-
*
|
|
107
|
-
* >} [T=import('@endo/far').ERef<I>]
|
|
108
|
-
* @template {unknown[]} [B=[]]
|
|
97
|
+
* @template {(...args: any[]) => any} I
|
|
98
|
+
* @template {ERef<(...args: [...B, ...Parameters<I>]) => ReturnType<I>>} [T=ERef<I>]
|
|
99
|
+
* @template {any[]} [B=[]]
|
|
109
100
|
* @param {T} target
|
|
110
101
|
* @param {B} bound
|
|
111
102
|
* @returns {Callback<I>}
|
|
@@ -122,12 +113,12 @@ harden(makeFunctionCallback);
|
|
|
122
113
|
/**
|
|
123
114
|
* Create a callback from a near method.
|
|
124
115
|
*
|
|
125
|
-
* @template {(...args:
|
|
116
|
+
* @template {(...args: any[]) => any} I
|
|
126
117
|
* @template {PropertyKey} P
|
|
127
118
|
* @template {{
|
|
128
|
-
* [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I
|
|
119
|
+
* [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>;
|
|
129
120
|
* }} [T={ [x in P]: I }]
|
|
130
|
-
* @template {
|
|
121
|
+
* @template {any[]} [B=[]]
|
|
131
122
|
* @param {T} target
|
|
132
123
|
* @param {P} methodName
|
|
133
124
|
* @param {B} bound
|
|
@@ -148,12 +139,12 @@ harden(makeSyncMethodCallback);
|
|
|
148
139
|
/**
|
|
149
140
|
* Create a callback from a potentially far method.
|
|
150
141
|
*
|
|
151
|
-
* @template {(...args:
|
|
142
|
+
* @template {(...args: any[]) => any} I
|
|
152
143
|
* @template {PropertyKey} P
|
|
153
|
-
* @template {
|
|
154
|
-
* [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I
|
|
155
|
-
* }>} [T=
|
|
156
|
-
* @template {
|
|
144
|
+
* @template {ERef<{
|
|
145
|
+
* [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>;
|
|
146
|
+
* }>} [T=ERef<{ [x in P]: I }>]
|
|
147
|
+
* @template {any[]} [B=[]]
|
|
157
148
|
* @param {T} target
|
|
158
149
|
* @param {P} methodName
|
|
159
150
|
* @param {B} bound
|
|
@@ -193,11 +184,14 @@ harden(isCallback);
|
|
|
193
184
|
* Prepare an attenuator class whose methods can be redirected via callbacks.
|
|
194
185
|
*
|
|
195
186
|
* @template {PropertyKey} M
|
|
196
|
-
* @param {import('@agoric/zone').Zone} zone The zone in which to allocate
|
|
187
|
+
* @param {import('@agoric/base-zone').Zone} zone The zone in which to allocate
|
|
188
|
+
* attenuators.
|
|
197
189
|
* @param {M[]} methodNames Methods to forward.
|
|
198
190
|
* @param {object} opts
|
|
199
|
-
* @param {InterfaceGuard
|
|
200
|
-
*
|
|
191
|
+
* @param {import('@endo/patterns').InterfaceGuard<{
|
|
192
|
+
* [K in M]: import('@endo/patterns').MethodGuard;
|
|
193
|
+
* }>} [opts.interfaceGuard]
|
|
194
|
+
* An interface guard for the new attenuator.
|
|
201
195
|
* @param {string} [opts.tag] A tag for the new attenuator exoClass.
|
|
202
196
|
*/
|
|
203
197
|
export const prepareAttenuator = (
|
|
@@ -206,9 +200,11 @@ export const prepareAttenuator = (
|
|
|
206
200
|
{ interfaceGuard, tag = 'Attenuator' } = {},
|
|
207
201
|
) => {
|
|
208
202
|
/**
|
|
209
|
-
* @typedef {(this: any, ...args:
|
|
210
|
-
*
|
|
211
|
-
* @typedef {{ [K in M]
|
|
203
|
+
* @typedef {(this: any, ...args: any[]) => any} Method
|
|
204
|
+
*
|
|
205
|
+
* @typedef {{ [K in M]?: Callback<any> | null }} Overrides
|
|
206
|
+
*
|
|
207
|
+
* @typedef {{ [K in M]: (this: any, ...args: any[]) => any }} Methods
|
|
212
208
|
*/
|
|
213
209
|
const methods = /** @type {Methods} */ (
|
|
214
210
|
fromEntries(
|
|
@@ -226,9 +222,7 @@ export const prepareAttenuator = (
|
|
|
226
222
|
// Support both synchronous and async callbacks.
|
|
227
223
|
const cb = this.state.cbs[key];
|
|
228
224
|
if (!cb) {
|
|
229
|
-
const err =
|
|
230
|
-
`unimplemented ${q(tag)} method ${q(key)}`,
|
|
231
|
-
);
|
|
225
|
+
const err = makeError(`unimplemented ${q(tag)} method ${q(key)}`);
|
|
232
226
|
if (this.state.isSync) {
|
|
233
227
|
throw err;
|
|
234
228
|
}
|
|
@@ -250,14 +244,13 @@ export const prepareAttenuator = (
|
|
|
250
244
|
* and/or individual method override callbacks.
|
|
251
245
|
*
|
|
252
246
|
* @param {object} opts
|
|
253
|
-
* @param {unknown} [opts.target] The target for any methods that
|
|
254
|
-
*
|
|
247
|
+
* @param {unknown} [opts.target] The target for any methods that weren't
|
|
248
|
+
* specified in `opts.overrides`.
|
|
255
249
|
* @param {boolean} [opts.isSync=false] Whether the target should be treated
|
|
256
|
-
*
|
|
257
|
-
* @param {Overrides} [opts.overrides] Set individual
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
* mean to throw.
|
|
250
|
+
* as synchronously available.
|
|
251
|
+
* @param {Overrides} [opts.overrides] Set individual callbacks for methods
|
|
252
|
+
* (whose names must be defined in the `prepareAttenuator` or
|
|
253
|
+
* `prepareGuardedAttenuator` call). Nullish overrides mean to throw.
|
|
261
254
|
*/
|
|
262
255
|
const makeAttenuator = zone.exoClass(
|
|
263
256
|
tag,
|
|
@@ -265,7 +258,7 @@ export const prepareAttenuator = (
|
|
|
265
258
|
/**
|
|
266
259
|
* @param {object} opts
|
|
267
260
|
* @param {any} [opts.target]
|
|
268
|
-
* @param {boolean} [opts.isSync
|
|
261
|
+
* @param {boolean} [opts.isSync]
|
|
269
262
|
* @param {Overrides} [opts.overrides]
|
|
270
263
|
*/
|
|
271
264
|
({
|
|
@@ -305,14 +298,14 @@ harden(prepareAttenuator);
|
|
|
305
298
|
/**
|
|
306
299
|
* Prepare an attenuator whose methodNames are derived from the interfaceGuard.
|
|
307
300
|
*
|
|
308
|
-
* @
|
|
309
|
-
* @param {
|
|
301
|
+
* @template {import('@endo/patterns').InterfaceGuard} G
|
|
302
|
+
* @param {import('@agoric/base-zone').Zone} zone
|
|
303
|
+
* @param {G} interfaceGuard
|
|
310
304
|
* @param {object} [opts]
|
|
311
305
|
* @param {string} [opts.tag]
|
|
312
306
|
*/
|
|
313
307
|
export const prepareGuardedAttenuator = (zone, interfaceGuard, opts = {}) => {
|
|
314
|
-
const
|
|
315
|
-
const methodNames = ownKeys(methodGuards);
|
|
308
|
+
const methodNames = getInterfaceMethodKeys(interfaceGuard);
|
|
316
309
|
const makeAttenuator = prepareAttenuator(zone, methodNames, {
|
|
317
310
|
...opts,
|
|
318
311
|
interfaceGuard,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* These identify top-level paths for SwingSet chain storage
|
|
3
|
-
*
|
|
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
|
|
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"}
|