@agoric/async-flow 0.1.1-dev-20cb52f.0 → 0.1.1-dev-92f2510.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.
Files changed (2) hide show
  1. package/package.json +9 -9
  2. package/src/types.d.ts +14 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/async-flow",
3
- "version": "0.1.1-dev-20cb52f.0+20cb52f",
3
+ "version": "0.1.1-dev-92f2510.0+92f2510",
4
4
  "description": "Upgrade async functions at await points by replay",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/Agoric/agoric-sdk",
@@ -24,10 +24,10 @@
24
24
  "author": "Agoric",
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@agoric/base-zone": "0.1.1-dev-20cb52f.0+20cb52f",
28
- "@agoric/internal": "0.3.3-dev-20cb52f.0+20cb52f",
29
- "@agoric/store": "0.9.3-dev-20cb52f.0+20cb52f",
30
- "@agoric/vow": "0.1.1-dev-20cb52f.0+20cb52f",
27
+ "@agoric/base-zone": "0.1.1-dev-92f2510.0+92f2510",
28
+ "@agoric/internal": "0.3.3-dev-92f2510.0+92f2510",
29
+ "@agoric/store": "0.9.3-dev-92f2510.0+92f2510",
30
+ "@agoric/vow": "0.1.1-dev-92f2510.0+92f2510",
31
31
  "@endo/common": "^1.2.2",
32
32
  "@endo/errors": "^1.2.2",
33
33
  "@endo/eventual-send": "^1.2.2",
@@ -37,8 +37,8 @@
37
37
  "@endo/promise-kit": "^1.1.2"
38
38
  },
39
39
  "devDependencies": {
40
- "@agoric/swingset-liveslots": "0.10.3-dev-20cb52f.0+20cb52f",
41
- "@agoric/zone": "0.2.3-dev-20cb52f.0+20cb52f",
40
+ "@agoric/swingset-liveslots": "0.10.3-dev-92f2510.0+92f2510",
41
+ "@agoric/zone": "0.2.3-dev-92f2510.0+92f2510",
42
42
  "@endo/env-options": "^1.1.4",
43
43
  "@endo/ses-ava": "^1.2.2",
44
44
  "ava": "^5.3.0",
@@ -61,7 +61,7 @@
61
61
  "workerThreads": false
62
62
  },
63
63
  "typeCoverage": {
64
- "atLeast": 77.01
64
+ "atLeast": 77.1
65
65
  },
66
- "gitHead": "20cb52f605da9535ead8778086b1900dfda0f375"
66
+ "gitHead": "92f2510ab86a27b2f3473edfca72bd8bf647dadc"
67
67
  }
package/src/types.d.ts CHANGED
@@ -46,11 +46,18 @@ export type GuestOf<F extends HostAsyncFuncWrapper> = F extends (
46
46
  ? (...args: A) => Promise<R>
47
47
  : F;
48
48
 
49
+ // from https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts
50
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
51
+
49
52
  /**
50
53
  * Convert an entire Guest interface into what the host will implement.
51
54
  */
52
55
  type HostInterface<T> = {
53
- [K in keyof T]: HostOf<T[K]>;
56
+ [K in keyof T]: T[K] extends CallableFunction
57
+ ? HostOf<T[K]>
58
+ : T[K] extends Record<string, any>
59
+ ? Simplify<HostInterface<T[K]>>
60
+ : T[K];
54
61
  };
55
62
 
56
63
  /**
@@ -71,8 +78,12 @@ export type GuestInterface<T> = {
71
78
  *
72
79
  * Specifically, Promise return values are converted to Vows.
73
80
  */
74
- export type HostOf<F> = F extends (...args: infer A) => Promise<infer R>
75
- ? (...args: A) => Vow<R extends Passable ? R : HostInterface<R>>
81
+ export type HostOf<F extends CallableFunction> = F extends (
82
+ ...args: infer A
83
+ ) => infer R
84
+ ? R extends Promise<infer T>
85
+ ? (...args: A) => Vow<T extends Passable ? T : HostInterface<T>>
86
+ : (...args: A) => HostInterface<R>
76
87
  : F;
77
88
 
78
89
  export type HostArgs<GA extends any[]> = { [K in keyof GA]: HostOf<GA[K]> };