@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/README.md CHANGED
@@ -27,7 +27,7 @@ Here they are: {
27
27
  ```
28
28
 
29
29
  You can use `heapVowE` exported from `@agoric/vow`, which converts a chain of
30
- promises and vows to a promise for its final fulfilment, by unwrapping any
30
+ promises and vows to a promise for its final fulfillment, by unwrapping any
31
31
  intermediate vows:
32
32
 
33
33
  ```js
@@ -77,6 +77,67 @@ const { watch, makeVowKit } = prepareVowTools(vowZone);
77
77
  // Vows and resolvers you create can be saved in durable stores.
78
78
  ```
79
79
 
80
+ ## VowTools
81
+
82
+ VowTools are a set of utility functions for working with Vows in Agoric smart contracts and vats. These tools help manage asynchronous operations in a way that's resilient to vat upgrades, ensuring your smart contract can handle long-running processes reliably.
83
+
84
+ ### Usage
85
+
86
+ VowTools are typically prepared in the start function of a smart contract or vat and passed in as a power to exos.
87
+
88
+
89
+ ```javascript
90
+ import { prepareVowTools } from '@agoric/vow/vat.js';
91
+ import { makeDurableZone } from '@agoric/zone/durable.js';
92
+
93
+ export const start = async (zcf, privateArgs, baggage) => {
94
+ const zone = makeDurableZone(baggage);
95
+ const vowTools = prepareVowTools(zone.subZone('vows'));
96
+
97
+ // Use vowTools here...
98
+ }
99
+ ```
100
+
101
+ ### Available Tools
102
+
103
+ #### `when(vowOrPromise)`
104
+ Returns a Promise for the fulfillment of the very end of the `vowOrPromise` chain. It can retry disconnections due to upgrades of other vats, but cannot survive the upgrade of the calling vat.
105
+
106
+ #### `watch(promiseOrVow, [watcher], [context])`
107
+ Watch a Vow and optionally provide a `watcher` with `onFulfilled`/`onRejected` handlers and a `context` value for the handlers. When handlers are not provided the fulfillment or rejection will simply pass through.
108
+
109
+ It also registers pending Promises, so if the current vat is upgraded, the watcher is rejected because the Promise was lost when the heap was reset.
110
+
111
+ #### `all(arrayOfPassables, [watcher], [context])`
112
+ Vow-tolerant implementation of Promise.all that takes an iterable of vows and other Passables and returns a single Vow. It resolves with an array of values when all of the input's promises or vows are fulfilled and rejects with the first rejection reason when any of the input's promises or vows are rejected.
113
+
114
+ #### `allSettled(arrayOfPassables, [watcher], [context])`
115
+ Vow-tolerant implementation of Promise.allSettled that takes an iterable of vows and other Passables and returns a single Vow. It resolves when all of the input's promises or vows are settled with an array of settled outcome objects.
116
+
117
+ #### `asVow(fn)`
118
+ Takes a function that might return synchronously, throw an Error, or return a Promise or Vow and returns a Vow.
119
+
120
+ #### `asPromise(vow)`
121
+ Converts a Vow back into a Promise.
122
+
123
+ ### Example
124
+
125
+ ```javascript
126
+ const { when, watch, all, allSettled } = vowTools;
127
+
128
+ // Using watch to create a Vow
129
+ const myVow = watch(someAsyncOperation());
130
+
131
+ // Using when to resolve a Vow
132
+ const result = await when(myVow);
133
+
134
+ // Using all
135
+ const results = await when(all([vow, vowForVow, promise]));
136
+
137
+ // Using allSettled
138
+ const outcomes = await when(allSettled([vow, vowForVow, promise]));
139
+ ```
140
+
80
141
  ## Internals
81
142
 
82
143
  The current "version 0" vow internals expose a `shorten()` method, returning a
@@ -89,8 +150,8 @@ Here is an (oversimplified) algorithm that `watch` and `when` use to obtain a
89
150
  final result:
90
151
 
91
152
  ```js
92
- // Directly await the non-retriable original specimen.
93
- // This is non-retriable because we don't know how our caller obtained
153
+ // Directly await the non-retryable original specimen.
154
+ // This is non-retryable because we don't know how our caller obtained
94
155
  // it in the first place, since it is an application-specific detail
95
156
  // that may not be side-effect free.
96
157
  let result = await specimenP;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/vow",
3
- "version": "0.2.0-upgrade-17-dev-ec448b0.0+ec448b0",
3
+ "version": "0.2.0-upgrade-18-dev-bf39b10.0+bf39b10",
4
4
  "description": "Remote (shortening and disconnection-tolerant) Promise-likes",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -10,9 +10,8 @@
10
10
  "scripts": {
11
11
  "build": "exit 0",
12
12
  "prepack": "tsc --build tsconfig.build.json",
13
- "postpack": "git clean -f '*.d.ts*'",
13
+ "postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
14
14
  "test": "ava",
15
- "test:nyc": "exit 0",
16
15
  "test:xs": "exit 0",
17
16
  "lint-fix": "yarn lint:eslint --fix",
18
17
  "lint": "run-s --continue-on-error lint:*",
@@ -20,19 +19,21 @@
20
19
  "lint:types": "tsc"
21
20
  },
22
21
  "dependencies": {
23
- "@agoric/base-zone": "0.1.1-upgrade-17-dev-ec448b0.0+ec448b0",
24
- "@agoric/internal": "0.4.0-upgrade-17-dev-ec448b0.0+ec448b0",
25
- "@endo/env-options": "^1.1.6",
26
- "@endo/errors": "^1.2.5",
27
- "@endo/eventual-send": "^1.2.5",
28
- "@endo/pass-style": "^1.4.3",
29
- "@endo/patterns": "^1.4.3",
30
- "@endo/promise-kit": "^1.1.5"
22
+ "@agoric/base-zone": "0.1.1-upgrade-18-dev-bf39b10.0+bf39b10",
23
+ "@agoric/internal": "0.4.0-upgrade-18-dev-bf39b10.0+bf39b10",
24
+ "@endo/env-options": "^1.1.7",
25
+ "@endo/errors": "^1.2.7",
26
+ "@endo/eventual-send": "^1.2.7",
27
+ "@endo/pass-style": "^1.4.6",
28
+ "@endo/patterns": "^1.4.6",
29
+ "@endo/promise-kit": "^1.1.7"
31
30
  },
32
31
  "devDependencies": {
33
32
  "@agoric/internal": "^0.3.2",
34
- "@endo/far": "^1.1.5",
35
- "@endo/init": "^1.1.4",
33
+ "@agoric/swingset-vat": "0.33.0-upgrade-18-dev-bf39b10.0+bf39b10",
34
+ "@agoric/zone": "0.3.0-upgrade-18-dev-bf39b10.0+bf39b10",
35
+ "@endo/far": "^1.1.8",
36
+ "@endo/init": "^1.1.6",
36
37
  "ava": "^5.3.0",
37
38
  "tsd": "^0.31.1"
38
39
  },
@@ -54,7 +55,7 @@
54
55
  "access": "public"
55
56
  },
56
57
  "typeCoverage": {
57
- "atLeast": 89.96
58
+ "atLeast": 91.85
58
59
  },
59
- "gitHead": "ec448b081ac21cbe217f210e06f0b8f7989e73d6"
60
+ "gitHead": "bf39b100f0da4380bab0ce2464aaca1988f0b76a"
60
61
  }
package/src/E.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"E.d.ts","sourceRoot":"","sources":["E.js"],"names":[],"mappings":";uBA6Bc,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,GAAG;qBAuR3B,UAAU,GAzGV,CAAC,uBACJ,yBAAyB;eAExB,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;;oBAgBxB,CAAC,KACH,CAAC,KACC,kBAAkB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAOjD;;;;;;;;;;OAUG;mBAJU,CAAC,KACH,CAAC,KACC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAWrC;;;;;;;;OAQG;uBAJU,CAAC,KACH,CAAC,KACC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAKhC;;;;;;;;OAQG;wBAJU,CAAC,KACH,CAAC,KACC,0BAA0B,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAW3D;;;;;;;;;;;;OAYG;oBARU,CAAC,EACA,QAAQ,eACR,QAAQ,aACX,IAAI,CAAC,CAAC,CAAC,yBACC,QAAQ,CAAC,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,sCAC5B,GAAG,KAAK,IAAI,CAAC,QAAQ,CAAC,kBAC7B,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;OAoBlB;;;;;qBAMlB,CAAC,IACD,IAAI,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;iBAKlC,CAAC,IACD,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC;sBAIP,CAAC,SAAX,QAAS,IACV,UAAU,CAAC,C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UG;mBAJU,CAAC,KACH,CAAC,KACC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAWrC;;;;;;;;OAQG;uBAJU,CAAC,KACH,CAAC,KACC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAKhC;;;;;;;;OAQG;wBAJU,CAAC,KACH,CAAC,KACC,0BAA0B,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAW3D;;;;;;;;;;;;OAYG;oBARU,CAAC,EACA,QAAQ,eACR,QAAQ,aACX,IAAI,CAAC,CAAC,CAAC,yBACC,QAAQ,CAAC,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,sCAC5B,GAAG,KAAK,IAAI,CAAC,QAAQ,CAAC,kBAC7B,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;MAgBhD;+CAtR6D,qBAAqB;6BACvD,YAAY;oCADsB,qBAAqB"}
package/src/index.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  export * from "../vat.js";
2
- export * from "./types.js";
3
- export * from "@agoric/internal/src/types.js";
2
+ export * from "./types-index.js";
4
3
  export { default as makeE } from "./E.js";
5
- export type VowTools = import("./tools.js").VowTools;
6
4
  export { VowShape, toPassableCap } from "./vow-utils.js";
7
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":";;;;uBASa,OAAO,YAAY,EAAE,QAAQ"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":""}
package/src/index.js CHANGED
@@ -6,12 +6,5 @@ export * from '../vat.js';
6
6
  export { default as makeE } from './E.js';
7
7
  export { VowShape, toPassableCap } from './vow-utils.js';
8
8
 
9
- /**
10
- * @typedef {import('./tools.js').VowTools} VowTools
11
- */
12
-
13
9
  // eslint-disable-next-line import/export
14
- export * from './types.js';
15
-
16
- // XXX re-exporting the Remote type for back-compat
17
- export * from '@agoric/internal/src/types.js';
10
+ export * from './types-index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"message-breakpoints.d.ts","sourceRoot":"","sources":["message-breakpoints.js"],"names":[],"mappings":"AA0FO,wDAHI,MAAM,GACJ,uBAAuB,GAAG,SAAS,CA0F/C;;;;;;;;6BA1KY,MAAM,GAAG,GAAG;;;;;;;8BAQZ,MAAM,GAAG,GAAG;;;;;;;;6BAOZ,MAAM,GAAG,GAAG;;;;;;;iCAcZ,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;;;;;;;8BAS/D,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;;oBAK9D,MAAM,kBAAkB;oBACxB,CAAC,cAAc,CAAC,EAAE,kBAAkB,KAAK,IAAI;sBAC7C,CACb,SAAa,EAAE,MAAM,EACrB,UAAc,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,KACpC,OAAO"}
1
+ {"version":3,"file":"message-breakpoints.d.ts","sourceRoot":"","sources":["message-breakpoints.js"],"names":[],"mappings":"AA0FO,wDAHI,MAAM,GACJ,uBAAuB,GAAG,SAAS,CA0F/C;;;;;;;;6BA1KY,MAAM,GAAG,GAAG;;;;;;;8BAQZ,MAAM,GAAG,GAAG;;;;;;;;6BAOZ,MAAM,GAAG,GAAG;;;;;;;iCAcZ,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;;;;;;;8BAS/D,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;;oBAK9D,MAAM,kBAAkB;oBACxB,CAAC,cAAc,CAAC,EAAE,kBAAkB,KAAK,IAAI;sBAC7C,CACT,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,KACpC,OAAO"}
@@ -0,0 +1,75 @@
1
+ export function prepareRetryableTools(outerZone: Zone, outerOptions: PreparationOptions): {
2
+ prepareRetryableFlowKit: (zone: Zone, tag: string, retryableFunc: RetryableFunc) => (activationArgs: any) => import("@endo/exo").GuardedKit<{
3
+ flow: {
4
+ /**
5
+ * Calls the retryable function, either for the initial run or when
6
+ * the result of the previous run fails with a retryable reason.
7
+ */
8
+ restart(): void;
9
+ getOutcome(): Vow<any>;
10
+ };
11
+ resultWatcher: {
12
+ onFulfilled(value: any, runId: any): void;
13
+ onRejected(reason: any, runId: any): void;
14
+ };
15
+ }>;
16
+ adminRetryableFlow: import("@endo/exo").Guarded<{
17
+ /**
18
+ * @param {Vow} outcomeVow
19
+ */
20
+ getFlowForOutcomeVow(outcomeVow: Vow): import("@endo/exo").Guarded<{
21
+ /**
22
+ * Calls the retryable function, either for the initial run or when
23
+ * the result of the previous run fails with a retryable reason.
24
+ */
25
+ restart(): void;
26
+ getOutcome(): Vow<any>;
27
+ }>;
28
+ }>;
29
+ retryable: import("./types.js").RetryableTool;
30
+ };
31
+ export type PreparationOptions = {
32
+ makeVowKit: () => VowKit<any>;
33
+ isRetryableReason: IsRetryableReason;
34
+ };
35
+ export type RetryableFunc = (...args: Passable[]) => Promise<any>;
36
+ export type RetryableTools = ReturnType<(outerZone: Zone, outerOptions: PreparationOptions) => {
37
+ prepareRetryableFlowKit: (zone: Zone, tag: string, retryableFunc: RetryableFunc) => (activationArgs: any) => import("@endo/exo").GuardedKit<{
38
+ flow: {
39
+ /**
40
+ * Calls the retryable function, either for the initial run or when
41
+ * the result of the previous run fails with a retryable reason.
42
+ */
43
+ restart(): void;
44
+ getOutcome(): Vow<any>;
45
+ };
46
+ resultWatcher: {
47
+ onFulfilled(value: any, runId: any): void;
48
+ onRejected(reason: any, runId: any): void;
49
+ };
50
+ }>;
51
+ adminRetryableFlow: import("@endo/exo").Guarded<{
52
+ /**
53
+ * @param {Vow} outcomeVow
54
+ */
55
+ getFlowForOutcomeVow(outcomeVow: Vow): import("@endo/exo").Guarded<{
56
+ /**
57
+ * Calls the retryable function, either for the initial run or when
58
+ * the result of the previous run fails with a retryable reason.
59
+ */
60
+ restart(): void;
61
+ getOutcome(): Vow<any>;
62
+ }>;
63
+ }>;
64
+ retryable: import("./types.js").RetryableTool;
65
+ }>;
66
+ export type AdminRetryableFlow = RetryableTools["adminRetryableFlow"];
67
+ export type MakeRetryableFlowKit = ReturnType<RetryableTools["prepareRetryableFlowKit"]>;
68
+ export type RetryableFlowKit = ReturnType<MakeRetryableFlowKit>;
69
+ export type RetryableFlow = RetryableFlowKit["flow"];
70
+ import type { Zone } from '@agoric/base-zone';
71
+ import type { Vow } from './types.js';
72
+ import type { VowKit } from './types.js';
73
+ import type { IsRetryableReason } from './types.js';
74
+ import type { Passable } from '@endo/pass-style';
75
+ //# sourceMappingURL=retryable.d.ts.map
@@ -0,0 +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;;;;;;;;;;QAuGP;;WAEG;yCADQ,GAAG;YA3GV;;;eAGG;;;;;;EAqHZ;;gBA5La,MAAM,OAAO,GAAG,CAAC;uBACjB,iBAAiB;;4BAIlB,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC;6BA2LrC,UAAU,aAzKZ,IAAI,gBACJ,kBAAkB;oCAoBhB,IAAI,OACJ,MAAM,iBACN,aAAa;;YAsBhB;;;eAGG;;;;;;;;;;QAuGP;;WAEG;yCADQ,GAAG;YA3GV;;;eAGG;;;;;;EAyHiC;iCAIjC,cAAc,CAAC,oBAAoB,CAAC;mCAIpC,UAAU,CAAC,cAAc,CAAC,yBAAyB,CAAC,CAAC;+BAIrD,UAAU,CAAC,oBAAoB,CAAC;4BAIhC,gBAAgB,CAAC,MAAM,CAAC;0BAvNd,mBAAmB;yBACiB,YAAY;4BAAZ,YAAY;uCAAZ,YAAY;8BAC/B,kBAAkB"}
@@ -0,0 +1,224 @@
1
+ import { Fail } from '@endo/errors';
2
+ import { M } from '@endo/patterns';
3
+ import { PromiseWatcherI } from '@agoric/base-zone';
4
+ import { makeAsVow, toPassableCap, VowShape } from './vow-utils.js';
5
+
6
+ /**
7
+ * @import {MapStore, WeakMapStore} from '@agoric/store'
8
+ * @import {Zone} from '@agoric/base-zone'
9
+ * @import {Vow, VowKit, IsRetryableReason, VowTools} from './types.js'
10
+ * @import {Passable, PassableCap} from '@endo/pass-style'
11
+ */
12
+
13
+ /**
14
+ * @typedef {object} PreparationOptions
15
+ * @property {() => VowKit<any>} makeVowKit
16
+ * @property {IsRetryableReason} isRetryableReason
17
+ */
18
+
19
+ /**
20
+ * @typedef {(...args: Passable[]) => Promise<any>} RetryableFunc
21
+ */
22
+
23
+ const { defineProperties } = Object;
24
+
25
+ const RetryableFlowIKit = harden({
26
+ flow: M.interface('Flow', {
27
+ restart: M.call().returns(),
28
+ getOutcome: M.call().returns(VowShape),
29
+ }),
30
+ resultWatcher: PromiseWatcherI,
31
+ });
32
+
33
+ const AdminRetryableFlowI = M.interface('RetryableFlowAdmin', {
34
+ getFlowForOutcomeVow: M.call(VowShape).returns(M.opt(M.remotable('flow'))),
35
+ });
36
+
37
+ /**
38
+ * @param {Zone} outerZone
39
+ * @param {PreparationOptions} outerOptions
40
+ */
41
+ export const prepareRetryableTools = (outerZone, outerOptions) => {
42
+ const { makeVowKit, isRetryableReason } = outerOptions;
43
+
44
+ const asVow = makeAsVow(makeVowKit);
45
+
46
+ /**
47
+ * So we can give out wrapper functions easily and recover flow objects
48
+ * for their activations later.
49
+ */
50
+ const flowForOutcomeVowKey =
51
+ /** @type {MapStore<PassableCap, RetryableFlow>} */ (
52
+ outerZone.mapStore('retryableFlowForOutcomeVow', {
53
+ keyShape: M.remotable('toPassableCap'),
54
+ valueShape: M.remotable('flow'), // isDone === false
55
+ })
56
+ );
57
+
58
+ /**
59
+ * @param {Zone} zone
60
+ * @param {string} tag
61
+ * @param {RetryableFunc} retryableFunc
62
+ */
63
+ const prepareRetryableFlowKit = (zone, tag, retryableFunc) => {
64
+ typeof retryableFunc === 'function' ||
65
+ Fail`retryableFunc must be a callable function ${retryableFunc}`;
66
+
67
+ const internalMakeRetryableFlowKit = zone.exoClassKit(
68
+ tag,
69
+ RetryableFlowIKit,
70
+ activationArgs => {
71
+ harden(activationArgs);
72
+
73
+ return {
74
+ activationArgs, // restarting the retryable function uses the original args
75
+ outcomeKit: makeVowKit(), // outcome of activation as vow
76
+ lastRetryReason: undefined,
77
+ runs: 0n,
78
+ isDone: false, // persistently done
79
+ };
80
+ },
81
+ {
82
+ flow: {
83
+ /**
84
+ * Calls the retryable function, either for the initial run or when
85
+ * the result of the previous run fails with a retryable reason.
86
+ */
87
+ restart() {
88
+ const { state, facets } = this;
89
+ const { activationArgs, isDone } = state;
90
+ const { flow, resultWatcher } = facets;
91
+
92
+ !isDone ||
93
+ // separate line so I can set a breakpoint
94
+ Fail`Cannot restart a done retryable flow ${flow}`;
95
+
96
+ const runId = state.runs + 1n;
97
+ state.runs = runId;
98
+
99
+ let resultP;
100
+ try {
101
+ resultP = Promise.resolve(retryableFunc(...activationArgs));
102
+ } catch (err) {
103
+ resultP = Promise.reject(err);
104
+ }
105
+
106
+ outerZone.watchPromise(harden(resultP), resultWatcher, runId);
107
+ },
108
+ getOutcome() {
109
+ const { state } = this;
110
+ const { outcomeKit } = state;
111
+ return outcomeKit.vow;
112
+ },
113
+ },
114
+ resultWatcher: {
115
+ onFulfilled(value, runId) {
116
+ const { state } = this;
117
+ const { runs, outcomeKit } = state;
118
+ if (runId !== runs) return;
119
+ !state.isDone ||
120
+ Fail`Cannot resolve a done retryable flow ${this.facets.flow}`;
121
+ outcomeKit.resolver.resolve(value);
122
+ flowForOutcomeVowKey.delete(toPassableCap(outcomeKit.vow));
123
+ state.isDone = true;
124
+ },
125
+ onRejected(reason, runId) {
126
+ const { state } = this;
127
+ const { runs, outcomeKit } = state;
128
+ if (runId !== runs) return;
129
+ !state.isDone ||
130
+ Fail`Cannot reject a done retryable flow ${this.facets.flow}`;
131
+ const retryReason = isRetryableReason(
132
+ reason,
133
+ state.lastRetryReason,
134
+ );
135
+ if (retryReason) {
136
+ state.lastRetryReason = retryReason;
137
+ this.facets.flow.restart();
138
+ } else {
139
+ outcomeKit.resolver.reject(reason);
140
+ flowForOutcomeVowKey.delete(toPassableCap(outcomeKit.vow));
141
+ state.isDone = true;
142
+ }
143
+ },
144
+ },
145
+ },
146
+ );
147
+ const makeRetryableFlowKit = activationArgs => {
148
+ const retryableKit = internalMakeRetryableFlowKit(activationArgs);
149
+ const { flow } = retryableKit;
150
+
151
+ const vow = flow.getOutcome();
152
+ flowForOutcomeVowKey.init(toPassableCap(vow), flow);
153
+ flow.restart();
154
+ return retryableKit;
155
+ };
156
+ return harden(makeRetryableFlowKit);
157
+ };
158
+
159
+ /**
160
+ * @type {VowTools['retryable']}
161
+ */
162
+ const retryable = (zone, tag, retryableFunc) => {
163
+ const makeRetryableKit = prepareRetryableFlowKit(zone, tag, retryableFunc);
164
+ const wrapperFuncName = `${tag}_retryable`;
165
+
166
+ const wrapperFunc = {
167
+ /** @param {any[]} args */
168
+ [wrapperFuncName](...args) {
169
+ // Make sure any error results in a rejected vow
170
+ return asVow(() => {
171
+ zone.isStorable(harden(args)) ||
172
+ Fail`retryable arguments must be storable ${args}`;
173
+ const { flow } = makeRetryableKit(args);
174
+ return flow.getOutcome();
175
+ });
176
+ },
177
+ }[wrapperFuncName];
178
+ defineProperties(wrapperFunc, {
179
+ length: { value: retryableFunc.length },
180
+ });
181
+ // @ts-expect-error inferred generic func
182
+ return harden(wrapperFunc);
183
+ };
184
+
185
+ const adminRetryableFlow = outerZone.exo(
186
+ 'AdminRetryableFlow',
187
+ AdminRetryableFlowI,
188
+ {
189
+ /**
190
+ * @param {Vow} outcomeVow
191
+ */
192
+ getFlowForOutcomeVow(outcomeVow) {
193
+ return flowForOutcomeVowKey.get(toPassableCap(outcomeVow));
194
+ },
195
+ },
196
+ );
197
+
198
+ return harden({
199
+ prepareRetryableFlowKit,
200
+ adminRetryableFlow,
201
+ retryable,
202
+ });
203
+ };
204
+ harden(prepareRetryableTools);
205
+
206
+ /**
207
+ * @typedef {ReturnType<prepareRetryableTools>} RetryableTools
208
+ */
209
+
210
+ /**
211
+ * @typedef {RetryableTools['adminRetryableFlow']} AdminRetryableFlow
212
+ */
213
+
214
+ /**
215
+ * @typedef {ReturnType<RetryableTools['prepareRetryableFlowKit']>} MakeRetryableFlowKit
216
+ */
217
+
218
+ /**
219
+ * @typedef {ReturnType<MakeRetryableFlowKit>} RetryableFlowKit
220
+ */
221
+
222
+ /**
223
+ * @typedef {RetryableFlowKit['flow']} RetryableFlow
224
+ */
package/src/tools.d.ts CHANGED
@@ -1,18 +1,7 @@
1
1
  export function prepareBasicVowTools(zone: Zone, powers?: {
2
2
  isRetryableReason?: IsRetryableReason | undefined;
3
- } | undefined): {
4
- when: <T, TResult1 = import("./types.js").EUnwrap<T>, TResult2 = never>(specimenP: T, onFulfilled?: ((value: import("./types.js").EUnwrap<T>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>;
5
- watch: <T = any, TResult1 = T, TResult2 = never, C extends any[] = any[]>(specimenP: EVow<T>, watcher?: import("./types.js").Watcher<T, TResult1, TResult2, C> | undefined, ...watcherArgs: C) => Vow<Exclude<TResult1, void> | Exclude<TResult2, void> extends never ? TResult1 : Exclude<TResult1, void> | Exclude<TResult2, void>>;
6
- makeVowKit: <T>() => import("./types.js").VowKit<T>;
7
- allVows: (maybeVows: EVow<unknown>[]) => Vow<any[]>;
8
- asVow: <T extends unknown>(fn: (...args: any[]) => Vow<Awaited<T>> | Awaited<T> | import("./types.js").PromiseVow<T>) => Vow<Awaited<T>>;
9
- asPromise: AsPromiseFunction;
10
- retriable: <F extends (...args: any[]) => Promise<any>>(fnZone: Zone, name: string, fn: F) => F extends (...args: infer Args) => Promise<infer R> ? (...args: Args) => Vow<R> : never;
11
- };
12
- export type VowTools = ReturnType<typeof prepareBasicVowTools>;
3
+ } | undefined): VowTools;
13
4
  import type { Zone } from '@agoric/base-zone';
14
5
  import type { IsRetryableReason } from './types.js';
15
- import type { EVow } from './types.js';
16
- import type { Vow } from './types.js';
17
- import type { AsPromiseFunction } from './types.js';
6
+ import type { VowTools } from './types.js';
18
7
  //# sourceMappingURL=tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["tools.js"],"names":[],"mappings":"AAoBO,2CAJI,IAAI;;;;;;yBAwCF,KAAK,OAAO,CAAC,EAAE;oCAqB8U,GAAG;;gBArC3T,CAAC,SAApC,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAE,UACpC,IAAI,QACJ,MAAM,MACN,CAAC,KACC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC,GAAG,KAAK;EA6BrG;uBAGa,UAAU,CAAC,OAAO,oBAAoB,CAAC;0BApE9B,mBAAmB;uCAC8B,YAAY;0BAAZ,YAAY;yBAAZ,YAAY;uCAAZ,YAAY"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["tools.js"],"names":[],"mappings":"AAuBO,2CALI,IAAI;;gBAGF,QAAQ,CAiEpB;0BA7EsB,mBAAmB;uCAE4B,YAAY;8BAAZ,YAAY"}
package/src/tools.js CHANGED
@@ -3,11 +3,13 @@ import { makeAsVow } from './vow-utils.js';
3
3
  import { prepareVowKit } from './vow.js';
4
4
  import { prepareWatchUtils } from './watch-utils.js';
5
5
  import { prepareWatch } from './watch.js';
6
+ import { prepareRetryableTools } from './retryable.js';
6
7
  import { makeWhen } from './when.js';
7
8
 
8
9
  /**
9
10
  * @import {Zone} from '@agoric/base-zone';
10
- * @import {IsRetryableReason, AsPromiseFunction, EVow, Vow, ERef} from './types.js';
11
+ * @import {Passable} from '@endo/pass-style';
12
+ * @import {IsRetryableReason, AsPromiseFunction, Vow, VowTools} from './types.js';
11
13
  */
12
14
 
13
15
  /**
@@ -17,6 +19,7 @@ import { makeWhen } from './when.js';
17
19
  * @param {Zone} zone
18
20
  * @param {object} [powers]
19
21
  * @param {IsRetryableReason} [powers.isRetryableReason]
22
+ * @returns {VowTools}
20
23
  */
21
24
  export const prepareBasicVowTools = (zone, powers = {}) => {
22
25
  const { isRetryableReason = /** @type {IsRetryableReason} */ (() => false) } =
@@ -33,30 +36,37 @@ export const prepareBasicVowTools = (zone, powers = {}) => {
33
36
  const watchUtils = makeWatchUtils();
34
37
  const asVow = makeAsVow(makeVowKit);
35
38
 
39
+ const { retryable } = prepareRetryableTools(zone, {
40
+ makeVowKit,
41
+ isRetryableReason,
42
+ });
43
+
36
44
  /**
37
- * TODO FIXME make this real
38
- * Create a function that retries the given function if the underlying
39
- * functions rejects due to upgrade disconnection.
45
+ * Vow-tolerant implementation of Promise.all that takes an iterable of vows
46
+ * and other {@link Passable}s and returns a single {@link Vow}. It resolves
47
+ * with an array of values when all of the input's promises or vows are
48
+ * fulfilled and rejects when any of the input's promises or vows are
49
+ * rejected with the first rejection reason.
40
50
  *
41
- * @template {(...args: any[]) => Promise<any>} F
42
- * @param {Zone} fnZone - the zone for the named function
43
- * @param {string} name
44
- * @param {F} fn
45
- * @returns {F extends (...args: infer Args) => Promise<infer R> ? (...args: Args) => Vow<R> : never}
51
+ * @param {unknown[]} maybeVows
46
52
  */
47
- const retriable =
48
- (fnZone, name, fn) =>
49
- // @ts-expect-error cast
50
- (...args) => {
51
- return watch(fn(...args));
52
- };
53
+ const all = maybeVows => watchUtils.all(maybeVows);
53
54
 
54
55
  /**
55
- * Vow-tolerant implementation of Promise.all.
56
+ * @param {unknown[]} maybeVows
57
+ * @deprecated use `vowTools.all`
58
+ */
59
+ const allVows = all;
60
+
61
+ /**
62
+ * Vow-tolerant implementation of Promise.allSettled that takes an iterable
63
+ * of vows and other {@link Passable}s and returns a single {@link Vow}. It
64
+ * resolves when all of the input's promises or vows are settled with an
65
+ * array of settled outcome objects.
56
66
  *
57
- * @param {EVow<unknown>[]} maybeVows
67
+ * @param {unknown[]} maybeVows
58
68
  */
59
- const allVows = maybeVows => watchUtils.all(maybeVows);
69
+ const allSettled = maybeVows => watchUtils.allSettled(maybeVows);
60
70
 
61
71
  /** @type {AsPromiseFunction} */
62
72
  const asPromise = (specimenP, ...watcherArgs) =>
@@ -66,12 +76,13 @@ export const prepareBasicVowTools = (zone, powers = {}) => {
66
76
  when,
67
77
  watch,
68
78
  makeVowKit,
79
+ all,
69
80
  allVows,
81
+ allSettled,
70
82
  asVow,
71
83
  asPromise,
72
- retriable,
84
+ retryable,
85
+ retriable: retryable, // For temporary backwards compat with alpha implementation
73
86
  });
74
87
  };
75
88
  harden(prepareBasicVowTools);
76
-
77
- /** @typedef {ReturnType<typeof prepareBasicVowTools>} VowTools */
@@ -0,0 +1,5 @@
1
+ // Export all the types this package provides
2
+ export type * from './types.js';
3
+
4
+ // XXX re-exporting the Remote type for back-compat
5
+ export type { Remote } from '@agoric/internal/src/types.js';
@@ -0,0 +1,2 @@
1
+ // Empty JS file to correspond with its .d.ts twin
2
+ export {};