@agoric/vow 0.1.1-other-dev-d15096d.0.d15096d → 0.1.1-other-dev-ecf44df.0.ecf44df
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/ava.config.js +10 -0
- package/package.json +23 -27
- package/src/E.d.ts +18 -30
- package/src/E.d.ts.map +1 -1
- package/src/E.js +75 -76
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -1
- package/src/rejection-tracker.d.ts +4 -1
- package/src/rejection-tracker.d.ts.map +1 -1
- package/src/retryable.d.ts +69 -2
- package/src/retryable.d.ts.map +1 -1
- package/src/retryable.js +28 -26
- package/src/tools.d.ts.map +1 -1
- package/src/tools.js +10 -4
- package/src/types.d.ts +33 -13
- package/src/types.d.ts.map +1 -1
- package/src/types.js +216 -0
- package/src/vow-utils.d.ts +25 -1
- package/src/vow-utils.d.ts.map +1 -1
- package/src/vow-utils.js +36 -5
- package/src/watch-utils.d.ts +22 -11
- package/src/watch-utils.d.ts.map +1 -1
- package/src/watch-utils.js +17 -7
- package/src/watch.d.ts +1 -1
- package/src/watch.d.ts.map +1 -1
- package/src/watch.js +3 -1
- package/src/types.ts +0 -195
package/ava.config.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// This file configures AVA for this package. A config file next to each
|
|
2
|
+
// package.json avoids AVA's warning about using a config file from an
|
|
3
|
+
// ancestor directory:
|
|
4
|
+
// https://github.com/avajs/ava/blob/main/lib/cli.js
|
|
5
|
+
import base from '../../ava.config.js';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
...base,
|
|
9
|
+
timeout: '10s',
|
|
10
|
+
};
|
package/package.json
CHANGED
|
@@ -1,51 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/vow",
|
|
3
|
-
"version": "0.1.1-other-dev-
|
|
3
|
+
"version": "0.1.1-other-dev-ecf44df.0.ecf44df",
|
|
4
4
|
"description": "Remote (shortening and disconnection-tolerant) Promise-likes",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/Agoric/agoric-sdk.git"
|
|
8
|
+
},
|
|
5
9
|
"type": "module",
|
|
6
10
|
"main": "src/index.js",
|
|
7
11
|
"engines": {
|
|
8
|
-
"node": "^
|
|
12
|
+
"node": "^22.11 || ^24.14"
|
|
9
13
|
},
|
|
10
14
|
"scripts": {
|
|
11
15
|
"build": "exit 0",
|
|
12
|
-
"prepack": "yarn run -T
|
|
13
|
-
"postpack": "
|
|
16
|
+
"prepack": "yarn run -T prepack-package",
|
|
17
|
+
"postpack": "yarn run -T postpack-package",
|
|
14
18
|
"test": "ava",
|
|
15
19
|
"test:xs": "exit 0",
|
|
16
20
|
"test:xs:ci": "npm run test:xs",
|
|
17
21
|
"lint-fix": "yarn lint:eslint --fix",
|
|
18
22
|
"lint": "yarn run -T run-s --continue-on-error 'lint:*'",
|
|
19
|
-
"lint:eslint": "
|
|
20
|
-
"lint:types": "yarn run -T
|
|
23
|
+
"lint:eslint": "node ../../scripts/eslint-repo.mjs .",
|
|
24
|
+
"lint:types": "yarn run -T tsgo --tsBuildInfoFile tsconfig.tsgo.tsbuildinfo"
|
|
21
25
|
},
|
|
22
26
|
"dependencies": {
|
|
23
|
-
"@agoric/base-zone": "0.1.1-other-dev-
|
|
24
|
-
"@agoric/internal": "0.3.3-other-dev-
|
|
27
|
+
"@agoric/base-zone": "0.1.1-other-dev-ecf44df.0.ecf44df",
|
|
28
|
+
"@agoric/internal": "0.3.3-other-dev-ecf44df.0.ecf44df",
|
|
25
29
|
"@endo/env-options": "^1.1.11",
|
|
26
|
-
"@endo/errors": "^1.
|
|
27
|
-
"@endo/eventual-send": "^1.
|
|
28
|
-
"@endo/pass-style": "^1.
|
|
29
|
-
"@endo/patterns": "^1.
|
|
30
|
-
"@endo/promise-kit": "^1.1
|
|
30
|
+
"@endo/errors": "^1.3.1",
|
|
31
|
+
"@endo/eventual-send": "^1.5.0",
|
|
32
|
+
"@endo/pass-style": "^1.8.1",
|
|
33
|
+
"@endo/patterns": "^1.9.1",
|
|
34
|
+
"@endo/promise-kit": "^1.2.1"
|
|
31
35
|
},
|
|
32
36
|
"devDependencies": {
|
|
33
37
|
"@agoric/internal": "workspace:*",
|
|
34
|
-
"@agoric/swingset-vat": "0.32.3-other-dev-
|
|
35
|
-
"@agoric/zone": "0.2.3-other-dev-
|
|
38
|
+
"@agoric/swingset-vat": "0.32.3-other-dev-ecf44df.0.ecf44df",
|
|
39
|
+
"@agoric/zone": "0.2.3-other-dev-ecf44df.0.ecf44df",
|
|
36
40
|
"@endo/far": "^1.1.14",
|
|
37
|
-
"@endo/init": "^1.1.
|
|
38
|
-
"ava": "^
|
|
41
|
+
"@endo/init": "^1.1.13",
|
|
42
|
+
"ava": "^8.0.1",
|
|
39
43
|
"tsd": "^0.33.0"
|
|
40
44
|
},
|
|
41
|
-
"ava": {
|
|
42
|
-
"require": [
|
|
43
|
-
"@endo/init/debug.js"
|
|
44
|
-
],
|
|
45
|
-
"files": [
|
|
46
|
-
"test/**/*.test.*"
|
|
47
|
-
]
|
|
48
|
-
},
|
|
49
45
|
"author": "Agoric",
|
|
50
46
|
"license": "Apache-2.0",
|
|
51
47
|
"files": [
|
|
@@ -56,7 +52,7 @@
|
|
|
56
52
|
"access": "public"
|
|
57
53
|
},
|
|
58
54
|
"typeCoverage": {
|
|
59
|
-
"atLeast":
|
|
55
|
+
"atLeast": 90.7
|
|
60
56
|
},
|
|
61
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "ecf44df5eadcc7a1d68745f056fca19155fb5231"
|
|
62
58
|
}
|
package/src/E.d.ts
CHANGED
|
@@ -1,44 +1,32 @@
|
|
|
1
1
|
export default makeE;
|
|
2
2
|
export type Callable = (...args: unknown[]) => any;
|
|
3
3
|
export type EProxy = ReturnType<typeof makeE>;
|
|
4
|
+
export type DataOnly<T> = import("@endo/eventual-send").DataOnly<T>;
|
|
5
|
+
export type EGetters<T> = import("@endo/eventual-send").EGetters<T>;
|
|
6
|
+
export type ESendOnlyCallable<T extends Callable> = import("@endo/eventual-send").ESendOnlyCallable<T>;
|
|
7
|
+
export type ESendOnlyMethods<T> = import("@endo/eventual-send").ESendOnlyMethods<T>;
|
|
8
|
+
export type ESendOnlyCallableOrMethods<T> = import("@endo/eventual-send").ESendOnlyCallableOrMethods<T>;
|
|
9
|
+
export type FilteredKeys<T, U> = import("@endo/eventual-send").FilteredKeys<T, U>;
|
|
10
|
+
export type EOnly<T> = import("@endo/eventual-send").EOnly<T>;
|
|
4
11
|
/**
|
|
5
|
-
*
|
|
6
|
-
* properties that are *not* functions.
|
|
12
|
+
* Maps a callable to its remotely called type, with Vow auto-unwrapping.
|
|
7
13
|
*/
|
|
8
|
-
export type
|
|
9
|
-
export type ECallable<T extends Callable> = ReturnType<T> extends EUnwrap<ReturnType<T>> ? (...args: Parameters<T>) => Promise<ReturnType<T>> : ReturnType<T> extends Promise<EUnwrap<ReturnType<T>>> ? T : (...args: Parameters<T>) => Promise<EUnwrap<ReturnType<T>>>;
|
|
14
|
+
export type ECallable<T extends Callable> = (ReturnType<T> extends Promise<EUnwrap<ReturnType<T>>> ? T : (...args: Parameters<T>) => Promise<EUnwrap<ReturnType<T>>>);
|
|
10
15
|
export type EMethods<T> = { readonly [P in keyof T]: T[P] extends Callable ? ECallable<T[P]> : never; };
|
|
11
|
-
export type
|
|
12
|
-
export type ESendOnlyCallable<T extends Callable> = (...args: Parameters<T>) => Promise<void>;
|
|
13
|
-
export type ESendOnlyMethods<T> = { readonly [P in keyof T]: T[P] extends Callable ? ESendOnlyCallable<T[P]> : never; };
|
|
14
|
-
export type ESendOnlyCallableOrMethods<T> = (T extends Callable ? ESendOnlyCallable<T> & ESendOnlyMethods<Required<T>> : ESendOnlyMethods<Required<T>>);
|
|
15
|
-
export type ECallableOrMethods<T> = (T extends Callable ? ECallable<T> & EMethods<Required<T>> : EMethods<Required<T>>);
|
|
16
|
-
/**
|
|
17
|
-
* Return a union of property names/symbols/numbers P for which the record element T[P]'s type extends U.
|
|
18
|
-
*
|
|
19
|
-
* Given const x = { a: 123, b: 'hello', c: 42, 49: () => {}, 53: 67 },
|
|
20
|
-
*
|
|
21
|
-
* FilteredKeys<typeof x, number> is the type 'a' | 'c' | 53.
|
|
22
|
-
* FilteredKeys<typeof x, string> is the type 'b'.
|
|
23
|
-
* FilteredKeys<typeof x, 42 | 67> is the type 'c' | 53.
|
|
24
|
-
* FilteredKeys<typeof x, boolean> is the type never.
|
|
25
|
-
*/
|
|
26
|
-
export type FilteredKeys<T, U> = { [P in keyof T]: T[P] extends U ? P : never; }[keyof T];
|
|
16
|
+
export type ECallableOrMethods<T> = (0 extends (1 & T) ? any : T extends Callable ? ECallable<T> & EMethods<Required<T>> : EMethods<Required<T>>);
|
|
27
17
|
/**
|
|
28
18
|
* `PickCallable<T>` means to return a single root callable or a record type
|
|
29
|
-
* consisting only of properties that are functions.
|
|
19
|
+
* consisting only of properties that are functions. Like Endo's
|
|
20
|
+
* `PickCallable` but with an extra guard against `Pick<T, never>` collapse
|
|
21
|
+
* when `T` has no callable members.
|
|
30
22
|
*/
|
|
31
|
-
export type PickCallable<T> = (T extends Callable ? (...args: Parameters<T>) => ReturnType<T> : FilteredKeys<T, Callable> extends never ? never : Pick<T, FilteredKeys<T, Callable>>);
|
|
23
|
+
export type PickCallable<T> = (0 extends (1 & T) ? any : T extends Callable ? (...args: Parameters<T>) => ReturnType<T> : FilteredKeys<T, Callable> extends never ? never : Pick<T, FilteredKeys<T, Callable>>);
|
|
32
24
|
/**
|
|
33
|
-
* `RemoteFunctions<T>` means to return the functions and properties that are
|
|
25
|
+
* `RemoteFunctions<T>` means to return the functions and properties that are
|
|
26
|
+
* remotely callable, after unwrapping any Vow chain via `EUnwrap`.
|
|
34
27
|
*/
|
|
35
|
-
export type RemoteFunctions<T> = (EUnwrap<T> extends RemotableBrand<any, infer R> ? PickCallable<R> : PickCallable<EUnwrap<T>>);
|
|
28
|
+
export type RemoteFunctions<T> = (0 extends (1 & T) ? any : EUnwrap<T> extends RemotableBrand<any, infer R> ? PickCallable<R> : PickCallable<EUnwrap<T>>);
|
|
36
29
|
export type LocalRecord<T> = (T extends RemotableBrand<infer L, any> ? L : EUnwrap<T>);
|
|
37
|
-
/**
|
|
38
|
-
* Type for an object that must only be invoked with E. It supports a given
|
|
39
|
-
* interface but declares all the functions as asyncable.
|
|
40
|
-
*/
|
|
41
|
-
export type EOnly<T> = (T extends Callable ? (...args: Parameters<T>) => ERef<Awaited<EOnly<ReturnType<T>>>> : T extends Record<PropertyKey, Callable> ? { [K in keyof T]: T[K] extends Callable ? (...args: Parameters<T[K]>) => ERef<Awaited<EOnly<ReturnType<T[K]>>>> : T[K]; } : T);
|
|
42
30
|
/**
|
|
43
31
|
* @template [A={}]
|
|
44
32
|
* @param {HandledPromiseConstructor} HandledPromise
|
|
@@ -99,6 +87,6 @@ declare function makeE<A = {}>(HandledPromise: HandledPromiseConstructor, powers
|
|
|
99
87
|
} & A;
|
|
100
88
|
import type { EUnwrap } from './types.js';
|
|
101
89
|
import type { RemotableBrand } from '@endo/eventual-send';
|
|
102
|
-
import type { ERef } from '@endo/far';
|
|
103
90
|
import type { HandledPromiseConstructor } from '@endo/eventual-send';
|
|
91
|
+
import type { ERef } from '@endo/far';
|
|
104
92
|
//# sourceMappingURL=E.d.ts.map
|
package/src/E.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"E.d.ts","sourceRoot":"","sources":["E.js"],"names":[],"mappings":";uBAiCc,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,GAAG;qBAuR3B,UAAU,CAAC,OAAO,KAAK,CAAC
|
|
1
|
+
{"version":3,"file":"E.d.ts","sourceRoot":"","sources":["E.js"],"names":[],"mappings":";uBAiCc,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,GAAG;qBAuR3B,UAAU,CAAC,OAAO,KAAK,CAAC;qBAkBzB,CAAC,IACD,O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,KAAK,QAAQ,CAAC,eACrC,CAAC,MAAM,EAAE,GAAG,KAAK,KAAK,QAAQ,CAAC,KAC7B,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;MAgBhD;6BA7RyB,YAAY;oCAQwB,qBAAqB;+CAArB,qBAAqB;0BAT5D,WAAW"}
|
package/src/E.js
CHANGED
|
@@ -312,110 +312,127 @@ export default makeE;
|
|
|
312
312
|
|
|
313
313
|
/** @typedef {ReturnType<typeof makeE>} EProxy */
|
|
314
314
|
|
|
315
|
+
// =====================================================================
|
|
316
|
+
// Type helpers re-exported from `@endo/eventual-send`.
|
|
317
|
+
//
|
|
318
|
+
// These helpers are byte-equivalent (or close enough) to Endo's, so we
|
|
319
|
+
// re-export rather than maintain duplicate definitions. This file
|
|
320
|
+
// keeps only the helpers whose semantics differ because vow needs to
|
|
321
|
+
// recursively unwrap Vows via `EUnwrap` (a no-op in plain Endo, where
|
|
322
|
+
// `Awaited` is sufficient).
|
|
323
|
+
//
|
|
324
|
+
// Re-exporting via JSDoc `@typedef` preserves the public type names
|
|
325
|
+
// for external consumers (e.g.
|
|
326
|
+
// `import type { ECallable } from '@agoric/vow/src/E.js'`) while
|
|
327
|
+
// pointing the actual definition at Endo.
|
|
328
|
+
// =====================================================================
|
|
329
|
+
|
|
315
330
|
/**
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
331
|
+
* @template T
|
|
332
|
+
* @typedef {import('@endo/eventual-send').DataOnly<T>} DataOnly
|
|
333
|
+
*/
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* @template T
|
|
337
|
+
* @typedef {import('@endo/eventual-send').EGetters<T>} EGetters
|
|
321
338
|
*/
|
|
322
339
|
|
|
323
340
|
/**
|
|
324
341
|
* @template {Callable} T
|
|
325
|
-
* @typedef {
|
|
326
|
-
* ? (...args: Parameters<T>) => Promise<ReturnType<T>>
|
|
327
|
-
* : ReturnType<T> extends Promise<EUnwrap<ReturnType<T>>>
|
|
328
|
-
* ? T
|
|
329
|
-
* : (...args: Parameters<T>) => Promise<EUnwrap<ReturnType<T>>>} ECallable
|
|
342
|
+
* @typedef {import('@endo/eventual-send').ESendOnlyCallable<T>} ESendOnlyCallable
|
|
330
343
|
*/
|
|
331
344
|
|
|
332
345
|
/**
|
|
333
346
|
* @template T
|
|
334
|
-
* @typedef {
|
|
335
|
-
* readonly [P in keyof T]: T[P] extends Callable
|
|
336
|
-
* ? ECallable<T[P]>
|
|
337
|
-
* : never;
|
|
338
|
-
* }} EMethods
|
|
347
|
+
* @typedef {import('@endo/eventual-send').ESendOnlyMethods<T>} ESendOnlyMethods
|
|
339
348
|
*/
|
|
340
349
|
|
|
341
350
|
/**
|
|
342
351
|
* @template T
|
|
343
|
-
* @typedef {
|
|
344
|
-
* readonly [P in keyof T]: T[P] extends PromiseLike<any>
|
|
345
|
-
* ? T[P]
|
|
346
|
-
* : Promise<Awaited<T[P]>>;
|
|
347
|
-
* }} EGetters
|
|
352
|
+
* @typedef {import('@endo/eventual-send').ESendOnlyCallableOrMethods<T>} ESendOnlyCallableOrMethods
|
|
348
353
|
*/
|
|
349
354
|
|
|
350
355
|
/**
|
|
351
|
-
* @template
|
|
352
|
-
* @
|
|
356
|
+
* @template T
|
|
357
|
+
* @template U
|
|
358
|
+
* @typedef {import('@endo/eventual-send').FilteredKeys<T, U>} FilteredKeys
|
|
353
359
|
*/
|
|
354
360
|
|
|
355
361
|
/**
|
|
356
362
|
* @template T
|
|
357
|
-
* @typedef {
|
|
358
|
-
* readonly [P in keyof T]: T[P] extends Callable
|
|
359
|
-
* ? ESendOnlyCallable<T[P]>
|
|
360
|
-
* : never;
|
|
361
|
-
* }} ESendOnlyMethods
|
|
363
|
+
* @typedef {import('@endo/eventual-send').EOnly<T>} EOnly
|
|
362
364
|
*/
|
|
363
365
|
|
|
366
|
+
// =====================================================================
|
|
367
|
+
// Vow-specific type helpers.
|
|
368
|
+
//
|
|
369
|
+
// These helpers diverge from Endo's because vow auto-unwraps the Vow
|
|
370
|
+
// chain via `EUnwrap`, while Endo only unwraps Promises via `Awaited`.
|
|
371
|
+
// `ECallable` is the root of the divergence — every helper that
|
|
372
|
+
// transitively references it (`EMethods`, `ECallableOrMethods`,
|
|
373
|
+
// `RemoteFunctions`, `LocalRecord`) must stay local.
|
|
374
|
+
// =====================================================================
|
|
375
|
+
|
|
364
376
|
/**
|
|
365
|
-
*
|
|
377
|
+
* Maps a callable to its remotely called type, with Vow auto-unwrapping.
|
|
378
|
+
*
|
|
379
|
+
* @template {Callable} T
|
|
366
380
|
* @typedef {(
|
|
367
|
-
* T extends
|
|
368
|
-
* ?
|
|
369
|
-
* :
|
|
370
|
-
* )}
|
|
381
|
+
* ReturnType<T> extends Promise<EUnwrap<ReturnType<T>>>
|
|
382
|
+
* ? T
|
|
383
|
+
* : (...args: Parameters<T>) => Promise<EUnwrap<ReturnType<T>>>
|
|
384
|
+
* )} ECallable
|
|
371
385
|
*/
|
|
372
386
|
|
|
373
387
|
/**
|
|
374
388
|
* @template T
|
|
375
|
-
* @typedef {
|
|
376
|
-
* T extends Callable
|
|
377
|
-
* ? ECallable<T>
|
|
378
|
-
* :
|
|
379
|
-
*
|
|
389
|
+
* @typedef {{
|
|
390
|
+
* readonly [P in keyof T]: T[P] extends Callable
|
|
391
|
+
* ? ECallable<T[P]>
|
|
392
|
+
* : never;
|
|
393
|
+
* }} EMethods
|
|
380
394
|
*/
|
|
381
395
|
|
|
382
396
|
/**
|
|
383
|
-
* Return a union of property names/symbols/numbers P for which the record element T[P]'s type extends U.
|
|
384
|
-
*
|
|
385
|
-
* Given const x = { a: 123, b: 'hello', c: 42, 49: () => {}, 53: 67 },
|
|
386
|
-
*
|
|
387
|
-
* FilteredKeys<typeof x, number> is the type 'a' | 'c' | 53.
|
|
388
|
-
* FilteredKeys<typeof x, string> is the type 'b'.
|
|
389
|
-
* FilteredKeys<typeof x, 42 | 67> is the type 'c' | 53.
|
|
390
|
-
* FilteredKeys<typeof x, boolean> is the type never.
|
|
391
|
-
*
|
|
392
397
|
* @template T
|
|
393
|
-
* @
|
|
394
|
-
*
|
|
398
|
+
* @typedef {(
|
|
399
|
+
* 0 extends (1 & T) // if T is any
|
|
400
|
+
* ? any // propagate any cleanly (avoid distributive collapse)
|
|
401
|
+
* : T extends Callable
|
|
402
|
+
* ? ECallable<T> & EMethods<Required<T>>
|
|
403
|
+
* : EMethods<Required<T>>
|
|
404
|
+
* )} ECallableOrMethods
|
|
395
405
|
*/
|
|
396
406
|
|
|
397
407
|
/**
|
|
398
408
|
* `PickCallable<T>` means to return a single root callable or a record type
|
|
399
|
-
* consisting only of properties that are functions.
|
|
409
|
+
* consisting only of properties that are functions. Like Endo's
|
|
410
|
+
* `PickCallable` but with an extra guard against `Pick<T, never>` collapse
|
|
411
|
+
* when `T` has no callable members.
|
|
400
412
|
*
|
|
401
413
|
* @template T
|
|
402
414
|
* @typedef {(
|
|
403
|
-
*
|
|
404
|
-
* ?
|
|
405
|
-
* :
|
|
406
|
-
*
|
|
407
|
-
*
|
|
415
|
+
* 0 extends (1 & T) // if T is any
|
|
416
|
+
* ? any // propagate any cleanly (avoid Pick<any, string> distributive collapse)
|
|
417
|
+
* : T extends Callable
|
|
418
|
+
* ? (...args: Parameters<T>) => ReturnType<T> // a root callable, no methods
|
|
419
|
+
* : FilteredKeys<T, Callable> extends never
|
|
420
|
+
* ? never
|
|
421
|
+
* : Pick<T, FilteredKeys<T, Callable>> // any callable methods
|
|
408
422
|
* )} PickCallable
|
|
409
423
|
*/
|
|
410
424
|
|
|
411
425
|
/**
|
|
412
|
-
* `RemoteFunctions<T>` means to return the functions and properties that are
|
|
426
|
+
* `RemoteFunctions<T>` means to return the functions and properties that are
|
|
427
|
+
* remotely callable, after unwrapping any Vow chain via `EUnwrap`.
|
|
413
428
|
*
|
|
414
429
|
* @template T
|
|
415
430
|
* @typedef {(
|
|
416
|
-
*
|
|
417
|
-
* ?
|
|
418
|
-
* :
|
|
431
|
+
* 0 extends (1 & T) // if T is any
|
|
432
|
+
* ? any // propagate any cleanly
|
|
433
|
+
* : EUnwrap<T> extends RemotableBrand<any, infer R> // if a given T will settle to some remote interface R
|
|
434
|
+
* ? PickCallable<R> // then return the callable properties of R
|
|
435
|
+
* : PickCallable<EUnwrap<T>> // otherwise return the callable properties of the settled T
|
|
419
436
|
* )} RemoteFunctions
|
|
420
437
|
*/
|
|
421
438
|
|
|
@@ -427,21 +444,3 @@ export default makeE;
|
|
|
427
444
|
* : EUnwrap<T>
|
|
428
445
|
* )} LocalRecord
|
|
429
446
|
*/
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* Type for an object that must only be invoked with E. It supports a given
|
|
433
|
-
* interface but declares all the functions as asyncable.
|
|
434
|
-
*
|
|
435
|
-
* @template T
|
|
436
|
-
* @typedef {(
|
|
437
|
-
* T extends Callable
|
|
438
|
-
* ? (...args: Parameters<T>) => ERef<Awaited<EOnly<ReturnType<T>>>>
|
|
439
|
-
* : T extends Record<PropertyKey, Callable>
|
|
440
|
-
* ? {
|
|
441
|
-
* [K in keyof T]: T[K] extends Callable
|
|
442
|
-
* ? (...args: Parameters<T[K]>) => ERef<Awaited<EOnly<ReturnType<T[K]>>>>
|
|
443
|
-
* : T[K];
|
|
444
|
-
* }
|
|
445
|
-
* : T
|
|
446
|
-
* )} EOnly
|
|
447
|
-
*/
|
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "../vat.js";
|
|
2
2
|
export * from "./types-index.js";
|
|
3
3
|
export { default as makeE } from "./E.js";
|
|
4
|
-
export { VowShape, toPassableCap } from "./vow-utils.js";
|
|
4
|
+
export { VowShape, Vow$, toPassableCap } from "./vow-utils.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/src/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// reconfigure if not running under SwingSet.
|
|
5
5
|
export * from '../vat.js';
|
|
6
6
|
export { default as makeE } from './E.js';
|
|
7
|
-
export { VowShape, toPassableCap } from './vow-utils.js';
|
|
7
|
+
export { VowShape, Vow$, toPassableCap } from './vow-utils.js';
|
|
8
8
|
|
|
9
9
|
// eslint-disable-next-line import/export
|
|
10
10
|
export * from './types-index.js';
|
|
@@ -8,7 +8,10 @@ export function prepareVowRejectionTracker(zone: Zone): import("@endo/exo").Guar
|
|
|
8
8
|
* @param {any} reason
|
|
9
9
|
*/
|
|
10
10
|
reject(vowCap: PassableCap, reason: any): void;
|
|
11
|
-
}
|
|
11
|
+
}, import("@endo/patterns").InterfaceGuard<{
|
|
12
|
+
handle: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").MatcherOf<"remotable", any>], import("@endo/patterns").ArgGuard[], any, import("@endo/patterns").SyncValueGuard>;
|
|
13
|
+
reject: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").RawGuard], import("@endo/patterns").ArgGuard[], any, import("@endo/patterns").SyncValueGuard>;
|
|
14
|
+
}>>;
|
|
12
15
|
export type VowRejectionTracker = ReturnType<typeof prepareVowRejectionTracker>;
|
|
13
16
|
import type { Zone } from '@agoric/base-zone';
|
|
14
17
|
import type { PassableCap } from '@endo/pass-style';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rejection-tracker.d.ts","sourceRoot":"","sources":["rejection-tracker.js"],"names":[],"mappings":"AA4BO,iDADK,IAAI;IA4BV;;OAEG;mBADQ,WAAW;IAetB;;;OAGG;mBAFQ,WAAW,UACX,GAAG;
|
|
1
|
+
{"version":3,"file":"rejection-tracker.d.ts","sourceRoot":"","sources":["rejection-tracker.js"],"names":[],"mappings":"AA4BO,iDADK,IAAI;IA4BV;;OAEG;mBADQ,WAAW;IAetB;;;OAGG;mBAFQ,WAAW,UACX,GAAG;;;;IA8BnB;kCAEa,UAAU,CAAC,OAAO,0BAA0B,CAAC;0BA/FpC,mBAAmB;iCAFZ,kBAAkB"}
|
package/src/retryable.d.ts
CHANGED
|
@@ -12,6 +12,41 @@ export function prepareRetryableTools(outerZone: Zone, outerOptions: Preparation
|
|
|
12
12
|
onFulfilled(value: any, runId: any): void;
|
|
13
13
|
onRejected(reason: any, runId: any): void;
|
|
14
14
|
};
|
|
15
|
+
}, {
|
|
16
|
+
flow: import("@endo/patterns").InterfaceGuard<{
|
|
17
|
+
restart: import("@endo/patterns").MethodGuard<"sync", [], import("@endo/patterns").ArgGuard[], any, import("@endo/patterns").SyncValueGuard>;
|
|
18
|
+
getOutcome: import("@endo/patterns").MethodGuard<"sync", [], import("@endo/patterns").ArgGuard[], (string & {
|
|
19
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
20
|
+
}) | (number & {
|
|
21
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
22
|
+
}) | (bigint & {
|
|
23
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
24
|
+
}) | (false & {
|
|
25
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
26
|
+
}) | (true & {
|
|
27
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
28
|
+
}) | (symbol & {
|
|
29
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
30
|
+
}) | (void & {
|
|
31
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
32
|
+
}) | (ArrayBuffer & {
|
|
33
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
34
|
+
}) | (import("@endo/pass-style").RemotableObject<string> & {
|
|
35
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
36
|
+
}) | (import("@endo/eventual-send").RemotableBrand<any, any> & {
|
|
37
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
38
|
+
}) | (import("@endo/pass-style").CopyArrayInterface<PassableCap, Error> & {
|
|
39
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
40
|
+
}) | (import("@endo/pass-style").CopyRecordInterface<PassableCap, Error> & {
|
|
41
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
42
|
+
}) | (import("@endo/pass-style").CopyTaggedInterface<PassableCap, Error> & {
|
|
43
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
44
|
+
}), import("@endo/patterns").SyncValueGuard>;
|
|
45
|
+
}>;
|
|
46
|
+
resultWatcher: import("@endo/patterns").InterfaceGuard<{
|
|
47
|
+
onFulfilled: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").RawGuard], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"kind", "undefined">, import("@endo/patterns").RawGuard>;
|
|
48
|
+
onRejected: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").RawGuard], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"kind", "undefined">, import("@endo/patterns").RawGuard>;
|
|
49
|
+
}>;
|
|
15
50
|
}>;
|
|
16
51
|
adminRetryableFlow: import("@endo/exo").Guarded<{
|
|
17
52
|
/**
|
|
@@ -24,8 +59,39 @@ export function prepareRetryableTools(outerZone: Zone, outerOptions: Preparation
|
|
|
24
59
|
*/
|
|
25
60
|
restart(): void;
|
|
26
61
|
getOutcome(): Vow<any>;
|
|
27
|
-
}
|
|
28
|
-
|
|
62
|
+
}, import("@endo/patterns").InterfaceGuard<{
|
|
63
|
+
restart: import("@endo/patterns").MethodGuard<"sync", [], import("@endo/patterns").ArgGuard[], any, import("@endo/patterns").SyncValueGuard>;
|
|
64
|
+
getOutcome: import("@endo/patterns").MethodGuard<"sync", [], import("@endo/patterns").ArgGuard[], (string & {
|
|
65
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
66
|
+
}) | (number & {
|
|
67
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
68
|
+
}) | (bigint & {
|
|
69
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
70
|
+
}) | (false & {
|
|
71
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
72
|
+
}) | (true & {
|
|
73
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
74
|
+
}) | (symbol & {
|
|
75
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
76
|
+
}) | (void & {
|
|
77
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
78
|
+
}) | (ArrayBuffer & {
|
|
79
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
80
|
+
}) | (import("@endo/pass-style").RemotableObject<string> & {
|
|
81
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
82
|
+
}) | (import("@endo/eventual-send").RemotableBrand<any, any> & {
|
|
83
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
84
|
+
}) | (import("@endo/pass-style").CopyArrayInterface<PassableCap, Error> & {
|
|
85
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
86
|
+
}) | (import("@endo/pass-style").CopyRecordInterface<PassableCap, Error> & {
|
|
87
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
88
|
+
}) | (import("@endo/pass-style").CopyTaggedInterface<PassableCap, Error> & {
|
|
89
|
+
"Symbol(castedType)"?: Vow | undefined;
|
|
90
|
+
}), import("@endo/patterns").SyncValueGuard>;
|
|
91
|
+
}>>;
|
|
92
|
+
}, import("@endo/patterns").InterfaceGuard<{
|
|
93
|
+
getFlowForOutcomeVow: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").CastedPattern<Vow>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", [import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"kind", "undefined">]>, import("@endo/patterns").SyncValueGuard>;
|
|
94
|
+
}>>;
|
|
29
95
|
retryable: import("./types.js").RetryableTool;
|
|
30
96
|
};
|
|
31
97
|
export type PreparationOptions = {
|
|
@@ -40,6 +106,7 @@ export type RetryableFlowKit = ReturnType<MakeRetryableFlowKit>;
|
|
|
40
106
|
export type RetryableFlow = RetryableFlowKit["flow"];
|
|
41
107
|
import type { Zone } from '@agoric/base-zone';
|
|
42
108
|
import type { Vow } from './types.js';
|
|
109
|
+
import type { PassableCap } from '@endo/pass-style';
|
|
43
110
|
import type { VowKit } from './types.js';
|
|
44
111
|
import type { IsRetryableReason } from './types.js';
|
|
45
112
|
import type { Passable } from '@endo/pass-style';
|
package/src/retryable.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retryable.d.ts","sourceRoot":"","sources":["retryable.js"],"names":[],"mappings":"AAwCO,iDAHI,IAAI,gBACJ,kBAAkB;oCAoBhB,IAAI,OACJ,MAAM,iBACN,aAAa;;YAsBhB;;;eAGG
|
|
1
|
+
{"version":3,"file":"retryable.d.ts","sourceRoot":"","sources":["retryable.js"],"names":[],"mappings":"AAwCO,iDAHI,IAAI,gBACJ,kBAAkB;oCAoBhB,IAAI,OACJ,MAAM,iBACN,aAAa;;YAsBhB;;;eAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAyGP;;WAEG;yCADQ,GAAG;YA7GV;;;eAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuHZ;;gBA9La,MAAM,OAAO,GAAG,CAAC;uBACjB,iBAAiB;;4BAIlB,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC;6BA6LrC,UAAU,CAAC,OAAO,qBAAqB,CAAC;iCAIxC,cAAc,CAAC,oBAAoB,CAAC;mCAIpC,UAAU,CAAC,cAAc,CAAC,yBAAyB,CAAC,CAAC;+BAIrD,UAAU,CAAC,oBAAoB,CAAC;4BAIhC,gBAAgB,CAAC,MAAM,CAAC;0BAzNd,mBAAmB;yBACiB,YAAY;iCAC/B,kBAAkB;4BADC,YAAY;uCAAZ,YAAY;8BAC/B,kBAAkB"}
|
package/src/retryable.js
CHANGED
|
@@ -148,7 +148,7 @@ export const prepareRetryableTools = (outerZone, outerOptions) => {
|
|
|
148
148
|
const retryableKit = internalMakeRetryableFlowKit(activationArgs);
|
|
149
149
|
const { flow } = retryableKit;
|
|
150
150
|
|
|
151
|
-
const vow = flow.getOutcome();
|
|
151
|
+
const vow = /** @type {Vow} */ (flow.getOutcome());
|
|
152
152
|
flowForOutcomeVowKey.init(toPassableCap(vow), flow);
|
|
153
153
|
flow.restart();
|
|
154
154
|
return retryableKit;
|
|
@@ -156,31 +156,33 @@ export const prepareRetryableTools = (outerZone, outerOptions) => {
|
|
|
156
156
|
return harden(makeRetryableFlowKit);
|
|
157
157
|
};
|
|
158
158
|
|
|
159
|
-
/**
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
159
|
+
const retryable = /** @type {VowTools['retryable']} */ (
|
|
160
|
+
(zone, tag, retryableFunc) => {
|
|
161
|
+
const makeRetryableKit = prepareRetryableFlowKit(
|
|
162
|
+
zone,
|
|
163
|
+
tag,
|
|
164
|
+
retryableFunc,
|
|
165
|
+
);
|
|
166
|
+
const wrapperFuncName = `${tag}_retryable`;
|
|
167
|
+
|
|
168
|
+
const wrapperFunc = {
|
|
169
|
+
/** @param {any[]} args */
|
|
170
|
+
[wrapperFuncName](...args) {
|
|
171
|
+
// Make sure any error results in a rejected vow
|
|
172
|
+
return asVow(() => {
|
|
173
|
+
zone.isStorable(harden(args)) ||
|
|
174
|
+
Fail`retryable arguments must be storable ${args}`;
|
|
175
|
+
const { flow } = makeRetryableKit(args);
|
|
176
|
+
return flow.getOutcome();
|
|
177
|
+
});
|
|
178
|
+
},
|
|
179
|
+
}[wrapperFuncName];
|
|
180
|
+
defineProperties(wrapperFunc, {
|
|
181
|
+
length: { value: retryableFunc.length },
|
|
182
|
+
});
|
|
183
|
+
return harden(wrapperFunc);
|
|
184
|
+
}
|
|
185
|
+
);
|
|
184
186
|
|
|
185
187
|
const adminRetryableFlow = outerZone.exo(
|
|
186
188
|
'AdminRetryableFlow',
|
package/src/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["tools.js"],"names":[],"mappings":"AAwBO,2CALI,IAAI,WAEZ;IAAmC,iBAAiB;CACpD,GAAU,QAAQ,
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["tools.js"],"names":[],"mappings":"AAwBO,2CALI,IAAI,WAEZ;IAAmC,iBAAiB;CACpD,GAAU,QAAQ,CAwEpB;0BApFsB,mBAAmB;uCAEuC,YAAY;8BAAZ,YAAY"}
|