@agoric/internal 0.3.3-other-dev-fbe72e7.0.fbe72e7 → 0.3.3-other-dev-d15096d.0.d15096d
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 -4
- package/package.json +7 -5
- package/src/batched-deliver.d.ts +6 -2
- package/src/batched-deliver.d.ts.map +1 -1
- package/src/batched-deliver.js +7 -2
- package/src/callback.d.ts +9 -11
- package/src/callback.d.ts.map +1 -1
- package/src/callback.js +16 -10
- package/src/config.d.ts +19 -0
- package/src/config.d.ts.map +1 -1
- package/src/config.js +21 -0
- package/src/debug.d.ts +4 -1
- package/src/debug.d.ts.map +1 -1
- package/src/debug.js +26 -13
- package/src/index.d.ts +1 -1
- package/src/index.js +9 -1
- package/src/js-utils.d.ts +6 -2
- package/src/js-utils.d.ts.map +1 -1
- package/src/js-utils.js +23 -1
- package/src/lib-chainStorage.d.ts +23 -12
- package/src/lib-chainStorage.d.ts.map +1 -1
- package/src/lib-chainStorage.js +18 -18
- package/src/lib-nodejs/spawnSubprocessWorker.d.ts +0 -2
- package/src/lib-nodejs/spawnSubprocessWorker.d.ts.map +1 -1
- package/src/lib-nodejs/spawnSubprocessWorker.js +5 -3
- package/src/lib-nodejs/waitUntilQuiescent.d.ts +3 -0
- package/src/lib-nodejs/waitUntilQuiescent.d.ts.map +1 -1
- package/src/lib-nodejs/waitUntilQuiescent.js +5 -1
- package/src/marshal/board-client-utils.d.ts +19 -0
- package/src/marshal/board-client-utils.d.ts.map +1 -0
- package/src/{marshal.js → marshal/board-client-utils.js} +27 -52
- package/src/marshal/cap-data.d.ts +3 -0
- package/src/marshal/cap-data.d.ts.map +1 -0
- package/src/marshal/cap-data.js +20 -0
- package/src/marshal/inaccessible-val.d.ts +2 -0
- package/src/marshal/inaccessible-val.d.ts.map +1 -0
- package/src/marshal/inaccessible-val.js +15 -0
- package/src/marshal/pure-data.d.ts +8 -0
- package/src/marshal/pure-data.d.ts.map +1 -0
- package/src/marshal/pure-data.js +14 -0
- package/src/marshal/wrap-marshaller.d.ts +33 -0
- package/src/marshal/wrap-marshaller.d.ts.map +1 -0
- package/src/marshal/wrap-marshaller.js +439 -0
- package/src/natural-sort.d.ts.map +1 -1
- package/src/natural-sort.js +47 -12
- package/src/node/buffer-line-transform.d.ts +10 -5
- package/src/node/buffer-line-transform.d.ts.map +1 -1
- package/src/node/buffer-line-transform.js +8 -4
- package/src/node/fs-stream.d.ts +4 -1
- package/src/node/fs-stream.d.ts.map +1 -1
- package/src/node/fs-stream.js +8 -6
- package/src/node/shutdown.d.ts.map +1 -1
- package/src/node/shutdown.js +2 -0
- package/src/priority-senders.d.ts +2 -1
- package/src/priority-senders.d.ts.map +1 -1
- package/src/priority-senders.js +6 -4
- package/src/ses-utils.d.ts +15 -4
- package/src/ses-utils.d.ts.map +1 -1
- package/src/ses-utils.js +112 -14
- package/src/storage-test-utils.d.ts +13 -3
- package/src/storage-test-utils.d.ts.map +1 -1
- package/src/storage-test-utils.js +61 -7
- package/src/typeGuards.d.ts +6 -2
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +5 -1
- package/src/types.d.ts +18 -17
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +22 -18
- package/src/work-pool.d.ts +13 -0
- package/src/work-pool.d.ts.map +1 -0
- package/src/work-pool.js +233 -0
- package/src/marshal.d.ts +0 -33
- package/src/marshal.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @type {(namespace: string) => string} */
|
|
2
2
|
export const normalizeSenderNamespace: (namespace: string) => string;
|
|
3
|
-
export function makePrioritySendersManager(sendersNode: ERef<
|
|
3
|
+
export function makePrioritySendersManager(sendersNode: ERef<StorageNode>): {
|
|
4
4
|
/**
|
|
5
5
|
* @param {string} rawNamespace
|
|
6
6
|
* @param {string} address
|
|
@@ -28,5 +28,6 @@ export function makePrioritySendersManager(sendersNode: ERef<import("./lib-chain
|
|
|
28
28
|
remove: (rawNamespace: string, address: string) => Promise<void>;
|
|
29
29
|
}>;
|
|
30
30
|
export type PrioritySendersManager = ReturnType<typeof makePrioritySendersManager>;
|
|
31
|
+
import type { StorageNode } from './lib-chainStorage.js';
|
|
31
32
|
import type { ERef } from '@endo/far';
|
|
32
33
|
//# sourceMappingURL=priority-senders.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priority-senders.d.ts","sourceRoot":"","sources":["priority-senders.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"priority-senders.d.ts","sourceRoot":"","sources":["priority-senders.js"],"names":[],"mappings":"AAUA,4CAA4C;AAC5C,uCADW,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAMtC;AAQK,wDAFI,KAAK,WAAW,CAAC;IA0CxB;;;;OAIG;wBAHQ,MAAM,WACN,MAAM,KACJ,OAAO,CAAC,IAAI,CAAC;IAe1B;;;;OAIG;2BAHQ,MAAM,WACN,MAAM,KACJ,OAAO,CAAC,IAAI,CAAC;;IArB1B;;;;OAIG;wBAHQ,MAAM,WACN,MAAM,KACJ,OAAO,CAAC,IAAI,CAAC;IAe1B;;;;OAIG;2BAHQ,MAAM,WACN,MAAM,KACJ,OAAO,CAAC,IAAI,CAAC;GAuB7B;qCAGa,UAAU,CAAC,OAAO,0BAA0B,CAAC;iCA1G7B,uBAAuB;0BAD9B,WAAW"}
|
package/src/priority-senders.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Fail, q } from '@endo/errors';
|
|
2
2
|
import { E, Far } from '@endo/far';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @import {ERef} from '@endo/far';
|
|
6
|
+
* @import {StorageNode} from './lib-chainStorage.js';
|
|
7
|
+
*/
|
|
6
8
|
|
|
7
9
|
const PRIORITY_SENDERS_NAMESPACE_RE = /^[a-zA-Z0-9_-]{1,50}$/;
|
|
8
10
|
|
|
@@ -18,7 +20,7 @@ harden(normalizeSenderNamespace);
|
|
|
18
20
|
/**
|
|
19
21
|
* XXX lets holder manage sender list for all namespaces
|
|
20
22
|
*
|
|
21
|
-
* @param {ERef<
|
|
23
|
+
* @param {ERef<StorageNode>} sendersNode
|
|
22
24
|
*/
|
|
23
25
|
export const makePrioritySendersManager = sendersNode => {
|
|
24
26
|
/**
|
|
@@ -35,7 +37,7 @@ export const makePrioritySendersManager = sendersNode => {
|
|
|
35
37
|
/**
|
|
36
38
|
* Write a list of namespaces into a storage node.
|
|
37
39
|
*
|
|
38
|
-
* @param {
|
|
40
|
+
* @param {StorageNode} node
|
|
39
41
|
* @param {Set<string>} namespaces
|
|
40
42
|
*/
|
|
41
43
|
const refreshVstorage = (node, namespaces) => {
|
package/src/ses-utils.d.ts
CHANGED
|
@@ -18,9 +18,11 @@ export function makeLimitedConsole(makeLogger: (level: string) => (...args: unkn
|
|
|
18
18
|
* @template T
|
|
19
19
|
* @typedef {T extends PromiseLike<any>
|
|
20
20
|
* ? Awaited<T>
|
|
21
|
-
* : T extends
|
|
22
|
-
* ?
|
|
23
|
-
* :
|
|
21
|
+
* : T extends RemotableBrand<any, any> | RemotableObject
|
|
22
|
+
* ? T
|
|
23
|
+
* : T extends {}
|
|
24
|
+
* ? Simplify<DeeplyAwaitedObject<T>>
|
|
25
|
+
* : Awaited<T>} DeeplyAwaited
|
|
24
26
|
*/
|
|
25
27
|
/**
|
|
26
28
|
* A more constrained version of {deeplyFulfilled} for type safety until
|
|
@@ -30,6 +32,12 @@ export function makeLimitedConsole(makeLogger: (level: string) => (...args: unkn
|
|
|
30
32
|
* @type {<T extends {}>(unfulfilledTerms: T) => Promise<DeeplyAwaited<T>>}
|
|
31
33
|
*/
|
|
32
34
|
export const deeplyFulfilledObject: <T extends {}>(unfulfilledTerms: T) => Promise<DeeplyAwaited<T>>;
|
|
35
|
+
export function stripPrefix(prefix: string, str: string): string;
|
|
36
|
+
export function throwErrorCode<Code extends string>(details: Parameters<typeof makeError>[0], code: Code, opts?: Parameters<typeof makeError>[2] & {
|
|
37
|
+
constructor?: Parameters<typeof makeError>[1];
|
|
38
|
+
}): never;
|
|
39
|
+
export function tryNow<F extends (...args: any[]) => any, U = ReturnType<F>>(fn: F, transformError: (err: Error) => U, ...args: Parameters<F>): ReturnType<F> | U;
|
|
40
|
+
export function tryJsonParse(jsonText: string, onError: string | ((err: Error) => unknown)): any;
|
|
33
41
|
export function PromiseAllOrErrors<T>(items: readonly (T | PromiseLike<T>)[]): Promise<T[]>;
|
|
34
42
|
export function aggregateTryFinally<T>(trier: () => Promise<T>, finalizer: (error?: unknown) => Promise<unknown>): ReturnType<() => Promise<T>>;
|
|
35
43
|
export function withDeferredCleanup<T>(fn: (addCleanup: (fn: (err?: unknown) => Promise<void>) => void) => Promise<T>): ReturnType<(addCleanup: (fn: (err?: unknown) => Promise<void>) => void) => Promise<T>>;
|
|
@@ -55,14 +63,17 @@ export function synchronizedTee<T = unknown>(sourceStream: AsyncIterator<T, void
|
|
|
55
63
|
export type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
|
|
56
64
|
export type Callable = (...args: any[]) => any;
|
|
57
65
|
export type DeeplyAwaitedObject<T extends {}> = { [K in keyof T]: T[K] extends Callable ? T[K] : DeeplyAwaited<T[K]>; };
|
|
58
|
-
export type DeeplyAwaited<T> = T extends PromiseLike<any> ? Awaited<T> : T extends {} ? Simplify<DeeplyAwaitedObject<T>> : Awaited<T>;
|
|
66
|
+
export type DeeplyAwaited<T> = T extends PromiseLike<any> ? Awaited<T> : T extends RemotableBrand<any, any> | RemotableObject ? T : T extends {} ? Simplify<DeeplyAwaitedObject<T>> : Awaited<T>;
|
|
59
67
|
export type AllDefined<T extends Record<string, unknown>> = { [P in keyof T]: Exclude<T[P], undefined>; };
|
|
60
68
|
import { objectMap } from '@endo/common/object-map.js';
|
|
61
69
|
import { objectMetaMap } from '@endo/common/object-meta-map.js';
|
|
62
70
|
import { fromUniqueEntries } from '@endo/common/from-unique-entries.js';
|
|
63
71
|
import type { LimitedConsole } from './js-utils.js';
|
|
72
|
+
import { makeError } from '@endo/errors';
|
|
64
73
|
import type { Permit } from './types.js';
|
|
65
74
|
import type { Attenuated } from './types.js';
|
|
66
75
|
import type { ERef } from '@endo/far';
|
|
76
|
+
import type { RemotableBrand } from '@endo/eventual-send';
|
|
77
|
+
import type { RemotableObject } from '@endo/pass-style';
|
|
67
78
|
export { objectMap, objectMetaMap, fromUniqueEntries };
|
|
68
79
|
//# sourceMappingURL=ses-utils.d.ts.map
|
package/src/ses-utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ses-utils.d.ts","sourceRoot":"","sources":["ses-utils.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ses-utils.d.ts","sourceRoot":"","sources":["ses-utils.js"],"names":[],"mappings":"AAmCO,+CADK,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GAKvC,cAAc,CACjC;AAGD;;;;;GAKG;AAEH;;GAEG;AAEH;;;;;GAKG;AAEH;;;;;;;;;GASG;AAEH;;;;;;GAMG;AACH,oCAFU,CAAC,CAAC,SAAS,EAAE,EAAE,gBAAgB,EAAE,CAAC,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAKxE;AAwBK,oCAJI,MAAM,OACN,MAAM,GACJ,MAAM,CAKlB;AAeM,+BAPe,IAAI,SAAb,MAAQ,WACV,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,QAC/B,IAAI,SACJ,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG;IACxC,WAAW,CAAC,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/C,SAUH;AAkBM,uBATgC,CAAC,SAA3B,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAI,EACxB,CAAC,sBACJ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,GAChC,OAAO,CAAC,CAAC,CAAC;uBAkMgB,CAAC,SAA1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE,IACzB,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,GAAE;0BAjQ/B,4BAA4B;8BACxB,iCAAiC;kCAC7B,qCAAqC;oCAWtC,eAAe;0BAVQ,cAAc;4BAkBhC,YAAY;gCAAZ,YAAY;0BAH1B,WAAW;oCACD,qBAAqB;qCACT,kBAAkB"}
|
package/src/ses-utils.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { objectMap } from '@endo/common/object-map.js';
|
|
9
9
|
import { objectMetaMap } from '@endo/common/object-meta-map.js';
|
|
10
10
|
import { fromUniqueEntries } from '@endo/common/from-unique-entries.js';
|
|
11
|
-
import { q, Fail, makeError, annotateError, X } from '@endo/errors';
|
|
11
|
+
import { q, b, Fail, makeError, annotateError, X } from '@endo/errors';
|
|
12
12
|
import { deeplyFulfilled, isPrimitive } from '@endo/pass-style';
|
|
13
13
|
import { makePromiseKit } from '@endo/promise-kit';
|
|
14
14
|
import { makeQueue } from '@endo/stream';
|
|
@@ -17,10 +17,15 @@ import { makeQueue } from '@endo/stream';
|
|
|
17
17
|
import { asyncGenerate } from 'jessie.js';
|
|
18
18
|
import { logLevels } from './js-utils.js';
|
|
19
19
|
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* @import {LimitedConsole} from './js-utils.js';
|
|
22
|
+
* @import {AsyncQueue} from '@endo/stream';
|
|
23
|
+
* @import {PromiseKit} from '@endo/promise-kit';
|
|
24
|
+
*/
|
|
21
25
|
|
|
22
26
|
/** @import {ERef} from '@endo/far'; */
|
|
23
|
-
/** @import {
|
|
27
|
+
/** @import {RemotableBrand} from '@endo/eventual-send'; */
|
|
28
|
+
/** @import {Primitive, RemotableObject} from '@endo/pass-style'; */
|
|
24
29
|
/** @import {Permit, Attenuated} from './types.js'; */
|
|
25
30
|
|
|
26
31
|
export { objectMap, objectMetaMap, fromUniqueEntries };
|
|
@@ -58,9 +63,11 @@ harden(makeLimitedConsole);
|
|
|
58
63
|
* @template T
|
|
59
64
|
* @typedef {T extends PromiseLike<any>
|
|
60
65
|
* ? Awaited<T>
|
|
61
|
-
* : T extends
|
|
62
|
-
* ?
|
|
63
|
-
* :
|
|
66
|
+
* : T extends RemotableBrand<any, any> | RemotableObject
|
|
67
|
+
* ? T
|
|
68
|
+
* : T extends {}
|
|
69
|
+
* ? Simplify<DeeplyAwaitedObject<T>>
|
|
70
|
+
* : Awaited<T>} DeeplyAwaited
|
|
64
71
|
*/
|
|
65
72
|
|
|
66
73
|
/**
|
|
@@ -90,6 +97,101 @@ const makeAggregateError =
|
|
|
90
97
|
});
|
|
91
98
|
};
|
|
92
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Assert that a string has a prefix, and return the part that follows it.
|
|
102
|
+
*
|
|
103
|
+
* @param {string} prefix
|
|
104
|
+
* @param {string} str
|
|
105
|
+
* @returns {string}
|
|
106
|
+
*/
|
|
107
|
+
export const stripPrefix = (prefix, str) => {
|
|
108
|
+
str.startsWith(prefix) || Fail`${str} is missing prefix ${q(prefix)}`;
|
|
109
|
+
return str.slice(prefix.length);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Throw an error with an own "code" data property, supporting identification
|
|
114
|
+
* without parsing `message`. Note that such errors are not Passable and thus
|
|
115
|
+
* cannot appear inside a Passable structure, and even at top level the "code"
|
|
116
|
+
* property will be silently dropped by marshalling.
|
|
117
|
+
*
|
|
118
|
+
* @template {string} Code
|
|
119
|
+
* @param {Parameters<typeof makeError>[0]} details
|
|
120
|
+
* @param {Code} code
|
|
121
|
+
* @param {Parameters<typeof makeError>[2] & {
|
|
122
|
+
* constructor?: Parameters<typeof makeError>[1];
|
|
123
|
+
* }} [opts]
|
|
124
|
+
*/
|
|
125
|
+
export const throwErrorCode = (details, code, opts) => {
|
|
126
|
+
const err = makeError(details, opts?.constructor, {
|
|
127
|
+
...opts,
|
|
128
|
+
sanitize: false,
|
|
129
|
+
});
|
|
130
|
+
Object.defineProperty(err, 'code', { value: code, enumerable: true });
|
|
131
|
+
harden(err);
|
|
132
|
+
throw err;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Synchronusly invoke a function with the opportunity to handle any error
|
|
137
|
+
* similarly to a Promise `catch` callback (e.g., substituting a non-error
|
|
138
|
+
* returned value or throwing a possibly-new error). This is useful for (among
|
|
139
|
+
* other things) replacing generic error messages with specific ones (as in
|
|
140
|
+
* {@see tryJsonParse}).
|
|
141
|
+
*
|
|
142
|
+
* @template {(...args: any[]) => any} F
|
|
143
|
+
* @template [U=ReturnType<F>]
|
|
144
|
+
* @param {F} fn to invoke
|
|
145
|
+
* @param {(err: Error) => U} transformError callback to receive any error from
|
|
146
|
+
* invoking `fn` and either return a substitute value or throw a potentially
|
|
147
|
+
* new error
|
|
148
|
+
* @param {Parameters<F>} args for `fn`
|
|
149
|
+
* @returns {ReturnType<F> | U}
|
|
150
|
+
*/
|
|
151
|
+
export const tryNow = (fn, transformError, ...args) => {
|
|
152
|
+
try {
|
|
153
|
+
return fn(...args);
|
|
154
|
+
} catch (err) {
|
|
155
|
+
try {
|
|
156
|
+
return transformError(err);
|
|
157
|
+
} catch (newErr) {
|
|
158
|
+
// Try to associate `err` with `newErr`.
|
|
159
|
+
if (!newErr.cause) {
|
|
160
|
+
const desc = {
|
|
161
|
+
value: err,
|
|
162
|
+
configurable: true,
|
|
163
|
+
enumerable: false,
|
|
164
|
+
writable: true,
|
|
165
|
+
};
|
|
166
|
+
if (!Reflect.defineProperty(newErr, 'cause', desc)) {
|
|
167
|
+
assert.note(newErr, err.message);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
throw newErr;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Parse JSON text, or handle an error by e.g. substituting a default value or
|
|
177
|
+
* replacing it with one bearing a non-generic message.
|
|
178
|
+
*
|
|
179
|
+
* @param {string} jsonText
|
|
180
|
+
* @param {string | ((err: Error) => unknown)} onError an error message or
|
|
181
|
+
* callback
|
|
182
|
+
*/
|
|
183
|
+
export const tryJsonParse = (jsonText, onError) => {
|
|
184
|
+
const transformError =
|
|
185
|
+
typeof onError === 'function'
|
|
186
|
+
? onError
|
|
187
|
+
: err => Fail([`${onError}: ${err.message} for input `, ''], jsonText);
|
|
188
|
+
return tryNow(() => {
|
|
189
|
+
const type = typeof jsonText;
|
|
190
|
+
type === 'string' || Fail`Input must be a string, not ${b(type)}`;
|
|
191
|
+
return JSON.parse(jsonText);
|
|
192
|
+
}, transformError);
|
|
193
|
+
};
|
|
194
|
+
|
|
93
195
|
/**
|
|
94
196
|
* @template T
|
|
95
197
|
* @param {readonly (T | PromiseLike<T>)[]} items
|
|
@@ -320,7 +422,7 @@ export const synchronizedTee = (sourceStream, readerCount) => {
|
|
|
320
422
|
* (value: PromiseLike<IteratorResult<T>>) => void
|
|
321
423
|
* >} QueuePayload
|
|
322
424
|
*/
|
|
323
|
-
/** @type {
|
|
425
|
+
/** @type {AsyncQueue<QueuePayload>[]} */
|
|
324
426
|
const queues = [];
|
|
325
427
|
|
|
326
428
|
/** @returns {Promise<void>} */
|
|
@@ -374,7 +476,7 @@ export const synchronizedTee = (sourceStream, readerCount) => {
|
|
|
374
476
|
};
|
|
375
477
|
|
|
376
478
|
const readers = Array.from({ length: readerCount }).map(() => {
|
|
377
|
-
/** @type {
|
|
479
|
+
/** @type {AsyncQueue<QueuePayload>} */
|
|
378
480
|
const queue = makeQueue();
|
|
379
481
|
queues.push(queue);
|
|
380
482
|
|
|
@@ -382,9 +484,7 @@ export const synchronizedTee = (sourceStream, readerCount) => {
|
|
|
382
484
|
const reader = harden({
|
|
383
485
|
async next() {
|
|
384
486
|
/**
|
|
385
|
-
* @type {
|
|
386
|
-
* IteratorResult<T>
|
|
387
|
-
* >}
|
|
487
|
+
* @type {PromiseKit<IteratorResult<T>>}
|
|
388
488
|
*/
|
|
389
489
|
const { promise, resolve } = makePromiseKit();
|
|
390
490
|
queue.put({ value: resolve, done: false });
|
|
@@ -392,9 +492,7 @@ export const synchronizedTee = (sourceStream, readerCount) => {
|
|
|
392
492
|
},
|
|
393
493
|
async return() {
|
|
394
494
|
/**
|
|
395
|
-
* @type {
|
|
396
|
-
* IteratorResult<T>
|
|
397
|
-
* >}
|
|
495
|
+
* @type {PromiseKit<IteratorResult<T>>}
|
|
398
496
|
*/
|
|
399
497
|
const { promise, resolve } = makePromiseKit();
|
|
400
498
|
queue.put({ value: resolve, done: true });
|
|
@@ -14,7 +14,16 @@ export namespace defaultSerializer {
|
|
|
14
14
|
let stringify: (obj: any) => string;
|
|
15
15
|
}
|
|
16
16
|
export const slotStringUnserialize: (capData: any) => any;
|
|
17
|
-
export function
|
|
17
|
+
export function makeAsyncQueue<T>(): {
|
|
18
|
+
enqueue: (data: T) => void;
|
|
19
|
+
iterable: {
|
|
20
|
+
[Symbol.asyncIterator](): AsyncGenerator<Awaited<T> | undefined, void, unknown>;
|
|
21
|
+
};
|
|
22
|
+
cancel: () => boolean;
|
|
23
|
+
};
|
|
24
|
+
export function makeFakeStorageKit(rootPath: string, rootOptions?: Parameters<typeof makeChainStorageRoot>[2], { eachMessage }?: {
|
|
25
|
+
eachMessage?: (m: StorageMessage) => void;
|
|
26
|
+
}): {
|
|
18
27
|
rootNode: import("@endo/exo").Guarded<{
|
|
19
28
|
getPath(): string;
|
|
20
29
|
getStoreKey(): Promise<VStorageKey>;
|
|
@@ -36,7 +45,7 @@ export function makeFakeStorageKit(rootPath: string, rootOptions?: Parameters<ty
|
|
|
36
45
|
} | null>;
|
|
37
46
|
};
|
|
38
47
|
export function makeMockChainStorageRoot(): MockChainStorageRoot;
|
|
39
|
-
export function documentStorageSchema(t:
|
|
48
|
+
export function documentStorageSchema(t: ExecutionContext<unknown>, storage: MockChainStorageRoot | FakeStorageKit, opts: ({
|
|
40
49
|
note: string;
|
|
41
50
|
} | {
|
|
42
51
|
node: string;
|
|
@@ -60,7 +69,8 @@ export type MockChainStorageRootMethods = {
|
|
|
60
69
|
};
|
|
61
70
|
export type MockChainStorageRoot = StorageNode & MockChainStorageRootMethods;
|
|
62
71
|
import { makeChainStorageRoot } from './lib-chainStorage.js';
|
|
63
|
-
import type { StorageNode } from './lib-chainStorage.js';
|
|
64
72
|
import type { StorageMessage } from './lib-chainStorage.js';
|
|
73
|
+
import type { StorageNode } from './lib-chainStorage.js';
|
|
74
|
+
import type { ExecutionContext } from 'ava';
|
|
65
75
|
import type { Marshaller } from './lib-chainStorage.js';
|
|
66
76
|
//# sourceMappingURL=storage-test-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-test-utils.d.ts","sourceRoot":"","sources":["storage-test-utils.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storage-test-utils.d.ts","sourceRoot":"","sources":["storage-test-utils.js"],"names":[],"mappings":"AA0BO,yCAHI,MAAM,UACN,MAAM,6GAGC;AAElB;;;GAGG;AACH;;;;;EAEG;;eAMU,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO;mBAEzB,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM;;AA8CjC,8CAtBuB,GAAG,KAAK,GAAG,CAsB+B;AAa1D,+BAFM,CAAC;oBASA,CAAC;;;;;EA6Bd;AAWM,6CAJI,MAAM,gBACN,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,oBAC1C;IAAE,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAA;CAAE;;;;;oBAwD3B,CAAC;;;;UA4FT,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;;sBAd3B,MAAM,KACJ,MAAM,EAAE;;0BA/FP,cAAc;;;8IAAd,cAAc;;;;EAkH7B;AAoBM,4CADO,oBAAoB,CA2BjC;AAUM,yCAPI,iBAAiB,OAAO,CAAC,WACzB,oBAAoB,GAAG,cAAc,QACrC,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GAC9D,CAAK;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,EAAE,CAAC,GAAG;IAChD,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;CACpC,iBAkDL;6BAtGa,UAAU,CAAC,OAAO,kBAAkB,CAAC;;;;;;;;aAIrC,CACT,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,UAAU,EACvB,KAAK,CAAC,EAAE,MAAM,KACX,OAAO;UAKD,MAAM,MAAM,EAAE;;mCAEd,WAAW,GAAG,2BAA2B;qCAxTJ,uBAAuB;oCAOU,uBAAuB;iCAAvB,uBAAuB;sCACxE,KAAK;gCAD4C,uBAAuB"}
|
|
@@ -5,13 +5,14 @@ import { makeMarshal, Remotable } from '@endo/marshal';
|
|
|
5
5
|
import { makeTracer } from './debug.js';
|
|
6
6
|
import { NonNullish } from './errors.js';
|
|
7
7
|
import { isStreamCell, makeChainStorageRoot } from './lib-chainStorage.js';
|
|
8
|
-
import { unmarshalFromVstorage } from './marshal.js';
|
|
8
|
+
import { unmarshalFromVstorage } from './marshal/board-client-utils.js';
|
|
9
9
|
import { bindAllMethods } from './method-tools.js';
|
|
10
10
|
import { eventLoopIteration } from './testing-utils.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @import {TotalMap} from './types.js';
|
|
14
14
|
* @import {Marshaller, StorageEntry, StorageMessage, StorageNode, StreamCell} from './lib-chainStorage.js';
|
|
15
|
+
* @import {ExecutionContext} from 'ava';
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
const trace = makeTracer('StorTU', false);
|
|
@@ -88,6 +89,55 @@ const makeSlotStringUnserialize = () => {
|
|
|
88
89
|
};
|
|
89
90
|
export const slotStringUnserialize = makeSlotStringUnserialize();
|
|
90
91
|
|
|
92
|
+
/**
|
|
93
|
+
* @example to iterate over storage messages
|
|
94
|
+
*
|
|
95
|
+
* ```js
|
|
96
|
+
* const q = makeAsyncQueue<StorageMessage>();
|
|
97
|
+
* const storage = makeFakeStorageKit('published', undefined, { eachMessage: q.enqueue });
|
|
98
|
+
* for (const message of q.iterable) { ... }
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* @template T
|
|
102
|
+
*/
|
|
103
|
+
export const makeAsyncQueue = () => {
|
|
104
|
+
/** @type {T[]} */
|
|
105
|
+
const queue = [];
|
|
106
|
+
/** @type {null | ((r: undefined) => void)} */
|
|
107
|
+
let resolve = null;
|
|
108
|
+
let done = false;
|
|
109
|
+
|
|
110
|
+
/** @param {T} data */
|
|
111
|
+
const enqueue = data => {
|
|
112
|
+
queue.push(data);
|
|
113
|
+
if (resolve) {
|
|
114
|
+
resolve(undefined);
|
|
115
|
+
resolve = null;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
let alreadyIterating = false;
|
|
120
|
+
const iterable = {
|
|
121
|
+
async *[Symbol.asyncIterator]() {
|
|
122
|
+
assert(!alreadyIterating, `AsyncQueue is already iterating`);
|
|
123
|
+
alreadyIterating = true;
|
|
124
|
+
await null;
|
|
125
|
+
while (!done) {
|
|
126
|
+
if (queue.length === 0) {
|
|
127
|
+
await new Promise(r => (resolve = r));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
while (queue.length > 0) {
|
|
131
|
+
yield queue.shift();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const cancel = () => (done = true);
|
|
138
|
+
return harden({ enqueue, iterable, cancel });
|
|
139
|
+
};
|
|
140
|
+
|
|
91
141
|
/**
|
|
92
142
|
* For testing, creates a chainStorage root node over an in-memory map and
|
|
93
143
|
* exposes both the map and the sequence of received messages. The `sequence`
|
|
@@ -95,8 +145,13 @@ export const slotStringUnserialize = makeSlotStringUnserialize();
|
|
|
95
145
|
*
|
|
96
146
|
* @param {string} rootPath
|
|
97
147
|
* @param {Parameters<typeof makeChainStorageRoot>[2]} [rootOptions]
|
|
148
|
+
* @param {{ eachMessage?: (m: StorageMessage) => void }} [spyOpts]
|
|
98
149
|
*/
|
|
99
|
-
export const makeFakeStorageKit = (
|
|
150
|
+
export const makeFakeStorageKit = (
|
|
151
|
+
rootPath,
|
|
152
|
+
rootOptions,
|
|
153
|
+
{ eachMessage } = {},
|
|
154
|
+
) => {
|
|
100
155
|
const resolvedOptions = { sequence: true, ...rootOptions };
|
|
101
156
|
/** @type {TotalMap<string, string>} */
|
|
102
157
|
const data = new Map();
|
|
@@ -133,6 +188,7 @@ export const makeFakeStorageKit = (rootPath, rootOptions) => {
|
|
|
133
188
|
/** @param {StorageMessage} message */
|
|
134
189
|
message => {
|
|
135
190
|
messages.push(message);
|
|
191
|
+
eachMessage?.(message);
|
|
136
192
|
switch (message.method) {
|
|
137
193
|
case 'getStoreKey': {
|
|
138
194
|
const [key] = message.args;
|
|
@@ -236,7 +292,7 @@ export const makeFakeStorageKit = (rootPath, rootOptions) => {
|
|
|
236
292
|
|
|
237
293
|
return {
|
|
238
294
|
rootNode,
|
|
239
|
-
|
|
295
|
+
|
|
240
296
|
data: /** @type {Map<string, string>} */ (data),
|
|
241
297
|
updateNewCellBlockHeight,
|
|
242
298
|
getValues,
|
|
@@ -281,9 +337,7 @@ export const makeMockChainStorageRoot = () => {
|
|
|
281
337
|
getBody: (path, marshaller = defaultMarshaller, index = -1) => {
|
|
282
338
|
data.size || Fail`no data in storage`;
|
|
283
339
|
/**
|
|
284
|
-
* @type {ReturnType<
|
|
285
|
-
* typeof import('@endo/marshal').makeMarshal
|
|
286
|
-
* >['fromCapData']}
|
|
340
|
+
* @type {ReturnType<typeof makeMarshal>['fromCapData']}
|
|
287
341
|
*/
|
|
288
342
|
const fromCapData = (...args) =>
|
|
289
343
|
Reflect.apply(marshaller.fromCapData, marshaller, args);
|
|
@@ -294,7 +348,7 @@ export const makeMockChainStorageRoot = () => {
|
|
|
294
348
|
};
|
|
295
349
|
|
|
296
350
|
/**
|
|
297
|
-
* @param {
|
|
351
|
+
* @param {ExecutionContext<unknown>} t
|
|
298
352
|
* @param {MockChainStorageRoot | FakeStorageKit} storage
|
|
299
353
|
* @param {({ note: string } | { node: string; owner: string }) &
|
|
300
354
|
* ({ pattern: string; replacement: string } | {}) & {
|
package/src/typeGuards.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {TypedPattern} from './types.js';
|
|
3
|
+
*/
|
|
1
4
|
export const StorageNodeShape: import("@endo/patterns").Matcher;
|
|
2
5
|
/** To be used only for 'helper' facets where the calls are from trusted code. */
|
|
3
6
|
export const UnguardedHelperI: import("@endo/patterns").InterfaceGuard<any>;
|
|
@@ -7,13 +10,14 @@ export const UnguardedHelperI: import("@endo/patterns").InterfaceGuard<any>;
|
|
|
7
10
|
* either a JS number or a stringified JS bigint.
|
|
8
11
|
*/
|
|
9
12
|
/**
|
|
10
|
-
* @type {
|
|
13
|
+
* @type {TypedPattern<BridgeBigInt>}
|
|
11
14
|
*/
|
|
12
|
-
export const BridgeBigIntShape:
|
|
15
|
+
export const BridgeBigIntShape: TypedPattern<BridgeBigInt>;
|
|
13
16
|
/**
|
|
14
17
|
* Ensure that callees passed a
|
|
15
18
|
* bridge message that was serialised from a Golang int64 or uint64 accept
|
|
16
19
|
* either a JS number or a stringified JS bigint.
|
|
17
20
|
*/
|
|
18
21
|
export type BridgeBigInt = number | `${bigint}`;
|
|
22
|
+
import type { TypedPattern } from './types.js';
|
|
19
23
|
//# sourceMappingURL=typeGuards.d.ts.map
|
package/src/typeGuards.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"AAKA,gEAA2D;AAE3D,iFAAiF;AACjF,4EAKE;AAEF;;;;GAIG;AAEH;;GAEG;AACH,gCAFU,
|
|
1
|
+
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"AAKA;;GAEG;AAEH,gEAA2D;AAE3D,iFAAiF;AACjF,4EAKE;AAEF;;;;GAIG;AAEH;;GAEG;AACH,gCAFU,aAAa,YAAY,CAAC,CAE0B;;;;;;2BARjD,MAAM,GAAG,GAAG,MAAM,EAAE;kCAdF,YAAY"}
|
package/src/typeGuards.js
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
import { M } from '@endo/patterns';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @import {TypedPattern} from './types.js';
|
|
8
|
+
*/
|
|
9
|
+
|
|
6
10
|
export const StorageNodeShape = M.remotable('StorageNode');
|
|
7
11
|
|
|
8
12
|
/** To be used only for 'helper' facets where the calls are from trusted code. */
|
|
@@ -20,6 +24,6 @@ export const UnguardedHelperI = M.interface(
|
|
|
20
24
|
*/
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
|
-
* @type {
|
|
27
|
+
* @type {TypedPattern<BridgeBigInt>}
|
|
24
28
|
*/
|
|
25
29
|
export const BridgeBigIntShape = M.or(M.number(), M.string());
|
package/src/types.d.ts
CHANGED
|
@@ -35,19 +35,19 @@ export declare class SyncCallback<I extends (...args: unknown[]) => any> extends
|
|
|
35
35
|
isSync: true;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
Returns a boolean for whether the given type is primitive value or
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
* Returns a boolean for whether the given type is a primitive value or
|
|
39
|
+
* primitive type.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```
|
|
43
|
+
* IsPrimitive<'string'>
|
|
44
|
+
* //=> true
|
|
45
|
+
*
|
|
46
|
+
* IsPrimitive<string>
|
|
47
|
+
* //=> true
|
|
48
|
+
*
|
|
49
|
+
* IsPrimitive<Object>
|
|
50
|
+
* //=> false
|
|
51
51
|
*/
|
|
52
52
|
export type IsPrimitive<T> = [T] extends [Primitive] ? true : false;
|
|
53
53
|
/** Recursively extract the non-callable properties of T */
|
|
@@ -61,9 +61,10 @@ export type DataOnly<T> = IsPrimitive<T> extends true ? T : T extends Callable ?
|
|
|
61
61
|
*/
|
|
62
62
|
export type Remote<Primary, Local = DataOnly<Primary>> = Primary | RemotableBrand<Local, Primary>;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* A type that accepts either resolved or promised references that may be either
|
|
65
|
+
* near or marshalled. @see {ERef} and @see {Remote}.
|
|
65
66
|
*/
|
|
66
|
-
export type
|
|
67
|
+
export type ERemote<Primary, Local = DataOnly<Primary>> = ERef<Remote<Primary, Local>>;
|
|
67
68
|
declare const validatedType: unique symbol;
|
|
68
69
|
/**
|
|
69
70
|
* Tag a pattern with the static type it represents.
|
|
@@ -78,8 +79,8 @@ export declare type PatternType<TM extends TypedPattern<any>> = TM extends Typed
|
|
|
78
79
|
*
|
|
79
80
|
* Note: remotables can only be matched as "remotable", not the specific kind.
|
|
80
81
|
*
|
|
81
|
-
* @see {
|
|
82
|
+
* @see {endoMustMatch} for the implementation. This one has a type annotation to narrow if the pattern is a TypedPattern.
|
|
82
83
|
*/
|
|
83
84
|
export declare type MustMatch = <P extends Pattern>(specimen: unknown, pattern: P, label?: string | number) => asserts specimen is P extends TypedPattern<any> ? PatternType<P> : unknown;
|
|
84
|
-
export {};
|
|
85
|
+
export type { TraceLogger } from './debug.js';
|
|
85
86
|
//# sourceMappingURL=types.d.ts.map
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,KAAK,EAA8B,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;GAGG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG;IACpD,6EAA6E;IAC7E,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,IAC9C,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAChB,IAAI,GACJ,MAAM,GACN,OAAO,CAAC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK;CAAE,CAAC,CAAC;AAEzE,MAAM,MA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QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAEhF;;;;GAIG;AACH,MAAM,MAAM,MAAM,CAAC,OAAO,EAAE,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,IACjD,OAAO,GACP,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAGnC;;;GAGG;AACH,MAAM,MAAM,OAAO,CAAC,OAAO,EAAE,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAC5D,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CACvB,CAAC;AAQF,OAAO,CAAC,MAAM,aAAa,EAAE,OAAO,MAAM,CAAC;AAC3C;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,OAAO,GAAG;IAAE,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC;AAEhE,MAAM,CAAC,OAAO,MAAM,WAAW,CAAC,EAAE,SAAS,YAAY,CAAC,GAAG,CAAC,IAC1D,EAAE,SAAS,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAG/C;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,MAAM,SAAS,GAAG,CAAC,CAAC,SAAS,OAAO,EAChD,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,CAAC,EACV,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,KACpB,OAAO,CAAC,QAAQ,IAAI,CAAC,SAAS,YAAY,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;AAEhF,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
package/src/types.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* eslint-disable max-classes-per-file */
|
|
2
2
|
import type { ERef, RemotableBrand } from '@endo/eventual-send';
|
|
3
3
|
import type { Primitive } from '@endo/pass-style';
|
|
4
|
-
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- used in JSDoc
|
|
5
|
+
import type { mustMatch as endoMustMatch, Pattern } from '@endo/patterns';
|
|
5
6
|
import type { Callable } from './ses-utils.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -57,19 +58,19 @@ export declare class SyncCallback<
|
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
/**
|
|
60
|
-
Returns a boolean for whether the given type is primitive value or
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
61
|
+
* Returns a boolean for whether the given type is a primitive value or
|
|
62
|
+
* primitive type.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```
|
|
66
|
+
* IsPrimitive<'string'>
|
|
67
|
+
* //=> true
|
|
68
|
+
*
|
|
69
|
+
* IsPrimitive<string>
|
|
70
|
+
* //=> true
|
|
71
|
+
*
|
|
72
|
+
* IsPrimitive<Object>
|
|
73
|
+
* //=> false
|
|
73
74
|
*/
|
|
74
75
|
export type IsPrimitive<T> = [T] extends [Primitive] ? true : false;
|
|
75
76
|
|
|
@@ -90,11 +91,12 @@ export type Remote<Primary, Local = DataOnly<Primary>> =
|
|
|
90
91
|
| Primary
|
|
91
92
|
| RemotableBrand<Local, Primary>;
|
|
92
93
|
|
|
93
|
-
// TODO: Add type tests for
|
|
94
|
+
// TODO: Add type tests for Remote and ERemote.
|
|
94
95
|
/**
|
|
95
|
-
*
|
|
96
|
+
* A type that accepts either resolved or promised references that may be either
|
|
97
|
+
* near or marshalled. @see {ERef} and @see {Remote}.
|
|
96
98
|
*/
|
|
97
|
-
export type
|
|
99
|
+
export type ERemote<Primary, Local = DataOnly<Primary>> = ERef<
|
|
98
100
|
Remote<Primary, Local>
|
|
99
101
|
>;
|
|
100
102
|
|
|
@@ -120,10 +122,12 @@ export declare type PatternType<TM extends TypedPattern<any>> =
|
|
|
120
122
|
*
|
|
121
123
|
* Note: remotables can only be matched as "remotable", not the specific kind.
|
|
122
124
|
*
|
|
123
|
-
* @see {
|
|
125
|
+
* @see {endoMustMatch} for the implementation. This one has a type annotation to narrow if the pattern is a TypedPattern.
|
|
124
126
|
*/
|
|
125
127
|
export declare type MustMatch = <P extends Pattern>(
|
|
126
128
|
specimen: unknown,
|
|
127
129
|
pattern: P,
|
|
128
130
|
label?: string | number,
|
|
129
131
|
) => asserts specimen is P extends TypedPattern<any> ? PatternType<P> : unknown;
|
|
132
|
+
|
|
133
|
+
export type { TraceLogger } from './debug.js';
|