@agoric/swingset-liveslots 0.10.3-dev-89a3a85.0 → 0.10.3-dev-1289bc4.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 +10 -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-1289bc4.0+1289bc4",
|
|
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-1289bc4.0+1289bc4",
|
|
21
|
+
"@agoric/internal": "0.3.3-dev-1289bc4.0+1289bc4",
|
|
22
|
+
"@agoric/store": "0.9.3-dev-1289bc4.0+1289bc4",
|
|
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": "1289bc442ba74598fe765ab151031dda13327ec0"
|
|
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 = {
|
|
@@ -719,6 +719,7 @@ export const makeVirtualObjectManager = (
|
|
|
719
719
|
stateShape = undefined,
|
|
720
720
|
thisfulMethods = false,
|
|
721
721
|
interfaceGuard = undefined,
|
|
722
|
+
interfaceGuardKit = undefined,
|
|
722
723
|
} = options;
|
|
723
724
|
|
|
724
725
|
const statePrototype = {}; // Not frozen yet
|
|
@@ -739,11 +740,19 @@ export const makeVirtualObjectManager = (
|
|
|
739
740
|
switch (assessFacetiousness(behavior)) {
|
|
740
741
|
case 'one': {
|
|
741
742
|
assert(!multifaceted);
|
|
743
|
+
interfaceGuardKit === undefined ||
|
|
744
|
+
Fail`Use an interfaceGuard, not interfaceGuardKit, to protect class ${q(
|
|
745
|
+
tag,
|
|
746
|
+
)}`;
|
|
742
747
|
proposedFacetNames = undefined;
|
|
743
748
|
break;
|
|
744
749
|
}
|
|
745
750
|
case 'many': {
|
|
746
751
|
assert(multifaceted);
|
|
752
|
+
interfaceGuard === undefined ||
|
|
753
|
+
Fail`Use an interfaceGuardKit, not an interfaceGuard, to protect class kit ${q(
|
|
754
|
+
tag,
|
|
755
|
+
)}`;
|
|
747
756
|
proposedFacetNames = ownKeys(behavior).sort();
|
|
748
757
|
break;
|
|
749
758
|
}
|
|
@@ -954,7 +963,7 @@ export const makeVirtualObjectManager = (
|
|
|
954
963
|
makeContextProviderKit(contextCache, getSlotForVal, facetNames),
|
|
955
964
|
behavior,
|
|
956
965
|
thisfulMethods,
|
|
957
|
-
|
|
966
|
+
interfaceGuardKit,
|
|
958
967
|
);
|
|
959
968
|
} else {
|
|
960
969
|
proto = defendPrototype(
|