@agoric/internal 0.3.3-mainnet1B-dev-cfa7cb2.0 → 0.3.3-orchestration-dev-096c4e8.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/package.json +24 -13
- package/src/batched-deliver.d.ts +6 -6
- package/src/batched-deliver.d.ts.map +1 -1
- package/src/batched-deliver.js +6 -3
- package/src/callback.d.ts +23 -16
- package/src/callback.d.ts.map +1 -1
- package/src/callback.js +14 -13
- package/src/config.d.ts +19 -12
- package/src/config.js +6 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +3 -0
- 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/lib-chainStorage.d.ts +4 -31
- package/src/lib-chainStorage.d.ts.map +1 -1
- package/src/lib-chainStorage.js +6 -37
- 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 +16 -0
- package/src/lib-nodejs/spawnSubprocessWorker.d.ts.map +1 -0
- package/src/lib-nodejs/spawnSubprocessWorker.js +87 -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 +56 -0
- package/src/marshal.d.ts +19 -0
- package/src/marshal.d.ts.map +1 -0
- package/src/marshal.js +131 -0
- package/src/method-tools.d.ts +1 -0
- package/src/method-tools.d.ts.map +1 -1
- package/src/method-tools.js +12 -0
- package/src/netstring.d.ts +13 -0
- package/src/netstring.d.ts.map +1 -0
- package/src/netstring.js +119 -0
- package/src/node/buffer-line-transform.d.ts +1 -1
- package/src/node/buffer-line-transform.d.ts.map +1 -1
- package/src/node/createBundles.js +1 -1
- package/src/queue.d.ts +1 -1
- package/src/queue.d.ts.map +1 -1
- package/src/queue.js +6 -6
- package/src/storage-test-utils.d.ts +14 -9
- package/src/storage-test-utils.d.ts.map +1 -1
- package/src/storage-test-utils.js +2 -5
- package/src/tokens.d.ts +34 -0
- package/src/tokens.d.ts.map +1 -0
- package/src/tokens.js +35 -0
- package/src/typeGuards.d.ts +2 -0
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +8 -0
- package/src/upgrade-api.d.ts +13 -4
- package/src/upgrade-api.d.ts.map +1 -1
- package/src/upgrade-api.js +26 -18
- package/src/utils.d.ts +3 -6
- package/src/utils.d.ts.map +1 -1
- package/src/utils.js +6 -144
- package/CHANGELOG.md +0 -115
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 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/internal",
|
|
3
|
-
"version": "0.3.3-
|
|
3
|
+
"version": "0.3.3-orchestration-dev-096c4e8.0+096c4e8",
|
|
4
4
|
"description": "Externally unsupported utilities internal to agoric-sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "exit 0",
|
|
12
|
-
"prepack": "tsc --build
|
|
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,22 +17,30 @@
|
|
|
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/
|
|
24
|
-
"@
|
|
25
|
-
"@endo/
|
|
26
|
-
"@endo/
|
|
27
|
-
"@endo/
|
|
28
|
-
"@endo/
|
|
23
|
+
"@agoric/assert": "0.6.1-orchestration-dev-096c4e8.0+096c4e8",
|
|
24
|
+
"@agoric/base-zone": "0.1.1-orchestration-dev-096c4e8.0+096c4e8",
|
|
25
|
+
"@endo/common": "^1.1.0",
|
|
26
|
+
"@endo/far": "^1.0.4",
|
|
27
|
+
"@endo/init": "^1.0.4",
|
|
28
|
+
"@endo/marshal": "^1.3.0",
|
|
29
|
+
"@endo/patterns": "^1.2.0",
|
|
30
|
+
"@endo/promise-kit": "^1.0.4",
|
|
31
|
+
"@endo/stream": "^1.1.0",
|
|
29
32
|
"anylogger": "^0.21.0",
|
|
30
33
|
"jessie.js": "^0.3.2"
|
|
31
34
|
},
|
|
32
35
|
"devDependencies": {
|
|
33
|
-
"@endo/init": "0.
|
|
34
|
-
"ava": "^5.
|
|
35
|
-
"tsd": "^0.
|
|
36
|
+
"@endo/init": "^1.0.4",
|
|
37
|
+
"ava": "^5.3.0",
|
|
38
|
+
"tsd": "^0.30.4"
|
|
39
|
+
},
|
|
40
|
+
"ava": {
|
|
41
|
+
"require": [
|
|
42
|
+
"@endo/init/debug.js"
|
|
43
|
+
]
|
|
36
44
|
},
|
|
37
45
|
"author": "Agoric",
|
|
38
46
|
"license": "Apache-2.0",
|
|
@@ -42,5 +50,8 @@
|
|
|
42
50
|
"publishConfig": {
|
|
43
51
|
"access": "public"
|
|
44
52
|
},
|
|
45
|
-
"
|
|
53
|
+
"typeCoverage": {
|
|
54
|
+
"atLeast": 92.83
|
|
55
|
+
},
|
|
56
|
+
"gitHead": "096c4e8fce80e9a509b0e1a30fda11736c4570e1"
|
|
46
57
|
}
|
package/src/batched-deliver.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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 {{ clearTimeout:
|
|
6
|
+
* @param {{ clearTimeout: import('node:timers').clearTimeout, setTimeout: import('node:timers').setTimeout }} io
|
|
7
7
|
* @param {number} batchTimeoutMs
|
|
8
8
|
*/
|
|
9
9
|
export function makeBatchedDeliver(deliver: DeliverMessages, { clearTimeout, setTimeout }: {
|
|
10
|
-
clearTimeout:
|
|
11
|
-
setTimeout:
|
|
12
|
-
}, batchTimeoutMs?: number): (
|
|
10
|
+
clearTimeout: typeof clearTimeout;
|
|
11
|
+
setTimeout: typeof setTimeout;
|
|
12
|
+
}, batchTimeoutMs?: number): (message: unknown[], ackNum: number) => Promise<void>;
|
|
13
13
|
export const DEFAULT_BATCH_TIMEOUT_MS: 1000;
|
|
14
|
-
export type DeliverMessages = (message:
|
|
14
|
+
export type DeliverMessages = (message: unknown[], ackNum: number) => Promise<void>;
|
|
15
15
|
//# 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;;;;GAIG;AACH,4CAJW,eAAe,gCACf;IAAE,kCAAiD;IAAC,8BAA4C;CAAE,mBAClG,MAAM,aANM,OAAO,EAAE,UAAU,MAAM,KAAK,QAAQ,IAAI,CAAC,CA8CjE;AAjDD,4CAA6C;wCAGtB,OAAO,EAAE,UAAU,MAAM,KAAK,QAAQ,IAAI,CAAC"}
|
package/src/batched-deliver.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
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 {{ clearTimeout:
|
|
12
|
+
* @param {{ clearTimeout: import('node:timers').clearTimeout, setTimeout: import('node:timers').setTimeout }} io
|
|
12
13
|
* @param {number} batchTimeoutMs
|
|
13
14
|
*/
|
|
14
15
|
export function makeBatchedDeliver(
|
|
@@ -16,8 +17,10 @@ export function makeBatchedDeliver(
|
|
|
16
17
|
{ clearTimeout, setTimeout },
|
|
17
18
|
batchTimeoutMs = DEFAULT_BATCH_TIMEOUT_MS,
|
|
18
19
|
) {
|
|
20
|
+
/** @type {unknown[]} */
|
|
19
21
|
let batchedMessages = [];
|
|
20
22
|
let latestAckNum = 0;
|
|
23
|
+
/** @type {NodeJS.Timeout} */
|
|
21
24
|
let deliverTimeout;
|
|
22
25
|
|
|
23
26
|
/**
|
|
@@ -34,7 +37,7 @@ export function makeBatchedDeliver(
|
|
|
34
37
|
// Transfer the batched messages to the deliver function.
|
|
35
38
|
const msgs = batchedMessages;
|
|
36
39
|
batchedMessages = [];
|
|
37
|
-
deliver(msgs, latestAckNum);
|
|
40
|
+
void deliver(msgs, latestAckNum);
|
|
38
41
|
}, batchTimeoutMs);
|
|
39
42
|
}
|
|
40
43
|
|
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: import("./types.js").SyncCallback<I>, ...args: Parameters<I>): ReturnType<I>;
|
|
2
|
+
export function callE<I extends (...args: unknown[]) => any>(callback: import("./types.js").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.js").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.js").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.js").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.js").Callback<I>;
|
|
7
|
+
export function isCallback(callback: any): callback is import("./types.js").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('@agoric/zone').Zone, interfaceGuard:
|
|
14
|
+
overrides?: { [K_1 in M]?: import("./types.js").Callback<any> | null | undefined; } | undefined;
|
|
15
|
+
}) => import("@endo/exo/src/exo-makers.js").Guarded<{ [K_2 in M]: (this: any, ...args: unknown[]) => any; }>;
|
|
16
|
+
export function prepareGuardedAttenuator<G extends import("@endo/patterns").InterfaceGuard<Record<PropertyKey, import("@endo/patterns").MethodGuard>>>(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/src/exo-tools.js").Methods> = (args_0: {
|
|
20
|
+
target?: any;
|
|
21
|
+
isSync?: boolean | undefined;
|
|
22
|
+
overrides?: {
|
|
23
|
+
[x: string]: import("./types.js").Callback<any> | null | undefined;
|
|
24
|
+
[x: number]: import("./types.js").Callback<any> | null | undefined;
|
|
25
|
+
[x: symbol]: import("./types.js").Callback<any> | null | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
}) => import('@endo/exo/src/exo-makers.js').Farable<T>;
|
|
28
|
+
export type Callback<I extends (...args: unknown[]) => any> = import('./types.js').Callback<I>;
|
|
29
|
+
export type SyncCallback<I extends (...args: unknown[]) => any> = import('./types.js').SyncCallback<I>;
|
|
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":"AAsDO,6CALiB,OAAO,EAAE,KAAK,GAAG,yFAWxC;AAWM,0CALiB,OAAO,EAAE,KAAK,GAAG,uGAWxC;AAaM,6DAPiB,OAAO,EAAE,KAAK,GAAG,8JAaxC;AAeM,yDATiB,OAAO,EAAE,KAAK,GAAG,8MAexC;AAiBM,2DAXiB,OAAO,EAAE,KAAK,GAAG,oOAoBxC;AAiBM,uDAXiB,OAAO,EAAE,KAAK,GAAG,oRAmBxC;AAOM,qCAHI,GAAG,kDAeb;AAgBM,+DATI,OAAO,mBAAmB,EAAE,IAAI;IAK9B,cAAc;IAEF,GAAG;;aAkEb,GAAG;;;yEAxDgB,GAAG,WAAW,OAAO,EAAE,KAAK,GAAG,KA2FhE;AAYM,6JALI,OAAO,mBAAmB,EAAE,IAAI;;oCAY1C;;;;;;;;;MAhToE,OAAO,6BAA6B,EAAE,OAAO,CAAC,CAAC,CAAC;yCAI7F,OAAO,EAAE,KAAK,GAAG,IAC5B,OAAO,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;6CAIrB,OAAO,EAAE,KAAK,GAAG,IAC5B,OAAO,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC"}
|
package/src/callback.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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';
|
|
4
5
|
|
|
5
6
|
const { Fail, quote: q } = assert;
|
|
6
7
|
|
|
@@ -13,22 +14,20 @@ const ownKeys =
|
|
|
13
14
|
);
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
|
-
* @template T
|
|
17
|
-
* @typedef {(...args: Parameters<ReturnType<prepareAttenuator>>) => Farable<T>} MakeAttenuator
|
|
17
|
+
* @template {import('@endo/exo/src/exo-makers.js').Methods} T
|
|
18
|
+
* @typedef {(...args: Parameters<ReturnType<prepareAttenuator>>) => import('@endo/exo/src/exo-makers.js').Farable<T>} MakeAttenuator
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* @template {(...args: unknown[]) => any} I
|
|
22
|
-
* @typedef {import('./types').Callback<I>} Callback
|
|
23
|
+
* @typedef {import('./types.js').Callback<I>} Callback
|
|
23
24
|
*/
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* @template {(...args: unknown[]) => any} I
|
|
27
|
-
* @typedef {import('./types').SyncCallback<I>} SyncCallback
|
|
28
|
+
* @typedef {import('./types.js').SyncCallback<I>} SyncCallback
|
|
28
29
|
*/
|
|
29
30
|
|
|
30
|
-
/** @template T @typedef {import('@endo/eventual-send').RemotableBrand<{}, T> & T} Farable */
|
|
31
|
-
|
|
32
31
|
/**
|
|
33
32
|
* @param {unknown} key
|
|
34
33
|
* @returns {key is PropertyKey} FIXME: should be just `PropertyKey` but TS
|
|
@@ -193,10 +192,12 @@ harden(isCallback);
|
|
|
193
192
|
* Prepare an attenuator class whose methods can be redirected via callbacks.
|
|
194
193
|
*
|
|
195
194
|
* @template {PropertyKey} M
|
|
196
|
-
* @param {import('@agoric/zone').Zone} zone The zone in which to allocate attenuators.
|
|
195
|
+
* @param {import('@agoric/base-zone').Zone} zone The zone in which to allocate attenuators.
|
|
197
196
|
* @param {M[]} methodNames Methods to forward.
|
|
198
197
|
* @param {object} opts
|
|
199
|
-
* @param {InterfaceGuard
|
|
198
|
+
* @param {import('@endo/patterns').InterfaceGuard<{
|
|
199
|
+
* [K in M]: import('@endo/patterns').MethodGuard
|
|
200
|
+
* }>} [opts.interfaceGuard] An interface guard for the
|
|
200
201
|
* new attenuator.
|
|
201
202
|
* @param {string} [opts.tag] A tag for the new attenuator exoClass.
|
|
202
203
|
*/
|
|
@@ -265,7 +266,7 @@ export const prepareAttenuator = (
|
|
|
265
266
|
/**
|
|
266
267
|
* @param {object} opts
|
|
267
268
|
* @param {any} [opts.target]
|
|
268
|
-
* @param {boolean} [opts.isSync
|
|
269
|
+
* @param {boolean} [opts.isSync]
|
|
269
270
|
* @param {Overrides} [opts.overrides]
|
|
270
271
|
*/
|
|
271
272
|
({
|
|
@@ -305,14 +306,14 @@ harden(prepareAttenuator);
|
|
|
305
306
|
/**
|
|
306
307
|
* Prepare an attenuator whose methodNames are derived from the interfaceGuard.
|
|
307
308
|
*
|
|
308
|
-
* @
|
|
309
|
-
* @param {
|
|
309
|
+
* @template {import('@endo/patterns').InterfaceGuard} G
|
|
310
|
+
* @param {import('@agoric/base-zone').Zone} zone
|
|
311
|
+
* @param {G} interfaceGuard
|
|
310
312
|
* @param {object} [opts]
|
|
311
313
|
* @param {string} [opts.tag]
|
|
312
314
|
*/
|
|
313
315
|
export const prepareGuardedAttenuator = (zone, interfaceGuard, opts = {}) => {
|
|
314
|
-
const
|
|
315
|
-
const methodNames = ownKeys(methodGuards);
|
|
316
|
+
const methodNames = getInterfaceMethodKeys(interfaceGuard);
|
|
316
317
|
const makeAttenuator = prepareAttenuator(zone, methodNames, {
|
|
317
318
|
...opts,
|
|
318
319
|
interfaceGuard,
|
package/src/config.d.ts
CHANGED
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
export namespace BridgeId {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
let BANK: string;
|
|
3
|
+
let CORE: string;
|
|
4
|
+
let DIBC: string;
|
|
5
|
+
let STORAGE: string;
|
|
6
|
+
let PROVISION: string;
|
|
7
|
+
let PROVISION_SMART_WALLET: string;
|
|
8
|
+
let VLOCALCHAIN: string;
|
|
9
|
+
let WALLET: string;
|
|
10
|
+
}
|
|
11
|
+
export namespace CosmosInitKeyToBridgeId {
|
|
12
|
+
import vbankPort = BridgeId.BANK;
|
|
13
|
+
export { vbankPort };
|
|
14
|
+
import vibcPort = BridgeId.DIBC;
|
|
15
|
+
export { vibcPort };
|
|
9
16
|
}
|
|
10
17
|
export namespace WalletName {
|
|
11
|
-
|
|
18
|
+
let depositFacet: string;
|
|
12
19
|
}
|
|
13
20
|
export namespace VBankAccount {
|
|
14
21
|
namespace reserve {
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
let module: string;
|
|
23
|
+
let address: string;
|
|
17
24
|
}
|
|
18
25
|
namespace provision {
|
|
19
|
-
|
|
26
|
+
let module_1: string;
|
|
20
27
|
export { module_1 as module };
|
|
21
|
-
|
|
28
|
+
let address_1: string;
|
|
22
29
|
export { address_1 as address };
|
|
23
30
|
}
|
|
24
31
|
}
|
package/src/config.js
CHANGED
|
@@ -21,10 +21,16 @@ export const BridgeId = {
|
|
|
21
21
|
STORAGE: 'storage',
|
|
22
22
|
PROVISION: 'provision',
|
|
23
23
|
PROVISION_SMART_WALLET: 'provisionWallet',
|
|
24
|
+
VLOCALCHAIN: 'vlocalchain',
|
|
24
25
|
WALLET: 'wallet',
|
|
25
26
|
};
|
|
26
27
|
harden(BridgeId);
|
|
27
28
|
|
|
29
|
+
export const CosmosInitKeyToBridgeId = {
|
|
30
|
+
vbankPort: BridgeId.BANK,
|
|
31
|
+
vibcPort: BridgeId.DIBC,
|
|
32
|
+
};
|
|
33
|
+
|
|
28
34
|
export const WalletName = {
|
|
29
35
|
depositFacet: 'depositFacet',
|
|
30
36
|
};
|
package/src/index.d.ts
CHANGED
|
@@ -3,4 +3,6 @@ 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 { objectMap } from "@endo/common/object-map.js";
|
|
7
|
+
export { fromUniqueEntries } from "@endo/common/from-unique-entries.js";
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
package/src/index.js
CHANGED
|
@@ -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';
|
|
@@ -12,20 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export function makeChainStorageRoot(handleStorageMessage: (message: StorageMessage) => any, rootPath: string, rootOptions?: {
|
|
14
14
|
sequence?: boolean | undefined;
|
|
15
|
-
} | undefined): {
|
|
16
|
-
getPath(): string;
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated use getPath
|
|
19
|
-
* @type {() => Promise<VStorageKey>}
|
|
20
|
-
*/
|
|
21
|
-
getStoreKey(): Promise<VStorageKey>;
|
|
22
|
-
/** @type {(name: string, childNodeOptions?: {sequence?: boolean}) => StorageNode} */
|
|
23
|
-
makeChildNode(name: string, childNodeOptions?: {
|
|
24
|
-
sequence?: boolean | undefined;
|
|
25
|
-
} | undefined): StorageNode;
|
|
26
|
-
/** @type {(value: string) => Promise<void>} */
|
|
27
|
-
setValue(value: string): Promise<void>;
|
|
28
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
15
|
+
} | undefined): import("@endo/exo/src/exo-makers.js").Guarded<{
|
|
29
16
|
getPath(): string;
|
|
30
17
|
/**
|
|
31
18
|
* @deprecated use getPath
|
|
@@ -51,25 +38,11 @@ export function makeChainStorageRoot(handleStorageMessage: (message: StorageMess
|
|
|
51
38
|
export function makeStorageNodeChild(storageNodeRef: import('@endo/far').ERef<StorageNode | null>, childName: string): Promise<StorageNode>;
|
|
52
39
|
export function isStreamCell(cell: any): cell is StreamCell<unknown>;
|
|
53
40
|
export function assertCapData(data: unknown): asserts data is import("@endo/marshal").CapData<string>;
|
|
54
|
-
export function unmarshalFromVstorage(data: Map<string, string>, key: string, fromCapData: ReturnType<typeof import('@endo/marshal').makeMarshal>['fromCapData'], index?: number | undefined): any;
|
|
55
41
|
/** @type {(name: string) => void} */
|
|
56
42
|
export const assertPathSegment: (name: string) => void;
|
|
57
|
-
export function prepareChainStorageNode(zone: import('@agoric/zone').Zone): (
|
|
43
|
+
export function prepareChainStorageNode(zone: import('@agoric/base-zone').Zone): (messenger: import("./types.js").Callback<(message: StorageMessage) => any>, path: string, args_2?: {
|
|
58
44
|
sequence?: boolean | undefined;
|
|
59
|
-
} | undefined) => {
|
|
60
|
-
getPath(): string;
|
|
61
|
-
/**
|
|
62
|
-
* @deprecated use getPath
|
|
63
|
-
* @type {() => Promise<VStorageKey>}
|
|
64
|
-
*/
|
|
65
|
-
getStoreKey(): Promise<VStorageKey>;
|
|
66
|
-
/** @type {(name: string, childNodeOptions?: {sequence?: boolean}) => StorageNode} */
|
|
67
|
-
makeChildNode(name: string, childNodeOptions?: {
|
|
68
|
-
sequence?: boolean | undefined;
|
|
69
|
-
} | undefined): StorageNode;
|
|
70
|
-
/** @type {(value: string) => Promise<void>} */
|
|
71
|
-
setValue(value: string): Promise<void>;
|
|
72
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
45
|
+
} | undefined) => import("@endo/exo/src/exo-makers.js").Guarded<{
|
|
73
46
|
getPath(): string;
|
|
74
47
|
/**
|
|
75
48
|
* @deprecated use getPath
|
|
@@ -174,6 +147,6 @@ export type StorageMessage = {
|
|
|
174
147
|
args: [path: string];
|
|
175
148
|
} | {
|
|
176
149
|
method: StorageUpdateEntriesMessageMethod;
|
|
177
|
-
args:
|
|
150
|
+
args: StorageEntry[];
|
|
178
151
|
};
|
|
179
152
|
//# sourceMappingURL=lib-chainStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib-chainStorage.d.ts","sourceRoot":"","sources":["lib-chainStorage.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lib-chainStorage.d.ts","sourceRoot":"","sources":["lib-chainStorage.js"],"names":[],"mappings":"AAqNA;;;;;;;;;;;GAWG;AACH,qEATqB,cAAc,KAAK,GAAG,YAGhC,MAAM;;;;IA1DX;;;OAGG;mBADa,QAAQ,WAAW,CAAC;IASpC,qFAAqF;wBAAnE,MAAM;;oBAA8C,WAAW;IAWjF,+CAA+C;oBAA5B,MAAM,GAAK,QAAQ,IAAI,CAAC;GAoDhD;AAUD;;;;;;;;GAQG;AACH,qDAJW,OAAO,WAAW,EAAE,IAAI,CAAC,WAAW,QAAE,aACtC,MAAM,GACJ,QAAQ,WAAW,CAAC,CAMhC;AAnMM,mCAHI,GAAG,+BAQ8B;AASrC,oCAHI,OAAO,2DASjB;AAiBD,qCAAqC;AACrC,uCADkB,MAAM,KAAK,IAAI,CAI/B;AAwBK,8CAFI,OAAO,mBAAmB,EAAE,IAAI,uDAqBe,cAAc,KAAK,GAAG;;;;IAc1E;;;OAGG;mBADa,QAAQ,WAAW,CAAC;IASpC,qFAAqF;wBAAnE,MAAM;;oBAA8C,WAAW;IAWjF,+CAA+C;oBAA5B,MAAM,GAAK,QAAQ,IAAI,CAAC;GA0BhD;AA0DM,oDAJI,OAAO,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,cACrC,OAAO,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,WAC1B,OAAO,KAAK,QAAQ,IAAI,CAAC,CAQ7C;yBAxQa,WAAW,cAAc,eAAe,EAAE,WAAW,CAAC;2BACtD,KAAK,UAAU,EAAE,aAAa,CAAC;;;;;eAM/B,MAAM;iBACN,MAAM;qBACN,MAAM;;;;;;;iBAON,MAAM;YACN,CAAC,EAAE;;;;;;;;;;;;;;;qBAaI,MAAM,KAAK,QAAQ,IAAI,CAAC;;;;aAC/B,MAAM,MAAM;;;;iBACZ,MAAM,QAAQ,WAAW,CAAC;6BAChB,MAAM,YAAY;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAC,KAAK,WAAW;;;;;;aA8ChE,MAAM,QAAQ,MAAM,CAAC;;;;iBACrB,WAAW,CAAC,aAAa,CAAC;;;;qBAC1B,MAAM,YAAY;;;;;4CAoBlB,KAAK,GAAG,aAAa,GAAG,KAAK,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAE,MAAM;;;;gDACzE,KAAK,GAAG,kBAAkB,GAAG,QAAQ;;;;mCACtC,6BAA6B,GAAG,iCAAiC;;;;0CAChE,CAAC,IAAI,EAAE,MAAM,CAAC;;;;2BACd,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;;;;8CACrC,mDAAc;;;;6BACf;IACZ,MAAU,EAAE,6BAA6B,CAAC;IAC1C,IAAQ,iBAA8B;CAClC,GAAG;IACP,MAAU,EAAE,iCAAiC,CAAC;IAC9C,IAAQ,iBAAkC;CACvC"}
|
package/src/lib-chainStorage.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
3
|
import { E } from '@endo/far';
|
|
4
|
-
import { M
|
|
4
|
+
import { M } from '@endo/patterns';
|
|
5
|
+
import { makeHeapZone } from '@agoric/base-zone/heap.js';
|
|
5
6
|
import * as cb from './callback.js';
|
|
6
7
|
|
|
7
8
|
const { Fail } = assert;
|
|
@@ -83,38 +84,6 @@ export const assertCapData = data => {
|
|
|
83
84
|
};
|
|
84
85
|
harden(assertCapData);
|
|
85
86
|
|
|
86
|
-
/**
|
|
87
|
-
* Read and unmarshal a value from a map representation of vstorage data
|
|
88
|
-
*
|
|
89
|
-
* @param {Map<string, string>} data
|
|
90
|
-
* @param {string} key
|
|
91
|
-
* @param {ReturnType<typeof import('@endo/marshal').makeMarshal>['fromCapData']} fromCapData
|
|
92
|
-
* @param {number} [index=-1] index of the desired value in a deserialized stream cell
|
|
93
|
-
*/
|
|
94
|
-
export const unmarshalFromVstorage = (data, key, fromCapData, index = -1) => {
|
|
95
|
-
const serialized = data.get(key) || Fail`no data for ${key}`;
|
|
96
|
-
assert.typeof(serialized, 'string');
|
|
97
|
-
|
|
98
|
-
const streamCell = JSON.parse(serialized);
|
|
99
|
-
if (!isStreamCell(streamCell)) {
|
|
100
|
-
throw Fail`not a StreamCell: ${streamCell}`;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const { values } = streamCell;
|
|
104
|
-
values.length > 0 || Fail`no StreamCell values: ${streamCell}`;
|
|
105
|
-
|
|
106
|
-
const marshalled = values.at(index);
|
|
107
|
-
assert.typeof(marshalled, 'string');
|
|
108
|
-
|
|
109
|
-
/** @type {import("@endo/marshal").CapData<string>} */
|
|
110
|
-
const capData = harden(JSON.parse(marshalled));
|
|
111
|
-
assertCapData(capData);
|
|
112
|
-
|
|
113
|
-
const unmarshalled = fromCapData(capData);
|
|
114
|
-
return unmarshalled;
|
|
115
|
-
};
|
|
116
|
-
harden(unmarshalFromVstorage);
|
|
117
|
-
|
|
118
87
|
/**
|
|
119
88
|
* @typedef {object} StoredFacet
|
|
120
89
|
* @property {() => Promise<string>} getPath the chain storage path at which the node was constructed
|
|
@@ -155,13 +124,13 @@ harden(assertPathSegment);
|
|
|
155
124
|
*/
|
|
156
125
|
|
|
157
126
|
/**
|
|
158
|
-
* @param {import('@agoric/zone').Zone} zone
|
|
127
|
+
* @param {import('@agoric/base-zone').Zone} zone
|
|
159
128
|
*/
|
|
160
129
|
export const prepareChainStorageNode = zone => {
|
|
161
130
|
/**
|
|
162
131
|
* Create a storage node for a given backing storage interface and path.
|
|
163
132
|
*
|
|
164
|
-
* @param {import('./callback').Callback<(message: StorageMessage) => any>} messenger a callback
|
|
133
|
+
* @param {import('./callback.js').Callback<(message: StorageMessage) => any>} messenger a callback
|
|
165
134
|
* for sending a storageMessage object to the storage implementation
|
|
166
135
|
* (cf. golang/cosmos/x/vstorage/vstorage.go)
|
|
167
136
|
* @param {string} path
|
|
@@ -176,7 +145,7 @@ export const prepareChainStorageNode = zone => {
|
|
|
176
145
|
'ChainStorageNode',
|
|
177
146
|
ChainStorageNodeI,
|
|
178
147
|
/**
|
|
179
|
-
* @param {import('./callback').Callback<(message: StorageMessage) => any>} messenger
|
|
148
|
+
* @param {import('./callback.js').Callback<(message: StorageMessage) => any>} messenger
|
|
180
149
|
* @param {string} path
|
|
181
150
|
* @param {object} [options]
|
|
182
151
|
* @param {boolean} [options.sequence]
|
|
@@ -240,7 +209,7 @@ export const prepareChainStorageNode = zone => {
|
|
|
240
209
|
return makeChainStorageNode;
|
|
241
210
|
};
|
|
242
211
|
|
|
243
|
-
const makeHeapChainStorageNode = prepareChainStorageNode(
|
|
212
|
+
const makeHeapChainStorageNode = prepareChainStorageNode(makeHeapZone());
|
|
244
213
|
|
|
245
214
|
/**
|
|
246
215
|
* Create a heap-based root storage node for a given backing function and root path.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-gc.d.ts","sourceRoot":"","sources":["engine-gc.js"],"names":[],"mappings":";AAoBA,mCAAwB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import v8 from 'v8';
|
|
2
|
+
import vm from 'vm';
|
|
3
|
+
|
|
4
|
+
/* global globalThis */
|
|
5
|
+
let bestGC = globalThis.gc;
|
|
6
|
+
if (typeof bestGC !== 'function') {
|
|
7
|
+
// Node.js v8 wizardry.
|
|
8
|
+
v8.setFlagsFromString('--expose_gc');
|
|
9
|
+
bestGC = vm.runInNewContext('gc');
|
|
10
|
+
assert(bestGC);
|
|
11
|
+
// We leave --expose_gc turned on, otherwise AVA's shared workers
|
|
12
|
+
// may race and disable it before we manage to extract the
|
|
13
|
+
// binding. This won't cause 'gc' to be visible to new Compartments
|
|
14
|
+
// because SES strips out everything it doesn't recognize.
|
|
15
|
+
|
|
16
|
+
// // Hide the gc global from new contexts/workers.
|
|
17
|
+
// v8.setFlagsFromString('--no-expose_gc');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Export a const.
|
|
21
|
+
const engineGC = bestGC;
|
|
22
|
+
export default engineGC;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gc-and-finalize.d.ts","sourceRoot":"","sources":["gc-and-finalize.js"],"names":[],"mappings":"AAkEA,qEAwBC"}
|