@agoric/swingset-liveslots 0.10.3-u18.1 → 0.10.3-u19.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 +22 -22
- package/src/boyd-gc.d.ts +12 -0
- package/src/boyd-gc.d.ts.map +1 -0
- package/src/cache.d.ts +71 -0
- package/src/cache.d.ts.map +1 -0
- package/src/capdata.d.ts +12 -0
- package/src/capdata.d.ts.map +1 -0
- package/src/collectionManager.d.ts +46 -0
- package/src/collectionManager.d.ts.map +1 -0
- package/src/facetiousness.d.ts +25 -0
- package/src/facetiousness.d.ts.map +1 -0
- package/src/index.d.ts +4 -0
- package/src/index.d.ts.map +1 -0
- package/src/kdebug.d.ts +7 -0
- package/src/kdebug.d.ts.map +1 -0
- package/src/liveslots.d.ts +42 -0
- package/src/liveslots.d.ts.map +1 -0
- package/src/liveslots.js +4 -2
- package/src/message.d.ts +45 -0
- package/src/message.d.ts.map +1 -0
- package/src/parseVatSlots.d.ts +125 -0
- package/src/parseVatSlots.d.ts.map +1 -0
- package/src/types.d.ts +76 -0
- package/src/types.d.ts.map +1 -0
- package/src/vatDataTypes.d.ts +170 -0
- package/src/vatDataTypes.d.ts.map +1 -0
- package/src/vatDataTypes.ts +272 -0
- package/src/vatstore-iterators.d.ts +4 -0
- package/src/vatstore-iterators.d.ts.map +1 -0
- package/src/vatstore-usage.md +197 -0
- package/src/virtualObjectManager.d.ts +44 -0
- package/src/virtualObjectManager.d.ts.map +1 -0
- package/src/virtualReferences.d.ts +61 -0
- package/src/virtualReferences.d.ts.map +1 -0
- package/src/vpid-tracking.md +92 -0
- package/src/watchedPromises.d.ts +31 -0
- package/src/watchedPromises.d.ts.map +1 -0
- package/test/dummyMeterControl.d.ts +2 -0
- package/test/dummyMeterControl.d.ts.map +1 -0
- package/test/engine-gc.d.ts +3 -0
- package/test/engine-gc.d.ts.map +1 -0
- package/test/gc-and-finalize.d.ts +5 -0
- package/test/gc-and-finalize.d.ts.map +1 -0
- package/test/liveslots-helpers.d.ts +63 -0
- package/test/liveslots-helpers.d.ts.map +1 -0
- package/test/liveslots-real-gc.test.js +9 -7
- package/test/util.d.ts +25 -0
- package/test/util.d.ts.map +1 -0
- package/test/vat-util.d.ts +9 -0
- package/test/vat-util.d.ts.map +1 -0
- package/test/waitUntilQuiescent.d.ts +3 -0
- package/test/waitUntilQuiescent.d.ts.map +1 -0
- package/tools/fakeCollectionManager.d.ts +14 -0
- package/tools/fakeCollectionManager.d.ts.map +1 -0
- package/tools/fakeVirtualObjectManager.d.ts +32 -0
- package/tools/fakeVirtualObjectManager.d.ts.map +1 -0
- package/tools/fakeVirtualSupport.d.ts +278 -0
- package/tools/fakeVirtualSupport.d.ts.map +1 -0
- package/tools/prepare-strict-test-env.d.ts +37 -0
- package/tools/prepare-strict-test-env.d.ts.map +1 -0
- package/tools/prepare-test-env.d.ts +2 -0
- package/tools/prepare-test-env.d.ts.map +1 -0
- package/tools/setup-vat-data.d.ts +9 -0
- package/tools/setup-vat-data.d.ts.map +1 -0
- package/tools/vo-test-harness.d.ts +2 -0
- package/tools/vo-test-harness.d.ts.map +1 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Types for vat-data
|
|
3
|
+
*
|
|
4
|
+
* Facet is a single object with methods.
|
|
5
|
+
* Behavior is a description when defining a kind of what facets it will have.
|
|
6
|
+
* For the non-multi defineKind, there is just one facet so it doesn't have a key.
|
|
7
|
+
*/
|
|
8
|
+
import type { MapStore, SetStore, StoreOptions, WeakMapStore, WeakSetStore } from '@agoric/store';
|
|
9
|
+
import type { Amplify, IsInstance, ReceivePower, StateShape } from '@endo/exo';
|
|
10
|
+
import type { RemotableObject } from '@endo/pass-style';
|
|
11
|
+
import type { RemotableBrand } from '@endo/eventual-send';
|
|
12
|
+
import type { InterfaceGuard, Pattern } from '@endo/patterns';
|
|
13
|
+
import type { makeWatchedPromiseManager } from './watchedPromises.js';
|
|
14
|
+
export type InterfaceGuardKit = Record<string, InterfaceGuard>;
|
|
15
|
+
export type { MapStore, Pattern };
|
|
16
|
+
export type Baggage = MapStore<string, any>;
|
|
17
|
+
type WatchedPromisesManager = ReturnType<typeof makeWatchedPromiseManager>;
|
|
18
|
+
type OmitFirstArg<F> = F extends (x: any, ...args: infer P) => infer R ? (...args: P) => R : never;
|
|
19
|
+
type PrimaryRemotable<O> = O & RemotableObject & RemotableBrand<object, O>;
|
|
20
|
+
export type KindFacet<O> = PrimaryRemotable<{
|
|
21
|
+
[K in keyof O]: OmitFirstArg<O[K]>;
|
|
22
|
+
}>;
|
|
23
|
+
export type KindFacets<B> = {
|
|
24
|
+
[FacetKey in keyof B]: KindFacet<B[FacetKey]>;
|
|
25
|
+
};
|
|
26
|
+
export type KindContext<S, F> = {
|
|
27
|
+
state: S;
|
|
28
|
+
self: KindFacet<F>;
|
|
29
|
+
};
|
|
30
|
+
export type MultiKindContext<S, B> = {
|
|
31
|
+
state: S;
|
|
32
|
+
facets: KindFacets<B>;
|
|
33
|
+
};
|
|
34
|
+
export type PlusContext<C, M extends (...args: any[]) => any> = (c: C, ...args: Parameters<M>) => ReturnType<M>;
|
|
35
|
+
export type FunctionsPlusContext<C, O extends Record<string, (...args: any[]) => any>> = {
|
|
36
|
+
[K in keyof O]: PlusContext<C, O[K]>;
|
|
37
|
+
};
|
|
38
|
+
declare class DurableKindHandleClass {
|
|
39
|
+
private descriptionTag;
|
|
40
|
+
}
|
|
41
|
+
export type DurableKindHandle = DurableKindHandleClass;
|
|
42
|
+
/**
|
|
43
|
+
* Grab bag of options that can be provided to `defineDurableKind` and its
|
|
44
|
+
* siblings. Not all options are meaningful in all contexts. See the
|
|
45
|
+
* doc-comments on each option.
|
|
46
|
+
*/
|
|
47
|
+
export type DefineKindOptions<C> = {
|
|
48
|
+
/**
|
|
49
|
+
* If provided, the `finish` function will be called after the instance is
|
|
50
|
+
* made and internally registered, but before it is returned. The finish
|
|
51
|
+
* function is to do any post-intantiation initialization that should be
|
|
52
|
+
* done before exposing the object to its clients.
|
|
53
|
+
*/
|
|
54
|
+
finish?: (context: C) => void;
|
|
55
|
+
/**
|
|
56
|
+
* If provided, it describes the shape of all state records of instances
|
|
57
|
+
* of this kind.
|
|
58
|
+
*/
|
|
59
|
+
stateShape?: StateShape;
|
|
60
|
+
/**
|
|
61
|
+
* If a `receiveAmplifier` function is provided to an exo class kit definition,
|
|
62
|
+
* it will be called with an `Amplify` function. If provided to the definition
|
|
63
|
+
* of a normal exo or exo class, the definition will throw, since only
|
|
64
|
+
* exo kits can be amplified.
|
|
65
|
+
* An `Amplify` function is a function that takes a facet instance of
|
|
66
|
+
* this class kit as an argument, in which case it will return the facets
|
|
67
|
+
* record, giving access to all the facet instances of the same cohort.
|
|
68
|
+
*/
|
|
69
|
+
receiveAmplifier?: ReceivePower<Amplify>;
|
|
70
|
+
/**
|
|
71
|
+
* If a `receiveInstanceTester` function is provided, it will be called
|
|
72
|
+
* during the definition of the exo class or exo class kit with an
|
|
73
|
+
* `IsInstance` function. The first argument of `IsInstance`
|
|
74
|
+
* is the value to be tested. When it may be a facet instance of an
|
|
75
|
+
* exo class kit, the optional second argument, if provided, is
|
|
76
|
+
* a `facetName`. In that case, the function tests only if the first
|
|
77
|
+
* argument is an instance of that facet of the associated exo class kit.
|
|
78
|
+
*/
|
|
79
|
+
receiveInstanceTester?: ReceivePower<IsInstance>;
|
|
80
|
+
/**
|
|
81
|
+
* As a kind option, intended for internal use only.
|
|
82
|
+
* Meaningful to `makeScalarBigMapStore` and its siblings. These maker
|
|
83
|
+
* fuctions will make either virtual or durable stores, depending on
|
|
84
|
+
* this flag. Defaults to off, making virtual but not durable collections.
|
|
85
|
+
*
|
|
86
|
+
* Generally, durable collections are provided with `provideDurableMapStore`
|
|
87
|
+
* and its sibling, which use this flag internally. If you do not make
|
|
88
|
+
* durable collections by other means, you can consider this as
|
|
89
|
+
* intended for internal use only.
|
|
90
|
+
*/
|
|
91
|
+
durable?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Intended for internal use only.
|
|
94
|
+
* Should the raw methods receive their `context` argument as their first
|
|
95
|
+
* argument or as their `this` binding? For `defineDurableKind` and its
|
|
96
|
+
* siblings (including `prepareSingleton`), this defaults to off, meaning that
|
|
97
|
+
* their behavior methods receive `context` as their first argument.
|
|
98
|
+
* `prepareExoClass` and its siblings (including `prepareExo`) use
|
|
99
|
+
* this flag internally to indicate that their methods receive `context`
|
|
100
|
+
* as their `this` binding.
|
|
101
|
+
*/
|
|
102
|
+
thisfulMethods?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Intended for internal use only.
|
|
105
|
+
* Only applicable if this is a class kind. A class kit kind should use
|
|
106
|
+
* `interfaceGuardKit` instead.
|
|
107
|
+
*
|
|
108
|
+
* If an `interfaceGuard` is provided, then the raw methods passed alongside
|
|
109
|
+
* it are wrapped by a function that first checks that this method's guard
|
|
110
|
+
* pattern is satisfied before calling the raw method.
|
|
111
|
+
*
|
|
112
|
+
* In `defineDurableKind` and its siblings, this defaults to `undefined`.
|
|
113
|
+
* Exo classes use this internally to protect their raw class methods
|
|
114
|
+
* using the provided interface.
|
|
115
|
+
* In absence, an exo is protected anyway, while a bare kind is
|
|
116
|
+
* not (detected by `!thisfulMethods`),
|
|
117
|
+
*/
|
|
118
|
+
interfaceGuard?: InterfaceGuard;
|
|
119
|
+
/**
|
|
120
|
+
* Intended for internal use only.
|
|
121
|
+
* Only applicable if this is a class kit kind. A class kind should use
|
|
122
|
+
* `interfaceGuard` instead.
|
|
123
|
+
*
|
|
124
|
+
* If an `interfaceGuardKit` is provided, then each member of the
|
|
125
|
+
* interfaceGuardKit is used to guard the corresponding facet of the
|
|
126
|
+
* class kit.
|
|
127
|
+
*
|
|
128
|
+
* In `defineDurableKindMulti` and its siblings, this defaults to `undefined`.
|
|
129
|
+
* Exo class kits use this internally to protect their facets.
|
|
130
|
+
* In absence, an exo is protected anyway, while a bare kind is
|
|
131
|
+
* not (detected by `!thisfulMethods`),
|
|
132
|
+
*/
|
|
133
|
+
interfaceGuardKit?: InterfaceGuardKit;
|
|
134
|
+
};
|
|
135
|
+
export type VatData = {
|
|
136
|
+
/** @deprecated Use defineVirtualExoClass instead */
|
|
137
|
+
defineKind: <P extends Array<any>, S, F>(tag: string, init: (...args: P) => S, facet: F, options?: DefineKindOptions<KindContext<S, F>>) => (...args: P) => KindFacet<F>;
|
|
138
|
+
/** @deprecated Use defineVirtualExoClassKit instead */
|
|
139
|
+
defineKindMulti: <P extends Array<any>, S, B>(tag: string, init: (...args: P) => S, behavior: B, options?: DefineKindOptions<MultiKindContext<S, B>>) => (...args: P) => KindFacets<B>;
|
|
140
|
+
makeKindHandle: (descriptionTag: string) => DurableKindHandle;
|
|
141
|
+
/** @deprecated Use defineDurableExoClass instead */
|
|
142
|
+
defineDurableKind: <P extends Array<any>, S, F>(kindHandle: DurableKindHandle, init: (...args: P) => S, facet: F, options?: DefineKindOptions<KindContext<S, F>>) => (...args: P) => KindFacet<F>;
|
|
143
|
+
/** @deprecated Use defineDurableExoClassKit instead */
|
|
144
|
+
defineDurableKindMulti: <P extends Array<any>, S, B>(kindHandle: DurableKindHandle, init: (...args: P) => S, behavior: B, options?: DefineKindOptions<MultiKindContext<S, B>>) => (...args: P) => KindFacets<B>;
|
|
145
|
+
providePromiseWatcher: WatchedPromisesManager['providePromiseWatcher'];
|
|
146
|
+
watchPromise: WatchedPromisesManager['watchPromise'];
|
|
147
|
+
makeScalarBigMapStore: <K, V>(label: string, options?: StoreOptions) => MapStore<K, V>;
|
|
148
|
+
makeScalarBigWeakMapStore: <K, V>(label: string, options?: StoreOptions) => WeakMapStore<K, V>;
|
|
149
|
+
makeScalarBigSetStore: <K>(label: string, options?: StoreOptions) => SetStore<K>;
|
|
150
|
+
makeScalarBigWeakSetStore: <K>(label: string, options?: StoreOptions) => WeakSetStore<K>;
|
|
151
|
+
canBeDurable: (specimen: unknown) => boolean;
|
|
152
|
+
};
|
|
153
|
+
export interface PickFacet {
|
|
154
|
+
/**
|
|
155
|
+
* When making a multi-facet kind, it's common to pick one facet to
|
|
156
|
+
* expose. E.g.,
|
|
157
|
+
*
|
|
158
|
+
* const makeFoo = (a, b, c, d) => makeFooBase(a, b, c, d).self;
|
|
159
|
+
*
|
|
160
|
+
* This helper reduces the duplication:
|
|
161
|
+
*
|
|
162
|
+
* const makeFoo = pickFacet(makeFooBase, 'self');
|
|
163
|
+
*/
|
|
164
|
+
<M extends (...args: any[]) => any, F extends keyof ReturnType<M>>(maker: M, facetName: F): (...args: Parameters<M>) => ReturnType<M>[F];
|
|
165
|
+
}
|
|
166
|
+
/** @deprecated Use prepareExoClass instead */
|
|
167
|
+
export type PrepareKind = <P extends Array<any>, S, F>(baggage: Baggage, tag: string, init: (...args: P) => S, facet: F, options?: DefineKindOptions<KindContext<S, F>>) => (...args: P) => KindFacet<F>;
|
|
168
|
+
/** @deprecated Use prepareExoClassKit instead */
|
|
169
|
+
export type PrepareKindMulti = <P extends Array<any>, S, B>(baggage: Baggage, tag: string, init: (...args: P) => S, behavior: B, options?: DefineKindOptions<MultiKindContext<S, B>>) => (...args: P) => KindFacets<B>;
|
|
170
|
+
//# sourceMappingURL=vatDataTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vatDataTypes.d.ts","sourceRoot":"","sources":["vatDataTypes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;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U,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACjD;AAED,8CAA8C;AAC9C,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EACnD,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,EACvB,KAAK,EAAE,CAAC,EACR,OAAO,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAC3C,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC;AAElC,iDAAiD;AACjD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EACxD,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,EACvB,QAAQ,EAAE,CAAC,EACX,OAAO,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAChD,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Types for vat-data
|
|
3
|
+
*
|
|
4
|
+
* Facet is a single object with methods.
|
|
5
|
+
* Behavior is a description when defining a kind of what facets it will have.
|
|
6
|
+
* For the non-multi defineKind, there is just one facet so it doesn't have a key.
|
|
7
|
+
*/
|
|
8
|
+
import type {
|
|
9
|
+
MapStore,
|
|
10
|
+
SetStore,
|
|
11
|
+
StoreOptions,
|
|
12
|
+
WeakMapStore,
|
|
13
|
+
WeakSetStore,
|
|
14
|
+
} from '@agoric/store';
|
|
15
|
+
import type { Amplify, IsInstance, ReceivePower, StateShape } from '@endo/exo';
|
|
16
|
+
import type { RemotableObject } from '@endo/pass-style';
|
|
17
|
+
import type { RemotableBrand } from '@endo/eventual-send';
|
|
18
|
+
import type { InterfaceGuard, Pattern } from '@endo/patterns';
|
|
19
|
+
import type { makeWatchedPromiseManager } from './watchedPromises.js';
|
|
20
|
+
|
|
21
|
+
// TODO should be moved into @endo/patterns and eventually imported here
|
|
22
|
+
// instead of this local definition.
|
|
23
|
+
export type InterfaceGuardKit = Record<string, InterfaceGuard>;
|
|
24
|
+
export type { MapStore, Pattern };
|
|
25
|
+
|
|
26
|
+
// This needs `any` values. If they were `unknown`, code that uses Baggage
|
|
27
|
+
// would need explicit runtime checks or casts for every fetch, which is
|
|
28
|
+
// onerous.
|
|
29
|
+
export type Baggage = MapStore<string, any>;
|
|
30
|
+
|
|
31
|
+
type WatchedPromisesManager = ReturnType<typeof makeWatchedPromiseManager>;
|
|
32
|
+
|
|
33
|
+
// used to omit the 'context' parameter
|
|
34
|
+
type OmitFirstArg<F> = F extends (x: any, ...args: infer P) => infer R
|
|
35
|
+
? (...args: P) => R
|
|
36
|
+
: never;
|
|
37
|
+
|
|
38
|
+
// The type of a passable local object with methods.
|
|
39
|
+
// An internal helper to avoid having to repeat `O`.
|
|
40
|
+
type PrimaryRemotable<O> = O & RemotableObject & RemotableBrand<object, O>;
|
|
41
|
+
|
|
42
|
+
export type KindFacet<O> = PrimaryRemotable<{
|
|
43
|
+
[K in keyof O]: OmitFirstArg<O[K]>; // omit the 'context' parameter
|
|
44
|
+
}>;
|
|
45
|
+
|
|
46
|
+
export type KindFacets<B> = {
|
|
47
|
+
[FacetKey in keyof B]: KindFacet<B[FacetKey]>;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type KindContext<S, F> = { state: S; self: KindFacet<F> };
|
|
51
|
+
export type MultiKindContext<S, B> = { state: S; facets: KindFacets<B> };
|
|
52
|
+
|
|
53
|
+
export type PlusContext<C, M extends (...args: any[]) => any> = (
|
|
54
|
+
c: C,
|
|
55
|
+
...args: Parameters<M>
|
|
56
|
+
) => ReturnType<M>;
|
|
57
|
+
|
|
58
|
+
export type FunctionsPlusContext<
|
|
59
|
+
C,
|
|
60
|
+
O extends Record<string, (...args: any[]) => any>,
|
|
61
|
+
> = {
|
|
62
|
+
[K in keyof O]: PlusContext<C, O[K]>;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
declare class DurableKindHandleClass {
|
|
66
|
+
private descriptionTag: string;
|
|
67
|
+
}
|
|
68
|
+
export type DurableKindHandle = DurableKindHandleClass;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Grab bag of options that can be provided to `defineDurableKind` and its
|
|
72
|
+
* siblings. Not all options are meaningful in all contexts. See the
|
|
73
|
+
* doc-comments on each option.
|
|
74
|
+
*/
|
|
75
|
+
export type DefineKindOptions<C> = {
|
|
76
|
+
/**
|
|
77
|
+
* If provided, the `finish` function will be called after the instance is
|
|
78
|
+
* made and internally registered, but before it is returned. The finish
|
|
79
|
+
* function is to do any post-intantiation initialization that should be
|
|
80
|
+
* done before exposing the object to its clients.
|
|
81
|
+
*/
|
|
82
|
+
finish?: (context: C) => void;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* If provided, it describes the shape of all state records of instances
|
|
86
|
+
* of this kind.
|
|
87
|
+
*/
|
|
88
|
+
stateShape?: StateShape;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* If a `receiveAmplifier` function is provided to an exo class kit definition,
|
|
92
|
+
* it will be called with an `Amplify` function. If provided to the definition
|
|
93
|
+
* of a normal exo or exo class, the definition will throw, since only
|
|
94
|
+
* exo kits can be amplified.
|
|
95
|
+
* An `Amplify` function is a function that takes a facet instance of
|
|
96
|
+
* this class kit as an argument, in which case it will return the facets
|
|
97
|
+
* record, giving access to all the facet instances of the same cohort.
|
|
98
|
+
*/
|
|
99
|
+
receiveAmplifier?: ReceivePower<Amplify>;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* If a `receiveInstanceTester` function is provided, it will be called
|
|
103
|
+
* during the definition of the exo class or exo class kit with an
|
|
104
|
+
* `IsInstance` function. The first argument of `IsInstance`
|
|
105
|
+
* is the value to be tested. When it may be a facet instance of an
|
|
106
|
+
* exo class kit, the optional second argument, if provided, is
|
|
107
|
+
* a `facetName`. In that case, the function tests only if the first
|
|
108
|
+
* argument is an instance of that facet of the associated exo class kit.
|
|
109
|
+
*/
|
|
110
|
+
receiveInstanceTester?: ReceivePower<IsInstance>;
|
|
111
|
+
|
|
112
|
+
// TODO properties above are identical to those in FarClassOptions.
|
|
113
|
+
// These are the only options that should be exposed by
|
|
114
|
+
// vat-data's public virtual/durable exo APIs. This DefineKindOptions
|
|
115
|
+
// should explicitly be a subtype, where the methods below are only for
|
|
116
|
+
// internal use, i.e., below the exo level.
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* As a kind option, intended for internal use only.
|
|
120
|
+
* Meaningful to `makeScalarBigMapStore` and its siblings. These maker
|
|
121
|
+
* fuctions will make either virtual or durable stores, depending on
|
|
122
|
+
* this flag. Defaults to off, making virtual but not durable collections.
|
|
123
|
+
*
|
|
124
|
+
* Generally, durable collections are provided with `provideDurableMapStore`
|
|
125
|
+
* and its sibling, which use this flag internally. If you do not make
|
|
126
|
+
* durable collections by other means, you can consider this as
|
|
127
|
+
* intended for internal use only.
|
|
128
|
+
*/
|
|
129
|
+
durable?: boolean;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Intended for internal use only.
|
|
133
|
+
* Should the raw methods receive their `context` argument as their first
|
|
134
|
+
* argument or as their `this` binding? For `defineDurableKind` and its
|
|
135
|
+
* siblings (including `prepareSingleton`), this defaults to off, meaning that
|
|
136
|
+
* their behavior methods receive `context` as their first argument.
|
|
137
|
+
* `prepareExoClass` and its siblings (including `prepareExo`) use
|
|
138
|
+
* this flag internally to indicate that their methods receive `context`
|
|
139
|
+
* as their `this` binding.
|
|
140
|
+
*/
|
|
141
|
+
thisfulMethods?: boolean;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Intended for internal use only.
|
|
145
|
+
* Only applicable if this is a class kind. A class kit kind should use
|
|
146
|
+
* `interfaceGuardKit` instead.
|
|
147
|
+
*
|
|
148
|
+
* If an `interfaceGuard` is provided, then the raw methods passed alongside
|
|
149
|
+
* it are wrapped by a function that first checks that this method's guard
|
|
150
|
+
* pattern is satisfied before calling the raw method.
|
|
151
|
+
*
|
|
152
|
+
* In `defineDurableKind` and its siblings, this defaults to `undefined`.
|
|
153
|
+
* Exo classes use this internally to protect their raw class methods
|
|
154
|
+
* using the provided interface.
|
|
155
|
+
* In absence, an exo is protected anyway, while a bare kind is
|
|
156
|
+
* not (detected by `!thisfulMethods`),
|
|
157
|
+
*/
|
|
158
|
+
interfaceGuard?: InterfaceGuard;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Intended for internal use only.
|
|
162
|
+
* Only applicable if this is a class kit kind. A class kind should use
|
|
163
|
+
* `interfaceGuard` instead.
|
|
164
|
+
*
|
|
165
|
+
* If an `interfaceGuardKit` is provided, then each member of the
|
|
166
|
+
* interfaceGuardKit is used to guard the corresponding facet of the
|
|
167
|
+
* class kit.
|
|
168
|
+
*
|
|
169
|
+
* In `defineDurableKindMulti` and its siblings, this defaults to `undefined`.
|
|
170
|
+
* Exo class kits use this internally to protect their facets.
|
|
171
|
+
* In absence, an exo is protected anyway, while a bare kind is
|
|
172
|
+
* not (detected by `!thisfulMethods`),
|
|
173
|
+
*/
|
|
174
|
+
interfaceGuardKit?: InterfaceGuardKit;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export type VatData = {
|
|
178
|
+
// virtual kinds
|
|
179
|
+
/** @deprecated Use defineVirtualExoClass instead */
|
|
180
|
+
defineKind: <P extends Array<any>, S, F>(
|
|
181
|
+
tag: string,
|
|
182
|
+
init: (...args: P) => S,
|
|
183
|
+
facet: F,
|
|
184
|
+
options?: DefineKindOptions<KindContext<S, F>>,
|
|
185
|
+
) => (...args: P) => KindFacet<F>;
|
|
186
|
+
|
|
187
|
+
/** @deprecated Use defineVirtualExoClassKit instead */
|
|
188
|
+
defineKindMulti: <P extends Array<any>, S, B>(
|
|
189
|
+
tag: string,
|
|
190
|
+
init: (...args: P) => S,
|
|
191
|
+
behavior: B,
|
|
192
|
+
options?: DefineKindOptions<MultiKindContext<S, B>>,
|
|
193
|
+
) => (...args: P) => KindFacets<B>;
|
|
194
|
+
|
|
195
|
+
// durable kinds
|
|
196
|
+
makeKindHandle: (descriptionTag: string) => DurableKindHandle;
|
|
197
|
+
|
|
198
|
+
/** @deprecated Use defineDurableExoClass instead */
|
|
199
|
+
defineDurableKind: <P extends Array<any>, S, F>(
|
|
200
|
+
kindHandle: DurableKindHandle,
|
|
201
|
+
init: (...args: P) => S,
|
|
202
|
+
facet: F,
|
|
203
|
+
options?: DefineKindOptions<KindContext<S, F>>,
|
|
204
|
+
) => (...args: P) => KindFacet<F>;
|
|
205
|
+
|
|
206
|
+
/** @deprecated Use defineDurableExoClassKit instead */
|
|
207
|
+
defineDurableKindMulti: <P extends Array<any>, S, B>(
|
|
208
|
+
kindHandle: DurableKindHandle,
|
|
209
|
+
init: (...args: P) => S,
|
|
210
|
+
behavior: B,
|
|
211
|
+
options?: DefineKindOptions<MultiKindContext<S, B>>,
|
|
212
|
+
) => (...args: P) => KindFacets<B>;
|
|
213
|
+
|
|
214
|
+
providePromiseWatcher: WatchedPromisesManager['providePromiseWatcher'];
|
|
215
|
+
watchPromise: WatchedPromisesManager['watchPromise'];
|
|
216
|
+
|
|
217
|
+
makeScalarBigMapStore: <K, V>(
|
|
218
|
+
label: string,
|
|
219
|
+
options?: StoreOptions,
|
|
220
|
+
) => MapStore<K, V>;
|
|
221
|
+
makeScalarBigWeakMapStore: <K, V>(
|
|
222
|
+
label: string,
|
|
223
|
+
options?: StoreOptions,
|
|
224
|
+
) => WeakMapStore<K, V>;
|
|
225
|
+
|
|
226
|
+
makeScalarBigSetStore: <K>(
|
|
227
|
+
label: string,
|
|
228
|
+
options?: StoreOptions,
|
|
229
|
+
) => SetStore<K>;
|
|
230
|
+
makeScalarBigWeakSetStore: <K>(
|
|
231
|
+
label: string,
|
|
232
|
+
options?: StoreOptions,
|
|
233
|
+
) => WeakSetStore<K>;
|
|
234
|
+
canBeDurable: (specimen: unknown) => boolean;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
// The JSDoc is repeated here and at the function definition so it appears
|
|
238
|
+
// in IDEs where it's used, regardless of type resolution.
|
|
239
|
+
export interface PickFacet {
|
|
240
|
+
/**
|
|
241
|
+
* When making a multi-facet kind, it's common to pick one facet to
|
|
242
|
+
* expose. E.g.,
|
|
243
|
+
*
|
|
244
|
+
* const makeFoo = (a, b, c, d) => makeFooBase(a, b, c, d).self;
|
|
245
|
+
*
|
|
246
|
+
* This helper reduces the duplication:
|
|
247
|
+
*
|
|
248
|
+
* const makeFoo = pickFacet(makeFooBase, 'self');
|
|
249
|
+
*/
|
|
250
|
+
<M extends (...args: any[]) => any, F extends keyof ReturnType<M>>(
|
|
251
|
+
maker: M,
|
|
252
|
+
facetName: F,
|
|
253
|
+
): (...args: Parameters<M>) => ReturnType<M>[F];
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** @deprecated Use prepareExoClass instead */
|
|
257
|
+
export type PrepareKind = <P extends Array<any>, S, F>(
|
|
258
|
+
baggage: Baggage,
|
|
259
|
+
tag: string,
|
|
260
|
+
init: (...args: P) => S,
|
|
261
|
+
facet: F,
|
|
262
|
+
options?: DefineKindOptions<KindContext<S, F>>,
|
|
263
|
+
) => (...args: P) => KindFacet<F>;
|
|
264
|
+
|
|
265
|
+
/** @deprecated Use prepareExoClassKit instead */
|
|
266
|
+
export type PrepareKindMulti = <P extends Array<any>, S, B>(
|
|
267
|
+
baggage: Baggage,
|
|
268
|
+
tag: string,
|
|
269
|
+
init: (...args: P) => S,
|
|
270
|
+
behavior: B,
|
|
271
|
+
options?: DefineKindOptions<MultiKindContext<S, B>>,
|
|
272
|
+
) => (...args: P) => KindFacets<B>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export function enumerateKeysStartEnd(syscall: any, start: any, end: any, checkF: any): Generator<any, void, unknown>;
|
|
2
|
+
export function enumerateKeysWithPrefix(syscall: any, prefix: any): Generator<any, void, unknown>;
|
|
3
|
+
export function prefixedKeysExist(syscall: any, prefix: any): boolean;
|
|
4
|
+
//# sourceMappingURL=vatstore-iterators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vatstore-iterators.d.ts","sourceRoot":"","sources":["vatstore-iterators.js"],"names":[],"mappings":"AAIA,sHAeC;AAMD,kGASC;AAGD,sEAGC"}
|