@agoric/notifier 0.7.0-upgrade-17-dev-a1453b2.0 → 0.7.0-upgrade-18-dev-bf39b10.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 +17 -17
- package/src/asyncIterableAdaptor.d.ts +2 -2
- package/src/index.d.ts +1 -1
- package/src/index.js +2 -2
- package/src/publish-kit.d.ts.map +1 -1
- package/src/subscribe.d.ts +9 -9
- package/src/types-index.d.ts +2 -0
- package/src/types-index.js +2 -0
- package/src/types.d.ts +5 -6
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +254 -0
- package/src/types.js +0 -300
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/notifier",
|
|
3
|
-
"version": "0.7.0-upgrade-
|
|
3
|
+
"version": "0.7.0-upgrade-18-dev-bf39b10.0+bf39b10",
|
|
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",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "exit 0",
|
|
12
12
|
"prepack": "tsc --build tsconfig.build.json",
|
|
13
|
-
"postpack": "git clean -f '*.d.ts*'",
|
|
13
|
+
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
|
|
14
14
|
"test": "ava",
|
|
15
15
|
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
|
|
16
16
|
"test:xs": "exit 0",
|
|
@@ -33,21 +33,21 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@agoric/internal": "0.4.0-upgrade-
|
|
37
|
-
"@agoric/vat-data": "0.5.3-upgrade-
|
|
38
|
-
"@endo/errors": "^1.2.
|
|
39
|
-
"@endo/far": "^1.1.
|
|
40
|
-
"@endo/marshal": "^1.
|
|
41
|
-
"@endo/patterns": "^1.4.
|
|
42
|
-
"@endo/promise-kit": "^1.1.
|
|
36
|
+
"@agoric/internal": "0.4.0-upgrade-18-dev-bf39b10.0+bf39b10",
|
|
37
|
+
"@agoric/vat-data": "0.5.3-upgrade-18-dev-bf39b10.0+bf39b10",
|
|
38
|
+
"@endo/errors": "^1.2.7",
|
|
39
|
+
"@endo/far": "^1.1.8",
|
|
40
|
+
"@endo/marshal": "^1.6.1",
|
|
41
|
+
"@endo/patterns": "^1.4.6",
|
|
42
|
+
"@endo/promise-kit": "^1.1.7"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@agoric/kmarshal": "0.1.1-upgrade-
|
|
46
|
-
"@agoric/swing-store": "0.
|
|
47
|
-
"@agoric/swingset-liveslots": "0.10.3-upgrade-
|
|
48
|
-
"@agoric/swingset-vat": "0.33.0-upgrade-
|
|
49
|
-
"@endo/init": "^1.1.
|
|
50
|
-
"@endo/ses-ava": "^1.2.
|
|
45
|
+
"@agoric/kmarshal": "0.1.1-upgrade-18-dev-bf39b10.0+bf39b10",
|
|
46
|
+
"@agoric/swing-store": "0.10.0-upgrade-18-dev-bf39b10.0+bf39b10",
|
|
47
|
+
"@agoric/swingset-liveslots": "0.10.3-upgrade-18-dev-bf39b10.0+bf39b10",
|
|
48
|
+
"@agoric/swingset-vat": "0.33.0-upgrade-18-dev-bf39b10.0+bf39b10",
|
|
49
|
+
"@endo/init": "^1.1.6",
|
|
50
|
+
"@endo/ses-ava": "^1.2.7",
|
|
51
51
|
"ava": "^5.3.0",
|
|
52
52
|
"c8": "^9.1.0"
|
|
53
53
|
},
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"timeout": "2m"
|
|
77
77
|
},
|
|
78
78
|
"typeCoverage": {
|
|
79
|
-
"atLeast": 90.
|
|
79
|
+
"atLeast": 90.71
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "bf39b100f0da4380bab0ce2464aaca1988f0b76a"
|
|
82
82
|
}
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
* @returns {ForkableAsyncIterable<T>}
|
|
35
35
|
*/
|
|
36
36
|
export const makeAsyncIterableFromNotifier: <T_1>(topic: ERef<LatestTopic<T_1>>) => {
|
|
37
|
-
[Symbol.asyncIterator]: () => import("
|
|
37
|
+
[Symbol.asyncIterator]: () => import("./types-index.js").ForkableAsyncIterableIterator<T_1, T_1>;
|
|
38
38
|
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
39
|
-
[Symbol.asyncIterator]: () => import("
|
|
39
|
+
[Symbol.asyncIterator]: () => import("./types-index.js").ForkableAsyncIterableIterator<T_1, T_1>;
|
|
40
40
|
}>;
|
|
41
41
|
export function observeIterator<T_1>(asyncIteratorP: ERef<AsyncIterator<T_1>>, iterationObserver: Partial<IterationObserver<T_1>>): Promise<undefined>;
|
|
42
42
|
export function observeIteration<T_1>(asyncIterableP: ERef<AsyncIterable<T_1>>, iterationObserver: Partial<IterationObserver<T_1>>): Promise<undefined>;
|
package/src/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { makePinnedHistoryTopic } from "./topic.js";
|
|
2
2
|
export * from "./storesub.js";
|
|
3
3
|
export * from "./stored-notifier.js";
|
|
4
|
-
export * from "./types.js";
|
|
4
|
+
export * from "./types-index.js";
|
|
5
5
|
export { makePublishKit, prepareDurablePublishKit, ForkableAsyncIterableIteratorShape, IterableEachTopicI, IterableLatestTopicI, SubscriberShape } from "./publish-kit.js";
|
|
6
6
|
export { subscribeEach, subscribeLatest } from "./subscribe.js";
|
|
7
7
|
export { makeNotifier, makeNotifierKit, makeNotifierFromAsyncIterable, makeNotifierFromSubscriber } from "./notifier.js";
|
package/src/index.js
CHANGED
|
@@ -28,5 +28,5 @@ export {
|
|
|
28
28
|
export * from './storesub.js';
|
|
29
29
|
export * from './stored-notifier.js';
|
|
30
30
|
|
|
31
|
-
// eslint-disable-next-line import/export
|
|
32
|
-
export * from './types.js';
|
|
31
|
+
// eslint-disable-next-line import/export
|
|
32
|
+
export * from './types-index.js'; // no named exports in JS
|
package/src/publish-kit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-kit.d.ts","sourceRoot":"","sources":["publish-kit.js"],"names":[],"mappings":"AAuBA;;;;GAIG;AAGH,gEAA6D;AAC7D;;;GAGG;;;;;AAMH;;;;GAOE;AAEF;;;GAMG;AAEH;;;GAMG;AA+CI,+BA2CQ,CAAC,KA7CH,WAAW,CAAC,CAAC,CA4FzB;AA6MM,kDAHI,OAAO,4BAA4B,EAAE,OAAO,YAC5C,MAAM
|
|
1
|
+
{"version":3,"file":"publish-kit.d.ts","sourceRoot":"","sources":["publish-kit.js"],"names":[],"mappings":"AAuBA;;;;GAIG;AAGH,gEAA6D;AAC7D;;;GAGG;;;;;AAMH;;;;GAOE;AAEF;;;GAMG;AAEH;;;GAMG;AA+CI,+BA2CQ,CAAC,KA7CH,WAAW,CAAC,CAAC,CA4FzB;AA6MM,kDAHI,OAAO,4BAA4B,EAAE,OAAO,YAC5C,MAAM;;;;;;;;;;;;GA2EhB;AAGD,+DAAyD;4CAlP3C,UAAU,GAAC,CAAC;;;;;;cASZ,OAAO,CAAC,GAAC,CAAC,GAAG,SAAS;;;;WAEtB,OAAO,CAAC,GAAC,CAAC;;;;;WACV,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG,SAAS;;gCAjPsI,iBAAiB;+BAAjB,iBAAiB"}
|
package/src/subscribe.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
export function subscribe<T>(itP: ERef<AsyncIterableIterator<T>>): {
|
|
2
2
|
[Symbol.asyncIterator]: () => {
|
|
3
|
-
[Symbol.asyncIterator]: () => any & import("@endo/
|
|
3
|
+
[Symbol.asyncIterator]: () => any & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, any>;
|
|
4
4
|
next: () => Promise<IteratorResult<T, any>>;
|
|
5
|
-
} & import("@endo/
|
|
6
|
-
[Symbol.asyncIterator]: () => any & import("@endo/
|
|
5
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
6
|
+
[Symbol.asyncIterator]: () => any & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, any>;
|
|
7
7
|
next: () => Promise<IteratorResult<T, any>>;
|
|
8
8
|
}>;
|
|
9
|
-
} & import("@endo/
|
|
9
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
10
10
|
[Symbol.asyncIterator]: () => {
|
|
11
|
-
[Symbol.asyncIterator]: () => any & import("@endo/
|
|
11
|
+
[Symbol.asyncIterator]: () => any & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, any>;
|
|
12
12
|
next: () => Promise<IteratorResult<T, any>>;
|
|
13
|
-
} & import("@endo/
|
|
14
|
-
[Symbol.asyncIterator]: () => any & import("@endo/
|
|
13
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
14
|
+
[Symbol.asyncIterator]: () => any & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, any>;
|
|
15
15
|
next: () => Promise<IteratorResult<T, any>>;
|
|
16
16
|
}>;
|
|
17
17
|
}>;
|
|
18
18
|
export function subscribeEach<T>(topic: ERef<EachTopic<T>>): {
|
|
19
19
|
[Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T>;
|
|
20
|
-
} & import("@endo/
|
|
20
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
21
21
|
[Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T>;
|
|
22
22
|
}>;
|
|
23
23
|
export function subscribeLatest<T>(topic: ERef<LatestTopic<T>>): {
|
|
24
24
|
[Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T>;
|
|
25
|
-
} & import("@endo/
|
|
25
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
26
26
|
[Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T>;
|
|
27
27
|
}>;
|
|
28
28
|
import type { ERef } from '@endo/far';
|
package/src/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { StoredFacet, Unserializer, VStorageKey } from '@agoric/internal/src/lib-chainStorage.js';
|
|
1
2
|
/**
|
|
2
3
|
* An AsyncIterator that can be forked at a given position
|
|
3
4
|
* into multiple independent ForkableAsyncIterators starting from that position.
|
|
@@ -135,11 +136,11 @@ export type StoredPublishKit<T> = {
|
|
|
135
136
|
* 'mandatory' is the only currently-supported value, and others must not be
|
|
136
137
|
* enabled without test coverage.
|
|
137
138
|
*/
|
|
138
|
-
export type DurablePublishKitValueDurability =
|
|
139
|
+
export type DurablePublishKitValueDurability = 'mandatory' | 'opportunistic' | 'ignored';
|
|
139
140
|
export type DurablePublishKitState = {
|
|
140
141
|
valueDurability: DurablePublishKitValueDurability;
|
|
141
142
|
publishCount: bigint;
|
|
142
|
-
status:
|
|
143
|
+
status: 'live' | 'finished' | 'failed';
|
|
143
144
|
/**
|
|
144
145
|
* hasValue indicates the presence of value. It starts off false,
|
|
145
146
|
* and can be reset to false when a durable publish kit is restored and
|
|
@@ -172,7 +173,7 @@ export type NotifierInternals<T> = BaseNotifier<T>;
|
|
|
172
173
|
/**
|
|
173
174
|
* an object that can be used to get the current state or updates
|
|
174
175
|
*/
|
|
175
|
-
export type Notifier<T> = import(
|
|
176
|
+
export type Notifier<T> = import('@endo/marshal').RemotableObject & NotifierInternals<T> & ForkableAsyncIterable<T, T> & SharableNotifier<T>;
|
|
176
177
|
export type SharableNotifier<T> = {
|
|
177
178
|
/**
|
|
178
179
|
* Used to replicate the multicast values at other sites. To manually create a
|
|
@@ -193,7 +194,7 @@ export type NotifierRecord<T> = {
|
|
|
193
194
|
/**
|
|
194
195
|
* the (closely-held) notifier producer
|
|
195
196
|
*/
|
|
196
|
-
updater: import(
|
|
197
|
+
updater: import('@endo/marshal').RemotableObject & IterationObserver<T>;
|
|
197
198
|
/**
|
|
198
199
|
* the (widely-held) notifier consumer
|
|
199
200
|
*/
|
|
@@ -227,6 +228,4 @@ export type StoredSubscription<T> = Subscription<T> & {
|
|
|
227
228
|
getUnserializer: () => Unserializer;
|
|
228
229
|
};
|
|
229
230
|
export type StoredSubscriber<T> = Subscriber<T> & StoredFacet;
|
|
230
|
-
import type { Unserializer } from '@agoric/internal/src/lib-chainStorage.js';
|
|
231
|
-
import type { StoredFacet } from '@agoric/internal/src/lib-chainStorage.js';
|
|
232
231
|
//# sourceMappingURL=types.d.ts.map
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACZ,MAAM,0CAA0C,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAC/B,CAAC,EACD,OAAO,GAAG,GAAG,EACb,KAAK,GAAG,SAAS,IACf,aAAa,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG;IACrC,IAAI,IAAI,qBAAqB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;CAClD,CAAC;AACF,MAAM,MAAM,iBAAiB,CAAC,CAAC,EAAE,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ACH,OAAO,EAAE,OAAO,eAAe,EAAE,eAAe,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACxE;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;CACvB,CAAC;AACF;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,GAChD,SAAS,CAAC,CAAC,CAAC,GACZ,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAC1B,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI;IACpC;;;;;;;;;OASG;IACH,gCAAgC,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D,CAAC;AACF,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI;IAClC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAClC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;CAC/B,CAAC;AACF,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG;IACpD,WAAW,EAAE,MAAM,OAAO,CACxB,WAAW,GAAG;QACZ,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;KAC/B,CACF,CAAC;IACF,eAAe,EAAE,MAAM,YAAY,CAAC;CACrC,CAAC;AACF,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC"}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/* eslint-disable no-use-before-define */
|
|
2
|
+
import type {
|
|
3
|
+
StoredFacet,
|
|
4
|
+
Unserializer,
|
|
5
|
+
VStorageKey,
|
|
6
|
+
} from '@agoric/internal/src/lib-chainStorage.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* An AsyncIterator that can be forked at a given position
|
|
10
|
+
* into multiple independent ForkableAsyncIterators starting from that position.
|
|
11
|
+
*/
|
|
12
|
+
export type ForkableAsyncIterator<
|
|
13
|
+
T,
|
|
14
|
+
TReturn = any,
|
|
15
|
+
TNext = undefined,
|
|
16
|
+
> = AsyncIterator<T, TReturn, TNext> & {
|
|
17
|
+
fork(): ForkableAsyncIterator<T, TReturn, TNext>;
|
|
18
|
+
};
|
|
19
|
+
export type AsyncIterableOnly<T, TReturn = any, TNext = undefined> = {
|
|
20
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<T, TReturn, TNext>;
|
|
21
|
+
};
|
|
22
|
+
export type ForkableAsyncIterableIterator<
|
|
23
|
+
T,
|
|
24
|
+
TReturn = any,
|
|
25
|
+
TNext = undefined,
|
|
26
|
+
> = {
|
|
27
|
+
[Symbol.asyncIterator](): ForkableAsyncIterableIterator<T, TReturn, TNext>;
|
|
28
|
+
fork(): ForkableAsyncIterableIterator<T, TReturn, TNext>;
|
|
29
|
+
} & ForkableAsyncIterator<T, TReturn, TNext>;
|
|
30
|
+
/**
|
|
31
|
+
* An AsyncIterable that produces ForkableAsyncIterators.
|
|
32
|
+
*/
|
|
33
|
+
export type ForkableAsyncIterable<T, TReturn = any, TNext = undefined> = {
|
|
34
|
+
[Symbol.asyncIterator]: () => ForkableAsyncIterator<T, TReturn, TNext>;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* A valid sequence of calls to the methods of an `IterationObserver`
|
|
38
|
+
* represents an iteration. A valid sequence consists of any number of calls
|
|
39
|
+
* to `updateState` with the successive non-final values, followed by a
|
|
40
|
+
* final call to either `finish` with a successful `completion` value
|
|
41
|
+
* or `fail` with the alleged `reason` for failure. After at most one
|
|
42
|
+
* terminating calls, no further calls to these methods are valid and must be
|
|
43
|
+
* rejected.
|
|
44
|
+
*/
|
|
45
|
+
export type IterationObserver<T> = {
|
|
46
|
+
updateState: (nonFinalValue: T) => void;
|
|
47
|
+
finish: (completion: T) => void;
|
|
48
|
+
fail: (reason: unknown) => void;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Will be shared between machines, so it must be safe to expose. But software
|
|
52
|
+
* outside the current package should consider it opaque, not depending on its
|
|
53
|
+
* internal structure.
|
|
54
|
+
*/
|
|
55
|
+
export type PublicationRecord<T> = {
|
|
56
|
+
head: IteratorResult<T>;
|
|
57
|
+
/**
|
|
58
|
+
* starts at 1 for the first result
|
|
59
|
+
* and advances by 1 for each subsequent result
|
|
60
|
+
*/
|
|
61
|
+
publishCount: bigint;
|
|
62
|
+
tail: Promise<PublicationRecord<T>>;
|
|
63
|
+
};
|
|
64
|
+
export type EachTopic<T> = {
|
|
65
|
+
/**
|
|
66
|
+
* Returns a promise for a "current" PublicationRecord (referencing its
|
|
67
|
+
* immediate successor via a `tail` promise) that is later than the
|
|
68
|
+
* provided publishCount.
|
|
69
|
+
* Used to make forward-lossless ("each") iterators.
|
|
70
|
+
*/
|
|
71
|
+
subscribeAfter: (publishCount?: bigint) => Promise<PublicationRecord<T>>;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* An EachTopic with default asyncIterable behaviour.
|
|
75
|
+
*
|
|
76
|
+
* NOTE: the publication records and iterators returned by this object are
|
|
77
|
+
* ephemeral and will be severed during upgrade. A caller should use
|
|
78
|
+
* `subscribeEach` to wrap this topic in a local iterable which automatically
|
|
79
|
+
* attempts to reconnect upon being severed.
|
|
80
|
+
*/
|
|
81
|
+
export type IterableEachTopic<T> = ForkableAsyncIterable<T, T> & EachTopic<T>;
|
|
82
|
+
/**
|
|
83
|
+
* A LatestTopic with default asyncIterable behaviour.
|
|
84
|
+
*
|
|
85
|
+
* NOTE: the iterators returned by this object are ephemeral and will be severed
|
|
86
|
+
* during upgrade. A caller should use `subscribeLatest` to wrap this topic in
|
|
87
|
+
* a local iterable which automatically attempts to reconnect upon being
|
|
88
|
+
* severed.
|
|
89
|
+
*/
|
|
90
|
+
export type IterableLatestTopic<T> = AsyncIterableOnly<T, T> & LatestTopic<T>;
|
|
91
|
+
export type LatestTopic<T> = {
|
|
92
|
+
/**
|
|
93
|
+
* Returns a promise for an update record as of an update count.
|
|
94
|
+
* If the `updateCount` argument is omitted or differs from the current update count,
|
|
95
|
+
* the promise promptly resolves to the current record.
|
|
96
|
+
* Otherwise, after the next state change, the promise resolves to the resulting record.
|
|
97
|
+
* This is an attenuated form of `subscribeAfter` whose return value stands alone and
|
|
98
|
+
* does not allow consumers to pin a chain of historical PublicationRecords.
|
|
99
|
+
* Used to make lossy ("latest") iterators.
|
|
100
|
+
* NOTE: Use of `number` as an `updateCount` is deprecated.
|
|
101
|
+
*/
|
|
102
|
+
getUpdateSince: (updateCount?: bigint | number) => Promise<UpdateRecord<T>>;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* This type is deprecated but is still
|
|
106
|
+
* used externally.
|
|
107
|
+
*/
|
|
108
|
+
export type BaseNotifier<T> = LatestTopic<T>;
|
|
109
|
+
/**
|
|
110
|
+
* A stream of results that allows consumers to configure
|
|
111
|
+
* forward-lossless "each" iteration with `subscribeEach` and
|
|
112
|
+
* lossy "latest" iteration with `subscribeLatest`.
|
|
113
|
+
*/
|
|
114
|
+
export type Subscriber<T> = LatestTopic<T> & EachTopic<T>;
|
|
115
|
+
/**
|
|
116
|
+
* A valid sequence of calls to the methods of an `IterationObserver`
|
|
117
|
+
* represents an iteration. A valid sequence consists of any number of calls
|
|
118
|
+
* to `publish` with the successive non-final values, followed by a
|
|
119
|
+
* final call to either `finish` with a successful `completion` value
|
|
120
|
+
* or `fail` with the alleged `reason` for failure. After at most one
|
|
121
|
+
* terminating calls, no further calls to these methods are valid and must be
|
|
122
|
+
* rejected.
|
|
123
|
+
*/
|
|
124
|
+
export type Publisher<T> = {
|
|
125
|
+
publish: (nonFinalValue: T) => void;
|
|
126
|
+
finish: (completion: T) => void;
|
|
127
|
+
fail: (reason: any) => void;
|
|
128
|
+
};
|
|
129
|
+
export type PublishObserver<T> = Partial<Publisher<T>>;
|
|
130
|
+
export type PublishKit<T> = {
|
|
131
|
+
publisher: Publisher<T>;
|
|
132
|
+
subscriber: Subscriber<T>;
|
|
133
|
+
};
|
|
134
|
+
export type StoredPublishKit<T> = {
|
|
135
|
+
publisher: Publisher<T>;
|
|
136
|
+
subscriber: StoredSubscriber<T>;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Durability configures constraints on non-terminal values that can be
|
|
140
|
+
* published to a durable publish kit (terminal values sent to finish or fail
|
|
141
|
+
* must always be durable).
|
|
142
|
+
* - 'mandatory' means that each value must be durable, so it can be restored
|
|
143
|
+
* on upgrade.
|
|
144
|
+
* - 'opportunistic' means that a durable value is persisted for post-upgrade
|
|
145
|
+
* restoration, but a non-durable value is still accepted (and will result in
|
|
146
|
+
* valueless restoration).
|
|
147
|
+
* - 'ignored' means that a value is not persisted for restoration even if it
|
|
148
|
+
* is durable.
|
|
149
|
+
*
|
|
150
|
+
* 'mandatory' is the only currently-supported value, and others must not be
|
|
151
|
+
* enabled without test coverage.
|
|
152
|
+
*/
|
|
153
|
+
export type DurablePublishKitValueDurability =
|
|
154
|
+
| 'mandatory'
|
|
155
|
+
| 'opportunistic'
|
|
156
|
+
| 'ignored';
|
|
157
|
+
export type DurablePublishKitState = {
|
|
158
|
+
valueDurability: DurablePublishKitValueDurability;
|
|
159
|
+
publishCount: bigint;
|
|
160
|
+
status: 'live' | 'finished' | 'failed';
|
|
161
|
+
/**
|
|
162
|
+
* hasValue indicates the presence of value. It starts off false,
|
|
163
|
+
* and can be reset to false when a durable publish kit is restored and
|
|
164
|
+
* the previous value was not durable, or non-terminal and valueDurablity is 'ignored'.
|
|
165
|
+
*/
|
|
166
|
+
hasValue: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* value holds either a non-terminal value from `publish` or a terminal value
|
|
169
|
+
* from `finish` or `fail`, depending upon the value in status.
|
|
170
|
+
*/
|
|
171
|
+
value: any;
|
|
172
|
+
};
|
|
173
|
+
export type UpdateRecord<T> = {
|
|
174
|
+
/**
|
|
175
|
+
* is whatever state the service wants to publish
|
|
176
|
+
*/
|
|
177
|
+
value: T;
|
|
178
|
+
/**
|
|
179
|
+
* is a value that identifies the update. For
|
|
180
|
+
* the last update, it is `undefined`.
|
|
181
|
+
*/
|
|
182
|
+
updateCount?: bigint | undefined;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Will be shared between machines,
|
|
186
|
+
* so it must be safe to expose. But other software should avoid depending on
|
|
187
|
+
* its internal structure.
|
|
188
|
+
*/
|
|
189
|
+
export type NotifierInternals<T> = BaseNotifier<T>;
|
|
190
|
+
/**
|
|
191
|
+
* an object that can be used to get the current state or updates
|
|
192
|
+
*/
|
|
193
|
+
export type Notifier<T> = import('@endo/marshal').RemotableObject &
|
|
194
|
+
NotifierInternals<T> &
|
|
195
|
+
ForkableAsyncIterable<T, T> &
|
|
196
|
+
SharableNotifier<T>;
|
|
197
|
+
export type SharableNotifier<T> = {
|
|
198
|
+
/**
|
|
199
|
+
* Used to replicate the multicast values at other sites. To manually create a
|
|
200
|
+
* local representative of a Notification, do
|
|
201
|
+
* ```js
|
|
202
|
+
* localIterable =
|
|
203
|
+
* makeNotifier(E(remoteIterable).getSharableNotifierInternals());
|
|
204
|
+
* ```
|
|
205
|
+
* The resulting `localIterable` also supports such remote use, and
|
|
206
|
+
* will return access to the same representation.
|
|
207
|
+
*/
|
|
208
|
+
getSharableNotifierInternals: () => Promise<NotifierInternals<T>>;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* the produced notifier/updater pair
|
|
212
|
+
*/
|
|
213
|
+
export type NotifierRecord<T> = {
|
|
214
|
+
/**
|
|
215
|
+
* the (closely-held) notifier producer
|
|
216
|
+
*/
|
|
217
|
+
updater: import('@endo/marshal').RemotableObject & IterationObserver<T>;
|
|
218
|
+
/**
|
|
219
|
+
* the (widely-held) notifier consumer
|
|
220
|
+
*/
|
|
221
|
+
notifier: Notifier<T>;
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* A form of AsyncIterable supporting distributed and multicast usage.
|
|
225
|
+
*/
|
|
226
|
+
export type Subscription<T> = IterableEachTopic<T> &
|
|
227
|
+
EachTopic<T> &
|
|
228
|
+
SharableSubscription<T>;
|
|
229
|
+
export type SharableSubscription<T> = {
|
|
230
|
+
/**
|
|
231
|
+
* Used to replicate the multicast values at other sites. To manually create a
|
|
232
|
+
* local representative of a Subscription, do
|
|
233
|
+
* ```js
|
|
234
|
+
* localIterable =
|
|
235
|
+
* makeSubscription(E(remoteIterable).getSharableSubscriptionInternals());
|
|
236
|
+
* ```
|
|
237
|
+
* The resulting `localIterable` also supports such remote use, and
|
|
238
|
+
* will return access to the same representation.
|
|
239
|
+
*/
|
|
240
|
+
getSharableSubscriptionInternals: () => Promise<EachTopic<T>>;
|
|
241
|
+
};
|
|
242
|
+
export type SubscriptionRecord<T> = {
|
|
243
|
+
publication: IterationObserver<T>;
|
|
244
|
+
subscription: Subscription<T>;
|
|
245
|
+
};
|
|
246
|
+
export type StoredSubscription<T> = Subscription<T> & {
|
|
247
|
+
getStoreKey: () => Promise<
|
|
248
|
+
VStorageKey & {
|
|
249
|
+
subscription: Subscription<T>;
|
|
250
|
+
}
|
|
251
|
+
>;
|
|
252
|
+
getUnserializer: () => Unserializer;
|
|
253
|
+
};
|
|
254
|
+
export type StoredSubscriber<T> = Subscriber<T> & StoredFacet;
|
package/src/types.js
DELETED
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
// @jessie-check
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @import {StoredFacet, Unserializer} from '@agoric/internal/src/lib-chainStorage.js';
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// Ensure this is a module.
|
|
8
|
-
export {};
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @template T
|
|
12
|
-
* @template [TReturn=any]
|
|
13
|
-
* @template [TNext=undefined]
|
|
14
|
-
* @typedef {AsyncIterator<T, TReturn, TNext> & {
|
|
15
|
-
* fork(): ForkableAsyncIterator<T, TReturn, TNext>
|
|
16
|
-
* }} ForkableAsyncIterator An AsyncIterator that can be forked at a given position
|
|
17
|
-
* into multiple independent ForkableAsyncIterators starting from that position.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @template T
|
|
22
|
-
* @template [TReturn=any]
|
|
23
|
-
* @template [TNext=undefined]
|
|
24
|
-
* @typedef {{ [Symbol.asyncIterator](): AsyncIterableIterator<T, TReturn, TNext> }} AsyncIterableOnly
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @template T
|
|
29
|
-
* @template [TReturn=any]
|
|
30
|
-
* @template [TNext=undefined]
|
|
31
|
-
* @typedef {{
|
|
32
|
-
* [Symbol.asyncIterator](): ForkableAsyncIterableIterator<T, TReturn, TNext>,
|
|
33
|
-
* fork(): ForkableAsyncIterableIterator<T, TReturn, TNext> } &
|
|
34
|
-
* ForkableAsyncIterator<T, TReturn, TNext>
|
|
35
|
-
* } ForkableAsyncIterableIterator
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @template T
|
|
40
|
-
* @template [TReturn=any]
|
|
41
|
-
* @template [TNext=undefined]
|
|
42
|
-
* @typedef {{
|
|
43
|
-
* [Symbol.asyncIterator]: () => ForkableAsyncIterator<T, TReturn, TNext>
|
|
44
|
-
* }} ForkableAsyncIterable
|
|
45
|
-
* An AsyncIterable that produces ForkableAsyncIterators.
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @template T
|
|
50
|
-
* @typedef {object} IterationObserver
|
|
51
|
-
* A valid sequence of calls to the methods of an `IterationObserver`
|
|
52
|
-
* represents an iteration. A valid sequence consists of any number of calls
|
|
53
|
-
* to `updateState` with the successive non-final values, followed by a
|
|
54
|
-
* final call to either `finish` with a successful `completion` value
|
|
55
|
-
* or `fail` with the alleged `reason` for failure. After at most one
|
|
56
|
-
* terminating calls, no further calls to these methods are valid and must be
|
|
57
|
-
* rejected.
|
|
58
|
-
* @property {(nonFinalValue: T) => void} updateState
|
|
59
|
-
* @property {(completion: T) => void} finish
|
|
60
|
-
* @property {(reason: unknown) => void} fail
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
// /////////////////////////////////////////////////////////////////////////////
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* @template T
|
|
67
|
-
* @typedef {object} PublicationRecord
|
|
68
|
-
* Will be shared between machines, so it must be safe to expose. But software
|
|
69
|
-
* outside the current package should consider it opaque, not depending on its
|
|
70
|
-
* internal structure.
|
|
71
|
-
* @property {IteratorResult<T>} head
|
|
72
|
-
* @property {bigint} publishCount starts at 1 for the first result
|
|
73
|
-
* and advances by 1 for each subsequent result
|
|
74
|
-
* @property {Promise<PublicationRecord<T>>} tail
|
|
75
|
-
*/
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* @template T
|
|
79
|
-
* @typedef {object} EachTopic
|
|
80
|
-
* @property {(publishCount?: bigint) => Promise<PublicationRecord<T>>} subscribeAfter
|
|
81
|
-
* Returns a promise for a "current" PublicationRecord (referencing its
|
|
82
|
-
* immediate successor via a `tail` promise) that is later than the
|
|
83
|
-
* provided publishCount.
|
|
84
|
-
* Used to make forward-lossless ("each") iterators.
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* @template T
|
|
89
|
-
* @typedef {ForkableAsyncIterable<T, T> & EachTopic<T>} IterableEachTopic
|
|
90
|
-
* An EachTopic with default asyncIterable behaviour.
|
|
91
|
-
*
|
|
92
|
-
* NOTE: the publication records and iterators returned by this object are
|
|
93
|
-
* ephemeral and will be severed during upgrade. A caller should use
|
|
94
|
-
* `subscribeEach` to wrap this topic in a local iterable which automatically
|
|
95
|
-
* attempts to reconnect upon being severed.
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* @template T
|
|
100
|
-
* @typedef {AsyncIterableOnly<T, T> & LatestTopic<T>} IterableLatestTopic
|
|
101
|
-
* A LatestTopic with default asyncIterable behaviour.
|
|
102
|
-
*
|
|
103
|
-
* NOTE: the iterators returned by this object are ephemeral and will be severed
|
|
104
|
-
* during upgrade. A caller should use `subscribeLatest` to wrap this topic in
|
|
105
|
-
* a local iterable which automatically attempts to reconnect upon being
|
|
106
|
-
* severed.
|
|
107
|
-
*/
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* @template T
|
|
111
|
-
* @typedef {object} LatestTopic
|
|
112
|
-
* @property {(updateCount?: bigint | number) => Promise<UpdateRecord<T>>} getUpdateSince
|
|
113
|
-
* Returns a promise for an update record as of an update count.
|
|
114
|
-
* If the `updateCount` argument is omitted or differs from the current update count,
|
|
115
|
-
* the promise promptly resolves to the current record.
|
|
116
|
-
* Otherwise, after the next state change, the promise resolves to the resulting record.
|
|
117
|
-
* This is an attenuated form of `subscribeAfter` whose return value stands alone and
|
|
118
|
-
* does not allow consumers to pin a chain of historical PublicationRecords.
|
|
119
|
-
* Used to make lossy ("latest") iterators.
|
|
120
|
-
* NOTE: Use of `number` as an `updateCount` is deprecated.
|
|
121
|
-
*/
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* @template T
|
|
125
|
-
* @typedef {LatestTopic<T>} BaseNotifier This type is deprecated but is still
|
|
126
|
-
* used externally.
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* @template T
|
|
131
|
-
* @typedef {LatestTopic<T> & EachTopic<T>} Subscriber
|
|
132
|
-
* A stream of results that allows consumers to configure
|
|
133
|
-
* forward-lossless "each" iteration with `subscribeEach` and
|
|
134
|
-
* lossy "latest" iteration with `subscribeLatest`.
|
|
135
|
-
*/
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* @template T
|
|
139
|
-
* @typedef {object} Publisher
|
|
140
|
-
* A valid sequence of calls to the methods of an `IterationObserver`
|
|
141
|
-
* represents an iteration. A valid sequence consists of any number of calls
|
|
142
|
-
* to `publish` with the successive non-final values, followed by a
|
|
143
|
-
* final call to either `finish` with a successful `completion` value
|
|
144
|
-
* or `fail` with the alleged `reason` for failure. After at most one
|
|
145
|
-
* terminating calls, no further calls to these methods are valid and must be
|
|
146
|
-
* rejected.
|
|
147
|
-
* @property {(nonFinalValue: T) => void} publish
|
|
148
|
-
* @property {(completion: T) => void} finish
|
|
149
|
-
* @property {(reason: any) => void} fail
|
|
150
|
-
*/
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* @template T
|
|
154
|
-
* @typedef {Partial<Publisher<T>>} PublishObserver
|
|
155
|
-
*/
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* @template T
|
|
159
|
-
* @typedef {object} PublishKit
|
|
160
|
-
* @property {Publisher<T>} publisher
|
|
161
|
-
* @property {Subscriber<T>} subscriber
|
|
162
|
-
*/
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* @template T
|
|
166
|
-
* @typedef {object} StoredPublishKit
|
|
167
|
-
* @property {Publisher<T>} publisher
|
|
168
|
-
* @property {StoredSubscriber<T>} subscriber
|
|
169
|
-
*/
|
|
170
|
-
|
|
171
|
-
// /////////////////////////////////////////////////////////////////////////////
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* @typedef {'mandatory' | 'opportunistic' | 'ignored'} DurablePublishKitValueDurability
|
|
175
|
-
*
|
|
176
|
-
* Durability configures constraints on non-terminal values that can be
|
|
177
|
-
* published to a durable publish kit (terminal values sent to finish or fail
|
|
178
|
-
* must always be durable).
|
|
179
|
-
* - 'mandatory' means that each value must be durable, so it can be restored
|
|
180
|
-
* on upgrade.
|
|
181
|
-
* - 'opportunistic' means that a durable value is persisted for post-upgrade
|
|
182
|
-
* restoration, but a non-durable value is still accepted (and will result in
|
|
183
|
-
* valueless restoration).
|
|
184
|
-
* - 'ignored' means that a value is not persisted for restoration even if it
|
|
185
|
-
* is durable.
|
|
186
|
-
*
|
|
187
|
-
* 'mandatory' is the only currently-supported value, and others must not be
|
|
188
|
-
* enabled without test coverage.
|
|
189
|
-
*/
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* @typedef {object} DurablePublishKitState
|
|
193
|
-
*
|
|
194
|
-
* @property {DurablePublishKitValueDurability} valueDurability
|
|
195
|
-
*
|
|
196
|
-
* @property {bigint} publishCount
|
|
197
|
-
*
|
|
198
|
-
* @property {'live' | 'finished' | 'failed'} status
|
|
199
|
-
*
|
|
200
|
-
* @property {boolean} hasValue
|
|
201
|
-
* hasValue indicates the presence of value. It starts off false,
|
|
202
|
-
* and can be reset to false when a durable publish kit is restored and
|
|
203
|
-
* the previous value was not durable, or non-terminal and valueDurablity is 'ignored'.
|
|
204
|
-
*
|
|
205
|
-
* @property {any} value
|
|
206
|
-
* value holds either a non-terminal value from `publish` or a terminal value
|
|
207
|
-
* from `finish` or `fail`, depending upon the value in status.
|
|
208
|
-
*/
|
|
209
|
-
|
|
210
|
-
// /////////////////////////////////////////////////////////////////////////////
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* @template T
|
|
214
|
-
* @typedef {object} UpdateRecord
|
|
215
|
-
* @property {T} value is whatever state the service wants to publish
|
|
216
|
-
* @property {bigint} [updateCount] is a value that identifies the update. For
|
|
217
|
-
* the last update, it is `undefined`.
|
|
218
|
-
*/
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* @template T
|
|
222
|
-
* @typedef {BaseNotifier<T>} NotifierInternals Will be shared between machines,
|
|
223
|
-
* so it must be safe to expose. But other software should avoid depending on
|
|
224
|
-
* its internal structure.
|
|
225
|
-
*/
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* @template T
|
|
229
|
-
* @typedef {import('@endo/marshal').RemotableObject & NotifierInternals<T> &
|
|
230
|
-
* ForkableAsyncIterable<T, T> &
|
|
231
|
-
* SharableNotifier<T>
|
|
232
|
-
* } Notifier an object that can be used to get the current state or updates
|
|
233
|
-
*/
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* @template T
|
|
237
|
-
* @typedef {object} SharableNotifier
|
|
238
|
-
* @property {() => Promise<NotifierInternals<T>>} getSharableNotifierInternals
|
|
239
|
-
* Used to replicate the multicast values at other sites. To manually create a
|
|
240
|
-
* local representative of a Notification, do
|
|
241
|
-
* ```js
|
|
242
|
-
* localIterable =
|
|
243
|
-
* makeNotifier(E(remoteIterable).getSharableNotifierInternals());
|
|
244
|
-
* ```
|
|
245
|
-
* The resulting `localIterable` also supports such remote use, and
|
|
246
|
-
* will return access to the same representation.
|
|
247
|
-
*/
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* @template T
|
|
251
|
-
* @typedef {object} NotifierRecord the produced notifier/updater pair
|
|
252
|
-
* @property {import('@endo/marshal').RemotableObject & IterationObserver<T>} updater the (closely-held) notifier producer
|
|
253
|
-
* @property {Notifier<T>} notifier the (widely-held) notifier consumer
|
|
254
|
-
*/
|
|
255
|
-
|
|
256
|
-
// /////////////////////////////////////////////////////////////////////////////
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* @template T
|
|
260
|
-
* @typedef {IterableEachTopic<T> & EachTopic<T> &
|
|
261
|
-
* SharableSubscription<T>} Subscription
|
|
262
|
-
* A form of AsyncIterable supporting distributed and multicast usage.
|
|
263
|
-
*/
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* @template T
|
|
267
|
-
* @typedef {object} SharableSubscription
|
|
268
|
-
* @property {() => Promise<EachTopic<T>>} getSharableSubscriptionInternals
|
|
269
|
-
* Used to replicate the multicast values at other sites. To manually create a
|
|
270
|
-
* local representative of a Subscription, do
|
|
271
|
-
* ```js
|
|
272
|
-
* localIterable =
|
|
273
|
-
* makeSubscription(E(remoteIterable).getSharableSubscriptionInternals());
|
|
274
|
-
* ```
|
|
275
|
-
* The resulting `localIterable` also supports such remote use, and
|
|
276
|
-
* will return access to the same representation.
|
|
277
|
-
*/
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* @template T
|
|
281
|
-
* @typedef {object} SubscriptionRecord
|
|
282
|
-
* @property {IterationObserver<T>} publication
|
|
283
|
-
* @property {Subscription<T>} subscription
|
|
284
|
-
*/
|
|
285
|
-
|
|
286
|
-
// /////////////////////////////////////////////////////////////////////////////
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* @deprecated use StoredSubscriber
|
|
290
|
-
* @template T
|
|
291
|
-
* @typedef {Subscription<T> & {
|
|
292
|
-
* getStoreKey: () => Promise<VStorageKey & { subscription: Subscription<T> }>,
|
|
293
|
-
* getUnserializer: () => Unserializer,
|
|
294
|
-
* }} StoredSubscription
|
|
295
|
-
*/
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* @template T
|
|
299
|
-
* @typedef {Subscriber<T> & StoredFacet} StoredSubscriber
|
|
300
|
-
*/
|