@agoric/swingset-liveslots 0.10.3-dev-1eed398.0 → 0.10.3-dev-20dd848.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 +5 -5
- package/src/vatDataTypes.d.ts +29 -5
- package/src/virtualObjectManager.js +34 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/swingset-liveslots",
|
|
3
|
-
"version": "0.10.3-dev-
|
|
3
|
+
"version": "0.10.3-dev-20dd848.0+20dd848",
|
|
4
4
|
"description": "SwingSet ocap support layer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"lint:eslint": "eslint ."
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@agoric/assert": "0.6.1-dev-
|
|
21
|
-
"@agoric/internal": "0.3.3-dev-
|
|
22
|
-
"@agoric/store": "0.9.3-dev-
|
|
20
|
+
"@agoric/assert": "0.6.1-dev-20dd848.0+20dd848",
|
|
21
|
+
"@agoric/internal": "0.3.3-dev-20dd848.0+20dd848",
|
|
22
|
+
"@agoric/store": "0.9.3-dev-20dd848.0+20dd848",
|
|
23
23
|
"@endo/eventual-send": "^0.17.3",
|
|
24
24
|
"@endo/exo": "^0.2.3",
|
|
25
25
|
"@endo/far": "^0.2.19",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "20dd84862b8d625d0fe5c935c307b9762a347df9"
|
|
67
67
|
}
|
package/src/vatDataTypes.d.ts
CHANGED
|
@@ -5,16 +5,19 @@
|
|
|
5
5
|
* Behavior is a description when defining a kind of what facets it will have.
|
|
6
6
|
* For the non-multi defineKind, there is just one facet so it doesn't have a key.
|
|
7
7
|
*/
|
|
8
|
+
import type { InterfaceGuard, Pattern } from '@endo/patterns';
|
|
8
9
|
import type {
|
|
9
|
-
InterfaceGuard,
|
|
10
10
|
MapStore,
|
|
11
|
-
Pattern,
|
|
12
11
|
SetStore,
|
|
13
12
|
StoreOptions,
|
|
14
13
|
WeakMapStore,
|
|
15
14
|
WeakSetStore,
|
|
16
15
|
} from '@agoric/store';
|
|
17
16
|
|
|
17
|
+
// TODO should be moved into @endo/patterns and eventually imported here
|
|
18
|
+
// instead of this local definition.
|
|
19
|
+
export type InterfaceGuardKit = Record<string, InterfaceGuard>;
|
|
20
|
+
|
|
18
21
|
export type { MapStore, Pattern };
|
|
19
22
|
|
|
20
23
|
// This needs `any` values. If they were `unknown`, code that uses Baggage
|
|
@@ -97,15 +100,36 @@ export type DefineKindOptions<C> = {
|
|
|
97
100
|
|
|
98
101
|
/**
|
|
99
102
|
* Intended for internal use only.
|
|
103
|
+
* Only applicable if this is a class kind. A class kit kind should use
|
|
104
|
+
* `interfaceGuardKit` instead.
|
|
105
|
+
*
|
|
100
106
|
* If an `interfaceGuard` is provided, then the raw methods passed alongside
|
|
101
107
|
* it are wrapped by a function that first checks that this method's guard
|
|
102
108
|
* pattern is satisfied before calling the raw method.
|
|
103
109
|
*
|
|
104
|
-
* In `defineDurableKind` and its siblings, this defaults to
|
|
105
|
-
*
|
|
110
|
+
* In `defineDurableKind` and its siblings, this defaults to `undefined`.
|
|
111
|
+
* Exo classes use this internally to protect their raw class methods
|
|
106
112
|
* using the provided interface.
|
|
113
|
+
* In absence, an exo is protected anyway, while a bare kind is
|
|
114
|
+
* not (detected by `!thisfulMethods`),
|
|
115
|
+
*/
|
|
116
|
+
interfaceGuard?: InterfaceGuard;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Intended for internal use only.
|
|
120
|
+
* Only applicable if this is a class kit kind. A class kind should use
|
|
121
|
+
* `interfaceGuard` instead.
|
|
122
|
+
*
|
|
123
|
+
* If an `interfaceGuardKit` is provided, then each member of the
|
|
124
|
+
* interfaceGuardKit is used to guard the corresponding facet of the
|
|
125
|
+
* class kit.
|
|
126
|
+
*
|
|
127
|
+
* In `defineDurableKindMulti` and its siblings, this defaults to `undefined`.
|
|
128
|
+
* Exo class kits use this internally to protect their facets.
|
|
129
|
+
* In absence, an exo is protected anyway, while a bare kind is
|
|
130
|
+
* not (detected by `!thisfulMethods`),
|
|
107
131
|
*/
|
|
108
|
-
|
|
132
|
+
interfaceGuardKit?: InterfaceGuardKit;
|
|
109
133
|
};
|
|
110
134
|
|
|
111
135
|
export type VatData = {
|
|
@@ -718,7 +718,13 @@ export const makeVirtualObjectManager = (
|
|
|
718
718
|
finish = undefined,
|
|
719
719
|
stateShape = undefined,
|
|
720
720
|
thisfulMethods = false,
|
|
721
|
+
} = options;
|
|
722
|
+
let {
|
|
723
|
+
// These are "let" rather than "const" only to accommodate code
|
|
724
|
+
// below that tolerates an old version of the vat-data package.
|
|
725
|
+
// See there for more explanation.
|
|
721
726
|
interfaceGuard = undefined,
|
|
727
|
+
interfaceGuardKit = undefined,
|
|
722
728
|
} = options;
|
|
723
729
|
|
|
724
730
|
const statePrototype = {}; // Not frozen yet
|
|
@@ -739,11 +745,38 @@ export const makeVirtualObjectManager = (
|
|
|
739
745
|
switch (assessFacetiousness(behavior)) {
|
|
740
746
|
case 'one': {
|
|
741
747
|
assert(!multifaceted);
|
|
748
|
+
interfaceGuardKit === undefined ||
|
|
749
|
+
Fail`Use an interfaceGuard, not interfaceGuardKit, to protect class ${q(
|
|
750
|
+
tag,
|
|
751
|
+
)}`;
|
|
742
752
|
proposedFacetNames = undefined;
|
|
743
753
|
break;
|
|
744
754
|
}
|
|
745
755
|
case 'many': {
|
|
746
756
|
assert(multifaceted);
|
|
757
|
+
|
|
758
|
+
if (interfaceGuard && interfaceGuardKit === undefined) {
|
|
759
|
+
// This if clause is for the purpose of tolerating versions
|
|
760
|
+
// of the vata-data package that precede
|
|
761
|
+
// https://github.com/Agoric/agoric-sdk/pull/8220 .
|
|
762
|
+
// Before that PR, the options name `interfaceGuard` would
|
|
763
|
+
// actually carry the InterfaceGuardKit.
|
|
764
|
+
//
|
|
765
|
+
// Tolerating the old vat-data with the new types.
|
|
766
|
+
// at-expect-error here causes inconsistent reports, so
|
|
767
|
+
// doing the at-ts-ignore-error ritual instead.
|
|
768
|
+
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
|
|
769
|
+
// @ts-ignore
|
|
770
|
+
interfaceGuardKit = interfaceGuard;
|
|
771
|
+
interfaceGuard = undefined;
|
|
772
|
+
// The rest of the code from here makes no further compromise
|
|
773
|
+
// for that old version of the vat-data package.
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
interfaceGuard === undefined ||
|
|
777
|
+
Fail`Use an interfaceGuardKit, not an interfaceGuard, to protect class kit ${q(
|
|
778
|
+
tag,
|
|
779
|
+
)}`;
|
|
747
780
|
proposedFacetNames = ownKeys(behavior).sort();
|
|
748
781
|
break;
|
|
749
782
|
}
|
|
@@ -954,7 +987,7 @@ export const makeVirtualObjectManager = (
|
|
|
954
987
|
makeContextProviderKit(contextCache, getSlotForVal, facetNames),
|
|
955
988
|
behavior,
|
|
956
989
|
thisfulMethods,
|
|
957
|
-
|
|
990
|
+
interfaceGuardKit,
|
|
958
991
|
);
|
|
959
992
|
} else {
|
|
960
993
|
proto = defendPrototype(
|