@agoric/internal 0.3.3-dev-442f07c.0 → 0.3.3-dev-69f8e4b.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/internal",
3
- "version": "0.3.3-dev-442f07c.0+442f07c",
3
+ "version": "0.3.3-dev-69f8e4b.0+69f8e4b",
4
4
  "description": "Externally unsupported utilities internal to agoric-sdk",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -20,7 +20,7 @@
20
20
  "lint:types": "tsc"
21
21
  },
22
22
  "dependencies": {
23
- "@agoric/base-zone": "0.1.1-dev-442f07c.0+442f07c",
23
+ "@agoric/base-zone": "0.1.1-dev-69f8e4b.0+69f8e4b",
24
24
  "@endo/common": "^1.2.5",
25
25
  "@endo/errors": "^1.2.5",
26
26
  "@endo/far": "^1.1.5",
@@ -59,5 +59,5 @@
59
59
  "typeCoverage": {
60
60
  "atLeast": 93.42
61
61
  },
62
- "gitHead": "442f07c8f0af03281b52b90e90c27131eef6f331"
62
+ "gitHead": "69f8e4b5e04b66df5400716251e66fbce468c86e"
63
63
  }
@@ -5,6 +5,7 @@ export namespace UpgradeDisconnectionShape {
5
5
  }
6
6
  export function makeUpgradeDisconnection(upgradeMessage: string, toIncarnationNumber: number): UpgradeDisconnection;
7
7
  export function isUpgradeDisconnection(reason: any): reason is UpgradeDisconnection;
8
+ export function isAbandonedError(reason: any): reason is Error;
8
9
  /**
9
10
  * An Error-like object for use as the rejection reason of promises abandoned by
10
11
  * upgrade.
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade-api.d.ts","sourceRoot":"","sources":["upgrade-api.js"],"names":[],"mappings":";;;;;AAgCO,yDAJI,MAAM,uBACN,MAAM,GACJ,oBAAoB,CAO7B;AASG,+CALI,GAAG,GAGD,MAAM,IAAI,oBAAoB,CAGqB;;;;;mCApCnD;IACR,IAAI,EAAE,aAAa,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;CAC3B"}
1
+ {"version":3,"file":"upgrade-api.d.ts","sourceRoot":"","sources":["upgrade-api.js"],"names":[],"mappings":";;;;;AAgCO,yDAJI,MAAM,uBACN,MAAM,GACJ,oBAAoB,CAO7B;AASG,+CALI,GAAG,GAGD,MAAM,IAAI,oBAAoB,CAKC;AAgBrC,yCAHI,GAAG,GACD,MAAM,IAAI,KAAK,CAQS;;;;;mCA5DxB;IACR,IAAI,EAAE,aAAa,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;CAC3B"}
@@ -45,5 +45,29 @@ harden(makeUpgradeDisconnection);
45
45
  * @returns {reason is UpgradeDisconnection}
46
46
  */
47
47
  export const isUpgradeDisconnection = reason =>
48
- isFrozen(reason) && matches(reason, UpgradeDisconnectionShape);
48
+ reason != null && // eslint-disable-line eqeqeq
49
+ isFrozen(reason) &&
50
+ matches(reason, UpgradeDisconnectionShape);
49
51
  harden(isUpgradeDisconnection);
52
+
53
+ /**
54
+ * Returns whether a reason is a 'vat terminated' error generated when an object
55
+ * is abandoned by a vat during an upgrade.
56
+ *
57
+ * Normally we do not want to rely on the `message` of an error object, but this
58
+ * is a pragmatic solution to the current state of vat upgrade errors. In the
59
+ * future we'd prefer having an error with a cause referencing a disconnection
60
+ * object like for promise rejections. See
61
+ * https://github.com/Agoric/agoric-sdk/issues/9582
62
+ *
63
+ * @param {any} reason
64
+ * @returns {reason is Error}
65
+ */
66
+ export const isAbandonedError = reason =>
67
+ reason != null && // eslint-disable-line eqeqeq
68
+ isFrozen(reason) &&
69
+ matches(reason, M.error()) &&
70
+ // We're not using a constant here since this special value is already
71
+ // sprinkled throughout the SDK
72
+ reason.message === 'vat terminated';
73
+ harden(isAbandonedError);