@agoric/notifier 0.6.3-upgrade-14-dev-c8f9e7b.0 → 0.6.3-upgrade-16-fi-dev-8879538.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.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
3
+ "version": "0.6.3-upgrade-16-fi-dev-8879538.0+8879538",
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.1-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
37
- "@agoric/internal": "0.4.0-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
38
- "@agoric/store": "0.9.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
39
- "@agoric/swing-store": "0.9.2-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
40
- "@agoric/swingset-vat": "0.32.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
41
- "@agoric/vat-data": "0.5.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
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-upgrade-16-fi-dev-8879538.0+8879538",
37
+ "@agoric/internal": "0.3.3-upgrade-16-fi-dev-8879538.0+8879538",
38
+ "@agoric/vat-data": "0.5.3-upgrade-16-fi-dev-8879538.0+8879538",
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-upgrade-16-fi-dev-8879538.0+8879538",
46
+ "@agoric/swing-store": "0.9.2-upgrade-16-fi-dev-8879538.0+8879538",
47
+ "@agoric/swingset-liveslots": "0.10.3-upgrade-16-fi-dev-8879538.0+8879538",
48
+ "@agoric/swingset-vat": "0.32.3-upgrade-16-fi-dev-8879538.0+8879538",
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": "c8f9e7be1645e0be23f47de197409a7d4874add5"
78
+ "typeCoverage": {
79
+ "atLeast": 90.34
80
+ },
81
+ "gitHead": "8879538cd1d125a08346f02dd5701d0d70c90bb8"
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
41
  export function observeIterator<T_1>(asyncIteratorP: ERef<AsyncIterator<T_1, any, undefined>>, 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,gCAH8B,GAAC,iHACzB,OAAO,CAAC,SAAS,CAAC,CAyB9B;AAaM,iCAH8B,GAAC,iGACzB,OAAO,CAAC,SAAS,CAAC,CAK9B;AAaM,gCAH8B,GAAC,0FACzB,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
@@ -1,5 +1,9 @@
1
- export function makeNotifier<T>(sharableInternalsP: ERef<LatestTopic<T>>): Notifier<T>;
2
- export function makeNotifierFromSubscriber<T>(subscriber: ERef<Subscriber<T>>): Notifier<T>;
1
+ export function makeNotifier<T>(sharableInternalsP: globalThis.ERef<LatestTopic<T>>): Notifier<T>;
2
+ export function makeNotifierFromSubscriber<T>(subscriber: globalThis.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,6BAFe,CAAC,oEAwBtB;AAOM,2CAFe,CAAC,2DAiBtB;AAoBM,gCAFqB,CAAC,sBADlB,EAAE,GAAG,CACY,CAAC,AADX,CAAC,qBAuBlB;AAcM,8CAFe,CAAC,kBADZ,IAAI,CAAC,aAAa,CACP,CAAC,AADQ,CAAC,CAAC,eAwEhC;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;
@@ -33,7 +40,11 @@ export function prepareDurablePublishKit(baggage: MapStore<string, unknown>, kin
33
40
  };
34
41
  }>;
35
42
  export const SubscriberShape: import("@endo/patterns").Matcher;
36
- export type DurablePublishKitEphemeralKey = Publisher<any>;
43
+ export type DurablePublishKitEphemeralKey = {
44
+ publish: (nonFinalValue: any) => void;
45
+ finish: (completion: any) => void;
46
+ fail: (reason: any) => void;
47
+ };
37
48
  export type DurablePublishKitEphemeralData = {
38
49
  /**
39
50
  * The current-result promise
@@ -50,4 +61,5 @@ export type DurablePublishKitEphemeralData = {
50
61
  */
51
62
  tailR: ((value: any) => void) | undefined;
52
63
  };
64
+ import type { PublishKit } from '../src/types.js';
53
65
  //# 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,+BAFiB,CAAC,mBA4FxB;AA6MM,kDAHI,OAAO,4BAA4B,EAAE,OAAO,YAC5C,MAAM;;;;;;;;;;;;GA2EhB;AAGD,+DAAyD;;;;;;;;;;;cAzO3C,OAAO,KAAG,GAAG,SAAS;;;;WAEtB,OAAO,KAAG;;;;;WACV,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG,SAAS;;gCAnPsI,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,39 @@
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<{
2
+ /**
3
+ * @import {ERef} from '@endo/far';
4
+ * @import {BaseNotifier, Notifier} from './types.js';
5
+ * @import {Marshaller, StoredFacet, StorageNode, Unserializer} from '@agoric/internal/src/lib-chainStorage.js';
6
+ * @import {PassableCap, RemotableObject} from '@endo/pass-style';
7
+ */
8
+ /**
9
+ * @template T
10
+ * @typedef {BaseNotifier<T> & Omit<StoredFacet, 'getStoreKey'>} StoredNotifier
11
+ */
12
+ /**
13
+ * Begin iterating the source, storing serialized iteration values. If the
14
+ * storageNode's `setValue` operation rejects, no further writes to it will
15
+ * be attempted (but results will remain available from the subscriber).
16
+ *
17
+ * Returns a StoredNotifier that can be used by a client to directly follow
18
+ * the iteration themselves, or obtain information to subscribe to the stored
19
+ * data out-of-band.
20
+ *
21
+ * @template {PassableCap} T
22
+ * @param {ERef<Notifier<T>>} notifier
23
+ * @param {ERef<StorageNode>} storageNode
24
+ * @param {ERef<Marshaller>} marshaller
25
+ * @returns {StoredNotifier<T>}
26
+ */
27
+ toCapData: import("@endo/marshal").ToCapData<unknown>;
28
+ fromCapData: import("@endo/marshal").FromCapData<unknown>;
29
+ serialize: import("@endo/marshal").ToCapData<unknown>;
30
+ unserialize: import("@endo/marshal").FromCapData<unknown>;
31
+ }>): StoredNotifier<T>;
32
+ export type StoredNotifier<T> = BaseNotifier<T> & Omit<StoredFacet, "getStoreKey">;
33
+ import type { PassableCap } from '@endo/pass-style';
34
+ import type { Notifier } from './types.js';
35
+ import type { ERef } from '@endo/far';
36
+ import type { StorageNode } from '@agoric/internal/src/lib-chainStorage.js';
37
+ import type { BaseNotifier } from './types.js';
38
+ import type { StoredFacet } from '@agoric/internal/src/lib-chainStorage.js';
3
39
  //# 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,mCAFqB,CAAC;IAzB7B;;;;;OAKG;IAEH;;;OAGG;IAEH;;;;;;;;;;;;;;OAcG;;;;;KADU,cAAc,CAAC,CAAC,CAAC,CAiC7B;2BAjDyB,CAAC;iCALoB,kBAAkB;8BAFxB,YAAY;0BAD9B,WAAW;iCAEmC,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,39 @@
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<{
3
+ toCapData: import("@endo/marshal").ToCapData<unknown>;
4
+ fromCapData: import("@endo/marshal").FromCapData<unknown>;
5
+ serialize: import("@endo/marshal").ToCapData<unknown>;
6
+ unserialize: import("@endo/marshal").FromCapData<unknown>;
7
+ }>): StoredSubscriber<T>;
3
8
  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>;
9
+ toCapData: import("@endo/marshal").ToCapData<unknown>;
10
+ fromCapData: import("@endo/marshal").FromCapData<unknown>;
11
+ serialize: import("@endo/marshal").ToCapData<unknown>;
12
+ unserialize: import("@endo/marshal").FromCapData<unknown>;
8
13
  }> | undefined): StoredSubscription<T>;
9
- export function makeStoredPublisherKit<T = unknown>(storageNode?: ERef<StorageNode> | undefined, marshaller?: ERef<Marshaller<unknown>> | undefined, childPath?: string | undefined): StoredPublisherKit<T>;
10
- export function makeStoredPublishKit<T = unknown>(storageNode: ERef<StorageNode>, marshaller: ERef<Marshaller>): StoredPublishKit<T>;
14
+ export function makeStoredPublisherKit<T = unknown>(storageNode?: ERef<StorageNode> | undefined, marshaller?: ERef<{
15
+ toCapData: import("@endo/marshal").ToCapData<unknown>;
16
+ fromCapData: import("@endo/marshal").FromCapData<unknown>;
17
+ serialize: import("@endo/marshal").ToCapData<unknown>;
18
+ unserialize: import("@endo/marshal").FromCapData<unknown>;
19
+ }> | undefined, childPath?: string | undefined): StoredPublisherKit<T>;
20
+ export function makeStoredPublishKit<T = unknown>(storageNode: ERef<StorageNode>, marshaller: ERef<{
21
+ toCapData: import("@endo/marshal").ToCapData<unknown>;
22
+ fromCapData: import("@endo/marshal").FromCapData<unknown>;
23
+ serialize: import("@endo/marshal").ToCapData<unknown>;
24
+ unserialize: import("@endo/marshal").FromCapData<unknown>;
25
+ }>): StoredPublishKit<T>;
11
26
  export type StoredPublisherKit<T> = {
12
27
  subscriber: StoredSubscription<T>;
13
28
  publisher: IterationObserver<T>;
14
29
  };
15
- import { makeMarshal } from "@endo/marshal";
30
+ import type { Subscriber } from '../src/types.js';
31
+ import type { StorageNode } from '@agoric/internal/src/lib-chainStorage.js';
32
+ import type { ERef } from '@endo/far';
33
+ import { makeMarshal } from '@endo/marshal';
34
+ import type { StoredSubscriber } from '../src/types.js';
35
+ import type { Subscription } from '../src/types.js';
36
+ import type { StoredSubscription } from '../src/types.js';
37
+ import type { StoredPublishKit } from '../src/types.js';
38
+ import type { IterationObserver } from '../src/types.js';
16
39
  //# 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,yCAFQ,CAAC,2CAAL,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,iBAcxB;AAiBM,qCAFuB,CAAC;;;;;yBA6B9B;AAkBM,uCAFyB,CAAC;;;;;uCAqEhC;AAoBM,uCAFyB,CAAC;;;;;iDAApB,kBAAkB,CAAC,CAAC,CAAC,CAoBjC;AAgBM,qCAFuB,CAAC;;;;;yBAU9B;+BAtD+B,CAAC;;;;gCAjKoL,iBAAiB;iCAC9K,0CAA0C;0BAF3E,WAAW;4BATN,eAAe;sCAU0K,iBAAiB;kCAAjB,iBAAiB;wCAAjB,iBAAiB;sCAAjB,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,0BAF+B,CAAC;;;;;;;;;;;;;;;;GAYnC;AAuEG,8BAFmB,CAAC;;;;GAU1B;AAsGM,gCAFqB,CAAC;;;;GAO5B;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,9 +1,12 @@
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
4
7
  * @returns {Subscription<T>}
5
8
  */
6
- export function makeSubscription<T>(topic: ERef<EachTopic<T>>): Subscription<T>;
9
+ export function makeSubscription<T>(topic: globalThis.ERef<EachTopic<T>>): Subscription<T>;
7
10
  /**
8
11
  * @deprecated Producers should use
9
12
  * ```js
@@ -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,iCAF0B,CAAC,yDAkB1B;AAID;;;;;;;;;;;;;;;;;GAiBG;AACH,oCAFgC,CAAC,2BAmBhC;+BA/DgO,iBAAiB;kCAAjB,iBAAiB;wCAAjB,iBAAiB"}