@agoric/notifier 0.6.3-other-dev-8f8782b.0 → 0.6.3-other-dev-fbe72e7.0.fbe72e7
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/README.md +1 -1
- package/exported.js +2 -3
- package/package.json +31 -23
- package/src/asyncIterableAdaptor.d.ts +11 -4
- package/src/asyncIterableAdaptor.d.ts.map +1 -1
- package/src/asyncIterableAdaptor.js +5 -2
- package/src/index.d.ts +2 -0
- package/src/index.js +5 -0
- package/src/notifier.d.ts +6 -1
- package/src/notifier.d.ts.map +1 -1
- package/src/notifier.js +8 -4
- package/src/publish-kit.d.ts +35 -28
- package/src/publish-kit.d.ts.map +1 -1
- package/src/publish-kit.js +16 -14
- package/src/stored-notifier.d.ts +9 -2
- package/src/stored-notifier.d.ts.map +1 -1
- package/src/stored-notifier.js +8 -1
- package/src/storesub.d.ts +13 -9
- package/src/storesub.d.ts.map +1 -1
- package/src/storesub.js +10 -5
- package/src/subscribe.d.ts +17 -13
- package/src/subscribe.d.ts.map +1 -1
- package/src/subscribe.js +9 -7
- package/src/subscriber.d.ts +6 -0
- package/src/subscriber.d.ts.map +1 -1
- package/src/subscriber.js +4 -2
- package/src/topic.d.ts +2 -0
- package/src/topic.d.ts.map +1 -1
- package/src/topic.js +5 -2
- package/src/types-index.d.ts +2 -0
- package/src/types-index.js +2 -0
- package/src/types.d.ts +5 -75
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +253 -0
- package/tools/testSupports.d.ts +7 -5
- package/tools/testSupports.d.ts.map +1 -1
- package/tools/testSupports.js +4 -2
- package/CHANGELOG.md +0 -578
- package/src/types-ambient.d.ts +0 -301
- package/src/types-ambient.d.ts.map +0 -1
- package/src/types-ambient.js +0 -346
- package/src/types.js +0 -347
package/README.md
CHANGED
|
@@ -182,7 +182,7 @@ time of calling `fork()`.
|
|
|
182
182
|
Carol's code is like Bob's except lower level, using the ForkableAsyncIterable interface directly.
|
|
183
183
|
|
|
184
184
|
```js
|
|
185
|
-
import { makePromiseKit } from '@
|
|
185
|
+
import { makePromiseKit } from '@endo/promise-kit';
|
|
186
186
|
|
|
187
187
|
const subscriptionIterator = subscription[Symbol.asyncIterator]();
|
|
188
188
|
const { promise: afterA, resolve: afterAResolve } = makePromiseKit();
|
package/exported.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
import './src/types-ambient.js';
|
|
1
|
+
// Dummy file for .d.ts twin to declare ambients
|
|
2
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/notifier",
|
|
3
|
-
"version": "0.6.3-other-dev-
|
|
3
|
+
"version": "0.6.3-other-dev-fbe72e7.0.fbe72e7",
|
|
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",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": "
|
|
8
|
+
"node": "^20.9 || ^22.11"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "exit 0",
|
|
12
|
-
"prepack": "
|
|
13
|
-
"postpack": "git clean -f '*.d
|
|
12
|
+
"prepack": "yarn run -T tsc --build tsconfig.build.json",
|
|
13
|
+
"postpack": "git clean -f '*.d.*ts*' '*.tsbuildinfo'",
|
|
14
14
|
"test": "ava",
|
|
15
|
-
"test:c8": "c8 $C8_OPTIONS ava
|
|
15
|
+
"test:c8": "c8 --all ${C8_OPTIONS:-} ava",
|
|
16
16
|
"test:xs": "exit 0",
|
|
17
17
|
"lint-fix": "yarn lint:eslint --fix",
|
|
18
|
-
"lint": "run-s --continue-on-error lint:*",
|
|
19
|
-
"lint:eslint": "eslint .",
|
|
20
|
-
"lint:types": "
|
|
18
|
+
"lint": "yarn run -T run-s --continue-on-error 'lint:*'",
|
|
19
|
+
"lint:eslint": "yarn run -T eslint .",
|
|
20
|
+
"lint:types": "yarn run -T tsc"
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
@@ -33,21 +33,23 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@agoric/
|
|
37
|
-
"@agoric/
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@endo/
|
|
43
|
-
"@endo/marshal": "0.8.5",
|
|
44
|
-
"@endo/promise-kit": "0.2.56"
|
|
36
|
+
"@agoric/internal": "0.3.3-other-dev-fbe72e7.0.fbe72e7",
|
|
37
|
+
"@agoric/vat-data": "0.5.3-other-dev-fbe72e7.0.fbe72e7",
|
|
38
|
+
"@endo/errors": "^1.2.13",
|
|
39
|
+
"@endo/far": "^1.1.14",
|
|
40
|
+
"@endo/marshal": "^1.8.0",
|
|
41
|
+
"@endo/patterns": "^1.7.0",
|
|
42
|
+
"@endo/promise-kit": "^1.1.13"
|
|
45
43
|
},
|
|
46
44
|
"devDependencies": {
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
50
|
-
"
|
|
45
|
+
"@agoric/kmarshal": "0.1.1-other-dev-fbe72e7.0.fbe72e7",
|
|
46
|
+
"@agoric/swing-store": "0.9.2-other-dev-fbe72e7.0.fbe72e7",
|
|
47
|
+
"@agoric/swingset-liveslots": "0.10.3-other-dev-fbe72e7.0.fbe72e7",
|
|
48
|
+
"@agoric/swingset-vat": "0.32.3-other-dev-fbe72e7.0.fbe72e7",
|
|
49
|
+
"@endo/init": "^1.1.12",
|
|
50
|
+
"@endo/ses-ava": "^1.3.2",
|
|
51
|
+
"ava": "^5.3.0",
|
|
52
|
+
"c8": "^10.1.3"
|
|
51
53
|
},
|
|
52
54
|
"exports": {
|
|
53
55
|
".": "./src/index.js",
|
|
@@ -66,9 +68,15 @@
|
|
|
66
68
|
},
|
|
67
69
|
"ava": {
|
|
68
70
|
"files": [
|
|
69
|
-
"test
|
|
71
|
+
"test/**/*.test.*"
|
|
72
|
+
],
|
|
73
|
+
"require": [
|
|
74
|
+
"@endo/init/debug.js"
|
|
70
75
|
],
|
|
71
76
|
"timeout": "2m"
|
|
72
77
|
},
|
|
73
|
-
"
|
|
78
|
+
"typeCoverage": {
|
|
79
|
+
"atLeast": 90.92
|
|
80
|
+
},
|
|
81
|
+
"gitHead": "fbe72e72107f9997f788674e668c660d92ec4492"
|
|
74
82
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {ERef} from '@endo/far';
|
|
3
|
+
* @import {BaseNotifier, IterationObserver, LatestTopic} from '../src/types.js';
|
|
4
|
+
*/
|
|
1
5
|
/**
|
|
2
6
|
* @deprecated Use `subscribeLatest` from `@agoric/notifier/subscribe.js` instead.
|
|
3
7
|
*
|
|
@@ -30,11 +34,14 @@
|
|
|
30
34
|
* @returns {ForkableAsyncIterable<T>}
|
|
31
35
|
*/
|
|
32
36
|
export const makeAsyncIterableFromNotifier: <T_1>(topic: ERef<LatestTopic<T_1>>) => {
|
|
33
|
-
[Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T_1, T_1
|
|
34
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
35
|
-
[Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T_1, T_1
|
|
37
|
+
[Symbol.asyncIterator]: () => import("./types-index.js").ForkableAsyncIterableIterator<T_1, T_1>;
|
|
38
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
39
|
+
[Symbol.asyncIterator]: () => import("./types-index.js").ForkableAsyncIterableIterator<T_1, T_1>;
|
|
36
40
|
}>;
|
|
37
|
-
export function observeIterator<T_1>(asyncIteratorP: ERef<AsyncIterator<T_1
|
|
41
|
+
export function observeIterator<T_1>(asyncIteratorP: ERef<AsyncIterator<T_1>>, iterationObserver: Partial<IterationObserver<T_1>>): Promise<undefined>;
|
|
38
42
|
export function observeIteration<T_1>(asyncIterableP: ERef<AsyncIterable<T_1>>, iterationObserver: Partial<IterationObserver<T_1>>): Promise<undefined>;
|
|
39
43
|
export function observeNotifier<T_1>(notifierP: ERef<LatestTopic<T_1>>, iterationObserver: Partial<IterationObserver<T_1>>): Promise<undefined>;
|
|
44
|
+
import type { LatestTopic } from '../src/types.js';
|
|
45
|
+
import type { ERef } from '@endo/far';
|
|
46
|
+
import type { IterationObserver } from '../src/types.js';
|
|
40
47
|
//# sourceMappingURL=asyncIterableAdaptor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asyncIterableAdaptor.d.ts","sourceRoot":"","sources":["asyncIterableAdaptor.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"asyncIterableAdaptor.d.ts","sourceRoot":"","sources":["asyncIterableAdaptor.js"],"names":[],"mappings":"AAKA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH;;;;GAA6D;AAatD,qDAJI,KAAK,aAAa,CAAC,GAAC,CAAC,CAAC,qBACtB,OAAO,CAAC,kBAAkB,GAAC,CAAC,CAAC,GAC3B,OAAO,CAAC,SAAS,CAAC,CAyB9B;AAaM,sDAJI,KAAK,aAAa,CAAC,GAAC,CAAC,CAAC,qBACtB,OAAO,CAAC,kBAAkB,GAAC,CAAC,CAAC,GAC3B,OAAO,CAAC,SAAS,CAAC,CAK9B;AAaM,gDAJI,KAAK,YAAY,GAAC,CAAC,CAAC,qBACpB,OAAO,CAAC,kBAAkB,GAAC,CAAC,CAAC,GAC3B,OAAO,CAAC,SAAS,CAAC,CAGkC;iCApGF,iBAAiB;0BADzD,WAAW;uCAC6B,iBAAiB"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
/// <reference types="ses"/>
|
|
1
|
+
/// <reference types="ses" />
|
|
2
2
|
|
|
3
3
|
import { E } from '@endo/far';
|
|
4
4
|
import { subscribeLatest } from './subscribe.js';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @import {ERef} from '@endo/far';
|
|
8
|
+
* @import {BaseNotifier, IterationObserver, LatestTopic} from '../src/types.js';
|
|
9
|
+
*/
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
* @deprecated Use `subscribeLatest` from `@agoric/notifier/subscribe.js` instead.
|
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
export { makePinnedHistoryTopic } from "./topic.js";
|
|
1
2
|
export * from "./storesub.js";
|
|
2
3
|
export * from "./stored-notifier.js";
|
|
4
|
+
export * from "./types-index.js";
|
|
3
5
|
export { makePublishKit, prepareDurablePublishKit, ForkableAsyncIterableIteratorShape, IterableEachTopicI, IterableLatestTopicI, SubscriberShape } from "./publish-kit.js";
|
|
4
6
|
export { subscribeEach, subscribeLatest } from "./subscribe.js";
|
|
5
7
|
export { makeNotifier, makeNotifierKit, makeNotifierFromAsyncIterable, makeNotifierFromSubscriber } from "./notifier.js";
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
|
+
/// <reference types="@agoric/internal/exported" />
|
|
2
3
|
|
|
3
4
|
export {
|
|
4
5
|
makePublishKit,
|
|
@@ -16,6 +17,7 @@ export {
|
|
|
16
17
|
makeNotifierFromSubscriber,
|
|
17
18
|
} from './notifier.js';
|
|
18
19
|
export { makeSubscription, makeSubscriptionKit } from './subscriber.js';
|
|
20
|
+
export { makePinnedHistoryTopic } from './topic.js';
|
|
19
21
|
export {
|
|
20
22
|
observeNotifier,
|
|
21
23
|
observeIterator,
|
|
@@ -25,3 +27,6 @@ export {
|
|
|
25
27
|
} from './asyncIterableAdaptor.js';
|
|
26
28
|
export * from './storesub.js';
|
|
27
29
|
export * from './stored-notifier.js';
|
|
30
|
+
|
|
31
|
+
// eslint-disable-next-line import/export
|
|
32
|
+
export * from './types-index.js'; // no named exports in JS
|
package/src/notifier.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export function makeNotifier<T>(sharableInternalsP: ERef<LatestTopic<T>>): Notifier<T>;
|
|
2
|
-
export function makeNotifierFromSubscriber<T>(subscriber: ERef<Subscriber<T>>): Notifier<T>;
|
|
2
|
+
export function makeNotifierFromSubscriber<T>(subscriber: ERef<Subscriber<T>> | Remote<Subscriber<T>>): Notifier<T>;
|
|
3
3
|
export function makeNotifierKit<T>(...initialStateArr: [] | [T]): NotifierRecord<T>;
|
|
4
4
|
export function makeNotifierFromAsyncIterable<T>(asyncIterableP: ERef<AsyncIterable<T>>): Notifier<T>;
|
|
5
|
+
import type { LatestTopic } from './types.js';
|
|
6
|
+
import type { Notifier } from './types.js';
|
|
7
|
+
import type { Subscriber } from './types.js';
|
|
8
|
+
import type { Remote } from '@agoric/internal';
|
|
9
|
+
import type { NotifierRecord } from './types.js';
|
|
5
10
|
//# sourceMappingURL=notifier.d.ts.map
|
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":"AAkBO,6BAJM,CAAC,sBACH,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,GAClB,SAAS,CAAC,CAAC,CAwBvB;AAOM,2CAJM,CAAC,cACH,IAAI,CAAC,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,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GACpB,SAAS,CAAC,CAAC,CAuEvB;iCA/K6F,YAAY;8BAAZ,YAAY;gCAAZ,YAAY;4BADjF,kBAAkB;oCACmD,YAAY"}
|
package/src/notifier.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
/// <reference types="ses"/>
|
|
1
|
+
/// <reference types="ses" />
|
|
2
2
|
|
|
3
|
-
import { assert } from '@
|
|
3
|
+
import { assert } from '@endo/errors';
|
|
4
4
|
import { E, Far } from '@endo/far';
|
|
5
5
|
|
|
6
|
-
import './types-ambient.js';
|
|
7
6
|
import { makePublishKit } from './publish-kit.js';
|
|
8
7
|
import { subscribeLatest } from './subscribe.js';
|
|
9
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @import {Remote} from '@agoric/internal';
|
|
11
|
+
* @import {LatestTopic, Notifier, NotifierRecord, PublishKit, Subscriber, UpdateRecord} from './types.js';
|
|
12
|
+
*/
|
|
13
|
+
|
|
10
14
|
/**
|
|
11
15
|
* @template T
|
|
12
16
|
* @param {ERef<LatestTopic<T>>} sharableInternalsP
|
|
@@ -38,7 +42,7 @@ export const makeNotifier = sharableInternalsP => {
|
|
|
38
42
|
|
|
39
43
|
/**
|
|
40
44
|
* @template T
|
|
41
|
-
* @param {ERef<Subscriber<T>>} subscriber
|
|
45
|
+
* @param {ERef<Subscriber<T>> | Remote<Subscriber<T>>} subscriber
|
|
42
46
|
* @returns {Notifier<T>}
|
|
43
47
|
*/
|
|
44
48
|
export const makeNotifierFromSubscriber = subscriber => {
|
package/src/publish-kit.d.ts
CHANGED
|
@@ -1,37 +1,32 @@
|
|
|
1
|
-
export const PublisherI: import("@endo/patterns").InterfaceGuard
|
|
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
|
+
}>;
|
|
2
6
|
export const UpdateCountShape: import("@endo/patterns").Matcher;
|
|
3
|
-
export const SubscriberI: import("@endo/patterns").InterfaceGuard
|
|
7
|
+
export const SubscriberI: import("@endo/patterns").InterfaceGuard<{
|
|
8
|
+
subscribeAfter: import("@endo/patterns").MethodGuard;
|
|
9
|
+
getUpdateSince: import("@endo/patterns").MethodGuard;
|
|
10
|
+
}>;
|
|
4
11
|
export namespace publishKitIKit {
|
|
5
12
|
export { PublisherI as publisher };
|
|
6
13
|
export { SubscriberI as subscriber };
|
|
7
14
|
}
|
|
8
|
-
export const ForkableAsyncIterableIteratorShape: import("@endo/patterns").InterfaceGuard
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export function prepareDurablePublishKit(baggage: MapStore<string, unknown>, kindName: string): (options?: {
|
|
13
|
-
valueDurability?: "mandatory" | undefined;
|
|
14
|
-
} | undefined) => {
|
|
15
|
-
publisher: {
|
|
16
|
-
publish(value: any): void;
|
|
17
|
-
finish(finalValue: any): void;
|
|
18
|
-
fail(reason: any): void;
|
|
19
|
-
};
|
|
20
|
-
subscriber: {
|
|
21
|
-
subscribeAfter(publishCount?: bigint): Promise<any>;
|
|
22
|
-
getUpdateSince(updateCount: any): any;
|
|
23
|
-
};
|
|
24
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
25
|
-
publisher: {
|
|
26
|
-
publish(value: any): void;
|
|
27
|
-
finish(finalValue: any): void;
|
|
28
|
-
fail(reason: any): void;
|
|
29
|
-
};
|
|
30
|
-
subscriber: {
|
|
31
|
-
subscribeAfter(publishCount?: bigint): Promise<any>;
|
|
32
|
-
getUpdateSince(updateCount: any): any;
|
|
33
|
-
};
|
|
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;
|
|
34
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: import("@agoric/swingset-liveslots").Baggage, kindName: string): <T>(options?: Parameters<typeof initDurablePublishKitState>[0]) => PublishKit<T>;
|
|
35
30
|
export const SubscriberShape: import("@endo/patterns").Matcher;
|
|
36
31
|
export type DurablePublishKitEphemeralKey = Publisher<any>;
|
|
37
32
|
export type DurablePublishKitEphemeralData = {
|
|
@@ -50,4 +45,16 @@ export type DurablePublishKitEphemeralData = {
|
|
|
50
45
|
*/
|
|
51
46
|
tailR: ((value: any) => void) | undefined;
|
|
52
47
|
};
|
|
48
|
+
import type { PublishKit } from '../src/types.js';
|
|
49
|
+
/**
|
|
50
|
+
* @param {object} [options]
|
|
51
|
+
* @param {DurablePublishKitValueDurability & 'mandatory'} [options.valueDurability]
|
|
52
|
+
* @returns {DurablePublishKitState}
|
|
53
|
+
*/
|
|
54
|
+
declare function initDurablePublishKitState(options?: {
|
|
55
|
+
valueDurability?: "mandatory" | undefined;
|
|
56
|
+
}): DurablePublishKitState;
|
|
57
|
+
import type { Publisher } from '../src/types.js';
|
|
58
|
+
import type { DurablePublishKitState } from '../src/types.js';
|
|
59
|
+
export {};
|
|
53
60
|
//# sourceMappingURL=publish-kit.d.ts.map
|
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":"AAuBA;;;;GAIG;AAGH,gEAA6D;AAC7D;;;GAGG;;;;;AAMH;;;;GAOE;AAEF;;;GAMG;AAEH;;;GAMG;AA+CI,+BA2CQ,CAAC,KA7CH,WAAW,CAAC,CAAC,CA4FzB;AA8MM,kDAJI,OAAO,4BAA4B,EAAE,OAAO,YAC5C,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;;gCAjPsI,iBAAiB;AA2MvM;;;;GAIG;AACH,sDAHG;IAAiE,eAAe;CAChF,GAAU,sBAAsB,CAmBlC;+BAjOqL,iBAAiB;4CAAjB,iBAAiB"}
|
package/src/publish-kit.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
/// <reference types="ses"/>
|
|
1
|
+
/// <reference types="ses" />
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Fail, q } from '@endo/errors';
|
|
4
4
|
import { E, Far } from '@endo/far';
|
|
5
|
-
import {
|
|
5
|
+
import { makePromiseKit } from '@endo/promise-kit';
|
|
6
|
+
import { M, getInterfaceGuardPayload } from '@endo/patterns';
|
|
6
7
|
import { canBeDurable, prepareExoClassKit } from '@agoric/vat-data';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @import {ERef} from '@endo/far';
|
|
11
|
+
* @import {DurablePublishKitState, DurablePublishKitValueDurability, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, Subscriber, UpdateRecord} from '../src/types.js';
|
|
12
|
+
*/
|
|
11
13
|
|
|
12
14
|
const sink = () => {};
|
|
13
15
|
const makeQuietRejection = reason => {
|
|
@@ -16,7 +18,7 @@ const makeQuietRejection = reason => {
|
|
|
16
18
|
return rejection;
|
|
17
19
|
};
|
|
18
20
|
const tooFarRejection = makeQuietRejection(
|
|
19
|
-
harden(
|
|
21
|
+
harden(Error('Cannot read past end of iteration.')),
|
|
20
22
|
);
|
|
21
23
|
|
|
22
24
|
export const PublisherI = M.interface('Publisher', {
|
|
@@ -46,14 +48,16 @@ export const ForkableAsyncIterableIteratorShape = M.interface(
|
|
|
46
48
|
);
|
|
47
49
|
|
|
48
50
|
export const IterableEachTopicI = M.interface('IterableEachTopic', {
|
|
49
|
-
subscribeAfter:
|
|
51
|
+
subscribeAfter:
|
|
52
|
+
getInterfaceGuardPayload(SubscriberI).methodGuards.subscribeAfter,
|
|
50
53
|
[Symbol.asyncIterator]: M.call().returns(
|
|
51
54
|
M.remotable('ForkableAsyncIterableIterator'),
|
|
52
55
|
),
|
|
53
56
|
});
|
|
54
57
|
|
|
55
58
|
export const IterableLatestTopicI = M.interface('IterableLatestTopic', {
|
|
56
|
-
getUpdateSince:
|
|
59
|
+
getUpdateSince:
|
|
60
|
+
getInterfaceGuardPayload(SubscriberI).methodGuards.getUpdateSince,
|
|
57
61
|
[Symbol.asyncIterator]: M.call().returns(
|
|
58
62
|
M.remotable('ForkableAsyncIterableIterator'),
|
|
59
63
|
),
|
|
@@ -209,7 +213,7 @@ const DurablePublishKitStateShape = harden({
|
|
|
209
213
|
|
|
210
214
|
/**
|
|
211
215
|
* @param {object} [options]
|
|
212
|
-
* @param {DurablePublishKitValueDurability & 'mandatory'} [options.valueDurability
|
|
216
|
+
* @param {DurablePublishKitValueDurability & 'mandatory'} [options.valueDurability]
|
|
213
217
|
* @returns {DurablePublishKitState}
|
|
214
218
|
*/
|
|
215
219
|
const initDurablePublishKitState = (options = {}) => {
|
|
@@ -396,17 +400,15 @@ const advanceDurablePublishKit = (context, value, targetStatus = 'live') => {
|
|
|
396
400
|
};
|
|
397
401
|
|
|
398
402
|
/**
|
|
399
|
-
* @param {import('
|
|
403
|
+
* @param {import('@agoric/swingset-liveslots').Baggage} baggage
|
|
400
404
|
* @param {string} kindName
|
|
405
|
+
* @returns {<T>(options?: Parameters<typeof initDurablePublishKitState>[0]) => PublishKit<T>}
|
|
401
406
|
*/
|
|
402
407
|
export const prepareDurablePublishKit = (baggage, kindName) => {
|
|
403
408
|
// TODO: Once we unify with makePublishKit, we will use a Zone-compatible weak
|
|
404
409
|
// map for memoization.
|
|
405
410
|
const makeMemoizedUpdateRecord = makeUpdateRecordFromPublicationRecord;
|
|
406
411
|
|
|
407
|
-
/**
|
|
408
|
-
* @returns {() => PublishKit<*>}
|
|
409
|
-
*/
|
|
410
412
|
return prepareExoClassKit(
|
|
411
413
|
baggage,
|
|
412
414
|
kindName,
|
package/src/stored-notifier.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
export function makeStoredNotifier<T>(notifier: ERef<Notifier<T>>, storageNode: ERef<StorageNode>, marshaller: ERef<Marshaller>): StoredNotifier<T>;
|
|
2
|
-
export type StoredNotifier<T> = BaseNotifier<T> & Omit<StoredFacet,
|
|
1
|
+
export function makeStoredNotifier<T extends PassableCap>(notifier: ERef<Notifier<T>>, storageNode: ERef<StorageNode>, marshaller: ERef<Marshaller>): StoredNotifier<T>;
|
|
2
|
+
export type StoredNotifier<T> = BaseNotifier<T> & Omit<StoredFacet, "getStoreKey">;
|
|
3
|
+
import type { PassableCap } from '@endo/pass-style';
|
|
4
|
+
import type { Notifier } from './types.js';
|
|
5
|
+
import type { ERef } from '@endo/far';
|
|
6
|
+
import type { StorageNode } from '@agoric/internal/src/lib-chainStorage.js';
|
|
7
|
+
import type { Marshaller } from '@agoric/internal/src/lib-chainStorage.js';
|
|
8
|
+
import type { BaseNotifier } from './types.js';
|
|
9
|
+
import type { StoredFacet } from '@agoric/internal/src/lib-chainStorage.js';
|
|
3
10
|
//# sourceMappingURL=stored-notifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stored-notifier.d.ts","sourceRoot":"","sources":["stored-notifier.js"],"names":[],"mappings":"
|
|
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,KAAK,WAAW,CAAC,cACjB,KAAK,UAAU,CAAC,GACd,cAAc,CAAC,CAAC,CAAC,CAiC7B;2BAlDY,CAAC,IACD,aAAa,CAAC,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC;iCALhB,kBAAkB;8BAFxB,YAAY;0BAD9B,WAAW;iCAEmC,0CAA0C;gCAA1C,0CAA0C;kCADtE,YAAY;iCACgB,0CAA0C"}
|
package/src/stored-notifier.js
CHANGED
|
@@ -5,6 +5,13 @@ import { makeSerializeToStorage } from '@agoric/internal/src/lib-chainStorage.js
|
|
|
5
5
|
import { E, Far } from '@endo/far';
|
|
6
6
|
import { observeNotifier } from './asyncIterableAdaptor.js';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @import {ERef} from '@endo/far';
|
|
10
|
+
* @import {BaseNotifier, Notifier} from './types.js';
|
|
11
|
+
* @import {Marshaller, StoredFacet, StorageNode, Unserializer} from '@agoric/internal/src/lib-chainStorage.js';
|
|
12
|
+
* @import {PassableCap, RemotableObject} from '@endo/pass-style';
|
|
13
|
+
*/
|
|
14
|
+
|
|
8
15
|
/**
|
|
9
16
|
* @template T
|
|
10
17
|
* @typedef {BaseNotifier<T> & Omit<StoredFacet, 'getStoreKey'>} StoredNotifier
|
|
@@ -19,7 +26,7 @@ import { observeNotifier } from './asyncIterableAdaptor.js';
|
|
|
19
26
|
* the iteration themselves, or obtain information to subscribe to the stored
|
|
20
27
|
* data out-of-band.
|
|
21
28
|
*
|
|
22
|
-
* @template T
|
|
29
|
+
* @template {PassableCap} T
|
|
23
30
|
* @param {ERef<Notifier<T>>} notifier
|
|
24
31
|
* @param {ERef<StorageNode>} storageNode
|
|
25
32
|
* @param {ERef<Marshaller>} marshaller
|
package/src/storesub.d.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
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<ReturnType<typeof makeMarshal>>): StoredSubscriber<T>;
|
|
3
|
-
export function makeStoredSubscription<T>(subscription: Subscription<T>, storageNode?: ERef<StorageNode
|
|
4
|
-
|
|
5
|
-
fromCapData: import("@endo/marshal/src/marshal.js").FromCapData<unknown>;
|
|
6
|
-
serialize: import("@endo/marshal/src/marshal.js").ToCapData<unknown>;
|
|
7
|
-
unserialize: import("@endo/marshal/src/marshal.js").FromCapData<unknown>;
|
|
8
|
-
}> | undefined): StoredSubscription<T>;
|
|
9
|
-
export function makeStoredPublisherKit<T = unknown>(storageNode?: ERef<StorageNode> | undefined, marshaller?: ERef<Marshaller<unknown>> | undefined, childPath?: string | undefined): StoredPublisherKit<T>;
|
|
2
|
+
export function makeStoredSubscriber<T extends import("@endo/marshal").PassableCap>(subscriber: Subscriber<T>, storageNode: ERef<StorageNode>, marshaller: ERef<ReturnType<typeof makeMarshal>>): StoredSubscriber<T>;
|
|
3
|
+
export function makeStoredSubscription<T>(subscription: Subscription<T>, storageNode?: ERef<StorageNode>, marshaller?: ERef<ReturnType<typeof makeMarshal>>): StoredSubscription<T>;
|
|
4
|
+
export function makeStoredPublisherKit<T = unknown>(storageNode?: ERef<StorageNode>, marshaller?: ERef<Marshaller>, childPath?: string): StoredPublisherKit<T>;
|
|
10
5
|
export function makeStoredPublishKit<T = unknown>(storageNode: ERef<StorageNode>, marshaller: ERef<Marshaller>): StoredPublishKit<T>;
|
|
11
6
|
export type StoredPublisherKit<T> = {
|
|
12
7
|
subscriber: StoredSubscription<T>;
|
|
13
8
|
publisher: IterationObserver<T>;
|
|
14
9
|
};
|
|
15
|
-
import {
|
|
10
|
+
import type { Subscriber } from '../src/types.js';
|
|
11
|
+
import type { StorageNode } from '@agoric/internal/src/lib-chainStorage.js';
|
|
12
|
+
import type { ERef } from '@endo/far';
|
|
13
|
+
import { makeMarshal } from '@endo/marshal';
|
|
14
|
+
import type { StoredSubscriber } from '../src/types.js';
|
|
15
|
+
import type { Subscription } from '../src/types.js';
|
|
16
|
+
import type { StoredSubscription } from '../src/types.js';
|
|
17
|
+
import type { Marshaller } from '@agoric/internal/src/lib-chainStorage.js';
|
|
18
|
+
import type { StoredPublishKit } from '../src/types.js';
|
|
19
|
+
import type { IterationObserver } from '../src/types.js';
|
|
16
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":"AAuBO,yCAJM,CAAC,cACH,WAAW,CAAC,CAAC,gBACb,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,iBAcxB;AAiBM,qCAN4C,CAAC,SAAvC,OAAQ,eAAe,EAAE,WAAY,cACvC,WAAW,CAAC,CAAC,eACb,KAAK,WAAW,CAAC,cACjB,KAAK,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,GAClC,iBAAiB,CAAC,CAAC,CA6B/B;AAkBM,uCANM,CAAC,gBACH,aAAa,CAAC,CAAC,gBACf,KAAK,WAAW,CAAC,eACjB,KAAK,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,GAClC,mBAAmB,CAAC,CAAC,CAqEjC;AAoBM,uCANO,CAAC,0BACJ,KAAK,WAAW,CAAC,eACjB,KAAK,UAAU,CAAC,cAChB,MAAM,GACJ,kBAAkB,CAAC,CAAC,CAAC,CAoBjC;AAgBM,qCALO,CAAC,yBACJ,KAAK,WAAW,CAAC,cACjB,KAAK,UAAU,CAAC,GACd,iBAAiB,CAAC,CAAC,CAU/B;+BAzDY,CAAC;gBAEA,mBAAmB,CAAC,CAAC;eACrB,kBAAkB,CAAC,CAAC;;gCAjKmL,iBAAiB;iCAC9K,0CAA0C;0BAF3E,WAAW;4BATN,eAAe;sCAU0K,iBAAiB;kCAAjB,iBAAiB;wCAAjB,iBAAiB;gCAC9K,0CAA0C;sCADmH,iBAAiB;uCAAjB,iBAAiB"}
|
package/src/storesub.js
CHANGED
|
@@ -7,9 +7,16 @@ import { makePublishKit } from './publish-kit.js';
|
|
|
7
7
|
import { makeSubscriptionKit } from './subscriber.js';
|
|
8
8
|
import { subscribeEach } from './subscribe.js';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @import {ERef} from '@endo/far';
|
|
12
|
+
* @import {IterationObserver, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, StoredPublishKit, StoredSubscription, StoredSubscriber, Subscriber, Subscription, UpdateRecord} from '../src/types.js';
|
|
13
|
+
* @import {Marshaller, StorageNode, Unserializer} from '@agoric/internal/src/lib-chainStorage.js';
|
|
14
|
+
*/
|
|
15
|
+
|
|
10
16
|
/**
|
|
11
17
|
* NB: does not yet survive upgrade https://github.com/Agoric/agoric-sdk/issues/6893
|
|
12
18
|
*
|
|
19
|
+
* @alpha
|
|
13
20
|
* @template T
|
|
14
21
|
* @param {Subscriber<T>} subscriber
|
|
15
22
|
* @param {(v: T) => void} consumeValue
|
|
@@ -20,11 +27,9 @@ export const forEachPublicationRecord = async (subscriber, consumeValue) => {
|
|
|
20
27
|
const iterator = subscribeEach(subscriber)[Symbol.asyncIterator]();
|
|
21
28
|
|
|
22
29
|
let finished = false;
|
|
30
|
+
await null;
|
|
23
31
|
while (!finished) {
|
|
24
|
-
// Allow nested awaits (in loop) because it's safe for each to run in a turn
|
|
25
|
-
// eslint-disable-next-line no-await-in-loop, @jessie.js/no-nested-await
|
|
26
32
|
const { value, done } = await iterator.next();
|
|
27
|
-
// eslint-disable-next-line no-await-in-loop, @jessie.js/no-nested-await
|
|
28
33
|
await consumeValue(value);
|
|
29
34
|
finished = !!done;
|
|
30
35
|
}
|
|
@@ -39,7 +44,7 @@ export const forEachPublicationRecord = async (subscriber, consumeValue) => {
|
|
|
39
44
|
* the iteration themselves, or obtain information to subscribe to the stored
|
|
40
45
|
* data out-of-band.
|
|
41
46
|
*
|
|
42
|
-
* @template T
|
|
47
|
+
* @template {import('@endo/marshal').PassableCap} T
|
|
43
48
|
* @param {Subscriber<T>} subscriber
|
|
44
49
|
* @param {ERef<StorageNode>} storageNode
|
|
45
50
|
* @param {ERef<ReturnType<typeof makeMarshal>>} marshaller
|
|
@@ -98,7 +103,7 @@ export const makeStoredSubscription = (
|
|
|
98
103
|
serializeBodyFormat: 'smallcaps',
|
|
99
104
|
}),
|
|
100
105
|
) => {
|
|
101
|
-
/** @type {Unserializer} */
|
|
106
|
+
/** @type {import('@agoric/internal/src/lib-chainStorage.js').Unserializer} */
|
|
102
107
|
const unserializer = Far('unserializer', {
|
|
103
108
|
fromCapData: data => E(marshaller).fromCapData(data),
|
|
104
109
|
unserialize: data => E(marshaller).fromCapData(data),
|
package/src/subscribe.d.ts
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
export function subscribe<T>(itP: ERef<AsyncIterableIterator<T>>): {
|
|
2
2
|
[Symbol.asyncIterator]: () => {
|
|
3
|
-
[Symbol.asyncIterator]: () => any & import("@endo/eventual-send").RemotableBrand<{}, any>;
|
|
3
|
+
[Symbol.asyncIterator]: () => /*elided*/ any & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, /*elided*/ any>;
|
|
4
4
|
next: () => Promise<IteratorResult<T, any>>;
|
|
5
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
6
|
-
[Symbol.asyncIterator]: () => any & import("@endo/eventual-send").RemotableBrand<{}, any>;
|
|
5
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
6
|
+
[Symbol.asyncIterator]: () => /*elided*/ any & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, /*elided*/ any>;
|
|
7
7
|
next: () => Promise<IteratorResult<T, any>>;
|
|
8
8
|
}>;
|
|
9
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
9
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
10
10
|
[Symbol.asyncIterator]: () => {
|
|
11
|
-
[Symbol.asyncIterator]: () => any & import("@endo/eventual-send").RemotableBrand<{}, any>;
|
|
11
|
+
[Symbol.asyncIterator]: () => /*elided*/ any & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, /*elided*/ any>;
|
|
12
12
|
next: () => Promise<IteratorResult<T, any>>;
|
|
13
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
14
|
-
[Symbol.asyncIterator]: () => any & import("@endo/eventual-send").RemotableBrand<{}, any>;
|
|
13
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
14
|
+
[Symbol.asyncIterator]: () => /*elided*/ any & import("@endo/pass-style").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
|
-
[Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T
|
|
20
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
21
|
-
[Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T
|
|
19
|
+
[Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T>;
|
|
20
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
21
|
+
[Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T>;
|
|
22
22
|
}>;
|
|
23
23
|
export function subscribeLatest<T>(topic: ERef<LatestTopic<T>>): {
|
|
24
|
-
[Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T
|
|
25
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
26
|
-
[Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T
|
|
24
|
+
[Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T>;
|
|
25
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
26
|
+
[Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T>;
|
|
27
27
|
}>;
|
|
28
|
+
import type { ERef } from '@endo/far';
|
|
29
|
+
import type { EachTopic } from '../src/types.js';
|
|
30
|
+
import type { ForkableAsyncIterableIterator } from '../src/types.js';
|
|
31
|
+
import type { LatestTopic } from '../src/types.js';
|
|
28
32
|
//# sourceMappingURL=subscribe.d.ts.map
|
package/src/subscribe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["subscribe.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["subscribe.js"],"names":[],"mappings":"AAqEO,0BAHM,CAAC,OACH,KAAK,qBAAqB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;GAYrC;AAuEG,8BAHM,CAAC,SACH,KAAK,UAAU,CAAC,CAAC,CAAC;;;;GAU5B;AAsGM,gCAHM,CAAC,SACH,KAAK,YAAY,CAAC,CAAC,CAAC;;;;GAO9B;0BAnQsB,WAAW;+BAC6N,iBAAiB;mDAAjB,iBAAiB;iCAAjB,iBAAiB"}
|
package/src/subscribe.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { X, Fail, annotateError } from '@endo/errors';
|
|
1
2
|
import { E, Far } from '@endo/far';
|
|
2
|
-
import {
|
|
3
|
+
import { isPrimitive } from '@endo/marshal';
|
|
3
4
|
import { isUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @import {ERef} from '@endo/far';
|
|
8
|
+
* @import {IterationObserver, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, StoredPublishKit, StoredSubscription, StoredSubscriber, Subscriber, Subscription, UpdateRecord, EachTopic, ForkableAsyncIterableIterator} from '../src/types.js';
|
|
9
|
+
*/
|
|
6
10
|
|
|
7
|
-
const { details: X, Fail } = assert;
|
|
8
11
|
const sink = () => {};
|
|
9
12
|
|
|
10
13
|
/**
|
|
@@ -24,7 +27,6 @@ const reconnectAsNeeded = async (getter, seed = []) => {
|
|
|
24
27
|
for (let i = 0; ; i += 1) {
|
|
25
28
|
try {
|
|
26
29
|
const resultP = i < seed.length ? seed[i] : getter();
|
|
27
|
-
// eslint-disable-next-line no-await-in-loop, @jessie.js/no-nested-await
|
|
28
30
|
const result = await resultP;
|
|
29
31
|
return result;
|
|
30
32
|
} catch (err) {
|
|
@@ -44,14 +46,14 @@ const reconnectAsNeeded = async (getter, seed = []) => {
|
|
|
44
46
|
// if `err` is an (Error) object, we can try to associate it with
|
|
45
47
|
// information about the disconnection that prompted the request
|
|
46
48
|
// for which it is a result.
|
|
47
|
-
if (
|
|
49
|
+
if (!isPrimitive(err) && disconnection && disconnection !== err) {
|
|
48
50
|
try {
|
|
49
|
-
|
|
51
|
+
annotateError(
|
|
50
52
|
err,
|
|
51
53
|
X`Attempting to recover from disconnection: ${disconnection}`,
|
|
52
54
|
);
|
|
53
55
|
} catch (_err) {
|
|
54
|
-
//
|
|
56
|
+
// noop
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
throw err;
|