@agoric/notifier 0.7.0 → 0.7.1-upgrade-23-dev-bd79330.0.bd79330
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 +12 -13
- package/src/asyncIterableAdaptor.d.ts +2 -2
- package/src/index.js +0 -3
- package/src/notifier.d.ts +1 -0
- package/src/notifier.d.ts.map +1 -1
- package/src/notifier.js +1 -0
- package/src/publish-kit.d.ts +2 -1
- package/src/publish-kit.d.ts.map +1 -1
- package/src/publish-kit.js +2 -1
- package/src/stored-notifier.d.ts +3 -2
- package/src/stored-notifier.d.ts.map +1 -1
- package/src/stored-notifier.js +6 -6
- package/src/storesub.d.ts +7 -7
- package/src/storesub.d.ts.map +1 -1
- package/src/storesub.js +14 -11
- package/src/subscribe.d.ts +9 -9
- package/src/subscribe.js +1 -1
- package/src/subscriber.d.ts +2 -0
- package/src/subscriber.d.ts.map +1 -1
- package/src/subscriber.js +1 -2
- package/src/topic.d.ts.map +1 -1
- package/src/topic.js +0 -2
- package/src/types.js +253 -0
- package/subscribe.js +0 -2
- package/exported.js +0 -2
- package/src/types.ts +0 -253
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/notifier",
|
|
3
|
-
"version": "0.7.0",
|
|
3
|
+
"version": "0.7.1-upgrade-23-dev-bd79330.0.bd79330",
|
|
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,14 +9,14 @@
|
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "exit 0",
|
|
12
|
-
"prepack": "yarn run -T
|
|
13
|
-
"postpack": "
|
|
12
|
+
"prepack": "yarn run -T prepack-package",
|
|
13
|
+
"postpack": "yarn run -T postpack-package",
|
|
14
14
|
"test": "ava",
|
|
15
15
|
"test:c8": "c8 --all ${C8_OPTIONS:-} ava",
|
|
16
16
|
"test:xs": "exit 0",
|
|
17
17
|
"lint-fix": "yarn lint:eslint --fix",
|
|
18
18
|
"lint": "yarn run -T run-s --continue-on-error 'lint:*'",
|
|
19
|
-
"lint:eslint": "
|
|
19
|
+
"lint:eslint": "node ../../scripts/eslint-repo.mjs .",
|
|
20
20
|
"lint:types": "yarn run -T tsc"
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@agoric/internal": "0.4.0",
|
|
37
|
-
"@agoric/vat-data": "0.6.0",
|
|
36
|
+
"@agoric/internal": "0.4.1-upgrade-23-dev-bd79330.0.bd79330",
|
|
37
|
+
"@agoric/vat-data": "0.6.1-upgrade-23-dev-bd79330.0.bd79330",
|
|
38
38
|
"@endo/errors": "^1.2.13",
|
|
39
39
|
"@endo/far": "^1.1.14",
|
|
40
40
|
"@endo/marshal": "^1.8.0",
|
|
@@ -42,18 +42,17 @@
|
|
|
42
42
|
"@endo/promise-kit": "^1.1.13"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@agoric/kmarshal": "0.2.0",
|
|
46
|
-
"@agoric/swing-store": "0.10.0",
|
|
47
|
-
"@agoric/swingset-liveslots": "0.11.0",
|
|
48
|
-
"@agoric/swingset-vat": "0.33.0",
|
|
45
|
+
"@agoric/kmarshal": "0.2.1-upgrade-23-dev-bd79330.0.bd79330",
|
|
46
|
+
"@agoric/swing-store": "0.10.1-upgrade-23-dev-bd79330.0.bd79330",
|
|
47
|
+
"@agoric/swingset-liveslots": "0.11.1-upgrade-23-dev-bd79330.0.bd79330",
|
|
48
|
+
"@agoric/swingset-vat": "0.33.1-upgrade-23-dev-bd79330.0.bd79330",
|
|
49
49
|
"@endo/init": "^1.1.12",
|
|
50
50
|
"@endo/ses-ava": "^1.3.2",
|
|
51
|
-
"ava": "^
|
|
51
|
+
"ava": "^6.4.1",
|
|
52
52
|
"c8": "^10.1.3"
|
|
53
53
|
},
|
|
54
54
|
"exports": {
|
|
55
55
|
".": "./src/index.js",
|
|
56
|
-
"./exported.js": "./exported.js",
|
|
57
56
|
"./subscribe.js": "./subscribe.js",
|
|
58
57
|
"./tools/testSupports.js": "./tools/testSupports.js"
|
|
59
58
|
},
|
|
@@ -78,5 +77,5 @@
|
|
|
78
77
|
"typeCoverage": {
|
|
79
78
|
"atLeast": 90.92
|
|
80
79
|
},
|
|
81
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "bd79330f78dae2faf9cc3d8b10063567700da07b"
|
|
82
81
|
}
|
|
@@ -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("../src/types.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("../src/types.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.js
CHANGED
package/src/notifier.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export function makeNotifierFromSubscriber<T>(subscriber: ERef<Subscriber<T>> |
|
|
|
3
3
|
export function makeNotifierKit<T>(...initialStateArr: [] | [T]): NotifierRecord<T>;
|
|
4
4
|
export function makeNotifierFromAsyncIterable<T>(asyncIterableP: ERef<AsyncIterable<T>>): Notifier<T>;
|
|
5
5
|
import type { LatestTopic } from './types.js';
|
|
6
|
+
import type { ERef } from '@agoric/vow';
|
|
6
7
|
import type { Notifier } from './types.js';
|
|
7
8
|
import type { Subscriber } from './types.js';
|
|
8
9
|
import type { Remote } from '@agoric/internal';
|
package/src/notifier.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifier.d.ts","sourceRoot":"","sources":["notifier.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notifier.d.ts","sourceRoot":"","sources":["notifier.js"],"names":[],"mappings":"AAmBO,6BAJM,CAAC,sBACH,KAAK,YAAY,CAAC,CAAC,CAAC,GAClB,SAAS,CAAC,CAAC,CAwBvB;AAOM,2CAJM,CAAC,cACH,KAAK,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,WAAW,CAAC,CAAC,CAAC,GACzC,SAAS,CAAC,CAAC,CAiBvB;AAoBM,gCAJM,CAAC,sBACH,EAAE,GAAG,CAAC,CAAC,CAAC,GACN,eAAe,CAAC,CAAC,CAsB7B;AAcM,8CAJM,CAAC,kBACH,KAAK,aAAa,CAAC,CAAC,CAAC,CAAC,GACpB,SAAS,CAAC,CAAC,CAuEvB;iCAhL6F,YAAY;0BACnF,aAAa;8BAD0D,YAAY;gCAAZ,YAAY;4BADjF,kBAAkB;oCACmD,YAAY"}
|
package/src/notifier.js
CHANGED
|
@@ -9,6 +9,7 @@ import { subscribeLatest } from './subscribe.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* @import {Remote} from '@agoric/internal';
|
|
11
11
|
* @import {LatestTopic, Notifier, NotifierRecord, PublishKit, Subscriber, UpdateRecord} from './types.js';
|
|
12
|
+
* @import {ERef} from '@agoric/vow';
|
|
12
13
|
*/
|
|
13
14
|
|
|
14
15
|
/**
|
package/src/publish-kit.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export const IterableLatestTopicI: import("@endo/patterns").InterfaceGuard<{
|
|
|
26
26
|
[Symbol.asyncIterator]: import("@endo/patterns").MethodGuard;
|
|
27
27
|
}>;
|
|
28
28
|
export function makePublishKit<T>(): PublishKit<T>;
|
|
29
|
-
export function prepareDurablePublishKit(baggage:
|
|
29
|
+
export function prepareDurablePublishKit(baggage: Baggage, kindName: string): <T>(options?: Parameters<typeof initDurablePublishKitState>[0]) => PublishKit<T>;
|
|
30
30
|
export const SubscriberShape: import("@endo/patterns").Matcher;
|
|
31
31
|
export type DurablePublishKitEphemeralKey = Publisher<any>;
|
|
32
32
|
export type DurablePublishKitEphemeralData = {
|
|
@@ -46,6 +46,7 @@ export type DurablePublishKitEphemeralData = {
|
|
|
46
46
|
tailR: ((value: any) => void) | undefined;
|
|
47
47
|
};
|
|
48
48
|
import type { PublishKit } from '../src/types.js';
|
|
49
|
+
import type { Baggage } from '@agoric/swingset-liveslots';
|
|
49
50
|
/**
|
|
50
51
|
* @param {object} [options]
|
|
51
52
|
* @param {DurablePublishKitValueDurability & 'mandatory'} [options.valueDurability]
|
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":"
|
|
1
|
+
{"version":3,"file":"publish-kit.d.ts","sourceRoot":"","sources":["publish-kit.js"],"names":[],"mappings":"AAwBA;;;;GAIG;AAGH,gEAA6D;AAC7D;;;GAGG;;;;;AAMH;;;;GAOE;AAEF;;;GAMG;AAEH;;;GAMG;AA+CI,+BA2CQ,CAAC,KA7CH,WAAW,CAAC,CAAC,CA4FzB;AA8MM,kDAJI,OAAO,YACP,MAAM,GACJ,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAwE5F;AAGD,+DAAyD;4CAhP3C,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;;gCAlPsI,iBAAiB;6BAC7K,4BAA4B;AA2MtD;;;;GAIG;AACH,sDAHG;IAAiE,eAAe;CAChF,GAAU,sBAAsB,CAmBlC;+BAlOqL,iBAAiB;4CAAjB,iBAAiB"}
|
package/src/publish-kit.js
CHANGED
|
@@ -9,6 +9,7 @@ import { canBeDurable, prepareExoClassKit } from '@agoric/vat-data';
|
|
|
9
9
|
/**
|
|
10
10
|
* @import {ERef} from '@endo/far';
|
|
11
11
|
* @import {DurablePublishKitState, DurablePublishKitValueDurability, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, Subscriber, UpdateRecord} from '../src/types.js';
|
|
12
|
+
* @import {Baggage} from '@agoric/swingset-liveslots';
|
|
12
13
|
*/
|
|
13
14
|
|
|
14
15
|
const sink = () => {};
|
|
@@ -400,7 +401,7 @@ const advanceDurablePublishKit = (context, value, targetStatus = 'live') => {
|
|
|
400
401
|
};
|
|
401
402
|
|
|
402
403
|
/**
|
|
403
|
-
* @param {
|
|
404
|
+
* @param {Baggage} baggage
|
|
404
405
|
* @param {string} kindName
|
|
405
406
|
* @returns {<T>(options?: Parameters<typeof initDurablePublishKitState>[0]) => PublishKit<T>}
|
|
406
407
|
*/
|
package/src/stored-notifier.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export function makeStoredNotifier<T extends PassableCap>(notifier: ERef<Notifier<T>>, storageNode:
|
|
1
|
+
export function makeStoredNotifier<T extends PassableCap>(notifier: ERef<Notifier<T>>, storageNode: ERemote<StorageNode>, marshaller: ERemote<EMarshaller>): StoredNotifier<T>;
|
|
2
2
|
export type StoredNotifier<T> = BaseNotifier<T> & Omit<StoredFacet, "getStoreKey">;
|
|
3
3
|
import type { PassableCap } from '@endo/pass-style';
|
|
4
4
|
import type { Notifier } from './types.js';
|
|
5
5
|
import type { ERef } from '@endo/far';
|
|
6
6
|
import type { StorageNode } from '@agoric/internal/src/lib-chainStorage.js';
|
|
7
|
-
import type {
|
|
7
|
+
import type { ERemote } from '@agoric/internal';
|
|
8
|
+
import type { EMarshaller } from '@agoric/internal/src/marshal/wrap-marshaller.js';
|
|
8
9
|
import type { BaseNotifier } from './types.js';
|
|
9
10
|
import type { StoredFacet } from '@agoric/internal/src/lib-chainStorage.js';
|
|
10
11
|
//# sourceMappingURL=stored-notifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stored-notifier.d.ts","sourceRoot":"","sources":["stored-notifier.js"],"names":[],"mappings":"AAkCO,mCANoB,CAAC,SAAf,WAAa,YACf,KAAK,SAAS,CAAC,CAAC,CAAC,eACjB,
|
|
1
|
+
{"version":3,"file":"stored-notifier.d.ts","sourceRoot":"","sources":["stored-notifier.js"],"names":[],"mappings":"AAkCO,mCANoB,CAAC,SAAf,WAAa,YACf,KAAK,SAAS,CAAC,CAAC,CAAC,eACjB,QAAQ,WAAW,CAAC,cACpB,QAAQ,WAAW,CAAC,GAClB,cAAc,CAAC,CAAC,CAAC,CAiC7B;2BAlDY,CAAC,IACD,aAAa,CAAC,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC;iCALjC,kBAAkB;8BAJP,YAAY;0BAD9B,WAAW;iCAIuB,0CAA0C;6BAFzE,kBAAkB;iCACd,iDAAiD;kCAFtC,YAAY;iCAGI,0CAA0C"}
|
package/src/stored-notifier.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// @jessie-check
|
|
2
|
-
|
|
3
1
|
import { assertAllDefined } from '@agoric/internal';
|
|
4
2
|
import { makeSerializeToStorage } from '@agoric/internal/src/lib-chainStorage.js';
|
|
5
3
|
import { E, Far } from '@endo/far';
|
|
@@ -8,8 +6,10 @@ import { observeNotifier } from './asyncIterableAdaptor.js';
|
|
|
8
6
|
/**
|
|
9
7
|
* @import {ERef} from '@endo/far';
|
|
10
8
|
* @import {BaseNotifier, Notifier} from './types.js';
|
|
11
|
-
* @import {
|
|
12
|
-
* @import {
|
|
9
|
+
* @import {ERemote} from '@agoric/internal';
|
|
10
|
+
* @import {EMarshaller} from '@agoric/internal/src/marshal/wrap-marshaller.js';
|
|
11
|
+
* @import {StoredFacet, StorageNode, Unserializer} from '@agoric/internal/src/lib-chainStorage.js';
|
|
12
|
+
* @import {PassableCap} from '@endo/pass-style';
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -28,8 +28,8 @@ import { observeNotifier } from './asyncIterableAdaptor.js';
|
|
|
28
28
|
*
|
|
29
29
|
* @template {PassableCap} T
|
|
30
30
|
* @param {ERef<Notifier<T>>} notifier
|
|
31
|
-
* @param {
|
|
32
|
-
* @param {
|
|
31
|
+
* @param {ERemote<StorageNode>} storageNode
|
|
32
|
+
* @param {ERemote<EMarshaller>} marshaller
|
|
33
33
|
* @returns {StoredNotifier<T>}
|
|
34
34
|
*/
|
|
35
35
|
export const makeStoredNotifier = (notifier, storageNode, marshaller) => {
|
package/src/storesub.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
export function forEachPublicationRecord<T>(subscriber: Subscriber<T>, consumeValue: (v: T) => void): Promise<void>;
|
|
2
|
-
export function makeStoredSubscriber<T extends
|
|
3
|
-
export function makeStoredSubscription<T>(subscription: Subscription<T>, storageNode?:
|
|
4
|
-
export function makeStoredPublisherKit<T = unknown>(storageNode?:
|
|
5
|
-
export function makeStoredPublishKit<T = unknown>(storageNode:
|
|
2
|
+
export function makeStoredSubscriber<T extends PassableCap>(subscriber: Subscriber<T>, storageNode: ERemote<StorageNode>, marshaller: ERemote<EMarshaller>): StoredSubscriber<T>;
|
|
3
|
+
export function makeStoredSubscription<T>(subscription: Subscription<T>, storageNode?: ERemote<StorageNode> | null, marshaller?: ERemote<EMarshaller>): StoredSubscription<T>;
|
|
4
|
+
export function makeStoredPublisherKit<T = unknown>(storageNode?: ERemote<StorageNode> | null, marshaller?: ERemote<EMarshaller>, childPath?: string): StoredPublisherKit<T>;
|
|
5
|
+
export function makeStoredPublishKit<T = unknown>(storageNode: ERemote<StorageNode>, marshaller: ERemote<EMarshaller>): StoredPublishKit<T>;
|
|
6
6
|
export type StoredPublisherKit<T> = {
|
|
7
7
|
subscriber: StoredSubscription<T>;
|
|
8
8
|
publisher: IterationObserver<T>;
|
|
9
9
|
};
|
|
10
10
|
import type { Subscriber } from '../src/types.js';
|
|
11
|
+
import type { PassableCap } from '@endo/marshal';
|
|
11
12
|
import type { StorageNode } from '@agoric/internal/src/lib-chainStorage.js';
|
|
12
|
-
import type {
|
|
13
|
-
import {
|
|
13
|
+
import type { ERemote } from '@agoric/internal';
|
|
14
|
+
import type { EMarshaller } from '@agoric/internal/src/marshal/wrap-marshaller.js';
|
|
14
15
|
import type { StoredSubscriber } from '../src/types.js';
|
|
15
16
|
import type { Subscription } from '../src/types.js';
|
|
16
17
|
import type { StoredSubscription } from '../src/types.js';
|
|
17
|
-
import type { Marshaller } from '@agoric/internal/src/lib-chainStorage.js';
|
|
18
18
|
import type { StoredPublishKit } from '../src/types.js';
|
|
19
19
|
import type { IterationObserver } from '../src/types.js';
|
|
20
20
|
//# sourceMappingURL=storesub.d.ts.map
|
package/src/storesub.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storesub.d.ts","sourceRoot":"","sources":["storesub.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storesub.d.ts","sourceRoot":"","sources":["storesub.js"],"names":[],"mappings":"AA0BO,yCAJM,CAAC,cACH,WAAW,CAAC,CAAC,gBACb,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,iBAcxB;AAiBM,qCANoB,CAAC,SAAf,WAAa,cACf,WAAW,CAAC,CAAC,eACb,QAAQ,WAAW,CAAC,cACpB,QAAQ,WAAW,CAAC,GAClB,iBAAiB,CAAC,CAAC,CA6B/B;AAkBM,uCANM,CAAC,gBACH,aAAa,CAAC,CAAC,gBACf,QAAQ,WAAW,CAAC,GAAG,IAAI,eAC3B,QAAQ,WAAW,CAAC,GAClB,mBAAmB,CAAC,CAAC,CAqEjC;AAoBM,uCANO,CAAC,0BACJ,QAAQ,WAAW,CAAC,GAAG,IAAI,eAC3B,QAAQ,WAAW,CAAC,cACpB,MAAM,GACJ,kBAAkB,CAAC,CAAC,CAAC,CAoBjC;AAgBM,qCALO,CAAC,yBACJ,QAAQ,WAAW,CAAC,cACpB,QAAQ,WAAW,CAAC,GAClB,iBAAiB,CAAC,CAAC,CAU/B;+BAzDY,CAAC;gBAEA,mBAAmB,CAAC,CAAC;eACrB,kBAAkB,CAAC,CAAC;;gCAnKmL,iBAAiB;iCAGxM,eAAe;iCAFD,0CAA0C;6BAH5D,kBAAkB;iCAId,iDAAiD;sCAFsI,iBAAiB;kCAAjB,iBAAiB;wCAAjB,iBAAiB;sCAAjB,iBAAiB;uCAAjB,iBAAiB"}
|
package/src/storesub.js
CHANGED
|
@@ -8,9 +8,12 @@ import { makeSubscriptionKit } from './subscriber.js';
|
|
|
8
8
|
import { subscribeEach } from './subscribe.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
+
* @import {ERemote} from '@agoric/internal';
|
|
11
12
|
* @import {ERef} from '@endo/far';
|
|
12
13
|
* @import {IterationObserver, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, StoredPublishKit, StoredSubscription, StoredSubscriber, Subscriber, Subscription, UpdateRecord} from '../src/types.js';
|
|
13
|
-
* @import {
|
|
14
|
+
* @import {StorageNode, Unserializer} from '@agoric/internal/src/lib-chainStorage.js';
|
|
15
|
+
* @import {EMarshaller} from '@agoric/internal/src/marshal/wrap-marshaller.js';
|
|
16
|
+
* @import {PassableCap} from '@endo/marshal';
|
|
14
17
|
*/
|
|
15
18
|
|
|
16
19
|
/**
|
|
@@ -44,10 +47,10 @@ export const forEachPublicationRecord = async (subscriber, consumeValue) => {
|
|
|
44
47
|
* the iteration themselves, or obtain information to subscribe to the stored
|
|
45
48
|
* data out-of-band.
|
|
46
49
|
*
|
|
47
|
-
* @template {
|
|
50
|
+
* @template {PassableCap} T
|
|
48
51
|
* @param {Subscriber<T>} subscriber
|
|
49
|
-
* @param {
|
|
50
|
-
* @param {
|
|
52
|
+
* @param {ERemote<StorageNode>} storageNode
|
|
53
|
+
* @param {ERemote<EMarshaller>} marshaller
|
|
51
54
|
* @returns {StoredSubscriber<T>}
|
|
52
55
|
*/
|
|
53
56
|
export const makeStoredSubscriber = (subscriber, storageNode, marshaller) => {
|
|
@@ -91,8 +94,8 @@ export const makeStoredSubscriber = (subscriber, storageNode, marshaller) => {
|
|
|
91
94
|
*
|
|
92
95
|
* @template T
|
|
93
96
|
* @param {Subscription<T>} subscription
|
|
94
|
-
* @param {
|
|
95
|
-
* @param {
|
|
97
|
+
* @param {ERemote<StorageNode> | null} [storageNode]
|
|
98
|
+
* @param {ERemote<EMarshaller>} [marshaller]
|
|
96
99
|
* @returns {StoredSubscription<T>}
|
|
97
100
|
*/
|
|
98
101
|
export const makeStoredSubscription = (
|
|
@@ -103,7 +106,7 @@ export const makeStoredSubscription = (
|
|
|
103
106
|
serializeBodyFormat: 'smallcaps',
|
|
104
107
|
}),
|
|
105
108
|
) => {
|
|
106
|
-
/** @type {
|
|
109
|
+
/** @type {Unserializer} */
|
|
107
110
|
const unserializer = Far('unserializer', {
|
|
108
111
|
fromCapData: data => E(marshaller).fromCapData(data),
|
|
109
112
|
unserialize: data => E(marshaller).fromCapData(data),
|
|
@@ -177,8 +180,8 @@ harden(makeStoredSubscription);
|
|
|
177
180
|
* @deprecated incompatible with durability; instead handle vstorage ephemerally on a durable PublishKit
|
|
178
181
|
*
|
|
179
182
|
* @template [T=unknown]
|
|
180
|
-
* @param {
|
|
181
|
-
* @param {
|
|
183
|
+
* @param {ERemote<StorageNode> | null} [storageNode]
|
|
184
|
+
* @param {ERemote<EMarshaller>} [marshaller]
|
|
182
185
|
* @param {string} [childPath]
|
|
183
186
|
* @returns {StoredPublisherKit<T>}
|
|
184
187
|
*/
|
|
@@ -212,8 +215,8 @@ export const makeStoredPublisherKit = (storageNode, marshaller, childPath) => {
|
|
|
212
215
|
* What's different is `subscriber` tees records, writing out to storageNode.
|
|
213
216
|
*
|
|
214
217
|
* @template [T=unknown]
|
|
215
|
-
* @param {
|
|
216
|
-
* @param {
|
|
218
|
+
* @param {ERemote<StorageNode>} storageNode
|
|
219
|
+
* @param {ERemote<EMarshaller>} marshaller
|
|
217
220
|
* @returns {StoredPublishKit<T>}
|
|
218
221
|
*/
|
|
219
222
|
export const makeStoredPublishKit = (storageNode, marshaller) => {
|
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]: () => /*elided*/ any & import("@endo/
|
|
3
|
+
[Symbol.asyncIterator]: () => /*elided*/ any & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, /*elided*/ any>;
|
|
4
4
|
next: () => Promise<IteratorResult<T, any>>;
|
|
5
|
-
} & import("@endo/
|
|
6
|
-
[Symbol.asyncIterator]: () => /*elided*/ any & import("@endo/
|
|
5
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
6
|
+
[Symbol.asyncIterator]: () => /*elided*/ any & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, /*elided*/ any>;
|
|
7
7
|
next: () => Promise<IteratorResult<T, any>>;
|
|
8
8
|
}>;
|
|
9
|
-
} & import("@endo/
|
|
9
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
10
10
|
[Symbol.asyncIterator]: () => {
|
|
11
|
-
[Symbol.asyncIterator]: () => /*elided*/ any & import("@endo/
|
|
11
|
+
[Symbol.asyncIterator]: () => /*elided*/ any & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, /*elided*/ any>;
|
|
12
12
|
next: () => Promise<IteratorResult<T, any>>;
|
|
13
|
-
} & import("@endo/
|
|
14
|
-
[Symbol.asyncIterator]: () => /*elided*/ any & import("@endo/
|
|
13
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
14
|
+
[Symbol.asyncIterator]: () => /*elided*/ any & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, /*elided*/ 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/marshal").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/marshal").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/subscribe.js
CHANGED
package/src/subscriber.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @import {EachTopic, IterationObserver, LatestTopic, Notifier, NotifierRecord, SubscriptionRecord, Publisher, PublishKit, StoredPublishKit, StoredSubscription, StoredSubscriber, Subscriber, Subscription, UpdateRecord} from '../src/types.js';
|
|
3
|
+
* @import {ERef} from '@agoric/vow';
|
|
3
4
|
*/
|
|
4
5
|
/**
|
|
5
6
|
* @template T
|
|
@@ -27,6 +28,7 @@ export function makeSubscription<T>(topic: ERef<EachTopic<T>>): Subscription<T>;
|
|
|
27
28
|
*/
|
|
28
29
|
export function makeSubscriptionKit<T>(): SubscriptionRecord<T>;
|
|
29
30
|
import type { EachTopic } from '../src/types.js';
|
|
31
|
+
import type { ERef } from '@agoric/vow';
|
|
30
32
|
import type { Subscription } from '../src/types.js';
|
|
31
33
|
import type { SubscriptionRecord } from '../src/types.js';
|
|
32
34
|
//# sourceMappingURL=subscriber.d.ts.map
|
package/src/subscriber.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriber.d.ts","sourceRoot":"","sources":["subscriber.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subscriber.d.ts","sourceRoot":"","sources":["subscriber.js"],"names":[],"mappings":"AAQA;;;GAGG;AAEH;;;;GAIG;AACH,iCAJa,CAAC,SACH,KAAK,UAAU,CAAC,CAAC,CAAC,GAChB,aAAa,CAAC,CAAC,CAkB3B;AAID;;;;;;;;;;;;;;;;;GAiBG;AACH,oCAHa,CAAC,KACD,mBAAmB,CAAC,CAAC,CAmBjC;+BAhEgO,iBAAiB;0BAC3N,aAAa;kCAD6L,iBAAiB;wCAAjB,iBAAiB"}
|
package/src/subscriber.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// @jessie-check
|
|
2
|
-
|
|
3
1
|
/// <reference types="ses" />
|
|
4
2
|
|
|
5
3
|
import { E, Far } from '@endo/far';
|
|
@@ -10,6 +8,7 @@ import { makePinnedHistoryTopic } from './topic.js';
|
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* @import {EachTopic, IterationObserver, LatestTopic, Notifier, NotifierRecord, SubscriptionRecord, Publisher, PublishKit, StoredPublishKit, StoredSubscription, StoredSubscriber, Subscriber, Subscription, UpdateRecord} from '../src/types.js';
|
|
11
|
+
* @import {ERef} from '@agoric/vow';
|
|
13
12
|
*/
|
|
14
13
|
|
|
15
14
|
/**
|
package/src/topic.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topic.d.ts","sourceRoot":"","sources":["topic.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"topic.d.ts","sourceRoot":"","sources":["topic.js"],"names":[],"mappings":"AAeO,uCALM,CAAC,SACH,UAAU,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,GAE3B,UAAU,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAoBzC;+BA9BwC,iBAAiB;iCAAjB,iBAAiB"}
|
package/src/topic.js
CHANGED
package/src/types.js
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* An AsyncIterator that can be forked at a given position
|
|
9
|
+
* into multiple independent ForkableAsyncIterators starting from that position.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* An AsyncIterable that produces ForkableAsyncIterators.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A valid sequence of calls to the methods of an `IterationObserver`
|
|
37
|
+
* represents an iteration. A valid sequence consists of any number of calls
|
|
38
|
+
* to `updateState` with the successive non-final values, followed by a
|
|
39
|
+
* final call to either `finish` with a successful `completion` value
|
|
40
|
+
* or `fail` with the alleged `reason` for failure. After at most one
|
|
41
|
+
* terminating calls, no further calls to these methods are valid and must be
|
|
42
|
+
* rejected.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Will be shared between machines, so it must be safe to expose. But software
|
|
51
|
+
* outside the current package should consider it opaque, not depending on its
|
|
52
|
+
* internal structure.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* An EachTopic with default asyncIterable behaviour.
|
|
74
|
+
*
|
|
75
|
+
* NOTE: the publication records and iterators returned by this object are
|
|
76
|
+
* ephemeral and will be severed during upgrade. A caller should use
|
|
77
|
+
* `subscribeEach` to wrap this topic in a local iterable which automatically
|
|
78
|
+
* attempts to reconnect upon being severed.
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* A LatestTopic with default asyncIterable behaviour.
|
|
83
|
+
*
|
|
84
|
+
* NOTE: the iterators returned by this object are ephemeral and will be severed
|
|
85
|
+
* during upgrade. A caller should use `subscribeLatest` to wrap this topic in
|
|
86
|
+
* a local iterable which automatically attempts to reconnect upon being
|
|
87
|
+
* severed.
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* This type is deprecated but is still
|
|
105
|
+
* used externally.
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* A stream of results that allows consumers to configure
|
|
110
|
+
* forward-lossless "each" iteration with `subscribeEach` and
|
|
111
|
+
* lossy "latest" iteration with `subscribeLatest`.
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* A valid sequence of calls to the methods of an `IterationObserver`
|
|
116
|
+
* represents an iteration. A valid sequence consists of any number of calls
|
|
117
|
+
* to `publish` with the successive non-final values, followed by a
|
|
118
|
+
* final call to either `finish` with a successful `completion` value
|
|
119
|
+
* or `fail` with the alleged `reason` for failure. After at most one
|
|
120
|
+
* terminating calls, no further calls to these methods are valid and must be
|
|
121
|
+
* rejected.
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Durability configures constraints on non-terminal values that can be
|
|
139
|
+
* published to a durable publish kit (terminal values sent to finish or fail
|
|
140
|
+
* must always be durable).
|
|
141
|
+
* - 'mandatory' means that each value must be durable, so it can be restored
|
|
142
|
+
* on upgrade.
|
|
143
|
+
* - 'opportunistic' means that a durable value is persisted for post-upgrade
|
|
144
|
+
* restoration, but a non-durable value is still accepted (and will result in
|
|
145
|
+
* valueless restoration).
|
|
146
|
+
* - 'ignored' means that a value is not persisted for restoration even if it
|
|
147
|
+
* is durable.
|
|
148
|
+
*
|
|
149
|
+
* 'mandatory' is the only currently-supported value, and others must not be
|
|
150
|
+
* enabled without test coverage.
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Will be shared between machines,
|
|
185
|
+
* so it must be safe to expose. But other software should avoid depending on
|
|
186
|
+
* its internal structure.
|
|
187
|
+
*/
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* an object that can be used to get the current state or updates
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* the produced notifier/updater pair
|
|
211
|
+
*/
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* A form of AsyncIterable supporting distributed and multicast usage.
|
|
224
|
+
*/
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
package/subscribe.js
CHANGED
package/exported.js
DELETED
package/src/types.ts
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
StoredFacet,
|
|
3
|
-
Unserializer,
|
|
4
|
-
VStorageKey,
|
|
5
|
-
} from '@agoric/internal/src/lib-chainStorage.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* An AsyncIterator that can be forked at a given position
|
|
9
|
-
* into multiple independent ForkableAsyncIterators starting from that position.
|
|
10
|
-
*/
|
|
11
|
-
export type ForkableAsyncIterator<
|
|
12
|
-
T,
|
|
13
|
-
TReturn = any,
|
|
14
|
-
TNext = undefined,
|
|
15
|
-
> = AsyncIterator<T, TReturn, TNext> & {
|
|
16
|
-
fork(): ForkableAsyncIterator<T, TReturn, TNext>;
|
|
17
|
-
};
|
|
18
|
-
export type AsyncIterableOnly<T, TReturn = any, TNext = undefined> = {
|
|
19
|
-
[Symbol.asyncIterator](): AsyncIterableIterator<T, TReturn, TNext>;
|
|
20
|
-
};
|
|
21
|
-
export type ForkableAsyncIterableIterator<
|
|
22
|
-
T,
|
|
23
|
-
TReturn = any,
|
|
24
|
-
TNext = undefined,
|
|
25
|
-
> = {
|
|
26
|
-
[Symbol.asyncIterator](): ForkableAsyncIterableIterator<T, TReturn, TNext>;
|
|
27
|
-
fork(): ForkableAsyncIterableIterator<T, TReturn, TNext>;
|
|
28
|
-
} & ForkableAsyncIterator<T, TReturn, TNext>;
|
|
29
|
-
/**
|
|
30
|
-
* An AsyncIterable that produces ForkableAsyncIterators.
|
|
31
|
-
*/
|
|
32
|
-
export type ForkableAsyncIterable<T, TReturn = any, TNext = undefined> = {
|
|
33
|
-
[Symbol.asyncIterator]: () => ForkableAsyncIterator<T, TReturn, TNext>;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* A valid sequence of calls to the methods of an `IterationObserver`
|
|
37
|
-
* represents an iteration. A valid sequence consists of any number of calls
|
|
38
|
-
* to `updateState` with the successive non-final values, followed by a
|
|
39
|
-
* final call to either `finish` with a successful `completion` value
|
|
40
|
-
* or `fail` with the alleged `reason` for failure. After at most one
|
|
41
|
-
* terminating calls, no further calls to these methods are valid and must be
|
|
42
|
-
* rejected.
|
|
43
|
-
*/
|
|
44
|
-
export type IterationObserver<T> = {
|
|
45
|
-
updateState: (nonFinalValue: T) => void;
|
|
46
|
-
finish: (completion: T) => void;
|
|
47
|
-
fail: (reason: unknown) => void;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Will be shared between machines, so it must be safe to expose. But software
|
|
51
|
-
* outside the current package should consider it opaque, not depending on its
|
|
52
|
-
* internal structure.
|
|
53
|
-
*/
|
|
54
|
-
export type PublicationRecord<T> = {
|
|
55
|
-
head: IteratorResult<T>;
|
|
56
|
-
/**
|
|
57
|
-
* starts at 1 for the first result
|
|
58
|
-
* and advances by 1 for each subsequent result
|
|
59
|
-
*/
|
|
60
|
-
publishCount: bigint;
|
|
61
|
-
tail: Promise<PublicationRecord<T>>;
|
|
62
|
-
};
|
|
63
|
-
export type EachTopic<T> = {
|
|
64
|
-
/**
|
|
65
|
-
* Returns a promise for a "current" PublicationRecord (referencing its
|
|
66
|
-
* immediate successor via a `tail` promise) that is later than the
|
|
67
|
-
* provided publishCount.
|
|
68
|
-
* Used to make forward-lossless ("each") iterators.
|
|
69
|
-
*/
|
|
70
|
-
subscribeAfter: (publishCount?: bigint) => Promise<PublicationRecord<T>>;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* An EachTopic with default asyncIterable behaviour.
|
|
74
|
-
*
|
|
75
|
-
* NOTE: the publication records and iterators returned by this object are
|
|
76
|
-
* ephemeral and will be severed during upgrade. A caller should use
|
|
77
|
-
* `subscribeEach` to wrap this topic in a local iterable which automatically
|
|
78
|
-
* attempts to reconnect upon being severed.
|
|
79
|
-
*/
|
|
80
|
-
export type IterableEachTopic<T> = ForkableAsyncIterable<T, T> & EachTopic<T>;
|
|
81
|
-
/**
|
|
82
|
-
* A LatestTopic with default asyncIterable behaviour.
|
|
83
|
-
*
|
|
84
|
-
* NOTE: the iterators returned by this object are ephemeral and will be severed
|
|
85
|
-
* during upgrade. A caller should use `subscribeLatest` to wrap this topic in
|
|
86
|
-
* a local iterable which automatically attempts to reconnect upon being
|
|
87
|
-
* severed.
|
|
88
|
-
*/
|
|
89
|
-
export type IterableLatestTopic<T> = AsyncIterableOnly<T, T> & LatestTopic<T>;
|
|
90
|
-
export type LatestTopic<T> = {
|
|
91
|
-
/**
|
|
92
|
-
* Returns a promise for an update record as of an update count.
|
|
93
|
-
* If the `updateCount` argument is omitted or differs from the current update count,
|
|
94
|
-
* the promise promptly resolves to the current record.
|
|
95
|
-
* Otherwise, after the next state change, the promise resolves to the resulting record.
|
|
96
|
-
* This is an attenuated form of `subscribeAfter` whose return value stands alone and
|
|
97
|
-
* does not allow consumers to pin a chain of historical PublicationRecords.
|
|
98
|
-
* Used to make lossy ("latest") iterators.
|
|
99
|
-
* NOTE: Use of `number` as an `updateCount` is deprecated.
|
|
100
|
-
*/
|
|
101
|
-
getUpdateSince: (updateCount?: bigint | number) => Promise<UpdateRecord<T>>;
|
|
102
|
-
};
|
|
103
|
-
/**
|
|
104
|
-
* This type is deprecated but is still
|
|
105
|
-
* used externally.
|
|
106
|
-
*/
|
|
107
|
-
export type BaseNotifier<T> = LatestTopic<T>;
|
|
108
|
-
/**
|
|
109
|
-
* A stream of results that allows consumers to configure
|
|
110
|
-
* forward-lossless "each" iteration with `subscribeEach` and
|
|
111
|
-
* lossy "latest" iteration with `subscribeLatest`.
|
|
112
|
-
*/
|
|
113
|
-
export type Subscriber<T> = LatestTopic<T> & EachTopic<T>;
|
|
114
|
-
/**
|
|
115
|
-
* A valid sequence of calls to the methods of an `IterationObserver`
|
|
116
|
-
* represents an iteration. A valid sequence consists of any number of calls
|
|
117
|
-
* to `publish` with the successive non-final values, followed by a
|
|
118
|
-
* final call to either `finish` with a successful `completion` value
|
|
119
|
-
* or `fail` with the alleged `reason` for failure. After at most one
|
|
120
|
-
* terminating calls, no further calls to these methods are valid and must be
|
|
121
|
-
* rejected.
|
|
122
|
-
*/
|
|
123
|
-
export type Publisher<T> = {
|
|
124
|
-
publish: (nonFinalValue: T) => void;
|
|
125
|
-
finish: (completion: T) => void;
|
|
126
|
-
fail: (reason: any) => void;
|
|
127
|
-
};
|
|
128
|
-
export type PublishObserver<T> = Partial<Publisher<T>>;
|
|
129
|
-
export type PublishKit<T> = {
|
|
130
|
-
publisher: Publisher<T>;
|
|
131
|
-
subscriber: Subscriber<T>;
|
|
132
|
-
};
|
|
133
|
-
export type StoredPublishKit<T> = {
|
|
134
|
-
publisher: Publisher<T>;
|
|
135
|
-
subscriber: StoredSubscriber<T>;
|
|
136
|
-
};
|
|
137
|
-
/**
|
|
138
|
-
* Durability configures constraints on non-terminal values that can be
|
|
139
|
-
* published to a durable publish kit (terminal values sent to finish or fail
|
|
140
|
-
* must always be durable).
|
|
141
|
-
* - 'mandatory' means that each value must be durable, so it can be restored
|
|
142
|
-
* on upgrade.
|
|
143
|
-
* - 'opportunistic' means that a durable value is persisted for post-upgrade
|
|
144
|
-
* restoration, but a non-durable value is still accepted (and will result in
|
|
145
|
-
* valueless restoration).
|
|
146
|
-
* - 'ignored' means that a value is not persisted for restoration even if it
|
|
147
|
-
* is durable.
|
|
148
|
-
*
|
|
149
|
-
* 'mandatory' is the only currently-supported value, and others must not be
|
|
150
|
-
* enabled without test coverage.
|
|
151
|
-
*/
|
|
152
|
-
export type DurablePublishKitValueDurability =
|
|
153
|
-
| 'mandatory'
|
|
154
|
-
| 'opportunistic'
|
|
155
|
-
| 'ignored';
|
|
156
|
-
export type DurablePublishKitState = {
|
|
157
|
-
valueDurability: DurablePublishKitValueDurability;
|
|
158
|
-
publishCount: bigint;
|
|
159
|
-
status: 'live' | 'finished' | 'failed';
|
|
160
|
-
/**
|
|
161
|
-
* hasValue indicates the presence of value. It starts off false,
|
|
162
|
-
* and can be reset to false when a durable publish kit is restored and
|
|
163
|
-
* the previous value was not durable, or non-terminal and valueDurablity is 'ignored'.
|
|
164
|
-
*/
|
|
165
|
-
hasValue: boolean;
|
|
166
|
-
/**
|
|
167
|
-
* value holds either a non-terminal value from `publish` or a terminal value
|
|
168
|
-
* from `finish` or `fail`, depending upon the value in status.
|
|
169
|
-
*/
|
|
170
|
-
value: any;
|
|
171
|
-
};
|
|
172
|
-
export type UpdateRecord<T> = {
|
|
173
|
-
/**
|
|
174
|
-
* is whatever state the service wants to publish
|
|
175
|
-
*/
|
|
176
|
-
value: T;
|
|
177
|
-
/**
|
|
178
|
-
* is a value that identifies the update. For
|
|
179
|
-
* the last update, it is `undefined`.
|
|
180
|
-
*/
|
|
181
|
-
updateCount?: bigint | undefined;
|
|
182
|
-
};
|
|
183
|
-
/**
|
|
184
|
-
* Will be shared between machines,
|
|
185
|
-
* so it must be safe to expose. But other software should avoid depending on
|
|
186
|
-
* its internal structure.
|
|
187
|
-
*/
|
|
188
|
-
export type NotifierInternals<T> = BaseNotifier<T>;
|
|
189
|
-
/**
|
|
190
|
-
* an object that can be used to get the current state or updates
|
|
191
|
-
*/
|
|
192
|
-
export type Notifier<T> = import('@endo/marshal').RemotableObject &
|
|
193
|
-
NotifierInternals<T> &
|
|
194
|
-
ForkableAsyncIterable<T, T> &
|
|
195
|
-
SharableNotifier<T>;
|
|
196
|
-
export type SharableNotifier<T> = {
|
|
197
|
-
/**
|
|
198
|
-
* Used to replicate the multicast values at other sites. To manually create a
|
|
199
|
-
* local representative of a Notification, do
|
|
200
|
-
* ```js
|
|
201
|
-
* localIterable =
|
|
202
|
-
* makeNotifier(E(remoteIterable).getSharableNotifierInternals());
|
|
203
|
-
* ```
|
|
204
|
-
* The resulting `localIterable` also supports such remote use, and
|
|
205
|
-
* will return access to the same representation.
|
|
206
|
-
*/
|
|
207
|
-
getSharableNotifierInternals: () => Promise<NotifierInternals<T>>;
|
|
208
|
-
};
|
|
209
|
-
/**
|
|
210
|
-
* the produced notifier/updater pair
|
|
211
|
-
*/
|
|
212
|
-
export type NotifierRecord<T> = {
|
|
213
|
-
/**
|
|
214
|
-
* the (closely-held) notifier producer
|
|
215
|
-
*/
|
|
216
|
-
updater: import('@endo/marshal').RemotableObject & IterationObserver<T>;
|
|
217
|
-
/**
|
|
218
|
-
* the (widely-held) notifier consumer
|
|
219
|
-
*/
|
|
220
|
-
notifier: Notifier<T>;
|
|
221
|
-
};
|
|
222
|
-
/**
|
|
223
|
-
* A form of AsyncIterable supporting distributed and multicast usage.
|
|
224
|
-
*/
|
|
225
|
-
export type Subscription<T> = IterableEachTopic<T> &
|
|
226
|
-
EachTopic<T> &
|
|
227
|
-
SharableSubscription<T>;
|
|
228
|
-
export type SharableSubscription<T> = {
|
|
229
|
-
/**
|
|
230
|
-
* Used to replicate the multicast values at other sites. To manually create a
|
|
231
|
-
* local representative of a Subscription, do
|
|
232
|
-
* ```js
|
|
233
|
-
* localIterable =
|
|
234
|
-
* makeSubscription(E(remoteIterable).getSharableSubscriptionInternals());
|
|
235
|
-
* ```
|
|
236
|
-
* The resulting `localIterable` also supports such remote use, and
|
|
237
|
-
* will return access to the same representation.
|
|
238
|
-
*/
|
|
239
|
-
getSharableSubscriptionInternals: () => Promise<EachTopic<T>>;
|
|
240
|
-
};
|
|
241
|
-
export type SubscriptionRecord<T> = {
|
|
242
|
-
publication: IterationObserver<T>;
|
|
243
|
-
subscription: Subscription<T>;
|
|
244
|
-
};
|
|
245
|
-
export type StoredSubscription<T> = Subscription<T> & {
|
|
246
|
-
getStoreKey: () => Promise<
|
|
247
|
-
VStorageKey & {
|
|
248
|
-
subscription: Subscription<T>;
|
|
249
|
-
}
|
|
250
|
-
>;
|
|
251
|
-
getUnserializer: () => Unserializer;
|
|
252
|
-
};
|
|
253
|
-
export type StoredSubscriber<T> = Subscriber<T> & StoredFacet;
|