@agoric/notifier 0.6.2 → 0.6.3-calypso-dev-84eb287.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/exported.js CHANGED
@@ -1,3 +1,2 @@
1
- // @jessie-check
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.2",
3
+ "version": "0.6.3-calypso-dev-84eb287.0+84eb287",
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": ">=14.15.0"
8
+ "node": "^18.12 || ^20.9"
9
9
  },
10
10
  "scripts": {
11
11
  "build": "exit 0",
12
- "prepack": "echo \"export {}; \" | cat - src/types-ambient.js > src/types.js && tsc --build jsconfig.build.json",
13
- "postpack": "git clean -f '*.d.ts*' src/types.js",
12
+ "prepack": "tsc --build tsconfig.build.json",
13
+ "postpack": "git clean -f '*.d.ts*'",
14
14
  "test": "ava",
15
15
  "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
16
16
  "test:xs": "exit 0",
17
17
  "lint-fix": "yarn lint:eslint --fix",
18
18
  "lint": "run-s --continue-on-error lint:*",
19
19
  "lint:eslint": "eslint .",
20
- "lint:types": "tsc -p jsconfig.json"
20
+ "lint:types": "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/assert": "^0.6.0",
37
- "@agoric/internal": "^0.3.2",
38
- "@agoric/store": "^0.9.2",
39
- "@agoric/swing-store": "^0.9.1",
40
- "@agoric/swingset-vat": "^0.32.2",
41
- "@agoric/vat-data": "^0.5.2",
42
- "@endo/far": "^0.2.18",
43
- "@endo/marshal": "^0.8.5",
44
- "@endo/promise-kit": "^0.2.56"
36
+ "@agoric/assert": "0.6.1-calypso-dev-84eb287.0+84eb287",
37
+ "@agoric/internal": "0.3.3-calypso-dev-84eb287.0+84eb287",
38
+ "@agoric/vat-data": "0.5.3-calypso-dev-84eb287.0+84eb287",
39
+ "@endo/far": "^1.1.2",
40
+ "@endo/marshal": "^1.5.0",
41
+ "@endo/patterns": "^1.4.0",
42
+ "@endo/promise-kit": "^1.1.2"
45
43
  },
46
44
  "devDependencies": {
47
- "@endo/init": "^0.5.56",
48
- "@endo/ses-ava": "^0.2.40",
49
- "ava": "^5.2.0",
50
- "c8": "^7.13.0"
45
+ "@agoric/kmarshal": "0.1.1-calypso-dev-84eb287.0+84eb287",
46
+ "@agoric/swing-store": "0.9.2-calypso-dev-84eb287.0+84eb287",
47
+ "@agoric/swingset-liveslots": "0.10.3-calypso-dev-84eb287.0+84eb287",
48
+ "@agoric/swingset-vat": "0.32.3-calypso-dev-84eb287.0+84eb287",
49
+ "@endo/init": "^1.1.2",
50
+ "@endo/ses-ava": "^1.2.2",
51
+ "ava": "^5.3.0",
52
+ "c8": "^9.1.0"
51
53
  },
52
54
  "exports": {
53
55
  ".": "./src/index.js",
@@ -66,9 +68,15 @@
66
68
  },
67
69
  "ava": {
68
70
  "files": [
69
- "test/**/test-*.js"
71
+ "test/**/*.test.*"
72
+ ],
73
+ "require": [
74
+ "@endo/init/debug.js"
70
75
  ],
71
76
  "timeout": "2m"
72
77
  },
73
- "gitHead": "b66bf7c881ae462fcb617cd6e8d41b5c40ec58ef"
78
+ "typeCoverage": {
79
+ "atLeast": 90.34
80
+ },
81
+ "gitHead": "84eb287915c8255d68e845a9b6e10c790f0d54cb"
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, undefined>;
34
- } & import("@endo/eventual-send").RemotableBrand<{}, {
35
- [Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T_1, T_1, undefined>;
37
+ [Symbol.asyncIterator]: () => import("../src/types.js").ForkableAsyncIterableIterator<T_1, T_1>;
38
+ } & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
39
+ [Symbol.asyncIterator]: () => import("../src/types.js").ForkableAsyncIterableIterator<T_1, T_1>;
36
40
  }>;
37
- export function observeIterator<T_1>(asyncIteratorP: ERef<AsyncIterator<T_1, any, undefined>>, iterationObserver: Partial<IterationObserver<T_1>>): Promise<undefined>;
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":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH;;;;GAA6D;AAatD,oJAFM,QAAQ,SAAS,CAAC,CAyB9B;AAaM,qIAFM,QAAQ,SAAS,CAAC,CAK9B;AAaM,6HAFM,QAAQ,SAAS,CAAC,CAGkC"}
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
- import './types-ambient.js';
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.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 -- doesn't know types
32
+ export * from './types.js';
package/src/notifier.d.ts CHANGED
@@ -2,4 +2,8 @@ export function makeNotifier<T>(sharableInternalsP: ERef<LatestTopic<T>>): Notif
2
2
  export function makeNotifierFromSubscriber<T>(subscriber: ERef<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 { NotifierRecord } from './types.js';
5
9
  //# sourceMappingURL=notifier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notifier.d.ts","sourceRoot":"","sources":["notifier.js"],"names":[],"mappings":"AAcO,uFAsBN;AAOM,4FAeN;AAoBM,oFAoBN;AAcM,sGAqEN"}
1
+ {"version":3,"file":"notifier.d.ts","sourceRoot":"","sources":["notifier.js"],"names":[],"mappings":"AAiBO,6BAJM,CAAC,sBACH,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,GAClB,SAAS,CAAC,CAAC,CAwBvB;AAOM,2CAJM,CAAC,cACH,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GACjB,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;oCAAZ,YAAY"}
package/src/notifier.js CHANGED
@@ -1,12 +1,15 @@
1
- /// <reference types="ses"/>
1
+ /// <reference types="ses" />
2
2
 
3
3
  import { assert } from '@agoric/assert';
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 {LatestTopic, Notifier, NotifierRecord, PublishKit, Subscriber, UpdateRecord} from './types.js';
11
+ */
12
+
10
13
  /**
11
14
  * @template T
12
15
  * @param {ERef<LatestTopic<T>>} sharableInternalsP
@@ -1,27 +1,34 @@
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
- export const IterableEachTopicI: import("@endo/patterns").InterfaceGuard;
10
- export const IterableLatestTopicI: import("@endo/patterns").InterfaceGuard;
15
+ export const ForkableAsyncIterableIteratorShape: import("@endo/patterns").InterfaceGuard<{
16
+ fork: import("@endo/patterns").MethodGuard;
17
+ [Symbol.asyncIterator]: import("@endo/patterns").MethodGuard;
18
+ next: import("@endo/patterns").MethodGuard;
19
+ }>;
20
+ export const IterableEachTopicI: import("@endo/patterns").InterfaceGuard<{
21
+ subscribeAfter: import("@endo/patterns").MethodGuard;
22
+ [Symbol.asyncIterator]: import("@endo/patterns").MethodGuard;
23
+ }>;
24
+ export const IterableLatestTopicI: import("@endo/patterns").InterfaceGuard<{
25
+ getUpdateSince: import("@endo/patterns").MethodGuard;
26
+ [Symbol.asyncIterator]: import("@endo/patterns").MethodGuard;
27
+ }>;
11
28
  export function makePublishKit<T>(): PublishKit<T>;
12
- export function prepareDurablePublishKit(baggage: MapStore<string, unknown>, kindName: string): (options?: {
29
+ export function prepareDurablePublishKit(baggage: import("@agoric/swingset-liveslots").Baggage, kindName: string): (options?: {
13
30
  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<{}, {
31
+ } | undefined) => import("@endo/exo").GuardedKit<{
25
32
  publisher: {
26
33
  publish(value: any): void;
27
34
  finish(finalValue: any): void;
@@ -50,4 +57,6 @@ export type DurablePublishKitEphemeralData = {
50
57
  */
51
58
  tailR: ((value: any) => void) | undefined;
52
59
  };
60
+ import type { PublishKit } from '../src/types.js';
61
+ import type { Publisher } from '../src/types.js';
53
62
  //# sourceMappingURL=publish-kit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"publish-kit.d.ts","sourceRoot":"","sources":["publish-kit.js"],"names":[],"mappings":"AAqBA,iEAIG;AAGH,gEAA6D;AAC7D,kEAGG;;;;;AAMH,yFAOE;AAEF,yEAKG;AAEH,2EAKG;AA+CI,mDA0FN;AA6MM,uFAFI,MAAM;;;;;;;;;;;;;;;;;;;;;;GA2EhB;AAGD,+DAAyD;4CAlP3C,cAAY;;;;;;cASZ,YAAU,GAAG,SAAS;;;;WAEtB,YAAU;;;;;oBACD,GAAG,KAAK,IAAI"}
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;AA6MM,kDAHI,OAAO,4BAA4B,EAAE,OAAO,YAC5C,MAAM;;yBA/JwB,WACzC;;;;;;;;;;GAyOC;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;;gCAnPsI,iBAAiB;+BAAjB,iBAAiB"}
@@ -1,11 +1,14 @@
1
- /// <reference types="ses"/>
1
+ /// <reference types="ses" />
2
2
 
3
- import { makePromiseKit } from '@endo/promise-kit';
4
- import { E, Far } from '@endo/far';
5
- import { M } from '@agoric/store';
6
3
  import { canBeDurable, prepareExoClassKit } from '@agoric/vat-data';
4
+ import { E, Far } from '@endo/far';
5
+ import { M, getInterfaceGuardPayload } from '@endo/patterns';
6
+ import { makePromiseKit } from '@endo/promise-kit';
7
7
 
8
- import './types-ambient.js';
8
+ /**
9
+ * @import {ERef} from '@endo/far';
10
+ * @import {DurablePublishKitState, DurablePublishKitValueDurability, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, Subscriber, UpdateRecord} from '../src/types.js';
11
+ */
9
12
 
10
13
  const { Fail, quote: q } = assert;
11
14
 
@@ -46,14 +49,16 @@ export const ForkableAsyncIterableIteratorShape = M.interface(
46
49
  );
47
50
 
48
51
  export const IterableEachTopicI = M.interface('IterableEachTopic', {
49
- subscribeAfter: SubscriberI.methodGuards.subscribeAfter,
52
+ subscribeAfter:
53
+ getInterfaceGuardPayload(SubscriberI).methodGuards.subscribeAfter,
50
54
  [Symbol.asyncIterator]: M.call().returns(
51
55
  M.remotable('ForkableAsyncIterableIterator'),
52
56
  ),
53
57
  });
54
58
 
55
59
  export const IterableLatestTopicI = M.interface('IterableLatestTopic', {
56
- getUpdateSince: SubscriberI.methodGuards.getUpdateSince,
60
+ getUpdateSince:
61
+ getInterfaceGuardPayload(SubscriberI).methodGuards.getUpdateSince,
57
62
  [Symbol.asyncIterator]: M.call().returns(
58
63
  M.remotable('ForkableAsyncIterableIterator'),
59
64
  ),
@@ -209,7 +214,7 @@ const DurablePublishKitStateShape = harden({
209
214
 
210
215
  /**
211
216
  * @param {object} [options]
212
- * @param {DurablePublishKitValueDurability & 'mandatory'} [options.valueDurability='mandatory']
217
+ * @param {DurablePublishKitValueDurability & 'mandatory'} [options.valueDurability]
213
218
  * @returns {DurablePublishKitState}
214
219
  */
215
220
  const initDurablePublishKitState = (options = {}) => {
@@ -396,7 +401,7 @@ const advanceDurablePublishKit = (context, value, targetStatus = 'live') => {
396
401
  };
397
402
 
398
403
  /**
399
- * @param {import('../../vat-data/src/types.js').Baggage} baggage
404
+ * @param {import('@agoric/swingset-liveslots').Baggage} baggage
400
405
  * @param {string} kindName
401
406
  */
402
407
  export const prepareDurablePublishKit = (baggage, kindName) => {
@@ -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, 'getStoreKey'>;
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":"AA2BO,gFAJI,KAAK,WAAW,CAAC,cACjB,KAAK,UAAU,CAAC,qBAkC1B;gCAjDY,aAAa,CAAC,CAAC,GAAG,KAAK,WAAW,EAAE,aAAa,CAAC"}
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"}
@@ -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,30 @@
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>;
2
+ export function makeStoredSubscriber<T extends import("@endo/marshal").PassableCap>(subscriber: Subscriber<T>, storageNode: ERef<StorageNode>, marshaller: ERef<ReturnType<typeof makeMarshal>>): StoredSubscriber<T>;
3
3
  export function makeStoredSubscription<T>(subscription: Subscription<T>, storageNode?: ERef<StorageNode> | undefined, marshaller?: ERef<{
4
- toCapData: import("@endo/marshal/src/marshal.js").ToCapData<unknown>;
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>;
4
+ toCapData: import("@endo/marshal").ToCapData<unknown>;
5
+ fromCapData: import("@endo/marshal").FromCapData<unknown>;
6
+ serialize: import("@endo/marshal").ToCapData<unknown>;
7
+ unserialize: import("@endo/marshal").FromCapData<unknown>;
8
8
  }> | undefined): StoredSubscription<T>;
9
- export function makeStoredPublisherKit<T = unknown>(storageNode?: ERef<StorageNode> | undefined, marshaller?: ERef<Marshaller<unknown>> | undefined, childPath?: string | undefined): StoredPublisherKit<T>;
9
+ export function makeStoredPublisherKit<T = unknown>(storageNode?: ERef<StorageNode> | undefined, marshaller?: ERef<{
10
+ toCapData: import("@endo/marshal").ToCapData<unknown>;
11
+ fromCapData: import("@endo/marshal").FromCapData<unknown>;
12
+ serialize: import("@endo/marshal").ToCapData<unknown>;
13
+ unserialize: import("@endo/marshal").FromCapData<unknown>;
14
+ }> | undefined, childPath?: string | undefined): StoredPublisherKit<T>;
10
15
  export function makeStoredPublishKit<T = unknown>(storageNode: ERef<StorageNode>, marshaller: ERef<Marshaller>): StoredPublishKit<T>;
11
16
  export type StoredPublisherKit<T> = {
12
17
  subscriber: StoredSubscription<T>;
13
18
  publisher: IterationObserver<T>;
14
19
  };
15
- import { makeMarshal } from "@endo/marshal";
20
+ import type { Subscriber } from '../src/types.js';
21
+ import type { StorageNode } from '@agoric/internal/src/lib-chainStorage.js';
22
+ import type { ERef } from '@endo/far';
23
+ import { makeMarshal } from '@endo/marshal';
24
+ import type { StoredSubscriber } from '../src/types.js';
25
+ import type { Subscription } from '../src/types.js';
26
+ import type { StoredSubscription } from '../src/types.js';
27
+ import type { Marshaller } from '@agoric/internal/src/lib-chainStorage.js';
28
+ import type { StoredPublishKit } from '../src/types.js';
29
+ import type { IterationObserver } from '../src/types.js';
16
30
  //# sourceMappingURL=storesub.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"storesub.d.ts","sourceRoot":"","sources":["storesub.js"],"names":[],"mappings":"AAgBO,+FAFc,IAAI,iBAgBxB;AAiBM,gFAJI,KAAK,WAAW,CAAC,cACjB,KAAK,WAAW,kBAAkB,CAAC,CAAC,uBA8B9C;AAkBM;;;;;uCAmEN;AAoBM,4MAkBN;AAgBM,+DAJI,KAAK,WAAW,CAAC,cACjB,KAAK,UAAU,CAAC,uBAW1B;;gBAvDa,mBAAmB,CAAC,CAAC;eACrB,kBAAkB,CAAC,CAAC"}
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;;;;;iBAGb,mBAAmB,CAAC,CAAC,CAqEjC;AAoBM,uCANO,CAAC;;;;;iDAIF,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),
@@ -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]: () => any & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, 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/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
6
+ [Symbol.asyncIterator]: () => any & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, any>;
7
7
  next: () => Promise<IteratorResult<T, any>>;
8
8
  }>;
9
- } & import("@endo/eventual-send").RemotableBrand<{}, {
9
+ } & import("@endo/marshal").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]: () => any & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, 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/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
14
+ [Symbol.asyncIterator]: () => any & import("@endo/marshal").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
- [Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T, undefined>;
20
- } & import("@endo/eventual-send").RemotableBrand<{}, {
21
- [Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T, undefined>;
19
+ [Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T>;
20
+ } & import("@endo/marshal").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, undefined>;
25
- } & import("@endo/eventual-send").RemotableBrand<{}, {
26
- [Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T, undefined>;
24
+ [Symbol.asyncIterator]: () => ForkableAsyncIterableIterator<T, T>;
25
+ } & import("@endo/marshal").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
@@ -1 +1 @@
1
- {"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["subscribe.js"],"names":[],"mappings":"AAmEO;;;;;;;;;;;;;;;;GAUH;AAuEG;;;;GAQN;AAsGM;;;;GAKN"}
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;0BApQsB,WAAW;+BAC6N,iBAAiB;mDAAjB,iBAAiB;iCAAjB,iBAAiB"}
package/src/subscribe.js CHANGED
@@ -2,7 +2,10 @@ import { E, Far } from '@endo/far';
2
2
  import { isObject } from '@endo/marshal';
3
3
  import { isUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js';
4
4
 
5
- import './types-ambient.js';
5
+ /**
6
+ * @import {ERef} from '@endo/far';
7
+ * @import {IterationObserver, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, StoredPublishKit, StoredSubscription, StoredSubscriber, Subscriber, Subscription, UpdateRecord, EachTopic, ForkableAsyncIterableIterator} from '../src/types.js';
8
+ */
6
9
 
7
10
  const { details: X, Fail } = assert;
8
11
  const sink = () => {};
@@ -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) {
@@ -51,7 +53,7 @@ const reconnectAsNeeded = async (getter, seed = []) => {
51
53
  X`Attempting to recover from disconnection: ${disconnection}`,
52
54
  );
53
55
  } catch (_err) {
54
- // eslint-disable-next-line no-empty
56
+ // noop
55
57
  }
56
58
  }
57
59
  throw err;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @import {EachTopic, IterationObserver, LatestTopic, Notifier, NotifierRecord, SubscriptionRecord, Publisher, PublishKit, StoredPublishKit, StoredSubscription, StoredSubscriber, Subscriber, Subscription, UpdateRecord} from '../src/types.js';
3
+ */
1
4
  /**
2
5
  * @template T
3
6
  * @param {ERef<EachTopic<T>>} topic
@@ -23,4 +26,7 @@ export function makeSubscription<T>(topic: ERef<EachTopic<T>>): Subscription<T>;
23
26
  * @returns {SubscriptionRecord<T>}
24
27
  */
25
28
  export function makeSubscriptionKit<T>(): SubscriptionRecord<T>;
29
+ import type { EachTopic } from '../src/types.js';
30
+ import type { Subscription } from '../src/types.js';
31
+ import type { SubscriptionRecord } from '../src/types.js';
26
32
  //# sourceMappingURL=subscriber.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"subscriber.d.ts","sourceRoot":"","sources":["subscriber.js"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,gFAgBC;AAID;;;;;;;;;;;;;;;;;GAiBG;AACH,gEAiBC"}
1
+ {"version":3,"file":"subscriber.d.ts","sourceRoot":"","sources":["subscriber.js"],"names":[],"mappings":"AAUA;;GAEG;AAEH;;;;GAIG;AACH,iCAJa,CAAC,SACH,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAChB,aAAa,CAAC,CAAC,CAkB3B;AAID;;;;;;;;;;;;;;;;;GAiBG;AACH,oCAHa,CAAC,KACD,mBAAmB,CAAC,CAAC,CAmBjC;+BA/DgO,iBAAiB;kCAAjB,iBAAiB;wCAAjB,iBAAiB"}
package/src/subscriber.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @jessie-check
2
2
 
3
- /// <reference types="ses"/>
3
+ /// <reference types="ses" />
4
4
 
5
5
  import { E, Far } from '@endo/far';
6
6
  import { subscribeEach } from './subscribe.js';
@@ -8,7 +8,9 @@ import { makePublishKit } from './publish-kit.js';
8
8
 
9
9
  import { makePinnedHistoryTopic } from './topic.js';
10
10
 
11
- import './types-ambient.js';
11
+ /**
12
+ * @import {EachTopic, IterationObserver, LatestTopic, Notifier, NotifierRecord, SubscriptionRecord, Publisher, PublishKit, StoredPublishKit, StoredSubscription, StoredSubscriber, Subscriber, Subscription, UpdateRecord} from '../src/types.js';
13
+ */
12
14
 
13
15
  /**
14
16
  * @template T
package/src/topic.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export function makePinnedHistoryTopic<T>(topic: EachTopic<T> & LatestTopic<T>): EachTopic<T> & LatestTopic<T>;
2
+ import type { EachTopic } from '../src/types.js';
3
+ import type { LatestTopic } from '../src/types.js';
2
4
  //# sourceMappingURL=topic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"topic.d.ts","sourceRoot":"","sources":["topic.js"],"names":[],"mappings":"AAcO,+GAkBN"}
1
+ {"version":3,"file":"topic.d.ts","sourceRoot":"","sources":["topic.js"],"names":[],"mappings":"AAiBO,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
@@ -1,7 +1,10 @@
1
1
  // @jessie-check
2
2
 
3
3
  import { Far } from '@endo/far';
4
- import './types-ambient.js';
4
+
5
+ /**
6
+ * @import {EachTopic, LatestTopic} from '../src/types.js';
7
+ */
5
8
 
6
9
  /**
7
10
  * @deprecated A pinned-history topic preserves all of its published values in
@@ -9,7 +12,7 @@ import './types-ambient.js';
9
12
  *
10
13
  * @template T
11
14
  * @param {EachTopic<T> & LatestTopic<T>} topic needs to be near in order to
12
- * preserve subscription timings. TODO: drop LatestTopic<T> requirement
15
+ * preserve subscription timings. TODO: drop `LatestTopic<T>` requirement
13
16
  * @returns {EachTopic<T> & LatestTopic<T>}
14
17
  */
15
18
  export const makePinnedHistoryTopic = topic => {