@agoric/notifier 0.6.3-dev-fa844b5.0 → 0.6.3-dev-a477bee.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/notifier",
3
- "version": "0.6.3-dev-fa844b5.0+fa844b5",
3
+ "version": "0.6.3-dev-a477bee.0+a477bee",
4
4
  "description": "Notifier allows services to update clients about state changes using a stream of promises",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "scripts": {
11
11
  "build": "exit 0",
12
- "prepack": "echo \"export {}; \" | cat - src/types-ambient.js > src/types.js && tsc --build --clean tsconfig.build.json",
12
+ "prepack": "echo \"export {}; \" | cat - src/types-ambient.js > src/types.js && tsc --build tsconfig.build.json",
13
13
  "postpack": "git clean -f '*.d.ts*' src/types.js",
14
14
  "test": "ava",
15
15
  "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
@@ -33,19 +33,19 @@
33
33
  },
34
34
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
35
35
  "dependencies": {
36
- "@agoric/assert": "0.6.1-dev-fa844b5.0+fa844b5",
37
- "@agoric/internal": "0.3.3-dev-fa844b5.0+fa844b5",
38
- "@agoric/vat-data": "0.5.3-dev-fa844b5.0+fa844b5",
36
+ "@agoric/assert": "0.6.1-dev-a477bee.0+a477bee",
37
+ "@agoric/internal": "0.3.3-dev-a477bee.0+a477bee",
38
+ "@agoric/vat-data": "0.5.3-dev-a477bee.0+a477bee",
39
39
  "@endo/far": "^1.1.0",
40
40
  "@endo/marshal": "^1.4.0",
41
41
  "@endo/patterns": "^1.3.0",
42
42
  "@endo/promise-kit": "^1.1.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@agoric/kmarshal": "0.1.1-dev-fa844b5.0+fa844b5",
46
- "@agoric/swing-store": "0.9.2-dev-fa844b5.0+fa844b5",
47
- "@agoric/swingset-liveslots": "0.10.3-dev-fa844b5.0+fa844b5",
48
- "@agoric/swingset-vat": "0.32.3-dev-fa844b5.0+fa844b5",
45
+ "@agoric/kmarshal": "0.1.1-dev-a477bee.0+a477bee",
46
+ "@agoric/swing-store": "0.9.2-dev-a477bee.0+a477bee",
47
+ "@agoric/swingset-liveslots": "0.10.3-dev-a477bee.0+a477bee",
48
+ "@agoric/swingset-vat": "0.32.3-dev-a477bee.0+a477bee",
49
49
  "@endo/init": "^1.1.0",
50
50
  "@endo/ses-ava": "^1.2.0",
51
51
  "ava": "^5.3.0",
@@ -78,5 +78,5 @@
78
78
  "typeCoverage": {
79
79
  "atLeast": 89.76
80
80
  },
81
- "gitHead": "fa844b51a10ab02af61af19207c164c99c2d8d8c"
81
+ "gitHead": "a477bee3be6e0e98b9346c0640380e276cf8423e"
82
82
  }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @deprecated Use `subscribeLatest` from `@agoric/notifier/subscribe.js` instead.
3
+ *
4
+ * Adaptor from a notifierP to an async iterable.
5
+ * The notifierP can be any object that has an eventually invocable
6
+ * `getUpdateSince` method that behaves according to the notifier
7
+ * spec. This can be a notifier, a promise for a local or remote
8
+ * notifier, or a presence of a remote notifier.
9
+ *
10
+ * It is also used internally by notifier.js so that a notifier itself is an
11
+ * async iterable.
12
+ *
13
+ * An async iterable is an object with a `[Symbol.asyncIterator]()` method
14
+ * that returns an async iterator. The async iterator we return here has only
15
+ * a `next()` method, without the optional `return` and `throw` methods. The
16
+ * omitted methods, if present, would be used by the for/await/of loop to
17
+ * inform the iterator of early termination. But this adaptor would not do
18
+ * anything useful in reaction to this notification.
19
+ *
20
+ * An async iterator's `next()` method returns a promise for an iteration
21
+ * result. An iteration result is a record with `value` and `done` properties.
22
+ *
23
+ * The purpose of building on the notifier protocol is to have a lossy
24
+ * adaptor, where intermediate results can be missed in favor of more recent
25
+ * results which are therefore less stale. See
26
+ * https://github.com/Agoric/documentation/blob/HEAD/main/guides/js-programming/notifiers.md
27
+ *
28
+ * @template T
29
+ * @param {ERef<BaseNotifier<T>>} notifierP
30
+ * @returns {ForkableAsyncIterable<T>}
31
+ */
32
+ export const makeAsyncIterableFromNotifier: <T_1>(topic: ERef<LatestTopic<T_1>>) => {
33
+ [Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T_1, T_1, undefined>;
34
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
35
+ [Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T_1, T_1, undefined>;
36
+ }>;
37
+ export function observeIterator<T_1>(asyncIteratorP: ERef<AsyncIterator<T_1, any, undefined>>, iterationObserver: Partial<IterationObserver<T_1>>): Promise<undefined>;
38
+ export function observeIteration<T_1>(asyncIterableP: ERef<AsyncIterable<T_1>>, iterationObserver: Partial<IterationObserver<T_1>>): Promise<undefined>;
39
+ export function observeNotifier<T_1>(notifierP: ERef<LatestTopic<T_1>>, iterationObserver: Partial<IterationObserver<T_1>>): Promise<undefined>;
40
+ //# sourceMappingURL=asyncIterableAdaptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncIterableAdaptor.d.ts","sourceRoot":"","sources":["asyncIterableAdaptor.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH;;;;GAA6D;AAatD,oJAFM,QAAQ,SAAS,CAAC,CAyB9B;AAaM,qIAFM,QAAQ,SAAS,CAAC,CAK9B;AAaM,6HAFM,QAAQ,SAAS,CAAC,CAGkC"}
package/src/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export { makePinnedHistoryTopic } from "./topic.js";
2
+ export * from "./storesub.js";
3
+ export * from "./stored-notifier.js";
4
+ export { makePublishKit, prepareDurablePublishKit, ForkableAsyncIterableIteratorShape, IterableEachTopicI, IterableLatestTopicI, SubscriberShape } from "./publish-kit.js";
5
+ export { subscribeEach, subscribeLatest } from "./subscribe.js";
6
+ export { makeNotifier, makeNotifierKit, makeNotifierFromAsyncIterable, makeNotifierFromSubscriber } from "./notifier.js";
7
+ export { makeSubscription, makeSubscriptionKit } from "./subscriber.js";
8
+ export { observeNotifier, observeIterator, observeIteration, makeAsyncIterableFromNotifier } from "./asyncIterableAdaptor.js";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export function makeNotifier<T>(sharableInternalsP: ERef<LatestTopic<T>>): Notifier<T>;
2
+ export function makeNotifierFromSubscriber<T>(subscriber: ERef<Subscriber<T>>): Notifier<T>;
3
+ export function makeNotifierKit<T>(...initialStateArr: [] | [T]): NotifierRecord<T>;
4
+ export function makeNotifierFromAsyncIterable<T>(asyncIterableP: ERef<AsyncIterable<T>>): Notifier<T>;
5
+ //# sourceMappingURL=notifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifier.d.ts","sourceRoot":"","sources":["notifier.js"],"names":[],"mappings":"AAcO,uFAsBN;AAOM,4FAeN;AAoBM,oFAoBN;AAcM,sGAqEN"}
@@ -0,0 +1,60 @@
1
+ export const PublisherI: import("@endo/patterns").InterfaceGuard<{
2
+ publish: import("@endo/patterns").MethodGuard;
3
+ finish: import("@endo/patterns").MethodGuard;
4
+ fail: import("@endo/patterns").MethodGuard;
5
+ }>;
6
+ export const UpdateCountShape: import("@endo/patterns").Matcher;
7
+ export const SubscriberI: import("@endo/patterns").InterfaceGuard<{
8
+ subscribeAfter: import("@endo/patterns").MethodGuard;
9
+ getUpdateSince: import("@endo/patterns").MethodGuard;
10
+ }>;
11
+ export namespace publishKitIKit {
12
+ export { PublisherI as publisher };
13
+ export { SubscriberI as subscriber };
14
+ }
15
+ export const ForkableAsyncIterableIteratorShape: import("@endo/patterns").InterfaceGuard<{
16
+ fork: import("@endo/patterns").MethodGuard;
17
+ [Symbol.asyncIterator]: import("@endo/patterns").MethodGuard;
18
+ next: import("@endo/patterns").MethodGuard;
19
+ }>;
20
+ export const IterableEachTopicI: import("@endo/patterns").InterfaceGuard<{
21
+ subscribeAfter: import("@endo/patterns").MethodGuard;
22
+ [Symbol.asyncIterator]: import("@endo/patterns").MethodGuard;
23
+ }>;
24
+ export const IterableLatestTopicI: import("@endo/patterns").InterfaceGuard<{
25
+ getUpdateSince: import("@endo/patterns").MethodGuard;
26
+ [Symbol.asyncIterator]: import("@endo/patterns").MethodGuard;
27
+ }>;
28
+ export function makePublishKit<T>(): PublishKit<T>;
29
+ export function prepareDurablePublishKit(baggage: MapStore<string, any>, kindName: string): (options?: {
30
+ valueDurability?: "mandatory" | undefined;
31
+ } | undefined) => import("@endo/exo").GuardedKit<{
32
+ publisher: {
33
+ publish(value: any): void;
34
+ finish(finalValue: any): void;
35
+ fail(reason: any): void;
36
+ };
37
+ subscriber: {
38
+ subscribeAfter(publishCount?: bigint): Promise<any>;
39
+ getUpdateSince(updateCount: any): any;
40
+ };
41
+ }>;
42
+ export const SubscriberShape: import("@endo/patterns").Matcher;
43
+ export type DurablePublishKitEphemeralKey = Publisher<any>;
44
+ export type DurablePublishKitEphemeralData = {
45
+ /**
46
+ * The current-result promise
47
+ * (undefined unless resolved with unrecoverable ephemeral data)
48
+ */
49
+ currentP: Promise<any> | undefined;
50
+ /**
51
+ * The next-result promise
52
+ */
53
+ tailP: Promise<any>;
54
+ /**
55
+ * The next-result resolver
56
+ * (undefined when the publish kit has terminated)
57
+ */
58
+ tailR: ((value: any) => void) | undefined;
59
+ };
60
+ //# sourceMappingURL=publish-kit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish-kit.d.ts","sourceRoot":"","sources":["publish-kit.js"],"names":[],"mappings":"AAqBA;;;;GAIG;AAGH,gEAA6D;AAC7D;;;GAGG;;;;;AAMH;;;;GAOE;AAEF;;;GAMG;AAEH;;;GAMG;AA+CI,mDA0FN;AA6MM,mFAFI,MAAM;;;;;;;;;;;;GA2EhB;AAGD,+DAAyD;4CAlP3C,cAAY;;;;;;cASZ,YAAU,GAAG,SAAS;;;;WAEtB,YAAU;;;;;WACV,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG,SAAS"}
@@ -0,0 +1,3 @@
1
+ export function makeStoredNotifier<T>(notifier: ERef<Notifier<T>>, storageNode: ERef<StorageNode>, marshaller: ERef<Marshaller<unknown>>): StoredNotifier<T>;
2
+ export type StoredNotifier<T> = BaseNotifier<T> & Omit<StoredFacet, 'getStoreKey'>;
3
+ //# sourceMappingURL=stored-notifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stored-notifier.d.ts","sourceRoot":"","sources":["stored-notifier.js"],"names":[],"mappings":"AA2BO,6JA+BN;gCAjDY,aAAa,CAAC,CAAC,GAAG,KAAK,WAAW,EAAE,aAAa,CAAC"}
@@ -0,0 +1,21 @@
1
+ export function forEachPublicationRecord<T>(subscriber: Subscriber<T>, consumeValue: (v: T) => void): Promise<void>;
2
+ export function makeStoredSubscriber<T>(subscriber: Subscriber<T>, storageNode: ERef<StorageNode>, marshaller: ERef<{
3
+ toCapData: import("../../../node_modules/@endo/marshal/src/marshal.js").ToCapData<unknown>;
4
+ fromCapData: import("../../../node_modules/@endo/marshal/src/marshal.js").FromCapData<unknown>;
5
+ serialize: import("../../../node_modules/@endo/marshal/src/marshal.js").ToCapData<unknown>;
6
+ unserialize: import("../../../node_modules/@endo/marshal/src/marshal.js").FromCapData<unknown>;
7
+ }>): StoredSubscriber<T>;
8
+ export function makeStoredSubscription<T>(subscription: Subscription<T>, storageNode?: ERef<StorageNode> | undefined, marshaller?: ERef<{
9
+ toCapData: import("../../../node_modules/@endo/marshal/src/marshal.js").ToCapData<unknown>;
10
+ fromCapData: import("../../../node_modules/@endo/marshal/src/marshal.js").FromCapData<unknown>;
11
+ serialize: import("../../../node_modules/@endo/marshal/src/marshal.js").ToCapData<unknown>;
12
+ unserialize: import("../../../node_modules/@endo/marshal/src/marshal.js").FromCapData<unknown>;
13
+ }> | undefined): StoredSubscription<T>;
14
+ export function makeStoredPublisherKit<T = unknown>(storageNode?: ERef<StorageNode> | undefined, marshaller?: ERef<Marshaller<unknown>> | undefined, childPath?: string | undefined): StoredPublisherKit<T>;
15
+ export function makeStoredPublishKit<T = unknown>(storageNode: ERef<StorageNode>, marshaller: ERef<Marshaller<unknown>>): StoredPublishKit<T>;
16
+ export type StoredPublisherKit<T> = {
17
+ subscriber: StoredSubscription<T>;
18
+ publisher: IterationObserver<T>;
19
+ };
20
+ import { makeMarshal } from '@endo/marshal';
21
+ //# sourceMappingURL=storesub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storesub.d.ts","sourceRoot":"","sources":["storesub.js"],"names":[],"mappings":"AAiBO,+FAFc,IAAI,iBAcxB;AAiBM;;;;;yBA2BN;AAkBM;;;;;uCAmEN;AAoBM,4MAkBN;AAgBM,8IAQN;;gBAvDa,mBAAmB,CAAC,CAAC;eACrB,kBAAkB,CAAC,CAAC;;4BArKN,eAAe"}
@@ -0,0 +1,28 @@
1
+ export function subscribe<T>(itP: ERef<AsyncIterableIterator<T>>): {
2
+ [Symbol.asyncIterator]: () => {
3
+ [Symbol.asyncIterator]: () => any & import("@endo/eventual-send").RemotableBrand<{}, any>;
4
+ next: () => Promise<IteratorResult<T, any>>;
5
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
6
+ [Symbol.asyncIterator]: () => any & import("@endo/eventual-send").RemotableBrand<{}, any>;
7
+ next: () => Promise<IteratorResult<T, any>>;
8
+ }>;
9
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
10
+ [Symbol.asyncIterator]: () => {
11
+ [Symbol.asyncIterator]: () => any & import("@endo/eventual-send").RemotableBrand<{}, any>;
12
+ next: () => Promise<IteratorResult<T, any>>;
13
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
14
+ [Symbol.asyncIterator]: () => any & import("@endo/eventual-send").RemotableBrand<{}, any>;
15
+ next: () => Promise<IteratorResult<T, any>>;
16
+ }>;
17
+ }>;
18
+ export function subscribeEach<T>(topic: ERef<EachTopic<T>>): {
19
+ [Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T, undefined>;
20
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
21
+ [Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T, undefined>;
22
+ }>;
23
+ export function subscribeLatest<T>(topic: ERef<LatestTopic<T>>): {
24
+ [Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T, undefined>;
25
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
26
+ [Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T, undefined>;
27
+ }>;
28
+ //# sourceMappingURL=subscribe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["subscribe.js"],"names":[],"mappings":"AAkEO;;;;;;;;;;;;;;;;GAUH;AAuEG;;;;GAQN;AAsGM;;;;GAKN"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @template T
3
+ * @param {ERef<EachTopic<T>>} topic
4
+ * @returns {Subscription<T>}
5
+ */
6
+ export function makeSubscription<T>(topic: ERef<EachTopic<T>>): Subscription<T>;
7
+ /**
8
+ * @deprecated Producers should use
9
+ * ```js
10
+ * const { publisher, subscriber } = makePublishKit();
11
+ * const topic = makePinnedHistoryTopic(subscriber);
12
+ * ```
13
+ * instead, which makes it clearer that all the subscriber's history is
14
+ * retained, preventing GC. Potentially remote consumers use
15
+ * ```js
16
+ * for await (const value of subscribeEach(topic)) { ... }
17
+ * ```
18
+ *
19
+ * Makes a `{ publication, subscription }` for doing lossless efficient
20
+ * distributed pub/sub.
21
+ *
22
+ * @template T
23
+ * @returns {SubscriptionRecord<T>}
24
+ */
25
+ export function makeSubscriptionKit<T>(): SubscriptionRecord<T>;
26
+ //# sourceMappingURL=subscriber.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriber.d.ts","sourceRoot":"","sources":["subscriber.js"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,gFAgBC;AAID;;;;;;;;;;;;;;;;;GAiBG;AACH,gEAiBC"}
package/src/topic.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export function makePinnedHistoryTopic<T>(topic: EachTopic<T> & LatestTopic<T>): EachTopic<T> & LatestTopic<T>;
2
+ //# sourceMappingURL=topic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topic.d.ts","sourceRoot":"","sources":["topic.js"],"names":[],"mappings":"AAcO,+GAkBN"}
@@ -0,0 +1,298 @@
1
+ /**
2
+ * An AsyncIterator that can be forked at a given position
3
+ * into multiple independent ForkableAsyncIterators starting from that position.
4
+ */
5
+ type ForkableAsyncIterator<T, TReturn = any, TNext = undefined> = AsyncIterator<T, TReturn, TNext> & {
6
+ fork(): ForkableAsyncIterator<T, TReturn, TNext>;
7
+ };
8
+ type AsyncIterableOnly<T, TReturn = any, TNext = undefined> = {
9
+ [Symbol.asyncIterator](): AsyncIterableIterator<T, TReturn, TNext>;
10
+ };
11
+ type ForkableAsyncIterableIterator<T, TReturn = any, TNext = undefined> = {
12
+ [Symbol.asyncIterator](): ForkableAsyncIterableIterator<T, TReturn, TNext>;
13
+ fork(): ForkableAsyncIterableIterator<T, TReturn, TNext>;
14
+ } & ForkableAsyncIterator<T, TReturn, TNext>;
15
+ /**
16
+ * An AsyncIterable that produces ForkableAsyncIterators.
17
+ */
18
+ type ForkableAsyncIterable<T, TReturn = any, TNext = undefined> = {
19
+ [Symbol.asyncIterator]: () => ForkableAsyncIterator<T, TReturn, TNext>;
20
+ };
21
+ /**
22
+ * <T>
23
+ * A valid sequence of calls to the methods of an `IterationObserver`
24
+ * represents an iteration. A valid sequence consists of any number of calls
25
+ * to `updateState` with the successive non-final values, followed by a
26
+ * final call to either `finish` with a successful `completion` value
27
+ * or `fail` with the alleged `reason` for failure. After at most one
28
+ * terminating calls, no further calls to these methods are valid and must be
29
+ * rejected.
30
+ */
31
+ type IterationObserver<T> = {
32
+ updateState: (nonFinalValue: T) => void;
33
+ finish: (completion: T) => void;
34
+ fail: (reason: unknown) => void;
35
+ };
36
+ /**
37
+ * Will be shared between machines, so it must be safe to expose. But software
38
+ * outside the current package should consider it opaque, not depending on its
39
+ * internal structure.
40
+ */
41
+ type PublicationRecord<T> = {
42
+ head: IteratorResult<T>;
43
+ /**
44
+ * starts at 1 for the first result
45
+ * and advances by 1 for each subsequent result
46
+ */
47
+ publishCount: bigint;
48
+ tail: Promise<PublicationRecord<T>>;
49
+ };
50
+ type EachTopic<T> = {
51
+ /**
52
+ * Returns a promise for a "current" PublicationRecord (referencing its
53
+ * immediate successor via a `tail` promise) that is later than the
54
+ * provided publishCount.
55
+ * Used to make forward-lossless ("each") iterators.
56
+ */
57
+ subscribeAfter: (publishCount?: bigint) => Promise<PublicationRecord<T>>;
58
+ };
59
+ /**
60
+ * An EachTopic with default asyncIterable behaviour.
61
+ *
62
+ * NOTE: the publication records and iterators returned by this object are
63
+ * ephemeral and will be severed during upgrade. A caller should use
64
+ * `subscribeEach` to wrap this topic in a local iterable which automatically
65
+ * attempts to reconnect upon being severed.
66
+ */
67
+ type IterableEachTopic<T> = ForkableAsyncIterable<T, T> & EachTopic<T>;
68
+ /**
69
+ * A LatestTopic with default asyncIterable behaviour.
70
+ *
71
+ * NOTE: the iterators returned by this object are ephemeral and will be severed
72
+ * during upgrade. A caller should use `subscribeLatest` to wrap this topic in
73
+ * a local iterable which automatically attempts to reconnect upon being
74
+ * severed.
75
+ */
76
+ type IterableLatestTopic<T> = AsyncIterableOnly<T, T> & LatestTopic<T>;
77
+ type LatestTopic<T> = {
78
+ /**
79
+ * Returns a promise for an update record as of an update count.
80
+ * If the `updateCount` argument is omitted or differs from the current update count,
81
+ * the promise promptly resolves to the current record.
82
+ * Otherwise, after the next state change, the promise resolves to the resulting record.
83
+ * This is an attenuated form of `subscribeAfter` whose return value stands alone and
84
+ * does not allow consumers to pin a chain of historical PublicationRecords.
85
+ * Used to make lossy ("latest") iterators.
86
+ * NOTE: Use of `number` as an `updateCount` is deprecated.
87
+ */
88
+ getUpdateSince: (updateCount?: bigint | number) => Promise<UpdateRecord<T>>;
89
+ };
90
+ /**
91
+ * This type is deprecated but is still
92
+ * used externally.
93
+ */
94
+ type BaseNotifier<T> = LatestTopic<T>;
95
+ /**
96
+ * A stream of results that allows consumers to configure
97
+ * forward-lossless "each" iteration with `subscribeEach` and
98
+ * lossy "latest" iteration with `subscribeLatest`.
99
+ */
100
+ type Subscriber<T> = LatestTopic<T> & EachTopic<T>;
101
+ /**
102
+ * A valid sequence of calls to the methods of an `IterationObserver`
103
+ * represents an iteration. A valid sequence consists of any number of calls
104
+ * to `publish` with the successive non-final values, followed by a
105
+ * final call to either `finish` with a successful `completion` value
106
+ * or `fail` with the alleged `reason` for failure. After at most one
107
+ * terminating calls, no further calls to these methods are valid and must be
108
+ * rejected.
109
+ */
110
+ type Publisher<T> = {
111
+ publish: (nonFinalValue: T) => void;
112
+ finish: (completion: T) => void;
113
+ fail: (reason: any) => void;
114
+ };
115
+ type PublishObserver<T> = Partial<Publisher<T>>;
116
+ /**
117
+ * <T>
118
+ */
119
+ type PublishKit<T> = {
120
+ publisher: Publisher<T>;
121
+ subscriber: Subscriber<T>;
122
+ };
123
+ /**
124
+ * <T>
125
+ */
126
+ type StoredPublishKit<T> = {
127
+ publisher: Publisher<T>;
128
+ subscriber: StoredSubscriber<T>;
129
+ };
130
+ /**
131
+ * Durability configures constraints on non-terminal values that can be
132
+ * published to a durable publish kit (terminal values sent to finish or fail
133
+ * must always be durable).
134
+ * - 'mandatory' means that each value must be durable, so it can be restored
135
+ * on upgrade.
136
+ * - 'opportunistic' means that a durable value is persisted for post-upgrade
137
+ * restoration, but a non-durable value is still accepted (and will result in
138
+ * valueless restoration).
139
+ * - 'ignored' means that a value is not persisted for restoration even if it
140
+ * is durable.
141
+ *
142
+ * 'mandatory' is the only currently-supported value, and others must not be
143
+ * enabled without test coverage.
144
+ */
145
+ type DurablePublishKitValueDurability = 'mandatory' | 'opportunistic' | 'ignored';
146
+ type DurablePublishKitState = {
147
+ valueDurability: DurablePublishKitValueDurability;
148
+ publishCount: bigint;
149
+ status: 'live' | 'finished' | 'failed';
150
+ /**
151
+ * hasValue indicates the presence of value. It starts off false,
152
+ * and can be reset to false when a durable publish kit is restored and
153
+ * the previous value was not durable, or non-terminal and valueDurablity is 'ignored'.
154
+ */
155
+ hasValue: boolean;
156
+ /**
157
+ * value holds either a non-terminal value from `publish` or a terminal value
158
+ * from `finish` or `fail`, depending upon the value in status.
159
+ */
160
+ value: any;
161
+ };
162
+ /**
163
+ * <T>
164
+ */
165
+ type UpdateRecord<T> = {
166
+ /**
167
+ * is whatever state the service wants to publish
168
+ */
169
+ value: T;
170
+ /**
171
+ * is a value that identifies the update. For
172
+ * the last update, it is `undefined`.
173
+ */
174
+ updateCount?: bigint | undefined;
175
+ };
176
+ /**
177
+ * Will be shared between machines,
178
+ * so it must be safe to expose. But other software should avoid depending on
179
+ * its internal structure.
180
+ */
181
+ type NotifierInternals<T> = BaseNotifier<T>;
182
+ /**
183
+ * <T> an object that can be used to get the current state or updates
184
+ */
185
+ type Notifier<T> = NotifierInternals<T> & ForkableAsyncIterable<T, T> & SharableNotifier<T>;
186
+ type SharableNotifier<T> = {
187
+ /**
188
+ * Used to replicate the multicast values at other sites. To manually create a
189
+ * local representative of a Notification, do
190
+ * ```js
191
+ * localIterable =
192
+ * makeNotifier(E(remoteIterable).getSharableNotifierInternals());
193
+ * ```
194
+ * The resulting `localIterable` also supports such remote use, and
195
+ * will return access to the same representation.
196
+ */
197
+ getSharableNotifierInternals: () => Promise<NotifierInternals<T>>;
198
+ };
199
+ /**
200
+ * <T> the produced notifier/updater pair
201
+ */
202
+ type NotifierRecord<T> = {
203
+ /**
204
+ * the (closely-held) notifier producer
205
+ */
206
+ updater: IterationObserver<T>;
207
+ /**
208
+ * the (widely-held) notifier consumer
209
+ */
210
+ notifier: Notifier<T>;
211
+ };
212
+ /**
213
+ * <T>
214
+ * A form of AsyncIterable supporting distributed and multicast usage.
215
+ */
216
+ type Subscription<T> = IterableEachTopic<T> & EachTopic<T> & SharableSubscription<T>;
217
+ type SharableSubscription<T> = {
218
+ /**
219
+ * Used to replicate the multicast values at other sites. To manually create a
220
+ * local representative of a Subscription, do
221
+ * ```js
222
+ * localIterable =
223
+ * makeSubscription(E(remoteIterable).getSharableSubscriptionInternals());
224
+ * ```
225
+ * The resulting `localIterable` also supports such remote use, and
226
+ * will return access to the same representation.
227
+ */
228
+ getSharableSubscriptionInternals: () => Promise<EachTopic<T>>;
229
+ };
230
+ /**
231
+ * <T>
232
+ */
233
+ type SubscriptionRecord<T> = {
234
+ publication: IterationObserver<T>;
235
+ subscription: Subscription<T>;
236
+ };
237
+ type Marshaller<Slot = unknown> = import('@endo/marshal').Marshal<Slot>;
238
+ type Unserializer = Pick<Marshaller, 'fromCapData'>;
239
+ /**
240
+ * Defined by vstorageStoreKey in vstorage.go
241
+ */
242
+ type VStorageKey = {
243
+ storeName: string;
244
+ storeSubkey: string;
245
+ dataPrefixBytes: string;
246
+ noDataValue?: string | undefined;
247
+ };
248
+ /**
249
+ * This represents a node in an IAVL tree.
250
+ *
251
+ * The active implementation is x/vstorage, an Agoric extension of the Cosmos SDK.
252
+ *
253
+ * Vstorage is a hierarchical externally-reachable storage structure that
254
+ * identifies children by restricted ASCII name and is associated with arbitrary
255
+ * string-valued data for each node, defaulting to the empty string.
256
+ */
257
+ type StorageNode = {
258
+ /**
259
+ * publishes some data (append to the node)
260
+ */
261
+ setValue: (data: string) => Promise<void>;
262
+ /**
263
+ * the chain storage path at which the node was constructed
264
+ */
265
+ getPath: () => string;
266
+ /**
267
+ * DEPRECATED use getPath
268
+ */
269
+ getStoreKey: () => Promise<VStorageKey>;
270
+ makeChildNode: (subPath: string, options?: {
271
+ sequence?: boolean;
272
+ }) => StorageNode;
273
+ };
274
+ type StoredFacet = {
275
+ /**
276
+ * the chain storage path at which the node was constructed
277
+ */
278
+ getPath: () => Promise<string>;
279
+ /**
280
+ * DEPRECATED use getPath
281
+ */
282
+ getStoreKey: StorageNode['getStoreKey'];
283
+ /**
284
+ * get the unserializer for the stored data
285
+ */
286
+ getUnserializer: () => Unserializer;
287
+ };
288
+ type StoredSubscription<T> = Subscription<T> & {
289
+ getStoreKey: () => Promise<VStorageKey & {
290
+ subscription: Subscription<T>;
291
+ }>;
292
+ getUnserializer: () => Unserializer;
293
+ };
294
+ type StoredSubscriber<T> = Subscriber<T> & StoredFacet;
295
+ import type { ERef } from '@endo/far';
296
+ import type { PromiseKit } from '@endo/promise-kit';
297
+ import type { PromiseRecord } from '@endo/promise-kit';
298
+ //# sourceMappingURL=types-ambient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-ambient.d.ts","sourceRoot":"","sources":["types-ambient.js"],"names":[],"mappings":";;;;kEAYa,cAAc,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG;IAC/C,IAAQ,IAAI,sBAAsB,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;CACjD;8DAQS;IAAE,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,sBAAsB,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;CAAE;0EAOtE;IACZ,CAAK,MAAM,CAAC,aAAa,CAAC,IAAI,8BAA8B,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC/E,IAAQ,IAAI,8BAA8B,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;CAAE,GAC9D,sBAA0B,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC;;;;kEAQhC;IACZ,CAAK,MAAM,CAAC,aAAa,CAAC,EAAE,MAAM,sBAAsB,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;CACvE;;;;;;;;;;;;iBAcU,CAAC,aAAa,EAAE,CAAC,KAAK,IAAI;YAC1B,CAAC,UAAU,EAAE,CAAC,KAAK,IAAI;UACvB,CAAC,MAAM,EAAE,OAAO,KAAK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C,CAAC;;;;cACpB,SAAS,CAAC,CAAC;;;;;;uBAOZ,kBAAkB,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,GAC/C,qBAAyB,CAAC,CAAC;;;;;;;;;;;;sCAOd,MAAM,QAAQ,UAAU,CAAC,CAAC,CAAC;;;;;;iBAc3B,kBAAkB,CAAC,CAAC;kBACpB,aAAa,CAAC,CAAC;;kCAKU,OAAO,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC;oBAC9D,KAAK,UAAU,EAAE,aAAa,CAAC;;;;;eAM/B,MAAM;iBACN,MAAM;qBACN,MAAM;;;;;;;;;;;;;;;;cAcN,CAAC,IAAI,EAAE,MAAM,KAAK,QAAQ,IAAI,CAAC;;;;aAC/B,MAAM,MAAM;;;;iBACZ,MAAM,QAAQ,WAAW,CAAC;mBAC1B,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAC,KAAK,WAAW;;;;;;aAKhE,MAAM,QAAQ,MAAM,CAAC;;;;iBACrB,WAAW,CAAC,aAAa,CAAC;;;;qBAC1B,MAAM,YAAY;;6BAMnB,aAAa,CAAC,CAAC,GAAG;IAC9B,WAAe,EAAE,MAAM,QAAQ,WAAW,GAAG;QAAE,YAAY,EAAE,aAAa,CAAC,CAAC,CAAA;KAAE,CAAC,CAAC;IAChF,eAAmB,EAAE,MAAM,YAAY,CAAC;CACrC;2BAKS,WAAW,CAAC,CAAC,GAAG,WAAW;0BA3Ud,WAAW;gCAGO,mBAAmB;mCAAnB,mBAAmB"}
package/src/types.d.ts ADDED
@@ -0,0 +1,295 @@
1
+ /**
2
+ * An AsyncIterator that can be forked at a given position
3
+ * into multiple independent ForkableAsyncIterators starting from that position.
4
+ */
5
+ export type ForkableAsyncIterator<T, TReturn = any, TNext = undefined> = AsyncIterator<T, TReturn, TNext> & {
6
+ fork(): ForkableAsyncIterator<T, TReturn, TNext>;
7
+ };
8
+ export type AsyncIterableOnly<T, TReturn = any, TNext = undefined> = {
9
+ [Symbol.asyncIterator](): AsyncIterableIterator<T, TReturn, TNext>;
10
+ };
11
+ export type ForkableAsyncIterableIterator<T, TReturn = any, TNext = undefined> = {
12
+ [Symbol.asyncIterator](): ForkableAsyncIterableIterator<T, TReturn, TNext>;
13
+ fork(): ForkableAsyncIterableIterator<T, TReturn, TNext>;
14
+ } & ForkableAsyncIterator<T, TReturn, TNext>;
15
+ /**
16
+ * An AsyncIterable that produces ForkableAsyncIterators.
17
+ */
18
+ export type ForkableAsyncIterable<T, TReturn = any, TNext = undefined> = {
19
+ [Symbol.asyncIterator]: () => ForkableAsyncIterator<T, TReturn, TNext>;
20
+ };
21
+ /**
22
+ * <T>
23
+ * A valid sequence of calls to the methods of an `IterationObserver`
24
+ * represents an iteration. A valid sequence consists of any number of calls
25
+ * to `updateState` with the successive non-final values, followed by a
26
+ * final call to either `finish` with a successful `completion` value
27
+ * or `fail` with the alleged `reason` for failure. After at most one
28
+ * terminating calls, no further calls to these methods are valid and must be
29
+ * rejected.
30
+ */
31
+ export type IterationObserver<T> = {
32
+ updateState: (nonFinalValue: T) => void;
33
+ finish: (completion: T) => void;
34
+ fail: (reason: unknown) => void;
35
+ };
36
+ /**
37
+ * Will be shared between machines, so it must be safe to expose. But software
38
+ * outside the current package should consider it opaque, not depending on its
39
+ * internal structure.
40
+ */
41
+ export type PublicationRecord<T> = {
42
+ head: IteratorResult<T>;
43
+ /**
44
+ * starts at 1 for the first result
45
+ * and advances by 1 for each subsequent result
46
+ */
47
+ publishCount: bigint;
48
+ tail: Promise<PublicationRecord<T>>;
49
+ };
50
+ export type EachTopic<T> = {
51
+ /**
52
+ * Returns a promise for a "current" PublicationRecord (referencing its
53
+ * immediate successor via a `tail` promise) that is later than the
54
+ * provided publishCount.
55
+ * Used to make forward-lossless ("each") iterators.
56
+ */
57
+ subscribeAfter: (publishCount?: bigint) => Promise<PublicationRecord<T>>;
58
+ };
59
+ /**
60
+ * An EachTopic with default asyncIterable behaviour.
61
+ *
62
+ * NOTE: the publication records and iterators returned by this object are
63
+ * ephemeral and will be severed during upgrade. A caller should use
64
+ * `subscribeEach` to wrap this topic in a local iterable which automatically
65
+ * attempts to reconnect upon being severed.
66
+ */
67
+ export type IterableEachTopic<T> = ForkableAsyncIterable<T, T> & EachTopic<T>;
68
+ /**
69
+ * A LatestTopic with default asyncIterable behaviour.
70
+ *
71
+ * NOTE: the iterators returned by this object are ephemeral and will be severed
72
+ * during upgrade. A caller should use `subscribeLatest` to wrap this topic in
73
+ * a local iterable which automatically attempts to reconnect upon being
74
+ * severed.
75
+ */
76
+ export type IterableLatestTopic<T> = AsyncIterableOnly<T, T> & LatestTopic<T>;
77
+ export type LatestTopic<T> = {
78
+ /**
79
+ * Returns a promise for an update record as of an update count.
80
+ * If the `updateCount` argument is omitted or differs from the current update count,
81
+ * the promise promptly resolves to the current record.
82
+ * Otherwise, after the next state change, the promise resolves to the resulting record.
83
+ * This is an attenuated form of `subscribeAfter` whose return value stands alone and
84
+ * does not allow consumers to pin a chain of historical PublicationRecords.
85
+ * Used to make lossy ("latest") iterators.
86
+ * NOTE: Use of `number` as an `updateCount` is deprecated.
87
+ */
88
+ getUpdateSince: (updateCount?: bigint | number) => Promise<UpdateRecord<T>>;
89
+ };
90
+ /**
91
+ * This type is deprecated but is still
92
+ * used externally.
93
+ */
94
+ export type BaseNotifier<T> = LatestTopic<T>;
95
+ /**
96
+ * A stream of results that allows consumers to configure
97
+ * forward-lossless "each" iteration with `subscribeEach` and
98
+ * lossy "latest" iteration with `subscribeLatest`.
99
+ */
100
+ export type Subscriber<T> = LatestTopic<T> & EachTopic<T>;
101
+ /**
102
+ * A valid sequence of calls to the methods of an `IterationObserver`
103
+ * represents an iteration. A valid sequence consists of any number of calls
104
+ * to `publish` with the successive non-final values, followed by a
105
+ * final call to either `finish` with a successful `completion` value
106
+ * or `fail` with the alleged `reason` for failure. After at most one
107
+ * terminating calls, no further calls to these methods are valid and must be
108
+ * rejected.
109
+ */
110
+ export type Publisher<T> = {
111
+ publish: (nonFinalValue: T) => void;
112
+ finish: (completion: T) => void;
113
+ fail: (reason: any) => void;
114
+ };
115
+ export type PublishObserver<T> = Partial<Publisher<T>>;
116
+ /**
117
+ * <T>
118
+ */
119
+ export type PublishKit<T> = {
120
+ publisher: Publisher<T>;
121
+ subscriber: Subscriber<T>;
122
+ };
123
+ /**
124
+ * <T>
125
+ */
126
+ export type StoredPublishKit<T> = {
127
+ publisher: Publisher<T>;
128
+ subscriber: StoredSubscriber<T>;
129
+ };
130
+ /**
131
+ * Durability configures constraints on non-terminal values that can be
132
+ * published to a durable publish kit (terminal values sent to finish or fail
133
+ * must always be durable).
134
+ * - 'mandatory' means that each value must be durable, so it can be restored
135
+ * on upgrade.
136
+ * - 'opportunistic' means that a durable value is persisted for post-upgrade
137
+ * restoration, but a non-durable value is still accepted (and will result in
138
+ * valueless restoration).
139
+ * - 'ignored' means that a value is not persisted for restoration even if it
140
+ * is durable.
141
+ *
142
+ * 'mandatory' is the only currently-supported value, and others must not be
143
+ * enabled without test coverage.
144
+ */
145
+ export type DurablePublishKitValueDurability = 'mandatory' | 'opportunistic' | 'ignored';
146
+ export type DurablePublishKitState = {
147
+ valueDurability: DurablePublishKitValueDurability;
148
+ publishCount: bigint;
149
+ status: 'live' | 'finished' | 'failed';
150
+ /**
151
+ * hasValue indicates the presence of value. It starts off false,
152
+ * and can be reset to false when a durable publish kit is restored and
153
+ * the previous value was not durable, or non-terminal and valueDurablity is 'ignored'.
154
+ */
155
+ hasValue: boolean;
156
+ /**
157
+ * value holds either a non-terminal value from `publish` or a terminal value
158
+ * from `finish` or `fail`, depending upon the value in status.
159
+ */
160
+ value: any;
161
+ };
162
+ /**
163
+ * <T>
164
+ */
165
+ export type UpdateRecord<T> = {
166
+ /**
167
+ * is whatever state the service wants to publish
168
+ */
169
+ value: T;
170
+ /**
171
+ * is a value that identifies the update. For
172
+ * the last update, it is `undefined`.
173
+ */
174
+ updateCount?: bigint | undefined;
175
+ };
176
+ /**
177
+ * Will be shared between machines,
178
+ * so it must be safe to expose. But other software should avoid depending on
179
+ * its internal structure.
180
+ */
181
+ export type NotifierInternals<T> = BaseNotifier<T>;
182
+ /**
183
+ * <T> an object that can be used to get the current state or updates
184
+ */
185
+ export type Notifier<T> = NotifierInternals<T> & ForkableAsyncIterable<T, T> & SharableNotifier<T>;
186
+ export type SharableNotifier<T> = {
187
+ /**
188
+ * Used to replicate the multicast values at other sites. To manually create a
189
+ * local representative of a Notification, do
190
+ * ```js
191
+ * localIterable =
192
+ * makeNotifier(E(remoteIterable).getSharableNotifierInternals());
193
+ * ```
194
+ * The resulting `localIterable` also supports such remote use, and
195
+ * will return access to the same representation.
196
+ */
197
+ getSharableNotifierInternals: () => Promise<NotifierInternals<T>>;
198
+ };
199
+ /**
200
+ * <T> the produced notifier/updater pair
201
+ */
202
+ export type NotifierRecord<T> = {
203
+ /**
204
+ * the (closely-held) notifier producer
205
+ */
206
+ updater: IterationObserver<T>;
207
+ /**
208
+ * the (widely-held) notifier consumer
209
+ */
210
+ notifier: Notifier<T>;
211
+ };
212
+ /**
213
+ * <T>
214
+ * A form of AsyncIterable supporting distributed and multicast usage.
215
+ */
216
+ export type Subscription<T> = IterableEachTopic<T> & EachTopic<T> & SharableSubscription<T>;
217
+ export type SharableSubscription<T> = {
218
+ /**
219
+ * Used to replicate the multicast values at other sites. To manually create a
220
+ * local representative of a Subscription, do
221
+ * ```js
222
+ * localIterable =
223
+ * makeSubscription(E(remoteIterable).getSharableSubscriptionInternals());
224
+ * ```
225
+ * The resulting `localIterable` also supports such remote use, and
226
+ * will return access to the same representation.
227
+ */
228
+ getSharableSubscriptionInternals: () => Promise<EachTopic<T>>;
229
+ };
230
+ /**
231
+ * <T>
232
+ */
233
+ export type SubscriptionRecord<T> = {
234
+ publication: IterationObserver<T>;
235
+ subscription: Subscription<T>;
236
+ };
237
+ export type Marshaller<Slot = unknown> = import('@endo/marshal').Marshal<Slot>;
238
+ export type Unserializer = Pick<Marshaller, 'fromCapData'>;
239
+ /**
240
+ * Defined by vstorageStoreKey in vstorage.go
241
+ */
242
+ export type VStorageKey = {
243
+ storeName: string;
244
+ storeSubkey: string;
245
+ dataPrefixBytes: string;
246
+ noDataValue?: string | undefined;
247
+ };
248
+ /**
249
+ * This represents a node in an IAVL tree.
250
+ *
251
+ * The active implementation is x/vstorage, an Agoric extension of the Cosmos SDK.
252
+ *
253
+ * Vstorage is a hierarchical externally-reachable storage structure that
254
+ * identifies children by restricted ASCII name and is associated with arbitrary
255
+ * string-valued data for each node, defaulting to the empty string.
256
+ */
257
+ export type StorageNode = {
258
+ /**
259
+ * publishes some data (append to the node)
260
+ */
261
+ setValue: (data: string) => Promise<void>;
262
+ /**
263
+ * the chain storage path at which the node was constructed
264
+ */
265
+ getPath: () => string;
266
+ /**
267
+ * DEPRECATED use getPath
268
+ */
269
+ getStoreKey: () => Promise<VStorageKey>;
270
+ makeChildNode: (subPath: string, options?: {
271
+ sequence?: boolean;
272
+ }) => StorageNode;
273
+ };
274
+ export type StoredFacet = {
275
+ /**
276
+ * the chain storage path at which the node was constructed
277
+ */
278
+ getPath: () => Promise<string>;
279
+ /**
280
+ * DEPRECATED use getPath
281
+ */
282
+ getStoreKey: StorageNode['getStoreKey'];
283
+ /**
284
+ * get the unserializer for the stored data
285
+ */
286
+ getUnserializer: () => Unserializer;
287
+ };
288
+ export type StoredSubscription<T> = Subscription<T> & {
289
+ getStoreKey: () => Promise<VStorageKey & {
290
+ subscription: Subscription<T>;
291
+ }>;
292
+ getUnserializer: () => Unserializer;
293
+ };
294
+ export type StoredSubscriber<T> = Subscriber<T> & StoredFacet;
295
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":";;;;yEAaa,cAAc,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG;IAC/C,IAAQ,IAAI,sBAAsB,CAAC,EAAE,OAAO,E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;;;;;aAKhE,MAAM,QAAQ,MAAM,CAAC;;;;iBACrB,WAAW,CAAC,aAAa,CAAC;;;;qBAC1B,MAAM,YAAY;;oCAMnB,aAAa,CAAC,CAAC,GAAG;IAC9B,WAAe,EAAE,MAAM,QAAQ,WAAW,GAAG;QAAE,YAAY,EAAE,aAAa,CAAC,CAAC,CAAA;KAAE,CAAC,CAAC;IAChF,eAAmB,EAAE,MAAM,YAAY,CAAC;CACrC;kCAKS,WAAW,CAAC,CAAC,GAAG,WAAW"}
@@ -0,0 +1,11 @@
1
+ export { eventLoopIteration } from "@agoric/internal/src/testing-utils.js";
2
+ export function makeFakeStorage(path: string, publication?: IterationObserver<unknown> | undefined): StorageNode & {
3
+ countSetValueCalls: () => number;
4
+ };
5
+ export function makeFakeMarshaller(): {
6
+ toCapData: import("../../../node_modules/@endo/marshal/src/marshal.js").ToCapData<any>;
7
+ fromCapData: import("../../../node_modules/@endo/marshal/src/marshal.js").FromCapData<any>;
8
+ serialize: import("../../../node_modules/@endo/marshal/src/marshal.js").ToCapData<any>;
9
+ unserialize: import("../../../node_modules/@endo/marshal/src/marshal.js").FromCapData<any>;
10
+ };
11
+ //# sourceMappingURL=testSupports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testSupports.d.ts","sourceRoot":"","sources":["testSupports.js"],"names":[],"mappings":";AAUO,sCAHI,MAAM;wBAWgC,MAAM,MAAM;EAe5D;AAGM;;;;;EAGH"}