@agoric/vow 0.1.1-dev-217005a.0 → 0.1.1-dev-b196804.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/vow",
3
- "version": "0.1.1-dev-217005a.0+217005a",
3
+ "version": "0.1.1-dev-b196804.0+b196804",
4
4
  "description": "Remote (shortening and disconnection-tolerant) Promise-likes",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -20,8 +20,8 @@
20
20
  "lint:types": "tsc"
21
21
  },
22
22
  "dependencies": {
23
- "@agoric/base-zone": "0.1.1-dev-217005a.0+217005a",
24
- "@agoric/internal": "0.3.3-dev-217005a.0+217005a",
23
+ "@agoric/base-zone": "0.1.1-dev-b196804.0+b196804",
24
+ "@agoric/internal": "0.3.3-dev-b196804.0+b196804",
25
25
  "@endo/env-options": "^1.1.4",
26
26
  "@endo/errors": "^1.2.2",
27
27
  "@endo/eventual-send": "^1.2.2",
@@ -55,5 +55,5 @@
55
55
  "typeCoverage": {
56
56
  "atLeast": 89.6
57
57
  },
58
- "gitHead": "217005a921dcac6928c999e6bfe06330a5947ac5"
58
+ "gitHead": "b196804c28fe5ed5f742c0e23a4d223b7fc0a164"
59
59
  }
package/src/tools.d.ts CHANGED
@@ -2,15 +2,18 @@ export function prepareVowTools(zone: Zone, powers?: {
2
2
  isRetryableReason?: IsRetryableReason | undefined;
3
3
  } | undefined): {
4
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) => import("./types.js").Vow<Exclude<TResult1, void> | Exclude<TResult2, void> extends never ? TResult1 : Exclude<TResult1, void> | Exclude<TResult2, void>>;
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
6
  makeVowKit: <T>() => import("./types.js").VowKit<T>;
7
- allVows: (maybeVows: EVow<unknown>[]) => import("./types.js").Vow<any[]>;
8
- asVow: <T extends unknown>(fn: (...args: any[]) => import("./types.js").Vow<Awaited<T>> | Awaited<T> | import("./types.js").PromiseVow<T>) => import("./types.js").Vow<Awaited<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
9
  asPromise: AsPromiseFunction;
10
+ retriable: <T>(fnZone: Zone, name: string, fn: (...args: unknown[]) => ERef<T>) => (...args: unknown[]) => Vow<T>;
10
11
  };
11
12
  export type VowTools = ReturnType<typeof prepareVowTools>;
12
13
  import type { Zone } from '@agoric/base-zone';
13
14
  import type { IsRetryableReason } from './types.js';
14
15
  import type { EVow } from './types.js';
16
+ import type { Vow } from './types.js';
15
17
  import type { AsPromiseFunction } from './types.js';
18
+ import type { ERef } from './types.js';
16
19
  //# sourceMappingURL=tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["tools.js"],"names":[],"mappings":"AAoBO,sCAJI,IAAI;;;;;;yBAsBF,KAAK,OAAO,CAAC,EAAE;oCAa48B,GAAG;;EAJ1+B;uBAGa,UAAU,CAAC,OAAO,eAAe,CAAC;0BA1CzB,mBAAmB;uCACmB,YAAY;0BAAZ,YAAY;uCAAZ,YAAY"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["tools.js"],"names":[],"mappings":"AAoBO,sCAJI,IAAI;;;;;;yBAyCF,KAAK,OAAO,CAAC,EAAE;oCAqBuZ,GAAG;;gBApCva,CAAC,UACH,IAAI,QACJ,MAAM,MACN,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,KAAK,CAAC,CAAC,KAC7B,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC,CAAC;EA4B5C;uBAGa,UAAU,CAAC,OAAO,eAAe,CAAC;0BArEzB,mBAAmB;uCAC8B,YAAY;0BAAZ,YAAY;yBAAZ,YAAY;uCAAZ,YAAY;0BAAZ,YAAY"}
package/src/tools.js CHANGED
@@ -1,13 +1,13 @@
1
1
  // @ts-check
2
- import { makeWhen } from './when.js';
2
+ import { makeAsVow } from './vow-utils.js';
3
3
  import { prepareVowKit } from './vow.js';
4
- import { prepareWatch } from './watch.js';
5
4
  import { prepareWatchUtils } from './watch-utils.js';
6
- import { makeAsVow } from './vow-utils.js';
5
+ import { prepareWatch } from './watch.js';
6
+ import { makeWhen } from './when.js';
7
7
 
8
8
  /**
9
9
  * @import {Zone} from '@agoric/base-zone';
10
- * @import {IsRetryableReason, AsPromiseFunction, EVow} from './types.js';
10
+ * @import {IsRetryableReason, AsPromiseFunction, EVow, Vow, ERef} from './types.js';
11
11
  */
12
12
 
13
13
  /**
@@ -33,6 +33,25 @@ export const prepareVowTools = (zone, powers = {}) => {
33
33
  const watchUtils = makeWatchUtils();
34
34
  const asVow = makeAsVow(makeVowKit);
35
35
 
36
+ /**
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.
40
+ *
41
+ * The internal functions
42
+ *
43
+ * @template T
44
+ * @param {Zone} fnZone - the zone for the named function
45
+ * @param {string} name
46
+ * @param {(...args: unknown[]) => ERef<T>} fn
47
+ * @returns {(...args: unknown[]) => Vow<T>}
48
+ */
49
+ const retriable =
50
+ (fnZone, name, fn) =>
51
+ (...args) => {
52
+ return watch(fn(...args));
53
+ };
54
+
36
55
  /**
37
56
  * Vow-tolerant implementation of Promise.all.
38
57
  *
@@ -44,7 +63,15 @@ export const prepareVowTools = (zone, powers = {}) => {
44
63
  const asPromise = (specimenP, ...watcherArgs) =>
45
64
  watchUtils.asPromise(specimenP, ...watcherArgs);
46
65
 
47
- return harden({ when, watch, makeVowKit, allVows, asVow, asPromise });
66
+ return harden({
67
+ when,
68
+ watch,
69
+ makeVowKit,
70
+ allVows,
71
+ asVow,
72
+ asPromise,
73
+ retriable,
74
+ });
48
75
  };
49
76
  harden(prepareVowTools);
50
77