@agoric/vow 0.2.0-upgrade-17-dev-ec448b0.0 → 0.2.0-upgrade-18-dev-bf39b10.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/src/types.js DELETED
@@ -1,108 +0,0 @@
1
- // @ts-check
2
- export {};
3
-
4
- /**
5
- * @import {CopyTagged} from '@endo/pass-style'
6
- * @import {RemotableObject} from '@endo/pass-style';
7
- * @import {Remote} from '@agoric/internal';
8
- * @import {prepareVowTools} from './tools.js'
9
- */
10
-
11
- /**
12
- * @callback IsRetryableReason
13
- * Return truthy if a rejection reason should result in a retry.
14
- * @param {any} reason
15
- * @param {any} priorRetryValue the previous value returned by this function
16
- * when deciding whether to retry the same logical operation
17
- * @returns {any} If falsy, the reason is not retryable. If truthy, the
18
- * priorRetryValue for the next call.
19
- */
20
-
21
- /**
22
- * @template T
23
- * @typedef {Promise<T | Vow<T>>} PromiseVow Return type of a function that may
24
- * return a promise or a vow.
25
- */
26
-
27
- /**
28
- * @template T
29
- * @typedef {T | PromiseLike<T>} ERef
30
- */
31
-
32
- /**
33
- * Eventually a value T or Vow for it.
34
- * @template T
35
- * @typedef {ERef<T | Vow<T>>} EVow
36
- */
37
-
38
- /**
39
- * Follow the chain of vow shortening to the end, returning the final value.
40
- * This is used within E, so we must narrow the type to its remote form.
41
- * @template T
42
- * @typedef {(
43
- * T extends Vow<infer U> ? EUnwrap<U> :
44
- * T extends PromiseLike<infer U> ? EUnwrap<U> :
45
- * T
46
- * )} EUnwrap
47
- */
48
-
49
- /**
50
- * @template [T=any]
51
- * @typedef {object} VowV0 The first version of the vow implementation
52
- * object. CAVEAT: These methods must never be changed or added to, to provide
53
- * forward/backward compatibility. Create a new object and bump its version
54
- * number instead.
55
- *
56
- * @property {() => Promise<T>} shorten Attempt to unwrap all vows in this
57
- * promise chain, returning a promise for the final value. A rejection may
58
- * indicate a temporary routing failure requiring a retry, otherwise that the
59
- * decider of the terminal promise rejected it.
60
- */
61
-
62
- /**
63
- * @template [T=any]
64
- * @typedef {object} VowPayload
65
- * @property {RemotableObject & Remote<VowV0<T>>} vowV0
66
- */
67
-
68
- /**
69
- * @template [T=any]
70
- * @typedef {CopyTagged<'Vow', VowPayload<T>>} Vow
71
- */
72
-
73
- /**
74
- * @template [T=any]
75
- * @typedef {{
76
- * vow: Vow<T>,
77
- * resolver: VowResolver<T>,
78
- * }} VowKit
79
- */
80
-
81
- /**
82
- * @template [T=any]
83
- * @typedef {{ resolve(value?: T | PromiseVow<T>): void, reject(reason?: any): void }} VowResolver
84
- */
85
-
86
- /**
87
- * @template [T=any]
88
- * @template [TResult1=T]
89
- * @template [TResult2=never]
90
- * @template {any[]} [C=any[]] watcher args
91
- * @typedef {object} Watcher
92
- * @property {(value: T, ...args: C) => Vow<TResult1> | PromiseVow<TResult1> | TResult1} [onFulfilled]
93
- * @property {(reason: any, ...args: C) => Vow<TResult2> | PromiseVow<TResult2> | TResult2} [onRejected]
94
- */
95
-
96
- /**
97
- * Converts a vow or promise to a promise, ensuring proper handling of ephemeral promises.
98
- *
99
- * @template [T=any]
100
- * @template [TResult1=T]
101
- * @template [TResult2=never]
102
- * @template {any[]} [C=any[]]
103
- * @callback AsPromiseFunction
104
- * @param {ERef<T | Vow<T>>} specimenP
105
- * @param {Watcher<T, TResult1, TResult2, C>} [watcher]
106
- * @param {C} [watcherArgs]
107
- * @returns {Promise<TResult1 | TResult2>}
108
- */